code
stringlengths 3
1.01M
| repo_name
stringlengths 5
116
| path
stringlengths 3
311
| language
stringclasses 30
values | license
stringclasses 15
values | size
int64 3
1.01M
|
|---|---|---|---|---|---|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `MAP_LOCKED` constant in crate `libc`.">
<meta name="keywords" content="rust, rustlang, rust-lang, MAP_LOCKED">
<title>libc::consts::os::extra::MAP_LOCKED - Rust</title>
<link rel="stylesheet" type="text/css" href="../../../../main.css">
<link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<a href='../../../../libc/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='' width='100'></a>
<p class='location'><a href='../../../index.html'>libc</a>::<wbr><a href='../../index.html'>consts</a>::<wbr><a href='../index.html'>os</a>::<wbr><a href='index.html'>extra</a></p><script>window.sidebarCurrent = {name: 'MAP_LOCKED', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content constant">
<h1 class='fqn'><span class='in-band'><a href='../../../index.html'>libc</a>::<wbr><a href='../../index.html'>consts</a>::<wbr><a href='../index.html'>os</a>::<wbr><a href='index.html'>extra</a>::<wbr><a class='constant' href=''>MAP_LOCKED</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>−</span>]
</a>
</span><a id='src-850' class='srclink' href='../../../../src/libc/lib.rs.html#4083' title='goto source code'>[src]</a></span></h1>
<pre class='rust const'>pub const MAP_LOCKED: <a class='type' href='../../../../libc/types/os/arch/c95/type.c_int.html' title='libc::types::os::arch::c95::c_int'>c_int</a><code> = </code><code>0x02000</code></pre></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../../../";
window.currentCrate = "libc";
window.playgroundUrl = "https://play.rust-lang.org/";
</script>
<script src="../../../../jquery.js"></script>
<script src="../../../../main.js"></script>
<script src="../../../../playpen.js"></script>
<script async src="../../../../search-index.js"></script>
</body>
</html>
|
ssgrn/Rust-Matrix-Computations
|
target/doc/libc/consts/os/extra/constant.MAP_LOCKED.html
|
HTML
|
mit
| 4,514
|
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LeapHandController — Leap Motion Java SDK v3.1 documentation</title>
<link rel="stylesheet" href="../../cpp/_static/bootstrap-3.0.0/css/documentation-bundle.1471552333.css" type="text/css" />
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '3.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: false
};
</script>
<script type="text/javascript" src="../../cpp/_static/bootstrap-3.0.0/js/documentation-bundle.1471552333.js"></script>
<link rel="top" title="Leap Motion Java SDK v3.1 documentation" href="../index.html" />
<script type="text/javascript" src="/assets/standalone-header.js?r9"></script>
<link rel="stylesheet" href="/assets/standalone-header.css?r9" type="text/css" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-31536531-1']);
_gaq.push(['_setDomainName', 'leapmotion.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script>
function getQueryValue(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
var relPath = "../../";
var requestedAPI = getQueryValue("proglang");
if(requestedAPI == "current") requestedAPI = localStorage["currentAPI"];
var pageAPI = 'java';
var hasAPI = {};
hasAPI.unity = true;
if(requestedAPI && (requestedAPI != pageAPI))
{
if(pageAPI != 'none'){
var redirectedLocation = relPath + 'java/unity/Unity.Prefab.HandController.html';
if( requestedAPI == 'cpp' && hasAPI.cpp){
redirectedLocation = relPath + "cpp/unity/Unity.Prefab.HandController.html";
}
else if( requestedAPI == 'csharp' && hasAPI.csharp){
redirectedLocation = relPath + "csharp/unity/Unity.Prefab.HandController.html";
}
else if( requestedAPI == 'unity' && hasAPI.unity){
redirectedLocation = relPath + "unity/unity/Unity.Prefab.HandController.html";
}
else if( requestedAPI == 'objc' && hasAPI.objc){
redirectedLocation = relPath + "objc/unity/Unity.Prefab.HandController.html";
}
else if( requestedAPI == 'java' && hasAPI.java) {
redirectedLocation = relPath + "java/unity/Unity.Prefab.HandController.html";
}
else if( requestedAPI == 'javascript' && hasAPI.javascript){
redirectedLocation = relPath + "javascript/unity/Unity.Prefab.HandController.html";
}
else if( requestedAPI == 'python' && hasAPI.python){
redirectedLocation = relPath + "python/unity/Unity.Prefab.HandController.html";
}
else if( requestedAPI == 'unreal' && hasAPI.unreal) {
redirectedLocation = relPath + "unreal/unity/Unity.Prefab.HandController.html";
} else {
if( requestedAPI == 'cpp'){
redirectedLocation = relPath + "cpp/index.html?proglang=cpp";
}
else if( requestedAPI == 'csharp'){
redirectedLocation = relPath + "csharp/index.html?proglang=csharp";
}
else if( requestedAPI == 'unity'){
redirectedLocation = relPath + "unity/index.html?proglang=unity";
}
else if( requestedAPI == 'objc'){
redirectedLocation = relPath + "objc/index.html?proglang=objc";
}
else if( requestedAPI == 'java') {
redirectedLocation = relPath + "java/index.html?proglang=java";
}
else if( requestedAPI == 'javascript'){
redirectedLocation = relPath + "javascript/index.html?proglang=javascript";
}
else if( requestedAPI == 'python'){
redirectedLocation = relPath + "python/index.html?proglang=python";
}
else if( requestedAPI == 'unreal') {
redirectedLocation = relPath + "unreal/index.html?proglang=unreal";
} else {
redirectedLocation = relPath + "index.html";
}
}
//Guard against redirecting to the same page (infinitely)
if(relPath + 'java/unity/Unity.Prefab.HandController.html' != redirectedLocation) window.location.replace(redirectedLocation);
}
}
</script>
<script>
window.addEventListener('keyup', handleKeyInput);
function handleKeyInput(e)
{
var code;
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code);
if( character == "J" & e.altKey){ }
else if( character == "K" & e.altKey){
}
}
</script>
</head>
<body role="document">
<div class="developer-portal-styles">
<header class="navbar navbar-static-top developer-navbar header beta-header">
<nav class="container pr">
<a class="logo-link pull-left" href="/">
<img alt="Leap Motion Developers" class="media-object pull-left white-background" src="../_static/logo.png" />
</a>
<span class="inline-block hidden-phone developer-logo-text">
<div class="text">
<a href="/">
<span class="more-than-1199">Developer Portal</span>
</a>
</div>
</span>
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Everything within here will be hidden at 940px or less, accessible via a button. -->
<div class="nav-collapse">
<ul class="nav header-navigation developer-links">
<li class="external-link"><a href="https://developer.leapmotion.com/features">What's new</a> </li>
<li class="external-link"><a href="https://developer.leapmotion.com/downloads/skeletal-beta" class="">Getting Started</a></li>
<li><a class="active" href="#" class="">Documentation</a></li>
<li class="external-link"> <a href="https://developer.leapmotion.com/gallery" class="">Examples</a> </li>
<li class="external-link"> <a href="https://www.leapmotion.com/blog/category/labs/" class="" target="_blank">Blog <i class='fa fa-external-link'></i></a> </li>
<li class="external-link"> <a href="https://community.leapmotion.com/category/beta" class="" target="_blank">Community <i class='fa fa-external-link'></i></a> </li>
</ul>
</div>
</nav>
</header>
</div>
<section class="main-wrap">
<div data-swiftype-index="true">
<div class="second_navigation">
<div class="container">
<div class="row">
<div class="col-md-8">
<ul>
<li>
<a href="../../javascript/index.html?proglang=javascript" onclick="localStorage['currentAPI'] = 'javascript'">JavaScript</a>
</li>
<li>
<a href="../../unity/unity/Unity.Prefab.HandController.html?proglang=unity" onclick="localStorage['currentAPI'] = 'unity'">Unity</a>
</li>
<li>
<a href="../../csharp/index.html?proglang=csharp" onclick="localStorage['currentAPI'] = 'csharp'">C#</a>
</li>
<li>
<a href="../../cpp/index.html?proglang=cpp" onclick="localStorage['currentAPI'] = 'cpp'">C++</a>
</li>
<li>
Java
</li>
<li>
<a href="../../python/index.html?proglang=python" onclick="localStorage['currentAPI'] = 'python'">Python</a>
</li>
<li>
<a href="../../objc/index.html?proglang=objc" onclick="localStorage['currentAPI'] = 'objc'">Objective-C</a>
</li>
<li>
<a href="../../unreal/index.html?proglang=unreal" onclick="localStorage['currentAPI'] = 'unreal'">Unreal</a>
</li>
</ul>
</div>
<div class="col-md-4 search">
<script>
function storeThisPage(){
sessionStorage["pageBeforeSearch"] = window.location;
return true;
}
function doneWithSearch(){
var storedPage = sessionStorage["pageBeforeSearch"];
if(storedPage){
window.location = storedPage;
} else {
window.location = "index.html"; //fallback
}
return false;
}
</script>
<div style="margin-top:-4px">
<ul style="display:inline; white-space:nowrap"><li>
<form class="navbar-form" action="../search.html" method="get" onsubmit="storeThisPage()">
<div class="form-group">
<input type="search" results="5" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script>
//Remove dev portal header and footer when viewing from file system
if(window.location.protocol == 'file:'){
var navNode = document.querySelector(".developer-links");
navNode.parentNode.removeChild(navNode);
}
</script>
<div id="wrap" data-spy="scroll" data-target="#sidebar">
<div class="container">
<div class="row">
<div class="col-md-9 pull-right">
<!--
<span id="breadcrumbs">
<a href="../index.html">Home</a>»
LeapHandController
</span> -->
<div class="section" id="leaphandcontroller">
<h1>LeapHandController<a class="headerlink" href="#leaphandcontroller" title="Permalink to this headline">¶</a></h1>
<p>The LeapHandController prefab queries the Leap Motion service for tracking data and uses it to place hands in the scene. The tracking data from the service is transformed relative to the prefab’s position and orientation in the scene. The scripts in the controller manage the hand objects that represent the physical hands detected by the Leap Motion device.</p>
<div class="section" id="using-the-leaphandcontroller-prefab">
<h2>Using the LeapHandController Prefab<a class="headerlink" href="#using-the-leaphandcontroller-prefab" title="Permalink to this headline">¶</a></h2>
<p>To add the LeapHandController to a VR scene, it is easiest to use the LMHeadMountedRig prefab, which already contains a LeapHandController prefab. Otherwise, see <a class="reference internal" href="Unity_Custom_Rig.html"><em>Building a Custom VR Rig</em></a> for tips on building a custom VR camera rig.</p>
<p>To add the LeapHandController to a non-VR scene, place the LeapHandController prefab in the scene immediately below where the hands should appear in the scene.</p>
<div class="section" id="adding-hand-models">
<h3>Adding Hand Models<a class="headerlink" href="#adding-hand-models" title="Permalink to this headline">¶</a></h3>
<ol class="arabic simple">
<li>Set the Hand Pool’s Model Pool size to the number of different pairs of hand models you want to use in the scene. This will create the same number of elements in the pool.</li>
<li>Set the name of one element to “gfx_hands” (or any suitable name).</li>
<li>Drag the desired hand prefabs to the left and right model properties.</li>
<li>Set <strong>Is Enabled</strong> and <strong>Can Duplicate</strong> to true.</li>
<li>Repeat for any additional elements.</li>
</ol>
<p>You can use prefabs directly in the hand pool or place the hand models in the scene hierarchy first. If you place the hand models in the scene, note that we no longer recommend placing the models as children of the LeapHandController. The models should go outside the camera hierarchy. Otherwise stuttering can occur during head movement.</p>
</div>
</div>
<div class="section" id="key-components">
<h2>Key Components<a class="headerlink" href="#key-components" title="Permalink to this headline">¶</a></h2>
<p>The key components in the LeapHandController prefab include:</p>
<div class="section" id="leaphandcontroller-script">
<h3>LeapHandController (Script)<a class="headerlink" href="#leaphandcontroller-script" title="Permalink to this headline">¶</a></h3>
<p>The LeapHandController class defines the logic for managing tracking data and hands. It contains no properties that can be set in the inspector.</p>
</div>
<div class="section" id="leap-service-provider">
<h3>Leap Service Provider<a class="headerlink" href="#leap-service-provider" title="Permalink to this headline">¶</a></h3>
<p>The Leap Service Provider is the connection point between the Leap Motion service and the rest of the Unity assets. The service provider gets frames and images from the service and provides them other parts of your application.</p>
<ul class="simple">
<li>Is Head Mounted – must be enabled for proper hand tracking when the Leap Motion hardware is mounted on an HMD. Must be unchecked when using the Leap Motion hardware in a desktop (facing upward) configuration.</li>
<li>Override Device Type – enables the use of a specific Leap Motion hardware profile. Typically, this should be left unchecked.</li>
<li>Override Device Type With:<ul>
<li>Peripheral – the standard device.</li>
<li>Dragonfly – an internal prototype device. Should only be used if you have one of the handful of these devices that exist in the world.</li>
</ul>
</li>
<li>Use Interpolation – enables frame interpolation/extrapolation. When enabled, the service provides a frame of data interpolated or extrapolated to match the actual time when the Unity Update or FixedUpdate events are executed.</li>
<li>Interpolation Delay – adjusts the interpolation time by a fixed amount. Too small a delay can lead to excessive extrapolation, which can be recognized by jerkiness in the hand and finger movements. Too large a delay will add excessive latency.</li>
</ul>
</div>
<div class="section" id="hand-pool">
<h3>Hand Pool<a class="headerlink" href="#hand-pool" title="Permalink to this headline">¶</a></h3>
<p>The Hand Pool manages the representation of the hands in a scene. A single tracked hand can have any number of task-specific Unity game objects associated with it. For example, one representation might be for the graphics display, one for the physics interactions, and another for attaching utility objects to the hand.</p>
<p>Each of these task-specific hand game objects must be added to the hand pool in a separate pool element (as described in <a class="reference internal" href="Unity.Prefab.LMHeadMountedRig.html"><em>LMHeadMountedRig</em></a>). Each element in the pool must have a game object for both the left and right hands</p>
<p>Increase the Model Pool Size to add additional elements. For each element in the pool you can make the following settings:</p>
<ul class="simple">
<li>Group Name – an arbitrary string you can assign to identify the group when calling the EnableGroup() and DisableGroup() functions of the HandPool object.</li>
<li>Left Model – the game object or prefab to use for left hands.</li>
<li>Right Model – the game object or prefab to use for right hands.</li>
<li>Is Enabled – whether this group is currently enabled. You can change this setting in the Unity Editor or at runtime with the EnableGroup() and DisableGroup() HandPool functions.</li>
<li>Can Duplicate – determines whether more than one instances of these game objects can exist in the scene. For example, if there are more than one left or right hand in a scene because the Leap Motion software misidentifies the chirality of a hand or two different people place hands in view, then an additional hand model is spawned when Can Duplicate is true. When false, only the first hand in view would be represented by a model from this group.</li>
</ul>
</div>
</div>
</div>
<!-- get_disqus_sso -->
</div>
<div id="sidebar" class="col-md-3">
<div class="well-sidebar" data-offset-top="188">
<ul>
<li><a href="../index.html" title="Home">Java Docs (v3.1)</a></li>
</ul><ul>
<li class="toctree-l1"><a class="reference internal" href="../devguide/Leap_Overview.html">API Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="../practices/Leap_Practices.html">Guidelines</a></li>
<li class="toctree-l1"><a class="reference internal" href="../devguide/Leap_Guides.html">Application Development</a></li>
<li class="toctree-l1"><a class="reference internal" href="../devguide/Leap_Guides2.html">Using the Tracking API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../api/Leap_Classes.html">API Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="../supplements/Leap_Supplements.html">Appendices</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!--
<div class="ribbon">
<p>Java</p>
</div>
<footer>
<div id="footer" class="container">
<div class="container">
<div class="copyright">
<span>Copyright © 2012 - 2016, Leap Motion, Inc.</span>
</div>
</div>
</div>
</footer>
</body>
</html>
|
MTASZTAKI/ApertusVR
|
plugins/track/hand/leapMotion/3rdParty/leapMotion/docs/java/unity/Unity.Prefab.HandController.html
|
HTML
|
mit
| 18,329
|
/**
Represents a bullet bill enemy.
Code by Rob Kleffner, 2011
*/
Mario.BulletBill = function(world, x, y, dir) {
this.Image = Enjine.Resources.Images["enemies"];
this.World = world;
this.X = x;
this.Y = y;
this.Facing = dir;
this.XPicO = 8;
this.YPicO = 31;
this.Height = 12;
this.Width = 4;
this.PicWidth = 16;
this.YPic = 5;
this.XPic = 0;
this.Ya = -5;
this.DeadTime = 0;
this.Dead = false;
this.Anim = 0;
};
Mario.BulletBill.prototype = new Mario.NotchSprite();
Mario.BulletBill.prototype.CollideCheck = function() {
if (this.Dead) {
return;
}
var xMarioD = Mario.MarioCharacter.X - this.X, yMarioD = Mario.MarioCharacter.Y - this.Y;
if (xMarioD > -16 && xMarioD < 16) {
if (yMarioD > -this.Height && yMarioD < this.World.Mario.Height) {
if (Mario.MarioCharacter.Y > 0 && yMarioD <= 0 && (!Mario.MarioCharacter.OnGround || !Mario.MarioCharacter.WasOnGround)) {
Mario.MarioCharacter.Stomp(this);
this.Dead = true;
this.Xa = 0;
this.Ya = 1;
this.DeadTime = 100;
} else {
Mario.MarioCharacter.GetHurt();
}
}
}
};
Mario.BulletBill.prototype.Move = function() {
var i = 0, sideWaysSpeed = 4;
if (this.DeadTime > 0) {
this.DeadTime--;
if (this.DeadTime === 0) {
this.DeadTime = 1;
for (i = 0; i < 8; i++) {
this.World.AddSprite(new Mario.Sparkle(((this.X + Math.random() * 16 - 8) | 0) + 4, ((this.Y + Math.random() * 8) | 0) + 4, Math.random() * 2 - 1, Math.random() * -1, 0, 1, 5));
}
this.World.RemoveSprite(this);
}
this.X += this.Xa;
this.Y += this.Ya;
this.Ya *= 0.95;
this.Ya += 1;
return;
}
this.Xa = this.Facing * sideWaysSpeed;
this.XFlip = this.Facing === -1;
this.Move(this.Xa, 0);
};
Mario.BulletBill.prototype.SubMove = function(xa, ya) {
this.X += xa;
return true;
};
Mario.BulletBill.prototype.FireballCollideCheck = function(fireball) {
if (this.DeadTime !== 0) {
return false;
}
var xD = fireball.X - this.X, yD = fireball.Y - this.Y;
if (xD > -16 && xD < 16) {
if (yD > -this.Height && yD < fireball.Height) {
return true;
}
}
return false;
};
Mario.BulletBill.prototype.ShellCollideCheck = function(shell) {
if (this.DeadTime !== 0) {
return false;
}
var xD = shell.X - this.X, yD = shell.Y - this.Y;
if (xD > -16 && xD < 16) {
if (yD > -this.Height && yD < shell.Height) {
Enjine.Resources.PlaySound("kick");
this.Dead = true;
this.Xa = 0;
this.Ya = 1;
this.DeadTime = 100;
return true;
}
}
return false;
};
|
Vehicola/vehicola.github.io
|
mario/code/bulletBill.js
|
JavaScript
|
mit
| 3,039
|
'use strict';
var assert = require('assert');
it('throws after timeout', function (done) {
setTimeout(function () {
throw new Error('Exception in delayed function');
}, 10);
});
|
tteltrab/gulp-mocha
|
test/fixtures/fixture-throws-uncaught.js
|
JavaScript
|
mit
| 183
|
#include "bits/stdc++.h"
using namespace std;
# define s(n) scanf("%d",&n)
# define sc(n) scanf("%c",&n)
# define sl(n) scanf("%lld",&n)
# define sf(n) scanf("%lf",&n)
# define ss(n) scanf("%s",n)
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
# define INF (int)1e9
# define EPS 1e-9
# define MOD 1000000007
typedef long long ll;
int main()
{
int t;
cin >> t;
ll min = INF;
ll n,j,sum;
while(t--){
sum=0;
min =INF;
sl(n);
REP(i,n){
sl(j);
if(j<min)
min=j;
sum+=j;
}
printf("%lld\n",sum-n*min);
//printf("%lld\n",min );
}
return 0;
}
|
saurabhjn76/Competitive-Coding
|
CodeChef/Easy/SALARY.cpp
|
C++
|
mit
| 831
|
footer {
margin-top: 400px;
}
@media (max-width: 320px) {
.container {
padding-right: 0;
padding-left: 0;
}
}
.nav > li > a {
padding: 5px 8px;
}
.face.icon {
width: 38px;
}
.face {
width: 76px;
}
.face.select {
cursor: pointer;
}
.scenario {
width: 320px;
background: black url(images/11002c9b1d8.png) repeat-y;
background-size: 320px 5px;
margin: 1em 0;
}
.paragraph {
width: 320px;
height: 84px;
position: relative;
}
.paragraph * {
margin: 0; padding: 0;
border: none;
}
.paragraph .face, .fukidashi {
top: 4px;
}
.paragraph .face {
position: absolute;
left: 5px;
width: 76px;
}
.fukidashi {
position: absolute;
right: 9px;
background: url(images/11006e59e67.png) no-repeat;
background-size: 224px 76px;
width: 224px;
height: 76px;
}
.fukidashi .name, .fukidashi .serifu {
font: bold 14px/17.5px "Arial", sans-serif;
color: black;
background-color: white;
}
.fukidashi .name {
position: absolute;
top: 4px;
left: 5px;
color: #f33281;
}
.fukidashi .serifu {
position: absolute;
top: 19px;
left: 5px;
width: 214px;
white-space: pre-wrap;
}
textarea {
max-width: 320px;
}
.nowloading {
text-align: center;
}
|
kuelgu/kuelgu.github.io
|
ohanashi/ohanashi.css
|
CSS
|
mit
| 1,201
|
<?php
namespace php_active_record;
/* connector: 257
Partner provided an XML feed for their dataObjects and connector scrapes the site for the taxa names.
*/
define("PODCAST_FEED", "http://podcast.eol.org/podcast/newfeed");
define("PODCAST_DETAILS_PAGE", "http://podcast.eol.org/podcast/");
class LearningEducationAPI
{
public static function get_all_taxa()
{
$podcast_taxon_names = self::all_podcast_scientific_names();
$podcast_data_objects = self::all_podcast_data_objects();
$all_taxa = array();
foreach($podcast_data_objects as $title => $data_object)
{
if($scientific_names = @$podcast_taxon_names[$title])
{
foreach($scientific_names as $scientific_name)
{
$taxon_parameters = array();
$taxon_parameters["scientificName"] = ucfirst(trim($scientific_name));
if(preg_match("/^([^ ]+) /", $taxon_parameters["scientificName"], $arr)) $taxon_parameters["genus"] = $arr[1];
$taxon_parameters["dataObjects"][] = $data_object;
$all_taxa[] = new \SchemaTaxon($taxon_parameters);
}
}
}
return $all_taxa;
}
public static function all_podcast_scientific_names()
{
$podcast_taxa = array();
$details_page_html = Functions::get_remote_file(PODCAST_DETAILS_PAGE, array('timeout' => 240));
if(preg_match_all("/<a href=\".*?\"><h2>(.*?)<\/h2><\/a> *?<h3 style=\"font-style:italic;margin:0 0 3px 0;\">(.*?)<\/h3>/ims", $details_page_html, $matches, PREG_SET_ORDER))
{
foreach($matches as $match)
{
$podcast_title = trim($match[1]);
if($podcast_title == "One Species at a Time") continue;
// turning commas into ands
$match[2] = str_replace(", ", " and ", $match[2]);
$match[2] = str_replace("variety", "var.", $match[2]);
// splitting on ands
$taxon_names = explode(" and ", $match[2]);
$podcast_taxa[$podcast_title] = $taxon_names;
}
}
return $podcast_taxa;
}
public static function all_podcast_data_objects()
{
$podcast_data_objects = array();
$xml = Functions::get_hashed_response(PODCAST_FEED, array('download_wait_time' => 1000000, 'timeout' => 240, 'download_attempts' => 5));
foreach($xml->channel->item as $item)
{
$data_object_parameters = array();
$item_itunes = $item->children("http://www.itunes.com/dtds/podcast-1.0.dtd");
$description = $item->description;
if($item_itunes->duration) $description .= "<br>Duration: " . $item_itunes->duration;
if($item->pubDate) $description .= "<br>Published: " . $item->pubDate;
$title = trim($item->title);
$data_object_parameters["identifier"] = trim($item->guid);
$data_object_parameters["source"] = trim($item->link);
$data_object_parameters["dataType"] = "http://purl.org/dc/dcmitype/Sound";
$data_object_parameters["mimeType"] = trim($item->enclosure["type"]);
$data_object_parameters["mediaURL"] = trim($item->enclosure["url"]);
$data_object_parameters["rightsHolder"] = "Encyclopedia of Life";
$data_object_parameters["title"] = trim($item->title);
$data_object_parameters["description"] = $description;
$data_object_parameters["license"] = 'http://creativecommons.org/licenses/by-nc/3.0/';
// add agents
$agents = array();
$agents[] = new \SchemaAgent(array("role" => "author", "homepage" => "http://www.eol.org", "fullName" => "Encyclopedia of Life"));
$agents[] = new \SchemaAgent(array("role" => "project", "homepage" => "http://www.atlantic.org/", "fullName" => "Atlantic Public Media"));
$data_object_parameters["agents"] = $agents;
// create object
$podcast_data_objects[$title] = new \SchemaDataObject($data_object_parameters);
}
return $podcast_data_objects;
}
}
?>
|
EOL/eol_php_code
|
lib/connectors/LearningEducationAPI.php
|
PHP
|
mit
| 4,238
|
/*
* mocaccino.js
*
* Copyright (c) 2014 Maximilian Antoni <mail@maxantoni.de>
*
* @license MIT
*/
/*globals describe, it*/
'use strict';
describe('cover', function () {
function called() {
return 42;
}
function test(a) {
return a || called();
}
it('yields', function (done) {
setTimeout(done, 50);
});
it('passes', function () {
test(false);
});
});
|
mantoni/mocaccino.js
|
test/fixture/cover-pass.js
|
JavaScript
|
mit
| 395
|
//
// AppDelegate.h
// Chapter 05 - Earth
//
// Created by David Rönnqvist on 2014-04-05.
// Copyright (c) 2014 David Rönnqvist.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in the
// Software without restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ==================================================================================
// IMPORTANT NOTE:
// The Image assets (textures) that are included in this project are used with permission
// from the original creator. These permissions include their usage in the digital book
// and in this sample project (including distribution of the sample project).
//
// If you want to use them for other purposes, you can download lower resolution versions
// at: http://planetpixelemporium.com/earth.html or get in contact with the creator.
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@end
|
d-ronnqvist/SCNBook-code
|
Chapter 05 - Earth/Code/Chapter 05 - Earth/AppDelegate.h
|
C
|
mit
| 1,888
|
<?php
namespace Recruiter\Option;
use Recruiter;
use Ulrichsg\Getopt;
use UnexpectedValueException;
class WorkOn implements Recruiter\Option
{
private $name;
private $label;
public function __construct($name)
{
$this->name = $name;
$this->label = 'all';
}
public function specification()
{
return (new Getopt\Option(null, $this->name, Getopt\Getopt::REQUIRED_ARGUMENT))
->setDescription(
sprintf('Work only on jobs grouped with this label [%s]', $this->label)
);
}
public function pickFrom(GetOpt\GetOpt $optionsFromCommandLine) {
$this->label = $this->validate(
$optionsFromCommandLine->getOption($this->name)
);
return $this;
}
public function applyTo(Recruiter\Worker $worker)
{
if ($this->label !== 'all') {
$worker->workOnJobsGroupedAs($this->label);
}
return $worker;
}
private function validate($label)
{
if (is_null($label)) {
return $this->label;
}
if (is_string($label) && !empty($label)) {
return $label;
}
throw new UnexpectedValueException(
sprintf(
"Option '%s' has an invalid value: '%s' is not a valid job label",
$this->name, $label
)
);
}
}
|
onebip/recruiter
|
src/Recruiter/Option/WorkOn.php
|
PHP
|
mit
| 1,395
|
SHELL := /bin/bash
LC=$(shell /usr/bin/wc -l cervidae.sh | /usr/bin/awk '{print $$1}')
DONTTOUCH=15
all: noop
noop:
@echo "The default is a no-op function. Pick one: "
@echo " * funcs: copy the cervidae functions into it's own _funcs file for testing"
@echo " * test: runs the full test suite (run 'make funcs' before running this)"
@echo " * clean: cleans up installation (leaves packages directory)"
funcs: cervidae.sh
@echo Moving $(LC) lines
@HC=$$(( $(LC) - $(DONTTOUCH) )); head -$$HC cervidae.sh > cervidae_funcs.sh
backup: cervidae.sh Makefile tests
rm -rf tests/__pycache__
rm -rf tests/*.pyc
cp -R {cervidae.sh,Makefile,tests} /vagrant/cervidae/
test: tests
@./bin/python -m unittest discover -s tests
clean:
rm cervidae_funcs.sh
rm -rf bin
rm -rf etc
rm -rf Gemfile*
rm -rf include
rm -rf lib
rm -rf logs
rm -rf node
rm -rf share
rm -rf src
rm -rf tmp
rm -rf var
rm -rf vendor
|
Cox-Automotive/cervidae
|
Makefile
|
Makefile
|
mit
| 920
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace sGridServer.Code.Utilities
{
/// <summary>
/// This class generates and validates captchas.
/// </summary>
public class CaptchaGenerator
{
/// <summary>
/// Captcha session key.
/// </summary>
private const string CaptchaSessionKeyPrefix = "CaptchaText";
/// <summary>
/// The code associated with the captcha generator.
/// </summary>
private string code;
/// <summary>
/// The System.Web.Mvc.ControllerContext object
/// of the controller using this captcha generator.
/// </summary>
private ControllerContext context;
/// <summary>
/// Gets the captcha text associated with the current context and the given code.
/// </summary>
public string CurrentCaptchaText
{
//The captcha text itself is stored in the session.
get { return (string)context.HttpContext.Session[CaptchaSessionKeyPrefix + code]; }
private set { context.HttpContext.Session[CaptchaSessionKeyPrefix + code] = value; }
}
/// <summary>
/// Generates a new instance of this class, using the given parameters.
/// </summary>
/// <param name="context">The System.Web.Mvc.ControllerContext object of the controller using the captcha.</param>
/// <param name="code">A code uniquely identifying the controller using the captcha.</param>
public CaptchaGenerator(ControllerContext context, string code)
{
this.code = code;
this.context = context;
if (this.CurrentCaptchaText == null)
{
this.CurrentCaptchaText = "";
}
}
/// <summary>
/// Creates a new Captcha object by generating a text to show and stores
/// this text in the session using the code given to the constructor as identifier.
/// </summary>
/// <returns>The created Captcha object.</returns>
public Models.Captcha CreateCaptcha()
{
//Generates a new Captcha and temporarily stores the captcha text.
Random r = new Random();
UrlHelper urlHelper = new UrlHelper(context.RequestContext);
CurrentCaptchaText = r.Next(0, 999999).ToString("D6");
//Returns the new Captcha object.
return new Models.Captcha(code, urlHelper.Action("GetCaptcha", "Captcha", new {captchaCode = (code), rnd = r.Next()} ));
}
/// <summary>
/// Validates whether the given captcha answer was valid. This is done by comparing the EnteredText property of
/// the Captcha object with the text stored in the session by the CreateCaptcha method before.
/// </summary>
/// <param name="captcha">The captcha to validate.</param>
/// <returns>True, if the captcha was valid, false if not.</returns>
public bool ValidateCaptcha(Models.Captcha captcha)
{
return captcha.EnteredText != null && captcha.EnteredText.Equals(CurrentCaptchaText);
}
}
}
|
ejoebstl/sGrid
|
sGridServer/Code/Utilities/CaptchaGenerator.cs
|
C#
|
mit
| 3,329
|
var _curry2 = require('./internal/_curry2');
var _map = require('./internal/_map');
var curryN = require('./curryN');
var pluck = require('./pluck');
/**
* Accepts a converging function and a list of branching functions and returns a new function.
* When invoked, this new function is applied to some arguments, each branching
* function is applied to those same arguments. The results of each branching
* function are passed as arguments to the converging function to produce the return value.
*
* @func
* @memberOf R
* @since v0.4.2
* @category Function
* @sig (x1 -> x2 -> ... -> z) -> [(a -> b -> ... -> x1), (a -> b -> ... -> x2), ...] -> (a -> b -> ... -> z)
* @param {Function} after A function. `after` will be invoked with the return values of
* `fn1` and `fn2` as its arguments.
* @param {Array} functions A list of functions.
* @return {Function} A new function.
* @example
*
* var add = (a, b) => a + b;
* var multiply = (a, b) => a * b;
* var subtract = (a, b) => a - b;
*
* //≅ multiply( add(1, 2), subtract(1, 2) );
* R.converge(multiply, [add, subtract])(1, 2); //=> -3
*
* var add3 = (a, b, c) => a + b + c;
* R.converge(add3, [multiply, add, subtract])(1, 2); //=> 4
*/
module.exports = _curry2(function converge(after, fns) {
return curryN(Math.max.apply(Math, pluck('length', fns)), function() {
var args = arguments;
var context = this;
return after.apply(context, _map(function(fn) {
return fn.apply(context, args);
}, fns));
});
});
|
kismts/my_udon
|
src/node_modules/ramda/src/converge.js
|
JavaScript
|
mit
| 1,554
|
/*
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2016 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to license@zephir-lang.com so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <andres@zephir-lang.com> |
| Eduar Carvajal <eduar@zephir-lang.com> |
| Vladimir Kolesnikov <vladimir@extrememember.com> |
+------------------------------------------------------------------------+
*/
#ifndef ZEPHIR_KERNEL_FCALL_H
#define ZEPHIR_KERNEL_FCALL_H
#include "php_ext.h"
#include "kernel/main.h"
#include "kernel/memory.h"
#include "kernel/fcall_internal.h"
#include "kernel/extended/fcall.h"
#include <Zend/zend_hash.h>
#include <Zend/zend.h>
typedef enum _zephir_call_type {
zephir_fcall_parent,
zephir_fcall_self,
zephir_fcall_static,
zephir_fcall_ce,
zephir_fcall_method,
zephir_fcall_function
} zephir_call_type;
/**
* @addtogroup callfuncs Calling Functions
* @{
*/
#if defined(_MSC_VER)
#define ZEPHIR_PASS_CALL_PARAMS(x) x + 1
#define ZEPHIR_CALL_NUM_PARAMS(x) ((sizeof(x) - sizeof(x[0]))/sizeof(x[0]))
#define ZEPHIR_FETCH_VA_ARGS NULL,
#else
#define ZEPHIR_PASS_CALL_PARAMS(x) x
#define ZEPHIR_CALL_NUM_PARAMS(x) sizeof(x)/sizeof(zval*)
#define ZEPHIR_FETCH_VA_ARGS
#endif
#define ZEPHIR_CALL_FUNCTION(return_value_ptr, func_name, cache, cache_slot, ...) \
do { \
zephir_fcall_cache_entry **cache_entry_ = cache; \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
if (__builtin_constant_p(func_name)) { \
if (cache_entry_ && *cache_entry_) { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_func_aparams_fast(return_value_ptr, cache, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} else { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_func_aparams(return_value_ptr, func_name, sizeof(func_name)-1, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} else { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_func_aparams(return_value_ptr, func_name, strlen(func_name), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} while (0)
#define ZEPHIR_CALL_ZVAL_FUNCTION(return_value_ptr, func_name, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
ZEPHIR_LAST_CALL_STATUS = zephir_call_zval_func_aparams(return_value_ptr, func_name, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
/* Saves the if pointer, and called/calling scope */
#define ZEPHIR_BACKUP_THIS_PTR() \
zend_object *old_this_ptr = Z_OBJ(EG(current_execute_data)->This) ? Z_OBJ(EG(current_execute_data)->This) : NULL;
#define ZEPHIR_RESTORE_THIS_PTR() do { \
if (old_this_ptr) { \
ZEPHIR_SET_THIS_OBJ(old_this_ptr); \
} else { \
ZEPHIR_SET_THIS_EXPLICIT_NULL(); \
} \
} while (0)
#define ZEPHIR_SET_THIS(zv) ZEPHIR_SET_THIS_OBJ((zv ? Z_OBJ_P(zv) : NULL))
#define ZEPHIR_SET_THIS_EXPLICIT_NULL() \
ZVAL_NULL(&EG(current_execute_data)->This); \
Z_OBJ(EG(current_execute_data)->This) = NULL;
#define ZEPHIR_SET_THIS_OBJ(obj) \
if (obj) { \
ZVAL_OBJ(&EG(current_execute_data)->This, obj); \
} \
else { ZEPHIR_SET_THIS_EXPLICIT_NULL(); } \
#if PHP_VERSION_ID >= 70100
#define ZEPHIR_BACKUP_SCOPE() \
zend_class_entry *old_scope = EG(fake_scope); \
zend_class_entry *old_called_scope = zend_get_called_scope(EG(current_execute_data));
#define ZEPHIR_RESTORE_SCOPE() \
zephir_set_called_scope(EG(current_execute_data), old_called_scope); \
EG(fake_scope) = old_scope; \
#define ZEPHIR_SET_SCOPE(_scope, _scope_called) \
EG(fake_scope) = _scope; \
zephir_set_called_scope(EG(current_execute_data), _scope_called); \
#else
#define ZEPHIR_BACKUP_SCOPE() \
zend_class_entry *old_scope = EG(scope); \
zend_class_entry *old_called_scope = EG(current_execute_data)->called_scope;
#define ZEPHIR_RESTORE_SCOPE() \
EG(current_execute_data)->called_scope = old_called_scope; \
EG(scope) = old_scope; \
#define ZEPHIR_SET_SCOPE(_scope, _scope_called) \
EG(scope) = _scope; \
EG(current_execute_data)->called_scope = _scope_called; \
#endif
/* End internal calls */
#define ZEPHIR_RETURN_CALL_ZVAL_FUNCTION(func_name, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_zval_function(return_value, func_name, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#define ZEPHIR_RETURN_CALL_FUNCTION(func_name, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
if (__builtin_constant_p(func_name)) { \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_function(return_value, func_name, sizeof(func_name)-1, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
else { \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_function(return_value, func_name, strlen(func_name), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} while (0)
#define ZEPHIR_CALL_METHOD(return_value_ptr, object, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
if (__builtin_constant_p(method)) { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, Z_TYPE_P(object) == IS_OBJECT ? Z_OBJCE_P(object) : NULL, zephir_fcall_method, object, method, sizeof(method)-1, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} else { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, Z_TYPE_P(object) == IS_OBJECT ? Z_OBJCE_P(object) : NULL, zephir_fcall_method, object, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} while (0)
#define ZEPHIR_RETURN_CALL_METHOD_ZVAL(object, method, cache, cache_slot, ...) \
do { \
char *method_name; \
int method_len; \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
if (Z_TYPE_P(method) == IS_STRING) { \
method_len = Z_STRLEN_P(method); \
method_name = zend_str_tolower_dup(Z_STRVAL_P(method), method_len); \
} else { \
method_len = 0; \
method_name = zend_str_tolower_dup("", 0); \
} \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, Z_TYPE_P(object) == IS_OBJECT ? Z_OBJCE_P(object) : NULL, zephir_fcall_method, object, method_name, method_len, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
efree(method_name); \
} while (0)
#define ZEPHIR_CALL_METHOD_ZVAL(return_value_ptr, object, method, cache, cache_slot, ...) \
do { \
char *method_name; \
int method_len; \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
if (Z_TYPE_P(method) == IS_STRING) { \
method_len = Z_STRLEN_P(method); \
method_name = zend_str_tolower_dup(Z_STRVAL_P(method), method_len); \
} else { \
method_len = 0; \
method_name = zend_str_tolower_dup("", 0); \
} \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, Z_TYPE_P(object) == IS_OBJECT ? Z_OBJCE_P(object) : NULL, zephir_fcall_method, object, method_name, method_len, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
efree(method_name); \
} while (0)
#define ZEPHIR_CALL_PARENT(return_value_ptr, class_entry, this_ptr, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
if (__builtin_constant_p(method)) { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, class_entry, zephir_fcall_parent, this_ptr, method, sizeof(method)-1, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
else { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, class_entry, zephir_fcall_parent, this_ptr, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} while (0)
#define ZEPHIR_RETURN_CALL_METHOD(object, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
if (__builtin_constant_p(method)) { \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, Z_TYPE_P(object) == IS_OBJECT ? Z_OBJCE_P(object) : NULL, zephir_fcall_method, object, method, sizeof(method)-1, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} else { \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, Z_TYPE_P(object) == IS_OBJECT ? Z_OBJCE_P(object) : NULL, zephir_fcall_method, object, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} while (0)
#define ZEPHIR_RETURN_CALL_STATIC(method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
if (__builtin_constant_p(method)) { \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_static, NULL, method, sizeof(method)-1, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
else { \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_static, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} while (0)
#define ZEPHIR_RETURN_CALL_PARENT(class_entry, this_ptr, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
if (__builtin_constant_p(method)) { \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, class_entry, zephir_fcall_parent, this_ptr, method, sizeof(method)-1, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
else { \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, class_entry, zephir_fcall_parent, this_ptr, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} while (0)
#define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
if (__builtin_constant_p(method)) { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_self, NULL, method, sizeof(method)-1, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
else { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} while (0)
#define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
if (__builtin_constant_p(method)) { \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_self, NULL, method, sizeof(method)-1, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
else { \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} while (0)
#define ZEPHIR_CALL_STATIC(return_value_ptr, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
if (__builtin_constant_p(method)) { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_static, NULL, method, sizeof(method)-1, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
else { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_static, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} while (0)
#define ZEPHIR_CALL_CE_STATIC(return_value_ptr, class_entry, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
if (__builtin_constant_p(method)) { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, class_entry, zephir_fcall_ce, NULL, method, sizeof(method)-1, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
else { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, class_entry, zephir_fcall_ce, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} while (0)
#define ZEPHIR_RETURN_CALL_CE_STATIC(class_entry, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
if (__builtin_constant_p(method)) { \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, class_entry, zephir_fcall_ce, NULL, method, sizeof(method)-1, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
else { \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, class_entry, zephir_fcall_ce, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} \
} while (0)
#define ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL(class_entry, method, cache, cache_slot, ...) \
do { \
char *method_name; \
int method_len; \
zval *params_[] = { ZEPHIR_FETCH_VA_ARGS __VA_ARGS__ }; \
if (Z_TYPE(method) == IS_STRING) { \
method_len = Z_STRLEN(method); \
method_name = zend_str_tolower_dup(Z_STRVAL(method), method_len); \
} else { \
method_len = 0; \
method_name = zend_str_tolower_dup("", 0); \
} \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, class_entry, zephir_fcall_ce, NULL, method_name, method_len, cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
efree(method_name); \
} while (0)
/** Use these functions to call functions in the PHP userland using an arbitrary zval as callable */
#define ZEPHIR_CALL_USER_FUNC(return_value, handler) ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, handler, NULL)
#define ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, handler, params) \
do { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_user_func_array(return_value, handler, params); \
} while (0)
#define ZEPHIR_CALL_USER_FUNC_ARRAY_NOEX(return_value, handler, params) \
do { \
ZEPHIR_LAST_CALL_STATUS = zephir_call_user_func_array_noex(return_value, handler, params); \
} while (0)
int zephir_call_func_aparams(zval *return_value_ptr, const char *func_name, uint func_length,
zephir_fcall_cache_entry **cache_entry, int cache_slot,
uint param_count, zval **params);
int zephir_call_func_aparams_fast(zval *return_value_ptr, zephir_fcall_cache_entry **cache_entry, uint param_count, zval **params);
int zephir_call_zval_func_aparams(zval *return_value_ptr, zval *func_name,
zephir_fcall_cache_entry **cache_entry, int cache_slot,
uint param_count, zval **params) ZEPHIR_ATTR_WARN_UNUSED_RESULT;
int zephir_call_class_method_aparams(zval *return_value_ptr,
zend_class_entry *ce,
zephir_call_type type,
zval *object,
const char *method_name,
uint method_len,
zephir_fcall_cache_entry **cache_entry,
int cache_slot,
uint param_count,
zval **params) ZEPHIR_ATTR_WARN_UNUSED_RESULT;
ZEPHIR_ATTR_WARN_UNUSED_RESULT static inline int zephir_return_call_function(zval *return_value,
const char *func, uint func_len, zephir_fcall_cache_entry **cache_entry, int cache_slot, uint param_count, zval **params)
{
zval rv, *rvp = return_value ? return_value : &rv;
int status;
if (return_value) {
zval_ptr_dtor(return_value);
ZVAL_UNDEF(return_value);
}
status = zephir_call_func_aparams(rvp, func, func_len, cache_entry, cache_slot, param_count, params);
if (status == FAILURE) {
if (return_value && EG(exception)) {
ZVAL_NULL(return_value);
}
return FAILURE;
}
if (!return_value) {
zval_ptr_dtor(&rv);
}
return SUCCESS;
}
ZEPHIR_ATTR_WARN_UNUSED_RESULT static inline int zephir_return_call_zval_function(zval *return_value,
zval *func, zephir_fcall_cache_entry **cache_entry, int cache_slot, uint param_count, zval **params)
{
zval rv, *rvp = return_value ? return_value : &rv;
int status;
if (return_value) {
zval_ptr_dtor(return_value);
ZVAL_UNDEF(return_value);
}
status = zephir_call_zval_func_aparams(rvp, func, cache_entry, cache_slot, param_count, params);
if (status == FAILURE) {
if (return_value && EG(exception)) {
ZVAL_NULL(return_value);
}
return FAILURE;
}
if (!return_value) {
zval_ptr_dtor(&rv);
}
return SUCCESS;
}
ZEPHIR_ATTR_WARN_UNUSED_RESULT static inline int zephir_return_call_class_method(zval *return_value,
zend_class_entry *ce, zephir_call_type type, zval *object,
const char *method_name, uint method_len,
zephir_fcall_cache_entry **cache_entry, int cache_slot,
uint param_count, zval **params)
{
zval rv, *rvp = return_value ? return_value : &rv;
int status;
ZVAL_UNDEF(&rv);
if (return_value) {
zval_ptr_dtor(return_value);
ZVAL_UNDEF(return_value);
}
status = zephir_call_class_method_aparams(rvp, ce, type, object, method_name, method_len, cache_entry, cache_slot, param_count, params);
if (status == FAILURE) {
if (return_value && EG(exception)) {
ZVAL_NULL(return_value);
}
return FAILURE;
}
if (!return_value) {
zval_ptr_dtor(&rv);
}
return SUCCESS;
}
/** Fast call_user_func_array/call_user_func */
int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *params) ZEPHIR_ATTR_WARN_UNUSED_RESULT;
/**
* Replaces call_user_func_array avoiding function lookup
*/
ZEPHIR_ATTR_WARN_UNUSED_RESULT static inline int zephir_call_user_func_array(zval *return_value, zval *handler, zval *params)
{
int status = zephir_call_user_func_array_noex(return_value, handler, params);
return (EG(exception)) ? FAILURE : status;
}
int zephir_has_constructor_ce(const zend_class_entry *ce) ZEPHIR_ATTR_PURE ZEPHIR_ATTR_NONNULL;
ZEPHIR_ATTR_WARN_UNUSED_RESULT ZEPHIR_ATTR_NONNULL static inline int zephir_has_constructor(const zval *object)
{
return Z_TYPE_P(object) == IS_OBJECT ? zephir_has_constructor_ce(Z_OBJCE_P(object)) : 0;
}
#define zephir_check_call_status() \
do \
if (ZEPHIR_LAST_CALL_STATUS == FAILURE) { \
ZEPHIR_MM_RESTORE(); \
return; \
} \
while(0)
#define zephir_check_call_status_or_jump(label) \
if (ZEPHIR_LAST_CALL_STATUS == FAILURE) { \
if (EG(exception)) { \
goto label; \
} else { \
ZEPHIR_MM_RESTORE(); \
return; \
} \
}
#ifdef ZEPHIR_RELEASE
#define ZEPHIR_TEMP_PARAM_COPY 0
#define zephir_check_temp_parameter(param) do { if (Z_REFCOUNT(param) > 1) zval_copy_ctor(¶m); else ZVAL_NULL(¶m); } while(0)
#else
#define ZEPHIR_TEMP_PARAM_COPY 1
#define zephir_check_temp_parameter(param)
#endif
void zephir_eval_php(zval *str, zval *retval_ptr, char *context);
static inline void zephir_set_called_scope(zend_execute_data *ex, zend_class_entry *called_scope)
{
while (ex) {
if (Z_TYPE(ex->This) == IS_OBJECT) {
Z_OBJCE(ex->This) = called_scope;
return;
} else if (Z_CE(ex->This)) {
Z_CE(ex->This) = called_scope;
return;
} else if (ex->func) {
if (ex->func->type != ZEND_INTERNAL_FUNCTION || ex->func->common.scope) {
return;
}
}
ex = ex->prev_execute_data;
}
}
#endif /* ZEPHIR_KERNEL_FCALL_H */
|
jonbaldie/container-zephir
|
ext/kernel/fcall.h
|
C
|
mit
| 20,978
|
<!doctype html>
<html>
<head>
<base href="../">
<title>JSDoc: Source:directions.js</title>
<link type="text/css" rel="stylesheet" href="css/jsdoc-default.css">
<link href="css/prettify-tomorrow.css" type="text/css" rel="stylesheet">
<script src="js/prettify.js"></script>
</head>
<body>
<nav>
<h2><a href="index.html">Index</a></h2>
<div>
<h3>module: undefined</h3>
<div>
<h3>service</h3>
<ul>
<li>
<a href="Attr2Options.html">Attr2Options</a>
</li><li>
<a href="GeoCoder.html">GeoCoder</a>
</li><li>
<a href="NavigatorGeolocation.html">NavigatorGeolocation</a>
</li><li>
<a href="StreetView.html">StreetView</a>
</li>
</ul>
</div><div>
<h3>directive</h3>
<ul>
<li>
<a href="bicycling-layer.html">bicycling-layer</a>
</li><li>
<a href="cloud-layer.html">cloud-layer</a>
</li><li>
<a href="custom-control.html">custom-control</a>
</li><li>
<a href="directions.html">directions</a>
</li><li>
<a href="drawing-manager.html">drawing-manager</a>
</li><li>
<a href="dynamic-maps-engine-layer.html">dynamic-maps-engine-layer</a>
</li><li>
<a href="fusion-tables-layer.html">fusion-tables-layer</a>
</li><li>
<a href="heatmap-layer.html">heatmap-layer</a>
</li><li>
<a href="info-window.html">info-window</a>
</li><li>
<a href="kml-layer.html">kml-layer</a>
</li><li>
<a href="map-data.html">map-data</a>
</li><li>
<a href="map-lazy-load.html">map-lazy-load</a>
</li><li>
<a href="map-type.html">map-type</a>
</li><li>
<a href="maps-engine-layer.html">maps-engine-layer</a>
</li><li>
<a href="marker.html">marker</a>
</li><li>
<a href="overlay-map-type.html">overlay-map-type</a>
</li><li>
<a href="places-auto-complete.html">places-auto-complete</a>
</li><li>
<a href="shape.html">shape</a>
</li><li>
<a href="streetview-panorama.html">streetview-panorama</a>
</li><li>
<a href="traffic-layer.html">traffic-layer</a>
</li><li>
<a href="transit-layer.html">transit-layer</a>
</li><li>
<a href="weather-layer.html">weather-layer</a>
</li>
</ul>
</div><div>
<h3>controller</h3>
<ul>
<li>
<a href="MapController.html">MapController</a>
</li>
</ul>
</div>
</div><div>
<h3>module: ngmap</h3>
<div>
<h3>directive</h3>
<ul>
<li>
<a href="ngmap.custom-marker.html">ngmap.custom-marker</a>
</li>
</ul>
</div>
</div><div>
<h3>module: ngMap</h3>
<div>
<h3>directive</h3>
<ul>
<li>
<a href="ngMap.map.html">ngMap.map</a>
</li>
</ul>
</div>
</div>
</nav>
<h1 class="title">
Source:directions.js
</h1>
<div id="main">
<article>
<pre class="prettyprint source linenums"><code>/**
* @ngdoc directive
* @name directions
* @description
* Enable directions on map. e.g., origin, destination, draggable, waypoints, etc
*
* Requires: map directive
*
* Restrict To: Element
*
* @attr {String} DirectionsRendererOptions [Any DirectionsRendererOptions](https://developers.google.com/maps/documentation/javascript/reference#DirectionsRendererOptions)
* @attr {String} DirectionsRequestOptions [Any DirectionsRequest options](https://developers.google.com/maps/documentation/javascript/reference#DirectionsRequest)
* @example
* Example:
* <map zoom="14" center="37.7699298, -122.4469157">
* <directions
* draggable="true"
* panel="directions-panel"
* travel-mode="{{travelMode}}"
* waypoints="[{location:'kingston', stopover:true}]"
* origin="{{origin}}"
* destination="{{destination}}">
* </directions>
* </map>
*/
/* global google */
(function() {
'use strict';
var getDirectionsRenderer = function(options, events) {
if (options.panel) {
options.panel = document.getElementById(options.panel) || document.querySelector(options.panel);
}
var renderer = new google.maps.DirectionsRenderer(options);
for (var eventName in events) {
google.maps.event.addListener(renderer, eventName, events[eventName]);
}
return renderer;
};
var directions = function(Attr2Options, $timeout) {
var parser = Attr2Options;
var directionsService = new google.maps.DirectionsService();
var updateRoute = function(renderer, options) {
/* filter out valid keys only for DirectionsRequest object*/
var request = options;
request.travelMode = request.travelMode || 'DRIVING';
var validKeys = [
'origin', 'destination', 'travelMode', 'transitOptions', 'unitSystem',
'durationInTraffic', 'waypoints', 'optimizeWaypoints',
'provideRouteAlternatives', 'avoidHighways', 'avoidTolls', 'region'
];
for(var key in request){
(validKeys.indexOf(key) === -1) && (delete request[key]);
}
if(request.waypoints) {
// Check fo valid values
if(request.waypoints == "[]" || request.waypoints == "") delete request.waypoints;
}
if (request.origin && request.destination) {
console.log('request', request);
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
$timeout(function() {
renderer.setDirections(response);
});
}
});
}
};
var linkFunc = function(scope, element, attrs, mapController) {
var orgAttrs = parser.orgAttributes(element);
var filtered = parser.filter(attrs);
var options = parser.getOptions(filtered);
var events = parser.getEvents(scope, filtered);
var attrsToObserve = parser.getAttrsToObserve(orgAttrs);
var renderer = getDirectionsRenderer(options, events);
mapController.addObject('directionsRenderers', renderer);
attrsToObserve.forEach(function(attrName) {
(function(attrName) {
attrs.$observe(attrName, function(val) {
if (options[attrName] !== val) { //apply only if changed
var optionValue = parser.toOptionValue(val, {key: attrName});
console.log('setting ', attrName, 'with value', optionValue);
options[attrName] = optionValue;
updateRoute(renderer, options);
}
});
})(attrName);
});
scope.$on('mapInitialized', function(event, map) {
updateRoute(renderer, options);
});
scope.$on('$destroy', function(event, map) {
mapController.deleteObject('directionsRenderers', renderer);
});
};
return {
restrict: 'E',
require: '^map',
link: linkFunc
}
}; // var directions
directions.$inject = ['Attr2Options', '$timeout'];
angular.module('ngMap').directive('directions', directions);
})();
</code></pre>
</article>
</div>
<footer style="clear:both">
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.2</a>
using
<a href="https://github.com/allenhwkim/angular-jsdoc">Angular-JSDoc template</a>
</footer>
<!--%= prettyJson %-->
<script>
prettyPrint();
var lineNo = window.location.hash.match(/([0-9]*)$/)[0] || 1;
var line = document.querySelector("ol li:nth-child("+(lineNo||1)+")");
line && line.scrollIntoView();
</script>
</body>
</html>
|
masudiiuc/angularjs-google-maps
|
build/docs/source/directions.html
|
HTML
|
mit
| 8,210
|
<?php
namespace Oro\Component\EntitySerializer\Tests\Unit;
/**
* @SuppressWarnings(PHPMD.ExcessiveClassLength)
*/
class SimpleEntitySerializerTest extends EntitySerializerTestCase
{
public function testReuseExistingJoin()
{
$qb = $this->em->getRepository('Test:Product')->createQueryBuilder('e')
->leftJoin('e.owner', 'user')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT p0_.id AS id_0, p0_.name AS name_1,'
. ' u1_.id AS id_2,'
. ' p0_.category_name AS category_name_3, p0_.owner_id AS owner_id_4,'
. ' u1_.category_name AS category_name_5'
. ' FROM product_table p0_'
. ' LEFT JOIN user_table u1_ ON p0_.owner_id = u1_.id'
. ' WHERE p0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'product_name',
'id_2' => 10,
'category_name_3' => 'category_name',
'owner_id_4' => 10,
'category_name_5' => 'owner_category_name',
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'fields' => [
'id' => null,
'name' => null,
'owner' => [
'fields' => 'id',
]
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'name' => 'product_name',
'owner' => 10
]
],
$result
);
}
public function testReuseExistingInnerJoin()
{
$qb = $this->em->getRepository('Test:Product')->createQueryBuilder('e')
->innerJoin('e.owner', 'user')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT p0_.id AS id_0, p0_.name AS name_1,'
. ' u1_.id AS id_2,'
. ' p0_.category_name AS category_name_3, p0_.owner_id AS owner_id_4,'
. ' u1_.category_name AS category_name_5'
. ' FROM product_table p0_'
. ' INNER JOIN user_table u1_ ON p0_.owner_id = u1_.id'
. ' WHERE p0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'product_name',
'id_2' => 10,
'category_name_3' => 'category_name',
'owner_id_4' => 10,
'category_name_5' => 'owner_category_name',
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'fields' => [
'id' => null,
'name' => null,
'owner' => [
'fields' => 'id',
]
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'name' => 'product_name',
'owner' => 10
]
],
$result
);
}
public function testReuseExistingJoinJoinWithCondition()
{
$qb = $this->em->getRepository('Test:Product')->createQueryBuilder('e')
->leftJoin('e.owner', 'user', 'WITH', 'e.owner = user.id AND user.name LIKE \'a%\'')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT p0_.id AS id_0, p0_.name AS name_1,'
. ' u1_.id AS id_2,'
. ' p0_.category_name AS category_name_3, p0_.owner_id AS owner_id_4,'
. ' u1_.category_name AS category_name_5'
. ' FROM product_table p0_'
. ' LEFT JOIN user_table u1_ ON p0_.owner_id = u1_.id AND (p0_.owner_id = u1_.id AND u1_.name LIKE \'a%\')'
. ' WHERE p0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'product_name',
'id_2' => 10,
'category_name_3' => 'category_name',
'owner_id_4' => 10,
'category_name_5' => 'owner_category_name',
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'fields' => [
'id' => null,
'name' => null,
'owner' => [
'fields' => 'id',
]
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'name' => 'product_name',
'owner' => 10
]
],
$result
);
}
public function testSimpleEntityWithoutConfig()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.name AS name_1, g0_.label AS label_2'
. ', g0_.public AS public_3, g0_.is_exception AS is_exception_4'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'test_name',
'label_2' => 'test_label',
'public_3' => 1,
'is_exception_4' => 0
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize($qb, []);
$this->assertArrayEquals(
[
[
'id' => 1,
'name' => 'test_name',
'label' => 'test_label',
'public' => true,
'isException' => false
]
],
$result
);
}
public function testSimpleEntityWithExclusion()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.label AS label_1, g0_.public AS public_2'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'label_1' => 'test_label',
'public_2' => 1,
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'fields' => [
'name' => ['exclude' => true],
'isException' => ['exclude' => true],
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'label' => 'test_label',
'public' => true
]
],
$result
);
}
/**
* @deprecated since 1.9. Use 'exclude' attribute for a field instead of 'excluded_fields' for an entity
*/
public function testSimpleEntityWithExclusionDeprecated()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.label AS label_1, g0_.public AS public_2'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'label_1' => 'test_label',
'public_2' => 1,
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'excluded_fields' => ['name', 'isException'],
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'label' => 'test_label',
'public' => true
]
],
$result
);
}
public function testSimpleEntityWithComputedField()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.name AS name_1'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'test_name',
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'fields' => [
'id' => null,
'name' => null,
'computedName' => null,
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'name' => 'test_name',
'computedName' => 'test_name (COMPUTED)',
]
],
$result
);
}
public function testSimpleEntityWithExclusionAndPartialLoadDisabled()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.name AS name_1, g0_.label AS label_2'
. ', g0_.public AS public_3, g0_.is_exception AS is_exception_4'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'test_name',
'label_2' => 'test_label',
'public_3' => 1,
'is_exception_4' => 0
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'disable_partial_load' => true,
'fields' => [
'name' => [
'exclude' => true
],
'isException' => [
'exclude' => true
]
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'label' => 'test_label',
'public' => true
]
],
$result
);
}
/**
* @deprecated since 1.9. Use 'exclude' attribute for a field instead of 'excluded_fields' for an entity
*/
public function testSimpleEntityWithExclusionDeprecatedAndPartialLoadDisabled()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.name AS name_1, g0_.label AS label_2'
. ', g0_.public AS public_3, g0_.is_exception AS is_exception_4'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'test_name',
'label_2' => 'test_label',
'public_3' => 1,
'is_exception_4' => 0
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'excluded_fields' => ['name', 'isException'],
'disable_partial_load' => true
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'label' => 'test_label',
'public' => true
]
],
$result
);
}
public function testSimpleEntityWithSpecifiedFieldsButNoExclusionPolicy()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.name AS name_1, g0_.label AS label_2'
. ', g0_.public AS public_3, g0_.is_exception AS is_exception_4'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'test_name',
'label_2' => null,
'public_3' => 0,
'is_exception_4' => 0
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'fields' => [
'id' => null,
'name' => null,
],
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'name' => 'test_name',
'label' => null,
'public' => false,
'isException' => false
]
],
$result
);
}
public function testSimpleEntityWithSpecifiedFieldsOnly()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.name AS name_1'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'test_name',
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'fields' => [
'id' => null,
'name' => null,
],
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'name' => 'test_name',
]
],
$result
);
}
public function testSimpleEntityWithSpecifiedFieldsAndExclusions()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'fields' => [
'id' => null,
'name' => [
'exclude' => true
],
],
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
]
],
$result
);
}
/**
* @deprecated since 1.9. Use 'exclude' attribute for a field instead of 'excluded_fields' for an entity
*/
public function testSimpleEntityWithSpecifiedFieldsAndExclusionsDeprecated()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'excluded_fields' => ['name'],
'fields' => [
'id' => null,
'name' => null,
],
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
]
],
$result
);
}
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function testSimpleEntityWithPostActionAsClosure()
{
$qb = $this->em->getRepository('Test:User')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$conn = $this->getDriverConnectionMock($this->em);
$this->setQueryExpectationAt(
$conn,
0,
'SELECT u0_.id AS id_0, u0_.name AS name_1,'
. ' c1_.name AS name_2,'
. ' u0_.category_name AS category_name_3'
. ' FROM user_table u0_'
. ' LEFT JOIN category_table c1_ ON u0_.category_name = c1_.name'
. ' WHERE u0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'user_name',
'name_2' => 'category_name',
'category_name_3' => 'category_name'
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$this->setQueryExpectationAt(
$conn,
1,
'SELECT u0_.id AS id_0, p1_.name AS name_1, p1_.id AS id_2'
. ' FROM product_table p1_'
. ' INNER JOIN user_table u0_ ON (p1_.owner_id = u0_.id)'
. ' WHERE u0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'product_name',
'id_2' => 10
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'fields' => [
'id' => null,
'name' => null,
'category' => [
'exclusion_policy' => 'all',
'fields' => [
'name' => null
],
'post_serialize' => function (array $result, array $context) {
$result['additional'] = sprintf('%s_additional[%s]', $result['name'], $context['key']);
return $result;
}
],
'products' => [
'exclusion_policy' => 'all',
'fields' => [
'name' => null
],
'post_serialize' => function (array $result, array $context) {
$result['additional'] = sprintf('%s_additional[%s]', $result['name'], $context['key']);
return $result;
}
],
],
'post_serialize' => function (array $result, array $context) {
$result['additional'] = sprintf('%s_additional[%s]', $result['name'], $context['key']);
return $result;
}
],
['key' => 'context value']
);
$this->assertArrayEquals(
[
[
'id' => 1,
'name' => 'user_name',
'category' => [
'name' => 'category_name',
'additional' => 'category_name_additional[context value]'
],
'products' => [
[
'name' => 'product_name',
'additional' => 'product_name_additional[context value]'
]
],
'additional' => 'user_name_additional[context value]'
]
],
$result
);
}
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function testSimpleEntityWithPostActionAsCallable()
{
$qb = $this->em->getRepository('Test:User')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$conn = $this->getDriverConnectionMock($this->em);
$this->setQueryExpectationAt(
$conn,
0,
'SELECT u0_.id AS id_0, u0_.name AS name_1,'
. ' c1_.name AS name_2,'
. ' u0_.category_name AS category_name_3'
. ' FROM user_table u0_'
. ' LEFT JOIN category_table c1_ ON u0_.category_name = c1_.name'
. ' WHERE u0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'user_name',
'name_2' => 'category_name',
'category_name_3' => 'category_name'
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$this->setQueryExpectationAt(
$conn,
1,
'SELECT u0_.id AS id_0, p1_.name AS name_1, p1_.id AS id_2'
. ' FROM product_table p1_'
. ' INNER JOIN user_table u0_ ON (p1_.owner_id = u0_.id)'
. ' WHERE u0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'product_name',
'id_2' => 10
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'fields' => [
'id' => null,
'name' => null,
'category' => [
'exclusion_policy' => 'all',
'fields' => [
'name' => null
],
'post_serialize' => [$this, 'postSerializeCallback']
],
'products' => [
'exclusion_policy' => 'all',
'fields' => [
'name' => null
],
'post_serialize' => [$this, 'postSerializeCallback']
],
],
'post_serialize' => [$this, 'postSerializeCallback']
],
['key' => 'context value']
);
$this->assertArrayEquals(
[
[
'id' => 1,
'name' => 'user_name',
'category' => [
'name' => 'category_name',
'additional' => 'category_name_additional[context value]'
],
'products' => [
[
'name' => 'product_name',
'additional' => 'product_name_additional[context value]'
]
],
'additional' => 'user_name_additional[context value]'
]
],
$result
);
}
public function postSerializeCallback(array $result, array $context)
{
$result['additional'] = sprintf('%s_additional[%s]', $result['name'], $context['key']);
return $result;
}
public function testPostActionForNullChild()
{
$qb = $this->em->getRepository('Test:User')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$conn = $this->getDriverConnectionMock($this->em);
$this->setQueryExpectationAt(
$conn,
0,
'SELECT u0_.id AS id_0, u0_.name AS name_1,'
. ' c1_.name AS name_2,'
. ' u0_.category_name AS category_name_3'
. ' FROM user_table u0_'
. ' LEFT JOIN category_table c1_ ON u0_.category_name = c1_.name'
. ' WHERE u0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'user_name',
'name_2' => null,
'category_name_3' => null
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'fields' => [
'id' => null,
'name' => null,
'category' => [
'exclusion_policy' => 'all',
'fields' => [
'name' => null
],
'post_serialize' => function (array $result, array $context) {
$result['additional'] = $result['name'] . '_additional';
return $result;
}
],
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'name' => 'user_name',
'category' => null
]
],
$result
);
}
/**
* @deprecated since 1.9. Use new signature of 'post_serialize' callback:
* function (array $item) : array
*/
public function testSimpleEntityWithPostActionDeprecated()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.name AS name_1, g0_.label AS label_2'
. ', g0_.public AS public_3, g0_.is_exception AS is_exception_4'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'test_name',
'label_2' => 'test_label',
'public_3' => 1,
'is_exception_4' => 0
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'post_serialize' => function (array &$result) {
$result['additional'] = $result['name'] . '_additional';
}
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'name' => 'test_name',
'label' => 'test_label',
'public' => true,
'isException' => false,
'additional' => 'test_name_additional'
]
],
$result
);
}
public function testSimpleEntityWithMetadata()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.label AS label_1'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'label_1' => 'test_label'
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'fields' => [
'entity' => [
'property_path' => '__class__'
],
'name' => [
'exclude' => true
],
'public' => [
'exclude' => true
],
'isException' => [
'exclude' => true
]
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'label' => 'test_label',
'entity' => 'Oro\Component\EntitySerializer\Tests\Unit\Fixtures\Entity\Group'
]
],
$result
);
}
/**
* @deprecated since 1.9. Use 'exclude' attribute for a field instead of 'excluded_fields' for an entity
* @deprecated since 1.9. Use `property_path` attribute instead of 'result_name'
*/
public function testSimpleEntityWithMetadataDeprecated()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.label AS label_1'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'label_1' => 'test_label'
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'excluded_fields' => ['name', 'public', 'isException'],
'fields' => [
'__class__' => [
'result_name' => 'entity'
]
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'label' => 'test_label',
'entity' => 'Oro\Component\EntitySerializer\Tests\Unit\Fixtures\Entity\Group'
]
],
$result
);
}
public function testSimpleEntityWithMetadataAndExcludeAllPolicy()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.label AS label_1'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'label_1' => 'test_label'
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'fields' => [
'id' => null,
'label' => null,
'entity' => [
'property_path' => '__class__'
]
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'label' => 'test_label',
'entity' => 'Oro\Component\EntitySerializer\Tests\Unit\Fixtures\Entity\Group'
]
],
$result
);
}
/**
* @deprecated since 1.9. Use `property_path` attribute instead of 'result_name'
*/
public function testSimpleEntityWithMetadataAndExcludeAllPolicyDeprecated()
{
$qb = $this->em->getRepository('Test:Group')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT g0_.id AS id_0, g0_.label AS label_1'
. ' FROM group_table g0_'
. ' WHERE g0_.id = ?',
[
[
'id_0' => 1,
'label_1' => 'test_label'
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'fields' => [
'id' => null,
'label' => null,
'__class__' => [
'result_name' => 'entity'
]
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'label' => 'test_label',
'entity' => 'Oro\Component\EntitySerializer\Tests\Unit\Fixtures\Entity\Group'
]
],
$result
);
}
/**
* tests that not configured relations is skipped
* it is a temporary fix until the identifier field will not be used by default for them
*/
public function testNotConfiguredRelations()
{
$qb = $this->em->getRepository('Test:Product')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$this->setQueryExpectation(
$this->getDriverConnectionMock($this->em),
'SELECT p0_.id AS id_0, p0_.name AS name_1,'
. ' p0_.category_name AS category_name_2, p0_.owner_id AS owner_id_3'
. ' FROM product_table p0_'
. ' WHERE p0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'product_name',
'category_name_2' => 'category_name',
'owner_id_3' => 10,
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'fields' => [
'id' => null,
'name' => null
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'name' => 'product_name'
]
],
$result
);
}
public function testSimpleEntityWithRenamedFields()
{
$qb = $this->em->getRepository('Test:User')->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', 1);
$conn = $this->getDriverConnectionMock($this->em);
$this->setQueryExpectationAt(
$conn,
0,
'SELECT u0_.id AS id_0, u0_.name AS name_1,'
. ' c1_.name AS name_2, c1_.label AS label_3,'
. ' u0_.category_name AS category_name_4'
. ' FROM user_table u0_'
. ' LEFT JOIN category_table c1_ ON u0_.category_name = c1_.name'
. ' WHERE u0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'user_name',
'name_2' => 'category_name',
'label_3' => 'category_label',
'category_name_4' => 'category_name'
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$this->setQueryExpectationAt(
$conn,
1,
'SELECT u0_.id AS id_0, p1_.name AS name_1, p1_.id AS id_2'
. ' FROM product_table p1_'
. ' INNER JOIN user_table u0_ ON (p1_.owner_id = u0_.id)'
. ' WHERE u0_.id = ?',
[
[
'id_0' => 1,
'name_1' => 'product_name',
'id_2' => 10
]
],
[1 => 1],
[1 => \PDO::PARAM_INT]
);
$result = $this->serializer->serialize(
$qb,
[
'exclusion_policy' => 'all',
'fields' => [
'id' => null,
'renamedName' => [
'property_path' => 'name'
],
'category' => [
'exclusion_policy' => 'all',
'fields' => [
'renamedLabel' => [
'property_path' => 'label'
]
],
],
'products' => [
'exclusion_policy' => 'all',
'fields' => [
'renamedName' => [
'property_path' => 'name'
]
],
],
]
]
);
$this->assertArrayEquals(
[
[
'id' => 1,
'renamedName' => 'user_name',
'category' => [
'renamedLabel' => 'category_label'
],
'products' => [
['renamedName' => 'product_name']
]
]
],
$result
);
}
}
|
Djamy/platform
|
src/Oro/Component/EntitySerializer/Tests/Unit/SimpleEntitySerializerTest.php
|
PHP
|
mit
| 40,585
|
<footer>
<div class="container">
</div>
</footer>
|
paris3200/flask-inventory
|
app/templates/footer.html
|
HTML
|
mit
| 54
|
<div class="ws-selector">
<div class="ws-selector-header">
<div class="btn-toolbar ws-toolbar">
<div class="dropdown pull-left">
<a ng-show="$root.USER_ID" data-toggle="dropdown">
Filter <span class="caret"></span>
</a>
<ul class="dropdown-menu settings-dropdown perm-filters" role="menu">
<!--<div class="checkbox pull-left">
<label><input id="ws-filter-projects" type="checkbox" value="">Narrative Projects</label>
</div>-->
<div class="checkbox pull-left">
<label><input id="ws-filter-owner" type="checkbox" value="">Owner</label>
</div>
<br><br><hr class="hr">
Your permission:<br>
<div class="checkbox">
<label><input id="ws-filter-admin" type="checkbox" value="" checked>Admin</label>
</div>
<div class="checkbox">
<label><input id="ws-filter-write" type="checkbox" value="" checked>Write</label>
</div>
<div class="checkbox">
<label><input id="ws-filter-read" type="checkbox" value="" checked>Read</label>
</div>
</ul>
</div>
<a ng-show="$root.USER_ID" class="btn-new-ws pull-left">New+</a>
<!--<a class="btn-analysis pull-left" ui-sref="analysis({ws: $scope.ws})">Analysis</a>-->
<div class="fav-toolbar" style="display: none;">
<div class="fav-toolbar-title pull-left">Objects</div>
<button type="button" class="btn btn-default pull-right" ng-click="clearList()">Clear</button>
</div>
</div>
<input type="text" class="search-query" placeholder="Search Workspaces">
</div>
<div id="select-box" class="select-box scroll-pane">
<table class="table table-bordered table-condensed table-hover"></table>
</div>
<div favoritesidebar style="display: none;" id="favorite-sidebar" class="scroll-pane"></div>
</div>
|
msneddon/ui-common
|
functional-site/views/ws/ws-selector.html
|
HTML
|
mit
| 2,242
|
//==================================================================================
// Copyright (c) 2016 , Advanced Micro Devices, Inc. All rights reserved.
//
/// \author AMD Developer Tools Team
/// \file pdRemoteProcessDebuggerDebuggingServerWatcherThread.h
///
//==================================================================================
//------------------------------ pdRemoteProcessDebuggerDebuggingServerWatcherThread.h ------------------------------
#ifndef __PDREMOTEPROCESSDEBUGGERDEBUGGINGSERVERWATCHERTHREAD_H
#define __PDREMOTEPROCESSDEBUGGERDEBUGGINGSERVERWATCHERTHREAD_H
// Infra:
#include <AMDTOSWrappers/Include/osThread.h>
// ----------------------------------------------------------------------------------
// Class Name: pdRemoteProcessDebuggerDebuggingServerWatcherThread : public osThread
// General Description: A thread to monitor the remote debugging server, and terminate it when
// the debugged process is terminated.
// Author: Uri Shomroni
// Creation Date: 16/8/2009
// ----------------------------------------------------------------------------------
class pdRemoteProcessDebuggerDebuggingServerWatcherThread : public osThread
{
public:
pdRemoteProcessDebuggerDebuggingServerWatcherThread();
~pdRemoteProcessDebuggerDebuggingServerWatcherThread();
// Overrides osThread:
virtual int entryPoint();
virtual void beforeTermination();
// Used to start and stop monitoring debugging servers:
void monitorLocalMachineDebuggingServer(osProcessId debuggingServerProcID);
void stopMonitoringDebuggingServer();
// Are we currently watching a process:
bool isMonitoringRemoteDebuggingServer() const {return (0 != _localMachineDebuggingServerProcId);};
private:
void terminateDebuggingServer();
private:
bool _waitingForNewServer;
osProcessId _localMachineDebuggingServerProcId;
};
#endif //__PDREMOTEPROCESSDEBUGGERDEBUGGINGSERVERWATCHERTHREAD_H
|
ilangal-amd/CodeXL
|
CodeXL/Components/GpuDebugging/AMDTProcessDebugger/src/pdRemoteProcessDebuggerDebuggingServerWatcherThread.h
|
C
|
mit
| 1,995
|
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\CatalogInventory\Model;
use Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface;
use Magento\CatalogInventory\Api\StockRepositoryInterface;
use Magento\CatalogInventory\Api\StockItemRepositoryInterface;
use Magento\CatalogInventory\Api\StockStatusRepositoryInterface;
use Magento\CatalogInventory\Api\Data\StockInterfaceFactory;
use Magento\CatalogInventory\Api\Data\StockItemInterfaceFactory;
use Magento\CatalogInventory\Api\Data\StockStatusInterfaceFactory;
use Magento\CatalogInventory\Api\StockCriteriaInterfaceFactory;
use Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory;
use Magento\CatalogInventory\Api\StockStatusCriteriaInterfaceFactory;
use Magento\Store\Model\StoreManagerInterface;
/**
* Class StockRegistryProvider
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class StockRegistryProvider implements StockRegistryProviderInterface
{
/**
* @var StockRepositoryInterface
*/
protected $stockRepository;
/**
* @var StockInterfaceFactory
*/
protected $stockFactory;
/**
* @var StockItemRepositoryInterface
*/
protected $stockItemRepository;
/**
* @var StockItemInterfaceFactory
*/
protected $stockItemFactory;
/**
* @var StockStatusRepositoryInterface
*/
protected $stockStatusRepository;
/**
* @var StockStatusInterfaceFactory
*/
protected $stockStatusFactory;
/**
* @var StockCriteriaInterfaceFactory
*/
protected $stockCriteriaFactory;
/**
* @var StockItemCriteriaInterfaceFactory
*/
protected $stockItemCriteriaFactory;
/**
* @var StockStatusCriteriaInterfaceFactory
*/
protected $stockStatusCriteriaFactory;
/**
* @var StockRegistryStorage
*/
protected $stockRegistryStorage;
/**
* @param StockRepositoryInterface $stockRepository
* @param StockInterfaceFactory $stockFactory
* @param StockItemRepositoryInterface $stockItemRepository
* @param StockItemInterfaceFactory $stockItemFactory
* @param StockStatusRepositoryInterface $stockStatusRepository
* @param StockStatusInterfaceFactory $stockStatusFactory
* @param StockCriteriaInterfaceFactory $stockCriteriaFactory
* @param StockItemCriteriaInterfaceFactory $stockItemCriteriaFactory
* @param StockStatusCriteriaInterfaceFactory $stockStatusCriteriaFactory
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
StockRepositoryInterface $stockRepository,
StockInterfaceFactory $stockFactory,
StockItemRepositoryInterface $stockItemRepository,
StockItemInterfaceFactory $stockItemFactory,
StockStatusRepositoryInterface $stockStatusRepository,
StockStatusInterfaceFactory $stockStatusFactory,
StockCriteriaInterfaceFactory $stockCriteriaFactory,
StockItemCriteriaInterfaceFactory $stockItemCriteriaFactory,
StockStatusCriteriaInterfaceFactory $stockStatusCriteriaFactory
) {
$this->stockRepository = $stockRepository;
$this->stockFactory = $stockFactory;
$this->stockItemRepository = $stockItemRepository;
$this->stockItemFactory = $stockItemFactory;
$this->stockStatusRepository = $stockStatusRepository;
$this->stockStatusFactory = $stockStatusFactory;
$this->stockCriteriaFactory = $stockCriteriaFactory;
$this->stockItemCriteriaFactory = $stockItemCriteriaFactory;
$this->stockStatusCriteriaFactory = $stockStatusCriteriaFactory;
}
/**
* @param int|null $scopeId
* @return \Magento\CatalogInventory\Api\Data\StockInterface
*/
public function getStock($scopeId)
{
$stock = $this->getStockRegistryStorage()->getStock($scopeId);
if (null === $stock) {
$criteria = $this->stockCriteriaFactory->create();
$criteria->setScopeFilter($scopeId);
$collection = $this->stockRepository->getList($criteria);
$stock = current($collection->getItems());
if ($stock && $stock->getStockId()) {
$this->getStockRegistryStorage()->setStock($scopeId, $stock);
} else {
$stock = $this->stockFactory->create();
}
}
return $stock;
}
/**
* @param int $productId
* @param int $scopeId
* @return \Magento\CatalogInventory\Api\Data\StockItemInterface
*/
public function getStockItem($productId, $scopeId)
{
$stockItem = $this->getStockRegistryStorage()->getStockItem($productId, $scopeId);
if (null === $stockItem) {
$criteria = $this->stockItemCriteriaFactory->create();
$criteria->setProductsFilter($productId);
$collection = $this->stockItemRepository->getList($criteria);
$stockItem = current($collection->getItems());
if ($stockItem && $stockItem->getItemId()) {
$this->getStockRegistryStorage()->setStockItem($productId, $scopeId, $stockItem);
} else {
$stockItem = $this->stockItemFactory->create();
}
}
return $stockItem;
}
/**
* @param int $productId
* @param int $scopeId
* @return \Magento\CatalogInventory\Api\Data\StockStatusInterface
*/
public function getStockStatus($productId, $scopeId)
{
$stockStatus = $this->getStockRegistryStorage()->getStockStatus($productId, $scopeId);
if (null === $stockStatus) {
$criteria = $this->stockStatusCriteriaFactory->create();
$criteria->setProductsFilter($productId);
$criteria->setScopeFilter($scopeId);
$collection = $this->stockStatusRepository->getList($criteria);
$stockStatus = current($collection->getItems());
if ($stockStatus && $stockStatus->getProductId()) {
$this->getStockRegistryStorage()->setStockStatus($productId, $scopeId, $stockStatus);
} else {
$stockStatus = $this->stockStatusFactory->create();
}
}
return $stockStatus;
}
/**
* @return StockRegistryStorage
*/
private function getStockRegistryStorage()
{
if (null === $this->stockRegistryStorage) {
$this->stockRegistryStorage = \Magento\Framework\App\ObjectManager::getInstance()
->get('Magento\CatalogInventory\Model\StockRegistryStorage');
}
return $this->stockRegistryStorage;
}
}
|
j-froehlich/magento2_wk
|
vendor/magento/module-catalog-inventory/Model/StockRegistryProvider.php
|
PHP
|
mit
| 6,699
|
#include "data_types.h"
#include "misc.h"
#include "base/MiscHelpers.h"
using namespace std;
using namespace Scheduler;
using namespace Core;
Resource::Resource(const string& name) : p_res_type(ResourceStatic), p_name(name), p_str_val(), p_avail(RESC_UNSPECIFIED), p_max(RESC_INFINITY), p_assign(RESC_UNSPECIFIED) {}
Resource::~Resource() {}
void Resource::set_capacity(char *value)
{
if (is_num(value))
{
this->p_max = res_to_num(value);
this->p_str_val = value;
this->p_res_type = ResourceStatic;
}
else
{
this->p_max = RESC_UNSPECIFIED;
this->p_avail = RESC_UNSPECIFIED;
this->p_assign = RESC_UNSPECIFIED;
this->p_str_val = value;
this->p_res_type = ResourceString;
}
}
void Resource::set_avail(char *value)
{
if (is_num(value))
{
this->p_avail = res_to_num(value);
this->p_max = RESC_UNSPECIFIED; // dynamic resources don't have capacity
this->p_str_val = value;
this->p_res_type = ResourceDynamic;
}
else
{
this->p_avail = 0;
this->p_max = RESC_UNSPECIFIED;
this->p_str_val = value;
this->p_res_type = ResourceString;
}
}
void Resource::set_utilization(sch_resource_t value)
{
this->p_assign = value;
// if (this->p_max == UNSPECIFIED)
// this->p_max = 0;
}
void Resource::set_utilization(char *value)
{
sch_resource_t val = res_to_num(value);
this->set_utilization(val);
}
void Resource::consume_resource(char *value)
{
sch_resource_t val = res_to_num(value);
this->consume_resource(val);
}
void Resource::consume_resource(sch_resource_t value)
{
this->p_assign += value;
}
void Resource::freeup_resource(char *value)
{
sch_resource_t val = res_to_num(value);
this->freeup_resource(val);
}
void Resource::freeup_resource(sch_resource_t value)
{
this->p_assign -= value;
}
void Resource::reset()
{
this->p_res_type = ResourceStatic;
this->p_avail = RESC_UNSPECIFIED;
this->p_max = RESC_UNSPECIFIED;
this->p_assign = RESC_UNSPECIFIED;
}
CheckResult Resource::check_numeric_fit(sch_resource_t amount)
{
if (this->p_max != RESC_INFINITY && this->p_max != RESC_UNSPECIFIED && this->p_max < amount) // there is a max and it's lower than the requested amount
return CheckNonFit;
if (this->p_max == RESC_UNSPECIFIED || this->p_max == RESC_INFINITY) // no max value present, only current
{
if (this->p_avail - this->p_assign >= amount)
return CheckAvailable;
else
return CheckOccupied;
}
else // max value present
{
if (this->p_max - this->p_assign >= amount)
return CheckAvailable;
else
return CheckOccupied;
}
}
CheckResult Resource::check_fit(char *value)
{
if (this->is_string()) // string resources work as properties
{
if (p_str_val != value)
return CheckNonFit;
else
return CheckAvailable;
}
sch_resource_t amount = res_to_num(value);
return this->check_numeric_fit(amount);
}
|
CESNET/TorqueFastSched
|
base/Resource.cpp
|
C++
|
mit
| 2,977
|
using System;
using System.Linq;
using System.Text;
namespace _03.Mankind
{
public class Student : Human
{
private string facultyNumber;
public Student(string firstName, string lastName, string facultyNumber) : base(firstName, lastName)
{
this.FacultyNumber = facultyNumber;
}
public string FacultyNumber
{
get { return this.facultyNumber; }
set
{
if (value.Length < 5 || value.Length > 10 ||
!value.All(char.IsLetterOrDigit))
{
throw new ArgumentException("Invalid faculty number!");
}
this.facultyNumber = value;
}
}
public override string ToString()
{
var sb = new StringBuilder();
sb.Append(base.ToString())
.AppendLine($"Faculty number: {this.FacultyNumber}");
return sb.ToString();
}
}
}
|
zrusev/SoftUni_2016
|
05. C# OOP Basics - June 2017/03. Inheritance/03. Inheritance - Exercise/Exercises Inheritance/03. Mankind/Student.cs
|
C#
|
mit
| 1,009
|
<?php return unserialize('a:2:{i:0;O:26:"Doctrine\\ORM\\Mapping\\Table":5:{s:4:"name";N;s:6:"schema";N;s:7:"indexes";N;s:17:"uniqueConstraints";N;s:7:"options";a:0:{}}i:1;O:27:"Doctrine\\ORM\\Mapping\\Entity":2:{s:15:"repositoryClass";s:59:"Quartet\\Bundle\\KakarotBundle\\Entity\\CleanScheduleRepository";s:8:"readOnly";b:0;}}');
|
emudmudmudmu/myoffice
|
app/cache/prod/annotations/5012b9ffdc125e778418e40c201ca542e7a325a2.cache.php
|
PHP
|
mit
| 330
|
package standard
import (
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"strings"
"github.com/labstack/echo"
"github.com/labstack/echo/engine"
"github.com/labstack/gommon/log"
)
type (
// Request implements `engine.Request`.
Request struct {
*http.Request
header engine.Header
url engine.URL
logger *log.Logger
}
)
const (
defaultMemory = 32 << 20 // 32 MB
)
// NewRequest returns `Request` instance.
func NewRequest(r *http.Request, l *log.Logger) *Request {
return &Request{
Request: r,
url: &URL{URL: r.URL},
header: &Header{Header: r.Header},
logger: l,
}
}
// IsTLS implements `engine.Request#TLS` function.
func (r *Request) IsTLS() bool {
return r.Request.TLS != nil
}
// Scheme implements `engine.Request#Scheme` function.
func (r *Request) Scheme() string {
if r.IsTLS() {
return "https"
}
return "http"
}
// Host implements `engine.Request#Host` function.
func (r *Request) Host() string {
return r.Request.Host
}
// URL implements `engine.Request#URL` function.
func (r *Request) URL() engine.URL {
return r.url
}
// Header implements `engine.Request#URL` function.
func (r *Request) Header() engine.Header {
return r.header
}
// func Proto() string {
// return r.request.Proto()
// }
//
// func ProtoMajor() int {
// return r.request.ProtoMajor()
// }
//
// func ProtoMinor() int {
// return r.request.ProtoMinor()
// }
// ContentLength implements `engine.Request#ContentLength` function.
func (r *Request) ContentLength() int {
return int(r.Request.ContentLength)
}
// UserAgent implements `engine.Request#UserAgent` function.
func (r *Request) UserAgent() string {
return r.Request.UserAgent()
}
// RemoteAddress implements `engine.Request#RemoteAddress` function.
func (r *Request) RemoteAddress() string {
return r.RemoteAddr
}
// Method implements `engine.Request#Method` function.
func (r *Request) Method() string {
return r.Request.Method
}
// SetMethod implements `engine.Request#SetMethod` function.
func (r *Request) SetMethod(method string) {
r.Request.Method = method
}
// URI implements `engine.Request#URI` function.
func (r *Request) URI() string {
return r.RequestURI
}
// SetURI implements `engine.Request#SetURI` function.
func (r *Request) SetURI(uri string) {
r.RequestURI = uri
}
// Body implements `engine.Request#Body` function.
func (r *Request) Body() io.Reader {
return r.Request.Body
}
// SetBody implements `engine.Request#SetBody` function.
func (r *Request) SetBody(reader io.Reader) {
r.Request.Body = ioutil.NopCloser(reader)
}
// FormValue implements `engine.Request#FormValue` function.
func (r *Request) FormValue(name string) string {
return r.Request.FormValue(name)
}
// FormParams implements `engine.Request#FormParams` function.
func (r *Request) FormParams() map[string][]string {
if strings.HasPrefix(r.header.Get(echo.HeaderContentType), echo.MIMEMultipartForm) {
if err := r.ParseMultipartForm(defaultMemory); err != nil {
r.logger.Error(err)
}
} else {
if err := r.ParseForm(); err != nil {
r.logger.Error(err)
}
}
return map[string][]string(r.Request.Form)
}
// FormFile implements `engine.Request#FormFile` function.
func (r *Request) FormFile(name string) (*multipart.FileHeader, error) {
_, fh, err := r.Request.FormFile(name)
return fh, err
}
// MultipartForm implements `engine.Request#MultipartForm` function.
func (r *Request) MultipartForm() (*multipart.Form, error) {
err := r.ParseMultipartForm(defaultMemory)
return r.Request.MultipartForm, err
}
// Cookie implements `engine.Request#Cookie` function.
func (r *Request) Cookie(name string) (engine.Cookie, error) {
c, err := r.Request.Cookie(name)
if err != nil {
return nil, echo.ErrCookieNotFound
}
return &Cookie{c}, nil
}
// Cookies implements `engine.Request#Cookies` function.
func (r *Request) Cookies() []engine.Cookie {
cs := r.Request.Cookies()
cookies := make([]engine.Cookie, len(cs))
for i, c := range cs {
cookies[i] = &Cookie{c}
}
return cookies
}
func (r *Request) reset(req *http.Request, h engine.Header, u engine.URL) {
r.Request = req
r.header = h
r.url = u
}
|
golang-devops/go-psexec
|
vendor/github.com/labstack/echo/engine/standard/request.go
|
GO
|
mit
| 4,125
|
import * as Mocha from 'mocha';
import * as glob from 'glob';
import * as path from 'path';
import * as minimist from 'minimist';
import { execSilent } from './e2e/utils/process';
const argv = minimist(process.argv.slice(2), {
boolean: ['debug', 'verbose', 'nolink', 'nobuild'],
string: ['glob', 'ignore']
});
const specFiles = glob.sync(path.resolve(__dirname, './unit/**/*.spec.*'));
const mo = new Mocha({ timeout: 180000, reporter: 'spec' });
Promise.resolve()
.then((): any => {
if (argv['nobuild']) {
return Promise.resolve();
} else {
return execSilent('npm', ['run', 'build:prod']);
}
})
.then((): any => {
if (argv['nolink']) {
return Promise.resolve();
} else {
return execSilent('npm', ['link']);
}
})
.then(() => {
specFiles.forEach(file => mo.addFile(file));
mo.run(failures => {
process.on('exit', () => process.exit(failures));
});
});
|
Izak88/abstruse
|
tests/unit_runner.ts
|
TypeScript
|
mit
| 938
|
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Adminhtml customer orders grid block
*
* @author Magento Core Team <core@magentocommerce.com>
*/
namespace Magento\Customer\Block\Adminhtml\Edit\Tab;
/**
* @SuppressWarnings(PHPMD.DepthOfInheritance)
*/
class Reviews extends \Magento\Review\Block\Adminhtml\Grid
{
/**
* Hide grid mass action elements
*
* @return \Magento\Customer\Block\Adminhtml\Edit\Tab\Reviews
*/
protected function _prepareMassaction()
{
return $this;
}
/**
* Determine ajax url for grid refresh
*
* @return string
*/
public function getGridUrl()
{
return $this->getUrl('customer/*/productReviews', ['_current' => true]);
}
}
|
j-froehlich/magento2_wk
|
vendor/magento/module-customer/Block/Adminhtml/Edit/Tab/Reviews.php
|
PHP
|
mit
| 820
|
import {
MISC_SELECTEDPLAYLIST_SET,
MISC_SELECTEDPLAYLIST_CLEAR,
MISC_SONGNAVSELECTION_SET,
} from '../constants';
export function setActivePlaylist(playlistId) {
return {
type: MISC_SELECTEDPLAYLIST_SET,
payload: { playlistId },
};
}
export function clearActivePlaylist() {
return {
type: MISC_SELECTEDPLAYLIST_CLEAR,
};
}
export function setSongNavSelectionType(songNavSelection) {
return {
type: MISC_SONGNAVSELECTION_SET,
payload: {
songNavSelection,
},
};
}
|
MrMint/markii
|
app/modules/misc/actions/index.js
|
JavaScript
|
mit
| 514
|
angular.module('dialogDemo1', ['ngMaterial'])
.controller('AppCtrl', function($scope, $mdDialog) {
$scope.alert = '';
$scope.showAlert = function(ev) {
// Appending dialog to document.body to cover sidenav in docs app
// Modal dialogs should fully cover application
// to prevent interaction outside of dialog
$mdDialog.show(
$mdDialog.alert()
.parent(angular.element(document.body))
.clickOutsideToClose(true)
.title('This is an alert title')
.content('You can specify some description text in here.')
.ariaLabel('Alert Dialog Demo')
.ok('Got it!')
.targetEvent(ev)
);
};
$scope.showConfirm = function(ev) {
// Appending dialog to document.body to cover sidenav in docs app
var confirm = $mdDialog.confirm()
.parent(angular.element(document.body))
.title('Would you like to delete your debt?')
.content('All of the banks have agreed to forgive you your debts.')
.ariaLabel('Lucky day')
.ok('Please do it!')
.cancel('Sounds like a scam')
.targetEvent(ev);
$mdDialog.show(confirm).then(function() {
$scope.alert = 'You decided to get rid of your debt.';
}, function() {
$scope.alert = 'You decided to keep your debt.';
});
};
$scope.showAdvanced = function(ev) {
$mdDialog.show({
controller: DialogController,
templateUrl: 'dialog1.tmpl.html',
parent: angular.element(document.body),
targetEvent: ev,
})
.then(function(answer) {
$scope.alert = 'You said the information was "' + answer + '".';
}, function() {
$scope.alert = 'You cancelled the dialog.';
});
};
});
function DialogController($scope, $mdDialog) {
$scope.hide = function() {
$mdDialog.hide();
};
$scope.cancel = function() {
$mdDialog.cancel();
};
$scope.answer = function(answer) {
$mdDialog.hide(answer);
};
}
|
ryancampbell/material
|
src/components/dialog/demoBasicUsage/script.js
|
JavaScript
|
mit
| 1,961
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Threading.Tasks;
namespace System.IO.Pipelines
{
public static class PipelineWriterExtensions
{
private readonly static Task _completedTask = Task.FromResult(0);
public static Task WriteAsync(this IPipeWriter output, byte[] source)
{
return WriteAsync(output, new ArraySegment<byte>(source));
}
public static Task WriteAsync(this IPipeWriter output, ArraySegment<byte> source)
{
var writeBuffer = output.Alloc();
writeBuffer.Write(source);
return FlushAsync(writeBuffer);
}
private static Task FlushAsync(WritableBuffer writeBuffer)
{
var awaitable = writeBuffer.FlushAsync();
if (awaitable.IsCompleted)
{
awaitable.GetResult();
return _completedTask;
}
return FlushAsyncAwaited(awaitable);
}
private static async Task FlushAsyncAwaited(WritableBufferAwaitable awaitable)
{
await awaitable;
}
}
}
|
Vedin/corefxlab
|
src/System.IO.Pipelines/PipelineWriterExtensions.cs
|
C#
|
mit
| 1,235
|
/**
* jquery.calendar.js 1.0
* http://jquerywidget.com
*/
;(function (factory) {
if (typeof define === "function" && (define.amd || define.cmd) && !jQuery) {
// AMD或CMD
define([ "jquery" ],factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = function( root, jQuery ) {
if ( jQuery === undefined ) {
if ( typeof window !== 'undefined' ) {
jQuery = require('jquery');
} else {
jQuery = require('jquery')(root);
}
}
factory(jQuery);
return jQuery;
};
} else {
//Browser globals
factory(jQuery);
}
}(function ($) {
$.fn.calendar = function(parameter,getApi) {
if(typeof parameter == 'function'){ //重载
getApi = parameter;
parameter = {};
}else{
parameter = parameter || {};
getApi = getApi||function(){};
}
var defaults = {
prefix:'widget', //生成日历的class前缀
isRange:false, //是否选择范围
limitRange:[], //有效选择区域的范围
highlightRange:[], //指定日期范围高亮
onChange:function(){}, //当前选中月份修改时触发
onSelect:function(){} //选择日期时触发
};
var options = $.extend({}, defaults, parameter);
return this.each(function() {
var $this = $(this);
var $table = $('<table>').appendTo($this);
var $caption = $('<caption>').appendTo($table);
var $prevYear = $('<a class="'+options.prefix+'-prevYear" href="javascript:;"><<</a>').appendTo($caption);
var $prevMonth = $('<a class="'+options.prefix+'-prevMonth" href="javascript:;"><</a>').appendTo($caption);
var $title = $('<span>').appendTo($caption);
var $nextMonth = $('<a class="'+options.prefix+'-nextMonth" href="javascript:;">></a>').appendTo($caption);
var $nextYear = $('<a class="'+options.prefix+'-nextYear" href="javascript:;">>></a>').appendTo($caption);
var $back = $('<a class="'+options.prefix+'-back" href="javascript:;">今天</a>').appendTo($caption);
var _today, //当天
_data, //日期数据
_day, //日历状态
_range = []; //当前选择范围
/***** 节点修改 *****/
$table.append('<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th>六</th></tr></thead>');
var $tbody = $('<tbody>').appendTo($table);
/***** 私有方法 *****/
//获取日期数据
var getDateObj = function(year,month,day){
var date = arguments.length&&year?new Date(year,month-1,day):new Date();
var obj = {
'year':date.getFullYear(),
'month':date.getMonth()+1,
'day':date.getDate(),
'week':date.getDay()
};
obj['code'] = ''+obj['year']+(obj['month']>9?obj['month']:'0'+obj['month'])+(obj['day']>9?obj['day']:'0'+obj['day']);
return obj;
};
//获取当月天数
var getMonthDays = function(obj){
var day = new Date(obj.year,obj.month,0);
return day.getDate();
};
//获取某天日期信息
var getDateInfo = function(obj){
if(options.limitRange.length){
obj['status'] = 'disabled';
for(var i=0;i<options.limitRange.length;i++){
var start = options.limitRange[i][0];
var end = options.limitRange[i][1];
if(start=='today'){
start = _today['code'];
}
if(end=='today'){
end = _today['code'];
}
if(start>end){
start = [end,end=start][0];
}
if(obj['code']>=start&&obj['code']<=end){
obj['status'] = '';
break;
}
}
}
obj['sign'] = [];
if(options.highlightRange.length){
for(var i=0;i<options.highlightRange.length;i++){
var start = options.highlightRange[i][0];
var end = options.highlightRange[i][1];
if(start=='today'){
start = _today['code'];
}
if(end=='today'){
end = _today['code'];
}
if(start>end){
start = [end,end=start][0];
}
if(obj['code']>=start&&obj['code']<=end){
obj['sign'].push('highlight');
break;
}
}
}
if(obj['code']==_today['code']){
obj['sign'].push('today');
}
return obj;
};
var getData = function(obj){
if(typeof obj=='undefined'){
obj = _today;
}
_day = getDateObj(obj['year'],obj['month'],1); //当月第一天
var days = getMonthDays(_day); //当月天数
var data = []; //日历信息
var obj = {};
//上月日期
for(var i=_day['week'];i>0;i--){
obj = getDateObj(_day['year'],_day['month'],_day['day']-i);
var info = getDateInfo(obj);
if(!options.limitRange.length){
info['status'] = 'disabled';
}
data.push(info);
}
//当月日期
for(var i=0;i<days;i++){
obj = {
'year':_day['year'],
'month':_day['month'],
'day':_day['day']+i,
'week':(_day['week']+i)%7
};
obj['code'] = ''+obj['year']+(obj['month']>9?obj['month']:'0'+obj['month'])+(obj['day']>9?obj['day']:'0'+obj['day']);
var info = getDateInfo(obj);
data.push(info);
}
//下月日期
var last = obj;
for(var i=1;last['week']+i<7;i++){
obj = getDateObj(last['year'],last['month'],last['day']+i);
var info = getDateInfo(obj);
if(!options.limitRange.length){
info['status'] = 'disabled';
}
data.push(info);
}
return data;
};
var format = function(data){
options.onChange(_day);
for(var i=0;i<data.length;i++){
var d = data[i];
if(d['status'] == 'active'){
d['status'] = '';
}
}
if(_range.length==2){
var start = _range[0]['code'];
var end = _range[1]['code'];
for(var i=0;i<data.length;i++){
var d = data[i];
if(d['code']>=start&&d['code']<=end){
if(d['status']=='disabled'){
_range[1]=d;
break;
}else{
d['status'] = 'active';
}
}
}
}else if(_range.length==1){
for(var i=0;i<data.length;i++){
var d = data[i];
if(d['code']==_range[0]['code']){
d['status'] = 'active';
}
}
}
var html = '<tr>';
for(var i=0,len=data.length;i<len;i++){
var day = data[i];
var arr = [];
for(var s=0;s<day['sign'].length;s++){
arr.push(options.prefix+'-'+day['sign'][s]);
}
if(day['status']){
arr.push(options.prefix+'-'+day['status']);
}
var className = arr.join(' ');
html+='<td'+(className?' class="'+className+'"':'')+' data-id="'+i+'">\
'+(day['link']?'<a href="'+day['link']+'">'+day['day']+'</a>':'<span>'+day['day']+'</span>')+'\
</td>';
if(i%7==6&&i<len-1){
html+='</tr><tr>';
}
}
html+='</tr>';
$title.html(_day['year']+'年'+_day['month']+'月');
$tbody.html(html);
};
/***** 初始化 *****/
_today = getDateObj();
_day = {
'year':_today['year'],
'month':_today['month']
};
$prevMonth.click(function(){
_day['month']--;
_data = getData(_day);
format(_data);
});
$nextMonth.click(function(){
_day['month']++;
_data = getData(_day);
format(_data);
});
$prevYear.click(function(){
_day['year']--;
_data = getData(_day);
format(_data);
});
$nextYear.click(function(){
_day['year']++;
_data = getData(_day);
format(_data);
});
$back.click(function(){
_data = getData();
format(_data);
});
$this.on('click','td',function(){
var $this = $(this);
var index = $(this).data('id');
var day = _data[index];
if(day['status']!='disabled'){
if(options.isRange){
if(_range.length!=1){
_range = [day];
format(_data);
}else{
_range.push(day);
_range.sort(function(a,b){
return a['code']>b['code'];
});
format(_data);
options.onSelect(_range);
}
}else{
_range = [day];
format(_data);
options.onSelect(_range);
}
}
});
_data = getData();
format(_data);
});
};
}));
|
chaiqingshan/chaiqingshan.github.io
|
effects/demo/demo-calender/js/index.js
|
JavaScript
|
mit
| 11,615
|
#ifndef __GUI_H
#define __GUI_H
typedef struct
{
u16 Left; //区域离屏幕左边界的距离 像素数
u16 Top; //区域离屏幕上边界的距离 像素数
u16 Width; //区域宽度
u16 Height; //区域高度
u16 BackColor; //区域背景色
u16 ForeColor; //区域前景色
}GUI_Area;
extern GUI_Area Screen;
extern GUI_Area Label[];
extern u16 touch_left;
extern u16 touch_top;
#define G_wel 0
#define G_neme 1
#define G_prc 2
#define G_recg 3
#define G_cap 4
//必须保证顺序 模板存储时用到
#define G_num0 5
#define G_num9 14
#define G_up 15
#define G_down 16
#define G_front 17
#define G_back 18
#define G_left 19
#define G_right 20
#define G_big 21
#define G_little 22
#define G_comm_fst G_num0
#define G_comm_lst G_little
#define G_ctrl 23
#define G_spk 24
#define G_stus 25
#define G_count 26
#define G_return 27
#define G_designer 28
#define G_recg_res 29
#define G_mtch_dis 30
void wait_touch(void); //等待屏幕点击
u8 touch_area(GUI_Area *area); //判断是否点击指定区域
void GUI_HideArea(GUI_Area *Area); //隐藏区域 显示屏幕前景色
void GUI_ClrArea(GUI_Area *Area); //清除区域 显示区域背景色
void GUI_DispStr(GUI_Area *Area,const u8 *str); //在区域内显示字符串
void GUI_printf(GUI_Area *Area,char *fmt, ...); //printf函数在区域内的实现
#endif
|
gk969/stm32-speech-recognition
|
Src/GUI/GUI.H
|
C++
|
mit
| 1,449
|
<form name="forms.wizard.step3b" ng-submit="wizardSubmit()" novalidate>
<div class="form-group">
<label>Select something</label>
<select class="form-control" name="something" required
ng-model="wizard.something"
ng-init="wizard.something = wizard.something || 'deadend'">
<option value="deadend">Go to dead-end</option>
<option value="finish">Finish wizard</option>
</select>
</div>
<button class="btn btn-default" type="button" ng-click="wizardBack(['something'])">Back</button>
<button class="btn btn-default" type="submit"
ng-disabled="forms.wizard.step3b.$invalid">Continue</button>
</form>
|
toenu23/angular-simplewizard
|
example/views/step3b.html
|
HTML
|
mit
| 647
|
#!/bin/bash
FN="hguqiagenv3.db_3.2.3.tar.gz"
URLS=(
"https://bioconductor.org/packages/3.11/data/annotation/src/contrib/hguqiagenv3.db_3.2.3.tar.gz"
"https://bioarchive.galaxyproject.org/hguqiagenv3.db_3.2.3.tar.gz"
"https://depot.galaxyproject.org/software/bioconductor-hguqiagenv3.db/bioconductor-hguqiagenv3.db_3.2.3_src_all.tar.gz"
"https://depot.galaxyproject.org/software/bioconductor-hguqiagenv3.db/bioconductor-hguqiagenv3.db_3.2.3_src_all.tar.gz"
)
MD5="91ebb82e773ff799befdb8921b38e90e"
# Use a staging area in the conda dir rather than temp dirs, both to avoid
# permission issues as well as to have things downloaded in a predictable
# manner.
STAGING=$PREFIX/share/$PKG_NAME-$PKG_VERSION-$PKG_BUILDNUM
mkdir -p $STAGING
TARBALL=$STAGING/$FN
SUCCESS=0
for URL in ${URLS[@]}; do
curl $URL > $TARBALL
[[ $? == 0 ]] || continue
# Platform-specific md5sum checks.
if [[ $(uname -s) == "Linux" ]]; then
if md5sum -c <<<"$MD5 $TARBALL"; then
SUCCESS=1
break
fi
else if [[ $(uname -s) == "Darwin" ]]; then
if [[ $(md5 $TARBALL | cut -f4 -d " ") == "$MD5" ]]; then
SUCCESS=1
break
fi
fi
fi
done
if [[ $SUCCESS != 1 ]]; then
echo "ERROR: post-link.sh was unable to download any of the following URLs with the md5sum $MD5:"
printf '%s\n' "${URLS[@]}"
exit 1
fi
# Install and clean up
R CMD INSTALL --library=$PREFIX/lib/R/library $TARBALL
rm $TARBALL
rmdir $STAGING
|
roryk/recipes
|
recipes/bioconductor-hguqiagenv3.db/post-link.sh
|
Shell
|
mit
| 1,440
|
/*
* Copyright 2013 Feifan Tang. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Provider;
namespace Microsoft.Owin.Security.QQ
{
public class QQConnectReturnEndpointContext : ReturnEndpointContext
{
public QQConnectReturnEndpointContext(
IOwinContext context,
AuthenticationTicket ticket)
: base(context, ticket)
{
}
}
}
|
gavin-hao/framework_aspnet
|
src/Microsoft.Owin.Security.QQ/Provider/QQConnectReturnEndpointContext.cs
|
C#
|
mit
| 1,113
|
I represent an index with just 64 characters of the ascii range utilized; 33 - 96, so we must do without the {, }, |, ~, and space characters. This increases my number of meaningful characters and eliminates the need for case-sensitive matching.
|
magma-database/magma
|
src/Magma-Client.package/MaSearchStringIndex.class/README.md
|
Markdown
|
mit
| 246
|
import Route from '@ember/routing/route';
export default class Index extends Route {
async model() {
return await this.modelFor('blog');
}
resetController(controller, isExiting, transition) {
if (isExiting && transition.targetName !== 'error') {
controller.set('page', 1);
}
}
}
|
shipshapecode/website
|
app/routes/blog/index.js
|
JavaScript
|
mit
| 307
|
/** @module transition */ /** for typedoc */
import {StateDeclaration} from "../state/interface";
import {Predicate} from "../common/common";
import {Transition} from "./transition";
import {State} from "../state/stateObject";
import {PathNode} from "../path/node";
import {TargetState} from "../state/targetState";
import {UIInjector} from "../common/interface";
/**
* The TransitionOptions object can be used to change the behavior of a transition.
*
* It is passed as the third argument to [[$state.go]], [[$state.transitionTo]], and
* can be used with the [[ui-sref-opts]] directive.
*/
export interface TransitionOptions {
/**
* This option changes how the Transition interacts with the browser's location bar (URL).
*
* - If `true`, it will update the url in the location bar.
* - If `false`, it will not update the url in the location bar.
* - If it is the string "`replace`", it will update the url and also replace the last history record.
*
* @default `true`
*/
location ?: (boolean|string);
/**
* When transitioning to relative path (e.g '`^`'), this option defines which state to be relative from.
* @default `$state.current`
*/
relative ?: (string|StateDeclaration|State);
/**
* This option sets whether or not the transition's parameter values should be inherited from
* the current state parameters.
*
* - If `true`, it will inherit parameters from current state.
* - If `false`, only the parameters which are provided to `transitionTo` will be used.
*
* @default `false`
*/
inherit ?: boolean;
/**
* @deprecated
*/
notify ?: boolean;
/**
* This option may be used to force states which are currently active to reload.
*
* During a normal transition, a state is "retained" if:
* - It was previously active
* - The state's parameter values have not changed
* - All the parent states' parameter values have not changed
*
* Forcing a reload of a state will cause it to be exited and entered, which will:
* - Refetch that state's resolve data
* - Exit the state (onExit hook)
* - Re-enter the state (onEnter hook)
* - Re-render the views (controllers and templates)
*
* - When `true`, the destination state (and all parent states) will be reloaded.
* - When it is a string and is the name of a state, or when it is a State object,
* that state and any children states will be reloaded.
*
* @default `false`
*/
reload ?: (boolean|string|StateDeclaration|State);
/**
* You can define your own Transition Options inside this property and use them, e.g., from a Transition Hook
*/
custom ?: any;
/** @hidden @internal */
reloadState ?: (State);
/** @hidden @internal
* If this transition is a redirect, this property should be the original Transition (which was redirected to this one)
*/
redirectedFrom?: Transition;
/** @hidden @internal */
current ?: () => Transition;
/** @hidden @internal */
source ?: "sref"|"url"|"redirect"|"unknown";
}
/** @hidden @internal */
export interface TransitionHookOptions {
async ?: boolean;
rejectIfSuperseded ?: boolean;
current ?: () => Transition; //path?
transition ?: Transition;
hookType ?: string;
target ?: any;
traceData ?: any;
bind ?: any;
stateHook ?: boolean;
}
/**
* TreeChanges encapsulates the various Paths that are involved in a Transition.
*
* Get a TreeChanges object using [[Transition.treeChanges]]
*
* A UI-Router Transition is from one Path in a State Tree to another Path. For a given Transition,
* this object stores the "to" and "from" paths, as well as subsets of those: the "retained",
* "exiting" and "entering" paths.
*
* Each path in TreeChanges is an array of [[PathNode]] objects. Each PathNode in the array corresponds to a portion
* of a nested state.
*
* For example, if you had a nested state named `foo.bar.baz`, it would have three
* portions, `foo, bar, baz`. If you transitioned **to** `foo.bar.baz` and inspected the [[TreeChanges.to]]
* Path, you would find a node in the array for each portion: `foo`, `bar`, and `baz`.
*
* ---
*
* @todo show visual state tree
*/
export interface TreeChanges {
/** @nodoc */
[key: string]: PathNode[];
/** The path of nodes in the state tree that the transition is coming *from* */
from: PathNode[];
/** The path of nodes in the state tree that the transition is going *to* */
to: PathNode[];
/**
* The path of active nodes that the transition is retaining.
*
* These nodes are neither exited, nor entered.
* Before and after the transition is successful, these nodes are active.
*/
retained: PathNode[];
/**
* The path of previously active nodes that the transition is exiting.
*
* After the Transition is successful, these nodes are no longer active.
*
* Note that a state that is being reloaded (due to parameter values changing, or `reload: true`) may be in both the
* `exiting` and `entering` paths.
*/
exiting: PathNode[];
/**
* The path of nodes that the transition is entering.
*
* After the Transition is successful, these nodes will be active.
* Because they are entering, they have their resolves fetched, `onEnter` hooks run, and their views
* (component(s) or controller(s)+template(s)) refreshed.
*
* Note that a state that is reloaded (due to parameter values changing, or `reload: true`) may be in both the
* `exiting` and `entering` paths.
*/
entering: PathNode[];
}
export type IErrorHandler = (error: Error) => void;
export type IHookGetter = (hookName: string) => IEventHook[];
export type IHookRegistration = (matchCriteria: HookMatchCriteria, callback: HookFn, options?: HookRegOptions) => Function;
/**
* The signature for Transition Hooks.
*
* Transition hooks are callback functions that hook into the lifecycle of transitions.
* As a transition runs, it reaches certain lifecycle events.
* As each event occurs, the hooks which are registered for the event are called (in priority order).
*
* A transition hook may alter a Transition by returning a [[HookResult]].
*
* @param transition the current [[Transition]]
* @param injector (for ng1 or ng2 only) the injector service
*
* @returns a [[HookResult]] which may alter the transition
*
* @see
*
* - [[IHookRegistry.onBefore]]
* - [[IHookRegistry.onStart]]
* - [[IHookRegistry.onFinish]]
* - [[IHookRegistry.onSuccess]]
* - [[IHookRegistry.onError]]
*/
export interface TransitionHookFn {
(transition: Transition) : HookResult
}
/**
* The signature for Transition State Hooks.
*
* A function which hooks into a lifecycle event for a specific state.
*
* Transition State Hooks are callback functions that hook into the lifecycle events of specific states during a transition.
* As a transition runs, it may exit some states, retain (keep) states, and enter states.
* As each lifecycle event occurs, the hooks which are registered for the event and that state are called (in priority order).
*
* @param transition the current [[Transition]]
* @param state the [[State]] that the hook is bound to
* @param injector (for ng1 or ng2 only) the injector service
*
* @returns a [[HookResult]] which may alter the transition
*
* @see
*
* - [[IHookRegistry.onExit]]
* - [[IHookRegistry.onRetain]]
* - [[IHookRegistry.onEnter]]
*/
export interface TransitionStateHookFn {
(transition: Transition, state: State) : HookResult
}
export type HookFn = (TransitionHookFn|TransitionStateHookFn);
/**
* The return value of a [[TransitionHookFn]] or [[TransitionStateHookFn]]
*
* When returned from a [[TransitionHookFn]] or [[TransitionStateHookFn]], these values alter the running [[Transition]]:
*
* - `false`: the transition will be cancelled.
* - [[TargetState]]: the transition will be redirected to the new target state (see: [[StateService.target]])
* - `Promise`: the transition will wait for the promise to resolve or reject
* - If the promise is rejected (or resolves to `false`), the transition will be cancelled
* - If the promise resolves to a [[TargetState]], the transition will be redirected
* - If the promise resolves to anything else, the transition will resume
* - Anything else: the transition will resume
*/
export type HookResult = (boolean | TargetState | void | Promise<boolean|TargetState|void>);
/**
* These options may be provided when registering a Transition Hook (such as `onStart`)
*/
export interface HookRegOptions {
/**
* Sets the priority of the registered hook
*
* Hooks of the same type (onBefore, onStart, etc) are invoked in priority order. A hook with a higher priority
* is invoked before a hook with a lower priority.
*
* The default hook priority is 0
*/
priority?: number;
/**
* Specifies what `this` is bound to during hook invocation.
*/
bind?: any;
}
/**
* This interface specifies the api for registering Transition Hooks. Both the
* [[TransitionService]] and also the [[Transition]] object itself implement this interface.
* Note: the Transition object only allows hooks to be registered before the Transition is started.
*/
export interface IHookRegistry {
/**
* Registers a [[TransitionHookFn]], called *before a transition starts*.
*
* Registers a transition lifecycle hook, which is invoked before a transition even begins.
* This hook can be useful to implement logic which prevents a transition from even starting, such
* as authentication, redirection
*
* See [[TransitionHookFn]] for the signature of the function.
*
* The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.
* To match all Transitions, use an empty criteria object `{}`.
*
* ### Lifecycle
*
* `onBefore` hooks are invoked *before a Transition starts*.
* No resolves have been fetched yet.
* Each `onBefore` hook is invoked synchronously, in the same call stack as [[StateService.transitionTo]].
* The registered `onBefore` hooks are invoked in priority order.
*
* Note: during the `onBefore` phase, additional hooks can be added to the specific [[Transition]] instance.
* These "on-the-fly" hooks only affect the currently running transition..
*
* ### Return value
*
* The hook's return value can be used to pause, cancel, or redirect the current Transition.
* See [[HookResult]] for more information.
*
* If any hook modifies the transition *synchronously* (by throwing, returning `false`, or returning
* a [[TargetState]]), the remainder of the hooks are skipped.
* If a hook returns a promise, the remainder of the `onBefore` hooks are still invoked synchronously.
* All promises are resolved, and processed asynchronously before the `onStart` phase of the Transition.
*
* ### Examples
*
* #### Default Substate
*
* This example redirects any transition from 'home' to 'home.dashboard'. This is commonly referred to as a
* "default substate".
*
* @example
* ```js
* // ng2
* transitionService.onBefore({ to: 'home' }, (trans: Transition) =>
* trans.router.stateService.target("home.dashboard"));
* ```
*
* #### Data Driven Default Substate
*
* This example provides data-driven default substate functionality. It matches on a transition to any state
* which has `defaultSubstate: "some.sub.state"` defined. See: [[Transition.to]] which returns the "to state"
* definition.
*
* @example
* ```js
* // ng1
* // state declaration
* {
* name: 'home',
* template: '<div ui-view/>',
* defaultSubstate: 'home.dashboard'
* }
*
* var criteria = {
* to: function(state) {
* return state.defaultSubstate != null;
* }
* }
*
* $transitions.onBefore(criteria, function(trans: Transition) {
* var substate = trans.to().defaultSubstate;
* return trans.router.stateService.target(substate);
* });
* ```
*
*
* #### Require authentication
*
* This example cancels a transition to a state which requires authentication, if the user is not currently authenticated.
*
* This example assumes a state tree where all states which require authentication are children of a parent `'requireauth'` state.
* This example assumes `MyAuthService` synchronously returns a boolean from `isAuthenticated()`.
*
* @example
* ```js
* // ng1
* $transitions.onBefore( { to: 'requireauth.**' }, function(trans) {
* var myAuthService = trans.injector().get('MyAuthService');
* // If isAuthenticated returns false, the transition is cancelled.
* return myAuthService.isAuthenticated();
* });
* ```
*
* @param matchCriteria defines which Transitions the Hook should be invoked for.
* @param callback the hook function which will be invoked.
* @returns a function which deregisters the hook.
*/
onBefore(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;
/**
* Registers a [[TransitionHookFn]], called when a transition starts.
*
* Registers a transition lifecycle hook, which is invoked as a transition starts running.
* This hook can be useful to perform some asynchronous action before completing a transition.
*
* See [[TransitionHookFn]] for the signature of the function.
*
* The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.
* To match all Transitions, use an empty criteria object `{}`.
*
* ### Lifecycle
*
* `onStart` hooks are invoked asynchronously when the Transition starts running.
* This happens after the `onBefore` phase is complete.
* At this point, the Transition has not yet exited nor entered any states.
* The registered `onStart` hooks are invoked in priority order.
*
* Note: A built-in `onStart` hook with high priority is used to fetch any eager resolve data.
*
* ### Return value
*
* The hook's return value can be used to pause, cancel, or redirect the current Transition.
* See [[HookResult]] for more information.
*
* ### Example
*
* #### Login during transition
*
* This example intercepts any transition to a state which requires authentication, when the user is
* not currently authenticated. It allows the user to authenticate asynchronously, then resumes the
* transition. If the user did not authenticate successfully, it redirects to the "guest" state, which
* does not require authentication.
*
* This example assumes:
* - a state tree where all states which require authentication are children of a parent `'auth'` state.
* - `MyAuthService.isAuthenticated()` synchronously returns a boolean.
* - `MyAuthService.authenticate()` presents a login dialog, and returns a promise which is resolved
* or rejected, whether or not the login attempt was successful.
*
* @example
* ```js
* // ng1
* $transitions.onStart( { to: 'auth.**' }, function(trans) {
* var $state = trans.router.stateService;
* var MyAuthService = trans.injector().get('MyAuthService');
*
* // If the user is not authenticated
* if (!MyAuthService.isAuthenticated()) {
*
* // Then return a promise for a successful login.
* // The transition will wait for this promise to settle
*
* return MyAuthService.authenticate().catch(function() {
*
* // If the authenticate() method failed for whatever reason,
* // redirect to a 'guest' state which doesn't require auth.
* return $state.target("guest");
* });
* }
* });
* ```
*
* @param matchCriteria defines which Transitions the Hook should be invoked for.
* @param callback the hook function which will be injected and invoked.
* @returns a function which deregisters the hook.
*/
onStart(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;
/**
* Registers a [[TransitionStateHookFn]], called when a specific state is entered.
*
* Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being entered.
*
* Since this hook is run only when the specific state is being *entered*, it can be useful for
* performing tasks when entering a submodule/feature area such as initializing a stateful service,
* or for guarding access to a submodule/feature area.
*
* See [[TransitionStateHookFn]] for the signature of the function.
*
* The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.
* `onEnter` hooks generally specify `{ entering: 'somestate' }`.
* To match all Transitions, use an empty criteria object `{}`.
*
* ### Lifecycle
*
* `onEnter` hooks are invoked when the Transition is entering a state.
* States are entered after the `onRetain` phase is complete.
* If more than one state is being entered, the parent state is entered first.
* The registered `onEnter` hooks for a state are invoked in priority order.
*
* Note: A built-in `onEnter` hook with high priority is used to fetch lazy resolve data for states being entered.
*
* ### Return value
*
* The hook's return value can be used to pause, cancel, or redirect the current Transition.
* See [[HookResult]] for more information.
*
* ### Inside a state declaration
*
* Instead of registering `onEnter` hooks using the [[TransitionService]], you may define an `onEnter` hook
* directly on a state declaration (see: [[StateDeclaration.onEnter]]).
*
*
* ### Examples
*
* #### Audit Log
*
* This example uses a service to log that a user has entered the admin section of an app.
* This assumes that there are substates of the "admin" state, such as "admin.users", "admin.pages", etc.
* @example
* ```
*
* $transitions.onEnter({ entering: 'admin' }, function(transition, state) {
* var AuditService = trans.injector().get('AuditService');
* AuditService.log("Entered " + state.name + " module while transitioning to " + transition.to().name);
* }
* ```
*
* #### Audit Log (inside a state declaration)
*
* The `onEnter` inside this state declaration is syntactic sugar for the previous Audit Log example.
* ```
* {
* name: 'admin',
* component: 'admin',
* onEnter: function($transition$, $state$) {
* var AuditService = $transition$.injector().get('AuditService');
* AuditService.log("Entered " + state.name + " module while transitioning to " + transition.to().name);
* }
* }
* ```
*
* Note: A state declaration's `onEnter` function is injected for Angular 1 only.
*
* @param matchCriteria defines which Transitions the Hook should be invoked for.
* @param callback the hook function which will be injected and invoked.
* @returns a function which deregisters the hook.
*/
onEnter(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;
/**
* Registers a [[TransitionStateHookFn]], called when a specific state is retained/kept.
*
* Registers a lifecycle hook, which is invoked (during a transition) for
* a specific state that was previously active and is not being entered nor exited.
*
* Since this hook is invoked when a transition is when the state is kept, it means the transition
* is coming *from* a substate of the kept state *to* a substate of the kept state.
* This hook can be used to perform actions when the user moves from one substate to another, such as
* between steps in a wizard.
*
* The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.
* `onRetain` hooks generally specify `{ retained: 'somestate' }`.
* To match all Transitions, use an empty criteria object `{}`.
*
* ### Lifecycle
*
* `onRetain` hooks are invoked after any `onExit` hooks have been fired.
* If more than one state is retained, the child states' `onRetain` hooks are invoked first.
* The registered `onRetain` hooks for a state are invoked in priority order.
*
* ### Return value
*
* The hook's return value can be used to pause, cancel, or redirect the current Transition.
* See [[HookResult]] for more information.
*
* ### Inside a state declaration
*
* Instead of registering `onRetain` hooks using the [[TransitionService]], you may define an `onRetain` hook
* directly on a state declaration (see: [[StateDeclaration.onRetain]]).
*
* Note: A state declaration's `onRetain` function is injected for Angular 1 only.
*
* @param matchCriteria defines which Transitions the Hook should be invoked for.
* @param callback the hook function which will be injected and invoked.
* @returns a function which deregisters the hook.
*/
onRetain(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;
/**
* Registers a [[TransitionStateHookFn]], called when a specific state is exited.
*
* Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being exited.
*
* Since this hook is run only when the specific state is being *exited*, it can be useful for
* performing tasks when leaving a submodule/feature area such as cleaning up a stateful service,
* or for preventing the user from leaving a state or submodule until some criteria is satisfied.
*
* See [[TransitionStateHookFn]] for the signature of the function.
*
* The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.
* `onExit` hooks generally specify `{ exiting: 'somestate' }`.
* To match all Transitions, use an empty criteria object `{}`.
*
* ### Lifecycle
*
* `onExit` hooks are invoked when the Transition is exiting a state.
* States are exited after any `onStart` phase is complete.
* If more than one state is being exited, the child states are exited first.
* The registered `onExit` hooks for a state are invoked in priority order.
*
* ### Return value
*
* The hook's return value can be used to pause, cancel, or redirect the current Transition.
* See [[HookResult]] for more information.
*
* ### Inside a state declaration
*
* Instead of registering `onExit` hooks using the [[TransitionService]], you may define an `onExit` hook
* directly on a state declaration (see: [[StateDeclaration.onExit]]).
*
* Note: A state declaration's `onExit` function is injected for Angular 1 only.
*
* @param matchCriteria defines which Transitions the Hook should be invoked for.
* @param callback the hook function which will be injected and invoked.
* @returns a function which deregisters the hook.
*/
onExit(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;
/**
* Registers a [[TransitionHookFn]], called *just before a transition finishes*.
*
* Registers a transition lifecycle hook, which is invoked just before a transition finishes.
* This hook is a last chance to cancel or redirect a transition.
*
* See [[TransitionHookFn]] for the signature of the function.
*
* The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.
* To match all Transitions, use an empty criteria object `{}`.
*
* ### Lifecycle
*
* `onFinish` hooks are invoked after the `onEnter` phase is complete.
* These hooks are invoked just before the transition is "committed".
* Each hook is invoked in priority order.
*
* ### Return value
*
* The hook's return value can be used to pause, cancel, or redirect the current Transition.
* See [[HookResult]] for more information.
*
* @param matchCriteria defines which Transitions the Hook should be invoked for.
* @param callback the hook function which will be injected and invoked.
* @returns a function which deregisters the hook.
*/
onFinish(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;
/**
* Registers a [[TransitionHookFn]], called after a successful transition completed.
*
* Registers a transition lifecycle hook, which is invoked after a transition successfully completes.
*
* See [[TransitionHookFn]] for the signature of the function.
*
* The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.
* To match all Transitions, use an empty criteria object `{}`.
*
* ### Lifecycle
*
* `onSuccess` hooks are chained off the Transition's promise (see [[Transition.promise]]).
* If the Transition is successful and its promise is resolved, then the `onSuccess` hooks are invoked.
* Since these hooks are run after the transition is over, their return value is ignored.
* The `onSuccess` hooks are invoked in priority order.
*
* ### Return value
*
* Since the Transition is already completed, the hook's return value is ignored
*
* @param matchCriteria defines which Transitions the Hook should be invoked for.
* @param callback the hook function which will be injected and invoked.
* @returns a function which deregisters the hook.
*/
onSuccess(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;
/**
* Registers a [[TransitionHookFn]], called after a transition has errored.
*
* Registers a transition lifecycle hook, which is invoked after a transition has been rejected for any reason.
*
* See [[TransitionHookFn]] for the signature of the function.
*
* The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.
* To match all Transitions, use an empty criteria object `{}`.
*
* ### Lifecycle
*
* The `onError` hooks are chained off the Transition's promise (see [[Transition.promise]]).
* If a Transition fails, its promise is rejected and the `onError` hooks are invoked.
* The `onError` hooks are invoked in priority order.
*
* Since these hooks are run after the transition is over, their return value is ignored.
*
* A transition "errors" if it was started, but failed to complete (for any reason).
* A *non-exhaustive list* of reasons a transition can error:
*
* - A transition was cancelled because a new transition started while it was still running
* - A transition was cancelled by a Transition Hook returning false
* - A transition was redirected by a Transition Hook returning a [[TargetState]]
* - A transition was invalid because the target state/parameters are not valid
* - A transition was ignored because the target state/parameters are exactly the current state/parameters
* - A Transition Hook or resolve function threw an error
* - A Transition Hook returned a rejected promise
* - A resolve function returned a rejected promise
*
* To check the failure reason, inspect the return value of [[Transition.error]].
*
* Note: `onError` should be used for targeted error handling, or error recovery.
* For simple catch-all error reporting, use [[StateService.defaultErrorHandler]].
*
* ### Return value
*
* Since the Transition is already completed, the hook's return value is ignored
*
* @param matchCriteria defines which Transitions the Hook should be invoked for.
* @param callback the hook function which will be injected and invoked.
* @returns a function which deregisters the hook.
*/
onError(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;
/**
* Returns all the registered hooks of a given `hookName` type
*
* @example
* ```
*
* $transitions.getHooks("onEnter")
* ```
*/
getHooks(hookName: string): IEventHook[];
}
/** A predicate type which takes a [[State]] and returns a boolean */
export type IStateMatch = Predicate<State>
/**
* This object is used to configure whether or not a Transition Hook is invoked for a particular transition,
* based on the Transition's "to state" and "from state".
*
* Each property (`to`, `from`, `exiting`, `retained`, and `entering`) can be a state [[Glob]] string,
* a boolean, or a function that takes a state and returns a boolean (see [[HookMatchCriterion]])
*
* All properties are optional. If any property is omitted, it is replaced with the value `true`, and always matches.
* To match any transition, use an empty criteria object `{}`.
*
* @example
* ```js
*
* // This matches a transition coming from the `parent` state and going to the `parent.child` state.
* var match = {
* to: 'parent',
* from: 'parent.child'
* }
* ```
*
* @example
* ```js
*
* // This matches a transition coming from any substate of `parent` and going directly to the `parent` state.
* var match = {
* to: 'parent',
* from: 'parent.**'
* }
* ```
*
* @example
* ```js
*
* // This matches a transition coming from any state and going to any substate of `mymodule`
* var match = {
* to: 'mymodule.**'
* }
* ```
*
* @example
* ```js
*
* // This matches a transition coming from any state and going to any state that has `data.authRequired`
* // set to a truthy value.
* var match = {
* to: function(state) {
* return state.data != null && state.data.authRequired === true;
* }
* }
* ```
*
* @example
* ```js
*
* // This matches a transition that is exiting `parent.child`
* var match = {
* exiting: 'parent.child'
* }
* ```
*/
export interface HookMatchCriteria {
/** A [[HookMatchCriterion]] to match the destination state */
to?: HookMatchCriterion;
/** A [[HookMatchCriterion]] to match the original (from) state */
from?: HookMatchCriterion;
/** A [[HookMatchCriterion]] to match any state that would be exiting */
exiting?: HookMatchCriterion;
/** A [[HookMatchCriterion]] to match any state that would be retained */
retained?: HookMatchCriterion;
/** A [[HookMatchCriterion]] to match any state that would be entering */
entering?: HookMatchCriterion;
}
export interface IMatchingNodes {
[key: string]: PathNode[];
to: PathNode[];
from: PathNode[];
exiting: PathNode[];
retained: PathNode[];
entering: PathNode[];
}
/**
* Hook Criterion used to match a transition.
*
* A [[Glob]] string that matches the name of a state.
*
* Or, a function with the signature `function(state) { return matches; }`
* which should return a boolean to indicate if a state matches.
*
* Or, `true` to always match
*/
export type HookMatchCriterion = (string|IStateMatch|boolean)
/** @hidden */
export interface IEventHook {
callback: HookFn;
priority?: number;
bind?: any;
matches: (treeChanges: TreeChanges) => IMatchingNodes;
_deregistered: boolean;
}
|
Chimaytric/angular_starter
|
bower_components/angular-ui-router/src/transition/interface.ts
|
TypeScript
|
mit
| 31,171
|
namespace Remotus.API.WinService
{
/// <summary>
/// Class exposed for Windows Service
/// </summary>
public class WinService : System.ServiceProcess.ServiceBase
{
public const string ServiceName = "Remotus";
public const string DisplayName = "Remotus";
public const string Description = "Windows Service which can take requests for managing processes and services";
private ServiceInstance _serviceInstance;
public WinService()
{
_serviceInstance = new ServiceInstance();
}
internal WinService(ServiceInstance serviceInstance)
{
_serviceInstance = serviceInstance;
}
protected override void OnStart(string[] args)
{
_serviceInstance?.Start(args);
base.OnStart(args);
}
protected override void OnPause()
{
//ApiService?.Pause();
base.OnPause();
}
protected override void OnContinue()
{
//ApiService?.Continue();
base.OnContinue();
}
protected override void OnStop()
{
_serviceInstance?.Stop();
base.OnStop();
}
protected override void Dispose(bool disposing)
{
_serviceInstance?.Dispose();
_serviceInstance = null;
base.Dispose(disposing);
}
}
}
|
LazyTarget/Remotus
|
src/Remotus.API/WinService/WinService.cs
|
C#
|
mit
| 1,451
|
/*
* Integrated Rule Inference System (IRIS):
* An extensible rule inference system for datalog with extensions.
*
* Copyright (C) 2008 Semantic Technology Institute (STI) Innsbruck,
* University of Innsbruck, Technikerstrasse 21a, 6020 Innsbruck, Austria.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.deri.iris.rules.compiler;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.deri.iris.Configuration;
import org.deri.iris.EvaluationException;
import org.deri.iris.api.basics.IAtom;
import org.deri.iris.api.basics.ILiteral;
import org.deri.iris.api.basics.IPredicate;
import org.deri.iris.api.basics.IQuery;
import org.deri.iris.api.basics.IRule;
import org.deri.iris.api.basics.ITuple;
import org.deri.iris.api.builtins.IBuiltinAtom;
import org.deri.iris.api.terms.IConstructedTerm;
import org.deri.iris.api.terms.ITerm;
import org.deri.iris.api.terms.IVariable;
import org.deri.iris.facts.IFacts;
import org.deri.iris.storage.IRelation;
import org.deri.iris.storage.IRelationFactory;
import org.deri.iris.storage.RelationFactory;
/**
* A rule compiler for creating objects that compute new facts using forward-chaining techniques.
*/
public class RuleCompiler {
/**
* Constructor.
* @param facts The facts that will be used by the compiled rules.
*/
public RuleCompiler(final IFacts facts, final Configuration configuration) {
mFacts = facts;
mConfiguration = configuration;
}
/**
* Compile a rule. No optimisations of any kind are attempted.
* @param rule The rule to be compiled
* @return The compiled rule, ready to be evaluated
* @throws EvaluationException If the query can not be compiled for any reason.
*/
public ICompiledRule compile(final IRule rule) throws EvaluationException {
final List<RuleElement> elements = compileBody(rule.getBody());
List<IVariable> variables;
if (elements.size() == 0) {
variables = new ArrayList<IVariable>();
} else {
final RuleElement lastElement = elements.get(elements.size() - 1);
variables = lastElement.getOutputVariables();
}
// Rule head
final IAtom headAtom = rule.getHead().iterator().next().getAtom();
final HeadSubstituter substituter = new HeadSubstituter(variables, headAtom, mConfiguration);
elements.add(substituter);
return new CompiledRule(elements, rule.getHead().iterator().next().getAtom().getPredicate(), mConfiguration);
}
/**
* Compile a query. No optimisations of any kind are attempted.
* @param query The query to be compiled
* @return The compiled query, ready to be evaluated
* @throws EvaluationException If the query can not be compiled for any reason.
*/
public ICompiledRule compile(final IQuery query) throws EvaluationException {
final List<RuleElement> elements = compileBody(query.getLiterals());
return new CompiledRule(elements, null, mConfiguration);
}
/**
* Compile a rule body (or query). The literals are compiled in the order given. However, if one literal can not be
* compiled, because one or more of its variables are not bound from the proceeding literal, then it is skipped an
* re-tried later.
* @param bodyLiterals The list of literals to compile
* @return The compiled rule elements.
* @throws EvaluationException If a rule construct can not be compiled (e.g. a built-in has constructed terms)
*/
private List<RuleElement> compileBody(final Collection<ILiteral> bodyLiterals) throws EvaluationException {
final List<ILiteral> literals = new ArrayList<ILiteral>(bodyLiterals);
final List<RuleElement> elements = new ArrayList<RuleElement>();
List<IVariable> previousVariables = new ArrayList<IVariable>();
while (elements.size() < bodyLiterals.size()) {
EvaluationException lastException = null;
boolean added = false;
for (int l = 0; l < literals.size(); ++l) {
final ILiteral literal = literals.get(l);
final IAtom atom = literal.getAtom();
final boolean positive = literal.isPositive();
RuleElement element;
try {
if (atom instanceof IBuiltinAtom) {
final IBuiltinAtom builtinAtom = (IBuiltinAtom) atom;
boolean constructedTerms = false;
for (final ITerm term : atom.getTuple()) {
if (term instanceof IConstructedTerm) {
constructedTerms = true;
break;
}
}
if (constructedTerms) {
element = new BuiltinForConstructedTermArguments(previousVariables, builtinAtom, positive,
mConfiguration);
} else {
element = new Builtin(previousVariables, builtinAtom, positive, mConfiguration);
}
} else {
final IPredicate predicate = atom.getPredicate();
IRelation relation;
/*
* Modified by Giorgio Orsi <orsi@elet.polimi.it> - Politecnico di Milano Check if the predicate
* is a stored-predicate
*/
if (predicate.getPredicateSymbol().startsWith("@")) {
final IRelationFactory rf = new RelationFactory();
relation = rf.createRelation(true, predicate.getPredicateSymbol().substring(1));
} else {
relation = mFacts.get(predicate);
}
final ITuple viewCriteria = atom.getTuple();
if (positive) {
if (previousVariables.size() == 0) {
// First sub-goal
element = new FirstSubgoal(predicate, relation, viewCriteria, mConfiguration);
} else {
element = new Joiner(previousVariables, predicate, relation, viewCriteria,
mConfiguration.indexFactory, mConfiguration.relationFactory);
}
} else {
// This *is* allowed to be the first literal for
// rules such as:
// p('a') :- not q('b')
// or even:
// p('a') :- not q(?X)
element = new Differ(previousVariables, relation, viewCriteria, mConfiguration);
}
}
previousVariables = element.getOutputVariables();
elements.add(element);
literals.remove(l);
added = true;
break;
} catch (final EvaluationException e) {
// Oh dear. Store the exception and try the next literal.
lastException = e;
}
}
if (!added)
// No more literals, so the last error really was serious.
throw lastException;
}
return elements;
}
/** The knowledge-base facts used to attach to the compiled rule elements. */
private final IFacts mFacts;
/** The knowledge-base configuration. */
private final Configuration mConfiguration;
}
|
personalised-semantic-search/JoDS_IRIS--
|
JoDS_IRIS+-/src/org/deri/iris/rules/compiler/RuleCompiler.java
|
Java
|
mit
| 7,330
|
/* global describe, it */
var assert = require('assert');
var jsdom = require('mocha-jsdom');
var React = require('react/addons');
var TestUtils = React.addons.TestUtils;
var stubContext = require('react-stub-context');
var Three = require('../src/Three');
describe('Three', function () {
jsdom();
var levels, content, render;
it('renders one level deep', function () {
render = TestUtils.renderIntoDocument(
React.createElement(Three)
);
levels = TestUtils.scryRenderedDOMComponentsWithTag(render, 'div');
assert.equal(levels.length, 1);
});
describe('without context', function () {
it('renders nothing without context from parents at one level deep', function () {
render = TestUtils.renderIntoDocument(
React.createElement(Three)
);
content = render.getDOMNode().textContent;
assert.notEqual(content.indexOf('Three (, )'), -1);
});
});
describe('with context', function () {
it('renders context from parents at one level deep', function () {
Three = stubContext(Three, { a: 'Aye', b: 'Bee' });
render = TestUtils.renderIntoDocument(
React.createElement(Three)
);
content = render.getDOMNode().textContent;
assert.notEqual(content.indexOf('Three (Aye, Bee)'), -1);
});
});
});
|
JedWatson/react-context-example
|
test/Three.js
|
JavaScript
|
mit
| 1,254
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("XamarinCommons")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("Admin")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
y2k/XamarinCommons
|
XamarinCommons/Properties/AssemblyInfo.cs
|
C#
|
mit
| 995
|
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./app.ts");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./app.ts":
/*!****************!*\
!*** ./app.ts ***!
\****************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("throw new Error(\"Module parse failed: Unexpected token (2:1)/nYou may need an appropriate loader to handle this file type./n| var a;/n| == 0;/n| \");\n\n//# sourceURL=webpack:///./app.ts?");
/***/ })
/******/ });
|
jbrantly/ts-loader
|
test/comparison-tests/errors/expectedOutput-2.9/bundle.js
|
JavaScript
|
mit
| 3,975
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="NetworkAcl.cs" company="Naos Project">
// Copyright (c) Naos Project 2019. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Naos.AWS.Domain
{
/// <summary>
/// Route table model object.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Acl", Justification = "Spelling/name is correct.")]
public class NetworkAcl : IAwsObject
{
/// <summary>
/// Rule number that indicates the last catch all rule.
/// </summary>
public const long FallThroughRuleNumber = 32767;
/// <summary>
/// Gets or sets the region.
/// </summary>
public string Region { get; set; }
/// <summary>
/// Gets or sets the Id.
/// </summary>
public string Id { get; set; }
/// <summary>
/// Gets or sets the Name.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets a value indicating whether or not this is the default ACL of its VPC.
/// </summary>
public bool IsDefault { get; set; }
/// <summary>
/// Gets or sets the subnets the ACL is associated with.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Want these clearly ordered.")]
public Subnet[] AssociatedSubnets { get; set; }
/// <summary>
/// Gets or sets the inbound rules.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Want these clearly ordered.")]
public NetworkAclRule[] InboundRules { get; set; }
/// <summary>
/// Gets or sets the outbound rules.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Want these clearly ordered.")]
public NetworkAclRule[] OutboundRules { get; set; }
}
}
|
NaosProject/Naos.AWS
|
Naos.AWS.Domain/NetworkAcl.cs
|
C#
|
mit
| 2,417
|
package com.aquafx_project.controls.skin.effects;
import javafx.scene.effect.BlurType;
import javafx.scene.effect.DropShadow;
import javafx.scene.paint.Color;
/**
* Defines the Mac OS X specific very light shadow for some controls.
* This Effect is a dropshadow.
*
* @author claudinezillmann
*
*/
public class Shadow extends DropShadow {
public Shadow(boolean pillShadow) {
setColor(Color.rgb(172, 172, 184));
setBlurType(BlurType.ONE_PASS_BOX);
setRadius(2.0);
setSpread(0.1);
setOffsetX(0.0);
setOffsetY(0.8);
if (pillShadow) {
setOffsetX(1.0);
setOffsetY(0.5);
setWidth(1.0);
}
}
}
|
cis422s14team5/WatchlistPro
|
src/com/aquafx_project/controls/skin/effects/Shadow.java
|
Java
|
mit
| 706
|
var searchData=
[
['addra',['addrA',['../a00028.html#a3cae9d5d9bef65c080151c7a068aba59',1,'ip_addr']]],
['addrb',['addrB',['../a00028.html#affc4950defbac0add14648c302d1cca3',1,'ip_addr']]],
['addrc',['addrC',['../a00028.html#a2965c835c1e5f0a593e0ce78a9e22596',1,'ip_addr']]],
['addrd',['addrD',['../a00028.html#a46e67573cf0c4c6cc8fcaf4573a441c5',1,'ip_addr']]],
['adv',['adv',['../a00043.html#aa0b33ec0b236628dd65628a7aa238b03',1,'utils_temperature']]],
['aitc',['aitc',['../a00046.html#a4ef06d5c9fc774f79cf065ec4d971518',1,'aitc.c']]],
['all_5fships',['all_ships',['../a00101.html#af4ba9abb0410a1ddc659f565de7a0e00',1,'model_battleship.c']]],
['apprunning',['appRunning',['../a00099.html#a2c9ae8a4de631e631a531446605ee47d',1,'model.c']]],
['apptext',['appText',['../a00099.html#acb5bd952a87114eb0c59dcba58e5f782',1,'model.c']]],
['arpcache',['arpcache',['../a00108.html#a7489612cbdbbec7ea6dc20811cafd90f',1,'network.h']]]
];
|
romainfroidevaux/RealTimeEmbeddedConsole
|
doc/html/search/variables_0.js
|
JavaScript
|
mit
| 946
|
///
/// Copyright (c) 2016 Dropbox, Inc. All rights reserved.
///
/// Auto-generated by Stone, do not modify.
///
#import <Foundation/Foundation.h>
#import "DBSerializableProtocol.h"
@class DBTEAMMembersSetProfileArg;
@class DBTEAMUserSelectorArg;
NS_ASSUME_NONNULL_BEGIN
#pragma mark - API Object
///
/// The `MembersSetProfileArg` struct.
///
/// Exactly one of team_member_id, email, or external_id must be provided to
/// identify the user account. At least one of new_email, new_external_id,
/// new_given_name, and/or new_surname must be provided.
///
/// This class implements the `DBSerializable` protocol (serialize and
/// deserialize instance methods), which is required for all Obj-C SDK API route
/// objects.
///
@interface DBTEAMMembersSetProfileArg : NSObject <DBSerializable, NSCopying>
#pragma mark - Instance fields
/// Identity of user whose profile will be set.
@property (nonatomic, readonly) DBTEAMUserSelectorArg *user;
/// New email for member.
@property (nonatomic, readonly, copy, nullable) NSString *dNewEmail;
/// New external ID for member.
@property (nonatomic, readonly, copy, nullable) NSString *dNewExternalId;
/// New given name for member.
@property (nonatomic, readonly, copy, nullable) NSString *dNewGivenName;
/// New surname for member.
@property (nonatomic, readonly, copy, nullable) NSString *dNewSurname;
/// New persistent ID. This field only available to teams using persistent ID
/// SAML configuration.
@property (nonatomic, readonly, copy, nullable) NSString *dNewPersistentId;
/// New value for whether the user is a directory restricted user.
@property (nonatomic, readonly, nullable) NSNumber *dNewIsDirectoryRestricted;
#pragma mark - Constructors
///
/// Full constructor for the struct (exposes all instance variables).
///
/// @param user Identity of user whose profile will be set.
/// @param dNewEmail New email for member.
/// @param dNewExternalId New external ID for member.
/// @param dNewGivenName New given name for member.
/// @param dNewSurname New surname for member.
/// @param dNewPersistentId New persistent ID. This field only available to
/// teams using persistent ID SAML configuration.
/// @param dNewIsDirectoryRestricted New value for whether the user is a
/// directory restricted user.
///
/// @return An initialized instance.
///
- (instancetype)initWithUser:(DBTEAMUserSelectorArg *)user
dNewEmail:(nullable NSString *)dNewEmail
dNewExternalId:(nullable NSString *)dNewExternalId
dNewGivenName:(nullable NSString *)dNewGivenName
dNewSurname:(nullable NSString *)dNewSurname
dNewPersistentId:(nullable NSString *)dNewPersistentId
dNewIsDirectoryRestricted:(nullable NSNumber *)dNewIsDirectoryRestricted;
///
/// Convenience constructor (exposes only non-nullable instance variables with
/// no default value).
///
/// @param user Identity of user whose profile will be set.
///
/// @return An initialized instance.
///
- (instancetype)initWithUser:(DBTEAMUserSelectorArg *)user;
- (instancetype)init NS_UNAVAILABLE;
@end
#pragma mark - Serializer Object
///
/// The serialization class for the `MembersSetProfileArg` struct.
///
@interface DBTEAMMembersSetProfileArgSerializer : NSObject
///
/// Serializes `DBTEAMMembersSetProfileArg` instances.
///
/// @param instance An instance of the `DBTEAMMembersSetProfileArg` API object.
///
/// @return A json-compatible dictionary representation of the
/// `DBTEAMMembersSetProfileArg` API object.
///
+ (nullable NSDictionary<NSString *, id> *)serialize:(DBTEAMMembersSetProfileArg *)instance;
///
/// Deserializes `DBTEAMMembersSetProfileArg` instances.
///
/// @param dict A json-compatible dictionary representation of the
/// `DBTEAMMembersSetProfileArg` API object.
///
/// @return An instantiation of the `DBTEAMMembersSetProfileArg` object.
///
+ (DBTEAMMembersSetProfileArg *)deserialize:(NSDictionary<NSString *, id> *)dict;
@end
NS_ASSUME_NONNULL_END
|
dropbox/dropbox-sdk-obj-c
|
Source/ObjectiveDropboxOfficial/Shared/Generated/ApiObjects/Team/Headers/DBTEAMMembersSetProfileArg.h
|
C
|
mit
| 3,997
|
------------------------------------------------------------------------------
-- Test attributes.
-- Copyright © 2013–2015 Peter Colberg.
-- Distributed under the MIT license. (See accompanying file LICENSE.)
------------------------------------------------------------------------------
require("strict")
pcall(require, "luacov")
local hdf5 = require("hdf5")
local ffi = require("ffi")
local path = "test_attribute.h5"
do
local file = hdf5.create_file(path)
local dtype = hdf5.uint64
local space = hdf5.create_space("scalar")
local attr = file:create_attribute("particles", dtype, space)
assert(attr:get_object_name() == "/")
assert(attr:get_object_type() == "attr")
end
collectgarbage()
do
local file = hdf5.open_file(path)
local attr = file:open_attribute("particles")
assert(attr:get_name() == "particles")
local dtype = hdf5.uint64
assert(attr:get_type():equal(dtype))
local space = hdf5.create_space("scalar")
assert(attr:get_space():extent_equal(space))
end
collectgarbage()
do
local file = hdf5.open_file(path, "rdwr")
assert(file:exists_attribute("particles") == true)
file:rename_attribute("particles", "molecules")
assert(file:exists_attribute("particles") == false)
assert(file:exists_attribute("molecules") == true)
file:delete_attribute("molecules")
assert(file:exists_attribute("molecules") == false)
end
collectgarbage()
do
local file = hdf5.create_file(path)
local dtype = hdf5.uint64
local space = hdf5.create_space("scalar")
local attr = file:create_attribute("particles", dtype, space)
attr:write(ffi.new("uint64_t[1]", 50000), dtype)
end
collectgarbage()
do
local file = hdf5.open_file(path)
local attr = file:open_attribute("particles")
local dtype = hdf5.int
local buf = ffi.new("int[1]")
attr:read(buf, dtype)
assert(buf[0] == 50000)
end
collectgarbage()
do
local file = hdf5.create_file(path)
local space = hdf5.create_space("scalar")
file:create_attribute("B", hdf5.double, space)
file:create_attribute("A", hdf5.double, space)
file:create_attribute("C", hdf5.double, space)
assert(file:get_attr_name_by_idx(".", 0, "name", "inc") == "A")
assert(file:get_attr_name_by_idx(".", 1, "name", "inc") == "B")
assert(file:get_attr_name_by_idx(".", 2, "name", "inc") == "C")
assert(file:get_attr_name_by_idx(".", 0, "name", "dec") == "C")
assert(file:get_attr_name_by_idx(".", 1, "name", "dec") == "B")
assert(file:get_attr_name_by_idx(".", 2, "name", "dec") == "A")
end
collectgarbage()
do
local fcpl = hdf5.create_plist("file_create")
fcpl:set_attr_creation_order("tracked")
local file = hdf5.create_file(path, nil, fcpl)
local space = hdf5.create_space("scalar")
file:create_attribute("B", hdf5.double, space)
file:create_attribute("A", hdf5.double, space)
file:create_attribute("C", hdf5.double, space)
assert(file:get_attr_name_by_idx(".", 0, "crt_order", "inc") == "B")
assert(file:get_attr_name_by_idx(".", 1, "crt_order", "inc") == "A")
assert(file:get_attr_name_by_idx(".", 2, "crt_order", "inc") == "C")
assert(file:get_attr_name_by_idx(".", 0, "crt_order", "dec") == "C")
assert(file:get_attr_name_by_idx(".", 1, "crt_order", "dec") == "A")
assert(file:get_attr_name_by_idx(".", 2, "crt_order", "dec") == "B")
end
collectgarbage()
os.remove(path)
|
ld-test/hdf5
|
test/attribute.lua
|
Lua
|
mit
| 3,307
|
/*
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang("widget","en-gb",{move:"Click and drag to move"});
|
laravelproject2016/mkproject
|
public/components/ckeditor/plugins/widget/lang/en-gb.js
|
JavaScript
|
mit
| 220
|
<div ng-controller="ValidationTestController as validationCtrl">
<div class="row">
<div class="col-md-12">
<div class="tile-form">
<form name="validationCtrl.validationTest">
<div class="form-group">
<div class="input-group">
<label for="testField1">Email address </label>
<input class="form-control" type="email" name="testField1" ng-model="validationCtrl.email" bb-email-validation />
<label class="error" ng-show="validationCtrl.validationTest.testField1.$dirty && validationCtrl.validationTest.testField1.$error.email">
Invalid email address format!
</label>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
|
Blackbaud-LukeJones/skyux
|
js/sky/src/validation/docs/demo.html
|
HTML
|
mit
| 922
|
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.ico" />
<title>Buffer - Android SDK | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="../../../assets/css/default.css" rel="stylesheet" type="text/css">
<!-- FULLSCREEN STYLESHEET -->
<link href="../../../assets/css/fullscreen.css" rel="stylesheet" class="fullscreen"
type="text/css">
<!-- JAVASCRIPT -->
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script src="../../../assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "../../../";
var devsite = false;
</script>
<script src="../../../assets/js/docs.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
develop" itemscope itemtype="http://schema.org/Article">
<div id="doc-api-level" class="1" style="display:none"></div>
<a name="top"></a>
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo">
<a href="../../../index.html">
<img src="../../../assets/images/dac_logo.png" width="123" height="25" alt="Android Developers" />
</a>
<div class="btn-quicknav" id="btn-quicknav">
<a href="#" class="arrow-inactive">Quicknav</a>
<a href="#" class="arrow-active">Quicknav</a>
</div>
</div>
<ul class="nav-x col-9">
<li class="design">
<a href="../../../design/index.html"
zh-tw-lang="設計"
zh-cn-lang="设计"
ru-lang="Проектирование"
ko-lang="디자인"
ja-lang="設計"
es-lang="Diseñar"
>Design</a></li>
<li class="develop"><a href="../../../develop/index.html"
zh-tw-lang="開發"
zh-cn-lang="开发"
ru-lang="Разработка"
ko-lang="개발"
ja-lang="開発"
es-lang="Desarrollar"
>Develop</a></li>
<li class="distribute last"><a href="../../../distribute/index.html"
zh-tw-lang="發佈"
zh-cn-lang="分发"
ru-lang="Распространение"
ko-lang="배포"
ja-lang="配布"
es-lang="Distribuir"
>Distribute</a></li>
</ul>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="../../../about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<br class="clearfix" />
</div>
<div class="bottom"></div>
</div>
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '../../../')"
onkeyup="return search_changed(event, false, '../../../')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div>
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display"> </div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
</div>
<!-- /New Search>
<!-- Expanded quicknav -->
<div id="quicknav" class="col-9">
<ul>
<li class="design">
<ul>
<li><a href="../../../design/index.html">Get Started</a></li>
<li><a href="../../../design/style/index.html">Style</a></li>
<li><a href="../../../design/patterns/index.html">Patterns</a></li>
<li><a href="../../../design/building-blocks/index.html">Building Blocks</a></li>
<li><a href="../../../design/downloads/index.html">Downloads</a></li>
<li><a href="../../../design/videos/index.html">Videos</a></li>
</ul>
</li>
<li class="develop">
<ul>
<li><a href="../../../training/index.html"
zh-tw-lang="訓練課程"
zh-cn-lang="培训"
ru-lang="Курсы"
ko-lang="교육"
ja-lang="トレーニング"
es-lang="Capacitación"
>Training</a></li>
<li><a href="../../../guide/components/index.html"
zh-tw-lang="API 指南"
zh-cn-lang="API 指南"
ru-lang="Руководства по API"
ko-lang="API 가이드"
ja-lang="API ガイド"
es-lang="Guías de la API"
>API Guides</a></li>
<li><a href="../../../reference/packages.html"
zh-tw-lang="參考資源"
zh-cn-lang="参考"
ru-lang="Справочник"
ko-lang="참조문서"
ja-lang="リファレンス"
es-lang="Referencia"
>Reference</a></li>
<li><a href="../../../tools/index.html"
zh-tw-lang="相關工具"
zh-cn-lang="工具"
ru-lang="Инструменты"
ko-lang="도구"
ja-lang="ツール"
es-lang="Herramientas"
>Tools</a>
<ul><li><a href="../../../sdk/index.html">Get the SDK</a></li></ul>
</li>
<li><a href="../../../google/index.html">Google Services</a>
</li>
</ul>
</li>
<li class="distribute last">
<ul>
<li><a href="../../../distribute/index.html">Google Play</a></li>
<li><a href="../../../distribute/googleplay/publish/index.html">Publishing</a></li>
<li><a href="../../../distribute/googleplay/promote/index.html">Promoting</a></li>
<li><a href="../../../distribute/googleplay/quality/index.html">App Quality</a></li>
<li><a href="../../../distribute/googleplay/spotlight/index.html">Spotlight</a></li>
<li><a href="../../../distribute/open.html">Open Distribution</a></li>
</ul>
</li>
</ul>
</div>
<!-- /Expanded quicknav -->
</div>
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<!-- Secondary x-nav -->
<div id="nav-x">
<div class="wrap">
<ul class="nav-x col-9 develop" style="width:100%">
<li class="training"><a href="../../../training/index.html"
zh-tw-lang="訓練課程"
zh-cn-lang="培训"
ru-lang="Курсы"
ko-lang="교육"
ja-lang="トレーニング"
es-lang="Capacitación"
>Training</a></li>
<li class="guide"><a href="../../../guide/components/index.html"
zh-tw-lang="API 指南"
zh-cn-lang="API 指南"
ru-lang="Руководства по API"
ko-lang="API 가이드"
ja-lang="API ガイド"
es-lang="Guías de la API"
>API Guides</a></li>
<li class="reference"><a href="../../../reference/packages.html"
zh-tw-lang="參考資源"
zh-cn-lang="参考"
ru-lang="Справочник"
ko-lang="참조문서"
ja-lang="リファレンス"
es-lang="Referencia"
>Reference</a></li>
<li class="tools"><a href="../../../tools/index.html"
zh-tw-lang="相關工具"
zh-cn-lang="工具"
ru-lang="Инструменты"
ko-lang="도구"
ja-lang="ツール"
es-lang="Herramientas"
>Tools</a></li>
<li class="google"><a href="../../../google/index.html"
>Google Services</a>
</li>
</ul>
</div>
</div>
<!-- /Sendondary x-nav -->
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<div id="api-nav-header">
<div id="api-level-toggle">
<label for="apiLevelCheckbox" class="disabled">API level: </label>
<div class="select-wrapper">
<select id="apiLevelSelector">
<!-- option elements added by buildApiLevelSelector() -->
</select>
</div>
</div><!-- end toggle -->
<div id="api-nav-title">Android APIs</div>
</div><!-- end nav header -->
<script>
var SINCE_DATA = [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19' ];
buildApiLevelSelector();
</script>
<div id="swapper">
<div id="nav-panels">
<div id="resize-packages-nav">
<div id="packages-nav" class="scroll-pane">
<ul>
<li class="api apilevel-1">
<a href="../../../reference/android/package-summary.html">android</a></li>
<li class="api apilevel-4">
<a href="../../../reference/android/accessibilityservice/package-summary.html">android.accessibilityservice</a></li>
<li class="api apilevel-5">
<a href="../../../reference/android/accounts/package-summary.html">android.accounts</a></li>
<li class="api apilevel-11">
<a href="../../../reference/android/animation/package-summary.html">android.animation</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/app/package-summary.html">android.app</a></li>
<li class="api apilevel-8">
<a href="../../../reference/android/app/admin/package-summary.html">android.app.admin</a></li>
<li class="api apilevel-8">
<a href="../../../reference/android/app/backup/package-summary.html">android.app.backup</a></li>
<li class="api apilevel-3">
<a href="../../../reference/android/appwidget/package-summary.html">android.appwidget</a></li>
<li class="api apilevel-5">
<a href="../../../reference/android/bluetooth/package-summary.html">android.bluetooth</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/content/package-summary.html">android.content</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/content/pm/package-summary.html">android.content.pm</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/content/res/package-summary.html">android.content.res</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/database/package-summary.html">android.database</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/database/sqlite/package-summary.html">android.database.sqlite</a></li>
<li class="api apilevel-11">
<a href="../../../reference/android/drm/package-summary.html">android.drm</a></li>
<li class="api apilevel-4">
<a href="../../../reference/android/gesture/package-summary.html">android.gesture</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/graphics/package-summary.html">android.graphics</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/graphics/drawable/package-summary.html">android.graphics.drawable</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/graphics/drawable/shapes/package-summary.html">android.graphics.drawable.shapes</a></li>
<li class="api apilevel-19">
<a href="../../../reference/android/graphics/pdf/package-summary.html">android.graphics.pdf</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/hardware/package-summary.html">android.hardware</a></li>
<li class="api apilevel-17">
<a href="../../../reference/android/hardware/display/package-summary.html">android.hardware.display</a></li>
<li class="api apilevel-16">
<a href="../../../reference/android/hardware/input/package-summary.html">android.hardware.input</a></li>
<li class="api apilevel-18">
<a href="../../../reference/android/hardware/location/package-summary.html">android.hardware.location</a></li>
<li class="api apilevel-12">
<a href="../../../reference/android/hardware/usb/package-summary.html">android.hardware.usb</a></li>
<li class="api apilevel-3">
<a href="../../../reference/android/inputmethodservice/package-summary.html">android.inputmethodservice</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/location/package-summary.html">android.location</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/media/package-summary.html">android.media</a></li>
<li class="api apilevel-9">
<a href="../../../reference/android/media/audiofx/package-summary.html">android.media.audiofx</a></li>
<li class="api apilevel-14">
<a href="../../../reference/android/media/effect/package-summary.html">android.media.effect</a></li>
<li class="api apilevel-12">
<a href="../../../reference/android/mtp/package-summary.html">android.mtp</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/net/package-summary.html">android.net</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/net/http/package-summary.html">android.net.http</a></li>
<li class="api apilevel-16">
<a href="../../../reference/android/net/nsd/package-summary.html">android.net.nsd</a></li>
<li class="api apilevel-12">
<a href="../../../reference/android/net/rtp/package-summary.html">android.net.rtp</a></li>
<li class="api apilevel-9">
<a href="../../../reference/android/net/sip/package-summary.html">android.net.sip</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/net/wifi/package-summary.html">android.net.wifi</a></li>
<li class="api apilevel-14">
<a href="../../../reference/android/net/wifi/p2p/package-summary.html">android.net.wifi.p2p</a></li>
<li class="api apilevel-16">
<a href="../../../reference/android/net/wifi/p2p/nsd/package-summary.html">android.net.wifi.p2p.nsd</a></li>
<li class="api apilevel-9">
<a href="../../../reference/android/nfc/package-summary.html">android.nfc</a></li>
<li class="api apilevel-19">
<a href="../../../reference/android/nfc/cardemulation/package-summary.html">android.nfc.cardemulation</a></li>
<li class="api apilevel-10">
<a href="../../../reference/android/nfc/tech/package-summary.html">android.nfc.tech</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/opengl/package-summary.html">android.opengl</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/os/package-summary.html">android.os</a></li>
<li class="api apilevel-9">
<a href="../../../reference/android/os/storage/package-summary.html">android.os.storage</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/preference/package-summary.html">android.preference</a></li>
<li class="api apilevel-19">
<a href="../../../reference/android/print/package-summary.html">android.print</a></li>
<li class="api apilevel-19">
<a href="../../../reference/android/print/pdf/package-summary.html">android.print.pdf</a></li>
<li class="api apilevel-19">
<a href="../../../reference/android/printservice/package-summary.html">android.printservice</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/provider/package-summary.html">android.provider</a></li>
<li class="api apilevel-11">
<a href="../../../reference/android/renderscript/package-summary.html">android.renderscript</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/sax/package-summary.html">android.sax</a></li>
<li class="api apilevel-14">
<a href="../../../reference/android/security/package-summary.html">android.security</a></li>
<li class="api apilevel-17">
<a href="../../../reference/android/service/dreams/package-summary.html">android.service.dreams</a></li>
<li class="api apilevel-18">
<a href="../../../reference/android/service/notification/package-summary.html">android.service.notification</a></li>
<li class="api apilevel-14">
<a href="../../../reference/android/service/textservice/package-summary.html">android.service.textservice</a></li>
<li class="api apilevel-7">
<a href="../../../reference/android/service/wallpaper/package-summary.html">android.service.wallpaper</a></li>
<li class="api apilevel-3">
<a href="../../../reference/android/speech/package-summary.html">android.speech</a></li>
<li class="api apilevel-4">
<a href="../../../reference/android/speech/tts/package-summary.html">android.speech.tts</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v13/app/package-summary.html">android.support.v13.app</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/accessibilityservice/package-summary.html">android.support.v4.accessibilityservice</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/app/package-summary.html">android.support.v4.app</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/content/package-summary.html">android.support.v4.content</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/content/pm/package-summary.html">android.support.v4.content.pm</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/database/package-summary.html">android.support.v4.database</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/graphics/drawable/package-summary.html">android.support.v4.graphics.drawable</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/hardware/display/package-summary.html">android.support.v4.hardware.display</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/media/package-summary.html">android.support.v4.media</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/net/package-summary.html">android.support.v4.net</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/os/package-summary.html">android.support.v4.os</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/print/package-summary.html">android.support.v4.print</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/text/package-summary.html">android.support.v4.text</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/util/package-summary.html">android.support.v4.util</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/view/package-summary.html">android.support.v4.view</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/view/accessibility/package-summary.html">android.support.v4.view.accessibility</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v4/widget/package-summary.html">android.support.v4.widget</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v7/app/package-summary.html">android.support.v7.app</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v7/appcompat/package-summary.html">android.support.v7.appcompat</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v7/gridlayout/package-summary.html">android.support.v7.gridlayout</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v7/media/package-summary.html">android.support.v7.media</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v7/mediarouter/package-summary.html">android.support.v7.mediarouter</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v7/view/package-summary.html">android.support.v7.view</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v7/widget/package-summary.html">android.support.v7.widget</a></li>
<li class="api apilevel-">
<a href="../../../reference/android/support/v8/renderscript/package-summary.html">android.support.v8.renderscript</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/telephony/package-summary.html">android.telephony</a></li>
<li class="api apilevel-5">
<a href="../../../reference/android/telephony/cdma/package-summary.html">android.telephony.cdma</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/telephony/gsm/package-summary.html">android.telephony.gsm</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/test/package-summary.html">android.test</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/test/mock/package-summary.html">android.test.mock</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/test/suitebuilder/package-summary.html">android.test.suitebuilder</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/text/package-summary.html">android.text</a></li>
<li class="api apilevel-3">
<a href="../../../reference/android/text/format/package-summary.html">android.text.format</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/text/method/package-summary.html">android.text.method</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/text/style/package-summary.html">android.text.style</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/text/util/package-summary.html">android.text.util</a></li>
<li class="api apilevel-19">
<a href="../../../reference/android/transition/package-summary.html">android.transition</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/util/package-summary.html">android.util</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/view/package-summary.html">android.view</a></li>
<li class="api apilevel-4">
<a href="../../../reference/android/view/accessibility/package-summary.html">android.view.accessibility</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/view/animation/package-summary.html">android.view.animation</a></li>
<li class="api apilevel-3">
<a href="../../../reference/android/view/inputmethod/package-summary.html">android.view.inputmethod</a></li>
<li class="api apilevel-14">
<a href="../../../reference/android/view/textservice/package-summary.html">android.view.textservice</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/webkit/package-summary.html">android.webkit</a></li>
<li class="api apilevel-1">
<a href="../../../reference/android/widget/package-summary.html">android.widget</a></li>
<li class="api apilevel-1">
<a href="../../../reference/dalvik/bytecode/package-summary.html">dalvik.bytecode</a></li>
<li class="api apilevel-1">
<a href="../../../reference/dalvik/system/package-summary.html">dalvik.system</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/awt/font/package-summary.html">java.awt.font</a></li>
<li class="api apilevel-3">
<a href="../../../reference/java/beans/package-summary.html">java.beans</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/io/package-summary.html">java.io</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/lang/package-summary.html">java.lang</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/lang/annotation/package-summary.html">java.lang.annotation</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/lang/ref/package-summary.html">java.lang.ref</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/lang/reflect/package-summary.html">java.lang.reflect</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/math/package-summary.html">java.math</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/net/package-summary.html">java.net</a></li>
<li class="selected api apilevel-1">
<a href="../../../reference/java/nio/package-summary.html">java.nio</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/nio/channels/package-summary.html">java.nio.channels</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/nio/channels/spi/package-summary.html">java.nio.channels.spi</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/nio/charset/package-summary.html">java.nio.charset</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/nio/charset/spi/package-summary.html">java.nio.charset.spi</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/security/package-summary.html">java.security</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/security/acl/package-summary.html">java.security.acl</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/security/cert/package-summary.html">java.security.cert</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/security/interfaces/package-summary.html">java.security.interfaces</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/security/spec/package-summary.html">java.security.spec</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/sql/package-summary.html">java.sql</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/text/package-summary.html">java.text</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/util/package-summary.html">java.util</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/util/concurrent/package-summary.html">java.util.concurrent</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/util/concurrent/atomic/package-summary.html">java.util.concurrent.atomic</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/util/concurrent/locks/package-summary.html">java.util.concurrent.locks</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/util/jar/package-summary.html">java.util.jar</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/util/logging/package-summary.html">java.util.logging</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/util/prefs/package-summary.html">java.util.prefs</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/util/regex/package-summary.html">java.util.regex</a></li>
<li class="api apilevel-1">
<a href="../../../reference/java/util/zip/package-summary.html">java.util.zip</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/crypto/package-summary.html">javax.crypto</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/crypto/interfaces/package-summary.html">javax.crypto.interfaces</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/crypto/spec/package-summary.html">javax.crypto.spec</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/microedition/khronos/egl/package-summary.html">javax.microedition.khronos.egl</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/microedition/khronos/opengles/package-summary.html">javax.microedition.khronos.opengles</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/net/package-summary.html">javax.net</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/net/ssl/package-summary.html">javax.net.ssl</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/security/auth/package-summary.html">javax.security.auth</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/security/auth/callback/package-summary.html">javax.security.auth.callback</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/security/auth/login/package-summary.html">javax.security.auth.login</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/security/auth/x500/package-summary.html">javax.security.auth.x500</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/security/cert/package-summary.html">javax.security.cert</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/sql/package-summary.html">javax.sql</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/xml/package-summary.html">javax.xml</a></li>
<li class="api apilevel-8">
<a href="../../../reference/javax/xml/datatype/package-summary.html">javax.xml.datatype</a></li>
<li class="api apilevel-8">
<a href="../../../reference/javax/xml/namespace/package-summary.html">javax.xml.namespace</a></li>
<li class="api apilevel-1">
<a href="../../../reference/javax/xml/parsers/package-summary.html">javax.xml.parsers</a></li>
<li class="api apilevel-8">
<a href="../../../reference/javax/xml/transform/package-summary.html">javax.xml.transform</a></li>
<li class="api apilevel-8">
<a href="../../../reference/javax/xml/transform/dom/package-summary.html">javax.xml.transform.dom</a></li>
<li class="api apilevel-8">
<a href="../../../reference/javax/xml/transform/sax/package-summary.html">javax.xml.transform.sax</a></li>
<li class="api apilevel-8">
<a href="../../../reference/javax/xml/transform/stream/package-summary.html">javax.xml.transform.stream</a></li>
<li class="api apilevel-8">
<a href="../../../reference/javax/xml/validation/package-summary.html">javax.xml.validation</a></li>
<li class="api apilevel-8">
<a href="../../../reference/javax/xml/xpath/package-summary.html">javax.xml.xpath</a></li>
<li class="api apilevel-1">
<a href="../../../reference/junit/framework/package-summary.html">junit.framework</a></li>
<li class="api apilevel-1">
<a href="../../../reference/junit/runner/package-summary.html">junit.runner</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/package-summary.html">org.apache.http</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/auth/package-summary.html">org.apache.http.auth</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/auth/params/package-summary.html">org.apache.http.auth.params</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/client/package-summary.html">org.apache.http.client</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/client/entity/package-summary.html">org.apache.http.client.entity</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/client/methods/package-summary.html">org.apache.http.client.methods</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/client/params/package-summary.html">org.apache.http.client.params</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/client/protocol/package-summary.html">org.apache.http.client.protocol</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/client/utils/package-summary.html">org.apache.http.client.utils</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/conn/package-summary.html">org.apache.http.conn</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/conn/params/package-summary.html">org.apache.http.conn.params</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/conn/routing/package-summary.html">org.apache.http.conn.routing</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/conn/scheme/package-summary.html">org.apache.http.conn.scheme</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/conn/ssl/package-summary.html">org.apache.http.conn.ssl</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/conn/util/package-summary.html">org.apache.http.conn.util</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/cookie/package-summary.html">org.apache.http.cookie</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/cookie/params/package-summary.html">org.apache.http.cookie.params</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/entity/package-summary.html">org.apache.http.entity</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/impl/package-summary.html">org.apache.http.impl</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/impl/auth/package-summary.html">org.apache.http.impl.auth</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/impl/client/package-summary.html">org.apache.http.impl.client</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/impl/conn/package-summary.html">org.apache.http.impl.conn</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/impl/conn/tsccm/package-summary.html">org.apache.http.impl.conn.tsccm</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/impl/cookie/package-summary.html">org.apache.http.impl.cookie</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/impl/entity/package-summary.html">org.apache.http.impl.entity</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/impl/io/package-summary.html">org.apache.http.impl.io</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/io/package-summary.html">org.apache.http.io</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/message/package-summary.html">org.apache.http.message</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/params/package-summary.html">org.apache.http.params</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/protocol/package-summary.html">org.apache.http.protocol</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/apache/http/util/package-summary.html">org.apache.http.util</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/json/package-summary.html">org.json</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/w3c/dom/package-summary.html">org.w3c.dom</a></li>
<li class="api apilevel-8">
<a href="../../../reference/org/w3c/dom/ls/package-summary.html">org.w3c.dom.ls</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/xml/sax/package-summary.html">org.xml.sax</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/xml/sax/ext/package-summary.html">org.xml.sax.ext</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/xml/sax/helpers/package-summary.html">org.xml.sax.helpers</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/xmlpull/v1/package-summary.html">org.xmlpull.v1</a></li>
<li class="api apilevel-1">
<a href="../../../reference/org/xmlpull/v1/sax2/package-summary.html">org.xmlpull.v1.sax2</a></li>
</ul><br/>
</div> <!-- end packages-nav -->
</div> <!-- end resize-packages -->
<div id="classes-nav" class="scroll-pane">
<ul>
<li><h2>Classes</h2>
<ul>
<li class="selected api apilevel-1"><a href="../../../reference/java/nio/Buffer.html">Buffer</a></li>
<li class="api apilevel-1"><a href="../../../reference/java/nio/ByteBuffer.html">ByteBuffer</a></li>
<li class="api apilevel-1"><a href="../../../reference/java/nio/ByteOrder.html">ByteOrder</a></li>
<li class="api apilevel-1"><a href="../../../reference/java/nio/CharBuffer.html">CharBuffer</a></li>
<li class="api apilevel-1"><a href="../../../reference/java/nio/DoubleBuffer.html">DoubleBuffer</a></li>
<li class="api apilevel-1"><a href="../../../reference/java/nio/FloatBuffer.html">FloatBuffer</a></li>
<li class="api apilevel-1"><a href="../../../reference/java/nio/IntBuffer.html">IntBuffer</a></li>
<li class="api apilevel-1"><a href="../../../reference/java/nio/LongBuffer.html">LongBuffer</a></li>
<li class="api apilevel-1"><a href="../../../reference/java/nio/MappedByteBuffer.html">MappedByteBuffer</a></li>
<li class="api apilevel-1"><a href="../../../reference/java/nio/ShortBuffer.html">ShortBuffer</a></li>
</ul>
</li>
<li><h2>Exceptions</h2>
<ul>
<li class="api apilevel-1"><a href="../../../reference/java/nio/BufferOverflowException.html">BufferOverflowException</a></li>
<li class="api apilevel-1"><a href="../../../reference/java/nio/BufferUnderflowException.html">BufferUnderflowException</a></li>
<li class="api apilevel-1"><a href="../../../reference/java/nio/InvalidMarkException.html">InvalidMarkException</a></li>
<li class="api apilevel-1"><a href="../../../reference/java/nio/ReadOnlyBufferException.html">ReadOnlyBufferException</a></li>
</ul>
</li>
</ul><br/>
</div><!-- end classes -->
</div><!-- end nav-panels -->
<div id="nav-tree" style="display:none" class="scroll-pane">
<div id="tree-list"></div>
</div><!-- end nav-tree -->
</div><!-- end swapper -->
<div id="nav-swap">
<a class="fullscreen">fullscreen</a>
<a href='#' onclick='swapNav();return false;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>
</div>
</div> <!-- end devdoc-nav -->
</div> <!-- end side-nav -->
<script type="text/javascript">
// init fullscreen based on user pref
var fullscreen = readCookie("fullscreen");
if (fullscreen != 0) {
if (fullscreen == "false") {
toggleFullscreen(false);
} else {
toggleFullscreen(true);
}
}
// init nav version for mobile
if (isMobile) {
swapNav(); // tree view should be used on mobile
$('#nav-swap').hide();
} else {
chooseDefaultNav();
if ($("#nav-tree").is(':visible')) {
init_default_navtree("../../../");
}
}
// scroll the selected page into view
$(document).ready(function() {
scrollIntoView("packages-nav");
scrollIntoView("classes-nav");
});
</script>
<div class="col-12" id="doc-col">
<div id="api-info-block">
<div class="sum-details-links">
Summary:
<a href="#pubmethods">Methods</a>
| <a href="#inhmethods">Inherited Methods</a>
| <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a>
</div><!-- end sum-details-links -->
<div class="api-level">
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a>
</div>
</div><!-- end api-info-block -->
<!-- ======== START OF CLASS DATA ======== -->
<div id="jd-header">
public
abstract
class
<h1 itemprop="name">Buffer</h1>
extends <a href="../../../reference/java/lang/Object.html">Object</a><br/>
</div><!-- end header -->
<div id="naMessage"></div>
<div id="jd-content" class="api apilevel-1">
<table class="jd-inheritance-table">
<tr>
<td colspan="2" class="jd-inheritance-class-cell"><a href="../../../reference/java/lang/Object.html">java.lang.Object</a></td>
</tr>
<tr>
<td class="jd-inheritance-space"> ↳</td>
<td colspan="1" class="jd-inheritance-class-cell">java.nio.Buffer</td>
</tr>
</table>
<table class="jd-sumtable jd-sumtable-subclasses"><tr><td colspan="12" style="border:none;margin:0;padding:0;">
<a href="#" onclick="return toggleInherited(this, null)" id="subclasses-direct" class="jd-expando-trigger closed"
><img id="subclasses-direct-trigger"
src="../../../assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>Known Direct Subclasses
<div id="subclasses-direct">
<div id="subclasses-direct-list"
class="jd-inheritedlinks"
>
<a href="../../../reference/java/nio/ByteBuffer.html">ByteBuffer</a>,
<a href="../../../reference/java/nio/CharBuffer.html">CharBuffer</a>,
<a href="../../../reference/java/nio/DoubleBuffer.html">DoubleBuffer</a>,
<a href="../../../reference/java/nio/FloatBuffer.html">FloatBuffer</a>,
<a href="../../../reference/java/nio/IntBuffer.html">IntBuffer</a>,
<a href="../../../reference/java/nio/LongBuffer.html">LongBuffer</a>,
<a href="../../../reference/java/nio/ShortBuffer.html">ShortBuffer</a>
</div>
<div id="subclasses-direct-summary"
style="display: none;"
>
<table class="jd-sumtable-expando">
<tr class="alt-color api apilevel-1" >
<td class="jd-linkcol"><a href="../../../reference/java/nio/ByteBuffer.html">ByteBuffer</a></td>
<td class="jd-descrcol" width="100%">A buffer for bytes. </td>
</tr>
<tr class=" api apilevel-1" >
<td class="jd-linkcol"><a href="../../../reference/java/nio/CharBuffer.html">CharBuffer</a></td>
<td class="jd-descrcol" width="100%">A buffer of chars. </td>
</tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-linkcol"><a href="../../../reference/java/nio/DoubleBuffer.html">DoubleBuffer</a></td>
<td class="jd-descrcol" width="100%">A buffer of doubles. </td>
</tr>
<tr class=" api apilevel-1" >
<td class="jd-linkcol"><a href="../../../reference/java/nio/FloatBuffer.html">FloatBuffer</a></td>
<td class="jd-descrcol" width="100%">A buffer of floats. </td>
</tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-linkcol"><a href="../../../reference/java/nio/IntBuffer.html">IntBuffer</a></td>
<td class="jd-descrcol" width="100%">A buffer of ints. </td>
</tr>
<tr class=" api apilevel-1" >
<td class="jd-linkcol"><a href="../../../reference/java/nio/LongBuffer.html">LongBuffer</a></td>
<td class="jd-descrcol" width="100%">A buffer of longs. </td>
</tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-linkcol"><a href="../../../reference/java/nio/ShortBuffer.html">ShortBuffer</a></td>
<td class="jd-descrcol" width="100%">A buffer of shorts. </td>
</tr>
</table>
</div>
</div>
</td></tr></table>
<table class="jd-sumtable jd-sumtable-subclasses"><tr><td colspan="12" style="border:none;margin:0;padding:0;">
<a href="#" onclick="return toggleInherited(this, null)" id="subclasses-indirect" class="jd-expando-trigger closed"
><img id="subclasses-indirect-trigger"
src="../../../assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>Known Indirect Subclasses
<div id="subclasses-indirect">
<div id="subclasses-indirect-list"
class="jd-inheritedlinks"
>
<a href="../../../reference/java/nio/MappedByteBuffer.html">MappedByteBuffer</a>
</div>
<div id="subclasses-indirect-summary"
style="display: none;"
>
<table class="jd-sumtable-expando">
<tr class="alt-color api apilevel-1" >
<td class="jd-linkcol"><a href="../../../reference/java/nio/MappedByteBuffer.html">MappedByteBuffer</a></td>
<td class="jd-descrcol" width="100%"><code>MappedByteBuffer</code> is a special kind of direct byte buffer which maps a
region of file to memory. </td>
</tr>
</table>
</div>
</div>
</td></tr></table>
<div class="jd-descr">
<h2>Class Overview</h2>
<p itemprop="articleBody">A buffer is a list of elements of a specific primitive type.
<p>
A buffer can be described by the following properties:
<ul>
<li>Capacity: the number of elements a buffer can hold. Capacity may not be
negative and never changes.</li>
<li>Position: a cursor of this buffer. Elements are read or written at the
position if you do not specify an index explicitly. Position may not be
negative and not greater than the limit.</li>
<li>Limit: controls the scope of accessible elements. You can only read or
write elements from index zero to <code>limit - 1</code>. Accessing
elements out of the scope will cause an exception. Limit may not be negative
and not greater than capacity.</li>
<li>Mark: used to remember the current position, so that you can reset the
position later. Mark may not be negative and no greater than position.</li>
<li>A buffer can be read-only or read-write. Trying to modify the elements
of a read-only buffer will cause a <code>ReadOnlyBufferException</code>,
while changing the position, limit and mark of a read-only buffer is OK.</li>
<li>A buffer can be direct or indirect. A direct buffer will try its best to
take advantage of native memory APIs and it may not stay in the Java heap,
thus it is not affected by garbage collection.</li>
</ul>
<p>
Buffers are not thread-safe. If concurrent access to a buffer instance is
required, then the callers are responsible to take care of the
synchronization issues.
</p>
</div><!-- jd-descr -->
<div class="jd-descr">
<h2>Summary</h2>
<!-- ========== METHOD SUMMARY =========== -->
<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr>
<tr class="alt-color api apilevel-9" >
<td class="jd-typecol"><nobr>
abstract
<a href="../../../reference/java/lang/Object.html">Object</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#array()">array</a></span>()</nobr>
<div class="jd-descrdiv">Returns the array that backs this buffer (optional operation).</div>
</td></tr>
<tr class=" api apilevel-9" >
<td class="jd-typecol"><nobr>
abstract
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#arrayOffset()">arrayOffset</a></span>()</nobr>
<div class="jd-descrdiv">Returns the offset into the array returned by <code>array</code> of the first
element of the buffer (optional operation).</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
final
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#capacity()">capacity</a></span>()</nobr>
<div class="jd-descrdiv">Returns the capacity of this buffer.</div>
</td></tr>
<tr class=" api apilevel-1" >
<td class="jd-typecol"><nobr>
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#clear()">clear</a></span>()</nobr>
<div class="jd-descrdiv">Clears this buffer.</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#flip()">flip</a></span>()</nobr>
<div class="jd-descrdiv">Flips this buffer.</div>
</td></tr>
<tr class=" api apilevel-9" >
<td class="jd-typecol"><nobr>
abstract
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#hasArray()">hasArray</a></span>()</nobr>
<div class="jd-descrdiv">Returns true if <code>array</code> and <code>arrayOffset</code> won't throw.</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
final
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#hasRemaining()">hasRemaining</a></span>()</nobr>
<div class="jd-descrdiv">Indicates if there are elements remaining in this buffer, that is if
<code>position < limit</code>.</div>
</td></tr>
<tr class=" api apilevel-9" >
<td class="jd-typecol"><nobr>
abstract
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#isDirect()">isDirect</a></span>()</nobr>
<div class="jd-descrdiv">Returns true if this is a direct buffer.</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
abstract
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#isReadOnly()">isReadOnly</a></span>()</nobr>
<div class="jd-descrdiv">Indicates whether this buffer is read-only.</div>
</td></tr>
<tr class=" api apilevel-1" >
<td class="jd-typecol"><nobr>
final
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#limit()">limit</a></span>()</nobr>
<div class="jd-descrdiv">Returns the limit of this buffer.</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#limit(int)">limit</a></span>(int newLimit)</nobr>
<div class="jd-descrdiv">Sets the limit of this buffer.</div>
</td></tr>
<tr class=" api apilevel-1" >
<td class="jd-typecol"><nobr>
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#mark()">mark</a></span>()</nobr>
<div class="jd-descrdiv">Marks the current position, so that the position may return to this point
later by calling <code>reset()</code>.</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#position(int)">position</a></span>(int newPosition)</nobr>
<div class="jd-descrdiv">Sets the position of this buffer.</div>
</td></tr>
<tr class=" api apilevel-1" >
<td class="jd-typecol"><nobr>
final
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#position()">position</a></span>()</nobr>
<div class="jd-descrdiv">Returns the position of this buffer.</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
final
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#remaining()">remaining</a></span>()</nobr>
<div class="jd-descrdiv">Returns the number of remaining elements in this buffer, that is
<code>limit - position</code>.</div>
</td></tr>
<tr class=" api apilevel-1" >
<td class="jd-typecol"><nobr>
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#reset()">reset</a></span>()</nobr>
<div class="jd-descrdiv">Resets the position of this buffer to the <code>mark</code>.</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#rewind()">rewind</a></span>()</nobr>
<div class="jd-descrdiv">Rewinds this buffer.</div>
</td></tr>
<tr class=" api apilevel-1" >
<td class="jd-typecol"><nobr>
<a href="../../../reference/java/lang/String.html">String</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/nio/Buffer.html#toString()">toString</a></span>()</nobr>
<div class="jd-descrdiv">Returns a string describing this buffer.</div>
</td></tr>
</table>
<!-- ========== METHOD SUMMARY =========== -->
<table id="inhmethods" class="jd-sumtable"><tr><th>
<a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
<div style="clear:left;">Inherited Methods</div></th></tr>
<tr class="api apilevel-" >
<td colspan="12">
<a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed"
><img id="inherited-methods-java.lang.Object-trigger"
src="../../../assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>
From class
<a href="../../../reference/java/lang/Object.html">java.lang.Object</a>
<div id="inherited-methods-java.lang.Object">
<div id="inherited-methods-java.lang.Object-list"
class="jd-inheritedlinks">
</div>
<div id="inherited-methods-java.lang.Object-summary" style="display: none;">
<table class="jd-sumtable-expando">
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
<a href="../../../reference/java/lang/Object.html">Object</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/lang/Object.html#clone()">clone</a></span>()</nobr>
<div class="jd-descrdiv">Creates and returns a copy of this <code>Object</code>.</div>
</td></tr>
<tr class=" api apilevel-1" >
<td class="jd-typecol"><nobr>
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/lang/Object.html#equals(java.lang.Object)">equals</a></span>(<a href="../../../reference/java/lang/Object.html">Object</a> o)</nobr>
<div class="jd-descrdiv">Compares this instance with the specified object and indicates if they
are equal.</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/lang/Object.html#finalize()">finalize</a></span>()</nobr>
<div class="jd-descrdiv">Invoked when the garbage collector has detected that this instance is no longer reachable.</div>
</td></tr>
<tr class=" api apilevel-1" >
<td class="jd-typecol"><nobr>
final
<a href="../../../reference/java/lang/Class.html">Class</a><?></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/lang/Object.html#getClass()">getClass</a></span>()</nobr>
<div class="jd-descrdiv">Returns the unique instance of <code><a href="../../../reference/java/lang/Class.html">Class</a></code> that represents this
object's class.</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/lang/Object.html#hashCode()">hashCode</a></span>()</nobr>
<div class="jd-descrdiv">Returns an integer hash code for this object.</div>
</td></tr>
<tr class=" api apilevel-1" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/lang/Object.html#notify()">notify</a></span>()</nobr>
<div class="jd-descrdiv">Causes a thread which is waiting on this object's monitor (by means of
calling one of the <code>wait()</code> methods) to be woken up.</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/lang/Object.html#notifyAll()">notifyAll</a></span>()</nobr>
<div class="jd-descrdiv">Causes all threads which are waiting on this object's monitor (by means
of calling one of the <code>wait()</code> methods) to be woken up.</div>
</td></tr>
<tr class=" api apilevel-1" >
<td class="jd-typecol"><nobr>
<a href="../../../reference/java/lang/String.html">String</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/lang/Object.html#toString()">toString</a></span>()</nobr>
<div class="jd-descrdiv">Returns a string containing a concise, human-readable description of this
object.</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/lang/Object.html#wait()">wait</a></span>()</nobr>
<div class="jd-descrdiv">Causes the calling thread to wait until another thread calls the <code>notify()</code> or <code>notifyAll()</code> method of this object.</div>
</td></tr>
<tr class=" api apilevel-1" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/lang/Object.html#wait(long, int)">wait</a></span>(long millis, int nanos)</nobr>
<div class="jd-descrdiv">Causes the calling thread to wait until another thread calls the <code>notify()</code> or <code>notifyAll()</code> method of this object or until the
specified timeout expires.</div>
</td></tr>
<tr class="alt-color api apilevel-1" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/java/lang/Object.html#wait(long)">wait</a></span>(long millis)</nobr>
<div class="jd-descrdiv">Causes the calling thread to wait until another thread calls the <code>notify()</code> or <code>notifyAll()</code> method of this object or until the
specified timeout expires.</div>
</td></tr>
</table>
</div>
</div>
</td></tr>
</table>
</div><!-- jd-descr (summary) -->
<!-- Details -->
<!-- XML Attributes -->
<!-- Enum Values -->
<!-- Constants -->
<!-- Fields -->
<!-- Public ctors -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- Protected ctors -->
<!-- ========= METHOD DETAIL ======== -->
<!-- Public methdos -->
<h2>Public Methods</h2>
<A NAME="array()"></A>
<div class="jd-details api apilevel-9">
<h4 class="jd-details-title">
<span class="normal">
public
abstract
<a href="../../../reference/java/lang/Object.html">Object</a>
</span>
<span class="sympad">array</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 9</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns the array that backs this buffer (optional operation).
The returned value is the actual array, not a copy, so modifications
to the array write through to the buffer.
<p>Subclasses should override this method with a covariant return type
to provide the exact type of the array.
<p>Use <code>hasArray</code> to ensure this method won't throw.
(A separate call to <code>isReadOnly</code> is not necessary.)</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>the array</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Throws</h5>
<table class="jd-tagtable">
<tr>
<th><a href="../../../reference/java/nio/ReadOnlyBufferException.html">ReadOnlyBufferException</a></td>
<td>if the buffer is read-only
UnsupportedOperationException if the buffer does not expose an array</td>
</tr>
</table>
</div>
</div>
</div>
<A NAME="arrayOffset()"></A>
<div class="jd-details api apilevel-9">
<h4 class="jd-details-title">
<span class="normal">
public
abstract
int
</span>
<span class="sympad">arrayOffset</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 9</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns the offset into the array returned by <code>array</code> of the first
element of the buffer (optional operation). The backing array (if there is one)
is not necessarily the same size as the buffer, and position 0 in the buffer is
not necessarily the 0th element in the array. Use
<code>buffer.array()[offset + buffer.arrayOffset()</code> to access element <code>offset</code>
in <code>buffer</code>.
<p>Use <code>hasArray</code> to ensure this method won't throw.
(A separate call to <code>isReadOnly</code> is not necessary.)</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>the offset</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Throws</h5>
<table class="jd-tagtable">
<tr>
<th><a href="../../../reference/java/nio/ReadOnlyBufferException.html">ReadOnlyBufferException</a></td>
<td>if the buffer is read-only
UnsupportedOperationException if the buffer does not expose an array</td>
</tr>
</table>
</div>
</div>
</div>
<A NAME="capacity()"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
final
int
</span>
<span class="sympad">capacity</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns the capacity of this buffer.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>the number of elements that are contained in this buffer.
</li></ul>
</div>
</div>
</div>
<A NAME="clear()"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a>
</span>
<span class="sympad">clear</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Clears this buffer.
<p>
While the content of this buffer is not changed, the following internal
changes take place: the current position is reset back to the start of
the buffer, the value of the buffer limit is made equal to the capacity
and mark is cleared.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this buffer.
</li></ul>
</div>
</div>
</div>
<A NAME="flip()"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a>
</span>
<span class="sympad">flip</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Flips this buffer.
<p>
The limit is set to the current position, then the position is set to
zero, and the mark is cleared.
<p>
The content of this buffer is not changed.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this buffer.
</li></ul>
</div>
</div>
</div>
<A NAME="hasArray()"></A>
<div class="jd-details api apilevel-9">
<h4 class="jd-details-title">
<span class="normal">
public
abstract
boolean
</span>
<span class="sympad">hasArray</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 9</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns true if <code>array</code> and <code>arrayOffset</code> won't throw. This method does not
return true for buffers not backed by arrays because the other methods would throw
<code>UnsupportedOperationException</code>, nor does it return true for buffers backed by
read-only arrays, because the other methods would throw <code>ReadOnlyBufferException</code>.</p></div>
</div>
</div>
<A NAME="hasRemaining()"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
final
boolean
</span>
<span class="sympad">hasRemaining</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Indicates if there are elements remaining in this buffer, that is if
<code>position < limit</code>.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li><code>true</code> if there are elements remaining in this buffer,
<code>false</code> otherwise.
</li></ul>
</div>
</div>
</div>
<A NAME="isDirect()"></A>
<div class="jd-details api apilevel-9">
<h4 class="jd-details-title">
<span class="normal">
public
abstract
boolean
</span>
<span class="sympad">isDirect</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 9</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns true if this is a direct buffer.</p></div>
</div>
</div>
<A NAME="isReadOnly()"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
abstract
boolean
</span>
<span class="sympad">isReadOnly</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Indicates whether this buffer is read-only.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li><code>true</code> if this buffer is read-only, <code>false</code>
otherwise.
</li></ul>
</div>
</div>
</div>
<A NAME="limit()"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
final
int
</span>
<span class="sympad">limit</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns the limit of this buffer.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>the limit of this buffer.
</li></ul>
</div>
</div>
</div>
<A NAME="limit(int)"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a>
</span>
<span class="sympad">limit</span>
<span class="normal">(int newLimit)</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets the limit of this buffer.
<p>
If the current position in the buffer is in excess of
<code>newLimit</code> then, on returning from this call, it will have
been adjusted to be equivalent to <code>newLimit</code>. If the mark
is set and is greater than the new limit, then it is cleared.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>newLimit</td>
<td>the new limit, must not be negative and not greater than
capacity.</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this buffer.</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Throws</h5>
<table class="jd-tagtable">
<tr>
<th><a href="../../../reference/java/lang/IllegalArgumentException.html">IllegalArgumentException</a></td>
<td>if <code>newLimit</code> is invalid.
</td>
</tr>
</table>
</div>
</div>
</div>
<A NAME="mark()"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a>
</span>
<span class="sympad">mark</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Marks the current position, so that the position may return to this point
later by calling <code>reset()</code>.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this buffer.
</li></ul>
</div>
</div>
</div>
<A NAME="position(int)"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a>
</span>
<span class="sympad">position</span>
<span class="normal">(int newPosition)</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Sets the position of this buffer.
<p>
If the mark is set and it is greater than the new position, then it is
cleared.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>newPosition</td>
<td>the new position, must be not negative and not greater than
limit.</td>
</tr>
</table>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this buffer.</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Throws</h5>
<table class="jd-tagtable">
<tr>
<th><a href="../../../reference/java/lang/IllegalArgumentException.html">IllegalArgumentException</a></td>
<td>if <code>newPosition</code> is invalid.
</td>
</tr>
</table>
</div>
</div>
</div>
<A NAME="position()"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
final
int
</span>
<span class="sympad">position</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns the position of this buffer.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>the value of this buffer's current position.
</li></ul>
</div>
</div>
</div>
<A NAME="remaining()"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
final
int
</span>
<span class="sympad">remaining</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns the number of remaining elements in this buffer, that is
<code>limit - position</code>.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>the number of remaining elements in this buffer.
</li></ul>
</div>
</div>
</div>
<A NAME="reset()"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a>
</span>
<span class="sympad">reset</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Resets the position of this buffer to the <code>mark</code>.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this buffer.</li></ul>
</div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Throws</h5>
<table class="jd-tagtable">
<tr>
<th><a href="../../../reference/java/nio/InvalidMarkException.html">InvalidMarkException</a></td>
<td>if the mark is not set.
</td>
</tr>
</table>
</div>
</div>
</div>
<A NAME="rewind()"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
final
<a href="../../../reference/java/nio/Buffer.html">Buffer</a>
</span>
<span class="sympad">rewind</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Rewinds this buffer.
<p>
The position is set to zero, and the mark is cleared. The content of this
buffer is not changed.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>this buffer.
</li></ul>
</div>
</div>
</div>
<A NAME="toString()"></A>
<div class="jd-details api apilevel-1">
<h4 class="jd-details-title">
<span class="normal">
public
<a href="../../../reference/java/lang/String.html">String</a>
</span>
<span class="sympad">toString</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Returns a string describing this buffer.
</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>a printable representation of this object.
</li></ul>
</div>
</div>
</div>
<!-- ========= METHOD DETAIL ======== -->
<!-- ========= END OF CLASS DATA ========= -->
<A NAME="navbar_top"></A>
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is licensed under <a
href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
For details and restrictions, see the <a href="../../../license.html">
Content License</a>.
</div>
<div id="build_info">
Android 4.4 r1 —
<script src="../../../timestamp.js" type="text/javascript"></script>
<script>document.write(BUILD_TIMESTAMP)</script>
</div>
<div id="footerlinks">
<p>
<a href="../../../about/index.html">About Android</a> |
<a href="../../../legal.html">Legal</a> |
<a href="../../../support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div> <!-- jd-content -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
</body>
</html>
|
AzureZhao/android-developer-cn
|
reference/java/nio/Buffer.html
|
HTML
|
mit
| 87,489
|
import { initialize } from 'ember-off-canvas-components/initializers/custom-events';
export default {
name: 'eoc-custom-events',
initialize: initialize
};
|
pixelhandler/ember-off-canvas-components
|
app/initializers/eoc-custom-events.js
|
JavaScript
|
mit
| 160
|
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2014 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#include "OgreStableHeaders.h"
#include "Animation/OgreTagPoint.h"
#include "Animation/OgreBone.h"
#include "Math/Array/OgreBooleanMask.h"
#include "Math/Array/OgreNodeMemoryManager.h"
#include "OgreSceneManager.h"
namespace Ogre {
//-----------------------------------------------------------------------
TagPoint::TagPoint( IdType id, SceneManager* creator, NodeMemoryManager *nodeMemoryManager,
SceneNode *parent ) :
SceneNode( id, creator, nodeMemoryManager, parent ),
mParentBone( 0 )
{
}
//-----------------------------------------------------------------------
TagPoint::~TagPoint()
{
if( mParentBone )
mParentBone->removeTagPoint( this );
}
//-----------------------------------------------------------------------
void TagPoint::_setParentBone( Bone *bone )
{
if( this->mParentBone )
{
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"Node ID: " + StringConverter::toString( this->getId() ) + ", named '" +
this->getName() + "' already was a child of Bone ID: " +
StringConverter::toString( this->mParentBone->getId() ) + ", named '" +
this->mParentBone->getName() + "'.", "TagPoint::_setBoneParent");
}
if( this->mParent )
{
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"Node ID: " + StringConverter::toString( this->getId() ) + ", named '" +
this->getName() + "' already was a child of Node ID: " +
StringConverter::toString( this->mParent->getId() ) + ", named '" +
this->mParent->getName() + "'.", "TagPoint::_setBoneParent");
}
mParentBone = bone;
// Call listener
if( mListener )
mListener->nodeAttached(this);
assert( mDepthLevel == 0 );
NodeMemoryManager *nodeMemoryManager = &mCreator->_getTagPointNodeMemoryManager();
if( mNodeMemoryManager != nodeMemoryManager )
this->migrateTo( nodeMemoryManager );
// Somewhat hacky way to mark our base classes that we can't be attached.
mParent = mCreator->getDummySceneNode();
}
//-----------------------------------------------------------------------
void TagPoint::_unsetParentBone(void)
{
if( mParentBone )
{
mParentBone = 0;
this->unsetParent();
}
}
//-----------------------------------------------------------------------
Matrix3 TagPoint::_getDerivedOrientationMatrix(void) const
{
#if OGRE_DEBUG_MODE
assert( !mCachedTransformOutOfDate );
#endif
Matrix3 retVal;
mTransform.mDerivedTransform[mTransform.mIndex].extract3x3Matrix( retVal );
return retVal;
}
//-----------------------------------------------------------------------
void TagPoint::updateFromParentImpl(void)
{
assert( false && "Not implemented" );
//I'm lazy, but before you implement it, remember that the skeleton needs to be updated as well.
}
//-----------------------------------------------------------------------
void TagPoint::updateAllTransformsBoneToTag( const size_t numNodes, Transform t )
{
SimpleMatrixAf4x3 const * RESTRICT_ALIAS parentBoneParentNodeTransform[ARRAY_PACKED_REALS];
SimpleMatrixAf4x3 const * RESTRICT_ALIAS parentBoneTransform[ARRAY_PACKED_REALS];
for( size_t j=0; j<ARRAY_PACKED_REALS; ++j )
{
parentBoneParentNodeTransform[j] = &SimpleMatrixAf4x3::IDENTITY;
parentBoneTransform[j] = &SimpleMatrixAf4x3::IDENTITY;
}
for( size_t i=0; i<numNodes; i += ARRAY_PACKED_REALS )
{
//Retrieve from parents. Unfortunately we need to do SoA -> AoS -> SoA conversion
ArrayMatrixAf4x3 finalMat;
ArrayMatrixAf4x3 parentBone;
for( size_t j=0; j<ARRAY_PACKED_REALS; ++j )
{
if( t.mOwner[j] )
{
Bone *parentBonePtr = static_cast<TagPoint*>( t.mOwner[j] )->mParentBone;
const BoneTransform &boneTransform = parentBonePtr->_getTransform();
parentBoneParentNodeTransform[j] =
boneTransform.mParentNodeTransform[boneTransform.mIndex];
parentBoneTransform[j] = &boneTransform.mDerivedTransform[boneTransform.mIndex];
}
}
finalMat.loadFromAoS( parentBoneParentNodeTransform );
parentBone.loadFromAoS( parentBoneTransform );
finalMat *= parentBone; //finalMat = parentBoneParentNodeTransform * parentBone;
//ArrayMatrixAf4x3::retain is quite lengthy in instruction count, and the
//general case is to inherit both attributes. This branch is justified.
if( !BooleanMask4::allBitsSet( t.mInheritOrientation, t.mInheritScale ) )
{
ArrayMaskR inheritOrientation = BooleanMask4::getMask( t.mInheritOrientation );
ArrayMaskR inheritScale = BooleanMask4::getMask( t.mInheritScale );
finalMat.retain( inheritOrientation, inheritScale );
}
ArrayMatrixAf4x3 baseTransform;
baseTransform.makeTransform( *t.mPosition, *t.mScale, *t.mOrientation );
finalMat *= baseTransform; //finalMat = parentMat * baseTransform;
finalMat.streamToAoS( t.mDerivedTransform );
finalMat.decomposition( *t.mDerivedPosition,
*t.mDerivedScale,
*t.mDerivedOrientation );
#if OGRE_DEBUG_MODE
for( size_t j=0; j<ARRAY_PACKED_REALS; ++j )
{
if( t.mOwner[j] )
static_cast<TagPoint*>(t.mOwner[j])->mCachedTransformOutOfDate = false;
}
#endif
t.advancePack();
}
}
//-----------------------------------------------------------------------
void TagPoint::updateAllTransformsTagOnTag( const size_t numNodes, Transform t )
{
for( size_t i=0; i<numNodes; i += ARRAY_PACKED_REALS )
{
//Retrieve from parents. Unfortunately we need to do SoA -> AoS -> SoA conversion
ArrayMatrixAf4x3 finalMat;
Matrix4 const * RESTRICT_ALIAS parentBoneTransform[ARRAY_PACKED_REALS];
for( size_t j=0; j<ARRAY_PACKED_REALS; ++j )
{
Transform &parentTransform = t.mParents[j]->_getTransform();
parentBoneTransform[j] = &parentTransform.mDerivedTransform[parentTransform.mIndex];
}
finalMat.loadFromAoS( parentBoneTransform );
//ArrayMatrixAf4x3::retain is quite lengthy in instruction count, and the
//general case is to inherit both attributes. This branch is justified.
if( !BooleanMask4::allBitsSet( t.mInheritOrientation, t.mInheritScale ) )
{
ArrayMaskR inheritOrientation = BooleanMask4::getMask( t.mInheritOrientation );
ArrayMaskR inheritScale = BooleanMask4::getMask( t.mInheritScale );
finalMat.retain( inheritOrientation, inheritScale );
}
ArrayMatrixAf4x3 baseTransform;
baseTransform.makeTransform( *t.mPosition, *t.mScale, *t.mOrientation );
finalMat *= baseTransform; //finalMat = parentMat * baseTransform;
finalMat.streamToAoS( t.mDerivedTransform );
finalMat.decomposition( *t.mDerivedPosition,
*t.mDerivedScale,
*t.mDerivedOrientation );
#if OGRE_DEBUG_MODE
for( size_t j=0; j<ARRAY_PACKED_REALS; ++j )
{
if( t.mOwner[j] )
t.mOwner[j]->mCachedTransformOutOfDate = false;
}
#endif
t.advancePack();
}
}
//-----------------------------------------------------------------------
TagPoint* TagPoint::createChildTagPoint( const Vector3& vPos, const Quaternion& qRot )
{
TagPoint *newNode = mCreator->_createTagPoint( this, mNodeMemoryManager );
newNode->setPosition( vPos );
newNode->setOrientation( qRot );
//_createTagPoint must have passed us as parent. It's a special
//case to improve memory usage (avoid transfering mTransform)
mChildren.push_back( newNode );
newNode->mParentIndex = mChildren.size() - 1;
return newNode;
}
}
|
devxkh/FrankE
|
src/Ogre/OgreMain/src/Animation/OgreTagPoint.cpp
|
C++
|
mit
| 10,052
|
<html>
<META HTTP-EQUIV=Content-Type Content="text/html; charset=utf8">
<!-- Mirrored from lis.ly.gov.tw/lghtml/lawstat/version2/04502/0450295121200.htm by HTTrack Website Copier/3.x [XR&CO'2010], Sun, 24 Mar 2013 09:22:38 GMT -->
<head><title>法編號:04502 版本:095121200</title>
<link rel="stylesheet" type="text/css" href="../../version.css" >
</HEAD>
<body><left>
<table><tr><td><FONT COLOR=blue SIZE=5>法院組織法(04502)</font>
<table><tr><td> </td><td>
<table><tr><td> </td><td>
<table><tr><td> </td>
<tr><td align=left valign=top>
<a href=0450221100800.html target=law04502><nobr><font size=2>中華民國 21 年 10 月 8 日</font></nobr></a>
</td>
<td valign=top><font size=2>制定91條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 21 年 10 月 28 日公布</font></nobr></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 24 年 7 月 1 日施行</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450224071200.html target=law04502><nobr><font size=2>中華民國 24 年 7 月 12 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第33, 37, 38條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 24 年 7 月 22 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450227091600.html target=law04502><nobr><font size=2>中華民國 27 年 9 月 16 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第55條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 27 年 9 月 21 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450234033100.html target=law04502><nobr><font size=2>中華民國 34 年 3 月 31 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第33, 35, 48, 51, 54, 91條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 34 年 4 月 17 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450234122900.html target=law04502><nobr><font size=2>中華民國 34 年 12 月 29 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第16, 19, 34, 36, 45, 50條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 35 年 1 月 17 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450257121000.html target=law04502><nobr><font size=2>中華民國 57 年 12 月 10 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第63條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 57 年 12 月 19 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450258032800.html target=law04502><nobr><font size=2>中華民國 58 年 3 月 28 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第34, 45條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 58 年 4 月 10 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450269061000.html target=law04502><nobr><font size=2>中華民國 69 年 6 月 10 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第21, 26, 27, 34, 35, 45, 49至51, 56, 63, 87條<br>修正第5章章名
</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 69 年 6 月 29 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450278120800.html target=law04502><nobr><font size=2>中華民國 78 年 12 月 8 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正全文115條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 78 年 12 月 22 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450288011200.html target=law04502><nobr><font size=2>中華民國 88 年 1 月 12 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第11, 12, 33, 34, 49, 51, 73至75條<br>
增訂第66之1至66之4條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 88 年 2 月 3 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450290010400.html target=law04502><nobr><font size=2>中華民國 90 年 1 月 4 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第15, 34, 103, 106條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 90 年 1 月 17 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450290050800.html target=law04502><nobr><font size=2>中華民國 90 年 5 月 8 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第66, 79條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 90 年 5 月 23 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450294052000.html target=law04502><nobr><font size=2>中華民國 94 年 5 月 20 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第11, 22, 23, 33, 38, 39, 49, 52, 53, 69至71, 73至75條<br>
增訂第114之1條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 94 年 6 月 15 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450295011300.html target=law04502><nobr><font size=2>中華民國 95 年 1 月 13 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第12, 62, 66條<br>
增訂第59之1, 63之1條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 95 年 2 月 3 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450295121200.html target=law04502><nobr><font size=2>中華民國 95 年 12 月 12 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第34條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 95 年 12 月 27 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450296061500.html target=law04502><nobr><font size=2>中華民國 96 年 6 月 15 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第11, 16, 17, 37條<br>
增訂第17之1, 17之2條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 96 年 7 月 11 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450297052300.html target=law04502><nobr><font size=2>中華民國 97 年 5 月 23 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第17之2條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 97 年 6 月 11 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=0450299110500.html target=law04502><nobr><font size=2>中華民國 99 年 11 月 5 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第34, 66, 83條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 99 年 11 月 24 日公布</font></nobr></td>
<tr><td align=left valign=top>
<a href=04502100110100.html target=law04502><nobr><font size=2>中華民國 100 年 11 月 1 日</font></nobr></a>
</td>
<td valign=top><font size=2>修正第14, 15, 32, 79條</font></td>
<tr><td align=left valign=top><nobr><font size=2>中華民國 100 年 11 月 23 日公布</font></nobr></td>
</table></table></table></table>
<p><table><tr><td><font color=blue size=4>民國95年12月12日(非現行條文)</font></td>
<td><a href=http://lis.ly.gov.tw/lghtml/lawstat/reason2/0450295121200.htm target=reason><font size=2>立法理由</font></a></td>
<td><a href=http://lis.ly.gov.tw/lgcgi/lglawproc?0450295121200 target=proc><font size=2>立法紀錄</font></a></td>
</table>
<table><tr><td> </td>
<td><font color=4000ff size=4>第一章 總則</font>
<table><tr><td> </td><td><font color=8000ff>第一條</font>
</font>
<table><tr><td> </td>
<td>
本法所稱之法院,分左列三級:<br>
一、地方法院。<br>
二、高等法院。<br>
三、最高法院。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第二條</font>
</font>
<table><tr><td> </td>
<td>
法院審判民事、刑事及其他法律規定之訴訟案件,並依法管轄非訟事件。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第三條</font>
</font>
<table><tr><td> </td>
<td>
地方法院審判案件,以法官一人獨任或三人合議行之。<br>
高等法院審判案件,以法官三人合議行之。<br>
最高法院審判案件,以法官五人合議行之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第四條</font>
</font>
<table><tr><td> </td>
<td>
合議審判,以庭長充審判長;無庭長或庭長有事故時,以庭員中資深者充之,資同以年長者充之。<br>
獨任審判,即以該法官行審判長之職權。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第五條</font>
</font>
<table><tr><td> </td>
<td>
法官審判訴訟案件,其事務分配及代理次序,雖有未合本法所定者,審判仍屬有效。<br>
前項規定,於非訟事件之處理準用之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六條</font>
</font>
<table><tr><td> </td>
<td>
高等法院分院及地方法院分院審判訴訟案件及處理非訟事件,適用關於各該本院之規定。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第七條</font>
</font>
<table><tr><td> </td>
<td>
地方法院及其分院、高等法院及其分院管轄區域之劃分或變更,由司法院定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td>
<td><font color=4000ff size=4>第二章 地方法院</font>
<table><tr><td> </td><td><font color=8000ff>第八條</font>
</font>
<table><tr><td> </td>
<td>
直轄市或縣(市)各設地方法院。但得視其地理環境及案件多寡,增設地方法院分院;或合設地方法院;或將其轄區之一部劃歸其他地方法院或其分院,不受行政區劃限制。<br>
在特定地區,因業務需要,得設專業地方法院;其組織及管轄等事項,以法律定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第九條</font>
</font>
<table><tr><td> </td>
<td>
地方法院管轄事件如左:<br>
一、民事、刑事第一審訴訟案件。但法律別有規定者,不在此限。<br>
二、其他法律規定之訴訟案件。<br>
三、法律規定之非訟事件。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第十條</font>
</font>
<table><tr><td> </td>
<td>
地方法院得設簡易庭,其管轄事件依法律之規定。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第十一條</font>
</font>
<table><tr><td> </td>
<td>
地方法院或其分院之類別及員額,依附表之規定。<br>
各地方法院或其分院應適用之類別及其變更,由司法院定之。<br>
<a href=http://lis.ly.gov.tw/lgcgi/lylawatt?cfcbcacfcdc6cbcfcacdcfcfce target=pdf ><font size=2>附表:地方法院或其分院員額表</font></a><br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第十二條</font>
</font>
<table><tr><td> </td>
<td>
地方法院置法官,薦任第八職等至第九職等或簡任第十職等至第十一職等;試署法官,薦任第七職等至第九職等;候補法官,薦任第六職等至第八職等。<br>
實任法官繼續服務十年以上,成績優良,經審查合格者,得晉敘至簡任第十二職等至第十三職等;繼續服務十五年以上,成績優良,經審查合格者,得晉敘至簡任第十二職等至第十四職等。<br>
前項簡任第十四職等法官員額,不得逾地方法院實任法官總額三分之一。<br>
第二項晉敘法官之資格、審查委員會之組成、審查程序及限制不得申請晉敘情形等事項之審查辦法,由司法院定之。<br>
司法院因應地方法院業務需要,得調候補法官至地方法院辦事,承法官之命,辦理訴訟案件程序及實體之審查、法律問題之分析、資料之蒐集、裁判書之草擬等事務。<br>
地方法院於必要時,得置法官助理,依聘用人員聘用條例聘用各種專業人員充任之;承法官之命,辦理訴訟案件程序之審查、法律問題之分析、資料之蒐集等事務。<br>
候補法官調地方法院辦事期間,計入其候補法官年資。<br>
具律師執業資格者,經聘用充任法官助理期間,計入其律師執業年資。<br>
法官助理之遴聘、訓練、業務、管理及考核等相關事項,由司法院以命令定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第十三條</font>
</font>
<table><tr><td> </td>
<td>
地方法院置院長一人,由法官兼任,簡任第十職等至第十二職等,綜理全院行政事務,但直轄市地方法院兼任院長之法官,簡任第十一職等至第十三職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第十四條</font>
</font>
<table><tr><td> </td>
<td>
地方法院分設民事庭、刑事庭,其庭數視事務之繁簡定之;必要時得設專業法庭。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第十五條</font>
</font>
<table><tr><td> </td>
<td>
民事庭、刑事庭、專業法庭及簡易庭之庭長,除由兼任院長之法官兼任者外,餘由其他法官兼任,簡任第十職等至第十一職等或薦任第九職等,監督各該庭事務。<br>
曾任高等法院或其分院法官二年以上,調地方法院或其分院兼任院長或庭長之法官、法官者,得晉敘至簡任第十二職等至第十四職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第十六條</font>
</font>
<table><tr><td> </td>
<td>
地方法院設民事執行處,由法官辦理其事務,其法官在二人以上者,由一人兼任庭長,簡任第十職等至第十一職等或薦任第九職等,監督該處事務。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第十七條</font>
</font>
<table><tr><td> </td>
<td>
地方法院設公設辯護人室,置公設辯護人,薦任第七職等至第九職等。其公設辯護人在二人以上者,置主任公設辯護人,薦任第九職等或簡任第十職等至第十一職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第十八條</font>
</font>
<table><tr><td> </td>
<td>
地方法院設觀護人室,置觀護人;觀護人在二人以上者,置主任觀護人。觀護人,薦任第七職等至第九職等;主任觀護人,薦任第九職等或簡任第十職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第十九條</font>
</font>
<table><tr><td> </td>
<td>
地方法院設公證處;置公證人及佐理員;公證人在二人以上者,置主任公證人。公證人,薦任第七職等至第九職等;主任公證人,薦任第九職等或簡任第十職等;佐理員,委任第三職等至第五職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第二十條</font>
</font>
<table><tr><td> </td>
<td>
地方法院設提存所,置主任及佐理員。主任,薦任第九職等或簡任第十職等;佐理員,委任第三職等至第五職等或薦任第六職等至第八職等。<br>
前項薦任佐理員員額,不得逾同一法院佐理員總額二分之一。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第二十一條</font>
</font>
<table><tr><td> </td>
<td>
地方法院設登記處,置主任及佐理員。主任,薦任第九職等或簡任第十職等;佐理員,委任第三職等至第五職等或薦任第六職等至第八職等。<br>
前項薦任佐理員員額,不得逾同一法院佐理員總額二分之一。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第二十二條</font>
</font>
<table><tr><td> </td>
<td>
地方法院設書記處,置書記官長一人,薦任第九職等至簡任第十職等,承院長之命處理行政事務;一等書記官,薦任第八職等至第九職等;二等書記官,薦任第六職等至第七職等;三等書記官,委任第四職等至第五職等,分掌紀錄、文書、研究考核、總務、資料及訴訟輔導等事務,並得分科、分股辦事,科長由一等書記官兼任,股長由一等書記官或二等書記官兼任,均不另列等。<br>
前項一等書記官、二等書記官總額,不得逾同一法院一等書記官、二等書記官、三等書記官總額二分之一。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第二十三條</font>
</font>
<table><tr><td> </td>
<td>
地方法院置一等通譯,薦任第七職等至第八職等;二等通譯,薦任第六職等至第七職等;三等通譯,委任第四職等至第五職等;技士,委任第五職等或薦任第六職等至第七職等;執達員,委任第三職等至第五職等;錄事、庭務員,均委任第一職等至第三職等。<br>
前項一等通譯、二等通譯總額,不得逾同一法院一等通譯、二等通譯、三等通譯總額二分之一。<br>
地方法院為辦理值庭、執行、警衛、解送人犯及有關司法警察事務,置法警;法警長,委任第五職等或薦任第六職等至第七職等;副法警長,委任第四職等至第五職等或薦任第六職等;法警,委任第三職等至第五職等;其管理辦法,由司法院會同行政院定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第二十四條</font>
</font>
<table><tr><td> </td>
<td>
地方法院設人事室,置主任一人,薦任第八職等至第九職等,副主任一人,薦任第七職等至第九職等;必要時得依法置佐理人員。依法律規定辦理人事管理、人事查核等事項。<br>
直轄市地方法院人事室,必要時得分股辦事,由佐理人員兼任之,不另列等。事務較簡之地方法院,得僅置人事管理員,委任第五職等至薦任第七職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第二十五條</font>
</font>
<table><tr><td> </td>
<td>
地方法院設會計室、統計室,各置主任一人,均薦任第八職等至第九職等;必要時得依法各置佐理人員,依法律規定分別辦理歲計、會計、統計等事項。<br>
直轄市地方法院會計室、統計室,必要時得分股辦事,均由佐理人員兼任,不另列等。事務較簡之地方法院,得僅置會計員、統計員,均委任第五職等至薦任第七職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第二十六條</font>
</font>
<table><tr><td> </td>
<td>
地方法院設資訊室,置主任一人,薦任第七職等至第九職等,承院長之命處理資訊室之行政事項;資訊管理師,薦任第六職等至第七職等,操作員,委任第三職等至第五職等;必要時得置設計師,薦任第六職等至第八職等,以處理資訊事項。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第二十七條</font>
</font>
<table><tr><td> </td>
<td>
地方法院分院置院長一人,由法官兼任,簡任第十職等至第十二職等,綜理該分院行政事務。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第二十八條</font>
</font>
<table><tr><td> </td>
<td>
地方法院院長,得派本院法官兼行分院法官之職務。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第二十九條</font>
</font>
<table><tr><td> </td>
<td>
地方法院分院管轄事件,與地方法院同。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第三十條</font>
</font>
<table><tr><td> </td>
<td>
第十一條至第二十六條規定,於地方法院分院準用之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td>
<td><font color=4000ff size=4>第三章 高等法院</font>
<table><tr><td> </td><td><font color=8000ff>第三十一條</font>
</font>
<table><tr><td> </td>
<td>
省、直轄市或特別區域各設高等法院。但得視其地理環境及案件多寡,增設高等法院分院;或合設高等法院;或將其轄區之一部劃歸其他高等法院或其分院,不受行政區劃之限制。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第三十二條</font>
</font>
<table><tr><td> </td>
<td>
高等法院管轄事件如左:<br>
一、關於內亂、外患及妨害國交之刑事第一審訴訟案件。<br>
二、不服地方法院及其分院第一審判決而上訴之民事、刑事訴訟案件。但法律另有規定者,從其規定。<br>
三、不服地方法院及其分院裁定而抗告之案件。<br>
四、其他法律規定之訴訟案件。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第三十三條</font>
</font>
<table><tr><td> </td>
<td>
高等法院或其分院之類別及員額,依附表之規定。<br>
高等法院或其分院應適用之類別及其變更,由司法院定之。<br>
<a href=http://lis.ly.gov.tw/lgcgi/lylawatt?cfcbcacfcdc6cbcfcacdcfcfcd target=pdf ><font size=2>附表:高等法院或其分院員額表</font></a><br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第三十四條</font>
</font>
<table><tr><td> </td>
<td>
高等法院置法官,簡任第十職等至第十一職等或薦任第九職等;試署法官,薦任第七職等至第九職等。<br>
高等法院法官繼續服務二年以上,得晉敘至簡任第十二職等至第十四職等。<br>
司法院因應高等法院業務需要,得調地方法院或其分院試署法官或候補法官至高等法院辦事,承法官之命,辦理訴訟案件程序及實體之審查、法律問題之分析、資料之蒐集、裁判書之草擬等事務。<br>
高等法院於必要時得置法官助理,依聘用人員聘用條例聘用各種專業人員充任之,承法官之命,辦理訴訟案件程序之審查、法律問題之分析、資料之蒐集等事務。<br>
試署法官或候補法官調高等法院辦事期間,計入其試署法官或候補法官年資。<br>
具律師執業資格者,經聘用充任法官助理期間,計入其律師執業年資。<br>
第十二條第九項規定,於高等法院準用之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第三十五條</font>
</font>
<table><tr><td> </td>
<td>
高等法院置院長一人,由法官兼任,簡任第十三職等至第十四職等,綜理全院行政事務。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第三十六條</font>
</font>
<table><tr><td> </td>
<td>
高等法院分設民事庭、刑事庭,其庭數視事務之繁簡定之;必要時得設專業法庭。各庭庭長,除由兼任院長之法官兼任者外,餘由其他法官兼任,簡任第十一職等至第十三職等,監督各該庭事務。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第三十七條</font>
</font>
<table><tr><td> </td>
<td>
高等法院設公設辯護人室,置公設辯護人,簡任第十職等至第十一職等或薦任第九職等;其公設辯護人在二人以上者,置主任公設辯護人,簡任第十職等至第十二職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第三十八條</font>
</font>
<table><tr><td> </td>
<td>
高等法院設書記處,置書記官長一人,薦任第九職等至簡任第十一職等,承院長之命處理行政事務;一等書記官,薦任第八職等至第九職等;二等書記官,薦任第六職等至第七職等;三等書記官,委任第四職等至第五職等,分掌紀錄、文書、研究考核、總務、資料及訴訟輔導事務,並得分科、分股辦事,科長由一等書記官兼任;股長由一等書記官或二等書記官兼任,均不另列等。<br>
前項一等書記官、二等書記官總額,不得逾同一法院一等書記官、二等書記官、三等書記官總額二分之一。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第三十九條</font>
</font>
<table><tr><td> </td>
<td>
高等法院置一等通譯,薦任第八職等至第九職等;二等通譯,薦任第六職等至第七職等;三等通譯,委任第四職等至第五職等;技士,委任第五職等或薦任第六職等至第七職等;執達員,委任第三職等至第五職等;錄事、庭務員,均委任第一職等至第三職等。<br>
前項一等通譯、二等通譯總額,不得逾同一法院一等通譯、二等通譯、三等通譯總額二分之一。<br>
第二十三條第三項規定,於高等法院或其分院準用之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第四十條</font>
</font>
<table><tr><td> </td>
<td>
高等法院設人事室,置主任一人,簡任第十職等,副主任一人,薦任第九職等或簡任第十職等;科員,委任第四職等至第五職等或薦任第六職等至第七職等,其中薦任科員不得逾同一法院科員總額三分之一,依法律規定辦理人事管理、人事查核等事項,並得分科辦事;科長,薦任第九職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第四十一條</font>
</font>
<table><tr><td> </td>
<td>
高等法院設會計室、統計室,各置主任一人,均簡任第十職等,必要時得依法各置佐理人員,依法律規定分別辦理歲計、會計、統計等事項,並得分科辦事;科長,薦任第九職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第四十二條</font>
</font>
<table><tr><td> </td>
<td>
高等法院設資訊室,置主任一人,簡任第十職等,承院長之命處理資訊室之行政事項;資訊管理師,薦任第六職等至第七職等,操作員,委任第三職等至第五職等;必要時得置科長、設計師,科長,薦任第九職等,設計師,薦任第六職等至第八職等,處理資訊事項。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第四十三條</font>
</font>
<table><tr><td> </td>
<td>
高等法院分院置院長一人,由法官兼任,簡任第十二職等至第十四職等,綜理該分院行政事務。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第四十四條</font>
</font>
<table><tr><td> </td>
<td>
高等法院院長得派本院法官兼行分院法官職務。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第四十五條</font>
</font>
<table><tr><td> </td>
<td>
高等法院分院管轄事件,與高等法院同。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第四十六條</font>
</font>
<table><tr><td> </td>
<td>
第三十四條至第四十二條之規定,於高等法院分院準用之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td>
<td><font color=4000ff size=4>第四章 最高法院</font>
<table><tr><td> </td><td><font color=8000ff>第四十七條</font>
</font>
<table><tr><td> </td>
<td>
最高法院設於中央政府所在地。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第四十八條</font>
</font>
<table><tr><td> </td>
<td>
最高法院管轄事件如左:<br>
一、不服高等法院及其分院第一審判決而上訴之刑事訴訟案件。<br>
二、不服高等法院及其分院第二審判決而上訴之民事、刑事訴訟案件。<br>
三、不服高等法院及其分院裁定而抗告之案件。<br>
四、非常上訴案件。<br>
五、其他法律規定之訴訟案件。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第四十九條</font>
</font>
<table><tr><td> </td>
<td>
最高法院員額,依附表之規定。<br>
<a href=http://lis.ly.gov.tw/lgcgi/lylawatt?cfcbcacfcdc6cbcfcacdcfcfcc target=pdf ><font size=2>附表:最高法院員額表</font></a><br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第五十條</font>
</font>
<table><tr><td> </td>
<td>
最高法院置院長一人,特任,綜理全院行政事務,並任法官。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第五十一條</font>
</font>
<table><tr><td> </td>
<td>
最高法院置法官,簡任第十三職等至第十四職等;分設民事庭、刑事庭,其庭數視事務之繁簡定之;各庭置庭長一人,除由院長兼任者外,餘由法官兼任,簡任第十四職等,監督各該庭事務。<br>
司法院得調高等法院以下各級法院及其分院法官或候補法官至最高法院辦事,承法官之命,辦理訴訟案件程序及實體之審查、法律問題之分析、資料之蒐集、裁判書之草擬等事務。<br>
最高法院於必要時得置法官助理,依聘用人員聘用條例聘用各種專業人員充任之;承法官之命,辦理訴訟案件程序之審查、法律問題之分析、資料之蒐集等事務。<br>
法官或候補法官調最高法院辦事期間,計入其法官或候補法官年資。<br>
具律師執業資格者經聘用充任法官助理期間,計入其律師執業年資。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第五十二條</font>
</font>
<table><tr><td> </td>
<td>
最高法院設書記廳,置書記官長一人,簡任第十一職等至第十三職等,承院長之命處理行政事務;一等書記官,薦任第八職等至第九職等;二等書記官,薦任第六職等至第七職等;三等書記官,委任第四職等至第五職等,分掌紀錄、文書、研究考核、總務、資料及訴訟輔導等事務,並得分科、分股辦事,科長由一等書記官兼任;股長由一等書記官或二等書記官兼任,均不另列等。<br>
前項一等書記官、二等書記官總額,不得逾一等書記官、二等書記官、三等書記官總額二分之一。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第五十三條</font>
</font>
<table><tr><td> </td>
<td>
最高法院置一等通譯,薦任第八職等至第九職等;二等通譯,薦任第六職等至第七職等;三等通譯,委任第四職等至第五職等;技士,委任第五職等或薦任第六職等至第七職等;執達員,委任第三職等至第五職等;錄事、庭務員,均委任第一職等至第三職等。<br>
前項一等通譯、二等通譯總額,不得逾一等通譯、二等通譯、三等通譯總額二分之一。<br>
第二十三條第三項之規定,於最高法院準用之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第五十四條</font>
</font>
<table><tr><td> </td>
<td>
最高法院設人事室,置主任一人,簡任第十職等,副主任一人,薦任第九職等或簡任第十職等;科員,委任第四職等至第五職等或薦任第六職等至第七職等,其中薦任科員不得逾總額三分之一,依法律規定辦理人事管理、人事查核等事項,並得分股辦事;股長由科員兼任,不另列等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第五十五條</font>
</font>
<table><tr><td> </td>
<td>
最高法院設會計室、統計室,各置主任一人,均簡任第十職等;必要時得依法各置佐理人員,依法律規定分別辦理歲計、會計、統計等事項,並得分股辦事;股長由佐理人員兼任,不另列等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第五十六條</font>
</font>
<table><tr><td> </td>
<td>
最高法院設資訊室,置主任一人,簡任第十職等,承院長之命處理資訊室之行政事項;設計師,薦任第六職等至第八職等;資訊管理師,薦任第六職等至第七職等;操作員,第三職等至第五職等,處理資訊事項。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第五十七條</font>
</font>
<table><tr><td> </td>
<td>
最高法院之裁判,其所持法律見解,認有編為判例之必要者,應分別經由院長、庭長、法官組成之民事庭會議、刑事庭會議或民、刑事庭總會議決議後,報請司法院備查。<br>
最高法院審理案件,關於法律上之見解,認有變更判例之必要時,適用前項規定。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td>
<td><font color=4000ff size=4>第五章 檢察機關</font>
<table><tr><td> </td><td><font color=8000ff>第五十八條</font>
</font>
<table><tr><td> </td>
<td>
各級法院及分院各配置檢察署。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第五十九條</font>
</font>
<table><tr><td> </td>
<td>
各級法院及分院檢察署置檢察官,最高法院檢察署以一人為檢察總長,其他法院及分院檢察署各以一人為檢察長,分別綜理各該署行政事務。<br>
各級法院及分院檢察署檢察官員額在六人以上者,得分組辦事,每組以一人為主任檢察官,監督各該組事務。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第五十九條之一</font>
</font>
<table><tr><td> </td>
<td>
法務部設檢察官人事審議委員會,審議高等法院檢察署以下各級法院及其分院檢察署主任檢察官、檢察官之任免、轉任、遷調、考核及獎懲事項。<br>
前項審議之決議,應報請法務部部長核定後公告之。<br>
法務部部長遴任檢察長前,檢察官人事審議委員會應提出職缺二倍人選,由法務部部長圈選之。檢察長之遷調應送檢察官人事審議委員會徵詢意見。<br>
檢察官人事審議委員會置委員十七人,由法務部部長指派代表四人、檢察總長及其指派之代表三人與全體檢察官所選出之代表九人組成之,由法務部部長指派具司法官身分之次長為主任委員。<br>
前項選任委員之任期,均為一年,連選得連任一次。<br>
全體檢察官代表,以全國為單一選區,以秘密、無記名及單記直接選舉產生,每一檢察署以一名代表為限。<br>
檢察官人事審議委員會之組成方式、審議對象、程序、決議方式及相關事項之審議規則,由法務部徵詢檢察官人事審議委員會後定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十條</font>
</font>
<table><tr><td> </td>
<td>
檢察官之職權如左:<br>
一、實施偵查、提起公訴、實行公訴、協助自訴、擔當自訴及指揮刑事裁判之執行。<br>
二、其他法令所定職務之執行。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十一條</font>
</font>
<table><tr><td> </td>
<td>
檢察官對於法院,獨立行使職權。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十二條</font>
</font>
<table><tr><td> </td>
<td>
檢察官於其所屬檢察署管轄區域內執行職務。但遇有緊急情形或法律另有規定者,不在此限。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十三條</font>
</font>
<table><tr><td> </td>
<td>
檢察總長依本法及其他法律之規定,指揮監督該署檢察官及高等法院以下各級法院及分院檢察署檢察官。<br>
檢察長依本法及其他法律之規定,指揮監督該署檢察官及其所屬檢察署檢察官。<br>
檢察官應服從前二項指揮監督長官之命令。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十三條之一</font>
</font>
<table><tr><td> </td>
<td>
最高法院檢察署設特別偵查組,職司下列案件:<br>
一、涉及總統、副總統、五院院長、部會首長或上將階級軍職人員之貪瀆案件。<br>
二、選務機關、政黨或候選人於總統、副總統或立法委員選舉時,涉嫌全國性舞弊事件或妨害選舉之案件。<br>
三、特殊重大貪瀆、經濟犯罪、危害社會秩序,經最高法院檢察署檢察總長指定之案件。<br>
特別偵查組置檢察官六人以上,十五人以下,由最高法院檢察署檢察總長指定一人為主任,該組之檢察官、檢察事務官及其他人員,由最高法院檢察署檢察總長自各級法院檢察署中調最高法院檢察署辦事。<br>
特別偵查組為辦案需要,得借調相關機關之專業人員協助偵查。<br>
特別偵查組檢察官執行職務時,得執行各該審級檢察官之職權,不受第六十二條之限制。調辦事之檢察官行使職權,不受第六十六條之一之限制。<br>
立法院得於第一項第一款、第二款之案件偵查終結後,決議要求最高法院檢察署檢察總長赴立法院報告。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十四條</font>
</font>
<table><tr><td> </td>
<td>
檢察總長、檢察長得親自處理其所指揮監督之檢察官之事務,並得將該事務移轉於其所指揮監督之其他檢察官處理之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十五條</font>
</font>
<table><tr><td> </td>
<td>
高等法院及地方法院檢察署檢察長,得派本署檢察官兼行其分院檢察署檢察官之職務。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十六條</font>
</font>
<table><tr><td> </td>
<td>
最高法院檢察署檢察總長,特任;主任檢察官,簡任第十四職等;檢察官,簡任第十三職等至第十四職等。<br>
高等法院檢察署檢察長,簡任第十三職等至第十四職等;其分院檢察署檢察長,簡任第十二職等至第十四職等。高等法院及分院檢察署主任檢察官,簡任第十一職等至第十三職等;檢察官,簡任第十職等至第十一職等或薦任第九職等;繼續服務二年以上者,得晉敘至簡任第十二職等至第十四職等。<br>
地方法院及分院檢察署檢察長,簡任第十職等至第十二職等;主任檢察官,簡任第十職等至第十一職等或薦任第九職等;檢察官,薦任第八職等至第九職等或簡任第十職等至第十一職等;試署檢察官,薦任第七職等至第九職等;候補檢察官,薦任第六職等至第八職等。但直轄市地方法院檢察署檢察長,簡任第十一職等至第十三職等。<br>
曾任高等法院或其分院檢察署檢察官二年以上,調地方法院或其分院檢察署檢察長、主任檢察官、檢察官者,得晉敘至簡任第十二職等至第十四職等。<br>
第二項、第四項之規定,溯自中華民國九十年一月十九日生效。<br>
第十二條第二項至第四項於地方法院及分院檢察署主任檢察官、檢察官準用之;其審查辦法由法務部定之。<br>
最高法院檢察署檢察總長由總統提名,經立法院同意任命之,任期四年,不得連任。<br>
總統應於前項規定生效後一個月內,向立法院提出最高法院檢察署檢察總長人選。<br>
最高法院檢察署檢察總長除年度預算案及法律案外,無須至立法院列席備詢。<br>
最高法院檢察署檢察總長因故出缺或無法視事時,總統應於三個月內重新提出人選,經立法院同意任命之,其任期重行計算四年,不得連任。<br>
最高法院檢察署檢察總長於任命時具司法官身分者,於卸任時,得回任司法官。<br>
最高法院檢察署檢察總長於任滿前一個月,總統應依第七項規定辦理。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十六條之一</font>
</font>
<table><tr><td> </td>
<td>
法務部得調高等法院以下各級法院及其分院檢察署檢察官或候補檢察官至最高法院檢察署辦事,承檢察官之命,辦理訴訟案件程序之審查、法律問題之分析、資料之蒐集及書類之草擬等事項。<br>
法務部得調地方法院及其分院檢察署試署檢察官或候補檢察官至高等法院或其分院檢察署辦事,承檢察官之命,協助檢察官辦理訴訟案件程序之審查、法律問題之分析、資料之蒐集及書類之草擬等事項。<br>
法務部得調候補檢察官至地方法院或其分院檢察署辦事,承實任檢察官之命,協助檢察官辦理訴訟案件程序之審查、法律問題之分析、資料之蒐集及書類之草擬等事項。<br>
檢察官、試署檢察官或候補檢察官依前三項規定調辦事期間,計入其檢察官、試署檢察官或候補檢察官年資。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十六條之二</font>
</font>
<table><tr><td> </td>
<td>
各級法院及其分院檢察署設檢察事務官室,置檢察事務官,薦任第七職等至第九職等;檢察事務官在二人以上者,置主任檢察事務官,薦任第九職等或簡任第十職等;並得視業務需要分組辦事,各組組長由檢察事務官兼任,不另列等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十六條之三</font>
</font>
<table><tr><td> </td>
<td>
檢察事務官受檢察官之指揮,處理下列事務:<br>
一、實施搜索、扣押、勘驗或執行拘提。<br>
二、詢問告訴人、告發人、被告、證人或鑑定人。<br>
三、襄助檢察官執行其他第六十條所定之職權。<br>
檢察事務官處理前項前二款事務,視為刑事訴訟法第二百三十條第一項之司法警察官。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十六條之四</font>
</font>
<table><tr><td> </td>
<td>
檢察事務官,應就具有下列資格之一者任用之:<br>
一、經公務人員高等考試或司法人員特種考試相當等級之檢察事務官考試及格者。<br>
二、經律師考試及格,並具有薦任職任用資格者。<br>
三、曾任警察官或法務部調查局調查人員三年以上,成績優良,並具有薦任職任用資格者。<br>
四、具有公立或經立案之私立大學、獨立學院以上學歷,曾任法院或檢察署書記官,辦理民刑事紀錄三年以上,成績優良,具有薦任職任用資格者。<br>
主任檢察事務官,應就具有檢察事務官及擬任職等任用資格,並具有領導才能者遴任之。<br>
具律師執業資格者任檢察事務官期間,計入其律師執業年資。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十七條</font>
</font>
<table><tr><td> </td>
<td>
地方法院及分院檢察署設觀護人室,置觀護人,觀護人在二人以上者,置主任觀護人。觀護人,薦任第七職等至第九職等;主任觀護人,薦任第九職等或簡任第十職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十八條</font>
</font>
<table><tr><td> </td>
<td>
高等法院以下各級法院及其分院檢察署,置法醫師,法醫師在二人以上者,置主任法醫師。法醫師,薦任第七職等至第九職等;主任法醫師,薦任第九職等或簡任第十職等。但地方法院及其分院檢察署法醫師得列委任第五職等。<br>
高等法院以下各級法院及其分院檢察署,置檢驗員,委任第三職等至第五職等或薦任第六職等至第八職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第六十九條</font>
</font>
<table><tr><td> </td>
<td>
第二十二條、第二十三條第三項、第三十八條、第五十二條之規定,於地方法院或其分院檢察署、高等法院或其分院檢察署、最高法院檢察署分別準用之。<br>
高等法院以下各級法院及其分院檢察署,得設執行科,掌理關於刑事執行事務,並得分股辦事。科長由一等書記官兼任;股長由一等書記官或二等書記官兼任,均不另列等。<br>
高等法院或其分院檢察署,得設所務科,掌理關於監督看守所及少年觀護所之行政事務,並得分股辦事。置科長一人,薦任第九職等;科員,委任第五職等或薦任第六職等至第七職等;書記,委任第一職等至第三職等;股長由薦任科員兼任,不另列等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第七十條</font>
</font>
<table><tr><td> </td>
<td>
最高法院檢察署、高等法院及分院檢察署置一等通譯,薦任第八職等至第九職等;二等通譯,薦任第六職等至第七職等;三等通譯,委任第四職等至第五職等;技士,委任第五職等或薦任第六職等至第七職等。<br>
地方法院及分院檢察署置一等通譯,薦任第七職等至第八職等;二等通譯,薦任第六職等至第七職等;三等通譯,委任第四職等至第五職等;技士,委任第五職等或薦任第六職等至第七職等。<br>
前二項一等通譯、二等通譯總額,不得逾同一檢察署一等通譯、二等通譯、三等通譯總額二分之一。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第七十一條</font>
</font>
<table><tr><td> </td>
<td>
各級法院及分院檢察署置錄事,委任第一職等至第三職等。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第七十二條</font>
</font>
<table><tr><td> </td>
<td>
第二十四條至第二十六條、第四十條至第四十二條、第五十四條至第五十六條之規定,於地方法院或其分院檢察署、高等法院或其分院檢察署、最高法院檢察署分別準用之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第七十三條</font>
</font>
<table><tr><td> </td>
<td>
地方法院或其分院檢察署之類別及員額,依附表之規定。<br>
各地方法院或其分院檢察署應適用之類別及其變更,由行政院定之。<br>
<a href=http://lis.ly.gov.tw/lgcgi/lylawatt?cfcbcacfcdc6cbcfcacdcfcfcb target=pdf ><font size=2>附表:地方法院或其分院檢察署員額表</font></a><br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第七十四條</font>
</font>
<table><tr><td> </td>
<td>
高等法院或其分院檢察署之類別及員額,依附表之規定。<br>
高等法院或其分院檢察署應適用之類別及其變更,由行政院定之。<br>
<a href=http://lis.ly.gov.tw/lgcgi/lylawatt?cfcbcacfcdc6cbcfcacdcfcfca target=pdf ><font size=2>附表:高等法院或其分院檢察署員額表</font></a><br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第七十五條</font>
</font>
<table><tr><td> </td>
<td>
最高法院檢察署員額,依附表之規定。<br>
<a href=http://lis.ly.gov.tw/lgcgi/lylawatt?cfcbcacfcdc6cbcfcacdcfcfc9 target=pdf ><font size=2>附表:最高法院檢察署員額表</font></a><br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第七十六條</font>
</font>
<table><tr><td> </td>
<td>
檢察官得調度司法警察,法官於辦理刑事案件時,亦同。<br>
調度司法警察條例另定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td>
<td><font color=4000ff size=4>第六章 司法年度及事務分配</font>
<table><tr><td> </td><td><font color=8000ff>第七十七條</font>
</font>
<table><tr><td> </td>
<td>
司法年度,每年自一月一日起至十二月三十一日止。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第七十八條</font>
</font>
<table><tr><td> </td>
<td>
各級法院及分院與各級法院及分院檢察署之處務規程,分別由司法院與法務部定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第七十九條</font>
</font>
<table><tr><td> </td>
<td>
各級法院及分院於每年度終結前,由院長、庭長、法官舉行會議,按照本法、處務規程及其他法令規定,預定次年度司法事務之分配及代理次序。<br>
辦理民、刑事訴訟及其他特殊專業類型案件之法官,其年度司法事務分配辦法,由司法院另定之。<br>
第一項會議並應預定次年度關於合議審判時法官之配置。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第八十條</font>
</font>
<table><tr><td> </td>
<td>
前條會議,以院長為主席,其決議以過半數之意見定之,可否同數時,取決於主席。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第八十一條</font>
</font>
<table><tr><td> </td>
<td>
事務分配、代理次序及合議審判時法官之配置,經預定後,因案件或法官增減或他項事故,有變更之必要時,得由院長徵詢有關庭長、法官意見後定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第八十二條</font>
</font>
<table><tr><td> </td>
<td>
地方法院及其分院法官因事故不能執行職務時,得由地方法院院長命候補法官暫代其職務。<br>
高等法院或地方法院法官因事故不能執行職務時,得由高等法院或地方法院院長調用其分院法官暫代其職務。<br>
高等法院及其分院法官因事故不能執行職務時,得由高等法院院長調用地方法院或其分院法官暫代其職務。<br>
最高法院法官因事故不能執行職務時,得由最高法院院長商調高等法院或其分院法官暫代其職務。<br>
前二項暫代其職務之期間,不得逾六個月。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第八十三條</font>
</font>
<table><tr><td> </td>
<td>
各級法院及分院應定期出版公報,刊載裁判書全文。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td>
<td><font color=4000ff size=4>第七章 法庭之開閉及秩序</font>
<table><tr><td> </td><td><font color=8000ff>第八十四條</font>
</font>
<table><tr><td> </td>
<td>
法庭開庭,於法院內為之。但法律別有規定者,不在此限。<br>
法院內開庭時,在法庭實施訴訟程序之公務員及依法執行職務之人、訴訟當事人與訴訟關係人,均應設置席位;其席位布置,應依當事人平等之原則為之。<br>
除參與審判之法官或經審判長許可者外,在庭之人陳述時,起立,陳述後復坐。<br>
審判長蒞庭及宣示判決時,在庭之人均應起立。<br>
法庭席位布置及旁聽規則,由司法院定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第八十五條</font>
</font>
<table><tr><td> </td>
<td>
高等法院以下各級法院或分院於必要時,得在管轄區域內指定地方臨時開庭。<br>
前項情形,其法官除就本院法官中指派者外,得以所屬分院或下級法院法官充之。<br>
第一項臨時開庭辦法,由司法院定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第八十六條</font>
</font>
<table><tr><td> </td>
<td>
訴訟之辯論及裁判之宣示,應公開法庭行之。但有妨害國家安全、公共秩序或善良風俗之虞時,法院得決定不予公開。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第八十七條</font>
</font>
<table><tr><td> </td>
<td>
法庭不公開時,審判長應將不公開之理由宣示。<br>
前項情形,審判長仍得允許無妨礙之人旁聽。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第八十八條</font>
</font>
<table><tr><td> </td>
<td>
審判長於法庭之開閉及審理訴訟,有指揮之權。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第八十九條</font>
</font>
<table><tr><td> </td>
<td>
法庭開庭時,審判長有維持秩序之權。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第九十條</font>
</font>
<table><tr><td> </td>
<td>
法庭開庭時,應保持肅靜,不得有大聲交談、鼓掌、攝影、吸煙、飲食物品及其他類似之行為。非經審判長核准,並不得錄音。<br>
前項錄音辦法,由司法院定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第九十一條</font>
</font>
<table><tr><td> </td>
<td>
有妨害法庭秩序或其他不當行為者,審判長得禁止其進入法庭或命其退出法庭,必要時得命看管至閉庭時。<br>
前項處分,不得聲明不服。<br>
前二項之規定,於審判長在法庭外執行職務時準用之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第九十二條</font>
</font>
<table><tr><td> </td>
<td>
律師在法庭代理訴訟或辯護案件,其言語行動如有不當,審判長得加以警告或禁止其開庭當日之代理或辯護。非律師而為訴訟代理人或辯護人者,亦同。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第九十三條</font>
</font>
<table><tr><td> </td>
<td>
審判長為前二條之處分時,應記明其事由於筆錄。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第九十四條</font>
</font>
<table><tr><td> </td>
<td>
第八十四條至第九十三條有關審判長之規定,於受命法官、受託法官執行職務時準用之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第九十五條</font>
</font>
<table><tr><td> </td>
<td>
違反審判長、受命法官、受託法官所發維持法庭秩序之命令,致妨害法院執行職務,經制止不聽者,處三月以下有期徒刑、拘役或三千元以下罰金。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第九十六條</font>
</font>
<table><tr><td> </td>
<td>
法官及書記官在法庭執行職務時,應服制服,檢察官、公設辯護人及律師在法庭執行職務時,亦同。<br>
前項人員之服制,由司法院會同行政院定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td>
<td><font color=4000ff size=4>第八章 法院之用語</font>
<table><tr><td> </td><td><font color=8000ff>第九十七條</font>
</font>
<table><tr><td> </td>
<td>
法院為審判時,應用國語。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第九十八條</font>
</font>
<table><tr><td> </td>
<td>
訴訟當事人、證人、鑑定人及其他有關係之人,如有不通國語者,由通譯傳譯之,其為聾啞之人,亦同。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第九十九條</font>
</font>
<table><tr><td> </td>
<td>
訴訟文書應用中國文字。但有供參考之必要時,應附記所用之方言或外國語文。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百條</font>
</font>
<table><tr><td> </td>
<td>
前三條之規定,於辦理檢察事務時準用之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td>
<td><font color=4000ff size=4>第九章 裁判之評議</font>
<table><tr><td> </td><td><font color=8000ff>第一百零一條</font>
</font>
<table><tr><td> </td>
<td>
合議裁判案件,應依本法所定法官人數評議決定之。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百零二條</font>
</font>
<table><tr><td> </td>
<td>
裁判之評議,以審判長為主席。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百零三條</font>
</font>
<table><tr><td> </td>
<td>
裁判之評議,於裁判確定前均不公開。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百零四條</font>
</font>
<table><tr><td> </td>
<td>
評議時法官應各陳述意見,其次序以資淺者為先,資同以年少者為先,遞至審判長為終。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百零五條</font>
</font>
<table><tr><td> </td>
<td>
評議以過半數之意見決定之。<br>
關於數額,如法官之意見分三說以上,各不達過半數時,以最多額之意見順次算入次多額之意見,至達過半數為止。<br>
關於刑事,如法官之意見分三說以上,各不達過半數時,以最不利於被告之意見順次算入次不利於被告之意見,至達過半數為止。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百零六條</font>
</font>
<table><tr><td> </td>
<td>
評議時各法官之意見應記載於評議簿,並應於該案裁判確定前嚴守秘密。<br>
案件之當事人、訴訟代理人、辯護人或曾為輔佐人,得於裁判確定後聲請閱覽評議意見。但不得抄錄、攝影或影印。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td>
<td><font color=4000ff size=4>第十章 司法上之互動</font>
<table><tr><td> </td><td><font color=8000ff>第一百零七條</font>
</font>
<table><tr><td> </td>
<td>
法院處理事務,應互相協助。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百零八條</font>
</font>
<table><tr><td> </td>
<td>
檢察官執行職務,應互相協助。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百零九條</font>
</font>
<table><tr><td> </td>
<td>
書記官於權限內之事務,應互相協助,觀護人、執達員、法警,亦同。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td>
<td><font color=4000ff size=4>第十一章 司法行政之監督</font>
<table><tr><td> </td><td><font color=8000ff>第一百十條</font>
</font>
<table><tr><td> </td>
<td>
各級法院行政之監督,依左列規定:<br>
一、司法院院長監督各級法院及分院。<br>
二、最高法院院長監督該法院。<br>
三、高等法院院長監督該法院及其分院與所屬地方法院及其分院。<br>
四、高等法院分院院長監督該分院與轄區內地方法院及其分院。<br>
五、地方法院院長監督該法院及其分院。<br>
六、地方法院分院院長監督該分院。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百十一條</font>
</font>
<table><tr><td> </td>
<td>
各級法院檢察署行政之監督,依左列之規定:<br>
一、法務部部長監督各級法院及分院檢察署。<br>
二、最高法院檢察署檢察總長監督該檢察署。<br>
三、高等法院檢察署檢察長監督該檢察署及其分院檢察署與所屬地方法院及其分院檢察署。<br>
四、高等法院分院檢察署檢察長監督該檢察署與轄區內地方法院及其分院檢察署。<br>
五、地方法院檢察署檢察長監督該檢察署及其分院檢察署。<br>
六、地方法院分院檢察署檢察長監督該檢察署。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百十二條</font>
</font>
<table><tr><td> </td>
<td>
依前二條規定有監督權者,對於被監督之人員得為左列處分:<br>
一、關於職務上之事項,得發命令使之注意。<br>
二、有廢弛職務,侵越權限或行為不檢者,加以警告。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百十三條</font>
</font>
<table><tr><td> </td>
<td>
被監督之人員,如有前條第二款情事,而情節較重或經警告不悛者,監督長官得依公務員懲戒法辦理。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百十四條</font>
</font>
<table><tr><td> </td>
<td>
本章之規定,不影響審判權之行使。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td><td>
<table><tr><td> </td><td><font color=8000ff>第一百十四條之一</font>
</font>
<table><tr><td> </td>
<td>
各級法院及各級法院檢察署原依雇員管理規則進用之現職執達員、法警、錄事、庭務員、雇員,其未具公務人員任用資格者,得占用原職之職缺,繼續僱用至離職時為止。<br>
</td>
</table>
</table>
</table>
<table><tr><td> </td>
<td><font color=4000ff size=4>第十二章 附則</font>
<table><tr><td> </td><td><font color=8000ff>第一百十五條</font>
</font>
<table><tr><td> </td>
<td>
本法自公布日施行。<br>
</td>
</table>
</table>
</table>
<hr border=1><table cellspacing=1 cellpadding=1>
<th align=left>附<tr><td>
<a href=http://lis.ly.gov.tw/lgcgi/lylawatt?cfcbcacfcdc6cbcfcacdcfcfce target=pdf ><font size=2>附表:地方法院或其分院員額表</font></a><br>
<a href=http://lis.ly.gov.tw/lgcgi/lylawatt?cfcbcacfcdc6cbcfcacdcfcfcd target=pdf ><font size=2>附表:高等法院或其分院員額表</font></a><br>
<a href=http://lis.ly.gov.tw/lgcgi/lylawatt?cfcbcacfcdc6cbcfcacdcfcfcc target=pdf ><font size=2>附表:最高法院員額表</font></a><br>
<a href=http://lis.ly.gov.tw/lgcgi/lylawatt?cfcbcacfcdc6cbcfcacdcfcfcb target=pdf ><font size=2>附表:地方法院或其分院檢察署員額表</font></a><br>
<a href=http://lis.ly.gov.tw/lgcgi/lylawatt?cfcbcacfcdc6cbcfcacdcfcfca target=pdf ><font size=2>附表:高等法院或其分院檢察署員額表</font></a><br>
<a href=http://lis.ly.gov.tw/lgcgi/lylawatt?cfcbcacfcdc6cbcfcacdcfcfc9 target=pdf ><font size=2>附表:最高法院檢察署員額表</font></a><br>
</td></table>
</left>
</body>
<!-- Mirrored from lis.ly.gov.tw/lghtml/lawstat/version2/04502/0450295121200.htm by HTTrack Website Copier/3.x [XR&CO'2010], Sun, 24 Mar 2013 09:22:38 GMT -->
</html>
|
czchen/laweasyread-data
|
rawdata/utf8_lawstat/version2/04502/0450295121200.html
|
HTML
|
mit
| 74,105
|
package com.InfinityRaider.AgriCraft.compatibility.natura;
import com.InfinityRaider.AgriCraft.utility.LogHelper;
public class NaturaHelper {
public static int getTextureIndex(int plantMeta, int seedMeta) {
//barley: seedMeta = 0
//cotton: seedMeta = 1
switch (plantMeta) {
case 0: return seedMeta*4;
case 1: return seedMeta*4;
case 2: return seedMeta*5;
case 3: return 1+seedMeta*4;
case 4: return 1+seedMeta*5;
case 5: return 2+seedMeta*4;
case 6: return 2+seedMeta*5;
case 7: return 3+seedMeta*5;
}
LogHelper.info("Invalid Metadata on NaturaCrop"); //this should never happen
return 0;
}
}
|
marcin212/AgriCraft
|
src/main/java/com/InfinityRaider/AgriCraft/compatibility/natura/NaturaHelper.java
|
Java
|
mit
| 752
|
using Maple.Domain;
namespace Maple.Core
{
public interface IFileSystemDrive : IFileSystemInfo
{
IRangeObservableCollection<IFileSystemInfo> Children { get; }
}
}
|
Insire/InsireBot-V2
|
src/Maple.Core/IO/Interfaces/IFileSystemDrive.cs
|
C#
|
mit
| 187
|
#!/usr/bin/env python3
# Copyright (c) 2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test p2p addr-fetch connections
"""
import time
from test_framework.messages import msg_addr, CAddress, NODE_NETWORK, NODE_WITNESS
from test_framework.p2p import P2PInterface, p2p_lock
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal
ADDR = CAddress()
ADDR.time = int(time.time())
ADDR.nServices = NODE_NETWORK | NODE_WITNESS
ADDR.ip = "192.0.0.8"
ADDR.port = 18444
class P2PAddrFetch(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 1
def run_test(self):
node = self.nodes[0]
self.log.info("Connect to an addr-fetch peer")
peer = node.add_outbound_p2p_connection(P2PInterface(), p2p_idx=0, connection_type="addr-fetch")
info = node.getpeerinfo()
assert_equal(len(info), 1)
assert_equal(info[0]['connection_type'], 'addr-fetch')
self.log.info("Check that we send getaddr but don't try to sync headers with the addr-fetch peer")
peer.sync_send_with_ping()
with p2p_lock:
assert peer.message_count['getaddr'] == 1
assert peer.message_count['getheaders'] == 0
self.log.info("Check that answering the getaddr with a single address does not lead to disconnect")
# This prevents disconnecting on self-announcements
msg = msg_addr()
msg.addrs = [ADDR]
peer.send_and_ping(msg)
assert_equal(len(node.getpeerinfo()), 1)
self.log.info("Check that answering with larger addr messages leads to disconnect")
msg.addrs = [ADDR] * 2
peer.send_message(msg)
peer.wait_for_disconnect(timeout=5)
self.log.info("Check timeout for addr-fetch peer that does not send addrs")
peer = node.add_outbound_p2p_connection(P2PInterface(), p2p_idx=1, connection_type="addr-fetch")
node.setmocktime(int(time.time()) + 301) # Timeout: 5 minutes
peer.wait_for_disconnect(timeout=5)
if __name__ == '__main__':
P2PAddrFetch().main()
|
JeremyRubin/bitcoin
|
test/functional/p2p_addrfetch.py
|
Python
|
mit
| 2,266
|
import React, { PropTypes, Component } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import NoteAdd from 'material-ui/svg-icons/action/note-add';
import Delete from 'material-ui/svg-icons/action/delete';
import IconMenu from 'material-ui/IconMenu';
import ShowChart from 'material-ui/svg-icons/editor/show-chart';
import MenuItem from 'material-ui/MenuItem';
import History from 'material-ui/svg-icons/action/history';
import IconButtonElement from 'components/utils/IconButtonElement';
import { openKeyDialog,
openConfirmDeleteNamespaceDialog } from 'actions/dialogActions';
const anchorOrigin = {
vertical: 'bottom',
horizontal: 'left',
};
const targetOrigin = {
vertical: 'top',
horizontal: 'left',
};
export class NamespaceItemMenu extends Component {
createKey(name) {
this.props.newKey(name);
}
deleteNamespace(name) {
this.props.deleteNamespace(name);
}
render() {
const { name, ...props } = this.props;
return (
<IconMenu disableAutoFocus
iconButtonElement={ <IconButtonElement /> }
anchorOrigin={ anchorOrigin }
targetOrigin={ targetOrigin }
{...props}
>
<MenuItem leftIcon={<NoteAdd />} onTouchTap={ this.createKey.bind(this, name) }>
New key
</MenuItem>
<MenuItem leftIcon={<ShowChart />} containerElement={<Link to={`/stats/${name}`} />}>
Statistics
</MenuItem>
<MenuItem containerElement={<Link to={`/history/${name}`} />} leftIcon={<History />}>
History
</MenuItem>
<MenuItem leftIcon={<Delete />} onTouchTap={ this.deleteNamespace.bind(this, name) }>
Delete
</MenuItem>
</IconMenu>
);
}
}
NamespaceItemMenu.propTypes = {
name: PropTypes.string,
deleteNamespace: PropTypes.func,
newKey: PropTypes.func,
};
const mapDispatchToProps = (dispatch) => ({
deleteNamespace(namespace) {
dispatch(openConfirmDeleteNamespaceDialog({ namespace }));
},
newKey(namespace) {
dispatch(openKeyDialog({ namespace }));
},
});
export default connect(
null,
mapDispatchToProps
)(NamespaceItemMenu);
|
Stevenah/INF5750
|
webapp/js/components/sidebar/NamespaceItemMenu.js
|
JavaScript
|
mit
| 2,435
|
<?php
namespace ZfcDatagridTest\Column\Action;
use PHPUnit_Framework_TestCase;
use ZfcDatagrid\Column\Action\Button;
/**
* @group Column
* @covers ZfcDatagrid\Column\Action\Button
*/
class ButtonTest extends PHPUnit_Framework_TestCase
{
public function testConstruct()
{
$button = new Button();
$this->assertEquals([
'href' => '#',
'class' => 'btn btn-default',
], $button->getAttributes());
}
public function testLabelAndToHtml()
{
$button = new Button();
$button->setLabel('My label');
$this->assertEquals('My label', $button->getLabel());
$html = '<a href="#" class="btn btn-default">My label</a>';
$this->assertEquals($html, $button->toHtml([]));
}
public function testColumnLabelAndToHtml()
{
$col = $this->getMockForAbstractClass('ZfcDatagrid\Column\AbstractColumn');
$col->setUniqueId('myCol');
$button = new Button();
$button->setLabel($col);
$this->assertInstanceOf('ZfcDatagrid\Column\AbstractColumn', $button->getLabel());
$html = '<a href="#" class="btn btn-default">Blubb</a>';
$this->assertEquals($html, $button->toHtml(['myCol' => 'Blubb']));
}
public function testHtmlException()
{
$button = new Button();
$this->setExpectedException('InvalidArgumentException');
$button->toHtml([]);
}
}
|
kokspflanze/ZfcDatagrid
|
tests/ZfcDatagridTest/Column/Action/ButtonTest.php
|
PHP
|
mit
| 1,436
|
---
title: 'Kome Je Oprošteno'
date: 15/03/2021
---
Pedeset deveto poglavlje Knjige proroka Izaije iznosi zapanjujuću sliku u vezi s problemom grijeha. Srećom, Biblija pruža nadu u spasenje.
Za početak postavimo pitanje: Koliko nas je sagriješilo? Biblija je nedvosmislena: Svi smo sagriješili. Spasenje se, prema tome, ne može zasnivati na odsutnosti grijeha. Ono se mora zasnivati na oprostu (Jeremija 31,34). Pavao tvrdi isto. Svi su sagriješili (Rimljanima 3,9-20.23). Dakle, ne može postojati razlika po toj osnovi (Rimljanima 3,22). Oni koji su opravdani, mogu biti proglašeni pravednima samo zato što vjerom prihvaćaju dar Božje pravednosti zahvaljujući Kristovoj žrtvi.
`Pročitajte Rimljanima 3,21-24. Što nam ti redci govore o načinu na koji se spašavamo? Kakvu bi nam nadu oni trebali dati na sudu?`
Većina ljudi misli da je glavno pitanje na sudu tko je sagriješio. Međutim, to pitanje ne treba ni postavljati jer su svi sagriješili. Umjesto toga, pitanje glasi: Kome je oprošteno? Bog je pravedan kad opravdava “onoga koji vjeruje u Isusa” (Rimljanima 3,26). Odlučujuće pitanje na sudu glasi: Tko je primio oprost na osnovi svoje vjere u Isusa?
Točno je da se nama sudi po djelima, ali ne u smislu da nas djela spašavaju. Kad bi bilo tako, vjera bi bila uzaludna (Rimljanima 4,14). Naša djela, zapravo, otkrivaju jesmo li doista spašeni (Jakov 2,18).
`Zašto nas djela ne mogu spasiti, ni sada ni na sudu? Vidi Rimljanima 3,20.23.`
Prekasno je da dobra djela ili poslušnost Zakonu bilo koga spase. Svrha Zakona u grešnom svijetu nije da spasi, već da ukaže na grijeh. Jer “vjera koja očituje svoju snagu ljubavlju” (Galaćanima 5,6) koju u srce ulijeva Božji Duh (Rimljanima 5,5), pokazuje da osoba ima živu vjeru u Isusa (vidi i Jakov 2,26).
Djela su izvanjski izraz, ljudsko očitovanje spasonosne vjere. Prema tome, u pravom kršćanskom iskustvu vjera se izražava svakidašnjim posvećenjem Gospodinu, što se otkriva poslušnošću Zakonu. Na sudu Bog uzima djela kao dokaz pred svojim stvorenjima koja ne mogu čitati misli vjere kao što On može. Ali za obraćenu osobu na sudu su značajna samo djela učinjena nakon obraćenja, u sili Krista i Duha Svetoga. Život grijeha prije obraćenja već je opran krvlju Janjeta (vidi Rimljanima 6).
|
imasaru/sabbath-school-lessons
|
src/hr/2021-01/12/03.md
|
Markdown
|
mit
| 2,316
|
<!doctype html>
<html lang="lv">
<head
prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# profile: http://ogp.me/ns/profile#"
itemscope itemtype="http://schema.org/WebSite"
>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-KSXCLLZ');</script>
<!-- End Google Tag Manager -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="fb:app_id" content="1236171016488428" />
<meta property="og:type" content="profile" />
<meta property="og:url" content="https://lvdb.lv/kolektivi/ee20ee37-62bf-eb60-eb1f-5e827fa05467" />
<meta property="og:title" content="Pērkonītis" />
<meta property="og:description" content="Valmieras Valsts ģimnāzijas Jauniešu deju kolektīvs "Pērkonītis"" />
<meta name="description" content="Valmieras Valsts ģimnāzijas Jauniešu deju kolektīvs "Pērkonītis"">
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@lvdb_lv" />
<meta name="msvalidate.01" content="CD405DAD5EA4CF65237EAB3E933C6C74" />
<title>Pērkonītis</title>
<meta itemprop='name' content="lvdb.lv">
<link rel="canonical" href="https://lvdb.lv" itemprop="url">
<link rel="alternate" hreflang="lv-LV" href="https://lvdb.lv">
<meta name="theme-color" content="#f4c671">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700&subset=latin-ext" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css" />
<link rel="stylesheet" href="/static/style.css" />
<link rel="icon" href="images/favicon.png">
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KSXCLLZ"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '1236171016488428',
cookie : true,
xfbml : true,
version : 'v2.8'
});
FB.AppEvents.logPageView();
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="background">
<div class="header-background"></div>
</div>
<div class="main-section" itemscope itemtype="http://schema.org/DanceGroup">
<!-- <header>
<div class="header__hero"></div>
<div class="header__main-info-holder">
<div class="header__main-info">
<div class="image"></div>
<span class="name-row">
<span class="quality-group">B</span>
<h1 class="group-name" itemprop="name">Pērkonītis</h1>
</span>
</div>
</div>
</header> -->
<main>
<span class="name-row">
<h1 class="group-name" itemprop="name">Pērkonītis</h1>
<span class="quality-group">B</span>
</span>
<p itemprop="description">Valmieras Valsts ģimnāzijas Jauniešu deju kolektīvs "Pērkonītis"</p>
<section>
<h2>Vadītāji</h2>
<ul class="property-list">
<li class="property" itemprop="employee" itemscope itemtype="http://schema.org/Person">
<a itemprop="url" href="/vaditaji/Liesma-Ergle"><span itemprop="name">Liesma Ērgle<span></a>
</li>
</ul>
</section>
<section>
<h2>Skates</h2>
<table class="data-table collapse-768">
<thead>
<tr>
<th>Nosaukums</th>
<th>Rezultāts</th>
<th>Iegūtā pakāpe</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="table-cell-label">Nosaukums</div>
<a href="/">
XXVI Vispārējo latviešu Dziesmu un XVI deju svētku lieluzveduma "Māras zeme" repertuāra apguves skate 2017. gadā
</a>
</td>
<td>
<div class="table-cell-label">Rezultāts</div>
50,7 punkti
</td>
<td>
<div class="table-cell-label">Iegūtā pakāpe</div>
I pakāpe
</td>
</tr>
</tbody>
</table>
</section>
</main>
</div>
</body>
</html>
|
klavs/db-lv
|
docs/kolektivi/ee20ee37-62bf-eb60-eb1f-5e827fa05467.html
|
HTML
|
mit
| 6,171
|
#include "StdAfx.h"
#ifndef DISABLE_CONSTRAINTS
#include "Point2PointConstraint.h"
#include "RigidBody.h"
ConstraintSetting::ConstraintSetting(btConstraintSetting* native, bool preventDelete)
{
_native = native;
_preventDelete = preventDelete;
}
ConstraintSetting::~ConstraintSetting()
{
this->!ConstraintSetting();
}
ConstraintSetting::!ConstraintSetting()
{
if (!_preventDelete)
{
delete _native;
}
_native = NULL;
}
ConstraintSetting::ConstraintSetting()
{
_native = new btConstraintSetting();
}
btScalar ConstraintSetting::Damping::get()
{
return _native->m_damping;
}
void ConstraintSetting::Damping::set(btScalar value)
{
_native->m_damping = value;
}
btScalar ConstraintSetting::ImpulseClamp::get()
{
return _native->m_impulseClamp;
}
void ConstraintSetting::ImpulseClamp::set(btScalar value)
{
_native->m_impulseClamp = value;
}
btScalar ConstraintSetting::Tau::get()
{
return _native->m_tau;
}
void ConstraintSetting::Tau::set(btScalar value)
{
_native->m_tau = value;
}
#define Native static_cast<btPoint2PointConstraint*>(_native)
Point2PointConstraint::Point2PointConstraint(RigidBody^ rigidBodyA, RigidBody^ rigidBodyB,
Vector3 pivotInA, Vector3 pivotInB)
: TypedConstraint(0)
{
VECTOR3_CONV(pivotInA);
VECTOR3_CONV(pivotInB);
UnmanagedPointer = new btPoint2PointConstraint(*(btRigidBody*)rigidBodyA->_native, *(btRigidBody*)rigidBodyB->_native,
VECTOR3_USE(pivotInA), VECTOR3_USE(pivotInB));
VECTOR3_DEL(pivotInA);
VECTOR3_DEL(pivotInB);
_rigidBodyA = rigidBodyA;
_rigidBodyB = rigidBodyB;
}
Point2PointConstraint::Point2PointConstraint(RigidBody^ rigidBodyA, Vector3 pivotInA)
: TypedConstraint(0)
{
VECTOR3_CONV(pivotInA);
UnmanagedPointer = new btPoint2PointConstraint(*(btRigidBody*)rigidBodyA->_native, VECTOR3_USE(pivotInA));
VECTOR3_DEL(pivotInA);
_rigidBodyA = rigidBodyA;
_rigidBodyB = GetFixedBody();
}
void Point2PointConstraint::GetInfo1NonVirtual(ConstraintInfo1^ info)
{
Native->getInfo1NonVirtual(info->_native);
}
void Point2PointConstraint::GetInfo2NonVirtual(ConstraintInfo2^ info, Matrix body0Trans,
Matrix body1Trans)
{
TRANSFORM_CONV(body0Trans);
TRANSFORM_CONV(body1Trans);
Native->getInfo2NonVirtual(info->_native, TRANSFORM_USE(body0Trans), TRANSFORM_USE(body1Trans));
TRANSFORM_DEL(body0Trans);
TRANSFORM_DEL(body1Trans);
}
void Point2PointConstraint::UpdateRhs(btScalar timeStep)
{
Native->updateRHS(timeStep);
}
Vector3 Point2PointConstraint::PivotInA::get()
{
return Math::BtVector3ToVector3(&Native->getPivotInA());
}
void Point2PointConstraint::PivotInA::set(Vector3 pivotA)
{
VECTOR3_CONV(pivotA);
Native->setPivotA(VECTOR3_USE(pivotA));
VECTOR3_DEL(pivotA);
}
Vector3 Point2PointConstraint::PivotInB::get()
{
return Math::BtVector3ToVector3(&Native->getPivotInB());
}
void Point2PointConstraint::PivotInB::set(Vector3 pivotB)
{
VECTOR3_CONV(pivotB);
Native->setPivotB(VECTOR3_USE(pivotB));
VECTOR3_DEL(pivotB);
}
ConstraintSetting^ Point2PointConstraint::Setting::get()
{
return gcnew ConstraintSetting(&Native->m_setting, true);
}
void Point2PointConstraint::Setting::set(ConstraintSetting^ setting)
{
Native->m_setting = *setting->_native;
}
#endif
|
ruisebastiao/BulletSharp
|
src/Point2PointConstraint.cpp
|
C++
|
mit
| 3,310
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.MetadataAsSource;
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.Handler
{
[Shared]
[ExportLspMethod(LSP.Methods.TextDocumentTypeDefinitionName)]
internal class GoToTypeDefinitionHandler : AbstractGoToDefinitionHandler<LSP.TextDocumentPositionParams, LSP.Location[]>
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public GoToTypeDefinitionHandler(IMetadataAsSourceFileService metadataAsSourceFileService, ILspSolutionProvider solutionProvider)
: base(metadataAsSourceFileService, solutionProvider)
{
}
public override Task<LSP.Location[]> HandleRequestAsync(LSP.TextDocumentPositionParams request, RequestContext context, CancellationToken cancellationToken)
=> GetDefinitionAsync(request, typeOnly: true, context, cancellationToken);
}
}
|
genlu/roslyn
|
src/Features/LanguageServer/Protocol/Handler/Definitions/GoToTypeDefinitionHandler.cs
|
C#
|
mit
| 1,328
|
file(REMOVE_RECURSE
"CMakeFiles/linearstructure_6.dir/linearstructure.cpp.o"
"linearstructure_6.pdb"
"linearstructure_6"
)
# Per-language clean rules from dependency scanning.
foreach(lang CXX)
include(CMakeFiles/linearstructure_6.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()
|
dybiszb/MeanCurvatureLibrary
|
code/external/eigen/build/test/CMakeFiles/linearstructure_6.dir/cmake_clean.cmake
|
CMake
|
mit
| 293
|
/*! 1.2.7 */
window.XMLHttpRequest&&window.FormData&&(XMLHttpRequest=function(a){return function(){var b=new a;return b.setRequestHeader=function(a){return function(c,d){if("__setXHR_"===c){var e=d(b);e instanceof Function&&e(b)}else a.apply(b,arguments)}}(b.setRequestHeader),b}}(XMLHttpRequest),window.XMLHttpRequest.__isShim=!0);
|
ninjablocks/douitsu
|
public/bower_components/ng-file-upload/angular-file-upload-html5-shim.min.js
|
JavaScript
|
mit
| 332
|
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class YoutubeAPIController extends Controller
{
public function videos()
{
$options = ['chart' => 'mostPopular', 'maxResults' => 16];
$regionCode = 'MA';
$selectedCategory = 0;
if (\Input::has('page')) {
$options['pageToken'] = \Input::get('page');
}
if (\Input::has('category')) {
$selectedCategory = \Input::get('category');
$options['videoCategoryId'] = $selectedCategory;
}
$youtube = \App::make('youtube');
$categories = $youtube->videoCategories->listVideoCategories('snippet', ['regionCode' => $regionCode])->getItems();
$videos = $youtube->videos->listVideos('id, snippet', $options);
return view('videos', ['videos' => $videos, 'categories' => $categories, 'selectedCategory' => $selectedCategory]);
}
public function video($id)
{
$options = ['maxResults' => 1, 'id' => $id];
$youtube = \App::make('youtube');
$videos = $youtube->videos->listVideos('id, snippet, player, contentDetails, statistics, status', $options);
$relatedVideos = $youtube->search->listSearch("snippet",
['maxResults' => 16, 'type' => 'video', 'relatedToVideoId' => $id]);
if (count($videos->getItems()) == 0) {
return redirect('404');
}
return view('video', ['video' => $videos[0], 'relatedVideos' => $relatedVideos]);
}
public function search()
{
if (!\Input::has('query')) {
return view("search");
}
$options = ['maxResults' => 16, 'q' => \Input::get("query")];
if (\Input::has('page')) {
$options['pageToken'] = \Input::get('page');
}
$youtube = \App::make('youtube');
$videos = $youtube->search->listSearch("snippet", $options);
// after video ends, use relatedToVideoId for suggestions
return view("search", ['videos' => $videos, 'query' => \Input::get('query')]);
}
}
|
fypyuhu/nanna
|
app/Http/Controllers/YoutubeAPIController.php
|
PHP
|
mit
| 2,077
|
const ClientCommand = require('./_base-command.js');
/**
* Maximizes the current window.
*
* @example
* this.demoTest = function (browser) {
* browser.maximizeWindow();
* };
*
*
* @method maximizeWindow
* @param {function} [callback] Optional callback function to be called when the command finishes.
* @see windowMaximize
* @api protocol.contexts
*/
class WindowMaximize extends ClientCommand {
performAction(callback) {
this.api.windowMaximize('current', callback);
}
}
module.exports = WindowMaximize;
|
beatfactor/nightwatch
|
lib/api/client-commands/maximizeWindow.js
|
JavaScript
|
mit
| 534
|
<?xml version="1.0" ?><!DOCTYPE TS><TS language="lt" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About GlobalDenomination</source>
<translation>Apie GlobalDenomination</translation>
</message>
<message>
<location line="+39"/>
<source><b>GlobalDenomination</b> version</source>
<translation><b>GlobalDenomination</b> versija</translation>
</message>
<message>
<location line="+57"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
<translation>Tai eksperimentinė programa.
Platinama pagal MIT/X11 licenciją, kurią rasite faile COPYING arba http://www.opensource.org/licenses/mit-license.php.
Šiame produkte yra OpenSSL projekto kuriamas OpenSSL Toolkit (http://www.openssl.org/), Eric Young parašyta kriptografinė programinė įranga bei Thomas Bernard sukurta UPnP programinė įranga.</translation>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The GlobalDenomination developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Adresų knygelė</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Spragtelėkite, kad pakeistumėte adresą arba žymę</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Sukurti naują adresą</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Kopijuoti esamą adresą į mainų atmintį</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>&Naujas adresas</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your GlobalDenomination addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation>Tai yra jūsų GlobalDenomination adresai mokėjimų gavimui. Galite duoti skirtingus adresus atskiriems siuntėjams, kad galėtumėte sekti, kas jums moka.</translation>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>&Kopijuoti adresą</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>Rodyti &QR kodą</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a GlobalDenomination address</source>
<translation>Pasirašykite žinutę, kad įrodytume, jog esate GlobalDenomination adreso savininkas</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Registruoti praneši&mą</translation>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified GlobalDenomination address</source>
<translation>Patikrinkite žinutę, jog įsitikintumėte, kad ją pasirašė nurodytas GlobalDenomination adresas</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>&Tikrinti žinutę</translation>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Trinti</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your GlobalDenomination addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>Kopijuoti ž&ymę</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>&Keisti</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Eksportuoti adresų knygelės duomenis</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Kableliais išskirtas failas (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Eksportavimo klaida</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Nepavyko įrašyti į failą %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Žymė</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresas</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(nėra žymės)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Slaptafrazės dialogas</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Įvesti slaptafrazę</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Nauja slaptafrazė</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Pakartokite naują slaptafrazę</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Įveskite naują piniginės slaptafrazę.<br/>Prašome naudoti slaptafrazę iš <b> 10 ar daugiau atsitiktinių simbolių</b> arba <b>aštuonių ar daugiau žodžių</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Užšifruoti piniginę</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Ši operacija reikalauja jūsų piniginės slaptafrazės jai atrakinti.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Atrakinti piniginę</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Ši operacija reikalauja jūsų piniginės slaptafrazės jai iššifruoti.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Iššifruoti piniginę</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Pakeisti slaptafrazę</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Įveskite seną ir naują piniginės slaptafrazes.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Patvirtinkite piniginės užšifravimą</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR GlobalDenominationS</b>!</source>
<translation>Dėmesio: jei užšifruosite savo piniginę ir pamesite slaptafrazę, jūs<b>PRARASITE VISUS SAVO GlobalDenominationUS</b>! </translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Ar tikrai norite šifruoti savo piniginę?</translation>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Įspėjimas: įjungtas Caps Lock klavišas!</translation>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Piniginė užšifruota</translation>
</message>
<message>
<location line="-56"/>
<source>GlobalDenomination will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your GlobalDenominations from being stolen by malware infecting your computer.</source>
<translation>GlobalDenomination dabar užsidarys šifravimo proceso pabaigai. Atminkite, kad piniginės šifravimas negali pilnai apsaugoti GlobalDenominationų vagysčių kai tinkle esančios kenkėjiškos programos patenka į jūsų kompiuterį.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Nepavyko užšifruoti piniginę</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Dėl vidinės klaidos nepavyko užšifruoti piniginę.Piniginė neužšifruota.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>Įvestos slaptafrazės nesutampa.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>Nepavyko atrakinti piniginę</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Neteisingai įvestas slaptažodis piniginės iššifravimui.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Nepavyko iššifruoti piniginės</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>Piniginės slaptažodis sėkmingai pakeistas.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>Pasirašyti ži&nutę...</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Sinchronizavimas su tinklu ...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>&Apžvalga</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Rodyti piniginės bendrą apžvalgą</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>&Sandoriai</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Apžvelgti sandorių istoriją</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Redaguoti išsaugotus adresus bei žymes</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Parodyti adresų sąraša mokėjimams gauti</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>&Išeiti</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Išjungti programą</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about GlobalDenomination</source>
<translation>Rodyti informaciją apie GlobalDenomination</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Apie &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Rodyti informaciją apie Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Parinktys...</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>&Užšifruoti piniginę...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>&Backup piniginę...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>&Keisti slaptafrazę...</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-347"/>
<source>Send coins to a GlobalDenomination address</source>
<translation>Siųsti monetas GlobalDenomination adresui</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for GlobalDenomination</source>
<translation>Keisti GlobalDenomination konfigūracijos galimybes</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>Daryti piniginės atsarginę kopiją</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Pakeisti slaptafrazę naudojamą piniginės užšifravimui</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation>&Derinimo langas</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Atverti derinimo ir diagnostikos konsolę</translation>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>&Tikrinti žinutę...</translation>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>GlobalDenomination</source>
<translation>GlobalDenomination</translation>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>Piniginė</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>&About GlobalDenomination</source>
<translation>&Apie GlobalDenomination</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&Rodyti / Slėpti</translation>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your GlobalDenomination addresses to prove you own them</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified GlobalDenomination addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>&Failas</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>&Nustatymai</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>&Pagalba</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Kortelių įrankinė</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[testavimotinklas]</translation>
</message>
<message>
<location line="+47"/>
<source>GlobalDenomination client</source>
<translation>GlobalDenomination klientas</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to GlobalDenomination network</source>
<translation><numerusform>%n GlobalDenomination tinklo aktyvus ryšys</numerusform><numerusform>%n GlobalDenomination tinklo aktyvūs ryšiai</numerusform><numerusform>%n GlobalDenomination tinklo aktyvūs ryšiai</numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+70"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>Atnaujinta</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Vejamasi...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation>Patvirtinti sandorio mokestį</translation>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Sandoris nusiųstas</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Ateinantis sandoris</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Data: %1
Suma: %2
Tipas: %3
Adresas: %4</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation>URI apdorojimas</translation>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid GlobalDenomination address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Piniginė <b>užšifruota</b> ir šiuo metu <b>atrakinta</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Piniginė <b>užšifruota</b> ir šiuo metu <b>užrakinta</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. GlobalDenomination can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>Tinklo įspėjimas</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Keisti adresą</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>Ž&ymė</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Žymė yra susieta su šios adresų knygelęs turiniu</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Adresas</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation>Adresas yra susietas su šios adresų knygelęs turiniu. Tai gali būti keičiama tik siuntimo adresams.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Naujas gavimo adresas</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Naujas siuntimo adresas</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Keisti gavimo adresą</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Keisti siuntimo adresą</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Įvestas adresas „%1“ jau yra adresų knygelėje.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid GlobalDenomination address.</source>
<translation>Įvestas adresas „%1“ nėra galiojantis GlobalDenomination adresas.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Nepavyko atrakinti piniginės.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Naujo rakto generavimas nepavyko.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>GlobalDenomination-Qt</source>
<translation>GlobalDenomination-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>versija</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Naudojimas:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>komandinės eilutės parametrai</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>Naudotoji sąsajos parametrai</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Nustatyti kalbą, pavyzdžiui "lt_LT" (numatyta: sistemos kalba)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Paleisti sumažintą</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Parinktys</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Pagrindinės</translation>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>&Mokėti sandorio mokestį</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start GlobalDenomination after logging in to the system.</source>
<translation>Automatiškai paleisti Bitkoin programą įjungus sistemą.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start GlobalDenomination on system login</source>
<translation>&Paleisti GlobalDenomination programą su window sistemos paleidimu</translation>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation>&Tinklas</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the GlobalDenomination client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>Automatiškai atidaryti GlobalDenomination kliento prievadą maršrutizatoriuje. Tai veikia tik tada, kai jūsų maršrutizatorius palaiko UPnP ir ji įjungta.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Persiųsti prievadą naudojant &UPnP</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the GlobalDenomination network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>Jungtis į Bitkoin tinklą per socks proxy (pvz. jungiantis per Tor)</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>&Jungtis per SOCKS tarpinį serverį:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>Tarpinio serverio &IP:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>Tarpinio serverio IP adresas (pvz. 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Prievadas:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Tarpinio serverio preivadas (pvz, 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>SOCKS &versija:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>Tarpinio serverio SOCKS versija (pvz., 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>&Langas</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Po programos lango sumažinimo rodyti tik programos ikoną.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&M sumažinti langą bet ne užduočių juostą</translation>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation>Uždarant langą neuždaryti programos. Kai ši parinktis įjungta, programa bus uždaryta tik pasirinkus meniu komandą Baigti.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>&Sumažinti uždarant</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Rodymas</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>Naudotojo sąsajos &kalba:</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting GlobalDenomination.</source>
<translation>Čia gali būti nustatyta naudotojo sąsajos kalba. Šis nustatymas įsigalios iš naujo paleidus GlobalDenomination.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>&Vienetai, kuriais rodyti sumas:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Rodomų ir siunčiamų monetų kiekio matavimo vienetai</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show GlobalDenomination addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>&Rodyti adresus sandorių sąraše</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&Gerai</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Atšaukti</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Pritaikyti</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation>numatyta</translation>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation>Įspėjimas</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting GlobalDenomination.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>Nurodytas tarpinio serverio adresas negalioja.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Forma</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the GlobalDenomination network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>Balansas:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Nepatvirtinti:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>Piniginė</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation>Nepribrendę:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Naujausi sandoriai</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>Jūsų einamasis balansas</translation>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>Iš viso sandorių, įskaitant tuos kurie dar turi būti patvirtinti, ir jie dar nėra įskaičiuotii į einamosios sąskaitos balansą</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start GlobalDenomination: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>QR kodo dialogas</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>Prašau išmokėti</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Suma:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Žymė:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Žinutė:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>Į&rašyti kaip...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>Klaida, koduojant URI į QR kodą.</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation>Įvesta suma neteisinga, prašom patikrinti.</translation>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>Įrašyti QR kodą</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>PNG paveikslėliai (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Kliento pavadinimas</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+339"/>
<source>N/A</source>
<translation>nėra</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>Kliento versija</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Informacija</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Naudojama OpenSSL versija</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Paleidimo laikas</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Tinklas</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Prisijungimų kiekis</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>Testnete</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Blokų grandinė</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Dabartinis blokų skaičius</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Paskutinio bloko laikas</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Atverti</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>Komandinės eilutės parametrai</translation>
</message>
<message>
<location line="+7"/>
<source>Show the GlobalDenomination-Qt help message to get a list with possible GlobalDenomination command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>&Rodyti</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Konsolė</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Kompiliavimo data</translation>
</message>
<message>
<location line="-104"/>
<source>GlobalDenomination - Debug window</source>
<translation>GlobalDenomination - Derinimo langas</translation>
</message>
<message>
<location line="+25"/>
<source>GlobalDenomination Core</source>
<translation>GlobalDenomination branduolys</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>Derinimo žurnalo failas</translation>
</message>
<message>
<location line="+7"/>
<source>Open the GlobalDenomination debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Išvalyti konsolę</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the GlobalDenomination RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Siųsti monetas</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>Siųsti keliems gavėjams vienu metu</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>&A Pridėti gavėją</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>Pašalinti visus sandorio laukus</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>Išvalyti &viską</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>Balansas:</translation>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation>123.456 BTC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>Patvirtinti siuntimo veiksmą</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>&Siųsti</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> to %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Patvirtinti monetų siuntimą</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Ar tikrai norite siųsti %1?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation> ir </translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>Negaliojantis gavėjo adresas. Patikrinkite.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Apmokėjimo suma turi būti didesnė nei 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Suma viršija jūsų balansą.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Jei pridedame sandorio mokestį %1 bendra suma viršija jūsų balansą.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Rastas adreso dublikatas.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Klaida: sandoris buvo atmestas.Tai gali įvykti, jei kai kurios monetos iš jūsų piniginėje jau buvo panaudotos, pvz. jei naudojote wallet.dat kopiją ir monetos buvo išleistos kopijoje, bet nepažymėtos kaip skirtos išleisti čia.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Forma</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>Su&ma:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>Mokėti &gavėjui:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. H7QEPyCg1Yv3UZUALDha9bNYXuYbfMe9Lp)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Įveskite žymę šiam adresui kad galėtumėte įtraukti ją į adresų knygelę</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>Ž&ymė:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Pasirinkite adresą iš adresų knygelės</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Įvesti adresą iš mainų atminties</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation>Pašalinti šį gavėją</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a GlobalDenomination address (e.g. H7QEPyCg1Yv3UZUALDha9bNYXuYbfMe9Lp)</source>
<translation>Įveskite bitkoinų adresą (pvz. H7QEPyCg1Yv3UZUALDha9bNYXuYbfMe9Lp)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation>&Pasirašyti žinutę</translation>
</message>
<message>
<location line="+6"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. H7QEPyCg1Yv3UZUALDha9bNYXuYbfMe9Lp)</source>
<translation>Įveskite bitkoinų adresą (pvz. H7QEPyCg1Yv3UZUALDha9bNYXuYbfMe9Lp)</translation>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation>Pasirinkite adresą iš adresų knygelės</translation>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation>Įvesti adresą iš mainų atminties</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation>Įveskite pranešimą, kurį norite pasirašyti čia</translation>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this GlobalDenomination address</source>
<translation>Registruotis žinute įrodymuii, kad turite šį adresą</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>Išvalyti &viską</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation>&Patikrinti žinutę</translation>
</message>
<message>
<location line="+6"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. H7QEPyCg1Yv3UZUALDha9bNYXuYbfMe9Lp)</source>
<translation>Įveskite bitkoinų adresą (pvz. H7QEPyCg1Yv3UZUALDha9bNYXuYbfMe9Lp)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified GlobalDenomination address</source>
<translation>Patikrinkite žinutę, jog įsitikintumėte, kad ją pasirašė nurodytas GlobalDenomination adresas</translation>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a GlobalDenomination address (e.g. H7QEPyCg1Yv3UZUALDha9bNYXuYbfMe9Lp)</source>
<translation>Įveskite bitkoinų adresą (pvz. H7QEPyCg1Yv3UZUALDha9bNYXuYbfMe9Lp)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Spragtelėkite "Registruotis žinutę" tam, kad gauti parašą</translation>
</message>
<message>
<location line="+3"/>
<source>Enter GlobalDenomination signature</source>
<translation>Įveskite GlobalDenomination parašą</translation>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>Įvestas adresas negalioja.</translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>Prašom patikrinti adresą ir bandyti iš naujo.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>Piniginės atrakinimas atšauktas.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Žinutės pasirašymas nepavyko.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Žinutė pasirašyta.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>Nepavyko iškoduoti parašo.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Prašom patikrinti parašą ir bandyti iš naujo.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>Parašas neatitinka žinutės.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Žinutės tikrinimas nepavyko.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Žinutė patikrinta.</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The GlobalDenomination developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation>[testavimotinklas]</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>Atidaryta iki %1</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation>%1/neprisijungęs</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/nepatvirtintas</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 patvirtinimų</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Būsena</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Šaltinis</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Sugeneruotas</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>Nuo</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>Kam</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation>savo adresas</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>žymė</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Kreditas</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>nepriimta</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Debitas</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Sandorio mokestis</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Neto suma</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Žinutė</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Komentaras</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>Sandorio ID</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation>Išgautos monetos turi sulaukti 120 blokų, kol jos gali būti naudojamos. Kai sukūrėte šį bloką, jis buvo transliuojamas tinkle ir turėjo būti įtrauktas į blokų grandinę. Jei nepavyksta patekti į grandinę, bus pakeista į "nepriėmė", o ne "vartojamas". Tai kartais gali atsitikti, jei kitas mazgas per keletą sekundžių sukuria bloką po jūsų bloko.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Derinimo informacija</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Sandoris</translation>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Suma</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>tiesa</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>netiesa</translation>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, transliavimas dar nebuvo sėkmingas</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>nežinomas</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Sandorio detelės</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Šis langas sandorio detalų aprašymą</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Tipas</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresas</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Suma</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>Atidaryta iki %1</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>Atjungta (%1 patvirtinimai)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>Nepatvirtintos (%1 iš %2 patvirtinimų)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Patvirtinta (%1 patvirtinimai)</translation>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Šis blokas negautas nė vienu iš mazgų ir matomai nepriimtas</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Išgauta bet nepriimta</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>Gauta su</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Gauta iš</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Siųsta </translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Mokėjimas sau</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Išgauta</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>nepasiekiama</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Sandorio būklė. Užvedus pelės žymeklį ant šios srities matysite patvirtinimų skaičių.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Sandorio gavimo data ir laikas</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Sandorio tipas.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Sandorio paskirties adresas</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Suma pridėta ar išskaičiuota iš balanso</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>Visi</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Šiandien</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Šią savaitę</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Šį mėnesį</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Paskutinį mėnesį</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Šiais metais</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Intervalas...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Gauta su</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Išsiųsta</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Skirta sau</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Išgauta</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Kita</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Įveskite adresą ar žymę į paiešką</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Minimali suma</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Kopijuoti adresą</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Kopijuoti žymę</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Kopijuoti sumą</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Taisyti žymę</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Rodyti sandėrio detales</translation>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>Sandorio duomenų eksportavimas</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Kableliais atskirtų duomenų failas (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Patvirtintas</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Tipas</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Žymė</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Adresas</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Suma</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Eksportavimo klaida</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Neįmanoma įrašyti į failą %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Grupė:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>skirta</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation>Siųsti monetas</translation>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>GlobalDenomination version</source>
<translation>GlobalDenomination versija</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>Naudojimas:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or GlobalDenominationd</source>
<translation>Siųsti komandą serveriui arba GlobalDenominationd</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>Komandų sąrašas</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>Suteikti pagalba komandai</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>Parinktys:</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: GlobalDenomination.conf)</source>
<translation>Nurodyti konfigūracijos failą (pagal nutylėjimąt: GlobalDenomination.conf)</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: GlobalDenominationd.pid)</source>
<translation>Nurodyti pid failą (pagal nutylėjimą: GlobalDenominationd.pid)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Nustatyti duomenų aplanką</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 9348 or testnet: 19348)</source>
<translation>Sujungimo klausymas prijungčiai <port> (pagal nutylėjimą: 9348 arba testnet: 19348)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Palaikyti ne daugiau <n> jungčių kolegoms (pagal nutylėjimą: 125)</translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Atjungimo dėl netinkamo kolegų elgesio riba (pagal nutylėjimą: 100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Sekundžių kiekis eikiamas palaikyti ryšį dėl lygiarangių nestabilumo (pagal nutylėjimą: 86.400)</translation>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 9347 or testnet: 19347)</source>
<translation>Klausymas JSON-RPC sujungimui prijungčiai <port> (pagal nutylėjimą: 9347 or testnet: 19347)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Priimti komandinę eilutę ir JSON-RPC komandas</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Dirbti fone kaip šešėlyje ir priimti komandas</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>Naudoti testavimo tinklą</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=GlobalDenominationrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "GlobalDenomination Alert" admin@foo.com
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. GlobalDenomination is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Įspėjimas: -paytxfee yra nustatytas per didelis. Tai sandorio mokestis, kurį turėsite mokėti, jei siųsite sandorį.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong GlobalDenomination will not work properly.</source>
<translation>Įspėjimas: Patikrinkite, kad kompiuterio data ir laikas yra teisingi.Jei Jūsų laikrodis neteisingai nustatytas GlobalDenomination, veiks netinkamai.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation>Prisijungti tik prie nurodyto mazgo</translation>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation>Neteisingas tor adresas: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Maksimalus buferis priėmimo sujungimui <n>*1000 bitų (pagal nutylėjimą: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Maksimalus buferis siuntimo sujungimui <n>*1000 bitų (pagal nutylėjimą: 1000)</translation>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>Išvesti papildomą derinimo informaciją. Numanomi visi kiti -debug* parametrai</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation>Išvesti papildomą tinklo derinimo informaciją</translation>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation>Prideėti laiko žymę derinimo rezultatams</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the GlobalDenomination Wiki for SSL setup instructions)</source>
<translation>SSL opcijos (žr.e GlobalDenomination Wiki for SSL setup instructions)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Siųsti atsekimo/derinimo info į konsolę vietoj debug.log failo</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Siųsti sekimo/derinimo info derintojui</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Nustatyti sujungimo trukmę milisekundėmis (pagal nutylėjimą: 5000)</translation>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Bandymas naudoti UPnP struktūra klausymosi prievadui (default: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Bandymas naudoti UPnP struktūra klausymosi prievadui (default: 1 when listening)</translation>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>Vartotojo vardas JSON-RPC jungimuisi</translation>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation>Slaptažodis JSON-RPC sujungimams</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Leisti JSON-RPC tik iš nurodytų IP adresų</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Siųsti komandą mazgui dirbančiam <ip> (pagal nutylėjimą: 127.0.0.1)</translation>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>Atnaujinti piniginę į naujausią formatą</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Nustatyti rakto apimties dydį <n> (pagal nutylėjimą: 100)</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Ieškoti prarastų piniginės sandorių blokų grandinėje</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Naudoti OpenSSL (https) jungimuisi JSON-RPC </translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Serverio sertifikato failas (pagal nutylėjimą: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Serverio privatus raktas (pagal nutylėjimą: server.pem)</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Priimtini šifrai (pagal nutylėjimą: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>Pagelbos žinutė</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Nepavyko susieti šiame kompiuteryje prievado %s (bind returned error %d, %s)</translation>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation>Jungtis per socks tarpinį serverį</translation>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Leisti DNS paiešką sujungimui ir mazgo pridėjimui</translation>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>Užkraunami adresai...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation> wallet.dat pakrovimo klaida, wallet.dat sugadintas</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of GlobalDenomination</source>
<translation> wallet.dat pakrovimo klaida, wallet.dat reikalauja naujasnės GlobalDenomination versijos</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart GlobalDenomination to complete</source>
<translation>Piniginė turi būti prrašyta: įvykdymui perkraukite GlobalDenomination</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation> wallet.dat pakrovimo klaida</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Neteisingas proxy adresas: '%s'</translation>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Neteisinga suma -paytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>Neteisinga suma</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>Nepakanka lėšų</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>Įkeliamas blokų indeksas...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Pridėti mazgą prie sujungti su and attempt to keep the connection open</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. GlobalDenomination is probably already running.</source>
<translation>Nepavyko susieti šiame kompiuteryje prievado %s. GlobalDenomination tikriausiai jau veikia.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Įtraukti mokestį už kB siunčiamiems sandoriams</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>Užkraunama piniginė...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>Peržiūra</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>Įkėlimas baigtas</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>Klaida</translation>
</message>
<message>
<location line="-31"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation type="unfinished"/>
</message>
</context>
</TS>
|
GlobalDenomination/GDN
|
src/qt/locale/bitcoin_lt.ts
|
TypeScript
|
mit
| 109,292
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactIconBase = require('react-icon-base');
var _reactIconBase2 = _interopRequireDefault(_reactIconBase);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var IoIonic = function IoIonic(props) {
return _react2.default.createElement(
_reactIconBase2.default,
_extends({ viewBox: '0 0 40 40' }, props),
_react2.default.createElement(
'g',
null,
_react2.default.createElement('path', { d: 'm32.9 10.4c1.9 2.6 3.1 6 3.1 9.6 0 9-7.3 16.3-16.2 16.3s-16.3-7.3-16.3-16.3 7.3-16.2 16.3-16.2c3.5 0 6.9 1.1 9.6 3.1 0.4-0.3 0.8-0.4 1.4-0.4 1.4 0 2.5 1.1 2.5 2.5 0 0.5-0.2 1-0.4 1.4z m-2.5 20.2c1.4-1.4 2.4-2.9 3.2-4.7 0.8-1.9 1.2-3.9 1.2-5.9s-0.4-4-1.2-5.9c-0.5-1-1-2-1.7-2.9-0.3 0.1-0.7 0.3-1.1 0.3-1.4 0-2.5-1.1-2.5-2.5 0-0.4 0.1-0.9 0.3-1.2-1-0.6-2-1.2-3-1.6-1.9-0.8-3.8-1.2-5.8-1.2s-4 0.4-5.9 1.2c-1.8 0.8-3.4 1.8-4.8 3.2s-2.4 2.9-3.2 4.7c-0.8 1.9-1.1 3.9-1.1 5.9s0.3 4 1.1 5.9c0.8 1.8 1.8 3.3 3.2 4.7s3 2.4 4.8 3.2c1.9 0.8 3.8 1.2 5.9 1.2s3.9-0.4 5.8-1.2c1.8-0.8 3.4-1.8 4.8-3.2z m-18.1-10.6c0-5 2.5-7.5 7.5-7.5s7.5 2.5 7.5 7.5-2.5 7.5-7.5 7.5-7.5-2.5-7.5-7.5z' })
)
);
};
exports.default = IoIonic;
module.exports = exports['default'];
|
bengimbel/Solstice-React-Contacts-Project
|
node_modules/react-icons/lib/io/ionic.js
|
JavaScript
|
mit
| 1,682
|
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2014 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#include "OgreStableHeaders.h"
#include "Vao/OgreStagingBuffer.h"
#include "Vao/OgreVaoManager.h"
#include "OgreException.h"
#include "OgreStringConverter.h"
#include "OgreTimer.h"
namespace Ogre
{
StagingBuffer::StagingBuffer( size_t internalBufferStart, size_t sizeBytes,
VaoManager *vaoManager, bool uploadOnly ) :
mInternalBufferStart( internalBufferStart ),
mSizeBytes( sizeBytes ),
mUploadOnly( uploadOnly ),
mVaoManager( vaoManager ),
mMappingState( MS_UNMAPPED ),
mMappingStart( 0 ),
mMappingCount( 0 ),
mRefCount( 1 ),
mUnfenceTimeThreshold( vaoManager->getDefaultStagingBufferUnfencedTime() ),
mLifetimeThreshold( vaoManager->getDefaultStagingBufferLifetime() ),
mLastUsedTimestamp( vaoManager->getTimer()->getMilliseconds() )
{
if( !mUploadOnly )
mAvailableDownloadRegions.push_back( Fence( 0, mSizeBytes ) );
}
//-----------------------------------------------------------------------------------
StagingBuffer::~StagingBuffer()
{
}
//-----------------------------------------------------------------------------------
void StagingBuffer::mapChecks( size_t sizeBytes )
{
if( !sizeBytes )
{
OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS,
"StagingBuffer cannot map 0 bytes",
"StagingBuffer::mapChecks" );
}
if( sizeBytes > mSizeBytes )
{
OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS,
"StagingBuffer (" + StringConverter::toString( mSizeBytes ) +
" bytes) is smaller than the mapping request (" +
StringConverter::toString( sizeBytes ) + ")",
"StagingBuffer::mapChecks" );
}
if( mMappingState != MS_UNMAPPED )
{
OGRE_EXCEPT( Exception::ERR_INVALID_STATE,
"StagingBuffer is already mapped. You can't"
" call this function while it's mapped",
"StagingBuffer::mapChecks" );
}
}
//-----------------------------------------------------------------------------------
StagingStallType StagingBuffer::uploadWillStall( size_t sizeBytes )
{
assert( mUploadOnly );
return STALL_PARTIAL;
}
//-----------------------------------------------------------------------------------
void* StagingBuffer::map( size_t sizeBytes )
{
assert( mUploadOnly );
if( mMappingState != MS_UNMAPPED )
{
OGRE_EXCEPT( Exception::ERR_INVALID_STATE, "Buffer already mapped!",
"StagingBuffer::map" );
}
mapChecks( sizeBytes );
mMappingState = MS_MAPPED;
return mapImpl( sizeBytes );
}
//-----------------------------------------------------------------------------------
void StagingBuffer::unmap( const Destination *destinations, size_t numDestinations )
{
if( mMappingState != MS_MAPPED )
{
OGRE_EXCEPT( Exception::ERR_INVALID_STATE, "Unmapping an unmapped buffer!",
"StagingBuffer::unmap" );
}
assert( ( (!mUploadOnly && !destinations && !numDestinations) ||
(mUploadOnly && destinations && numDestinations) ) &&
"Using an upload staging-buffer for downloads or vice-versa." );
unmapImpl( destinations, numDestinations );
mMappingState = MS_UNMAPPED;
mMappingStart += mMappingCount;
if( mMappingStart >= mSizeBytes )
mMappingStart = 0;
}
//-----------------------------------------------------------------------------------
void StagingBuffer::addReferenceCount(void)
{
++mRefCount;
if( mRefCount == 1 )
mVaoManager->_notifyStagingBufferLeftZeroRef( this );
}
//-----------------------------------------------------------------------------------
void StagingBuffer::removeReferenceCount(void)
{
Timer *timer = mVaoManager->getTimer();
--mRefCount;
assert( mRefCount >= 0 );
mLastUsedTimestamp = timer->getMilliseconds();
if( mRefCount == 0 )
mVaoManager->_notifyStagingBufferEnteredZeroRef( this );
}
//-----------------------------------------------------------------------------------
//
// DOWNLOADS
//
//-----------------------------------------------------------------------------------
bool StagingBuffer::canDownload( size_t length ) const
{
assert( !mUploadOnly );
FenceVec::const_iterator itor = mAvailableDownloadRegions.begin();
FenceVec::const_iterator end = mAvailableDownloadRegions.end();
while( itor != end && length > itor->length() )
++itor;
return itor != end;
}
//-----------------------------------------------------------------------------------
void StagingBuffer::_cancelDownload( size_t offset, size_t sizeBytes )
{
//Put the mapped region back to our records as "available" for subsequent _asyncDownload
Fence mappedArea( offset, offset + sizeBytes );
#if OGRE_DEBUG_MODE
FenceVec::const_iterator itor = mAvailableDownloadRegions.begin();
FenceVec::const_iterator end = mAvailableDownloadRegions.end();
while( itor != end )
{
assert( !itor->overlaps( mappedArea ) &&
"Already called _mapForReadImpl on this area (or part of it!) before!" );
++itor;
}
#endif
mAvailableDownloadRegions.push_back( mappedArea );
mergeContiguousBlocks( mAvailableDownloadRegions.end() - 1, mAvailableDownloadRegions );
}
//-----------------------------------------------------------------------------------
const void* StagingBuffer::_mapForRead( size_t offset, size_t sizeBytes )
{
assert( !mUploadOnly );
if( mMappingState != MS_UNMAPPED )
{
OGRE_EXCEPT( Exception::ERR_INVALID_STATE, "Buffer already mapped!",
"StagingBuffer::_mapForRead" );
}
mMappingState = MS_MAPPED;
return _mapForReadImpl( offset, sizeBytes );
}
//-----------------------------------------------------------------------------------
size_t StagingBuffer::getFreeDownloadRegion( size_t length )
{
//Grab the smallest region that fits the request.
size_t lowestLength = std::numeric_limits<size_t>::max();
FenceVec::iterator itor = mAvailableDownloadRegions.begin();
FenceVec::iterator end = mAvailableDownloadRegions.end();
FenceVec::iterator itLowest = end;
while( itor != end )
{
size_t freeRegionLength = itor->length();
if( length <= freeRegionLength && freeRegionLength < lowestLength )
{
itLowest = itor;
lowestLength = freeRegionLength;
}
++itor;
}
size_t retVal = -1;
if( itLowest != end )
{
//Got a region! Shrink our records
retVal = itLowest->start;
itLowest->start += length;
//This region is empty. Remove it.
if( itLowest->start == itLowest->end )
efficientVectorRemove( mAvailableDownloadRegions, itLowest );
}
return retVal;
}
//-----------------------------------------------------------------------------------
void StagingBuffer::mergeContiguousBlocks( FenceVec::iterator blockToMerge, FenceVec &blocks )
{
FenceVec::iterator itor = blocks.begin();
FenceVec::iterator end = blocks.end();
while( itor != end )
{
if( itor->end == blockToMerge->start )
{
itor->end = blockToMerge->end;
size_t idx = itor - blocks.begin();
//When blockToMerge is the last one, its index won't be the same
//after removing the other iterator, they will swap.
if( idx == blocks.size() - 1 )
idx = blockToMerge - blocks.begin();
efficientVectorRemove( blocks, blockToMerge );
blockToMerge = blocks.begin() + idx;
itor = blocks.begin();
end = blocks.end();
}
else if( blockToMerge->end == itor->start )
{
blockToMerge->end = itor->end;
size_t idx = blockToMerge - blocks.begin();
//When blockToMerge is the last one, its index won't be the same
//after removing the other iterator, they will swap.
if( idx == blocks.size() - 1 )
idx = itor - blocks.begin();
efficientVectorRemove( blocks, itor );
blockToMerge = blocks.begin() + idx;
itor = blocks.begin();
end = blocks.end();
}
else
{
++itor;
}
}
}
}
|
devxkh/FrankE
|
src/Ogre/OgreMain/src/Vao/OgreStagingBuffer.cpp
|
C++
|
mit
| 10,592
|
$(function () {
if (!Modernizr.json) {
alert('Navegador muy antiguo, por favor actualícelo');
window.location = "http://whatbrowser.org/"
}
});
|
jorgelive/Vweb
|
web/js/d55c167_part_1_20_oldBrowser_11.js
|
JavaScript
|
mit
| 169
|
<div style="text-align: center; padding-bottom: 30px;">収録日: 2017/04/16</div><br>
[CoderDojo 西宮・梅田](http://coderdojo-nishinomiya.info/)のチャンピオンであり、一般社団法人 [CoderDojo Japan](https://coderdojo.jp/) の理事であり、[DojoCon Japan 2016](http://dojocon2016.coderdojo.jp/) と [DojoCon Japan 2017](http://dojocon2017.coderdojo.jp/) の実行委員長である細谷崇さん ([@tkc49](https://twitter.com/tkc49)) と一緒に、DojoCon Japan についてお話ししました。
<br>
## 📝 Shownote − 話したこと
- [CoderDojo 西宮・梅田](http://coderdojo-nishinomiya.info/)
- [DojoCon Japan 2016](http://dojocon2016.coderdojo.jp/)
- [DojoCon Japan 2017](http://dojocon2017.coderdojo.jp/)
|
coderdojo-japan/coderdojo.jp
|
public/podcasts/4.md
|
Markdown
|
mit
| 751
|
var baseDifference = require('../internal/baseDifference'),
baseFlatten = require('../internal/baseFlatten'),
isArguments = require('../lang/isArguments'),
isArray = require('../lang/isArray'),
restParam = require('../function/restParam');
/**
* Creates an array excluding all values of the provided arrays using
* `SameValueZero` for equality comparisons.
*
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
* comparisons are like strict equality comparisons, e.g. `===`, except that
* `NaN` matches `NaN`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The arrays of values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.difference([1, 2, 3], [4, 2]);
* // => [1, 3]
*/
var difference = restParam(function(array, values) {
return (isArray(array) || isArguments(array))
? baseDifference(array, baseFlatten(values, false, true))
: [];
});
module.exports = difference;
|
Moccine/global-service-plus.com
|
web/libariries/bootstrap/node_modules/jshint/node_modules/lodash/array/difference.js
|
JavaScript
|
mit
| 1,113
|
<?php
/**
* Methods for getting information about short phone numbers, such as short codes and emergency
* numbers. Note that most commercial short numbers are not handled here, but by the
* {@link PhoneNumberUtil}.
*
* @author Shaopeng Jia
* @author David Yonge-Mallo
* @since 5.8
*/
namespace libphonenumber;
class ShortNumberInfo
{
const META_DATA_FILE_PREFIX = 'ShortNumberMetadata';
/**
* @var ShortNumberInfo
*/
protected static $instance = null;
/**
* @var MatcherAPIInterface
*/
protected $matcherAPI;
protected $currentFilePrefix;
protected $regionToMetadataMap = array();
protected $countryCallingCodeToRegionCodeMap = array();
protected $countryCodeToNonGeographicalMetadataMap = array();
protected static $regionsWhereEmergencyNumbersMustBeExact = array(
'BR',
'CL',
'NI',
);
protected function __construct(MatcherAPIInterface $matcherAPI)
{
$this->matcherAPI = $matcherAPI;
// TODO: Create ShortNumberInfo for a given map
$this->countryCallingCodeToRegionCodeMap = CountryCodeToRegionCodeMap::$countryCodeToRegionCodeMap;
$this->currentFilePrefix = dirname(__FILE__) . '/data/' . static::META_DATA_FILE_PREFIX;
// Initialise PhoneNumberUtil to make sure regex's are setup correctly
PhoneNumberUtil::getInstance();
}
/**
* Returns the singleton instance of ShortNumberInfo
*
* @return \libphonenumber\ShortNumberInfo
*/
public static function getInstance()
{
if (null === static::$instance) {
static::$instance = new self(RegexBasedMatcher::create());
}
return static::$instance;
}
public static function resetInstance()
{
static::$instance = null;
}
/**
* Returns a list with teh region codes that match the specific country calling code. For
* non-geographical country calling codes, the region code 001 is returned. Also, in the case
* of no region code being found, an empty list is returned.
*
* @param int $countryCallingCode
* @return array
*/
protected function getRegionCodesForCountryCode($countryCallingCode)
{
if (!array_key_exists($countryCallingCode, $this->countryCallingCodeToRegionCodeMap)) {
$regionCodes = null;
} else {
$regionCodes = $this->countryCallingCodeToRegionCodeMap[$countryCallingCode];
}
return ($regionCodes === null) ? array() : $regionCodes;
}
/**
* Helper method to check that the country calling code of the number matches the region it's
* being dialed from.
* @param PhoneNumber $number
* @param string $regionDialingFrom
* @return bool
*/
protected function regionDialingFromMatchesNumber(PhoneNumber $number, $regionDialingFrom)
{
$regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode());
return in_array($regionDialingFrom, $regionCodes);
}
public function getSupportedRegions()
{
return ShortNumbersRegionCodeSet::$shortNumbersRegionCodeSet;
}
/**
* Gets a valid short number for the specified region.
*
* @param $regionCode String the region for which an example short number is needed
* @return string a valid short number for the specified region. Returns an empty string when the
* metadata does not contain such information.
*/
public function getExampleShortNumber($regionCode)
{
$phoneMetadata = $this->getMetadataForRegion($regionCode);
if ($phoneMetadata === null) {
return "";
}
/** @var PhoneNumberDesc $desc */
$desc = $phoneMetadata->getShortCode();
if ($desc !== null && $desc->hasExampleNumber()) {
return $desc->getExampleNumber();
}
return "";
}
/**
* @param $regionCode
* @return PhoneMetadata|null
*/
public function getMetadataForRegion($regionCode)
{
if (!in_array($regionCode, ShortNumbersRegionCodeSet::$shortNumbersRegionCodeSet)) {
return null;
}
if (!isset($this->regionToMetadataMap[$regionCode])) {
// The regionCode here will be valid and won't be '001', so we don't need to worry about
// what to pass in for the country calling code.
$this->loadMetadataFromFile($this->currentFilePrefix, $regionCode, 0);
}
return isset($this->regionToMetadataMap[$regionCode]) ? $this->regionToMetadataMap[$regionCode] : null;
}
protected function loadMetadataFromFile($filePrefix, $regionCode, $countryCallingCode)
{
$isNonGeoRegion = PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY === $regionCode;
$fileName = $filePrefix . '_' . ($isNonGeoRegion ? $countryCallingCode : $regionCode) . '.php';
if (!is_readable($fileName)) {
throw new \Exception('missing metadata: ' . $fileName);
}
$metadataLoader = new DefaultMetadataLoader();
$data = $metadataLoader->loadMetadata($fileName);
$metadata = new PhoneMetadata();
$metadata->fromArray($data);
if ($isNonGeoRegion) {
$this->countryCodeToNonGeographicalMetadataMap[$countryCallingCode] = $metadata;
} else {
$this->regionToMetadataMap[$regionCode] = $metadata;
}
}
/**
* Gets a valid short number for the specified cost category.
*
* @param string $regionCode the region for which an example short number is needed
* @param int $cost the cost category of number that is needed
* @return string a valid short number for the specified region and cost category. Returns an empty string
* when the metadata does not contain such information, or the cost is UNKNOWN_COST.
*/
public function getExampleShortNumberForCost($regionCode, $cost)
{
$phoneMetadata = $this->getMetadataForRegion($regionCode);
if ($phoneMetadata === null) {
return "";
}
/** @var PhoneNumberDesc $desc */
$desc = null;
switch ($cost) {
case ShortNumberCost::TOLL_FREE:
$desc = $phoneMetadata->getTollFree();
break;
case ShortNumberCost::STANDARD_RATE:
$desc = $phoneMetadata->getStandardRate();
break;
case ShortNumberCost::PREMIUM_RATE:
$desc = $phoneMetadata->getPremiumRate();
break;
default:
// UNKNOWN_COST numbers are computed by the process of elimination from the other cost categories
break;
}
if ($desc !== null && $desc->hasExampleNumber()) {
return $desc->getExampleNumber();
}
return "";
}
/**
* Returns true if the given number, exactly as dialed, might be used to connect to an emergency
* service in the given region.
* <p>
* This method accepts a string, rather than a PhoneNumber, because it needs to distinguish
* cases such as "+1 911" and "911", where the former may not connect to an emergency service in
* all cases but the latter would. This method takes into account cases where the number might
* contain formatting, or might have additional digits appended (when it is okay to do that in
* the specified region).
*
* @param string $number the phone number to test
* @param string $regionCode the region where the phone number if being dialled
* @return boolean whether the number might be used to connect to an emergency service in the given region
*/
public function connectsToEmergencyNumber($number, $regionCode)
{
return $this->matchesEmergencyNumberHelper($number, $regionCode, true /* allows prefix match */);
}
/**
* @param string $number
* @param string $regionCode
* @param bool $allowPrefixMatch
* @return bool
*/
protected function matchesEmergencyNumberHelper($number, $regionCode, $allowPrefixMatch)
{
$number = PhoneNumberUtil::extractPossibleNumber($number);
$matcher = new Matcher(PhoneNumberUtil::$PLUS_CHARS_PATTERN, $number);
if ($matcher->lookingAt()) {
// Returns false if the number starts with a plus sign. We don't believe dialing the country
// code before emergency numbers (e.g. +1911) works, but later, if that proves to work, we can
// add additional logic here to handle it.
return false;
}
$metadata = $this->getMetadataForRegion($regionCode);
if ($metadata === null || !$metadata->hasEmergency()) {
return false;
}
$normalizedNumber = PhoneNumberUtil::normalizeDigitsOnly($number);
$emergencyDesc = $metadata->getEmergency();
$allowPrefixMatchForRegion = ($allowPrefixMatch
&& !in_array($regionCode, static::$regionsWhereEmergencyNumbersMustBeExact)
);
return $this->matcherAPI->matchesNationalNumber($normalizedNumber, $emergencyDesc, $allowPrefixMatchForRegion);
}
/**
* Given a valid short number, determines whether it is carrier-specific (however, nothing is
* implied about its validity). Carrier-specific numbers may connect to a different end-point, or
* not connect at all, depending on the user's carrier. If it is important that the number is
* valid, then its validity must first be checked using {@link #isValidShortNumber} or
* {@link #isValidShortNumberForRegion}.
*
* @param PhoneNumber $number the valid short number to check
* @return boolean whether the short number is carrier-specific (assuming the input was a valid short
* number).
*/
public function isCarrierSpecific(PhoneNumber $number)
{
$regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode());
$regionCode = $this->getRegionCodeForShortNumberFromRegionList($number, $regionCodes);
$nationalNumber = $this->getNationalSignificantNumber($number);
$phoneMetadata = $this->getMetadataForRegion($regionCode);
return ($phoneMetadata !== null) && ($this->matchesPossibleNumberAndNationalNumber(
$nationalNumber,
$phoneMetadata->getCarrierSpecific()
));
}
/**
* Given a valid short number, determines whether it is carrier-specific when dialed from the
* given region (however, nothing is implied about its validity). Carrier-specific numbers may
* connect to a different end-point, or not connect at all, depending on the user's carrier. If
* it is important that the number is valid, then its validity must first be checked using
* {@link #isValidShortNumber} or {@link #isValidShortNumberForRegion}. Returns false if the
* number doesn't match the region provided.
* @param PhoneNumber $number The valid short number to check
* @param string $regionDialingFrom The region from which the number is dialed
* @return bool Whether the short number is carrier-specific (Assuming the input was a valid short
* number)
*/
public function isCarrierSpecificForRegion(PhoneNumber $number, $regionDialingFrom)
{
if (!$this->regionDialingFromMatchesNumber($number, $regionDialingFrom)) {
return false;
}
$nationalNumber = $this->getNationalSignificantNumber($number);
$phoneMetadata = $this->getMetadataForRegion($regionDialingFrom);
return ($phoneMetadata !== null)
&& ($this->matchesPossibleNumberAndNationalNumber($nationalNumber, $phoneMetadata->getCarrierSpecific()));
}
/**
* Helper method to get the region code for a given phone number, from a list of possible region
* codes. If the list contains more than one region, the first region for which the number is
* valid is returned.
*
* @param PhoneNumber $number
* @param $regionCodes
* @return String|null Region Code (or null if none are found)
*/
protected function getRegionCodeForShortNumberFromRegionList(PhoneNumber $number, $regionCodes)
{
if (count($regionCodes) == 0) {
return null;
} elseif (count($regionCodes) == 1) {
return $regionCodes[0];
}
$nationalNumber = $this->getNationalSignificantNumber($number);
foreach ($regionCodes as $regionCode) {
$phoneMetadata = $this->getMetadataForRegion($regionCode);
if ($phoneMetadata !== null
&& $this->matchesPossibleNumberAndNationalNumber($nationalNumber, $phoneMetadata->getShortCode())
) {
// The number is valid for this region.
return $regionCode;
}
}
return null;
}
/**
* Check whether a short number is a possible number. If a country calling code is shared by
* multiple regions, this returns true if it's possible in any of them. This provides a more
* lenient check than {@link #isValidShortNumber}. See {@link
* #IsPossibleShortNumberForRegion(PhoneNumber, String)} for details.
*
* @param $number PhoneNumber the short number to check
* @return boolean whether the number is a possible short number
*/
public function isPossibleShortNumber(PhoneNumber $number)
{
$regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode());
$shortNumberLength = strlen($this->getNationalSignificantNumber($number));
foreach ($regionCodes as $region) {
$phoneMetadata = $this->getMetadataForRegion($region);
if ($phoneMetadata === null) {
continue;
}
if (in_array($shortNumberLength, $phoneMetadata->getGeneralDesc()->getPossibleLength())) {
return true;
}
}
return false;
}
/**
* Check whether a short number is a possible number when dialled from a region, given the number
* in the form of a string, and the region where the number is dialled from. This provides a more
* lenient check than {@link #isValidShortNumber}.
*
* @param PhoneNumber $shortNumber The short number to check
* @param string $regionDialingFrom Region dialing From
* @return boolean whether the number is a possible short number
*/
public function isPossibleShortNumberForRegion(PhoneNumber $shortNumber, $regionDialingFrom)
{
if (!$this->regionDialingFromMatchesNumber($shortNumber, $regionDialingFrom)) {
return false;
}
$phoneMetadata = $this->getMetadataForRegion($regionDialingFrom);
if ($phoneMetadata === null) {
return false;
}
$numberLength = strlen($this->getNationalSignificantNumber($shortNumber));
return in_array($numberLength, $phoneMetadata->getGeneralDesc()->getPossibleLength());
}
/**
* Tests whether a short number matches a valid pattern. If a country calling code is shared by
* multiple regions, this returns true if it's valid in any of them. Note that this doesn't verify
* the number is actually in use, which is impossible to tell by just looking at the number
* itself. See {@link #isValidShortNumberForRegion(PhoneNumber, String)} for details.
*
* @param $number PhoneNumber the short number for which we want to test the validity
* @return boolean whether the short number matches a valid pattern
*/
public function isValidShortNumber(PhoneNumber $number)
{
$regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode());
$regionCode = $this->getRegionCodeForShortNumberFromRegionList($number, $regionCodes);
if (count($regionCodes) > 1 && $regionCode !== null) {
// If a matching region had been found for the phone number from among two or more regions,
// then we have already implicitly verified its validity for that region.
return true;
}
return $this->isValidShortNumberForRegion($number, $regionCode);
}
/**
* Tests whether a short number matches a valid pattern in a region. Note that this doesn't verify
* the number is actually in use, which is impossible to tell by just looking at the number
* itself.
*
* @param PhoneNumber $number The Short number for which we want to test the validity
* @param string $regionDialingFrom the region from which the number is dialed
* @return boolean whether the short number matches a valid pattern
*/
public function isValidShortNumberForRegion(PhoneNumber $number, $regionDialingFrom)
{
if (!$this->regionDialingFromMatchesNumber($number, $regionDialingFrom)) {
return false;
}
$phoneMetadata = $this->getMetadataForRegion($regionDialingFrom);
if ($phoneMetadata === null) {
return false;
}
$shortNumber = $this->getNationalSignificantNumber($number);
$generalDesc = $phoneMetadata->getGeneralDesc();
if (!$this->matchesPossibleNumberAndNationalNumber($shortNumber, $generalDesc)) {
return false;
}
$shortNumberDesc = $phoneMetadata->getShortCode();
return $this->matchesPossibleNumberAndNationalNumber($shortNumber, $shortNumberDesc);
}
/**
* Gets the expected cost category of a short number when dialled from a region (however, nothing is
* implied about its validity). If it is important that the number is valid, then its validity
* must first be checked using {@link isValidShortNumberForRegion}. Note that emergency numbers
* are always considered toll-free.
* Example usage:
* <pre>{@code
* $shortInfo = ShortNumberInfo::getInstance();
* $shortNumber = PhoneNumberUtil::parse("110", "US);
* $regionCode = "FR";
* if ($shortInfo->isValidShortNumberForRegion($shortNumber, $regionCode)) {
* $cost = $shortInfo->getExpectedCostForRegion($shortNumber, $regionCode);
* // Do something with the cost information here.
* }}</pre>
*
* @param PhoneNumber $number the short number for which we want to know the expected cost category,
* as a string
* @param string $regionDialingFrom the region from which the number is dialed
* @return int the expected cost category for that region of the short number. Returns UNKNOWN_COST if
* the number does not match a cost category. Note that an invalid number may match any cost
* category.
*/
public function getExpectedCostForRegion(PhoneNumber $number, $regionDialingFrom)
{
if (!$this->regionDialingFromMatchesNumber($number, $regionDialingFrom)) {
return ShortNumberCost::UNKNOWN_COST;
}
// Note that regionDialingFrom may be null, in which case phoneMetadata will also be null.
$phoneMetadata = $this->getMetadataForRegion($regionDialingFrom);
if ($phoneMetadata === null) {
return ShortNumberCost::UNKNOWN_COST;
}
$shortNumber = $this->getNationalSignificantNumber($number);
// The possible lengths are not present for a particular sub-type if they match the general
// description; for this reason, we check the possible lengths against the general description
// first to allow an early exit if possible.
if (!in_array(strlen($shortNumber), $phoneMetadata->getGeneralDesc()->getPossibleLength())) {
return ShortNumberCost::UNKNOWN_COST;
}
// The cost categories are tested in order of decreasing expense, since if for some reason the
// patterns overlap the most expensive matching cost category should be returned.
if ($this->matchesPossibleNumberAndNationalNumber($shortNumber, $phoneMetadata->getPremiumRate())) {
return ShortNumberCost::PREMIUM_RATE;
}
if ($this->matchesPossibleNumberAndNationalNumber($shortNumber, $phoneMetadata->getStandardRate())) {
return ShortNumberCost::STANDARD_RATE;
}
if ($this->matchesPossibleNumberAndNationalNumber($shortNumber, $phoneMetadata->getTollFree())) {
return ShortNumberCost::TOLL_FREE;
}
if ($this->isEmergencyNumber($shortNumber, $regionDialingFrom)) {
// Emergency numbers are implicitly toll-free.
return ShortNumberCost::TOLL_FREE;
}
return ShortNumberCost::UNKNOWN_COST;
}
/**
* Gets the expected cost category of a short number (however, nothing is implied about its
* validity). If the country calling code is unique to a region, this method behaves exactly the
* same as {@link #getExpectedCostForRegion(PhoneNumber, String)}. However, if the country calling
* code is shared by multiple regions, then it returns the highest cost in the sequence
* PREMIUM_RATE, UNKNOWN_COST, STANDARD_RATE, TOLL_FREE. The reason for the position of
* UNKNOWN_COST in this order is that if a number is UNKNOWN_COST in one region but STANDARD_RATE
* or TOLL_FREE in another, its expected cost cannot be estimated as one of the latter since it
* might be a PREMIUM_RATE number.
*
* <p>
* For example, if a number is STANDARD_RATE in the US, but TOLL_FREE in Canada, the expected
* cost returned by this method will be STANDARD_RATE, since the NANPA countries share the same
* country calling code.
* </p>
*
* Note: If the region from which the number is dialed is known, it is highly preferable to call
* {@link #getExpectedCostForRegion(PhoneNumber, String)} instead.
*
* @param PhoneNumber $number the short number for which we want to know the expected cost category
* @return int the highest expected cost category of the short number in the region(s) with the given
* country calling code
*/
public function getExpectedCost(PhoneNumber $number)
{
$regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode());
if (count($regionCodes) == 0) {
return ShortNumberCost::UNKNOWN_COST;
}
if (count($regionCodes) == 1) {
return $this->getExpectedCostForRegion($number, $regionCodes[0]);
}
$cost = ShortNumberCost::TOLL_FREE;
foreach ($regionCodes as $regionCode) {
$costForRegion = $this->getExpectedCostForRegion($number, $regionCode);
switch ($costForRegion) {
case ShortNumberCost::PREMIUM_RATE:
return ShortNumberCost::PREMIUM_RATE;
case ShortNumberCost::UNKNOWN_COST:
$cost = ShortNumberCost::UNKNOWN_COST;
break;
case ShortNumberCost::STANDARD_RATE:
if ($cost != ShortNumberCost::UNKNOWN_COST) {
$cost = ShortNumberCost::STANDARD_RATE;
}
break;
case ShortNumberCost::TOLL_FREE:
// Do nothing
break;
}
}
return $cost;
}
/**
* Returns true if the given number exactly matches an emergency service number in the given
* region.
* <p>
* This method takes into account cases where the number might contain formatting, but doesn't
* allow additional digits to be appended. Note that {@code isEmergencyNumber(number, region)}
* implies {@code connectsToEmergencyNumber(number, region)}.
*
* @param string $number the phone number to test
* @param string $regionCode the region where the phone number is being dialled
* @return boolean whether the number exactly matches an emergency services number in the given region
*/
public function isEmergencyNumber($number, $regionCode)
{
return $this->matchesEmergencyNumberHelper($number, $regionCode, false /* doesn't allow prefix match */);
}
/**
* Gets the national significant number of the a phone number. Note a national significant number
* doesn't contain a national prefix or any formatting.
* <p>
* This is a temporary duplicate of the {@code getNationalSignificantNumber} method from
* {@code PhoneNumberUtil}. Ultimately a canonical static version should exist in a separate
* utility class (to prevent {@code ShortNumberInfo} needing to depend on PhoneNumberUtil).
*
* @param PhoneNumber $number the phone number for which the national significant number is needed
* @return string the national significant number of the PhoneNumber object passed in
*/
protected function getNationalSignificantNumber(PhoneNumber $number)
{
// If leading zero(s) have been set, we prefix this now. Note this is not a national prefix.
$nationalNumber = '';
if ($number->isItalianLeadingZero()) {
$zeros = str_repeat('0', $number->getNumberOfLeadingZeros());
$nationalNumber .= $zeros;
}
$nationalNumber .= $number->getNationalNumber();
return $nationalNumber;
}
/**
* TODO: Once we have benchmarked ShortnumberInfo, consider if it is worth keeping
* this performance optimization.
* @param string $number
* @param PhoneNumberDesc $numberDesc
* @return bool
*/
protected function matchesPossibleNumberAndNationalNumber($number, PhoneNumberDesc $numberDesc)
{
if (count($numberDesc->getPossibleLength()) > 0 && !in_array(strlen($number), $numberDesc->getPossibleLength())) {
return false;
}
return $this->matcherAPI->matchesNationalNumber($number, $numberDesc, false);
}
}
|
42php/42php
|
vendor/libphonenumber/ShortNumberInfo.php
|
PHP
|
mit
| 25,968
|
// class HandleDeleteApplication {
// constructor() {
// this.ui = {};
//
// this.applications_page = $('div#third_party_applications_page');
//
// //Delete aplication modal
// this.modal_delete_application = $('div#delete_application_modal');
// this.button_delete_application = $(
// 'button#delete_application',
// this.applications_page
// );
// this.form_delete_application = $(
// 'form#delete_application_form',
// this.modal_delete_application
// );
// }
// }
|
ging/fiware-idm
|
public/javascripts/users/handle_delete_application.js
|
JavaScript
|
mit
| 528
|
var block = {
"tags":["video-tag"],
"videos":["https:\/\/www.youtube.com\/v\/YigKNDHhjTA?version=3&f=videos&app=youtube_gdata"],
"liked":false,
"notebooks":["47307eb6-cd32-4544-9677-1ba276b54dd3"],
"image":"https:\/\/i1.ytimg.com\/vi\/YigKNDHhjTA\/0.jpg",
"type":"Video",
"url":"https:\/\/www.youtube.com\/watch?v=YigKNDHhjTA&feature=youtube_gdata_player",
"modified":"2014-05-19T14:08:05+0000",
"created":"2014-05-19T14:07:57+0000",
"complete":false,
"description":"FREE Download: http:\/\/www.mediafire.com\/?oj4x2qokmsner8u\n\nCover \/ Remix of \"All of the Lights\" (originally by Kanye West) performed by The Northern Lights. The Northern Lights is: Kyle Lampert, producer; Riki Lavi, vocalist; and MCs Jahizzi and Sheck, also of Divine Rhyme.\n\nOur 2010 album on iTunes:\nhttp:\/\/itunes.apple.com\/us\/album\/journey-through-your-minds\/id353700260\n\nFree ALBUM downloads from The Northern Lights and Divine Rhyme available at\nhttp:\/\/www.TheNorthernLights.bandcamp.com\nhttp:\/\/www.DivineRhyme.bandcamp.com\n\nFollow us on Facebook: http:\/\/www.facebook.com\/TNLexperience",
"name":"All of the Lights - kanye west cover (by The Northern Lights)",
"uuid":"473d3867-e3b6-4fc4-8f51-fa27aab65c28",
"rating":0.0,
"public":true,
"comments":[
{
"commenter":"klmprt",
"date":"2014-05-19T14:07:58+0000",
"comment":"VIdeo comment"
}]
};
|
springpartners/springpad-export
|
Example_Springpad_Export/viewer_data/blocks/473d3867-e3b6-4fc4-8f51-fa27aab65c28.js
|
JavaScript
|
mit
| 1,360
|
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2010 Tampere University of Technology
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import httplib
import urllib
import socket
class ToolProtocolHTTP(object):
"""
HTTP/HTTPS client for TEMA MBT protocol. Discusses with the TEMA test engine.
"""
# is client connected to the server
isConnected = False
def __init__(self):
self.host = "localhost"
self.port = 80
self.php_file = "temagui_http_proxy.php"
socket.setdefaulttimeout(1800)
def __del__(self):
if self.isConnected:
http_params = urllib.urlencode({"User" : self.username, "Message" : 'CLOSE', "Parameter" : 'Empty'})
http_data = self.__requestreply(http_params)
def __requestreply(self,message ):
""" One http(s) request/reply.
Message: Message to send string.
Returns: Reply string.
"""
http_data = ''
try:
http_connection = None
if self.protocol == "HTTP":
http_connection = httplib.HTTPConnection(self.host, self.port)
elif self.protocol == "HTTPS":
http_connection = httplib.HTTPSConnection(self.host, self.port)
else:
return ''
http_connection.connect()
http_connection.request("POST", self.php_file, message , self.http_headers)
http_response = http_connection.getresponse()
http_data = http_response.read()
http_response.close()
http_connection.close()
except Exception, e:
http_data = ''
return http_data
def init(self, host, path, port, username, protocol):
""" Initialises connection. Sends HELO.
host: Server hostname.
path: path to http proxy in server.
port: port
username: wwwgui username
protocol: http/https
returns: Reply to ACK. On error returns ''
"""
self.http_headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
self.host = host
self.php_file = "/".join(["",path,"temagui_http_proxy.php"])
self.port = port
self.username = username
self.protocol = protocol.upper()
try:
# SEND HELO
http_params = urllib.urlencode({"User" : username, "Message" : 'HELO', "Parameter" : 'Empty'})
http_data = self.__requestreply(http_params)
self.isConnected = True
lines = http_data.splitlines()
if lines != []:
message = lines.pop()
if message == "CLOSE":
http_data = ''
self.isConnected = False
except Exception, e:
self.isConnected = False
return ''
return http_data
def getKeyword(self):
""" Gets keyword from testserver.
Sends GET to testserver and waits for reply.
Returns: Reply to GET. On error return ''
"""
http_data = ''
try:
http_params = urllib.urlencode({"User" : self.username, "Message" : 'GET', "Parameter" : 'Empty'})
http_data = self.__requestreply(http_params)
lines = http_data.splitlines()
if lines != []:
message = lines.pop()
if message == "CLOSE":
self.isConnected = False
return 'ERROR'
if message == 'ERR':
# TODO: don't send ack.
http_data = self.__requestreply(http_params)
http_params = urllib.urlencode({"User" : self.username, "Message" : 'ACK', "Parameter" : 'Empty'})
http_data = self.__requestreply(http_params)
self.isConnected = False
return 'ERROR'
if not http_data.startswith("ACK"):
print http_data
return "ERROR"
else:
#http_data = http_data.partition("ACK")[2].strip()
http_data = http_data.split("ACK")[1].strip()
if http_data == '' or http_data == None:
http_data = ''
self.isConnected = False
except Exception, e:
self.isConnected = False
return http_data
def putResult(self, result):
""" Puts result to testserver.
result: True/False
returns: Reply message to PUT
"""
try:
if result:
http_params = urllib.urlencode({"User" : self.username, "Message" : 'PUT', "Parameter" : 'true'})
else:
http_params = urllib.urlencode({"User" : self.username, "Message" : 'PUT', "Parameter" : 'false'})
except Exception, e:
self.isConnected = False
return ''
try:
http_data = self.__requestreply(http_params)
lines = http_data.splitlines()
if lines != []:
message = lines.pop()
if message == "CLOSE":
self.isConnected = False
return ''
if http_data == '':
self.isConnected = False
except Exception, e:
self.isConnected = False
http_data = ''
return http_data
def log(self, msg):
""" Sends log message to testserver
returns: Reply to message.
"""
http_data = ''
try:
http_params = urllib.urlencode({"User" : self.username, "Message" : 'LOG', "Parameter" : msg })
http_data = self.__requestreply(http_params)
lines = http_data.splitlines()
if lines != []:
message = lines.pop()
if message == "CLOSE":
self.isConnected = False
return ''
if http_data == '':
self.isConnected = False
except Exception, e:
self.isConnected = False
http_data = ''
return http_data
def bye(self):
""" Sends message BYE to testserver. """
http_data = ''
try:
http_params = urllib.urlencode({"User" : self.username, "Message" : 'BYE', "Parameter" : 'None'})
http_data = self.__requestreply(http_params)
self.isConnected = False
except Exception, e:
self.isConnected = False
return ''
def hasConnection(self):
return self.isConnected
if __name__ == "__main__":
c = ToolProtocol()
print "init -> " + c.init()
print "getKeyword -> " + c.getKeyword()
print "putResult -> " + c.putResult(True)
print "getKeyword -> " + c.getKeyword()
print "putResult -> " + c.putResult(False)
print "invalid -> " + c.invalid()
print "bye -> " + c.bye()
|
tema-mbt/tema-adapterlib
|
adapterlib/ToolProtocolHTTP.py
|
Python
|
mit
| 8,508
|
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Authy\V1\Service\Entity\Factor;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceContext;
use Twilio\Options;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class ChallengeContext extends InstanceContext {
/**
* Initialize the ChallengeContext
*
* @param \Twilio\Version $version Version that contains the resource
* @param string $serviceSid Service Sid.
* @param string $identity Unique identity of the Entity
* @param string $factorSid Factor Sid.
* @param string $sid A string that uniquely identifies this Challenge, or
* `latest`.
* @return \Twilio\Rest\Authy\V1\Service\Entity\Factor\ChallengeContext
*/
public function __construct(Version $version, $serviceSid, $identity, $factorSid, $sid) {
parent::__construct($version);
// Path Solution
$this->solution = array(
'serviceSid' => $serviceSid,
'identity' => $identity,
'factorSid' => $factorSid,
'sid' => $sid,
);
$this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Entities/' . \rawurlencode($identity) . '/Factors/' . \rawurlencode($factorSid) . '/Challenges/' . \rawurlencode($sid) . '';
}
/**
* Deletes the ChallengeInstance
*
* @return boolean True if delete succeeds, false otherwise
* @throws TwilioException When an HTTP error occurs.
*/
public function delete() {
return $this->version->delete('delete', $this->uri);
}
/**
* Fetch a ChallengeInstance
*
* @return ChallengeInstance Fetched ChallengeInstance
* @throws TwilioException When an HTTP error occurs.
*/
public function fetch() {
$params = Values::of(array());
$payload = $this->version->fetch(
'GET',
$this->uri,
$params
);
return new ChallengeInstance(
$this->version,
$payload,
$this->solution['serviceSid'],
$this->solution['identity'],
$this->solution['factorSid'],
$this->solution['sid']
);
}
/**
* Update the ChallengeInstance
*
* @param array|Options $options Optional Arguments
* @return ChallengeInstance Updated ChallengeInstance
* @throws TwilioException When an HTTP error occurs.
*/
public function update($options = array()) {
$options = new Values($options);
$data = Values::of(array('AuthPayload' => $options['authPayload'], ));
$payload = $this->version->update(
'POST',
$this->uri,
array(),
$data
);
return new ChallengeInstance(
$this->version,
$payload,
$this->solution['serviceSid'],
$this->solution['identity'],
$this->solution['factorSid'],
$this->solution['sid']
);
}
/**
* Provide a friendly representation
*
* @return string Machine friendly representation
*/
public function __toString() {
$context = array();
foreach ($this->solution as $key => $value) {
$context[] = "$key=$value";
}
return '[Twilio.Authy.V1.ChallengeContext ' . \implode(' ', $context) . ']';
}
}
|
unaio/una
|
upgrade/files/12.1.0-13.0.0.A1/files/plugins/twilio/sdk/src/Twilio/Rest/Authy/V1/Service/Entity/Factor/ChallengeContext.php
|
PHP
|
mit
| 3,669
|
module Shoppe
VERSION = "1.0.5"
end
|
ParthivPatel-BTC/shoppe-gem
|
lib/shoppe/version.rb
|
Ruby
|
mit
| 37
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_26) on Mon Oct 07 06:41:20 UTC 2013 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
MultipleArcTransition (Apache Hadoop Main 2.2.0 API)
</TITLE>
<META NAME="date" CONTENT="2013-10-07">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="MultipleArcTransition (Apache Hadoop Main 2.2.0 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/MultipleArcTransition.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../org/apache/hadoop/yarn/state/InvalidStateTransitonException.html" title="class in org.apache.hadoop.yarn.state"><B>PREV CLASS</B></A>
<A HREF="../../../../../org/apache/hadoop/yarn/state/SingleArcTransition.html" title="interface in org.apache.hadoop.yarn.state"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/hadoop/yarn/state/MultipleArcTransition.html" target="_top"><B>FRAMES</B></A>
<A HREF="MultipleArcTransition.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.hadoop.yarn.state</FONT>
<BR>
Interface MultipleArcTransition<OPERAND,EVENT,STATE extends <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A><STATE>></H2>
<HR>
<DL>
<DT><PRE><FONT SIZE="-1">@InterfaceAudience.Public
@InterfaceStability.Evolving
</FONT>public interface <A HREF="../../../../../src-html/org/apache/hadoop/yarn/state/MultipleArcTransition.html#line.31"><B>MultipleArcTransition<OPERAND,EVENT,STATE extends <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A><STATE>></B></A></DL>
</PRE>
<P>
Hook for Transition.
Post state is decided by Transition hook. Post state must be one of the
valid post states registered in StateMachine.
<P>
<P>
<HR>
<P>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/hadoop/yarn/state/MultipleArcTransition.html" title="type parameter in MultipleArcTransition">STATE</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/yarn/state/MultipleArcTransition.html#transition(OPERAND, EVENT)">transition</A></B>(<A HREF="../../../../../org/apache/hadoop/yarn/state/MultipleArcTransition.html" title="type parameter in MultipleArcTransition">OPERAND</A> operand,
<A HREF="../../../../../org/apache/hadoop/yarn/state/MultipleArcTransition.html" title="type parameter in MultipleArcTransition">EVENT</A> event)</CODE>
<BR>
Transition hook.</TD>
</TR>
</TABLE>
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="transition(java.lang.Object,java.lang.Object)"><!-- --></A><A NAME="transition(OPERAND, EVENT)"><!-- --></A><H3>
transition</H3>
<PRE>
<A HREF="../../../../../org/apache/hadoop/yarn/state/MultipleArcTransition.html" title="type parameter in MultipleArcTransition">STATE</A> <A HREF="../../../../../src-html/org/apache/hadoop/yarn/state/MultipleArcTransition.html#line.42"><B>transition</B></A>(<A HREF="../../../../../org/apache/hadoop/yarn/state/MultipleArcTransition.html" title="type parameter in MultipleArcTransition">OPERAND</A> operand,
<A HREF="../../../../../org/apache/hadoop/yarn/state/MultipleArcTransition.html" title="type parameter in MultipleArcTransition">EVENT</A> event)</PRE>
<DL>
<DD>Transition hook.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>operand</CODE> - the entity attached to the FSM, whose internal
state may change.<DD><CODE>event</CODE> - causal event
<DT><B>Returns:</B><DD>the postState. Post state must be one of the
valid post states registered in StateMachine.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/MultipleArcTransition.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../org/apache/hadoop/yarn/state/InvalidStateTransitonException.html" title="class in org.apache.hadoop.yarn.state"><B>PREV CLASS</B></A>
<A HREF="../../../../../org/apache/hadoop/yarn/state/SingleArcTransition.html" title="interface in org.apache.hadoop.yarn.state"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/hadoop/yarn/state/MultipleArcTransition.html" target="_top"><B>FRAMES</B></A>
<A HREF="MultipleArcTransition.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2013 <a href="http://www.apache.org">Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>
|
ashish-17/playback
|
hadoop-2.2.0/share/doc/hadoop/api/org/apache/hadoop/yarn/state/MultipleArcTransition.html
|
HTML
|
mit
| 10,636
|
$(document).ready(function() {
//WAYPOINT - JQUERY COUNTTO PROGRESS BAR//
$('#count-wrapper').waypoint(function() {
$('.title-count').countTo();
}, {
offset: '80%',
triggerOnce: true
});
// MIXITUP PORTFOLIO
$(function() {
$('#container-mixitup').mixItUp();
});
// MAGNIFIC POPUP
$('#container-mixitup').magnificPopup({
delegate: 'a', // child items selector, by clicking on it popup will open
type: 'image'
// other options
});
//GOOGLE MAPS //
var myLatlng = new google.maps.LatLng(40.6700, -73.9400);
var mapOptions = {
zoom: 11,
scrollwheel: false,
center: myLatlng,
styles: [{
featureType: "landscape",
stylers: [{
saturation: -100
}, {
lightness: 65
}, {
visibility: "on"
}]
}, {
featureType: "poi",
stylers: [{
saturation: -100
}, {
lightness: 51
}, {
visibility: "simplified"
}]
}, {
featureType: "road.highway",
stylers: [{
saturation: -100
}, {
visibility: "simplified"
}]
}, {
featureType: "road.arterial",
stylers: [{
saturation: -100
}, {
lightness: 30
}, {
visibility: "on"
}]
}, {
featureType: "road.local",
stylers: [{
saturation: -100
}, {
lightness: 40
}, {
visibility: "on"
}]
}, {
featureType: "transit",
stylers: [{
saturation: -100
}, {
visibility: "simplified"
}]
}, {
featureType: "administrative.province",
stylers: [{
visibility: "off"
}] /**/
}, {
featureType: "administrative.locality",
stylers: [{
visibility: "off"
}]
}, {
featureType: "administrative.neighborhood",
stylers: [{
visibility: "on"
}] /**/
}, {
featureType: "water",
elementType: "labels",
stylers: [{
visibility: "on"
}, {
lightness: -25
}, {
saturation: -100
}]
}, {
featureType: "water",
elementType: "geometry",
stylers: [{
hue: "#ffff00"
}, {
lightness: -25
}, {
saturation: -97
}]
}]
};
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
// To add the marker to the map, use the 'map' property
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: "Hello World!"
});
// Clients Slider
$("#owl-clients").owlCarousel({
autoPlay: 4500,
items: 4,
pagination: false,
itemsCustom: [
[0, 3],
[450, 4]
]
});
// validate contact form
$(function() {
$('#contact').validate({
rules: {
name: {
required: true,
minlength: 2
},
email: {
required: true,
email: true
},
message: {
required: true
}
},
messages: {
name: {
required: "Please enter your name",
minlength: "your name must consist of at least 2 characters"
},
email: {
required: "Please enter your email address"
},
message: {
required: "Please enter your message",
minlength: "thats all? really?"
}
},
submitHandler: function(form) {
$(form).ajaxSubmit({
type:"POST",
data: $(form).serialize(),
url:"contact.php",
success: function() {
$('#contact').css( "display", 'none');
$('#contact :input').attr('disabled', 'disabled');
$('#success').fadeIn();
},
error: function() {
$('#contact').css( "display", 'none');
$('#contact :input').attr('disabled', 'disabled');
$('#error').fadeIn();
}
});
}
});
});
$(function () {
$('[data-toggle="tooltip"]').tooltip();
});
});
|
snktre59/projet_services
|
assets/theme_1/js/page/page.home-transparent-header.js
|
JavaScript
|
mit
| 5,340
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
namespace Microsoft.Azure.Management.Compute.Models
{
using System.Linq;
/// <summary>
/// Describes Windows Remote Management configuration of the VM
/// </summary>
public partial class WinRMConfiguration
{
/// <summary>
/// Initializes a new instance of the WinRMConfiguration class.
/// </summary>
public WinRMConfiguration() { }
/// <summary>
/// Initializes a new instance of the WinRMConfiguration class.
/// </summary>
/// <param name="listeners">the list of Windows Remote Management
/// listeners</param>
public WinRMConfiguration(System.Collections.Generic.IList<WinRMListener> listeners = default(System.Collections.Generic.IList<WinRMListener>))
{
Listeners = listeners;
}
/// <summary>
/// Gets or sets the list of Windows Remote Management listeners
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "listeners")]
public System.Collections.Generic.IList<WinRMListener> Listeners { get; set; }
}
}
|
ahosnyms/azure-sdk-for-net
|
src/ResourceManagement/Compute/Microsoft.Azure.Management.Compute/Generated/Models/WinRMConfiguration.cs
|
C#
|
mit
| 1,422
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @name: S12.14_A10_T1;
* @section: 12.14;
* @assertion: Using "try" with "catch" or "finally" statement within/without a "while" statement;
* @description: Throwing exception while executing iteration statement placed into try Block;
*/
// CHECK#1
var i=0;
try{
while(i<10){
if(i===5) throw i;
i++;
}
}
catch(e){
if(e!==5)$ERROR('#1: Exception === 5. Actual: Exception ==='+ e );
}
|
Diullei/Storm
|
Storm.Test/SputnikV1/12_Statement/12.14_The_try_Statement/S12.14_A10_T1.js
|
JavaScript
|
mit
| 555
|
/* Copyright (c) 2008-2009 Christopher J. W. Lloyd
Permission is hereby granted,free of charge,to any person obtaining a copy of this software and associated documentation files (the "Software"),to deal in the Software without restriction,including without limitation the rights to use,copy,modify,merge,publish,distribute,sublicense,and/or sell copies of the Software,and to permit persons to whom the Software is furnished to do so,subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER LIABILITY,WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <CoreFoundation/CFBase.h>
#import <CoreFoundation/CFNumber.h>
typedef struct __NSNumberFormatter *CFNumberFormatterRef;
enum {
kCFNumberFormatterNoStyle =0,
kCFNumberFormatterDecimalStyle =1,
kCFNumberFormatterCurrencyStyle =2,
kCFNumberFormatterPercentStyle =3,
kCFNumberFormatterScientificStyle=4,
kCFNumberFormatterSpellOutStyle =5,
};
typedef CFIndex CFNumberFormatterStyle;
enum {
kCFNumberFormatterParseIntegersOnly= 1
};
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterCurrencyCode;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterDecimalSeparator;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterCurrencyDecimalSeparator;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterAlwaysShowDecimalSeparator;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterGroupingSeparator;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterUseGroupingSeparator;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterPercentSymbol;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterZeroSymbol;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterNaNSymbol;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterInfinitySymbol;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterMinusSign;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterPlusSign;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterCurrencySymbol;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterExponentSymbol;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterMinIntegerDigits;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterMaxIntegerDigits;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterMinFractionDigits;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterMaxFractionDigits;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterGroupingSize;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterSecondaryGroupingSize;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterRoundingMode;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterRoundingIncrement;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterFormatWidth;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterPaddingPosition;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterPaddingCharacter;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterDefaultFormat;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterMultiplier;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterPositivePrefix;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterPositiveSuffix;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterNegativePrefix;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterNegativeSuffix;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterPerMillSymbol;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterInternationalCurrencySymbol;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterCurrencyGroupingSeparator;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterIsLenient;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterUseSignificantDigits;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterMinSignificantDigits;
COREFOUNDATION_EXPORT const CFStringRef kCFNumberFormatterMaxSignificantDigits;
CFTypeID CFNumberFormatterGetTypeID(void);
CFNumberFormatterRef CFNumberFormatterCreate(CFAllocatorRef allocator,CFLocaleRef locale,CFNumberFormatterStyle style);
CFLocaleRef CFNumberFormatterGetLocale(CFNumberFormatterRef self);
CFNumberFormatterStyle CFNumberFormatterGetStyle(CFNumberFormatterRef self);
CFStringRef CFNumberFormatterGetFormat(CFNumberFormatterRef self);
void CFNumberFormatterSetFormat(CFNumberFormatterRef self,CFStringRef format);
void CFNumberFormatterSetProperty(CFNumberFormatterRef self,CFStringRef key,CFTypeRef value);
CFTypeRef CFNumberFormatterCopyProperty(CFNumberFormatterRef self,CFStringRef key);
CFNumberRef CFNumberFormatterCreateNumberFromString(CFAllocatorRef allocator,CFNumberFormatterRef self,CFStringRef string,CFRange *rangep,CFOptionFlags options);
CFStringRef CFNumberFormatterCreateStringWithNumber(CFAllocatorRef allocator,CFNumberFormatterRef self,CFNumberRef number);
CFStringRef CFNumberFormatterCreateStringWithValue(CFAllocatorRef allocator,CFNumberFormatterRef self,CFNumberType numberType,const void *valuep);
Boolean CFNumberFormatterGetDecimalInfoForCurrencyCode(CFStringRef currencyCode,int32_t *defaultFractionDigits,double *roundingIncrement);
Boolean CFNumberFormatterGetValueFromString(CFNumberFormatterRef self,CFStringRef string,CFRange *rangep,CFNumberType numberType,void *valuep);
|
farcaller/cocotron
|
CoreFoundation/CFNumberFormatter.h
|
C
|
mit
| 5,775
|
# Be sure to restart your server when you modify this file.
AngularCasts::Application.config.session_store :cookie_store, key: '_angular_casts_session'
|
stephdatu/angular_casts
|
config/initializers/session_store.rb
|
Ruby
|
mit
| 153
|
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| http://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
| $route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = '/controlcentre';
//$route['programmes'] = '/programmes';
//$route['^(:any)(/:any)?$'] = "controlcentre/$0";
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
|
rccghmp/efollowup
|
application/config/routes.php
|
PHP
|
mit
| 2,067
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Jint.Expressions {
[Serializable]
public class SwitchStatement : Statement {
public Statement Expression { get; set; }
public List<CaseClause> CaseClauses { get; private set; }
public Statement DefaultStatements { get; set; }
public SwitchStatement() {
CaseClauses = new List<CaseClause>();
}
[System.Diagnostics.DebuggerStepThrough]
public override void Accept(IStatementVisitor visitor) {
visitor.Visit(this);
}
}
}
|
cosh/Jint
|
Jint/Expressions/SwitchStatement.cs
|
C#
|
mit
| 601
|
'use strict';
var chai = require('chai'),
chaiAsPromised = require('chai-as-promised');
if (!global.Promise) {
global.Promise = require('promise-polyfill');
}
chai.use(chaiAsPromised);
chai.should();
var async = require('../../lib/async-as-promised');
describe('aplus', function () {
describe('setPromise()', function () {
afterEach(function () {
async.resetPromise();
});
it('should set async.Promise', function () {
var value = Math.random();
async.setPromise(value);
async.Promise.should.equal(value);
});
});
describe('resetPromise()', function () {
afterEach(function () {
async.resetPromise();
});
it('should restore async.Promise', function () {
var value = async.Promise;
async.Promise = Math.random();
async.resetPromise();
async.Promise.should.equal(value);
});
});
});
describe('async.constant()', function () {
it('should return a Promise', function () {
async.constant(5).should.be.an.instanceOf(Promise);
});
it('should resolve to provided value', function () {
return async.constant(5).should.eventually.equal(5);
});
});
describe('async.fail()', function () {
it('should return a Promise', function () {
async.fail('boo!').should.be.an.instanceOf(Promise);
});
it('should resolve to provided value', function () {
return async.fail('boo!').should.eventually.be.rejectedWith('boo!');
});
});
describe('async.delay()', function () {
it('should alias async.later to async.delay', function () {
async.later.should.equal(async.delay);
});
it('should return a promise', function () {
async.delay(1).should.be.an.instanceOf(Promise);
});
it('should resolve after delay', function () {
var now = Date.now();
return async.delay(500).then(function () {
(Date.now() - now).should.be.at.least(499);
});
});
it('should resolve using default delay if not specified', function () {
var now = Date.now();
return async.delay().then(function () {
(Date.now() - now).should.be.at.least(99);
});
});
it('should resolve using default delay when no parameters specified', function () {
var now = Date.now();
return async.delay().then(function () {
(Date.now() - now).should.be.at.least(99);
});
});
it('should resolve to `undefined` when no parameters specified', function () {
return async.delay().then(function (value) {
chai.expect(value).to.equal(undefined);
});
});
it('should resolve using default delay when only value specified', function () {
var now = Date.now();
return async.delay('hi!').then(function () {
(Date.now() - now).should.be.at.least(99);
});
});
it('should resolve to value when only value specified', function () {
return async.delay('hi!').then(function (value) {
value.should.equal('hi!');
});
});
it('should resolve using provided delay when delay and value specified', function () {
var now = Date.now();
return async.delay(200, 'bye!').then(function () {
(Date.now() - now).should.be.at.least(199);
});
});
it('should resolve to value when delay and value specified', function () {
return async.delay(50, 'bye').then(function (value) {
value.should.equal('bye');
});
});
it('should throw exception when non number provided as delay and value is specified', function () {
function test() {
return async.delay('five seconds', 'hi!');
}
chai.expect(test).to.throw(TypeError);
});
it('should throw expected message for invalid delay', function () {
function test() {
return async.delay('five seconds', 'hi!');
}
chai.expect(test).to.throw('parameter ms must be a number, string was provided instead');
});
});
|
AccaliaDeElementia/aplus-async
|
test/lib/async.js
|
JavaScript
|
mit
| 4,141
|
<script type="text/javascript">
// removeEventListener("load", doJSload, false);
var doPJSload = function() {
try {
tmpV = "y";
// http://localhost/w/pm/
// alert("js-header");
} catch(e) {
// alert(e);
JSSHOP.logJSerror(e, arguments, "doJSload");
}
}
try {
if (window.addEventListener){
window.addEventListener("load", doPJSload, false);
} else if (window.attachEvent) {
window.attachEvent("onload", doPJSload);
} else {
window.onload = doPJSload;
}
} catch(e) {
alert("window.addEventListener: " + e);
}
</script>
|
njflabs/evenflow
|
webdroid/assets/quickorder/_p/js-header.php
|
PHP
|
mit
| 527
|
/*
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.drawee.drawable;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
/**
* Drawable that displays a progress bar based on the level.
*/
public class ProgressBarDrawable extends Drawable implements CloneableDrawable {
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Path mPath = new Path();
private final RectF mRect = new RectF();
private int mBackgroundColor = 0x80000000;
private int mColor = 0x800080FF;
private int mPadding = 10;
private int mBarWidth = 20;
private int mLevel = 0;
private int mRadius = 0;
private boolean mHideWhenZero = false;
private boolean mIsVertical = false;
/** Sets the progress bar color. */
public void setColor(int color) {
if (mColor != color) {
mColor = color;
invalidateSelf();
}
}
/** Gets the progress bar color. */
public int getColor() {
return mColor;
}
/** Sets the progress bar background color. */
public void setBackgroundColor(int backgroundColor) {
if (mBackgroundColor != backgroundColor) {
mBackgroundColor = backgroundColor;
invalidateSelf();
}
}
/** Gets the progress bar background color. */
public int getBackgroundColor() {
return mBackgroundColor;
}
/** Sets the progress bar padding. */
public void setPadding(int padding) {
if (mPadding != padding) {
mPadding = padding;
invalidateSelf();
}
}
/** Gets the progress bar padding. */
@Override
public boolean getPadding(Rect padding) {
padding.set(mPadding, mPadding, mPadding, mPadding);
return mPadding != 0;
}
/** Sets the progress bar width. */
public void setBarWidth(int barWidth) {
if (mBarWidth != barWidth) {
mBarWidth = barWidth;
invalidateSelf();
}
}
/** Gets the progress bar width. */
public int getBarWidth() {
return mBarWidth;
}
/** Sets whether the progress bar should be hidden when the progress is 0. */
public void setHideWhenZero(boolean hideWhenZero) {
mHideWhenZero = hideWhenZero;
}
/** Gets whether the progress bar should be hidden when the progress is 0. */
public boolean getHideWhenZero() {
return mHideWhenZero;
}
/** The progress bar will be displayed as a rounded corner rectangle, sets the radius here. */
public void setRadius(int radius) {
if (mRadius != radius) {
mRadius = radius;
invalidateSelf();
}
}
/** Gets the radius of the progress bar. */
public int getRadius() {
return mRadius;
}
/** Sets if the progress bar should be vertical. */
public void setIsVertical(boolean isVertical) {
if (mIsVertical != isVertical) {
mIsVertical = isVertical;
invalidateSelf();
}
}
/** Gets if the progress bar is vertical. */
public boolean getIsVertical() {
return mIsVertical;
}
@Override
protected boolean onLevelChange(int level) {
mLevel = level;
invalidateSelf();
return true;
}
@Override
public void setAlpha(int alpha) {
mPaint.setAlpha(alpha);
}
@Override
public void setColorFilter(ColorFilter cf) {
mPaint.setColorFilter(cf);
}
@Override
public int getOpacity() {
return DrawableUtils.getOpacityFromColor(mPaint.getColor());
}
@Override
public void draw(Canvas canvas) {
if (mHideWhenZero && mLevel == 0) {
return;
}
if (mIsVertical) {
drawVerticalBar(canvas, 10000, mBackgroundColor);
drawVerticalBar(canvas, mLevel, mColor);
} else {
drawHorizontalBar(canvas, 10000, mBackgroundColor);
drawHorizontalBar(canvas, mLevel, mColor);
}
}
@Override
public Drawable cloneDrawable() {
final ProgressBarDrawable copy = new ProgressBarDrawable();
copy.mBackgroundColor = mBackgroundColor;
copy.mColor = mColor;
copy.mPadding = mPadding;
copy.mBarWidth = mBarWidth;
copy.mLevel = mLevel;
copy.mRadius = mRadius;
copy.mHideWhenZero = mHideWhenZero;
copy.mIsVertical = mIsVertical;
return copy;
}
private void drawHorizontalBar(Canvas canvas, int level, int color) {
Rect bounds = getBounds();
int length = (bounds.width() - 2 * mPadding) * level / 10000;
int xpos = bounds.left + mPadding;
int ypos = bounds.bottom - mPadding - mBarWidth;
mRect.set(xpos, ypos, xpos + length, ypos + mBarWidth);
drawBar(canvas, color);
}
private void drawVerticalBar(Canvas canvas, int level, int color) {
Rect bounds = getBounds();
int length = (bounds.height() - 2 * mPadding) * level / 10000;
int xpos = bounds.left + mPadding;
int ypos = bounds.top + mPadding;
mRect.set(xpos, ypos, xpos + mBarWidth, ypos + length);
drawBar(canvas, color);
}
private void drawBar(Canvas canvas, int color) {
mPaint.setColor(color);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mPath.reset();
mPath.setFillType(Path.FillType.EVEN_ODD);
mPath.addRoundRect(
mRect,
Math.min(mRadius, mBarWidth / 2),
Math.min(mRadius, mBarWidth / 2),
Path.Direction.CW);
canvas.drawPath(mPath, mPaint);
}
}
|
s1rius/fresco
|
drawee/src/main/java/com/facebook/drawee/drawable/ProgressBarDrawable.java
|
Java
|
mit
| 5,461
|
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#include "stdafx.h"
#include "D3D12RaytracingLibrarySubobjects.h"
#include "DirectXRaytracingHelper.h"
#include "CompiledShaders\Raytracing.hlsl.h"
using namespace std;
using namespace DX;
const wchar_t* D3D12RaytracingLibrarySubobjects::c_hitGroupName = L"MyHitGroup";
const wchar_t* D3D12RaytracingLibrarySubobjects::c_raygenShaderName = L"MyRaygenShader";
const wchar_t* D3D12RaytracingLibrarySubobjects::c_closestHitShaderName = L"MyClosestHitShader";
const wchar_t* D3D12RaytracingLibrarySubobjects::c_missShaderName = L"MyMissShader";
// Library subobject names
const wchar_t* D3D12RaytracingLibrarySubobjects::c_globalRootSignatureName = L"MyGlobalRootSignature";
const wchar_t* D3D12RaytracingLibrarySubobjects::c_localRootSignatureName = L"MyLocalRootSignature";
const wchar_t* D3D12RaytracingLibrarySubobjects::c_localRootSignatureAssociationName = L"MyLocalRootSignatureAssociation";
const wchar_t* D3D12RaytracingLibrarySubobjects::c_shaderConfigName = L"MyShaderConfig";
const wchar_t* D3D12RaytracingLibrarySubobjects::c_pipelineConfigName = L"MyPipelineConfig";
D3D12RaytracingLibrarySubobjects::D3D12RaytracingLibrarySubobjects(UINT width, UINT height, std::wstring name) :
DXSample(width, height, name),
m_raytracingOutputResourceUAVDescriptorHeapIndex(UINT_MAX),
m_curRotationAngleRad(0.0f),
m_isDxrSupported(false)
{
UpdateForSizeChange(width, height);
}
void D3D12RaytracingLibrarySubobjects::EnableDirectXRaytracing(IDXGIAdapter1* adapter)
{
m_isDxrSupported = IsDirectXRaytracingSupported(adapter);
ThrowIfFalse(m_isDxrSupported, L"DirectX Raytracing is not supported by your GPU and driver.\n\n");
}
void D3D12RaytracingLibrarySubobjects::OnInit()
{
m_deviceResources = std::make_unique<DeviceResources>(
DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_FORMAT_UNKNOWN,
FrameCount,
D3D_FEATURE_LEVEL_11_0,
// Sample shows handling of use cases with tearing support, which is OS dependent and has been supported since TH2.
// Since the Library Subobjects requires 19h1 OS update, we don't need to handle non-tearing cases.
DeviceResources::c_RequireTearingSupport,
m_adapterIDoverride
);
m_deviceResources->RegisterDeviceNotify(this);
m_deviceResources->SetWindow(Win32Application::GetHwnd(), m_width, m_height);
m_deviceResources->InitializeDXGIAdapter();
EnableDirectXRaytracing(m_deviceResources->GetAdapter());
m_deviceResources->CreateDeviceResources();
m_deviceResources->CreateWindowSizeDependentResources();
InitializeScene();
CreateDeviceDependentResources();
CreateWindowSizeDependentResources();
}
// Update camera matrices passed into the shader.
void D3D12RaytracingLibrarySubobjects::UpdateCameraMatrices()
{
auto frameIndex = m_deviceResources->GetCurrentFrameIndex();
m_sceneCB[frameIndex].cameraPosition = m_eye;
float fovAngleY = 45.0f;
XMMATRIX view = XMMatrixLookAtLH(m_eye, m_at, m_up);
XMMATRIX proj = XMMatrixPerspectiveFovLH(XMConvertToRadians(fovAngleY), m_aspectRatio, 1.0f, 125.0f);
XMMATRIX viewProj = view * proj;
m_sceneCB[frameIndex].projectionToWorld = XMMatrixInverse(nullptr, viewProj);
}
// Initialize scene rendering parameters.
void D3D12RaytracingLibrarySubobjects::InitializeScene()
{
auto frameIndex = m_deviceResources->GetCurrentFrameIndex();
// Setup materials.
{
m_cubeCB.albedo = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
}
// Setup camera.
{
// Initialize the view and projection inverse matrices.
m_eye = { 0.0f, 2.0f, -5.0f, 1.0f };
m_at = { 0.0f, 0.0f, 0.0f, 1.0f };
XMVECTOR right = { 1.0f, 0.0f, 0.0f, 0.0f };
XMVECTOR direction = XMVector4Normalize(m_at - m_eye);
m_up = XMVector3Normalize(XMVector3Cross(direction, right));
// Rotate camera around Y axis.
XMMATRIX rotate = XMMatrixRotationY(XMConvertToRadians(45.0f));
m_eye = XMVector3Transform(m_eye, rotate);
m_up = XMVector3Transform(m_up, rotate);
UpdateCameraMatrices();
}
// Setup lights.
{
// Initialize the lighting parameters.
XMFLOAT4 lightPosition;
XMFLOAT4 lightAmbientColor;
XMFLOAT4 lightDiffuseColor;
lightPosition = XMFLOAT4(0.0f, 1.8f, -3.0f, 0.0f);
m_sceneCB[frameIndex].lightPosition = XMLoadFloat4(&lightPosition);
lightAmbientColor = XMFLOAT4(0.5f, 0.5f, 0.5f, 1.0f);
m_sceneCB[frameIndex].lightAmbientColor = XMLoadFloat4(&lightAmbientColor);
lightDiffuseColor = XMFLOAT4(0.0f, 0.5f, 0.0f, 1.0f);
m_sceneCB[frameIndex].lightDiffuseColor = XMLoadFloat4(&lightDiffuseColor);
}
// Apply the initial values to all frames' buffer instances.
for (auto& sceneCB : m_sceneCB)
{
sceneCB = m_sceneCB[frameIndex];
}
}
// Create constant buffers.
void D3D12RaytracingLibrarySubobjects::CreateConstantBuffers()
{
auto device = m_deviceResources->GetD3DDevice();
auto frameCount = m_deviceResources->GetBackBufferCount();
// Create the constant buffer memory and map the CPU and GPU addresses
const D3D12_HEAP_PROPERTIES uploadHeapProperties = CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD);
// Allocate one constant buffer per frame, since it gets updated every frame.
size_t cbSize = frameCount * sizeof(AlignedSceneConstantBuffer);
const D3D12_RESOURCE_DESC constantBufferDesc = CD3DX12_RESOURCE_DESC::Buffer(cbSize);
ThrowIfFailed(device->CreateCommittedResource(
&uploadHeapProperties,
D3D12_HEAP_FLAG_NONE,
&constantBufferDesc,
D3D12_RESOURCE_STATE_GENERIC_READ,
nullptr,
IID_PPV_ARGS(&m_perFrameConstants)));
// Map the constant buffer and cache its heap pointers.
// We don't unmap this until the app closes. Keeping buffer mapped for the lifetime of the resource is okay.
CD3DX12_RANGE readRange(0, 0); // We do not intend to read from this resource on the CPU.
ThrowIfFailed(m_perFrameConstants->Map(0, nullptr, reinterpret_cast<void**>(&m_mappedConstantData)));
}
// Create resources that depend on the device.
void D3D12RaytracingLibrarySubobjects::CreateDeviceDependentResources()
{
// Initialize raytracing pipeline.
// Create raytracing interfaces: raytracing device and commandlist.
CreateRaytracingInterfaces();
// Create root signatures for the shaders.
CreateRootSignatures();
// Create a raytracing pipeline state object which defines the binding of shaders, state and resources to be used during raytracing.
CreateRaytracingPipelineStateObject();
// Create a heap for descriptors.
CreateDescriptorHeap();
// Build geometry to be used in the sample.
BuildGeometry();
// Build raytracing acceleration structures from the generated geometry.
BuildAccelerationStructures();
// Create constant buffers for the geometry and the scene.
CreateConstantBuffers();
// Build shader tables, which define shaders and their local root arguments.
BuildShaderTables();
// Create an output 2D texture to store the raytracing result to.
CreateRaytracingOutputResource();
}
void D3D12RaytracingLibrarySubobjects::SerializeAndCreateRaytracingRootSignature(D3D12_ROOT_SIGNATURE_DESC& desc, ComPtr<ID3D12RootSignature>* rootSig)
{
auto device = m_deviceResources->GetD3DDevice();
ComPtr<ID3DBlob> blob;
ComPtr<ID3DBlob> error;
ThrowIfFailed(D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &blob, &error), error ? static_cast<wchar_t*>(error->GetBufferPointer()) : nullptr);
ThrowIfFailed(device->CreateRootSignature(1, blob->GetBufferPointer(), blob->GetBufferSize(), IID_PPV_ARGS(&(*rootSig))));
}
void D3D12RaytracingLibrarySubobjects::CreateRootSignatures()
{
auto device = m_deviceResources->GetD3DDevice();
// A unique global root signature is defined in hlsl library g_pRaytracing. For such scenario we can create
// compute root signature can directly from the library bytecode, using CreateRootSignature API.
ThrowIfFailed(device->CreateRootSignature(1, g_pRaytracing, ARRAYSIZE(g_pRaytracing), IID_PPV_ARGS(&m_raytracingGlobalRootSignature)));
}
// Create raytracing device and command list.
void D3D12RaytracingLibrarySubobjects::CreateRaytracingInterfaces()
{
auto device = m_deviceResources->GetD3DDevice();
auto commandList = m_deviceResources->GetCommandList();
ThrowIfFailed(device->QueryInterface(IID_PPV_ARGS(&m_dxrDevice)), L"Couldn't get DirectX Raytracing interface for the device.\n");
// This fails for some reasom.
// ThrowIfFailed(commandList->QueryInterface(IID_PPV_ARGS(&m_dxrCommandList)), L"Couldn't get DirectX Raytracing interface for the command list.\n");
// Workaround
m_dxrCommandList = reinterpret_cast<ID3D12GraphicsCommandList5*>(commandList);
}
// Create a raytracing pipeline state object (RTPSO).
// An RTPSO represents a full set of shaders reachable by a DispatchRays() call,
// with all configuration options resolved, such as local signatures and other state.
void D3D12RaytracingLibrarySubobjects::CreateRaytracingPipelineStateObject()
{
// Create library and use the library subobject defined in the library in the RTPSO:
// Subobjects need to be associated with DXIL shaders exports either by way of default or explicit associations.
// Default association applies to every exported shader entrypoint that doesn't have any of the same type of subobject associated with it.
// This simple sample utilizes default shader association except for local root signature subobject
// which has an explicit association specified purely for demonstration purposes.
//
// Following subobjects are defined with the library itself. We can export and rename the subobjects from the
// DXIL library in a similar way we export shaders.
// 1 - Triangle hit group
// 1 - Shader config
// 2 - Local root signature and association
// 1 - Global root signature
// 1 - Pipeline config
// 1 - Subobject to export association
CD3DX12_STATE_OBJECT_DESC raytracingPipeline{ D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE };
// DXIL library
// This contains the shaders and their entrypoints for the state object.
// Since shaders are not considered a subobject, they need to be passed in via DXIL library subobjects.
auto lib = raytracingPipeline.CreateSubobject<CD3DX12_DXIL_LIBRARY_SUBOBJECT>();
D3D12_SHADER_BYTECODE libdxil = CD3DX12_SHADER_BYTECODE((void *)g_pRaytracing, ARRAYSIZE(g_pRaytracing));
lib->SetDXILLibrary(&libdxil);
// Define which shader exports to surface from the library.
// If no shader exports are defined for a DXIL library subobject, all shaders will be surfaced.
// In this sample, this could be ommited for convenience since the sample uses all shaders in the library.
{
lib->DefineExport(c_raygenShaderName);
lib->DefineExport(c_closestHitShaderName);
lib->DefineExport(c_missShaderName);
}
// Define which subobjects exports to use from the library.
// If no exports are defined all subobjects are used.
{
lib->DefineExport(c_globalRootSignatureName);
lib->DefineExport(c_localRootSignatureName);
lib->DefineExport(c_localRootSignatureAssociationName);
lib->DefineExport(c_shaderConfigName);
lib->DefineExport(c_pipelineConfigName);
lib->DefineExport(c_hitGroupName);
}
#if _DEBUG
PrintStateObjectDesc(raytracingPipeline);
#endif
ThrowIfFailed(m_dxrDevice->CreateStateObject(raytracingPipeline, IID_PPV_ARGS(&m_dxrStateObject)), L"Couldn't create DirectX Raytracing state object.\n");
}
// Create 2D output texture for raytracing.
void D3D12RaytracingLibrarySubobjects::CreateRaytracingOutputResource()
{
auto device = m_deviceResources->GetD3DDevice();
auto backbufferFormat = m_deviceResources->GetBackBufferFormat();
// Create the output resource. The dimensions and format should match the swap-chain.
auto uavDesc = CD3DX12_RESOURCE_DESC::Tex2D(backbufferFormat, m_width, m_height, 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS);
auto defaultHeapProperties = CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT);
ThrowIfFailed(device->CreateCommittedResource(
&defaultHeapProperties, D3D12_HEAP_FLAG_NONE, &uavDesc, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, nullptr, IID_PPV_ARGS(&m_raytracingOutput)));
NAME_D3D12_OBJECT(m_raytracingOutput);
D3D12_CPU_DESCRIPTOR_HANDLE uavDescriptorHandle;
m_raytracingOutputResourceUAVDescriptorHeapIndex = AllocateDescriptor(&uavDescriptorHandle, m_raytracingOutputResourceUAVDescriptorHeapIndex);
D3D12_UNORDERED_ACCESS_VIEW_DESC UAVDesc = {};
UAVDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
device->CreateUnorderedAccessView(m_raytracingOutput.Get(), nullptr, &UAVDesc, uavDescriptorHandle);
m_raytracingOutputResourceUAVGpuDescriptor = CD3DX12_GPU_DESCRIPTOR_HANDLE(m_descriptorHeap->GetGPUDescriptorHandleForHeapStart(), m_raytracingOutputResourceUAVDescriptorHeapIndex, m_descriptorSize);
}
void D3D12RaytracingLibrarySubobjects::CreateDescriptorHeap()
{
auto device = m_deviceResources->GetD3DDevice();
D3D12_DESCRIPTOR_HEAP_DESC descriptorHeapDesc = {};
// Allocate a heap for 3 descriptors:
// 2 - vertex and index buffer SRVs
// 1 - raytracing output texture SRV
descriptorHeapDesc.NumDescriptors = 3;
descriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
descriptorHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
descriptorHeapDesc.NodeMask = 0;
device->CreateDescriptorHeap(&descriptorHeapDesc, IID_PPV_ARGS(&m_descriptorHeap));
NAME_D3D12_OBJECT(m_descriptorHeap);
m_descriptorSize = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
}
// Build geometry used in the sample.
void D3D12RaytracingLibrarySubobjects::BuildGeometry()
{
auto device = m_deviceResources->GetD3DDevice();
// Cube indices.
Index indices[] =
{
3,1,0,
2,1,3,
6,4,5,
7,4,6,
11,9,8,
10,9,11,
14,12,13,
15,12,14,
19,17,16,
18,17,19,
22,20,21,
23,20,22
};
// Cube vertices positions and corresponding triangle normals.
Vertex vertices[] =
{
{ XMFLOAT3(-1.0f, 1.0f, -1.0f), XMFLOAT3(0.0f, 1.0f, 0.0f) },
{ XMFLOAT3(1.0f, 1.0f, -1.0f), XMFLOAT3(0.0f, 1.0f, 0.0f) },
{ XMFLOAT3(1.0f, 1.0f, 1.0f), XMFLOAT3(0.0f, 1.0f, 0.0f) },
{ XMFLOAT3(-1.0f, 1.0f, 1.0f), XMFLOAT3(0.0f, 1.0f, 0.0f) },
{ XMFLOAT3(-1.0f, -1.0f, -1.0f), XMFLOAT3(0.0f, -1.0f, 0.0f) },
{ XMFLOAT3(1.0f, -1.0f, -1.0f), XMFLOAT3(0.0f, -1.0f, 0.0f) },
{ XMFLOAT3(1.0f, -1.0f, 1.0f), XMFLOAT3(0.0f, -1.0f, 0.0f) },
{ XMFLOAT3(-1.0f, -1.0f, 1.0f), XMFLOAT3(0.0f, -1.0f, 0.0f) },
{ XMFLOAT3(-1.0f, -1.0f, 1.0f), XMFLOAT3(-1.0f, 0.0f, 0.0f) },
{ XMFLOAT3(-1.0f, -1.0f, -1.0f), XMFLOAT3(-1.0f, 0.0f, 0.0f) },
{ XMFLOAT3(-1.0f, 1.0f, -1.0f), XMFLOAT3(-1.0f, 0.0f, 0.0f) },
{ XMFLOAT3(-1.0f, 1.0f, 1.0f), XMFLOAT3(-1.0f, 0.0f, 0.0f) },
{ XMFLOAT3(1.0f, -1.0f, 1.0f), XMFLOAT3(1.0f, 0.0f, 0.0f) },
{ XMFLOAT3(1.0f, -1.0f, -1.0f), XMFLOAT3(1.0f, 0.0f, 0.0f) },
{ XMFLOAT3(1.0f, 1.0f, -1.0f), XMFLOAT3(1.0f, 0.0f, 0.0f) },
{ XMFLOAT3(1.0f, 1.0f, 1.0f), XMFLOAT3(1.0f, 0.0f, 0.0f) },
{ XMFLOAT3(-1.0f, -1.0f, -1.0f), XMFLOAT3(0.0f, 0.0f, -1.0f) },
{ XMFLOAT3(1.0f, -1.0f, -1.0f), XMFLOAT3(0.0f, 0.0f, -1.0f) },
{ XMFLOAT3(1.0f, 1.0f, -1.0f), XMFLOAT3(0.0f, 0.0f, -1.0f) },
{ XMFLOAT3(-1.0f, 1.0f, -1.0f), XMFLOAT3(0.0f, 0.0f, -1.0f) },
{ XMFLOAT3(-1.0f, -1.0f, 1.0f), XMFLOAT3(0.0f, 0.0f, 1.0f) },
{ XMFLOAT3(1.0f, -1.0f, 1.0f), XMFLOAT3(0.0f, 0.0f, 1.0f) },
{ XMFLOAT3(1.0f, 1.0f, 1.0f), XMFLOAT3(0.0f, 0.0f, 1.0f) },
{ XMFLOAT3(-1.0f, 1.0f, 1.0f), XMFLOAT3(0.0f, 0.0f, 1.0f) },
};
AllocateUploadBuffer(device, indices, sizeof(indices), &m_indexBuffer.resource);
AllocateUploadBuffer(device, vertices, sizeof(vertices), &m_vertexBuffer.resource);
// Vertex buffer is passed to the shader along with index buffer as a descriptor table.
// Vertex buffer descriptor must follow index buffer descriptor in the descriptor heap.
UINT descriptorIndexIB = CreateBufferSRV(&m_indexBuffer, sizeof(indices)/4, 0);
UINT descriptorIndexVB = CreateBufferSRV(&m_vertexBuffer, ARRAYSIZE(vertices), sizeof(vertices[0]));
ThrowIfFalse(descriptorIndexVB == descriptorIndexIB + 1, L"Vertex Buffer descriptor index must follow that of Index Buffer descriptor index!");
}
// Build acceleration structures needed for raytracing.
void D3D12RaytracingLibrarySubobjects::BuildAccelerationStructures()
{
auto device = m_deviceResources->GetD3DDevice();
auto commandList = m_deviceResources->GetCommandList();
auto commandQueue = m_deviceResources->GetCommandQueue();
auto commandAllocator = m_deviceResources->GetCommandAllocator();
// Reset the command list for the acceleration structure construction.
commandList->Reset(commandAllocator, nullptr);
D3D12_RAYTRACING_GEOMETRY_DESC geometryDesc = {};
geometryDesc.Type = D3D12_RAYTRACING_GEOMETRY_TYPE_TRIANGLES;
geometryDesc.Triangles.IndexBuffer = m_indexBuffer.resource->GetGPUVirtualAddress();
geometryDesc.Triangles.IndexCount = static_cast<UINT>(m_indexBuffer.resource->GetDesc().Width) / sizeof(Index);
geometryDesc.Triangles.IndexFormat = DXGI_FORMAT_R16_UINT;
geometryDesc.Triangles.Transform3x4 = 0;
geometryDesc.Triangles.VertexFormat = DXGI_FORMAT_R32G32B32_FLOAT;
geometryDesc.Triangles.VertexCount = static_cast<UINT>(m_vertexBuffer.resource->GetDesc().Width) / sizeof(Vertex);
geometryDesc.Triangles.VertexBuffer.StartAddress = m_vertexBuffer.resource->GetGPUVirtualAddress();
geometryDesc.Triangles.VertexBuffer.StrideInBytes = sizeof(Vertex);
// Mark the geometry as opaque.
// PERFORMANCE TIP: mark geometry as opaque whenever applicable as it can enable important ray processing optimizations.
// Note: When rays encounter opaque geometry an any hit shader will not be executed whether it is present or not.
geometryDesc.Flags = D3D12_RAYTRACING_GEOMETRY_FLAG_OPAQUE;
// Get required sizes for an acceleration structure.
D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS buildFlags = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PREFER_FAST_TRACE;
D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC bottomLevelBuildDesc = {};
D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS &bottomLevelInputs = bottomLevelBuildDesc.Inputs;
bottomLevelInputs.DescsLayout = D3D12_ELEMENTS_LAYOUT_ARRAY;
bottomLevelInputs.Flags = buildFlags;
bottomLevelInputs.NumDescs = 1;
bottomLevelInputs.Type = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL;
bottomLevelInputs.pGeometryDescs = &geometryDesc;
D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC topLevelBuildDesc = {};
D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS &topLevelInputs = topLevelBuildDesc.Inputs;
topLevelInputs.DescsLayout = D3D12_ELEMENTS_LAYOUT_ARRAY;
topLevelInputs.Flags = buildFlags;
topLevelInputs.NumDescs = 1;
topLevelInputs.pGeometryDescs = nullptr;
topLevelInputs.Type = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL;
D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO topLevelPrebuildInfo;
m_dxrDevice->GetRaytracingAccelerationStructurePrebuildInfo(&topLevelInputs, &topLevelPrebuildInfo);
ThrowIfFalse(topLevelPrebuildInfo.ResultDataMaxSizeInBytes > 0);
D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO bottomLevelPrebuildInfo = {};
m_dxrDevice->GetRaytracingAccelerationStructurePrebuildInfo(&bottomLevelInputs, &bottomLevelPrebuildInfo);
ThrowIfFalse(bottomLevelPrebuildInfo.ResultDataMaxSizeInBytes > 0);
ComPtr<ID3D12Resource> scratchResource;
AllocateUAVBuffer(device, max(topLevelPrebuildInfo.ScratchDataSizeInBytes, bottomLevelPrebuildInfo.ScratchDataSizeInBytes), &scratchResource, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, L"ScratchResource");
// Allocate resources for acceleration structures.
// Acceleration structures can only be placed in resources that are created in the default heap (or custom heap equivalent).
// Default heap is OK since the application doesnt need CPU read/write access to them.
// The resources that will contain acceleration structures must be created in the state D3D12_RESOURCE_STATE_RAYTRACING_ACCELERATION_STRUCTURE,
// and must have resource flag D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS. The ALLOW_UNORDERED_ACCESS requirement simply acknowledges both:
// - the system will be doing this type of access in its implementation of acceleration structure builds behind the scenes.
// - from the app point of view, synchronization of writes/reads to acceleration structures is accomplished using UAV barriers.
{
D3D12_RESOURCE_STATES initialResourceState = D3D12_RESOURCE_STATE_RAYTRACING_ACCELERATION_STRUCTURE;
AllocateUAVBuffer(device, bottomLevelPrebuildInfo.ResultDataMaxSizeInBytes, &m_bottomLevelAccelerationStructure, initialResourceState, L"BottomLevelAccelerationStructure");
AllocateUAVBuffer(device, topLevelPrebuildInfo.ResultDataMaxSizeInBytes, &m_topLevelAccelerationStructure, initialResourceState, L"TopLevelAccelerationStructure");
}
ComPtr<ID3D12Resource> instanceDescs;
{
D3D12_RAYTRACING_INSTANCE_DESC instanceDesc = {};
instanceDesc.Transform[0][0] = instanceDesc.Transform[1][1] = instanceDesc.Transform[2][2] = 1;
instanceDesc.InstanceMask = 1;
instanceDesc.AccelerationStructure = m_bottomLevelAccelerationStructure->GetGPUVirtualAddress();
AllocateUploadBuffer(device, &instanceDesc, sizeof(instanceDesc), &instanceDescs, L"InstanceDescs");
}
// Bottom Level Acceleration Structure desc
{
bottomLevelBuildDesc.ScratchAccelerationStructureData = scratchResource->GetGPUVirtualAddress();
bottomLevelBuildDesc.DestAccelerationStructureData = m_bottomLevelAccelerationStructure->GetGPUVirtualAddress();
}
// Top Level Acceleration Structure desc
{
topLevelBuildDesc.DestAccelerationStructureData = m_topLevelAccelerationStructure->GetGPUVirtualAddress();
topLevelBuildDesc.ScratchAccelerationStructureData = scratchResource->GetGPUVirtualAddress();
topLevelBuildDesc.Inputs.InstanceDescs = instanceDescs->GetGPUVirtualAddress();
}
auto BuildAccelerationStructure = [&](auto* raytracingCommandList)
{
raytracingCommandList->BuildRaytracingAccelerationStructure(&bottomLevelBuildDesc, 0, nullptr);
commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::UAV(m_bottomLevelAccelerationStructure.Get()));
raytracingCommandList->BuildRaytracingAccelerationStructure(&topLevelBuildDesc, 0, nullptr);
};
BuildAccelerationStructure(m_dxrCommandList);
// Kick off acceleration structure construction.
m_deviceResources->ExecuteCommandList();
// Wait for GPU to finish as the locally created temporary GPU resources will get released once we go out of scope.
m_deviceResources->WaitForGpu();
}
// Build shader tables.
// This encapsulates all shader records - shaders and the arguments for their local root signatures.
void D3D12RaytracingLibrarySubobjects::BuildShaderTables()
{
auto device = m_deviceResources->GetD3DDevice();
void* rayGenShaderIdentifier;
void* missShaderIdentifier;
void* hitGroupShaderIdentifier;
auto GetShaderIdentifiers = [&](auto* stateObjectProperties)
{
rayGenShaderIdentifier = stateObjectProperties->GetShaderIdentifier(c_raygenShaderName);
missShaderIdentifier = stateObjectProperties->GetShaderIdentifier(c_missShaderName);
hitGroupShaderIdentifier = stateObjectProperties->GetShaderIdentifier(c_hitGroupName);
};
// Get shader identifiers.
UINT shaderIdentifierSize;
{
ComPtr<ID3D12StateObjectProperties> stateObjectProperties;
ThrowIfFailed(m_dxrStateObject.As(&stateObjectProperties));
GetShaderIdentifiers(stateObjectProperties.Get());
shaderIdentifierSize = D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES;
}
// Ray gen shader table
{
UINT numShaderRecords = 1;
UINT shaderRecordSize = shaderIdentifierSize;
ShaderTable rayGenShaderTable(device, numShaderRecords, shaderRecordSize, L"RayGenShaderTable");
rayGenShaderTable.push_back(ShaderRecord(rayGenShaderIdentifier, shaderIdentifierSize));
m_rayGenShaderTable = rayGenShaderTable.GetResource();
}
// Miss shader table
{
UINT numShaderRecords = 1;
UINT shaderRecordSize = shaderIdentifierSize;
ShaderTable missShaderTable(device, numShaderRecords, shaderRecordSize, L"MissShaderTable");
missShaderTable.push_back(ShaderRecord(missShaderIdentifier, shaderIdentifierSize));
m_missShaderTable = missShaderTable.GetResource();
}
// Hit group shader table
{
struct RootArguments {
CubeConstantBuffer cb;
} rootArguments;
rootArguments.cb = m_cubeCB;
UINT numShaderRecords = 1;
UINT shaderRecordSize = shaderIdentifierSize + sizeof(rootArguments);
ShaderTable hitGroupShaderTable(device, numShaderRecords, shaderRecordSize, L"HitGroupShaderTable");
hitGroupShaderTable.push_back(ShaderRecord(hitGroupShaderIdentifier, shaderIdentifierSize, &rootArguments, sizeof(rootArguments)));
m_hitGroupShaderTable = hitGroupShaderTable.GetResource();
}
}
// Update frame-based values.
void D3D12RaytracingLibrarySubobjects::OnUpdate()
{
m_timer.Tick();
CalculateFrameStats();
float elapsedTime = static_cast<float>(m_timer.GetElapsedSeconds());
auto frameIndex = m_deviceResources->GetCurrentFrameIndex();
auto prevFrameIndex = m_deviceResources->GetPreviousFrameIndex();
// Rotate the camera around Y axis.
{
float secondsToRotateAround = 24.0f;
float angleToRotateBy = 360.0f * (elapsedTime / secondsToRotateAround);
XMMATRIX rotate = XMMatrixRotationY(XMConvertToRadians(angleToRotateBy));
m_eye = XMVector3Transform(m_eye, rotate);
m_up = XMVector3Transform(m_up, rotate);
m_at = XMVector3Transform(m_at, rotate);
UpdateCameraMatrices();
}
// Rotate the second light around Y axis.
{
float secondsToRotateAround = 8.0f;
float angleToRotateBy = -360.0f * (elapsedTime / secondsToRotateAround);
XMMATRIX rotate = XMMatrixRotationY(XMConvertToRadians(angleToRotateBy));
const XMVECTOR& prevLightPosition = m_sceneCB[prevFrameIndex].lightPosition;
m_sceneCB[frameIndex].lightPosition = XMVector3Transform(prevLightPosition, rotate);
}
}
void D3D12RaytracingLibrarySubobjects::DoRaytracing()
{
auto commandList = m_deviceResources->GetCommandList();
auto frameIndex = m_deviceResources->GetCurrentFrameIndex();
auto DispatchRays = [&](auto* commandList, auto* stateObject, auto* dispatchDesc)
{
// Since each shader table has only one shader record, the stride is same as the size.
dispatchDesc->HitGroupTable.StartAddress = m_hitGroupShaderTable->GetGPUVirtualAddress();
dispatchDesc->HitGroupTable.SizeInBytes = m_hitGroupShaderTable->GetDesc().Width;
dispatchDesc->HitGroupTable.StrideInBytes = dispatchDesc->HitGroupTable.SizeInBytes;
dispatchDesc->MissShaderTable.StartAddress = m_missShaderTable->GetGPUVirtualAddress();
dispatchDesc->MissShaderTable.SizeInBytes = m_missShaderTable->GetDesc().Width;
dispatchDesc->MissShaderTable.StrideInBytes = dispatchDesc->MissShaderTable.SizeInBytes;
dispatchDesc->RayGenerationShaderRecord.StartAddress = m_rayGenShaderTable->GetGPUVirtualAddress();
dispatchDesc->RayGenerationShaderRecord.SizeInBytes = m_rayGenShaderTable->GetDesc().Width;
dispatchDesc->Width = m_width;
dispatchDesc->Height = m_height;
dispatchDesc->Depth = 1;
commandList->SetPipelineState1(stateObject);
commandList->DispatchRays(dispatchDesc);
};
auto SetCommonPipelineState = [&](auto* descriptorSetCommandList)
{
descriptorSetCommandList->SetDescriptorHeaps(1, m_descriptorHeap.GetAddressOf());
// Set index and successive vertex buffer decriptor tables
commandList->SetComputeRootDescriptorTable(GlobalRootSignatureParams::VertexBuffersSlot, m_indexBuffer.gpuDescriptorHandle);
commandList->SetComputeRootDescriptorTable(GlobalRootSignatureParams::OutputViewSlot, m_raytracingOutputResourceUAVGpuDescriptor);
};
commandList->SetComputeRootSignature(m_raytracingGlobalRootSignature.Get());
// Copy the updated scene constant buffer to GPU.
memcpy(&m_mappedConstantData[frameIndex].constants, &m_sceneCB[frameIndex], sizeof(m_sceneCB[frameIndex]));
auto cbGpuAddress = m_perFrameConstants->GetGPUVirtualAddress() + frameIndex * sizeof(m_mappedConstantData[0]);
commandList->SetComputeRootConstantBufferView(GlobalRootSignatureParams::SceneConstantSlot, cbGpuAddress);
// Bind the heaps, acceleration structure and dispatch rays.
D3D12_DISPATCH_RAYS_DESC dispatchDesc = {};
{
SetCommonPipelineState(commandList);
commandList->SetComputeRootShaderResourceView(GlobalRootSignatureParams::AccelerationStructureSlot, m_topLevelAccelerationStructure->GetGPUVirtualAddress());
DispatchRays(m_dxrCommandList, m_dxrStateObject.Get(), &dispatchDesc);
}
}
// Update the application state with the new resolution.
void D3D12RaytracingLibrarySubobjects::UpdateForSizeChange(UINT width, UINT height)
{
DXSample::UpdateForSizeChange(width, height);
}
// Copy the raytracing output to the backbuffer.
void D3D12RaytracingLibrarySubobjects::CopyRaytracingOutputToBackbuffer()
{
auto commandList= m_deviceResources->GetCommandList();
auto renderTarget = m_deviceResources->GetRenderTarget();
D3D12_RESOURCE_BARRIER preCopyBarriers[2];
preCopyBarriers[0] = CD3DX12_RESOURCE_BARRIER::Transition(renderTarget, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_DEST);
preCopyBarriers[1] = CD3DX12_RESOURCE_BARRIER::Transition(m_raytracingOutput.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE);
commandList->ResourceBarrier(ARRAYSIZE(preCopyBarriers), preCopyBarriers);
commandList->CopyResource(renderTarget, m_raytracingOutput.Get());
D3D12_RESOURCE_BARRIER postCopyBarriers[2];
postCopyBarriers[0] = CD3DX12_RESOURCE_BARRIER::Transition(renderTarget, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_PRESENT);
postCopyBarriers[1] = CD3DX12_RESOURCE_BARRIER::Transition(m_raytracingOutput.Get(), D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
commandList->ResourceBarrier(ARRAYSIZE(postCopyBarriers), postCopyBarriers);
}
// Create resources that are dependent on the size of the main window.
void D3D12RaytracingLibrarySubobjects::CreateWindowSizeDependentResources()
{
CreateRaytracingOutputResource();
UpdateCameraMatrices();
}
// Release resources that are dependent on the size of the main window.
void D3D12RaytracingLibrarySubobjects::ReleaseWindowSizeDependentResources()
{
m_raytracingOutput.Reset();
}
// Release all resources that depend on the device.
void D3D12RaytracingLibrarySubobjects::ReleaseDeviceDependentResources()
{
m_raytracingGlobalRootSignature.Reset();
m_dxrDevice.Reset();
m_dxrStateObject.Reset();
m_descriptorHeap.Reset();
m_descriptorsAllocated = 0;
m_raytracingOutputResourceUAVDescriptorHeapIndex = UINT_MAX;
m_indexBuffer.resource.Reset();
m_vertexBuffer.resource.Reset();
m_perFrameConstants.Reset();
m_rayGenShaderTable.Reset();
m_missShaderTable.Reset();
m_hitGroupShaderTable.Reset();
m_bottomLevelAccelerationStructure.Reset();
m_topLevelAccelerationStructure.Reset();
}
void D3D12RaytracingLibrarySubobjects::RecreateD3D()
{
// Give GPU a chance to finish its execution in progress.
try
{
m_deviceResources->WaitForGpu();
}
catch (HrException&)
{
// Do nothing, currently attached adapter is unresponsive.
}
m_deviceResources->HandleDeviceLost();
}
// Render the scene.
void D3D12RaytracingLibrarySubobjects::OnRender()
{
if (!m_deviceResources->IsWindowVisible())
{
return;
}
m_deviceResources->Prepare();
DoRaytracing();
CopyRaytracingOutputToBackbuffer();
m_deviceResources->Present(D3D12_RESOURCE_STATE_PRESENT);
}
void D3D12RaytracingLibrarySubobjects::OnDestroy()
{
// Let GPU finish before releasing D3D resources.
m_deviceResources->WaitForGpu();
OnDeviceLost();
}
// Release all device dependent resouces when a device is lost.
void D3D12RaytracingLibrarySubobjects::OnDeviceLost()
{
ReleaseWindowSizeDependentResources();
ReleaseDeviceDependentResources();
}
// Create all device dependent resources when a device is restored.
void D3D12RaytracingLibrarySubobjects::OnDeviceRestored()
{
CreateDeviceDependentResources();
CreateWindowSizeDependentResources();
}
// Compute the average frames per second and million rays per second.
void D3D12RaytracingLibrarySubobjects::CalculateFrameStats()
{
static int frameCnt = 0;
static double elapsedTime = 0.0f;
double totalTime = m_timer.GetTotalSeconds();
frameCnt++;
// Compute averages over one second period.
if ((totalTime - elapsedTime) >= 1.0f)
{
float diff = static_cast<float>(totalTime - elapsedTime);
float fps = static_cast<float>(frameCnt) / diff; // Normalize to an exact second.
frameCnt = 0;
elapsedTime = totalTime;
float MRaysPerSecond = (m_width * m_height * fps) / static_cast<float>(1e6);
wstringstream windowText;
windowText << setprecision(2) << fixed
<< L" fps: " << fps << L" ~Million Primary Rays/s: " << MRaysPerSecond
<< L" GPU[" << m_deviceResources->GetAdapterID() << L"]: " << m_deviceResources->GetAdapterDescription();
SetCustomWindowText(windowText.str().c_str());
}
}
// Handle OnSizeChanged message event.
void D3D12RaytracingLibrarySubobjects::OnSizeChanged(UINT width, UINT height, bool minimized)
{
if (!m_deviceResources->WindowSizeChanged(width, height, minimized))
{
return;
}
UpdateForSizeChange(width, height);
ReleaseWindowSizeDependentResources();
CreateWindowSizeDependentResources();
}
// Allocate a descriptor and return its index.
// If the passed descriptorIndexToUse is valid, it will be used instead of allocating a new one.
UINT D3D12RaytracingLibrarySubobjects::AllocateDescriptor(D3D12_CPU_DESCRIPTOR_HANDLE* cpuDescriptor, UINT descriptorIndexToUse)
{
auto descriptorHeapCpuBase = m_descriptorHeap->GetCPUDescriptorHandleForHeapStart();
if (descriptorIndexToUse >= m_descriptorHeap->GetDesc().NumDescriptors)
{
descriptorIndexToUse = m_descriptorsAllocated++;
}
*cpuDescriptor = CD3DX12_CPU_DESCRIPTOR_HANDLE(descriptorHeapCpuBase, descriptorIndexToUse, m_descriptorSize);
return descriptorIndexToUse;
}
// Create SRV for a buffer.
UINT D3D12RaytracingLibrarySubobjects::CreateBufferSRV(D3DBuffer* buffer, UINT numElements, UINT elementSize)
{
auto device = m_deviceResources->GetD3DDevice();
// SRV
D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
srvDesc.ViewDimension = D3D12_SRV_DIMENSION_BUFFER;
srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
srvDesc.Buffer.NumElements = numElements;
if (elementSize == 0)
{
srvDesc.Format = DXGI_FORMAT_R32_TYPELESS;
srvDesc.Buffer.Flags = D3D12_BUFFER_SRV_FLAG_RAW;
srvDesc.Buffer.StructureByteStride = 0;
}
else
{
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
srvDesc.Buffer.Flags = D3D12_BUFFER_SRV_FLAG_NONE;
srvDesc.Buffer.StructureByteStride = elementSize;
}
UINT descriptorIndex = AllocateDescriptor(&buffer->cpuDescriptorHandle);
device->CreateShaderResourceView(buffer->resource.Get(), &srvDesc, buffer->cpuDescriptorHandle);
buffer->gpuDescriptorHandle = CD3DX12_GPU_DESCRIPTOR_HANDLE(m_descriptorHeap->GetGPUDescriptorHandleForHeapStart(), descriptorIndex, m_descriptorSize);
return descriptorIndex;
}
|
SuperWangKai/DirectX-Graphics-Samples
|
Samples/Desktop/D3D12Raytracing/src/D3D12RaytracingLibrarySubobjects/D3D12RaytracingLibrarySubobjects.cpp
|
C++
|
mit
| 37,329
|
XCPRETTY := $(shell command -v xcpretty)
test: install repo_update
@set -e; \
for test in *_test.rb; do \
bundle exec ./$$test | $(XCPRETTY) -c; \
done
repo_update:
@bundle exec pod repo update --silent
install:
@bundle install --path gems
.PHONY: test install
|
hyperconnect/SQLite.swift
|
Tests/CocoaPods/Makefile
|
Makefile
|
mit
| 272
|
<?php
/**
* 后台管理 会员订单 生成类
* @category iCMS
* @package iCMS_FrameWork1_RuleClass_Gen_User
* @Author yin
*/
class UserOrderManageGen extends BaseManageGen implements IBaseManageGen{
/**
* 引导方法
* @return mixed|null|string 执行结果
*/
public function Gen(){
$result = "";
$method = Control::GetRequest("m", "");
switch($method){
case "async_create_offline_order":
$result = self::AsyncCreateOfflineOrder();
break;
case "async_renewal_offline_order_for_newspaper":
$result = self::AsyncRenewalOfflineOrderForNewspaper();
break;
case "modify":
$result = self::GenModify();
break;
case "list":
$result = self::GenList();
break;
case "list_for_search":
$result = self::GenListForSearch();
break;
case "print":
$result = self::GenPrint();
break;
case "export_excel":
$result = self::GenExportExcel();
break;
}
$result = str_ireplace("{method}", $method, $result);
return $result;
}
/**
* 修改
* @return mixed|string
*/
private function GenModify(){
$userOrderId = intval(Control::GetRequest("user_order_id",0));
$siteId = intval(Control::GetRequest("site_id",0));
$resultJavaScript = "";
if($userOrderId > 0 && $siteId > 0){
$templateContent = Template::Load("user/user_order_deal.html","common");
parent::ReplaceFirst($templateContent);
$pageSize = intval(Control::GetRequest("ps",0));
$tabIndex = intval(Control::GetRequest("tab_index",0));
$pageIndex = intval(Control::GetRequest("p",1));
$userOrderManageData = new UserOrderManageData();
$userOrderProductManageData = new UserOrderProductManageData();
$userReceiveInfoManageData = new UserReceiveInfoManageData();
if(!empty($_POST)){
$httpPostData = $_POST;
$closeTab = intval(Control::PostRequest("CloseTab",0));
$tabIndex = intval(Control::GetRequest("TabIndex",0));
$pageSize = intval(Control::GetRequest("PageSize",27));
$pageIndex = intval(Control::GetRequest("PageIndex",1));
$oldState = $userOrderManageData->GetState($userOrderId, false);
$result = $userOrderManageData->Modify($httpPostData,$userOrderId,$siteId);
//加入操作日志
if($result > 0){
$newState = intval(Control::PostRequest("f_State",0));
if (
$oldState != UserOrderData::STATE_CLOSE
&& $newState == UserOrderData::STATE_CLOSE){
/**
* @TODO 关闭交易时,要恢复库存
*/
$userOrderProductManageData = new UserOrderProductManageData();
$arrUserOrderProductList = $userOrderProductManageData->GetList($userOrderId,$siteId);
$productPriceManageData = new ProductPriceManageData();
for($i=0;$i<count($arrUserOrderProductList);$i++){
$productPriceId = $arrUserOrderProductList[$i]["ProductPriceId"];
$saleCount = $arrUserOrderProductList[$i]["SaleCount"];
$productPriceManageData->AddProductCount($productPriceId,$saleCount);
}
}
$operateContent = 'Modify UserOrder,POST FORM:'.implode('|',$_POST).';\r\nResult:'.$result;
self::CreateManageUserLog($operateContent);
$resultJavaScript .= Control::GetJqueryMessage(Language::Load('user_order', 3));
}else{
$resultJavaScript .= Control::GetJqueryMessage(Language::Load('user_order', 4));
}
if($closeTab == 1){
Control::GoUrl("/default.php?secu=manage&mod=user_order&m=list&site_id=".$siteId."&ps=".$pageSize."&p=".$pageIndex."&tab_index=".$tabIndex);
}else{
Control::GoUrl($_SERVER["PHP_SELF"]);
}
}
$arrUserOrderOne = $userOrderManageData->GetOne($userOrderId,$siteId);
$arrUserOrderProductList = $userOrderProductManageData->GetList($userOrderId,$siteId);
if(intval($arrUserOrderOne["UserId"]) > 0){
$userId = $arrUserOrderOne["UserId"];
$arrUserReceiveInfoList = $userReceiveInfoManageData->GetList($userId);
$tagUserReceiveInfoListId = "user_receive_info_list";
if(count($arrUserReceiveInfoList) > 0){
Template::ReplaceList($templateContent,$arrUserReceiveInfoList,$tagUserReceiveInfoListId);
}else{
Template::RemoveCustomTag($templateContent);
}
}
$tagUserOrderProductListId = "user_order_product_list";
if(count($arrUserOrderProductList) > 0){
Template::ReplaceList($templateContent,$arrUserOrderProductList,$tagUserOrderProductListId);
}else{
Template::RemoveCustomTag($templateContent);
}
if(count($arrUserOrderOne) > 0){
Template::ReplaceOne($templateContent,$arrUserOrderOne);
}else{
parent::ReplaceWhenCreate($templateContent,$userOrderManageData->GetFields());
}
$replace_arr = array(
"{TabIndex}" => $tabIndex,
"{PageSize}" => $pageSize,
"{PageIndex}" => $pageIndex,
"{SiteId}" => $siteId
);
$templateContent = strtr($templateContent,$replace_arr);
}
parent::ReplaceEnd($templateContent);
$templateContent = str_ireplace("{ResultJavascript}", $resultJavaScript, $templateContent);
return $templateContent;
}
/**
* 获取会员订单列表
* @return mixed|null|string
*/
private function GenList(){
$siteId = Control::GetRequest("site_id",0);
if($siteId > 0){
$pageIndex = Control::GetRequest("p",1);
$pageSize = Control::GetRequest("ps",27);
$templateContent = Template::Load("user/user_order_list.html","common");
$allCount = 0;
$pageBegin = ($pageIndex - 1) * $pageSize;
$userOrderManageData = new UserOrderManageData();
$arrUserOrderList = $userOrderManageData->GetList($siteId,$pageBegin,$pageSize,$allCount);
$tagId = "user_order_list";
if(count($arrUserOrderList) > 0){
$styleNumber = 1;
$pagerTemplate = Template::Load("pager/pager_style$styleNumber.html","common");
$isJs = FALSE;
$navUrl = "/default.php?secu=manage&mod=user_order&m=list&site_id=$siteId&p={0}&ps=$pageSize";
$jsFunctionName = "";
$jsParamList = "";
$pagerButton = Pager::ShowPageButton($pagerTemplate, $navUrl, $allCount, $pageSize, $pageIndex, $styleNumber, $isJs, $jsFunctionName, $jsParamList);
Template::ReplaceList($templateContent,$arrUserOrderList,$tagId);
$templateContent = str_ireplace("{pagerButton}", $pagerButton, $templateContent);
}else{
Template::RemoveCustomTag($templateContent, $tagId);
$templateContent = str_ireplace("{pagerButton}","", $templateContent);
}
$arrReplace = array(
"{SiteId}" => $siteId
);
$templateContent = strtr($templateContent,$arrReplace);
parent::ReplaceEnd($templateContent);
return $templateContent;
}else{
return null;
}
}
private function GenListForSearch(){
$siteId = Control::GetRequest("site_id",0);
if($siteId > 0){
$pageIndex = Control::GetRequest("p",1);
$pageSize = Control::GetRequest("ps",27);
$templateContent = Template::Load("user/user_order_list.html","common");
$allCount = 0;
$pageBegin = ($pageIndex - 1) * $pageSize;
$userOrderNumber = Control::GetRequest("user_order_number","");
$state = Control::GetRequest("state",0);
$beginDate = Control::GetRequest("begin_date","");
$endDate = Control::GetRequest("end_date","");
$searchKey = Control::GetRequest("search_key","");
$userOrderManageData = new UserOrderManageData();
$arrUserOrderList = $userOrderManageData->GetListForSearch($siteId,$userOrderNumber,$state,$beginDate,$endDate,$pageBegin,$pageSize,$allCount,$searchKey);
$tagId = "user_order_list";
if(count($arrUserOrderList) > 0){
$styleNumber = 1;
$pagerTemplate = Template::Load("pager/pager_style$styleNumber.html","common");
$isJs = FALSE;
$navUrl = "/default.php?secu=manage&mod=user_order&m=list_for_search&site_id=$siteId"
."&user_order_number=".$userOrderNumber."&state=".$state."&begin_date=".$beginDate
."&end_date=".$endDate."&p={0}&ps=$pageSize";
$jsFunctionName = "";
$jsParamList = "";
$pagerButton = Pager::ShowPageButton($pagerTemplate, $navUrl, $allCount, $pageSize, $pageIndex, $styleNumber, $isJs, $jsFunctionName, $jsParamList);
Template::ReplaceList($templateContent,$arrUserOrderList,$tagId);
$templateContent = str_ireplace("{pagerButton}", $pagerButton, $templateContent);
}else{
Template::RemoveCustomTag($templateContent, $tagId);
$templateContent = str_ireplace("{pagerButton}","", $templateContent);
}
$arrReplace = array(
"{SiteId}" => $siteId
);
$templateContent = strtr($templateContent,$arrReplace);
parent::ReplaceEnd($templateContent);
return $templateContent;
}else{
return null;
}
}
private function GenPrint(){
$userOrderId = Control::GetRequest("user_order_id",0);
$siteId = Control::GetRequest("site_id",0);
if($userOrderId > 0){
$templateContent = Template::Load("user/user_order_print.html","common");
parent::ReplaceFirst($templateContent);
$userOrderManageData = new UserOrderManageData();
$userOrderProductManageData = new UserOrderProductManageData();
$userReceiveInfoManageData = new UserReceiveInfoManageData();
$arrUserOrderOne = $userOrderManageData->GetOne($userOrderId,$siteId);
$arrUserOrderProductList = $userOrderProductManageData->GetList($userOrderId,$siteId);
$tagUserOrderProductListId = "user_order_product_list";
if(count($arrUserOrderProductList) > 0){
Template::ReplaceList($templateContent,$arrUserOrderProductList,$tagUserOrderProductListId);
}
if(intval($arrUserOrderOne["UserId"]) > 0){
$userReceiveInfoId = $arrUserOrderOne["UserReceiveInfoId"];
$arrUserReceiveInfoOne = $userReceiveInfoManageData->GetOne($userReceiveInfoId);
if(count($arrUserReceiveInfoOne) > 0){
Template::ReplaceOne($templateContent,$arrUserReceiveInfoOne);
}
}
if(count($arrUserOrderOne) > 0){
Template::ReplaceOne($templateContent,$arrUserOrderOne);
}
parent::ReplaceEnd($templateContent);
return $templateContent;
}else{
return null;
}
}
private function GenExportExcel(){
$beginDate = Control::GetRequest("begin_date", "");
$endDate = Control::GetRequest("end_date", "");
$siteId = Control::GetRequest("site_id",0);
if (strtotime($beginDate) <= strtotime($endDate)) {
$userOrderManageData = new UserOrderManageData();
$arrUserOrderListForExcel = $userOrderManageData->GetListForExportExcel($beginDate,$endDate,$siteId);
$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
$objActSheet = $objPHPExcel->getActiveSheet(0);
$key = ord("A");
$arrUserOrderListHeader = array(
"订单ID",
"订单创建时间",
"商品ID",
"商品标题",
"商品价格",
"购买总数量",
"小计",
"买家实际支付金额",
"订单状态",
"商家编码",
"买家会员名",
"收货人姓名",
"联系电话",
"收货人地区",
"收货地址",
"订单付款时间"
);
for ($i = 0; $i < count($arrUserOrderListHeader); $i++) {
$column = chr($key);
$objActSheet->setCellValue($column . '1', $arrUserOrderListHeader[$i]);
$objActSheet->getColumnDimension($column)->setAutoSize(true);
$key ++;
}
$column_content = 2;
for ($j = 0; $j < count($arrUserOrderListForExcel); $j++) {
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("A" . strval($column_content), $arrUserOrderListForExcel[$j]["UserOrderId"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("B" . strval($column_content), $arrUserOrderListForExcel[$j]["CreateDate"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("C" . strval($column_content), $arrUserOrderListForExcel[$j]["ProductId"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("D" . strval($column_content), $arrUserOrderListForExcel[$j]["ProductName"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("E" . strval($column_content), $arrUserOrderListForExcel[$j]["ProductPrice"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("F" . strval($column_content), $arrUserOrderListForExcel[$j]["SaleCount"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("G" . strval($column_content), $arrUserOrderListForExcel[$j]["SubTotal"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("H" . strval($column_content), $arrUserOrderListForExcel[$j]["PayPrice"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("I" . strval($column_content), $arrUserOrderListForExcel[$j]["State"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("J" . strval($column_content), $arrUserOrderListForExcel[$j]["ProductTag"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("K" . strval($column_content), $arrUserOrderListForExcel[$j]["UserName"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("L" . strval($column_content), $arrUserOrderListForExcel[$j]["ReceivePersonName"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("N" . strval($column_content), $arrUserOrderListForExcel[$j]["Mobile"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("M" . strval($column_content), $arrUserOrderListForExcel[$j]["District"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("O" . strval($column_content), $arrUserOrderListForExcel[$j]["Address"]);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("P" . strval($column_content), $arrUserOrderListForExcel[$j]["PayDate"]);
$column_content++;
}
$fileName = $beginDate."--".$endDate."-".time()."test.xls";
$fileName = iconv("utf-8", "gb2312", $fileName);
//将输出重定向到一个客户端web浏览器(Excel2007)
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
header('Pragma:public');
header('Expires:0');
header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
header('Content-Type:application/force-download');
header('Content-Type:application/vnd.ms-excel');
header('Content-Type:application/octet-stream');
header('Content-Type:application/download');
header('Content-Disposition:attachment;filename=' . $fileName);
header('Content-Transfer-Encoding:binary');
$objWriter->save('php://output');
}
return "";
}
/**
* 新增线下订单
* @return int
*/
private function AsyncCreateOfflineOrder(){
$result=-1;
$siteId=Control::GetRequest("site_id",0);
$manageUserId=Control::GetManageUserId();
/** 检查权限 **/
$manageUserAuthorityManageData=new ManageUserAuthorityManageData();
//$can=$manageUserAuthorityManageData->CanUserOrder
//if(!$can){
// return -10;//无权限
//}
$userName = Control::PostOrGetRequest("user_name","");
$realName = Control::PostOrGetRequest("real_name","");
$userManageData=new UserManageData;
$userOrderNewspaperManageData=new UserOrderNewspaperManageData();
if ($userName != ""&&$siteId>0)
{
//检测用户名是否重复
$newUserId=0;
$repeatUserId=$userManageData->CheckRepeat($userName);
if ($repeatUserId <= 0)
{ //生成新用户
$httpPostData=array();
$httpPostData["f_UserName"]=$userName;
$httpPostData["f_UserPass"]="123654888";
$newUserId=$userManageData->Create($httpPostData,$siteId);
if($newUserId>0){
//生成用户信息表
$userInfoManageData=new UserInfoManageData;
$userInfoId=$userInfoManageData->CreateForOfflineOrder($newUserId,$realName);
if($userInfoId<0){
$result=-3;//用户信息新建失败
return Control::GetRequest("jsonpcallback","").'({"result":"'.$result.'"})';
}
//挂接用户到对应用户组
$userRoleManageData=new UserRoleManageData();
$userGroupId = 12; //线下支付电子报
$userRoleId=$userRoleManageData->CreateOrModify($newUserId,$userGroupId,$siteId);
if($userRoleId<0){
$result= -4;//用户组挂接失败
return Control::GetRequest("jsonpcallback","").'({"result":"'.$result.'"})';
}
}else{
$result = -2; //用户新建失败
return Control::GetRequest("jsonpcallback","").'({"result":"'.$result.'"})';
}
}else{
//已存在用户,检查是否已有报纸订单
$userOrderNewspaperArray=$userOrderNewspaperManageData->GetOrderOfUser($repeatUserId);
if(count($userOrderNewspaperArray)>0){
$result = 10; //已有订单
return Control::GetRequest("jsonpcallback","").
'({"result":"'.$result.'","result_data":'.json_encode($userOrderNewspaperArray).'})';
}
}
//插入用户订单表
$userOrderTableType=1;//电子报类型订单
$userOrderNumber = UserOrderData::GenUserOrderNumber();
$allPrice = 72.00;//一个订单的总价
$userOrderState = 20;//已付款,未发货
$userOrderManageData=new UserOrderManageData();
$createDate=strval(date('Y-m-d H:i:s', time()));
$userOrderId=$userOrderManageData->CreateForOfflineOrder($userOrderNumber,$createDate,$newUserId,$allPrice,$userOrderState,$siteId,$userOrderTableType);
if($userOrderId<0){
$result = -11;//获取订单失败
return Control::GetRequest("jsonpcallback","").'({"result":"'.$result.'"})';
}
//插入报纸订单表
$channelId = 15;//电子报所在频道id
$salePrice = 72.00;//订单支付金额
$beginDate = "2016-1-1";
$endDate = "2016-12-31";
$userOrderNewspaperId=$userOrderNewspaperManageData->CreateForOfflineOrder($siteId,$channelId,$userOrderId,$newUserId,$createDate,$salePrice,$beginDate,$endDate);
if($userOrderNewspaperId<0){
$result = -12;//获取报纸订单失败
return Control::GetRequest("jsonpcallback","").'({"result":"'.$result.'"})';
}
//插入支付表
$httpPostData=array();
$httpPostData["f_PayPrice"]=72.00;//实际支付金额;
$httpPostData["f_PayDate"]=$createDate;//"2015-12-31";//;
$httpPostData["f_PayWay"]="线下统一支付";//;
$userOrderPayManageData=new UserOrderPayManageData();
$userOrderPayId=$userOrderPayManageData->Create($httpPostData,$userOrderId,$manageUserId);
if($userOrderPayId<0){
$result = -13;//获取支付id失败
return Control::GetRequest("jsonpcallback","").'({"result":"'.$result.'"})';
}
}
else{
$result = -1; //user id错误
return Control::GetRequest("jsonpcallback","").'({"result":"'.$result.'"})';
}
$result = 1;
return Control::GetRequest("jsonpcallback","").'({"result":"'.$result.'"})';
}
/**
* 更新报纸续期
* @return int
*/
private function AsyncRenewalOfflineOrderForNewspaper(){
$result=-1;
$userId = Control::PostOrGetRequest("user_id","");
$siteId = Control::PostOrGetRequest("site_id","");
$manageUserId = Control::PostOrGetRequest("manage_user_id","");
$userOrderNewspaperId = Control::PostOrGetRequest("user_order_newspaper_id","");
if($userId>0&&$userOrderNewspaperId>0){
//插入用户订单表
$userOrderTableType=1;//电子报类型订单
$userOrderNumber = UserOrderData::GenUserOrderNumber();
$allPrice = 72.00;//一个订单的总价
$userOrderState = 20;//已付款,未发货
$userOrderManageData=new UserOrderManageData();
$createDate=strval(date('Y-m-d H:i:s', time()));
$userOrderId=$userOrderManageData->CreateForOfflineOrder($userOrderNumber,$createDate,$userId,$allPrice,$userOrderState,$siteId,$userOrderTableType);
if($userOrderId<0){
$result = -11;//获取订单失败
return Control::GetRequest("jsonpcallback","").'({"result":"'.$result.'"})';
}
//插入支付表
$httpPostData=array();
$httpPostData["f_PayPrice"]=72.00;//实际支付金额;
$httpPostData["f_PayDate"]=$createDate;//"2015-12-31";//;
$httpPostData["f_PayWay"]="线下统一支付";//;
$userOrderPayManageData=new UserOrderPayManageData();
$userOrderPayId=$userOrderPayManageData->Create($httpPostData,$userOrderId,$manageUserId);
if($userOrderPayId<0){
//失败 删除新建的订单
$httpPostData=array();
$httpPostData["f_State"]=100;
$userOrderManageData->Modify($httpPostData,$userOrderId,$siteId);
$result = -13;//获取支付id失败
return Control::GetRequest("jsonpcallback","").'({"result":"'.$result.'"})';
}
//更新报纸订单表
$userOrderNewspaperManageData=new UserOrderNewspaperManageData();
$userOrderNewspaperInfoArray=$userOrderNewspaperManageData->GetInfoForUpdate($userOrderNewspaperId);
$lastEndDate=$userOrderNewspaperInfoArray["EndDate"];
$lastEndDateArray=explode("-",$lastEndDate);
if(!empty($lastEndDateArray)){
$year=$lastEndDateArray[0]+1; //加一年
$salePrice = 72.00+$userOrderNewspaperInfoArray["SalePrice"];//订单支付金额增加
$endDate = $year."-12-31";
$result=$userOrderNewspaperManageData->UpdateOrderForRenewal($userOrderNewspaperId,$userOrderId,$salePrice,$endDate);
}
if($result<0){
//失败 删除新建的订单
$httpPostData=array();
$httpPostData["f_State"]=100;
$userOrderManageData->Modify($httpPostData,$userOrderId,$siteId);
$userOrderPayManageData->Modify($httpPostData,$userOrderPayId);
$result = -12;//获取报纸订单失败
return Control::GetRequest("jsonpcallback","").'({"result":"'.$result.'"})';
}
}
return Control::GetRequest("jsonpcallback","").'({"result":"'.$result.'"})';
}
}
|
Daisukydayo/icms2
|
FrameWork1/RuleClass/Gen/User/UserOrderManageGen.php
|
PHP
|
mit
| 25,598
|
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Insights\V1\Call;
use Twilio\ListResource;
use Twilio\Options;
use Twilio\Stream;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class EventList extends ListResource {
/**
* Construct the EventList
*
* @param Version $version Version that contains the resource
* @param string $callSid The call_sid
*/
public function __construct(Version $version, string $callSid) {
parent::__construct($version);
// Path Solution
$this->solution = ['callSid' => $callSid, ];
$this->uri = '/Voice/' . \rawurlencode($callSid) . '/Events';
}
/**
* Streams EventInstance records from the API as a generator stream.
* This operation lazily loads records as efficiently as possible until the
* limit
* is reached.
* The results are returned as a generator, so this operation is memory
* efficient.
*
* @param array|Options $options Optional Arguments
* @param int $limit Upper limit for the number of records to return. stream()
* guarantees to never return more than limit. Default is no
* limit
* @param mixed $pageSize Number of records to fetch per request, when not set
* will use the default value of 50 records. If no
* page_size is defined but a limit is defined, stream()
* will attempt to read the limit with the most
* efficient page size, i.e. min(limit, 1000)
* @return Stream stream of results
*/
public function stream(array $options = [], int $limit = null, $pageSize = null): Stream {
$limits = $this->version->readLimits($limit, $pageSize);
$page = $this->page($options, $limits['pageSize']);
return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
}
/**
* Reads EventInstance records from the API as a list.
* Unlike stream(), this operation is eager and will load `limit` records into
* memory before returning.
*
* @param array|Options $options Optional Arguments
* @param int $limit Upper limit for the number of records to return. read()
* guarantees to never return more than limit. Default is no
* limit
* @param mixed $pageSize Number of records to fetch per request, when not set
* will use the default value of 50 records. If no
* page_size is defined but a limit is defined, read()
* will attempt to read the limit with the most
* efficient page size, i.e. min(limit, 1000)
* @return EventInstance[] Array of results
*/
public function read(array $options = [], int $limit = null, $pageSize = null): array {
return \iterator_to_array($this->stream($options, $limit, $pageSize), false);
}
/**
* Retrieve a single page of EventInstance records from the API.
* Request is executed immediately
*
* @param array|Options $options Optional Arguments
* @param mixed $pageSize Number of records to return, defaults to 50
* @param string $pageToken PageToken provided by the API
* @param mixed $pageNumber Page Number, this value is simply for client state
* @return EventPage Page of EventInstance
*/
public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EventPage {
$options = new Values($options);
$params = Values::of([
'Edge' => $options['edge'],
'PageToken' => $pageToken,
'Page' => $pageNumber,
'PageSize' => $pageSize,
]);
$response = $this->version->page('GET', $this->uri, $params);
return new EventPage($this->version, $response, $this->solution);
}
/**
* Retrieve a specific page of EventInstance records from the API.
* Request is executed immediately
*
* @param string $targetUrl API-generated URL for the requested results page
* @return EventPage Page of EventInstance
*/
public function getPage(string $targetUrl): EventPage {
$response = $this->version->getDomain()->getClient()->request(
'GET',
$targetUrl
);
return new EventPage($this->version, $response, $this->solution);
}
/**
* Provide a friendly representation
*
* @return string Machine friendly representation
*/
public function __toString(): string {
return '[Twilio.Insights.V1.EventList]';
}
}
|
twilio/twilio-php
|
src/Twilio/Rest/Insights/V1/Call/EventList.php
|
PHP
|
mit
| 5,044
|
module Elasticsearch
module Provider
module Childs
class Child
attr_accessor :index_name, :document_type, :document_mapping,
:parent_id, :id
include Elasticsearch::Provider::Client::ClassMethods
include Elasticsearch::Provider::Document::ClassMethods
include Elasticsearch::Provider::Request::Search::ClassMethods
include Elasticsearch::Provider::Request::Delete::ClassMethods
include Elasticsearch::Provider::Request::Create::ClassMethods
include Elasticsearch::Provider::Request::Update::ClassMethods
include Elasticsearch::Provider::Response::Results
def initialize
@object_tree = {}
end
def all
search({parent: parent_id}).results._source
rescue Elasticsearch::Transport::Transport::Errors::NotFound
[]
end
def release
object = Elasticsearch::Provider::Childs::Child.new
object.document_mapping = document_mapping
object.document_type = document_type
object.index_name = index_name
object.parent_id = parent_id
object.id = id
object
end
def save
_document = {}
@object_tree.each { |key, item|
_document[key] = item.object_value
}
document(_document)
begin
search({parent: parent_id})
update({parent: parent_id})
rescue Elasticsearch::Transport::Transport::Errors::NotFound
super({parent: parent_id})
end
end
def delete
super({parent: parent_id})
end
def select(name)
search({parent: id}).results._source[name]
rescue Elasticsearch::Transport::Transport::Errors::NotFound
end
def method_missing(method_name, *args, &block)
_mapping =
document_mapping[index_name]['mappings'][document_type]['properties']
if method_name[-1..-1] == '='
operation = '='
method_name = method_name[0..-2]
end
if _mapping.has_key?(method_name.to_s)
_current = _mapping[method_name.to_s]
_object = Object.const_get(
"Elasticsearch::Provider::Childs::#{_current['type'].capitalize}"
).new
_object.object_name = method_name
_object.object_mapping = {method_name => _current}
@object_tree[method_name.to_s] = _object
if operation.nil?
select(method_name.to_s)
else
_object.assignment(*args) if operation == '='
end
else
super
end
end
end
end
end
end
|
umount/elasticsearch-dslr
|
lib/elasticsearch/provider/childs/class.rb
|
Ruby
|
mit
| 2,769
|
#include "UnrealCVPrivate.h"
#include "TcpServer.h"
#include "Networking.h"
#include <string>
uint32 FSocketMessageHeader::DefaultMagic = 0x9E2B83C1;
bool FSocketMessageHeader::WrapAndSendPayload(const TArray<uint8>& Payload, FSocket* Socket)
{
FSocketMessageHeader Header(Payload);
FBufferArchive Ar;
Ar << Header.Magic;
Ar << Header.PayloadSize;
Ar.Append(Payload);
int32 AmountSent;
Socket->Send(Ar.GetData(), Ar.Num(), AmountSent);
if (AmountSent != Ar.Num())
{
UE_LOG(LogUnrealCV, Error, TEXT("Unable to send."));
return false;
}
return true;
}
/* Waiting for data, return false only when disconnected */
bool SocketReceiveAll(FSocket* Socket, uint8* Result, int32 ExpectedSize)
{
int32 Offset = 0;
while (ExpectedSize > 0)
{
// uint32 PendingDataSize;
// bool Status = Socket->HasPendingData(PendingDataSize);
// status = PendingDataSize != 0
int32 NumRead = 0;
bool RecvStatus = Socket->Recv(Result + Offset, ExpectedSize, NumRead);
// bool RecvStatus = Socket->Recv(Result + Offset, ExpectedSize, NumRead, ESocketReceiveFlags::WaitAll);
// WaitAll is not effective for non-blocking socket, see here https://msdn.microsoft.com/en-us/library/windows/desktop/ms740121(v=vs.85).aspx
// Check pending data first, see https://msdn.microsoft.com/en-us/library/windows/desktop/ms738573(v=vs.85).aspx
// ESocketConnectionState ConnectionState = Socket->GetConnectionState();
// check(NumRead <= ExpectedSize);
// RecvStatus == BytesRead >= 0
check(NumRead <= ExpectedSize);
ESocketErrors LastError = ISocketSubsystem::Get()->GetLastErrorCode();
// Use this check instead of use return status of recv to ensure backward compatibility
// Because there is a bug with 4.12 FSocketBSD implementation
// https://www.unrealengine.com/blog/unreal-engine-4-13-released, Search FSocketBSD::Recv
if (NumRead == 0 && LastError == ESocketErrors::SE_NO_ERROR) // 0 means gracefully closed
{
UE_LOG(LogUnrealCV, Log, TEXT("The connection is gracefully closed by the client."));
return false; // Socket is disconnected. if -1, keep waiting for data
}
if (NumRead == 0 && LastError == ESocketErrors::SE_EWOULDBLOCK)
{
continue; // No data and keep waiting
}
if (LastError == ESocketErrors::SE_NO_ERROR || LastError == ESocketErrors::SE_EWOULDBLOCK)
{
// Got some data and in an expected condition
Offset += NumRead;
ExpectedSize -= NumRead;
continue;
}
// LastError == ESocketErrors::SE_EWOULDBLOCK means running a non-block socket."));
if (LastError == ESocketErrors::SE_ECONNABORTED) // SE_ECONNABORTED
{
UE_LOG(LogUnrealCV, Error, TEXT("Connection aborted unexpectly."));
return false;
}
const TCHAR* LastErrorMsg = ISocketSubsystem::Get()->GetSocketError(LastError);
UE_LOG(LogUnrealCV, Error, TEXT("Expected error of socket happend, error %s"), LastErrorMsg);
return false;
}
return true;
}
bool FSocketMessageHeader::ReceivePayload(FArrayReader& OutPayload, FSocket* Socket)
{
TArray<uint8> HeaderBytes;
int32 Size = sizeof(FSocketMessageHeader);
HeaderBytes.AddZeroed(Size);
if (!SocketReceiveAll(Socket, HeaderBytes.GetData(), Size))
{
// false here means socket disconnected.
// UE_LOG(LogUnrealCV, Error, TEXT("Unable to read header, Socket disconnected."));
UE_LOG(LogUnrealCV, Log, TEXT("Client disconnected."));
return false;
}
FMemoryReader Reader(HeaderBytes);
uint32 Magic;
Reader << Magic;
if (Magic != FSocketMessageHeader::DefaultMagic)
{
UE_LOG(LogUnrealCV, Error, TEXT("Bad network header magic"));
return false;
}
uint32 PayloadSize;
Reader << PayloadSize;
if (!PayloadSize)
{
UE_LOG(LogUnrealCV, Error, TEXT("Empty payload"));
return false;
}
int32 PayloadOffset = OutPayload.AddUninitialized(PayloadSize);
OutPayload.Seek(PayloadOffset);
if (!SocketReceiveAll(Socket, OutPayload.GetData() + PayloadOffset, PayloadSize))
{
UE_LOG(LogUnrealCV, Error, TEXT("Unable to read full payload, Socket disconnected."));
return false;
}
// Skip CRC checking in FNFSMessageHeader
return true;
}
// TODO: Wrap these two functions into a class
FString StringFromBinaryArray(const TArray<uint8>& BinaryArray)
{
std::string cstr(reinterpret_cast<const char*>(BinaryArray.GetData()), BinaryArray.Num());
return FString(cstr.c_str());
}
void BinaryArrayFromString(const FString& Message, TArray<uint8>& OutBinaryArray)
{
FTCHARToUTF8 Convert(*Message);
OutBinaryArray.Empty();
// const TArray<TCHAR>& CharArray = Message.GetCharArray();
// OutBinaryArray.Append(CharArray);
// This can work, but will add tailing \0 also behavior is not well defined.
OutBinaryArray.Append((UTF8CHAR*)Convert.Get(), Convert.Length());
}
bool UNetworkManager::IsConnected()
{
return (this->ConnectionSocket != NULL);
}
/* Provide a dummy echo service to echo received data back for development purpose */
bool UNetworkManager::StartEchoService(FSocket* ClientSocket, const FIPv4Endpoint& ClientEndpoint)
{
if (!this->ConnectionSocket) // Only maintain one active connection, So just reuse the TCPListener thread.
{
UE_LOG(LogUnrealCV, Warning, TEXT("New client connected from %s"), *ClientEndpoint.ToString());
// ClientSocket->SetNonBlocking(false); // When this in blocking state, I can not use this socket to send message back
ConnectionSocket = ClientSocket;
// Listening data here or start a new thread for data?
// Reuse the TCP Listener thread for getting data, only support one connection
uint32 BufferSize = 1024;
int32 Read = 0;
TArray<uint8> ReceivedData;
ReceivedData.SetNumZeroed(BufferSize);
while (1)
{
// Easier to use raw FSocket here, need to detect remote socket disconnection
bool RecvStatus = ClientSocket->Recv(ReceivedData.GetData(), ReceivedData.Num(), Read);
// if (!RecvStatus) // The connection is broken
if (Read == 0)
// RecvStatus == true if Read >= 0, this is used to determine client disconnection
// -1 means no data, 0 means disconnected
{
ConnectionSocket = NULL; // Use this to determine whether client is connected
return false;
}
int32 Sent;
ClientSocket->Send(ReceivedData.GetData(), Read, Sent); // Echo the message back
check(Read == Sent);
}
return true;
}
return false;
}
/**
* Start message service in listening thread
* TODO: Start a new background thread to receive message
*/
bool UNetworkManager::StartMessageService(FSocket* ClientSocket, const FIPv4Endpoint& ClientEndpoint)
{
if (!this->ConnectionSocket)
{
ConnectionSocket = ClientSocket;
UE_LOG(LogUnrealCV, Warning, TEXT("New client connected from %s"), *ClientEndpoint.ToString());
// ClientSocket->SetNonBlocking(false); // When this in blocking state, I can not use this socket to send message back
FString Confirm = FString::Printf(TEXT("connected to %s"), FApp::GetGameName());
bool IsSent = this->SendMessage(Confirm); // Send a hello message
if (!IsSent)
{
UE_LOG(LogUnrealCV, Error, TEXT("Failed to send welcome message to client."));
}
// TODO: Start a new thread
while (this->ConnectionSocket) // Listening thread, while the client is still connected
{
FArrayReader ArrayReader;
if (!FSocketMessageHeader::ReceivePayload(ArrayReader, ConnectionSocket))
// Wait forever until got a message, or return false when error happened
{
this->ConnectionSocket = NULL;
return false; // false will release the ClientSocket
break; // Remote socket disconnected
}
FString Message = StringFromBinaryArray(ArrayReader);
BroadcastReceived(Message);
// Fire raw message received event, use message id to connect request and response
UE_LOG(LogUnrealCV, Warning, TEXT("Receive message %s"), *Message);
}
return false; // TODO: What is the meaning of return value?
}
else
{
// No response and let the client silently timeout
UE_LOG(LogUnrealCV, Warning, TEXT("Only one client is allowed, can not allow new connection from %s"), *ClientEndpoint.ToString());
return false; // Already have a connection
}
}
/** Connected Handler */
bool UNetworkManager::Connected(FSocket* ClientSocket, const FIPv4Endpoint& ClientEndpoint)
{
bool ServiceStatus = false;
// ServiceStatus = StartEchoService(ClientSocket, ClientEndpoint);
ServiceStatus = StartMessageService(ClientSocket, ClientEndpoint);
return ServiceStatus;
// This is a blocking service, if need to support multiple connections, consider start a new thread here.
}
bool UNetworkManager::Start(int32 InPortNum) // Restart the server if configuration changed
{
if (InPortNum == this->PortNum && this->bIsListening) return true; // Already started
if (ConnectionSocket) // Release previous connection
{
ConnectionSocket->Close();
ConnectionSocket = NULL;
}
if (TcpListener) // Delete previous configuration first
{
UE_LOG(LogUnrealCV, Warning, TEXT("Stop previous server"));
TcpListener->Stop(); // TODO: test the robustness, will this operation successful?
delete TcpListener;
}
this->PortNum = InPortNum; // Start a new TCPListener
FIPv4Address IPAddress = FIPv4Address(0, 0, 0, 0);
// int32 PortNum = this->PortNum; // Make this configuable
FIPv4Endpoint Endpoint(IPAddress, PortNum);
FSocket* ServerSocket = FTcpSocketBuilder(TEXT("FTcpListener server")) // TODO: Need to realease this socket
// .AsReusable()
.BoundToEndpoint(Endpoint)
.Listening(8);
if (ServerSocket)
{
int32 NewSize = 0;
ServerSocket->SetReceiveBufferSize(2 * 1024 * 1024, NewSize);
}
else
{
this->bIsListening = false;
UE_LOG(LogUnrealCV, Warning, TEXT("Can not start listening on port %d, Port might be in use"), PortNum);
return false;
}
TcpListener = new FTcpListener(*ServerSocket);
// TcpListener = new FTcpListener(Endpoint); // This will be released after start
// In FSocket, when a FSocket is set as reusable, it means SO_REUSEADDR, not SO_REUSEPORT. see SocketsBSD.cpp
TcpListener->OnConnectionAccepted().BindUObject(this, &UNetworkManager::Connected);
if (TcpListener->Init())
{
this->bIsListening = true;
UE_LOG(LogUnrealCV, Warning, TEXT("Start listening on %d"), PortNum);
return true;
}
else
{
this->bIsListening = false;
UE_LOG(LogUnrealCV, Error, TEXT("Can not start listening on port %d"), PortNum);
return false;
}
}
bool UNetworkManager::SendMessage(const FString& Message)
{
if (ConnectionSocket)
{
TArray<uint8> Payload;
BinaryArrayFromString(Message, Payload);
FSocketMessageHeader::WrapAndSendPayload(Payload, ConnectionSocket);
return true;
}
return false;
}
bool UNetworkManager::SendData(const TArray<uint8>& Payload)
{
if (ConnectionSocket)
{
FSocketMessageHeader::WrapAndSendPayload(Payload, ConnectionSocket);
return true;
}
return false;
}
UNetworkManager::~UNetworkManager()
{
if (ConnectionSocket)
{
ConnectionSocket->Close();
}
delete TcpListener;
}
|
Ized06/GID_Internal
|
built/Source/UnrealCV/Private/TcpServer.cpp
|
C++
|
mit
| 10,835
|
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.sql.v2017_03_01_preview.implementation;
import java.util.List;
import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaselineItem;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.rest.serializer.JsonFlatten;
import com.microsoft.azure.ProxyResource;
/**
* A database vulnerability assessment rule baseline.
*/
@JsonFlatten
public class DatabaseVulnerabilityAssessmentRuleBaselineInner extends ProxyResource {
/**
* The rule baseline result.
*/
@JsonProperty(value = "properties.baselineResults", required = true)
private List<DatabaseVulnerabilityAssessmentRuleBaselineItem> baselineResults;
/**
* Get the rule baseline result.
*
* @return the baselineResults value
*/
public List<DatabaseVulnerabilityAssessmentRuleBaselineItem> baselineResults() {
return this.baselineResults;
}
/**
* Set the rule baseline result.
*
* @param baselineResults the baselineResults value to set
* @return the DatabaseVulnerabilityAssessmentRuleBaselineInner object itself.
*/
public DatabaseVulnerabilityAssessmentRuleBaselineInner withBaselineResults(List<DatabaseVulnerabilityAssessmentRuleBaselineItem> baselineResults) {
this.baselineResults = baselineResults;
return this;
}
}
|
selvasingh/azure-sdk-for-java
|
sdk/sql/mgmt-v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java
|
Java
|
mit
| 1,627
|
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
import re
import os.path
from io import open
from setuptools import find_packages, setup
try:
from azure_bdist_wheel import cmdclass
except ImportError:
from distutils import log as logger
logger.warn("Wheel is not available, disabling bdist_wheel hook")
cmdclass = {}
# Change the PACKAGE_NAME only to change folder and different name
PACKAGE_NAME = "azure-cognitiveservices-vision-face"
PACKAGE_PPRINT_NAME = "Cognitive Services Face"
# a-b-c => a/b/c
package_folder_path = PACKAGE_NAME.replace('-', '/')
# a-b-c => a.b.c
namespace_name = PACKAGE_NAME.replace('-', '.')
# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
try:
import azure
try:
ver = azure.__version__
raise Exception(
'This package is incompatible with azure=={}. '.format(ver) +
'Uninstall it with "pip uninstall azure".'
)
except AttributeError:
pass
except ImportError:
pass
# Version extraction inspired from 'requests'
with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
if not version:
raise RuntimeError('Cannot find version information')
with open('README.rst', encoding='utf-8') as f:
readme = f.read()
with open('HISTORY.rst', encoding='utf-8') as f:
history = f.read()
setup(
name=PACKAGE_NAME,
version=version,
description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME),
long_description=readme + '\n\n' + history,
license='MIT License',
author='Microsoft Corporation',
author_email='azpysdkhelp@microsoft.com',
url='https://github.com/Azure/azure-sdk-for-python',
classifiers=[
'Development Status :: 4 - Beta',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
packages=find_packages(exclude=["tests"]),
install_requires=[
'msrest>=0.4.24,<2.0.0',
'azure-common~=1.1',
],
cmdclass=cmdclass
)
|
lmazuel/azure-sdk-for-python
|
azure-cognitiveservices-vision-face/setup.py
|
Python
|
mit
| 2,837
|
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/><!-- using block title in layout.dt--><!-- using block ddox.defs in ddox.layout.dt--><!-- using block ddox.title in ddox.layout.dt-->
<title>Field AssetManager.unitSquare</title>
<link rel="stylesheet" type="text/css" href="../../styles/ddox.css"/>
<link rel="stylesheet" href="../../prettify/prettify.css" type="text/css"/>
<script type="text/javascript" src="../../scripts/jquery.js">/**/</script>
<script type="text/javascript" src="../../prettify/prettify.js">/**/</script>
<script type="text/javascript" src="../../scripts/ddox.js">/**/</script>
</head>
<body onload="prettyPrint(); setupDdox();">
<nav id="main-nav"><!-- using block navigation in layout.dt-->
<ul class="tree-view">
<li class=" tree-view">
<a href="#" class="package">components</a>
<ul class="tree-view">
<li>
<a href="../../components/animation.html" class=" module">animation</a>
</li>
<li>
<a href="../../components/assets.html" class="selected module">assets</a>
</li>
<li>
<a href="../../components/behavior.html" class=" module">behavior</a>
</li>
<li>
<a href="../../components/camera.html" class=" module">camera</a>
</li>
<li>
<a href="../../components/icomponent.html" class=" module">icomponent</a>
</li>
<li>
<a href="../../components/lights.html" class=" module">lights</a>
</li>
<li>
<a href="../../components/material.html" class=" module">material</a>
</li>
<li>
<a href="../../components/mesh.html" class=" module">mesh</a>
</li>
<li>
<a href="../../components/userinterface.html" class=" module">userinterface</a>
</li>
</ul>
</li>
<li class="collapsed tree-view">
<a href="#" class="package">core</a>
<ul class="tree-view">
<li>
<a href="../../core/dgame.html" class=" module">dgame</a>
</li>
<li>
<a href="../../core/gameobject.html" class=" module">gameobject</a>
</li>
<li>
<a href="../../core/prefabs.html" class=" module">prefabs</a>
</li>
<li>
<a href="../../core/properties.html" class=" module">properties</a>
</li>
<li>
<a href="../../core/reflection.html" class=" module">reflection</a>
</li>
<li>
<a href="../../core/scene.html" class=" module">scene</a>
</li>
</ul>
</li>
<li class="collapsed tree-view">
<a href="#" class="package">graphics</a>
<ul class="tree-view">
<li class="collapsed tree-view">
<a href="#" class="package">adapters</a>
<ul class="tree-view">
<li>
<a href="../../graphics/adapters/adapter.html" class=" module">adapter</a>
</li>
<li>
<a href="../../graphics/adapters/linux.html" class=" module">linux</a>
</li>
<li>
<a href="../../graphics/adapters/mac.html" class=" module">mac</a>
</li>
<li>
<a href="../../graphics/adapters/win32.html" class=" module">win32</a>
</li>
</ul>
</li>
<li class="collapsed tree-view">
<a href="#" class="package">shaders</a>
<ul class="tree-view">
<li class="collapsed tree-view">
<a href="#" class="package">glsl</a>
<ul class="tree-view">
<li>
<a href="../../graphics/shaders/glsl/ambientlight.html" class=" module">ambientlight</a>
</li>
<li>
<a href="../../graphics/shaders/glsl/animatedgeometry.html" class=" module">animatedgeometry</a>
</li>
<li>
<a href="../../graphics/shaders/glsl/directionallight.html" class=" module">directionallight</a>
</li>
<li>
<a href="../../graphics/shaders/glsl/geometry.html" class=" module">geometry</a>
</li>
<li>
<a href="../../graphics/shaders/glsl/pointlight.html" class=" module">pointlight</a>
</li>
<li>
<a href="../../graphics/shaders/glsl/userinterface.html" class=" module">userinterface</a>
</li>
</ul>
</li>
<li>
<a href="../../graphics/shaders/glsl.html" class=" module">glsl</a>
</li>
<li>
<a href="../../graphics/shaders/shaders.html" class=" module">shaders</a>
</li>
</ul>
</li>
<li>
<a href="../../graphics/adapters.html" class=" module">adapters</a>
</li>
<li>
<a href="../../graphics/graphics.html" class=" module">graphics</a>
</li>
<li>
<a href="../../graphics/shaders.html" class=" module">shaders</a>
</li>
</ul>
</li>
<li class="collapsed tree-view">
<a href="#" class="package">utility</a>
<ul class="tree-view">
<li>
<a href="../../utility/array.html" class=" module">array</a>
</li>
<li>
<a href="../../utility/awesomium.html" class=" module">awesomium</a>
</li>
<li>
<a href="../../utility/concurrency.html" class=" module">concurrency</a>
</li>
<li>
<a href="../../utility/config.html" class=" module">config</a>
</li>
<li>
<a href="../../utility/filepath.html" class=" module">filepath</a>
</li>
<li>
<a href="../../utility/input.html" class=" module">input</a>
</li>
<li>
<a href="../../utility/output.html" class=" module">output</a>
</li>
<li>
<a href="../../utility/string.html" class=" module">string</a>
</li>
<li>
<a href="../../utility/tasks.html" class=" module">tasks</a>
</li>
<li>
<a href="../../utility/time.html" class=" module">time</a>
</li>
</ul>
</li>
<li>
<a href="../../components.html" class=" module">components</a>
</li>
<li>
<a href="../../core.html" class=" module">core</a>
</li>
<li>
<a href="../../graphics.html" class=" module">graphics</a>
</li>
<li>
<a href="../../utility.html" class=" module">utility</a>
</li>
</ul>
<noscript>
<p style="color: red">The search functionality needs JavaScript enabled</p>
</noscript>
<div id="symbolSearchPane" style="display: none">
<p>
<input id="symbolSearch" type="text" placeholder="Search for symbols" onchange="performSymbolSearch(24);" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();"/>
</p>
<ul id="symbolSearchResults" style="display: none"></ul>
<script type="application/javascript" src="../../symbols.js"></script>
<script type="application/javascript">
//<![CDATA[
var symbolSearchRootDir = "../../"; $('#symbolSearchPane').show();
//]]>
</script>
</div>
</nav>
<div id="main-contents">
<h1>Field AssetManager.unitSquare</h1><!-- using block body in layout.dt--><!-- using block ddox.description in ddox.layout.dt-->
<p> TODO
</p>
<section>
<h2>Declaration</h2>
<pre class="code prettyprint lang-d prototype">
class <a href="../../components/assets/AssetManager.html">AssetManager</a>
{
// ...
<code class="prettyprint lang-d">shared(<a href="../../components/mesh/Mesh.html">Mesh</a>)</code> unitSquare;
// ...
}</pre>
</section><!-- using block ddox.sections in ddox.layout.dt-->
<!-- Default block ddox.members in ddox.layout.dt-->
<section>
<h2>Authors</h2><!-- using block ddox.authors in ddox.layout.dt-->
</section>
<section>
<h2>Copyright</h2><!-- using block ddox.copyright in ddox.layout.dt-->
</section>
<section>
<h2>License</h2><!-- using block ddox.license in ddox.layout.dt-->
</section>
</div>
</body>
</html>
|
Circular-Studios/Dash-Docs
|
api/v0.7.1/components/assets/AssetManager.unitSquare.html
|
HTML
|
mit
| 7,871
|
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2017 Intel Corporation.
*
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
*/
#ifndef UPM_COMPASS_H_
#define UPM_COMPASS_H_
#ifdef __cplusplus
extern "C" {
#endif
// Compass function table
typedef struct _upm_compass_ft {
upm_result_t (*upm_compass_set_scale) (void* dev, float scale);
upm_result_t (*upm_compass_set_offset) (void* dev, float offset);
// returns a heading in degrees
upm_result_t (*upm_compass_get_value) (void* dev, float *value);
} upm_compass_ft;
#ifdef __cplusplus
}
#endif
#endif /* UPM_COMPASS_H_ */
|
intel-iot-devkit/upm
|
include/fti/upm_compass.h
|
C
|
mit
| 763
|
'use strict';
var ssacl = require('../lib')
, chai = require('chai')
, expect = chai.expect
, helper = require('./helper')
, Sequelize = require('sequelize')
, Promise = helper.Promise;
Promise.longStackTraces();
chai.use(require('chai-as-promised'));
describe('writer', function () {
beforeEach(function () {
this.Post = this.sequelize.define('Post', {
title: {
type: Sequelize.STRING
},
userId: {
type: Sequelize.INTEGER,
allowNull: false,
defaultValue: 0
}
});
this.User = this.sequelize.define('User', {
});
return Promise.join(
this.Post.sync({force: true}),
this.User.sync({force: true})
).bind(this).then(function () {
return this.User.create();
}).then(function (user) {
this.user = user;
return this.Post.create({
title: 'Super Awesome Post',
userId: this.user.get('id')
});
}).then(function (post) {
this.post = post;
});
});
describe('Instance.update', function () {
beforeEach(function () {
ssacl(this.Post, {
write: {
attribute: 'userId'
}
});
});
it('should reject update without actor', function () {
return expect(this.post.update({
title: 'Less Awesome Post'
})).be.rejectedWith(ssacl.ParanoiaError);
});
it('should reject update with wrong actor', function () {
return expect(this.post.update({
title: 'Less Awesome Post'
}, {
actor: this.User.build({
id: this.user.get('id')+13
})
})).be.rejectedWith(ssacl.WrongActorError);
});
it('should allow update when correct actor', function () {
return this.post.update({
title: 'Super Duper Awesome Post'
}, {
actor: this.user
});
});
it('should allow update when omnipotent actor', function () {
return this.post.update({
title: 'Super Duper Awesome Post'
}, {
actor: new ssacl.Omnipotent()
});
});
});
describe('Model.update', function () {
beforeEach(function () {
ssacl(this.Post, {
write: {
attribute: 'userId'
}
});
});
it('should reject update without actor', function () {
return expect(this.Post.update({
title: 'Less Awesome Post'
}, {
where: {}
})).be.rejectedWith(ssacl.ParanoiaError);
});
it('should filter update to actor', function () {
return this.Post.update({
title: 'Less Awesome Post',
}, {
where: {},
actor: this.User.build({
id: this.user.get('id')+13
})
}).bind(this).spread(function (affected) {
expect(affected).to.equal(0);
return this.Post.findAll({
paranoia: false
}).then(function (posts) {
expect(posts[0].get('title')).to.equal('Super Awesome Post');
});
}).then(function () {
return this.Post.update({
title: 'Super Duper Awesome Post',
}, {
where: {},
actor: this.user
}).bind(this).spread(function (affected) {
expect(affected).to.equal(1);
return this.Post.findAll({
paranoia: false
}).then(function (posts) {
expect(posts[0].get('title')).to.equal('Super Duper Awesome Post');
});
});
});
});
});
describe('Instance.destroy', function () {
beforeEach(function () {
ssacl(this.Post, {
write: {
attribute: 'userId'
}
});
});
it('should reject destroy without actor', function () {
return expect(this.post.destroy()).be.rejectedWith(ssacl.ParanoiaError);
});
it('should reject destroy with wrong actor', function () {
return expect(this.post.destroy({
actor: this.User.build({
id: this.user.get('id')+13
})
})).be.rejectedWith(ssacl.WrongActorError);
});
it('should allow destroy when correct actor', function () {
return this.post.destroy({
actor: this.user
});
});
it('should allow destroy when omnipotent actor', function () {
return this.post.destroy({
actor: new ssacl.Omnipotent()
});
});
});
describe('Model.destroy', function () {
beforeEach(function () {
ssacl(this.Post, {
write: {
attribute: 'userId'
}
});
});
it('should reject destroy without actor', function () {
return expect(this.Post.destroy({
where: {}
})).be.rejectedWith(ssacl.ParanoiaError);
});
it('should filter destroy to actor', function () {
return this.Post.destroy({
where: {},
actor: this.User.build({
id: this.user.get('id')+13
})
}).bind(this).then(function (affected) {
expect(affected).to.equal(0);
return this.Post.findAll({
paranoia: false
}).then(function (posts) {
expect(posts.length).to.equal(1);
});
}).then(function () {
return this.Post.destroy({
where: {},
actor: this.user
}).bind(this).then(function (affected) {
expect(affected).to.equal(1);
return this.Post.findAll({
paranoia: false
}).then(function (posts) {
expect(posts.length).to.equal(0);
});
});
});
});
});
});
|
msuret/ssacl
|
test/writer.test.js
|
JavaScript
|
mit
| 5,494
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.