repo_name
stringlengths 4
116
| path
stringlengths 3
942
| size
stringlengths 1
7
| content
stringlengths 3
1.05M
| license
stringclasses 15
values |
---|---|---|---|---|
lunaczp/learning | language/c/testPhpSrc/php-5.6.17/ext/ldap/tests/ldap_search_error.phpt | 1668 | --TEST--
ldap_search() - operation that should fail
--CREDITS--
Davide Mendolia <[email protected]>
Belgian PHP Testfest 2009
--SKIPIF--
<?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
<?php require_once dirname(__FILE__) .'/skipifbindfailure.inc'; ?>
--FILE--
<?php
include "connect.inc";
$link = ldap_connect($host, $port);
$dn = "dc=not-found,$base";
$filter = "(dc=*)";
$result = ldap_search();
var_dump($result);
$result = ldap_search($link, $dn, $filter);
var_dump($result);
$result = ldap_search($link, $dn, $filter, NULL);
var_dump($result);
$result = ldap_search($link, $dn, $filter, array(1 => 'top'));
var_dump($result);
$result = ldap_search(array(), $dn, $filter, array('top'));
var_dump($result);
$result = ldap_search(array($link, $link), array($dn), $filter, array('top'));
var_dump($result);
$result = ldap_search(array($link, $link), $dn, array($filter), array('top'));
var_dump($result);
?>
===DONE===
--EXPECTF--
Warning: ldap_search() expects at least 3 parameters, 0 given in %s on line %d
NULL
Warning: ldap_search(): Search: No such object in %s on line %d
bool(false)
Warning: ldap_search() expects parameter 4 to be array, null given in %s on line %d
NULL
Warning: ldap_search(): Array initialization wrong in %s on line %d
bool(false)
Warning: ldap_search(): No links in link array in %s on line %d
bool(false)
Warning: ldap_search(): Base must either be a string, or an array with the same number of elements as the links array in %s on line %d
bool(false)
Warning: ldap_search(): Filter must either be a string, or an array with the same number of elements as the links array in %s on line %d
bool(false)
===DONE===
| mit |
j-froehlich/magento2_wk | vendor/magento/framework/View/DesignLoader.php | 1360 | <?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\View;
class DesignLoader
{
/**
* Request
*
* @var \Magento\Framework\App\RequestInterface
*/
protected $_request;
/**
* Application
*
* @var \Magento\Framework\App\AreaList
*/
protected $_areaList;
/**
* Layout
*
* @var \Magento\Framework\App\State
*/
protected $appState;
/**
* @param \Magento\Framework\App\RequestInterface $request
* @param \Magento\Framework\App\AreaList $areaList
* @param \Magento\Framework\App\State $appState
*/
public function __construct(
\Magento\Framework\App\RequestInterface $request,
\Magento\Framework\App\AreaList $areaList,
\Magento\Framework\App\State $appState
) {
$this->_request = $request;
$this->_areaList = $areaList;
$this->appState = $appState;
}
/**
* Load design
*
* @return void
*/
public function load()
{
$area = $this->_areaList->getArea($this->appState->getAreaCode());
$area->load(\Magento\Framework\App\Area::PART_DESIGN);
$area->load(\Magento\Framework\App\Area::PART_TRANSLATE);
$area->detectDesign($this->_request);
}
}
| mit |
manekinekko/ng-admin | src/javascripts/ng-admin/Crud/field/datepickerPopup.js | 823 | /**
* Fixes an issue with Bootstrap Date Picker
* @see https://github.com/angular-ui/bootstrap/issues/2659
*
* How does it work? AngularJS allows multiple directives with the same name,
* and each is treated independently though they are instantiated based on the
* same element/attribute/comment.
*
* So this directive goes along with ui.bootstrap's datepicker-popup directive.
* @see http://angular-ui.github.io/bootstrap/versioned-docs/0.12.0/#/datepicker
*/
export default function datepickerPopup() {
return {
restrict: 'EAC',
require: 'ngModel',
link: function(scope, element, attr, controller) {
//remove the default formatter from the input directive to prevent conflict
controller.$formatters.shift();
}
};
}
datepickerPopup.$inject = [];
| mit |
navalev/azure-sdk-for-java | sdk/datamigration/mgmt-v2018_03_31_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_03_31_preview/MigrateSqlServerSqlServerDatabaseInput.java | 3305 | /**
* 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.datamigration.v2018_03_31_preview;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Database specific information for SQL to SQL migration task inputs.
*/
public class MigrateSqlServerSqlServerDatabaseInput {
/**
* Name of the database.
*/
@JsonProperty(value = "name")
private String name;
/**
* Name of the database at destination.
*/
@JsonProperty(value = "restoreDatabaseName")
private String restoreDatabaseName;
/**
* Backup file share information for this database.
*/
@JsonProperty(value = "backupFileShare")
private FileShare backupFileShare;
/**
* The list of database files.
*/
@JsonProperty(value = "databaseFiles")
private List<DatabaseFileInput> databaseFiles;
/**
* Get name of the database.
*
* @return the name value
*/
public String name() {
return this.name;
}
/**
* Set name of the database.
*
* @param name the name value to set
* @return the MigrateSqlServerSqlServerDatabaseInput object itself.
*/
public MigrateSqlServerSqlServerDatabaseInput withName(String name) {
this.name = name;
return this;
}
/**
* Get name of the database at destination.
*
* @return the restoreDatabaseName value
*/
public String restoreDatabaseName() {
return this.restoreDatabaseName;
}
/**
* Set name of the database at destination.
*
* @param restoreDatabaseName the restoreDatabaseName value to set
* @return the MigrateSqlServerSqlServerDatabaseInput object itself.
*/
public MigrateSqlServerSqlServerDatabaseInput withRestoreDatabaseName(String restoreDatabaseName) {
this.restoreDatabaseName = restoreDatabaseName;
return this;
}
/**
* Get backup file share information for this database.
*
* @return the backupFileShare value
*/
public FileShare backupFileShare() {
return this.backupFileShare;
}
/**
* Set backup file share information for this database.
*
* @param backupFileShare the backupFileShare value to set
* @return the MigrateSqlServerSqlServerDatabaseInput object itself.
*/
public MigrateSqlServerSqlServerDatabaseInput withBackupFileShare(FileShare backupFileShare) {
this.backupFileShare = backupFileShare;
return this;
}
/**
* Get the list of database files.
*
* @return the databaseFiles value
*/
public List<DatabaseFileInput> databaseFiles() {
return this.databaseFiles;
}
/**
* Set the list of database files.
*
* @param databaseFiles the databaseFiles value to set
* @return the MigrateSqlServerSqlServerDatabaseInput object itself.
*/
public MigrateSqlServerSqlServerDatabaseInput withDatabaseFiles(List<DatabaseFileInput> databaseFiles) {
this.databaseFiles = databaseFiles;
return this;
}
}
| mit |
bergynj/simple-cinema | public/views/app/cinemas/cinemas.html | 1194 | <div class="Cinema-Container">
<md-content class="md-padding">
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Cinema">
<md-content class="md-padding">
<!-- listCinema with Angular -->
<div ng-controller="CinemaCtrlService" class="listCinemas">
<md-content>
<md-list>
<md-subheader class="md-no-sticky"> Cinema Locations </md-subheader>
<md-list-item class="md-3-line" ng-repeat="cinema in cinemas">
<!-- img src="" class="md-avatar" alt="" -->
<!-- {{ cinema.id }} -->
<div class="md-list-item-text">
<h3> <a href="cinema/{{ cinema.id }}"> {{ cinema.name }} </a> </h3>
<h4> {{ cinema.address }} </h4>
<p class="session-times"> <a href="cinema/{{ cinema.id }}"> Session times </a> </p>
</div>
</md-list-item>
<md-divider></md-divider>
</md-list>
</md-content>
</div>
</md-content>
</md-tab>
</md-tabs>
</md-content>
</div>
| mit |
spadin/coverphoto | node_modules/grunt-contrib/node_modules/grunt-contrib-yuidoc/node_modules/yuidocjs/node_modules/yui/editor-base/editor-base-debug.js | 32357 | /*
YUI 3.7.2 (build 5639)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('editor-base', function (Y, NAME) {
/**
* Base class for Editor. Handles the business logic of Editor, no GUI involved only utility methods and events.
*
* var editor = new Y.EditorBase({
* content: 'Foo'
* });
* editor.render('#demo');
*
* @class EditorBase
* @extends Base
* @module editor
* @main editor
* @submodule editor-base
* @constructor
*/
var EditorBase = function() {
EditorBase.superclass.constructor.apply(this, arguments);
}, LAST_CHILD = ':last-child', BODY = 'body';
Y.extend(EditorBase, Y.Base, {
/**
* Internal reference to the Y.Frame instance
* @property frame
*/
frame: null,
initializer: function() {
var frame = new Y.Frame({
designMode: true,
title: EditorBase.STRINGS.title,
use: EditorBase.USE,
dir: this.get('dir'),
extracss: this.get('extracss'),
linkedcss: this.get('linkedcss'),
defaultblock: this.get('defaultblock'),
host: this
}).plug(Y.Plugin.ExecCommand);
frame.after('ready', Y.bind(this._afterFrameReady, this));
frame.addTarget(this);
this.frame = frame;
this.publish('nodeChange', {
emitFacade: true,
bubbles: true,
defaultFn: this._defNodeChangeFn
});
//this.plug(Y.Plugin.EditorPara);
},
destructor: function() {
this.frame.destroy();
this.detachAll();
},
/**
* Copy certain styles from one node instance to another (used for new paragraph creation mainly)
* @method copyStyles
* @param {Node} from The Node instance to copy the styles from
* @param {Node} to The Node instance to copy the styles to
*/
copyStyles: function(from, to) {
if (from.test('a')) {
//Don't carry the A styles
return;
}
var styles = ['color', 'fontSize', 'fontFamily', 'backgroundColor', 'fontStyle' ],
newStyles = {};
Y.each(styles, function(v) {
newStyles[v] = from.getStyle(v);
});
if (from.ancestor('b,strong')) {
newStyles.fontWeight = 'bold';
}
if (from.ancestor('u')) {
if (!newStyles.textDecoration) {
newStyles.textDecoration = 'underline';
}
}
to.setStyles(newStyles);
},
/**
* Holder for the selection bookmark in IE.
* @property _lastBookmark
* @private
*/
_lastBookmark: null,
/**
* Resolves the e.changedNode in the nodeChange event if it comes from the document. If
* the event came from the document, it will get the last child of the last child of the document
* and return that instead.
* @method _resolveChangedNode
* @param {Node} n The node to resolve
* @private
*/
_resolveChangedNode: function(n) {
var inst = this.getInstance(), lc, lc2, found;
if (n && n.test(BODY)) {
var sel = new inst.EditorSelection();
if (sel && sel.anchorNode) {
n = sel.anchorNode;
}
}
if (inst && n && n.test('html')) {
lc = inst.one(BODY).one(LAST_CHILD);
while (!found) {
if (lc) {
lc2 = lc.one(LAST_CHILD);
if (lc2) {
lc = lc2;
} else {
found = true;
}
} else {
found = true;
}
}
if (lc) {
if (lc.test('br')) {
if (lc.previous()) {
lc = lc.previous();
} else {
lc = lc.get('parentNode');
}
}
if (lc) {
n = lc;
}
}
}
if (!n) {
//Fallback to make sure a node is attached to the event
n = inst.one(BODY);
}
return n;
},
/**
* The default handler for the nodeChange event.
* @method _defNodeChangeFn
* @param {Event} e The event
* @private
*/
_defNodeChangeFn: function(e) {
var startTime = (new Date()).getTime();
//Y.log('Default nodeChange function: ' + e.changedType, 'info', 'editor');
var inst = this.getInstance(), sel, cur,
btag = inst.EditorSelection.DEFAULT_BLOCK_TAG;
if (Y.UA.ie) {
try {
sel = inst.config.doc.selection.createRange();
if (sel.getBookmark) {
this._lastBookmark = sel.getBookmark();
}
} catch (ie) {}
}
e.changedNode = this._resolveChangedNode(e.changedNode);
/*
* @TODO
* This whole method needs to be fixed and made more dynamic.
* Maybe static functions for the e.changeType and an object bag
* to walk through and filter to pass off the event to before firing..
*/
switch (e.changedType) {
case 'keydown':
if (!Y.UA.gecko) {
if (!EditorBase.NC_KEYS[e.changedEvent.keyCode] && !e.changedEvent.shiftKey && !e.changedEvent.ctrlKey && (e.changedEvent.keyCode !== 13)) {
//inst.later(100, inst, inst.EditorSelection.cleanCursor);
}
}
break;
case 'tab':
if (!e.changedNode.test('li, li *') && !e.changedEvent.shiftKey) {
e.changedEvent.frameEvent.preventDefault();
Y.log('Overriding TAB key to insert HTML: HALTING', 'info', 'editor');
if (Y.UA.webkit) {
this.execCommand('inserttext', '\t');
} else if (Y.UA.gecko) {
this.frame.exec._command('inserthtml', EditorBase.TABKEY);
} else if (Y.UA.ie) {
this.execCommand('inserthtml', EditorBase.TABKEY);
}
}
break;
case 'backspace-up':
// Fixes #2531090 - Joins text node strings so they become one for bidi
if (Y.UA.webkit && e.changedNode) {
e.changedNode.set('innerHTML', e.changedNode.get('innerHTML'));
}
break;
}
if (Y.UA.webkit && e.commands && (e.commands.indent || e.commands.outdent)) {
/*
* When executing execCommand 'indent or 'outdent' Webkit applies
* a class to the BLOCKQUOTE that adds left/right margin to it
* This strips that style so it is just a normal BLOCKQUOTE
*/
var bq = inst.all('.webkit-indent-blockquote, blockquote');
if (bq.size()) {
bq.setStyle('margin', '');
}
}
var changed = this.getDomPath(e.changedNode, false),
cmds = {}, family, fsize, classes = [],
fColor = '', bColor = '';
if (e.commands) {
cmds = e.commands;
}
var normal = false;
Y.each(changed, function(el) {
var tag = el.tagName.toLowerCase(),
cmd = EditorBase.TAG2CMD[tag];
if (cmd) {
cmds[cmd] = 1;
}
//Bold and Italic styles
var s = el.currentStyle || el.style;
if ((''+s.fontWeight) == 'normal') {
normal = true;
}
if ((''+s.fontWeight) == 'bold') { //Cast this to a string
cmds.bold = 1;
}
if (Y.UA.ie) {
if (s.fontWeight > 400) {
cmds.bold = 1;
}
}
if (s.fontStyle == 'italic') {
cmds.italic = 1;
}
if (s.textDecoration.indexOf('underline') > -1) {
cmds.underline = 1;
}
if (s.textDecoration.indexOf('line-through') > -1) {
cmds.strikethrough = 1;
}
var n = inst.one(el);
if (n.getStyle('fontFamily')) {
var family2 = n.getStyle('fontFamily').split(',')[0].toLowerCase();
if (family2) {
family = family2;
}
if (family) {
family = family.replace(/'/g, '').replace(/"/g, '');
}
}
fsize = EditorBase.NORMALIZE_FONTSIZE(n);
var cls = el.className.split(' ');
Y.each(cls, function(v) {
if (v !== '' && (v.substr(0, 4) !== 'yui_')) {
classes.push(v);
}
});
fColor = EditorBase.FILTER_RGB(n.getStyle('color'));
var bColor2 = EditorBase.FILTER_RGB(s.backgroundColor);
if (bColor2 !== 'transparent') {
if (bColor2 !== '') {
bColor = bColor2;
}
}
});
if (normal) {
delete cmds.bold;
delete cmds.italic;
}
e.dompath = inst.all(changed);
e.classNames = classes;
e.commands = cmds;
//TODO Dont' like this, not dynamic enough..
if (!e.fontFamily) {
e.fontFamily = family;
}
if (!e.fontSize) {
e.fontSize = fsize;
}
if (!e.fontColor) {
e.fontColor = fColor;
}
if (!e.backgroundColor) {
e.backgroundColor = bColor;
}
var endTime = (new Date()).getTime();
Y.log('_defNodeChangeTimer 2: ' + (endTime - startTime) + 'ms', 'info', 'selection');
},
/**
* Walk the dom tree from this node up to body, returning a reversed array of parents.
* @method getDomPath
* @param {Node} node The Node to start from
*/
getDomPath: function(node, nodeList) {
var domPath = [], domNode,
inst = this.frame.getInstance();
domNode = inst.Node.getDOMNode(node);
//return inst.all(domNode);
while (domNode !== null) {
if ((domNode === inst.config.doc.documentElement) || (domNode === inst.config.doc) || !domNode.tagName) {
domNode = null;
break;
}
if (!inst.DOM.inDoc(domNode)) {
domNode = null;
break;
}
//Check to see if we get el.nodeName and nodeType
if (domNode.nodeName && domNode.nodeType && (domNode.nodeType == 1)) {
domPath.push(domNode);
}
if (domNode == inst.config.doc.body) {
domNode = null;
break;
}
domNode = domNode.parentNode;
}
/*{{{ Using Node
while (node !== null) {
if (node.test('html') || node.test('doc') || !node.get('tagName')) {
node = null;
break;
}
if (!node.inDoc()) {
node = null;
break;
}
//Check to see if we get el.nodeName and nodeType
if (node.get('nodeName') && node.get('nodeType') && (node.get('nodeType') == 1)) {
domPath.push(inst.Node.getDOMNode(node));
}
if (node.test('body')) {
node = null;
break;
}
node = node.get('parentNode');
}
}}}*/
if (domPath.length === 0) {
domPath[0] = inst.config.doc.body;
}
if (nodeList) {
return inst.all(domPath.reverse());
} else {
return domPath.reverse();
}
},
/**
* After frame ready, bind mousedown & keyup listeners
* @method _afterFrameReady
* @private
*/
_afterFrameReady: function() {
var inst = this.frame.getInstance();
this.frame.on('dom:mouseup', Y.bind(this._onFrameMouseUp, this));
this.frame.on('dom:mousedown', Y.bind(this._onFrameMouseDown, this));
this.frame.on('dom:keydown', Y.bind(this._onFrameKeyDown, this));
if (Y.UA.ie) {
this.frame.on('dom:activate', Y.bind(this._onFrameActivate, this));
this.frame.on('dom:beforedeactivate', Y.bind(this._beforeFrameDeactivate, this));
}
this.frame.on('dom:keyup', Y.bind(this._onFrameKeyUp, this));
this.frame.on('dom:keypress', Y.bind(this._onFrameKeyPress, this));
this.frame.on('dom:paste', Y.bind(this._onPaste, this));
inst.EditorSelection.filter();
this.fire('ready');
},
/**
* Caches the current cursor position in IE.
* @method _beforeFrameDeactivate
* @private
*/
_beforeFrameDeactivate: function(e) {
if (e.frameTarget.test('html')) { //Means it came from a scrollbar
return;
}
var inst = this.getInstance(),
sel = inst.config.doc.selection.createRange();
if (sel.compareEndPoints && !sel.compareEndPoints('StartToEnd', sel)) {
sel.pasteHTML('<var id="yui-ie-cursor">');
}
},
/**
* Moves the cached selection bookmark back so IE can place the cursor in the right place.
* @method _onFrameActivate
* @private
*/
_onFrameActivate: function(e) {
if (e.frameTarget.test('html')) { //Means it came from a scrollbar
return;
}
var inst = this.getInstance(),
sel = new inst.EditorSelection(),
range = sel.createRange(),
cur = inst.all('#yui-ie-cursor');
if (cur.size()) {
cur.each(function(n) {
n.set('id', '');
if (range.moveToElementText) {
try {
range.moveToElementText(n._node);
var moved = range.move('character', -1);
if (moved === -1) { //Only move up if we actually moved back.
range.move('character', 1);
}
range.select();
range.text = '';
} catch (e) {}
}
n.remove();
});
}
},
/**
* Fires nodeChange event
* @method _onPaste
* @private
*/
_onPaste: function(e) {
this.fire('nodeChange', { changedNode: e.frameTarget, changedType: 'paste', changedEvent: e.frameEvent });
},
/**
* Fires nodeChange event
* @method _onFrameMouseUp
* @private
*/
_onFrameMouseUp: function(e) {
this.fire('nodeChange', { changedNode: e.frameTarget, changedType: 'mouseup', changedEvent: e.frameEvent });
},
/**
* Fires nodeChange event
* @method _onFrameMouseDown
* @private
*/
_onFrameMouseDown: function(e) {
this.fire('nodeChange', { changedNode: e.frameTarget, changedType: 'mousedown', changedEvent: e.frameEvent });
},
/**
* Caches a copy of the selection for key events. Only creating the selection on keydown
* @property _currentSelection
* @private
*/
_currentSelection: null,
/**
* Holds the timer for selection clearing
* @property _currentSelectionTimer
* @private
*/
_currentSelectionTimer: null,
/**
* Flag to determine if we can clear the selection or not.
* @property _currentSelectionClear
* @private
*/
_currentSelectionClear: null,
/**
* Fires nodeChange event
* @method _onFrameKeyDown
* @private
*/
_onFrameKeyDown: function(e) {
var inst, sel;
if (!this._currentSelection) {
if (this._currentSelectionTimer) {
this._currentSelectionTimer.cancel();
}
this._currentSelectionTimer = Y.later(850, this, function() {
this._currentSelectionClear = true;
});
inst = this.frame.getInstance();
sel = new inst.EditorSelection(e);
this._currentSelection = sel;
} else {
sel = this._currentSelection;
}
inst = this.frame.getInstance();
sel = new inst.EditorSelection();
this._currentSelection = sel;
if (sel && sel.anchorNode) {
this.fire('nodeChange', { changedNode: sel.anchorNode, changedType: 'keydown', changedEvent: e.frameEvent });
if (EditorBase.NC_KEYS[e.keyCode]) {
this.fire('nodeChange', { changedNode: sel.anchorNode, changedType: EditorBase.NC_KEYS[e.keyCode], changedEvent: e.frameEvent });
this.fire('nodeChange', { changedNode: sel.anchorNode, changedType: EditorBase.NC_KEYS[e.keyCode] + '-down', changedEvent: e.frameEvent });
}
}
},
/**
* Fires nodeChange event
* @method _onFrameKeyPress
* @private
*/
_onFrameKeyPress: function(e) {
var sel = this._currentSelection;
if (sel && sel.anchorNode) {
this.fire('nodeChange', { changedNode: sel.anchorNode, changedType: 'keypress', changedEvent: e.frameEvent });
if (EditorBase.NC_KEYS[e.keyCode]) {
this.fire('nodeChange', { changedNode: sel.anchorNode, changedType: EditorBase.NC_KEYS[e.keyCode] + '-press', changedEvent: e.frameEvent });
}
}
},
/**
* Fires nodeChange event for keyup on specific keys
* @method _onFrameKeyUp
* @private
*/
_onFrameKeyUp: function(e) {
var inst = this.frame.getInstance(),
sel = new inst.EditorSelection(e);
if (sel && sel.anchorNode) {
this.fire('nodeChange', { changedNode: sel.anchorNode, changedType: 'keyup', selection: sel, changedEvent: e.frameEvent });
if (EditorBase.NC_KEYS[e.keyCode]) {
this.fire('nodeChange', { changedNode: sel.anchorNode, changedType: EditorBase.NC_KEYS[e.keyCode] + '-up', selection: sel, changedEvent: e.frameEvent });
}
}
if (this._currentSelectionClear) {
this._currentSelectionClear = this._currentSelection = null;
}
},
/**
* Pass through to the frame.execCommand method
* @method execCommand
* @param {String} cmd The command to pass: inserthtml, insertimage, bold
* @param {String} val The optional value of the command: Helvetica
* @return {Node/NodeList} The Node or Nodelist affected by the command. Only returns on override commands, not browser defined commands.
*/
execCommand: function(cmd, val) {
var ret = this.frame.execCommand(cmd, val),
inst = this.frame.getInstance(),
sel = new inst.EditorSelection(), cmds = {},
e = { changedNode: sel.anchorNode, changedType: 'execcommand', nodes: ret };
switch (cmd) {
case 'forecolor':
e.fontColor = val;
break;
case 'backcolor':
e.backgroundColor = val;
break;
case 'fontsize':
e.fontSize = val;
break;
case 'fontname':
e.fontFamily = val;
break;
}
cmds[cmd] = 1;
e.commands = cmds;
this.fire('nodeChange', e);
return ret;
},
/**
* Get the YUI instance of the frame
* @method getInstance
* @return {YUI} The YUI instance bound to the frame.
*/
getInstance: function() {
return this.frame.getInstance();
},
/**
* Renders the Y.Frame to the passed node.
* @method render
* @param {Selector/HTMLElement/Node} node The node to append the Editor to
* @return {EditorBase}
* @chainable
*/
render: function(node) {
this.frame.set('content', this.get('content'));
this.frame.render(node);
return this;
},
/**
* Focus the contentWindow of the iframe
* @method focus
* @param {Function} fn Callback function to execute after focus happens
* @return {EditorBase}
* @chainable
*/
focus: function(fn) {
this.frame.focus(fn);
return this;
},
/**
* Handles the showing of the Editor instance. Currently only handles the iframe
* @method show
* @return {EditorBase}
* @chainable
*/
show: function() {
this.frame.show();
return this;
},
/**
* Handles the hiding of the Editor instance. Currently only handles the iframe
* @method hide
* @return {EditorBase}
* @chainable
*/
hide: function() {
this.frame.hide();
return this;
},
/**
* (Un)Filters the content of the Editor, cleaning YUI related code. //TODO better filtering
* @method getContent
* @return {String} The filtered content of the Editor
*/
getContent: function() {
var html = '', inst = this.getInstance();
if (inst && inst.EditorSelection) {
html = inst.EditorSelection.unfilter();
}
//Removing the _yuid from the objects in IE
html = html.replace(/ _yuid="([^>]*)"/g, '');
return html;
}
}, {
/**
* @static
* @method NORMALIZE_FONTSIZE
* @description Pulls the fontSize from a node, then checks for string values (x-large, x-small)
* and converts them to pixel sizes. If the parsed size is different from the original, it calls
* node.setStyle to update the node with a pixel size for normalization.
*/
NORMALIZE_FONTSIZE: function(n) {
var size = n.getStyle('fontSize'), oSize = size;
switch (size) {
case '-webkit-xxx-large':
size = '48px';
break;
case 'xx-large':
size = '32px';
break;
case 'x-large':
size = '24px';
break;
case 'large':
size = '18px';
break;
case 'medium':
size = '16px';
break;
case 'small':
size = '13px';
break;
case 'x-small':
size = '10px';
break;
}
if (oSize !== size) {
n.setStyle('fontSize', size);
}
return size;
},
/**
* @static
* @property TABKEY
* @description The HTML markup to use for the tabkey
*/
TABKEY: '<span class="tab"> </span>',
/**
* @static
* @method FILTER_RGB
* @param String css The CSS string containing rgb(#,#,#);
* @description Converts an RGB color string to a hex color, example: rgb(0, 255, 0) converts to #00ff00
* @return String
*/
FILTER_RGB: function(css) {
if (css.toLowerCase().indexOf('rgb') != -1) {
var exp = new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)", "gi");
var rgb = css.replace(exp, "$1,$2,$3,$4,$5").split(',');
if (rgb.length == 5) {
var r = parseInt(rgb[1], 10).toString(16);
var g = parseInt(rgb[2], 10).toString(16);
var b = parseInt(rgb[3], 10).toString(16);
r = r.length == 1 ? '0' + r : r;
g = g.length == 1 ? '0' + g : g;
b = b.length == 1 ? '0' + b : b;
css = "#" + r + g + b;
}
}
return css;
},
/**
* @static
* @property TAG2CMD
* @description A hash table of tags to their execcomand's
*/
TAG2CMD: {
'b': 'bold',
'strong': 'bold',
'i': 'italic',
'em': 'italic',
'u': 'underline',
'sup': 'superscript',
'sub': 'subscript',
'img': 'insertimage',
'a' : 'createlink',
'ul' : 'insertunorderedlist',
'ol' : 'insertorderedlist'
},
/**
* Hash table of keys to fire a nodeChange event for.
* @static
* @property NC_KEYS
* @type Object
*/
NC_KEYS: {
8: 'backspace',
9: 'tab',
13: 'enter',
32: 'space',
33: 'pageup',
34: 'pagedown',
35: 'end',
36: 'home',
37: 'left',
38: 'up',
39: 'right',
40: 'down',
46: 'delete'
},
/**
* The default modules to use inside the Frame
* @static
* @property USE
* @type Array
*/
USE: ['substitute', 'node', 'selector-css3', 'editor-selection', 'stylesheet'],
/**
* The Class Name: editorBase
* @static
* @property NAME
*/
NAME: 'editorBase',
/**
* Editor Strings. By default contains only the `title` property for the
* Title of frame document (default "Rich Text Editor").
*
* @static
* @property STRINGS
*/
STRINGS: {
title: 'Rich Text Editor'
},
ATTRS: {
/**
* The content to load into the Editor Frame
* @attribute content
*/
content: {
value: '<br class="yui-cursor">',
setter: function(str) {
if (str.substr(0, 1) === "\n") {
Y.log('Stripping first carriage return from content before injecting', 'warn', 'editor');
str = str.substr(1);
}
if (str === '') {
str = '<br class="yui-cursor">';
}
if (str === ' ') {
if (Y.UA.gecko) {
str = '<br class="yui-cursor">';
}
}
return this.frame.set('content', str);
},
getter: function() {
return this.frame.get('content');
}
},
/**
* The value of the dir attribute on the HTML element of the frame. Default: ltr
* @attribute dir
*/
dir: {
writeOnce: true,
value: 'ltr'
},
/**
* @attribute linkedcss
* @description An array of url's to external linked style sheets
* @type String
*/
linkedcss: {
value: '',
setter: function(css) {
if (this.frame) {
this.frame.set('linkedcss', css);
}
return css;
}
},
/**
* @attribute extracss
* @description A string of CSS to add to the Head of the Editor
* @type String
*/
extracss: {
value: false,
setter: function(css) {
if (this.frame) {
this.frame.set('extracss', css);
}
return css;
}
},
/**
* @attribute defaultblock
* @description The default tag to use for block level items, defaults to: p
* @type String
*/
defaultblock: {
value: 'p'
}
}
});
Y.EditorBase = EditorBase;
/**
* @event nodeChange
* @description Fired from several mouse/key/paste event points.
* @param {Event.Facade} event An Event Facade object with the following specific properties added:
* <dl>
* <dt>changedEvent</dt><dd>The event that caused the nodeChange</dd>
* <dt>changedNode</dt><dd>The node that was interacted with</dd>
* <dt>changedType</dt><dd>The type of change: mousedown, mouseup, right, left, backspace, tab, enter, etc..</dd>
* <dt>commands</dt><dd>The list of execCommands that belong to this change and the dompath that's associated with the changedNode</dd>
* <dt>classNames</dt><dd>An array of classNames that are applied to the changedNode and all of it's parents</dd>
* <dt>dompath</dt><dd>A sorted array of node instances that make up the DOM path from the changedNode to body.</dd>
* <dt>backgroundColor</dt><dd>The cascaded backgroundColor of the changedNode</dd>
* <dt>fontColor</dt><dd>The cascaded fontColor of the changedNode</dd>
* <dt>fontFamily</dt><dd>The cascaded fontFamily of the changedNode</dd>
* <dt>fontSize</dt><dd>The cascaded fontSize of the changedNode</dd>
* </dl>
* @type {Event.Custom}
*/
/**
* @event ready
* @description Fired after the frame is ready.
* @param {Event.Facade} event An Event Facade object.
* @type {Event.Custom}
*/
}, '3.7.2', {"requires": ["base", "frame", "node", "exec-command", "editor-selection"]});
| mit |
lriki/LNSL | src/hlsl2glslfork/hlslang/MachineIndependent/intermOut.cpp | 18856 | // Copyright (c) The HLSL2GLSLFork Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE.txt file.
#include "localintermediate.h"
//
// Two purposes:
// 1. Show an example of how to iterate tree. Functions can
// also directly call Traverse() on children themselves to
// have finer grained control over the process than shown here.
// See the last function for how to get started.
// 2. Print out a text based description of the tree.
//
//
// Use this class to carry along data from node to node in
// the traversal
//
class TOutputTraverser : public TIntermTraverser
{
public:
TOutputTraverser(TInfoSink& i) : infoSink(i)
{
}
TInfoSink& infoSink;
};
TString TType::getCompleteString() const
{
char buf[100];
char *p = &buf[0];
if (qualifier != EvqTemporary && qualifier != EvqGlobal)
p += sprintf(p, "%s ", getQualifierString());
sprintf(p, "%s", getBasicString());
if (array)
p += sprintf(p, " array");
if (matrix)
p += sprintf(p, "matrix%dX%d", matcols, matrows);
else if (matrows > 1)
p += sprintf(p, "vec%d", matrows);
return TString(buf);
}
//
// Helper functions for printing, not part of traversing.
//
void OutputTreeText(TInfoSink& infoSink, TIntermNode* node, const int depth)
{
int i;
infoSink.debug << node->getLine();
for (i = 0; i < depth; ++i)
infoSink.debug << " ";
}
//
// The rest of the file are the traversal functions. The last one
// is the one that starts the traversal.
//
// Return true from interior nodes to have the external traversal
// continue on to children. If you process children yourself,
// return false.
//
void OutputSymbol(TIntermSymbol* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
OutputTreeText(oit->infoSink, node, oit->depth);
char buf[100];
sprintf(buf, "'%s' (%s)\n",
node->getSymbol().c_str(),
node->getCompleteString().c_str());
oit->infoSink.debug << buf;
}
bool OutputBinary(bool, /* preVisit */ TIntermBinary* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputTreeText(out, node, oit->depth);
switch (node->getOp())
{
case EOpAssign: out.debug << "="; break;
case EOpAddAssign: out.debug << "+="; break;
case EOpSubAssign: out.debug << "-="; break;
case EOpMulAssign: out.debug << "*="; break;
case EOpVectorTimesMatrixAssign: out.debug << "vec *= matrix"; break;
case EOpVectorTimesScalarAssign: out.debug << "vec *= scalar"; break;
case EOpMatrixTimesScalarAssign: out.debug << "matrix *= scalar"; break;
case EOpMatrixTimesMatrixAssign: out.debug << "matrix *= matrix"; break;
case EOpDivAssign: out.debug << "/="; break;
case EOpModAssign: out.debug << "%="; break;
case EOpAndAssign: out.debug << "&="; break;
case EOpInclusiveOrAssign: out.debug << "|="; break;
case EOpExclusiveOrAssign: out.debug << "^="; break;
case EOpLeftShiftAssign: out.debug << "<<="; break;
case EOpRightShiftAssign: out.debug << ">>="; break;
case EOpIndexDirect: out.debug << "index"; break;
case EOpIndexIndirect: out.debug << "indirect index"; break;
case EOpIndexDirectStruct: out.debug << "struct index"; break;
case EOpVectorSwizzle: out.debug << "swizzle"; break;
case EOpAdd: out.debug << "+"; break;
case EOpSub: out.debug << "-"; break;
case EOpMul: out.debug << "*"; break;
case EOpDiv: out.debug << "/"; break;
case EOpMod: out.debug << "%"; break;
case EOpRightShift: out.debug << ">>"; break;
case EOpLeftShift: out.debug << "<<"; break;
case EOpAnd: out.debug << "&"; break;
case EOpInclusiveOr: out.debug << "|"; break;
case EOpExclusiveOr: out.debug << "^"; break;
case EOpEqual: out.debug << "=="; break;
case EOpNotEqual: out.debug << "!="; break;
case EOpLessThan: out.debug << "<"; break;
case EOpGreaterThan: out.debug << ">"; break;
case EOpLessThanEqual: out.debug << "<="; break;
case EOpGreaterThanEqual: out.debug << ">="; break;
case EOpVectorTimesScalar: out.debug << "vec*scalar"; break;
case EOpVectorTimesMatrix: out.debug << "vec*matrix"; break;
case EOpMatrixTimesVector: out.debug << "matrix*vec"; break;
case EOpMatrixTimesScalar: out.debug << "matrix*scalar"; break;
case EOpMatrixTimesMatrix: out.debug << "matrix*matrix"; break;
case EOpLogicalOr: out.debug << "||"; break;
case EOpLogicalXor: out.debug << "^^"; break;
case EOpLogicalAnd: out.debug << "&&"; break;
default: out.debug << "<unknown op>";
}
out.debug << " (" << node->getCompleteString() << ")";
out.debug << "\n";
return true;
}
bool OutputUnary(bool, /* preVisit */ TIntermUnary* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputTreeText(out, node, oit->depth);
switch (node->getOp())
{
case EOpNegative: out.debug << "Negate value"; break;
case EOpVectorLogicalNot:
case EOpLogicalNot: out.debug << "Negate conditional"; break;
case EOpBitwiseNot: out.debug << "Bitwise not"; break;
case EOpPostIncrement: out.debug << "Post-Increment"; break;
case EOpPostDecrement: out.debug << "Post-Decrement"; break;
case EOpPreIncrement: out.debug << "Pre-Increment"; break;
case EOpPreDecrement: out.debug << "Pre-Decrement"; break;
case EOpConvIntToBool: out.debug << "Convert int to bool"; break;
case EOpConvFloatToBool:out.debug << "Convert float to bool";break;
case EOpConvBoolToFloat:out.debug << "Convert bool to float";break;
case EOpConvIntToFloat: out.debug << "Convert int to float"; break;
case EOpConvFloatToInt: out.debug << "Convert float to int"; break;
case EOpConvBoolToInt: out.debug << "Convert bool to int"; break;
case EOpRadians: out.debug << "radians"; break;
case EOpDegrees: out.debug << "degrees"; break;
case EOpSin: out.debug << "sine"; break;
case EOpCos: out.debug << "cosine"; break;
case EOpTan: out.debug << "tangent"; break;
case EOpAsin: out.debug << "arc sine"; break;
case EOpAcos: out.debug << "arc cosine"; break;
case EOpAtan: out.debug << "arc tangent"; break;
case EOpAtan2: out.debug << "arc tangent 2"; break;
case EOpExp: out.debug << "exp"; break;
case EOpLog: out.debug << "log"; break;
case EOpExp2: out.debug << "exp2"; break;
case EOpLog2: out.debug << "log2"; break;
case EOpLog10: out.debug << "log10"; break;
case EOpSqrt: out.debug << "sqrt"; break;
case EOpInverseSqrt: out.debug << "inverse sqrt"; break;
case EOpAbs: out.debug << "Absolute value"; break;
case EOpSign: out.debug << "Sign"; break;
case EOpFloor: out.debug << "Floor"; break;
case EOpCeil: out.debug << "Ceiling"; break;
case EOpFract: out.debug << "Fraction"; break;
case EOpLength: out.debug << "length"; break;
case EOpNormalize: out.debug << "normalize"; break;
case EOpDPdx: out.debug << "dPdx"; break;
case EOpDPdy: out.debug << "dPdy"; break;
case EOpFwidth: out.debug << "fwidth"; break;
case EOpFclip: out.debug << "clip"; break;
case EOpAny: out.debug << "any"; break;
case EOpAll: out.debug << "all"; break;
case EOpD3DCOLORtoUBYTE4: out.debug << "D3DCOLORtoUBYTE4"; break;
default: out.debug.message(EPrefixError, "Bad unary op");
}
out.debug << " (" << node->getCompleteString() << ")";
out.debug << "\n";
return true;
}
bool OutputAggregate(bool, /* preVisit */ TIntermAggregate* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
if (node->getOp() == EOpNull)
{
out.debug.message(EPrefixError, "node is still EOpNull!");
return true;
}
OutputTreeText(out, node, oit->depth);
switch (node->getOp())
{
case EOpSequence: out.debug << "Sequence\n"; return true;
case EOpComma: out.debug << "Comma\n"; return true;
case EOpFunction: out.debug << "Func Def: " << node->getName(); break;
case EOpFunctionCall: out.debug << "Func Call: " << node->getName(); break;
case EOpParameters: out.debug << "Func Params: "; break;
case EOpConstructFloat: out.debug << "Construct float"; break;
case EOpConstructVec2: out.debug << "Construct vec2"; break;
case EOpConstructVec3: out.debug << "Construct vec3"; break;
case EOpConstructVec4: out.debug << "Construct vec4"; break;
case EOpConstructBool: out.debug << "Construct bool"; break;
case EOpConstructBVec2: out.debug << "Construct bvec2"; break;
case EOpConstructBVec3: out.debug << "Construct bvec3"; break;
case EOpConstructBVec4: out.debug << "Construct bvec4"; break;
case EOpConstructInt: out.debug << "Construct int"; break;
case EOpConstructIVec2: out.debug << "Construct ivec2"; break;
case EOpConstructIVec3: out.debug << "Construct ivec3"; break;
case EOpConstructIVec4: out.debug << "Construct ivec4"; break;
case EOpConstructMat2x2: out.debug << "Construct mat2x2"; break;
case EOpConstructMat2x3: out.debug << "Construct mat2x3"; break;
case EOpConstructMat2x4: out.debug << "Construct mat2x4"; break;
case EOpConstructMat3x2: out.debug << "Construct mat3x2"; break;
case EOpConstructMat3x3: out.debug << "Construct mat3x3"; break;
case EOpConstructMat3x4: out.debug << "Construct mat3x4"; break;
case EOpConstructMat4x2: out.debug << "Construct mat4x2"; break;
case EOpConstructMat4x3: out.debug << "Construct mat4x3"; break;
case EOpConstructMat4x4: out.debug << "Construct mat4x4"; break;
case EOpConstructStruct: out.debug << "Construct struc"; break;
case EOpConstructMat2x2FromMat: out.debug << "Construct mat2 from mat"; break;
case EOpConstructMat3x3FromMat: out.debug << "Construct mat3 from mat"; break;
case EOpMatrixIndex: out.debug << "Matrix index"; break;
case EOpMatrixIndexDynamic: out.debug << "Matrix index dynamic"; break;
case EOpLessThan: out.debug << "Compare Less Than"; break;
case EOpGreaterThan: out.debug << "Compare Greater Than"; break;
case EOpLessThanEqual: out.debug << "Compare Less Than or Equal"; break;
case EOpGreaterThanEqual: out.debug << "Compare Greater Than or Equal"; break;
case EOpVectorEqual: out.debug << "Equal"; break;
case EOpVectorNotEqual: out.debug << "NotEqual"; break;
case EOpMod: out.debug << "mod"; break;
case EOpPow: out.debug << "pow"; break;
case EOpAtan: out.debug << "atan"; break;
case EOpAtan2: out.debug << "atan2"; break;
case EOpSinCos: out.debug << "sincos"; break;
case EOpMin: out.debug << "min"; break;
case EOpMax: out.debug << "max"; break;
case EOpClamp: out.debug << "clamp"; break;
case EOpMix: out.debug << "mix"; break;
case EOpStep: out.debug << "step"; break;
case EOpSmoothStep: out.debug << "smoothstep"; break;
case EOpLit: out.debug << "lit"; break;
case EOpDistance: out.debug << "distance"; break;
case EOpDot: out.debug << "dot"; break;
case EOpCross: out.debug << "cross"; break;
case EOpFaceForward: out.debug << "faceforward"; break;
case EOpReflect: out.debug << "reflect"; break;
case EOpRefract: out.debug << "refract"; break;
case EOpMul: out.debug << "mul"; break;
case EOpTex1D: out.debug << "tex1D"; break;
case EOpTex1DProj: out.debug << "tex1Dproj"; break;
case EOpTex1DLod: out.debug << "tex1Dlod"; break;
case EOpTex1DBias: out.debug << "tex1Dbias"; break;
case EOpTex1DGrad: out.debug << "tex1Dgrad"; break;
case EOpTex2D: out.debug << "tex2D"; break;
case EOpTex2DProj: out.debug << "tex2Dproj"; break;
case EOpTex2DLod: out.debug << "tex2Dlod"; break;
case EOpTex2DBias: out.debug << "tex2Dbias"; break;
case EOpTex2DGrad: out.debug << "tex2Dgrad"; break;
case EOpTex3D: out.debug << "tex3D"; break;
case EOpTex3DProj: out.debug << "tex3Dproj"; break;
case EOpTex3DLod: out.debug << "tex3Dlod"; break;
case EOpTex3DBias: out.debug << "tex3Dbias"; break;
case EOpTex3DGrad: out.debug << "tex3Dgrad"; break;
case EOpTexCube: out.debug << "texCUBE"; break;
case EOpTexCubeProj: out.debug << "texCUBEproj"; break;
case EOpTexCubeLod: out.debug << "texCUBElod"; break;
case EOpTexCubeBias: out.debug << "texCUBEbias"; break;
case EOpTexCubeGrad: out.debug << "texCUBEgrad"; break;
case EOpTexRect: out.debug << "texRECT"; break;
case EOpTexRectProj: out.debug << "texRECTproj"; break;
case EOpShadow2D: out.debug << "shadow2D"; break;
case EOpShadow2DProj:out.debug << "shadow2Dproj"; break;
case EOpTex2DArray: out.debug << "tex2DArray"; break;
case EOpTex2DArrayLod: out.debug << "tex2DArrayLod"; break;
case EOpTex2DArrayBias: out.debug << "tex2DArrayBias"; break;
default: out.debug.message(EPrefixError, "Bad aggregation op");
}
if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)
out.debug << " (" << node->getCompleteString() << ")";
out.debug << "\n";
return true;
}
bool OutputSelection(bool, /* preVisit */ TIntermSelection* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputTreeText(out, node, oit->depth);
out.debug << "ternary ?:";
out.debug << " (" << node->getCompleteString() << ")\n";
++oit->depth;
OutputTreeText(oit->infoSink, node, oit->depth);
out.debug << "Condition\n";
node->getCondition()->traverse(it);
OutputTreeText(oit->infoSink, node, oit->depth);
if (node->getTrueBlock())
{
out.debug << "true case\n";
node->getTrueBlock()->traverse(it);
}
else
out.debug << "true case is null\n";
if (node->getFalseBlock())
{
OutputTreeText(oit->infoSink, node, oit->depth);
out.debug << "false case\n";
node->getFalseBlock()->traverse(it);
}
--oit->depth;
return false;
}
void OutputConstant(TIntermConstant* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
int size = node->getCount();
for (int i = 0; i < size; i++)
{
OutputTreeText(out, node, oit->depth);
switch (node->getValue(i).type)
{
case EbtBool:
if (node->toBool(i))
out.debug << "true";
else
out.debug << "false";
out.debug << " (" << "const bool" << ")";
out.debug << "\n";
break;
case EbtFloat:
{
char buf[300];
sprintf(buf, "%f (%s)", node->toFloat(i), "const float");
out.debug << buf << "\n";
}
break;
case EbtInt:
{
char buf[300];
sprintf(buf, "%d (%s)", node->toInt(i), "const int");
out.debug << buf << "\n";
break;
}
default:
out.info.message(EPrefixInternalError, "Unknown constant", node->getLine());
break;
}
}
}
bool OutputLoop(bool, /* preVisit */ TIntermLoop* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputTreeText(out, node, oit->depth);
out.debug << "Loop with condition ";
if (node->getType() == ELoopDoWhile)
out.debug << "not ";
out.debug << "tested first\n";
++oit->depth;
OutputTreeText(oit->infoSink, node, oit->depth);
if (node->getCondition())
{
out.debug << "Loop Condition\n";
node->getCondition()->traverse(it);
}
else
out.debug << "No loop condition\n";
OutputTreeText(oit->infoSink, node, oit->depth);
if (node->getBody())
{
out.debug << "Loop Body\n";
node->getBody()->traverse(it);
}
else
out.debug << "No loop body\n";
if (node->getExpression())
{
OutputTreeText(oit->infoSink, node, oit->depth);
out.debug << "Loop Terminal Expression\n";
node->getExpression()->traverse(it);
}
--oit->depth;
return false;
}
bool OutputBranch(bool, /* previsit*/ TIntermBranch* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputTreeText(out, node, oit->depth);
switch (node->getFlowOp())
{
case EOpKill: out.debug << "Branch: Kill"; break;
case EOpBreak: out.debug << "Branch: Break"; break;
case EOpContinue: out.debug << "Branch: Continue"; break;
case EOpReturn: out.debug << "Branch: Return"; break;
default: out.debug << "Branch: Unknown Branch"; break;
}
if (node->getExpression())
{
out.debug << " with expression\n";
++oit->depth;
node->getExpression()->traverse(it);
--oit->depth;
}
else
out.debug << "\n";
return false;
}
void ir_output_tree(TIntermNode* root, TInfoSink& infoSink)
{
if (root == 0)
return;
TOutputTraverser it(infoSink);
it.visitAggregate = OutputAggregate;
it.visitBinary = OutputBinary;
it.visitConstant = OutputConstant;
it.visitSelection = OutputSelection;
it.visitSymbol = OutputSymbol;
it.visitUnary = OutputUnary;
it.visitLoop = OutputLoop;
it.visitBranch = OutputBranch;
root->traverse(&it);
}
| mit |
sgpm-generator/sgpm-generator | sgpm/singapore-gurkhas-050116-gcspf-gurkha-contingent-archives-st-3jpg.html | 8206 | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>singapore-gurkhas-050116-gcspf-gurkha-contingent-archives-ST-3.jpg</title>
<!-- URL Structures -->
<link rel="canonical" href="http://sgpm-generator.github.io/sgpm/singapore-gurkhas-050116-gcspf-gurkha-contingent-archives-st-3jpg.html">
<link rel="alternate" type="application/rss+xml" title="Singapore Gurkha Photography Museum" href="http://sgpm-generator.github.io/feed.xml">
<!-- OPENGRAPH tags for Social Media linking -->
<meta content="Singapore Gurkha Photography Museum" property="og:site_name">
<meta content="singapore-gurkhas-050116-gcspf-gurkha-contingent-archives-ST-3.jpg" property="og:title">
<meta content="article" property="og:type">
<meta name="description" content="The Singapore Gurkha Photography Museum project is an online archive of photographs and documents contributed by former members of the Singapore Gurkhas.
" property="og:description">
<meta content="http://sgpm-generator.github.io/sgpm/singapore-gurkhas-050116-gcspf-gurkha-contingent-archives-st-3jpg.html" property="og:url">
<meta content="/img/surfaceiv/F7F7F6AD-E2F3-438E-9853-5912CEB6D416.jpg" property="og:image">
<meta content="1950s" property="article:tag">
<meta content="1960s" property="article:tag">
<meta content="1970s" property="article:tag">
<meta content="1980s" property="article:tag">
<meta content="1990s" property="article:tag">
<meta content="bhairahawa" property="article:tag">
<meta content="dharan" property="article:tag">
<meta content="gurkhas" property="article:tag">
<meta content="kathmandu" property="article:tag">
<meta content="nepal" property="article:tag">
<meta content="pokhara" property="article:tag">
<meta content="singapore" property="article:tag">
<meta content="singapore gurkha archive" property="article:tag">
<meta content="singapore gurkha old photographs" property="article:tag">
<meta content="singapore gurkha photography museum" property="article:tag">
<meta content="singapore gurkhas" property="article:tag">
<!-- OPENGRAPH tags end -->
<!-- CSS -->
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-theme.min.css">
<!-- Custom CSS -->
<style>
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700italic,700,400italic);
.sgpm-title a {
color: #030303;
}
.main-gallery > ul {
margin-bottom:1.414em;
padding-left:0;
}
.no-bullets {
list-style:none;
padding-left:0;
}
.no-bullets > ul {
list-style:none;
padding-left:0;
}
body {min-width:420px;}
footer {
margin-top:2.84em;
padding-top:1.414em;
border-top:0.3px solid #aaa ;
}
header {
margin-bottom:2.84em;
}
main {
display:block;
clear:both;
}
</style>
</head>
<body class="container">
<header class="row">
<!-- masthead -->
<div class="col-xs-4" style="display:table-block;">
<h1 class="sgpm-title hidden-xs hidden-sm"><strong><a class="site-title" href="/">Singapore Gurkha Photography Museum</a></strong></h1>
<h2 class="sgpm-title visible-sm"><strong><a class="site-title" href="/">Singapore Gurkha Photography Museum</a></strong></h2>
<h3 class="sgpm-title visible-xs"><strong><a class="site-title" href="/">Singapore Gurkha Photography Museum</a></strong></h3>
<!-- searchbar-->
<div class="">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button"><span class="hidden-xs">Search</span><span class="visible-xs">Go</span></button>
</span>
</div>
</div>
<!-- searchbar end -->
</div>
<!-- masthead end -->
<nav class="col-xs-4 col-xs-offset-2 col-sm-offset-1">
<ul class="nav col-xs-12" style="padding-top:1.41em;border-left:solid 0.3px #aaa" >
<!-- navlinks -->
<li class="active">
<a href="/about.html">About</a>
</li>
<li class="active">
<a href="/archive.html">Archive</a>
</li>
<li class="active">
<a href="/articles.html">Articles</a>
</li>
<li class="active">
<a href="/contact.html">Contact</a>
</li>
<!-- navlinks end-->
<!-- dev links -->
<li class="small">(these are links for development)</li>
<li class="active">
<a href="/sgpm-list.html">Brute Force List</a>
</li>
<li class="active">
<a href="/basic-generator.html">Brute Generator</a>
</li>
<!-- dev links end-->
</ul>
</nav>
</header>
<main class="row">
<img class="img-responsive" src="../img/singapore-gurkhas-050116-gcspf-gurkha-contingent-archives-ST-3.jpg" />
<h3>Photo from: Shivraj Thapa / Singapore Gurkha Photography Museum</h3>
<p>
Shivraj Thapa's section of men posing for a photograph outside Block 'E'. Date: 1979.
</p>
<ul style="list-style:none;margin-left:0;">
<a href="/tags/1950s" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> 1950s </li></a>
<a href="/tags/1960s" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> 1960s </li></a>
<a href="/tags/1970s" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> 1970s </li></a>
<a href="/tags/1980s" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> 1980s </li></a>
<a href="/tags/1990s" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> 1990s </li></a>
<a href="/tags/bhairahawa" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> bhairahawa </li></a>
<a href="/tags/dharan" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> dharan </li></a>
<a href="/tags/gurkhas" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> gurkhas </li></a>
<a href="/tags/kathmandu" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> kathmandu </li></a>
<a href="/tags/nepal" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> nepal </li></a>
<a href="/tags/pokhara" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> pokhara </li></a>
<a href="/tags/singapore" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> singapore </li></a>
<a href="/tags/singapore gurkha archive" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> singapore gurkha archive </li></a>
<a href="/tags/singapore gurkha old photographs" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> singapore gurkha old photographs </li></a>
<a href="/tags/singapore gurkha photography museum" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> singapore gurkha photography museum </li></a>
<a href="/tags/singapore gurkhas" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> singapore gurkhas </li></a>
</ul>
</main>
<footer class="row">
<div class="col-sm-4">
<h5 style="margin:0;font-weight:600;">©2016 Singapore Gurkha Photography Museum</h5>
</div>
<div class="col-sm-4">
<ul class="no-bullets">
<!-- contact -->
<li><strong>email: </strong><a href="mailto:[email protected]">[email protected]</a></li>
<!-- social media -->
</ul>
</div>
<div class="col-sm-4">
<p class="small">The Singapore Gurkha Photography Museum project is an online archive of photographs and documents contributed by former members of the Singapore Gurkhas.
</p>
</div>
</footer>
<!-- jQuery -->
<script src="/js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="/js/bootstrap.min.js"></script>
</body>
</html>
| mit |
aggiedefenders/aggiedefenders.github.io | node_modules/@firebase/firestore/dist/esm/src/local/persistence_promise.js | 6111 | /**
* Copyright 2017 Google Inc.
*
* 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.
*/
import { fail } from '../util/assert';
/**
* PersistencePromise<> is essentially a re-implementation of Promise<> except
* it has a .next() method instead of .then() and .next() and .catch() callbacks
* are executed synchronously when a PersistencePromise resolves rather than
* asynchronously (Promise<> implementations use setImmediate() or similar).
*
* This is necessary to interoperate with IndexedDB which will automatically
* commit transactions if control is returned to the event loop without
* synchronously initiating another operation on the transaction.
*
* NOTE: .then() and .catch() only allow a single consumer, unlike normal
* Promises.
*/
var PersistencePromise = /** @class */ (function () {
function PersistencePromise(callback) {
var _this = this;
// NOTE: next/catchCallback will always point to our own wrapper functions,
// not the user's raw next() or catch() callbacks.
this.nextCallback = null;
this.catchCallback = null;
// When the operation resolves, we'll set result or error and mark isDone.
this.result = undefined;
this.error = null;
this.isDone = false;
// Set to true when .then() or .catch() are called and prevents additional
// chaining.
this.callbackAttached = false;
callback(function (value) {
_this.isDone = true;
_this.result = value;
if (_this.nextCallback) {
// value should be defined unless T is Void, but we can't express
// that in the type system.
_this.nextCallback(value);
}
}, function (error) {
_this.isDone = true;
_this.error = error;
if (_this.catchCallback) {
_this.catchCallback(error);
}
});
}
PersistencePromise.prototype.catch = function (fn) {
return this.next(undefined, fn);
};
PersistencePromise.prototype.next = function (nextFn, catchFn) {
var _this = this;
if (this.callbackAttached) {
fail('Called next() or catch() twice for PersistencePromise');
}
this.callbackAttached = true;
if (this.isDone) {
if (!this.error) {
return this.wrapSuccess(nextFn, this.result);
}
else {
return this.wrapFailure(catchFn, this.error);
}
}
else {
return new PersistencePromise(function (resolve, reject) {
_this.nextCallback = function (value) {
_this.wrapSuccess(nextFn, value).next(resolve, reject);
};
_this.catchCallback = function (error) {
_this.wrapFailure(catchFn, error).next(resolve, reject);
};
});
}
};
PersistencePromise.prototype.toPromise = function () {
var _this = this;
return new Promise(function (resolve, reject) {
_this.next(resolve, reject);
});
};
PersistencePromise.prototype.wrapUserFunction = function (fn) {
try {
var result = fn();
if (result instanceof PersistencePromise) {
return result;
}
else {
return PersistencePromise.resolve(result);
}
}
catch (e) {
return PersistencePromise.reject(e);
}
};
PersistencePromise.prototype.wrapSuccess = function (nextFn, value) {
if (nextFn) {
return this.wrapUserFunction(function () { return nextFn(value); });
}
else {
// If there's no nextFn, then R must be the same as T but we
// can't express that in the type system.
return PersistencePromise.resolve(value);
}
};
PersistencePromise.prototype.wrapFailure = function (catchFn, error) {
if (catchFn) {
return this.wrapUserFunction(function () { return catchFn(error); });
}
else {
return PersistencePromise.reject(error);
}
};
PersistencePromise.resolve = function (result) {
return new PersistencePromise(function (resolve, reject) {
resolve(result);
});
};
PersistencePromise.reject = function (error) {
return new PersistencePromise(function (resolve, reject) {
reject(error);
});
};
PersistencePromise.waitFor = function (all) {
return all.reduce(function (promise, nextPromise, idx) {
return promise.next(function () {
return nextPromise;
});
}, PersistencePromise.resolve());
};
PersistencePromise.map = function (all) {
var results = [];
var first = true;
// initial is ignored, so we can cheat on the type.
var initial = PersistencePromise.resolve(null);
return all
.reduce(function (promise, nextPromise) {
return promise.next(function (result) {
if (!first) {
results.push(result);
}
first = false;
return nextPromise;
});
}, initial)
.next(function (result) {
results.push(result);
return results;
});
};
return PersistencePromise;
}());
export { PersistencePromise };
//# sourceMappingURL=persistence_promise.js.map
| mit |
erig0/textadept-vi | test/tests/pct.lua | 2182 | -- Test brace/bracket (and #if etc.) matching
test.open('bracket.txt')
local lineno = test.lineno
local colno = test.colno
local assertEq = test.assertEq
local log = test.log
assertEq(lineno(), 0) assertEq(colno(), 0)
test.key('%')
assertEq(lineno(), 0) assertEq(colno(), 7)
test.key('%', 'l')
assertEq(lineno(), 0) assertEq(colno(), 1)
test.key('%')
assertEq(lineno(), 0) assertEq(colno(), 6)
test.key('%', 'l')
assertEq(lineno(), 0) assertEq(colno(), 2)
test.key('%')
assertEq(lineno(), 0) assertEq(colno(), 5)
test.key('%', 'l')
assertEq(lineno(), 0) assertEq(colno(), 3)
test.key('%')
assertEq(lineno(), 0) assertEq(colno(), 4)
test.key('%')
assertEq(lineno(), 0) assertEq(colno(), 3)
test.key('5', 'l')
assertEq(lineno(), 0) assertEq(colno(), 8)
local startcol = 8
local endcol = 24
-- Loop through the matching pairs
while startcol < (endcol-2) do
test.key('%')
assertEq(lineno(), 0) assertEq(colno(), endcol)
test.key('%', 'l')
assertEq(lineno(), 0) assertEq(colno(), startcol+1)
startcol = startcol + 1
endcol = endcol - 1
end
test.key('j')
assertEq(lineno(), 1) assertEq(colno(), 0)
-- And the same on different lines
local startline = 1
local endline = 9
-- Loop through the matching pairs on different lines
while startline < (endline-2) do
test.key('%')
assertEq(lineno(), endline) assertEq(colno(), 0)
test.key('%', 'j')
assertEq(lineno(), startline+1) assertEq(colno(), 0)
startline = startline + 1
endline = endline - 1
end
-- Test C preprocessor matching
local matches = {
-- sequences of line numbers (% should rotate in order)
{ 11, 14, 17, 18 },
{ 12, 13 },
{ 15, 16 },
}
local function goto_line(n)
local ui_lineno = n + 1
local keystring = tostring(ui_lineno) .. "G"
for i=1, keystring:len() do
test.key(keystring:sub(i, i))
end
end
for _,v in ipairs(matches) do
for i,lno in ipairs(v) do
goto_line(lno)
assertEq(lineno(), lno)
test.key('%')
if i < #v then
assertEq(lineno(), v[i+1])
else
assertEq(lineno(), v[1])
end
end
end
-- Try with an action
assertEq(buffer.line_count, 19)
test.keys('2Gd%')
assertEq(buffer.line_count, 10)
| mit |
sealocal/yumhacker | app/assets/javascripts/views/main/index_establishments_list_view.js | 825 | MainIndexEstablishmentsListView = Backbone.View.extend({
events: {
'click .nav': 'navigate'
},
initialize: function () {
this.listenTo(this.collection, 'reset', this.render);
},
render: function (e) {
this.$el.html('');
if (this.collection.length > 0) {
this.collection.each(function (establishment) {
this.renderEstablishment(establishment);
}, this);
} else {
this.$el.html('');
this.$el.html(render('establishments/index_no_results'));
}
},
renderEstablishment: function (establishment) {
var establishment_view = new EstablishmentsIndexEstablishmentView({
tagName: 'li',
model: establishment
});
this.$el.append(establishment_view.el);
},
navigate: function (e) {
e.preventDefault();
App.navigate(e.target.pathname, { trigger: true });
}
});
| mit |
paladini/UFSC-so1-2015-01 | trabalhos/atividadePratica2/final/lib/BOOOS.cc | 979 | /*
* BOOOS.h
*
* Created on: Aug 14, 2014
*/
#ifndef TASK_CC_
#define TASK_CC_
#include "BOOOS.h"
#include <iostream>
namespace BOOOS {
BOOOS * BOOOS::__booos = 0;
BOOOS::SchedulerType BOOOS::SCHED_POLICY = BOOOS::SCHED_FCFS; // ou outro escalonador. Ajustem como necessário
bool BOOOS::SCHED_PREEMPT = false; // pode ser preemptivo ou não
bool BOOOS::SCHED_AGING = false; // apenas alguns escalonadores usam aging. Ajustem como necessário
BOOOS::BOOOS(bool verbose) : _verbose(verbose) {
if(_verbose) std::cout << "Welcome to BOOOS - Basic Object Oriented Operating System!" << std::endl;
// Call init routines of other components
this->init();
}
BOOOS::~BOOOS() {
// Call finish routines of other components (if any)
if(_verbose) std::cout << "BOOOS ended... Bye!" << std::endl;
}
void BOOOS::init() {
Task::init();
Scheduler::init();
}
void BOOOS::panic() {
std::cerr << "BOOOSta! Panic!" << std::endl;
while(true);
}
} /* namespace BOOOS */
#endif | mit |
georghinkel/ttc2017smartGrids | solutions/NMF/Schema/IEC61970/Informative/InfERPSupport/ErpInvoiceKind.cs | 2268 | //------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
using NMF.Collections.Generic;
using NMF.Collections.ObjectModel;
using NMF.Expressions;
using NMF.Expressions.Linq;
using NMF.Models;
using NMF.Models.Collections;
using NMF.Models.Expressions;
using NMF.Models.Meta;
using NMF.Models.Repository;
using NMF.Serialization;
using NMF.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using TTC2017.SmartGrids.CIM.IEC61968.AssetModels;
using TTC2017.SmartGrids.CIM.IEC61968.Assets;
using TTC2017.SmartGrids.CIM.IEC61968.Common;
using TTC2017.SmartGrids.CIM.IEC61968.Customers;
using TTC2017.SmartGrids.CIM.IEC61968.Work;
using TTC2017.SmartGrids.CIM.IEC61970.Core;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.Financial;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfAssetModels;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfAssets;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfCommon;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfCustomers;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfLocations;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfOperations;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfTypeAsset;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfWork;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.MarketOperations;
using TTC2017.SmartGrids.CIM.IEC61970.Meas;
namespace TTC2017.SmartGrids.CIM.IEC61970.Informative.InfERPSupport
{
[TypeConverterAttribute(typeof(ErpInvoiceKindConverter))]
[ModelRepresentationClassAttribute("http://iec.ch/TC57/2009/CIM-schema-cim14#//IEC61970/Informative/InfERPSupport/Erp" +
"InvoiceKind")]
public enum ErpInvoiceKind
{
Purchase = 0,
Sales = 1,
}
}
| mit |
liuxx001/BodeAbp | src/frame/Abp.Web.Common/Web/Api/ProxyScripting/Generators/ProxyScriptingJsFuncHelper.cs | 2365 | using System;
using System.Linq;
using System.Text;
using Abp.Collections.Extensions;
using Abp.Extensions;
using Abp.Web.Api.Modeling;
namespace Abp.Web.Api.ProxyScripting.Generators
{
internal static class ProxyScriptingJsFuncHelper
{
private const string ValidJsVariableNameChars = "abcdefghijklmnopqrstuxwvyzABCDEFGHIJKLMNOPQRSTUXWVYZ0123456789_";
public static string NormalizeJsVariableName(string name, string additionalChars = "")
{
var validChars = ValidJsVariableNameChars + additionalChars;
var sb = new StringBuilder(name);
sb.Replace('-', '_');
//Delete invalid chars
foreach (var c in name)
{
if (!validChars.Contains(c))
{
sb.Replace(c.ToString(), "");
}
}
if (sb.Length == 0)
{
return "_" + Guid.NewGuid().ToString("N").Left(8);
}
return sb.ToString();
}
public static string GetParamNameInJsFunc(ParameterApiDescriptionModel parameterInfo)
{
return parameterInfo.Name == parameterInfo.NameOnMethod
? NormalizeJsVariableName(parameterInfo.Name.ToCamelCase(), ".")
: NormalizeJsVariableName(parameterInfo.NameOnMethod.ToCamelCase()) + "." + NormalizeJsVariableName(parameterInfo.Name.ToCamelCase(), ".");
}
public static string CreateJsObjectLiteral(ParameterApiDescriptionModel[] parameters, int indent = 0)
{
var sb = new StringBuilder();
sb.AppendLine("{");
foreach (var prm in parameters)
{
sb.AppendLine($"{new string(' ', indent)} '{prm.Name}': {GetParamNameInJsFunc(prm)}");
}
sb.Append(new string(' ', indent) + "}");
return sb.ToString();
}
public static string GenerateJsFuncParameterList(ActionApiDescriptionModel action, string ajaxParametersName)
{
var methodParamNames = action.Parameters.Select(p => p.NameOnMethod).Distinct().ToList();
methodParamNames.Add(ajaxParametersName);
return methodParamNames.Select(prmName => NormalizeJsVariableName(prmName.ToCamelCase())).JoinAsString(", ");
}
}
} | mit |
StratifyLabs/StratifyAPI | include/var/Stack.hpp | 1819 | /*! \file */ // Copyright 2011-2020 Tyler Gilbert and Stratify Labs, Inc; see LICENSE.md for rights.
#ifndef SAPI_VAR_STACK_HPP_
#define SAPI_VAR_STACK_HPP_
#include <new>
#include <cstdio>
#include <deque>
#include "../arg/Argument.hpp"
namespace var {
/*! \brief Queue Class
* \details The Queue class is a FIFO data structure
* that allows data to be pushed on the back
* and popped from the front. It is similar to the
* std::queue container class.
*
*/
template<typename T> class Stack : public api::WorkObject {
public:
/*! \details Constructs a new Queue. */
Stack(){}
~Stack(){
}
/*! \details Returns a reference to the back item.
*
* The back item is the one that has most recently
* been pushed using push().
*
*/
T & top(){
return m_deque.back();
}
/*! \details Returns a read-only reference to the back item.
*
* The back item is the one that has most recently
* been pushed using push().
*
*/
const T & top() const {
return m_deque.back();
}
/*! \details Pushes an item on the queue.
*
* @param value The item to push
*
*/
Stack& push(const T & value){
m_deque.push_back(value);
return *this;
}
/*! \details Pops an item from the front of the queue. */
Stack& pop(){
m_deque.pop_back();
return *this;
}
/*! \details Returns true if the queue is empty. */
bool is_empty() const { return m_deque.empty(); }
/*! \details Returns the number of items in the queue. */
u32 count() const {
return m_deque.size();
}
/*! \details Clears the contents of the queue.
*
* This will empty the queue and free all the
* resources associated with it.
*
*/
Stack& clear(){
//deconstruct objects in the list using pop
m_deque.clear();
return *this;
}
private:
std::deque<T> m_deque;
};
}
#endif // SAPI_VAR_STACK_HPP_
| mit |
naster01/DataCloner | archive/DataCloner.Core/Data/Generator/InsertWriter.cs | 2629 | using DataCloner.Core.Metadata;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
namespace DataCloner.Core.Data.Generator
{
public class InsertWriter : IInsertWriter
{
private string IdentifierDelemiterStart { get; }
private string IdentifierDelemiterEnd { get; }
private string StringDelemiter { get; }
private string NamedParameterPrefix { get; }
private readonly StringBuilder _sb = new StringBuilder();
public InsertWriter(string identifierDelemiterStart, string identifierDelemiterEnd , string stringDelemiter, string namedParameterPrefix)
{
IdentifierDelemiterStart = identifierDelemiterStart;
IdentifierDelemiterEnd = identifierDelemiterEnd;
StringDelemiter = stringDelemiter;
NamedParameterPrefix = namedParameterPrefix;
}
public IInsertWriter AppendColumns(TableIdentifier table, List<ColumnDefinition> columns)
{
_sb.Append("INSERT INTO ")
.Append(IdentifierDelemiterStart).Append(table.Database).Append(IdentifierDelemiterEnd).Append(".");
if (!String.IsNullOrWhiteSpace(table.Schema))
_sb.Append(IdentifierDelemiterStart).Append(table.Schema).Append(IdentifierDelemiterEnd).Append(".");
_sb.Append(IdentifierDelemiterStart).Append(table.Table).Append(IdentifierDelemiterEnd)
.Append("(");
//Nom des colonnes
for (var i = 0; i < columns.Count(); i++)
{
if (!columns[i].IsAutoIncrement)
_sb.Append(IdentifierDelemiterStart).Append(columns[i].Name).Append(IdentifierDelemiterEnd).Append(",");
}
_sb.Remove(_sb.Length - 1, 1);
_sb.Append(")VALUES(");
return this;
}
public IInsertWriter Append(string value)
{
_sb.Append(value);
return this;
}
public IInsertWriter AppendValue(object value)
{
_sb.Append(StringDelemiter).Append(value).Append(StringDelemiter).Append(",");
return this;
}
public IInsertWriter AppendVariable(string varName)
{
_sb.Append(NamedParameterPrefix).Append(varName).Append(",");
return this;
}
public IInsertWriter Complete()
{
_sb.Remove(_sb.Length - 1, 1);
_sb.Append(");\r\n");
return this;
}
public StringBuilder ToStringBuilder()
{
return _sb;
}
}
}
| mit |
misuqian/ExcelTool | eclipse/poi-3.12/docs/apidocs/org/apache/poi/class-use/POIXMLFactory.html | 13662 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>Uses of Class org.apache.poi.POIXMLFactory (POI API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.poi.POIXMLFactory (POI API Documentation)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/poi/class-use/POIXMLFactory.html" target="_top">Frames</a></li>
<li><a href="POIXMLFactory.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.poi.POIXMLFactory" class="title">Uses of Class<br>org.apache.poi.POIXMLFactory</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.apache.poi">org.apache.poi</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="#org.apache.poi.xslf.usermodel">org.apache.poi.xslf.usermodel</a></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="#org.apache.poi.xssf.usermodel">org.apache.poi.xssf.usermodel</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="#org.apache.poi.xwpf.usermodel">org.apache.poi.xwpf.usermodel</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.apache.poi">
<!-- -->
</a>
<h3>Uses of <a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a> in <a href="../../../../org/apache/poi/package-summary.html">org.apache.poi</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../org/apache/poi/package-summary.html">org.apache.poi</a> with parameters of type <a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../org/apache/poi/POIXMLDocumentPart.html" title="class in org.apache.poi">POIXMLDocumentPart</a></code></td>
<td class="colLast"><span class="strong">POIXMLDocumentPart.</span><code><strong><a href="../../../../org/apache/poi/POIXMLDocumentPart.html#createRelationship(org.apache.poi.POIXMLRelation,%20org.apache.poi.POIXMLFactory)">createRelationship</a></strong>(<a href="../../../../org/apache/poi/POIXMLRelation.html" title="class in org.apache.poi">POIXMLRelation</a> descriptor,
<a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a> factory)</code>
<div class="block">Create a new child POIXMLDocumentPart</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/apache/poi/POIXMLDocumentPart.html" title="class in org.apache.poi">POIXMLDocumentPart</a></code></td>
<td class="colLast"><span class="strong">POIXMLDocumentPart.</span><code><strong><a href="../../../../org/apache/poi/POIXMLDocumentPart.html#createRelationship(org.apache.poi.POIXMLRelation,%20org.apache.poi.POIXMLFactory,%20int)">createRelationship</a></strong>(<a href="../../../../org/apache/poi/POIXMLRelation.html" title="class in org.apache.poi">POIXMLRelation</a> descriptor,
<a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a> factory,
int idx)</code>
<div class="block">Create a new child POIXMLDocumentPart</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="../../../../org/apache/poi/POIXMLDocumentPart.html" title="class in org.apache.poi">POIXMLDocumentPart</a></code></td>
<td class="colLast"><span class="strong">POIXMLDocumentPart.</span><code><strong><a href="../../../../org/apache/poi/POIXMLDocumentPart.html#createRelationship(org.apache.poi.POIXMLRelation,%20org.apache.poi.POIXMLFactory,%20int,%20boolean)">createRelationship</a></strong>(<a href="../../../../org/apache/poi/POIXMLRelation.html" title="class in org.apache.poi">POIXMLRelation</a> descriptor,
<a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a> factory,
int idx,
boolean noRelation)</code>
<div class="block">Create a new child POIXMLDocumentPart</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><span class="strong">POIXMLDocument.</span><code><strong><a href="../../../../org/apache/poi/POIXMLDocument.html#load(org.apache.poi.POIXMLFactory)">load</a></strong>(<a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a> factory)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><span class="strong">POIXMLDocumentPart.</span><code><strong><a href="../../../../org/apache/poi/POIXMLDocumentPart.html#read(org.apache.poi.POIXMLFactory,%20java.util.Map)">read</a></strong>(<a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a> factory,
java.util.Map<<a href="../../../../org/apache/poi/openxml4j/opc/PackagePart.html" title="class in org.apache.poi.openxml4j.opc">PackagePart</a>,<a href="../../../../org/apache/poi/POIXMLDocumentPart.html" title="class in org.apache.poi">POIXMLDocumentPart</a>> context)</code>
<div class="block">Iterate through the underlying PackagePart and create child POIXMLFactory instances
using the specified factory</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.apache.poi.xslf.usermodel">
<!-- -->
</a>
<h3>Uses of <a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a> in <a href="../../../../org/apache/poi/xslf/usermodel/package-summary.html">org.apache.poi.xslf.usermodel</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation">
<caption><span>Subclasses of <a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a> in <a href="../../../../org/apache/poi/xslf/usermodel/package-summary.html">org.apache.poi.xslf.usermodel</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/poi/xslf/usermodel/XSLFFactory.html" title="class in org.apache.poi.xslf.usermodel">XSLFFactory</a></strong></code>
<div class="block">Instantiates sub-classes of POIXMLDocumentPart depending on their relationship type</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.apache.poi.xssf.usermodel">
<!-- -->
</a>
<h3>Uses of <a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a> in <a href="../../../../org/apache/poi/xssf/usermodel/package-summary.html">org.apache.poi.xssf.usermodel</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation">
<caption><span>Subclasses of <a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a> in <a href="../../../../org/apache/poi/xssf/usermodel/package-summary.html">org.apache.poi.xssf.usermodel</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/poi/xssf/usermodel/XSSFFactory.html" title="class in org.apache.poi.xssf.usermodel">XSSFFactory</a></strong></code>
<div class="block">Instantiates sub-classes of POIXMLDocumentPart depending on their relationship type</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.apache.poi.xwpf.usermodel">
<!-- -->
</a>
<h3>Uses of <a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a> in <a href="../../../../org/apache/poi/xwpf/usermodel/package-summary.html">org.apache.poi.xwpf.usermodel</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation">
<caption><span>Subclasses of <a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">POIXMLFactory</a> in <a href="../../../../org/apache/poi/xwpf/usermodel/package-summary.html">org.apache.poi.xwpf.usermodel</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/poi/xwpf/usermodel/XWPFFactory.html" title="class in org.apache.poi.xwpf.usermodel">XWPFFactory</a></strong></code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../org/apache/poi/POIXMLFactory.html" title="class in org.apache.poi">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/poi/class-use/POIXMLFactory.html" target="_top">Frames</a></li>
<li><a href="POIXMLFactory.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
<i>Copyright 2015 The Apache Software Foundation or
its licensors, as applicable.</i>
</small></p>
</body>
</html>
| mit |
dcjones/Gadfly.jl | test/testscripts/raster.jl | 179 | using Gadfly, RDatasets
set_default_plot_size(6inch, 3inch)
plot(dataset("Zelig", "macro"), x="Year", y="Country", color="GDP",
Coord.cartesian(raster=true), Geom.rectbin)
| mit |
yubin-huang/jscheckstyle | lib/rules.js | 1979 | var rules = module.exports = [];
function Checker(name, rule) {
this.name = name;
this.rule = rule;
this.check = function(results) {
var violations = [], that = this;
results.filter(function(result) {
return result.shortName !== '[[code]]';
}).forEach(function (result) {
var violation = that.rule(result);
if (violation) {
if (!result.violations) {
result.violations = [];
}
result.violations.push({
message: violation,
source: that.name
});
}
violations.push(result);
});
return violations;
};
}
rules.Checker = Checker;
rules.push(
new Checker("FunctionLength", function(result) {
var config = result.config || {};
var functionLength = config.functionLength || 30;
if (result.shortName !== 'module.exports' && result.lines > functionLength) {
return result.shortName + " is " + result.lines + " lines long, maximum allowed is " + functionLength;
}
return null;
})
);
rules.push(
new Checker("CyclomaticComplexity", function(result) {
var config = result.config || {};
var cyclomaticComplexity = config.cyclomaticComplexity || 10;
if (result.complexity > cyclomaticComplexity) {
return result.shortName + " has a cyclomatic complexity of " + result.complexity + ", maximum should be " + cyclomaticComplexity;
}
return null;
})
);
rules.push(
new Checker("NumberOfArguments", function(result) {
var config = result.config || {};
var numberOfArguments = config.numberOfArguments || 5;
if (result.ins > numberOfArguments) {
return result.shortName + " has " + result.ins + " arguments, maximum allowed is " + numberOfArguments;
}
return null;
})
);
| mit |
wanganyv/cii-best-practices-badge | doc/nyc-2016.md | 11028 | # NYC 2016 Brainstorming session
A 2016 brainstorming session was held in New York City to identify "best
practices" (though perhaps the term "recommended practices" is better,
since that's a more accurate description). In particular, the idea was
to help identify these practices.
Below are notes from that session - this was reviewed
to identify potential criteria (at any level).
This was also recorded as GitHub issue #473.
Practices of what? Not just code.
The top-level categories were;
- Good documentation
- Community mgmt
- Make it easy for people to contribute
- Testing
- Discoverability
- Release control
- Security disclosure/response
- License your project (OSS)
- CLAs
- Governance
- Security development lifecycle
- Operational security of project (project IT)
- Dependency mgmt (Ecosystem)
We Should packages "measure" best practice, e.g. for use at install time.
Difficult to apply one universal evaluation. Subjective, different concerns,
etc.
One challenge is that lessons learned don't spread.
Some practices are difficult to use because of signal-to-noise:
- make check generating thousands of legacy "problems"
- no power to assert "zero warnings" on other peoples' projects
- AI: perhaps have Debian (say) turn "make check" on by default so
that it has to be disabled selectively (rather than enabled)
AI: commonly-used build systems could be updated to do ASAN builds
and checks
Best practices can be trumped by business/commercial considerations
AI: distributions/packaging mechanisms would convey "best practice"
attributes to worthy packages. (TBD what counts as "worthy")
Below are more detailed recommended practices (these are raw notes from
the brainstorming session).
## Release control
1. Stable release branches - yes but in a different way. Instead of
"branches" (which is git-specific), we require the more general notion
of tagging, which is in version_tags
2. Version numbers for releases - yes, in version_unique
3. Use semantic versioning - yes, in version_semver
4. Version control - yes, in repo_public, repo_track, and repo_distributed
5. Release notes (major changes) for each release - yes, release_notes
6. Intermediate versions are publicly released (no surprises in release) -
yes, repo_interim
7. Issue tracker (GitHub, Bugzilla, etc.) - yes, report_process and
report_tracker.
## Good documentation & design
1. Documentation - yes, documentation_basics and documentation_interface
2. README explaining whys & hows - yes, documentation_basics, description_good
3. Published roadmap for future improvements - proposed as documentation_roadmap
4. A short intro about the project on the webpage & README -
yes, documentation_basics
5. API guidelines / style guide - for the API, see documentation_interface.
For code, proposed under coding_standards.
6. Design documents - **Added**. This is related to know_secure_design.
Some is in proposed implement_secure_design and
proposed documentation_security.
## Dependency management
1. Accurate makefile dependencies - If a project uses makefiles (or
something like them), and there are a few inaccurate dependencies,
those are just a bugs - we don't want them, but projects can find and
fix bugs. To be a criterion, we need a general rule that people should
follow that is widely agreed on as being an improvement & has evidence
to support it. This is harder. We could say, "maximally automate
dependencies" - but it's hard to measure maximal. We could say,
"avoid recursive make", citing
["Recursive Make Considered Harmful" by Peter Miller](http://aegis.sourceforge.net/auug97.pdf).
Note that
["Non-recursive Make Considered Harmful"](http://research.microsoft.com/en-us/um/people/simonpj/papers/ghc-shake/ghc-shake.pdf)
agrees that recursive make approaches are bad; its argument is that
for large projects you should use a tool other than make (which is
fine, we're agnostic about the build system - BadgeApp uses rake).
Something like: "The project MUST NOT use recursive-subdirectory build
systems where there are cross-dependencies in the subdirectories." -
draft criterion build_non_recursive
2. External dependencies listed and traceable - Added as external_dependencies. It doesn't specifically say "traceable", but we think it gets the point across.
## Code review
Code reviews - yes, see proposed two_person_review and security_review.
Maybe more specific code review criteria could be added, suggestions
welcome.
## Community Management
1. Code of conduct (CoC) - code_of_conduct.
2. Be nice - this is *not* universally agreed on. Wheeler suggests you
should be nice to people & hard on code, but many people have trouble
seeing the difference. Also, there's a difference between "I'm offended"
and "I'm attacked" - the latter is the issue. Suggest that the key
issue here is addressed by code_of_conduct.
3. Discoverability - Presumably in this context this is "can I find the
project?" and "Can I find out how to interact with it?" The first part
is primarily addressed by criterion description_good - since once that's
done, search engines can help people find it. Getting a badge also helps
with the first part. The second part is helped by criteria interact,
contribution, and contribution_requirements.
4. Have project & repo URL - already in criteria.
## Other
1. Feature roadmap - proposed in criterion documentation_roadmap.
2. KISS (Keep it Simple) - worthy goal, but very difficult to measure
and determine whether or not it's achieved. We do require that people
be aware of this, as part of criterion know_secure_design.
3. Use code formatters - proposed in criterion coding_standards_enforced.
We already had coding_standards, but based on this comment have split out
coding_standards_enforced as a separate item to emphasize enforcement.
We don't specifically require the use of a code formatter - many projects
simply use a checker, instead of a reformatter, so we simply require
enforcement and let the project decide how to enforce it.
## Security disclosure/reporting
1. Bug reporting instructions - yes, already there in criterion report_process.
2. Explain how to report vulnerabilities / A way to report security
bugs / Security vulnerability reporting procedure - yes, already there
in criterion vulnerability_report_process.
3. Incident response SLA. Yes, report_response and
vulnerability_report_response, vulnerabilities_fixed_60_days
## Operational security of project
1. Two-factor authentication for developers - proposed as
two_factor_authentication (passing+2)
2. Email/issue tracker security - Just saying "your project's development
infrastructure secure" is too nebulous - people will agree, but will say
they're already doing it. Email security is challenging; GnuPG is used,
but many find it difficult to deploy in practice, especially to less
technically savvy people. Mandating a specific technique, like GnuPG,
doesn't seem like a good approach. We're not sure how to turn this into
a specific criterion.
3. HTTPS for project & repo sites - yes, sites_https
4. Signed releases - yes, proposed as signed_releases
## Make it easy for people to contribute
1. Issues marked for new contributors - yes, proposed small_tasks
2. Contributing guide/doc - yes, in criteria interact, contribution,
and contribution_requirements
3. Documented process for how patches get accepted - yes, in criteria
interact, contribution, and contribution_requirements
4. Low barrier to entry (tools, workflows, etc.) - added as new potential
criterion installation_development_quick
5. Acknowledge bug reports (don’t just sit there) - yes, criterion
report_responses. This only requires a majority, not every single report.
6. Public comment channel (for support) - yes, report_archive,
report_archive, report_tracker, report_tracker
7. Acknowledge/credit contributions & contributors - Added
vulnerability_report_credit for giving credit for vulnerability reports.
For just generic contributions trying to do this separately can get very
long, and many successful projects don't try to do this. In addition,
version control systems already record this (e.g., "git log" and "git
blame"). In conclusion, it's not clear that adding this as a separate
criterion is a universal good for general contributions.
8. Assume good intention - give commit access soon, revoke & revert if
needed - No, because different successful projects disagree on this.
Node.js prefers this approach, however, many other successful projects
(such as the Linux kernel) expressly do *not* do this. In addition,
from a security point-of-view, assuming good intentions is not always
realistic, especially since "revoke and revert" can be difficult if the
commiter is actively malicious. Projects can choose whether or not to
do this.
## Testing!
1. Add tests when add major new functionality - yes, test_policy and
tests_are_added
2. Code coverage. Yes, proposed as test_statement_coverage80 and
test_statement_coverage90 and test_branch_coverage80
3. Test coverage >=N% (statement? Branch? other?) - Yes, proposed
as test_statement_coverage80 and test_statement_coverage90 and
test_branch_coverage80
4. Automated test suite - yes, criterion test
5. Make check with ASAN - yes, dynamic_analysis_unsafe
6. Continuous integration (2x) - yes, proposed criteria
continuous_integration and automated_integration_testing
7. Can build it - criterion build and build_common_tools; see also
build_repeatable and build_reproducible
8. For parsers, etc: FUZZ - yes in general, though we don't require
fuzzing specifically. Criterion dynamic_analysis.
9. Use dynamic analysis tools - Criterion dynamic_analysis.
10. Use static analysis tools / static analysis coverage of code -
yes for the first part - criterion static_analysis. Unclear what the
author meant about "static coverage of code" - if what was meant was
coverage of tests, see proposed criteria test_statement_coverage80 and
test_statement_coverage90 and test_branch_coverage80
11. Use warning flags - yes, criterion warning_flags and
proposed warnings_strict
## How to get best practices applied
These are not changes to the criteria, but ideas on how to get the
criteria more easily applied.
1. Make things easier/automatic (distro/repo maintainers) - Proposed
as https://github.com/linuxfoundation/cii-best-practices-badge/issues/621
2. Debtags.debian.net
3. Show intrinsic value to project
4. Submit these changes to popular projects
5. Contact Debian maintainer - put in tags to best practice badge
6. At usual time- tell user/developer best practices status
7. On GitHub/etc. Page, show some best practice status
8. Language-specific package managers (npm, bundler, …)
tell people if not meet best practices
9. $ pay project to change
10. Must uncomment (dependencies?) to get “ugly” packages
11. Run lintian and for … (Debian)
| mit |
willempx/verifast | examples/tutorial/solutions/list_solution_part4.c | 3525 | #include "stdlib.h"
struct node {
struct node* next;
int value;
};
struct list {
struct node* head;
};
/*@
predicate list(struct list* l, listval v)
requires l->head |-> ?head &*& lseg(head, 0, v) &*& malloc_block_list(l);
predicate lseg(struct node* from, struct node* to, listval v)
requires from == to ? v == nil :
from->next |-> ?next &*& from->value |-> ?val &*& malloc_block_node(from) &*& lseg(next, to, ?nextv) &*& v == cons(val, nextv);
inductive listval = | nil | cons(int, listval);
fixpoint listval addLast(listval v, int x)
{
switch(v) {
case nil: return cons(x, nil);
case cons(h, t): return cons(h, addLast(t, x));
}
}
fixpoint int listval_length(listval v)
{
switch(v) {
case nil: return 0;
case cons(h, t): return 1 + listval_length(t);
}
}
@*/
struct list* create_list()
//@ requires true;
//@ ensures list(result, nil);
{
struct list* l = malloc(sizeof(struct list));
if(l == 0) { abort(); }
l->head = 0;
//@ close lseg(0, 0, nil);
//@ close list(l, nil);
return l;
}
void add(struct list* l, int x)
//@ requires list(l, ?v);
//@ ensures list(l, addLast(v, x));
{
//@ open list(l, v);
struct node* h = add_helper(l->head, x);
l->head = h;
//@ close list(l, addLast(v, x));
}
struct node* add_helper(struct node* n, int x)
//@ requires lseg(n, 0, ?v);
//@ ensures lseg(result, 0, addLast(v, x));
{
//@ open lseg(n, 0, v);
struct node* newNode = 0;
if(n == 0) {
newNode = malloc(sizeof(struct node));
if(newNode == 0) { abort(); }
newNode->value = x;
newNode->next = 0;
//@ close lseg(0, 0, nil);
} else {
struct node* tmp = add_helper(n->next, x);
n->next = tmp;
newNode = n;
}
//@ close lseg(newNode, 0, addLast(v, x));
return newNode;
}
int list_length(struct list* l)
//@ requires list(l, ?v);
//@ ensures list(l, v) &*& result == listval_length(v);
{
//@ open list(l, v);
int myLength = list_length_helper(l->head);
//@ close list(l, v);
return myLength;
}
int list_length_helper(struct node* n)
//@ requires lseg(n, 0, ?v);
//@ ensures lseg(n, 0, v) &*& result == listval_length(v);
{
//@ open lseg(n, 0, v);
if(n == 0) {
//@ close lseg(0, 0, nil);
return 0;
} else {
int tmp = list_length_helper(n->next);
//@ close lseg(n, 0, v);
return tmp + 1;
}
}
void dispose(struct list* l)
//@ requires list(l, _);
//@ ensures true;
{
//@ open list(l, _);
struct node* current = l->head;
while(current != 0)
//@ invariant lseg(current, 0, _);
{
//@ open lseg(current, 0, _);
struct node* oldcurrent = current;
current = current->next;
free(oldcurrent);
}
//@ open lseg(0, 0, _);
free(l);
}
int main()
//@ requires true;
//@ ensures true;
{
struct list* l= create_list();
add(l, 1);
add(l, 2);
add(l, 2);
add(l, 4);
int tmp = list_length(l);
//@ assert tmp == 4;
dispose(l);
return 0;
}
/*@
lemma void length_positive_lemma(listval v)
requires true;
ensures 0 <= listval_length(v);
{
switch(v) {
case nil:
case cons(h, t): length_positive_lemma(t);
}
}
@*/
int main2(struct list* l)
//@ requires list(l, ?v);
//@ ensures true;
{
int tmp = list_length(l);
//@ length_positive_lemma(v);
//@ assert 0 <= tmp;
dispose(l);
return 0;
}
| mit |
bkiers/sqlite-parser | src/test/resources/boundary2.test_936.sql | 158 | -- boundary2.test
--
-- db eval {
-- SELECT a FROM t1 WHERE r < 549755813887 ORDER BY r DESC
-- }
SELECT a FROM t1 WHERE r < 549755813887 ORDER BY r DESC | mit |
nlgcoin/guldencoin-official | test/functional/wallet_resendwallettransactions.py | 2912 | #!/usr/bin/env python3
# Copyright (c) 2017-2018 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 that the wallet resends transactions periodically."""
from collections import defaultdict
import time
from test_framework.blocktools import create_block, create_coinbase
from test_framework.messages import ToHex
from test_framework.mininode import P2PInterface, mininode_lock
from test_framework.test_framework import GuldenTestFramework
from test_framework.util import assert_equal, wait_until
class P2PStoreTxInvs(P2PInterface):
def __init__(self):
super().__init__()
self.tx_invs_received = defaultdict(int)
def on_inv(self, message):
# Store how many times invs have been received for each tx.
for i in message.inv:
if i.type == 1:
# save txid
self.tx_invs_received[i.hash] += 1
class ResendWalletTransactionsTest(GuldenTestFramework):
def set_test_params(self):
self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
node = self.nodes[0] # alias
node.add_p2p_connection(P2PStoreTxInvs())
self.log.info("Create a new transaction and wait until it's broadcast")
txid = int(node.sendtoaddress(node.getnewaddress(), 1), 16)
# Can take a few seconds due to transaction trickling
wait_until(lambda: node.p2p.tx_invs_received[txid] >= 1, lock=mininode_lock)
# Add a second peer since txs aren't rebroadcast to the same peer (see filterInventoryKnown)
node.add_p2p_connection(P2PStoreTxInvs())
self.log.info("Create a block")
# Create and submit a block without the transaction.
# Transactions are only rebroadcast if there has been a block at least five minutes
# after the last time we tried to broadcast. Use mocktime and give an extra minute to be sure.
block_time = int(time.time()) + 6 * 60
node.setmocktime(block_time)
block = create_block(int(node.getbestblockhash(), 16), create_coinbase(node.getblockchaininfo()['blocks']), block_time)
block.nVersion = 3
block.rehash()
block.solve()
node.submitblock(ToHex(block))
# Transaction should not be rebroadcast
node.p2ps[1].sync_with_ping()
assert_equal(node.p2ps[1].tx_invs_received[txid], 0)
self.log.info("Transaction should be rebroadcast after 30 minutes")
# Use mocktime and give an extra 5 minutes to be sure.
rebroadcast_time = int(time.time()) + 41 * 60
node.setmocktime(rebroadcast_time)
wait_until(lambda: node.p2ps[1].tx_invs_received[txid] >= 1, lock=mininode_lock)
if __name__ == '__main__':
ResendWalletTransactionsTest().main()
| mit |
emakina-cee-oss/generator-emakinacee-react | test/compute.test.js | 3309 | const fs = require('fs');
const path = require('path');
const yoHelper = require('yeoman-test');
const yoAssert = require('yeoman-assert');
const generatorPath = '../packages/generator-emakinacee-react/generators/compute';
describe('Compute', () => {
describe('without module', () => {
before(() => {
return yoHelper
.run(path.join(__dirname, generatorPath))
.withArguments(['test-compute']);
});
it('generates all files to shared location', () => {
yoAssert.file([
'./src/shared/computes/testCompute.js',
'./src/shared/computes/testCompute.spec.js',
]);
});
it('compute file has valid content', (done) => {
fs.readFile(path.join(__dirname, './snapshots/compute/compute.js'), 'utf8', (err, template) => {
if (err) done(err);
if (!template || template === '') done(new Error('Template snapshot does not exist or is empty'));
yoAssert.fileContent(
'./src/shared/computes/testCompute.js',
template
);
done();
});
});
it('spec file has valid content', (done) => {
fs.readFile(path.join(__dirname, './snapshots/compute/compute.spec.js'), 'utf8', (err, template) => {
if (err) done(err);
if (!template || template === '') done(new Error('Template snapshot does not exist or is empty'));
yoAssert.fileContent(
'./src/shared/computes/testCompute.spec.js',
template
);
done();
});
});
});
describe('with module', () => {
before(() => {
return yoHelper
.run(path.join(__dirname, generatorPath))
.withArguments(['test-compute', 'test-module']);
});
it('generates all files to module location', () => {
yoAssert.file([
'./src/modules/TestModule/computes/testCompute.js',
'./src/modules/TestModule/computes/testCompute.spec.js',
]);
});
it('compute file has valid content', (done) => {
fs.readFile(path.join(__dirname, './snapshots/compute/compute.js'), 'utf8', (err, template) => {
if (err) done(err);
if (!template || template === '') done(new Error('Template snapshot does not exist or is empty'));
yoAssert.fileContent(
'./src/modules/TestModule/computes/testCompute.js',
template
);
done();
});
});
it('spec file has valid content', (done) => {
fs.readFile(path.join(__dirname, './snapshots/compute/compute.spec.js'), 'utf8', (err, template) => {
if (err) done(err);
if (!template || template === '') done(new Error('Template snapshot does not exist or is empty'));
yoAssert.fileContent(
'./src/modules/TestModule/computes/testCompute.spec.js',
template
);
done();
});
});
});
});
| mit |
OpenDataSTL/STLCourts-client | app/views/communityService.html | 2300 | <div class="sub-page-title-block">
<h1>Community Service Options</h1>
</div>
<div class="sub-page-container">
<p>
Maybe you have a ticket but can’t afford the fines and fees. Spending time doing community service can be an alternative to paying for some traffic violations, as long as the judge agrees.
</p>
<p>
If, when you see the judge, he/she agrees to a community service option in lieu of fines, it will be your responsibility to contact the Community Service agency, arrange for the community service time and date with them, and then bring back proof of your service to the judge.
</p>
<!-- possibly add back later
<p>
Search for an activity that makes sense for you by visiting the link for <a href="https://www.stlvolunteer.org/search?page=1&sort_c=0&sort_o=asc&opportunity_id=" target="_blank">Community Service Options</a>. Search through the entire list or narrow your search by keyword, schedule or location. Once a service activity is chosen, you need to register for the activity and tell the court.
</p>
<ol class="parenthesis-list">
<li>Select "Express Interest" on the <a href="https://www.stlvolunteer.org/search?page=1&sort_c=0&sort_o=asc&opportunity_id=" target="_blank">United Way's Volunteer Center</a> site.</li>
<li>Create an account. This way, you can access and print your record of hours and verification of completion at any time.</li>
<li>Choose a service activity and wait for the organization to contact you to schedule the activity.</li>
<li>Appear in court. Inform the judge of your interest in community service in lieu of payment and come to an agreement regarding the activity, number of hours and timeframe.</li>
<li>Do the community service and get a verification from your mentor, including the number of hours served.</li>
<li>Finally, once completed, provide the verification from your mentor to the court clerk, which can be done at any time. The clerk will present the verification to the judge who will determine if the service is satisfactory. If it is, your case will be cleared. If not, the clerk will contact you to schedule another court date.</li>
</ol>
<p>
Follow these six simple steps to complete community service as an alternative to paying fines and fees.
</p>
-->
</div>
| mit |
journeyPassenger/xian-session | docs/source/zh-cn/core/i18n.md | 3012 | title: I18n 国际化
---
为了方便开发多语言应用,框架内置了国际化(I18n)支持,由 [egg-i18n](https://github.com/eggjs/egg-i18n) 插件提供。
## 默认语言
默认语言是 `en-US`。假设我们想修改默认语言为简体中文:
```js
// config/config.default.js
exports.i18n = {
defaultLocale: 'zh-CN',
};
```
## 切换语言
我们可以通过下面几种方式修改应用的当前语言(修改后会记录到 `locale` 这个 Cookie),下次请求直接用设定好的语言。
优先级从高到低:
1. query: `/?locale=en-US`
2. cookie: `locale=zh-TW`
3. header: `Accept-Language: zh-CN,zh;q=0.5`
如果想修改 query 或者 Cookie 参数名称:
```js
// config/config.default.js
exports.i18n = {
queryField: 'locale',
cookieField: 'locale',
// Cookie 默认一年后过期, 如果设置为 Number,则单位为 ms
cookieMaxAge: '1y',
};
```
## 编写 I18n 多语言文件
多种语言的配置是独立的,统一存放在 `config/locales/*.js` 下。
```
- config/locales/
- en-US.js
- zh-CN.js
- zh-TW.js
```
不仅对于应用目录生效,在框架,插件的 `config/locales` 目录下同样生效。
__注意单词拼写,是 locales 不是 locals。__
例如:
```js
// config/locales/zh-CN.js
module.exports = {
Email: '邮箱',
};
```
或者也可以用 JSON 格式的文件:
```json
// config/locales/zh-CN.json
{
"Email": "邮箱"
}
```
## 获取多语言文本
我们可以使用 `__` (Alias: `gettext`) 函数获取 locales 文件夹下面的多语言文本。
__注意: `__` 是两个下划线__
以上面配置过的多语言为例:
```js
ctx.__('Email')
// zh-CN => 邮箱
// en-US => Email
```
如果文本中含有 `%s`,`%j` 等 format 函数,可以按照 [`util.format()`](https://nodejs.org/api/util.html#util_util_format_format_args) 类似的方式调用:
```js
// config/locales/zh-CN.js
module.exports = {
'Welcome back, %s!': '欢迎回来,%s!',
};
ctx.__('Welcome back, %s!', 'Shawn');
// zh-CN => 欢迎回来,Shawn!
// en-US => Welcome back, Shawn!
```
同时支持数组下标占位符方式,例如:
```js
// config/locales/zh-CN.js
module.exports = {
'Hello {0}! My name is {1}.': '你好 {0}! 我的名字叫 {1}。',
};
ctx.__('Hello {0}! My name is {1}.', ['foo', 'bar'])
// zh-CN => 你好 foo!我的名字叫 bar。
// en-US => Hello foo! My name is bar.
```
### Controller 中使用
```js
module.exports = function* (ctx) {
ctx.body = {
message: ctx.__('Welcome back, %s!', ctx.user.name)
// 或者使用 gettext,gettext 是 __ 函数的 alias
// message: ctx.gettext('Welcome back', ctx.user.name)
user: ctx.user,
};
};
```
### View 中使用
假设我们使用的模板引擎是 [Nunjucks](https://github.com/eggjs/egg-view-nunjucks)
```html
<li>{{ __('Email') }}: {{ user.email }}</li>
<li>
{{ __('Welcome back, %s!', user.name) }}
</li>
<li>
{{ __('Hello {0}! My name is {1}.', ['foo', 'bar']) }}
</li>
```
| mit |
bosonic-labs/b-autocomplete | dist/b-autocomplete.js | 12927 | (function () {
var KEY = {
ENTER: 13,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40
};
function normalizeTokens(tokens) {
return tokens.filter(function (token) {
return !!token;
}).map(function (token) {
return token.toLowerCase();
});
}
function newIndexNode() {
return {
ids: [],
children: {}
};
}
function buildIndex(options) {
var index = newIndexNode();
options.forEach(function (option, id) {
var val = option.text || option.value, tokens = normalizeTokens(val.split(/\s+/));
tokens.forEach(function (token) {
var ch, chars = token.split(''), node = index;
while (ch = chars.shift()) {
node = node.children[ch] || (node.children[ch] = newIndexNode());
node.ids.push(id);
}
});
});
return index;
}
function find(query, index, options) {
var matches, tokens = normalizeTokens(query.split(/\s+/));
tokens.forEach(function (token) {
var node = index, ch, chars = token.split('');
if (matches && matches.length === 0) {
return false;
}
while (node && (ch = chars.shift())) {
node = node.children[ch];
}
if (node && chars.length === 0) {
ids = node.ids.slice(0);
matches = matches ? getIntersection(matches, ids) : ids;
} else {
matches = [];
return false;
}
});
return matches ? unique(matches).map(function (id) {
return options[id];
}) : [];
}
function unique(array) {
var seen = {}, uniques = [];
for (var i = 0; i < array.length; i++) {
if (!seen[array[i]]) {
seen[array[i]] = true;
uniques.push(array[i]);
}
}
return uniques;
}
function getIntersection(arrayA, arrayB) {
var ai = 0, bi = 0, intersection = [];
arrayA = arrayA.sort(compare);
arrayB = arrayB.sort(compare);
while (ai < arrayA.length && bi < arrayB.length) {
if (arrayA[ai] < arrayB[bi]) {
ai++;
} else if (arrayA[ai] > arrayB[bi]) {
bi++;
} else {
intersection.push(arrayA[ai]);
ai++;
bi++;
}
}
return intersection;
function compare(a, b) {
return a - b;
}
}
var BAutocompletePrototype = Object.create(HTMLElement.prototype, {
options: {
enumerable: true,
get: function () {
var list = document.querySelector('#' + this.getAttribute('list'));
if (list && list.options) {
CustomElements.upgrade(list);
return Array.prototype.slice.call(list.options, 0);
}
return [];
}
},
index: {
enumerable: true,
get: function () {
if (!this.__index) {
this.__index = buildIndex(this.options);
}
return this.__index;
}
},
suggestionList: {
enumerable: true,
get: function () {
return this.querySelector('ul');
}
},
selectable: {
enumerable: true,
get: function () {
return this.querySelector('b-selectable');
}
},
input: {
enumerable: true,
get: function () {
return this.querySelector('input[type=text]');
}
},
createdCallback: {
enumerable: true,
value: function () {
this.appendChild(this.template.content.cloneNode(true));
this.input.addEventListener('input', this.onInputChange.bind(this), false);
this.input.addEventListener('focus', this.onInputFocus.bind(this), false);
this.input.addEventListener('blur', this.onInputBlur.bind(this), false);
this.selectable.addEventListener('mousedown', this.onSuggestionPick.bind(this), false);
this.selectable.addEventListener('b-activate', this.pickSuggestion.bind(this), false);
}
},
handleAria: {
enumerable: true,
value: function () {
this.setAttribute('role', 'combobox');
this.setAttribute('aria-autocomplete', 'list');
}
},
onInputFocus: {
enumerable: true,
value: function (e) {
this.keydownListener = this.keydownHandler.bind(this);
this.input.addEventListener('keydown', this.keydownListener, false);
}
},
onInputBlur: {
enumerable: true,
value: function (e) {
if (this.cancelBlur) {
this.cancelBlur = false;
return;
}
this.input.removeEventListener('keydown', this.keydownListener, false);
this.hideSuggestionList();
}
},
onSuggestionPick: {
enumerable: true,
value: function (e) {
e.preventDefault();
this.cancelBlur = true;
}
},
keydownHandler: {
enumerable: true,
value: function (e) {
e.stopPropagation();
switch (e.keyCode) {
case KEY.ENTER: {
this.selectable.activate();
break;
}
case KEY.DOWN: {
if (!this.areSuggestionsVisible()) {
this.showSuggestionList();
} else {
this.selectable.selectNextItem();
}
break;
}
case KEY.UP: {
if (!this.areSuggestionsVisible()) {
this.showSuggestionList();
} else {
this.selectable.selectPreviousItem();
}
break;
}
default:
return;
}
e.preventDefault();
}
},
onInputChange: {
enumerable: true,
value: function (e) {
e.stopPropagation();
if (!this.areSuggestionsVisible()) {
this.showSuggestionList();
this.input.focus();
} else {
this.refreshSuggestionList();
}
this.selectFirstSuggestion();
}
},
filterOptions: {
enumerable: true,
value: function () {
var query = this.input.value;
if (!query)
return this.options;
return find(query, this.index, this.options);
}
},
paintSuggestionList: {
enumerable: true,
value: function () {
this.selectable.unselect();
var list = this.suggestionList, options = this.filterOptions();
while (list.childNodes.length > 0) {
list.removeChild(list.childNodes[0]);
}
options.forEach(function (option) {
var li = document.createElement('li');
li.innerHTML = option.text || option.value;
list.appendChild(li);
});
}
},
refreshSuggestionList: {
enumerable: true,
value: function () {
this.paintSuggestionList();
}
},
toggleSuggestionList: {
enumerable: true,
value: function (e) {
if (e) {
e.stopPropagation();
}
this.areSuggestionsVisible() ? this.hideSuggestionList() : this.showSuggestionList();
this.input.focus();
}
},
showSuggestionList: {
enumerable: true,
value: function () {
this.paintSuggestionList();
this.selectable.setAttribute('visible', '');
}
},
hideSuggestionList: {
enumerable: true,
value: function () {
if (this.areSuggestionsVisible()) {
this.selectable.removeAttribute('visible');
}
}
},
selectFirstSuggestion: {
enumerable: true,
value: function () {
this.selectable.selectFirst();
}
},
areSuggestionsVisible: {
enumerable: true,
value: function () {
return this.selectable.hasAttribute('visible');
}
},
pickSuggestion: {
enumerable: true,
value: function (e) {
this.cancelBlur = false;
this.input.value = this.getItemValue(e.detail.item);
this.hideSuggestionList();
}
},
getItemValue: {
enumerable: true,
value: function (itemIndex) {
return this.querySelectorAll('li')[itemIndex].innerHTML;
}
}
});
window.BAutocomplete = document.registerElement('b-autocomplete', { prototype: BAutocompletePrototype });
Object.defineProperty(BAutocompletePrototype, 'template', {
get: function () {
var fragment = document.createDocumentFragment();
var div = fragment.appendChild(document.createElement('div'));
div.innerHTML = ' <input type="text" autocomplete="off" role="textbox" value=""> <b-selectable target="li"> <ul></ul> </b-selectable> ';
while (child = div.firstChild) {
fragment.insertBefore(child, div);
}
fragment.removeChild(div);
return { content: fragment };
}
});
}());
(function () {
var BComboBoxPrototype = Object.create(BAutocomplete.prototype, {
listToggle: {
enumerable: true,
get: function () {
return this.querySelector('.b-combo-box-toggle');
}
},
createdCallback: {
enumerable: true,
value: function () {
this._super.createdCallback.call(this);
this.listToggle.addEventListener('click', this.toggleSuggestionList.bind(this), false);
}
}
});
window.BComboBox = document.registerElement('b-combo-box', { prototype: BComboBoxPrototype });
Object.defineProperty(BComboBox.prototype, '_super', {
enumerable: false,
writable: false,
configurable: false,
value: BAutocomplete.prototype
});
Object.defineProperty(BComboBoxPrototype, 'template', {
get: function () {
var fragment = document.createDocumentFragment();
var div = fragment.appendChild(document.createElement('div'));
div.innerHTML = ' <input type="text" autocomplete="off" role="textbox" value=""> <a class="b-combo-box-toggle"></a> <b-selectable target="li"> <ul></ul> </b-selectable> ';
while (child = div.firstChild) {
fragment.insertBefore(child, div);
}
fragment.removeChild(div);
return { content: fragment };
}
});
}()); | mit |
brainchen98/Team-PI-Lib | slave1/old/slave1.h | 13397 | #ifndef SLAVE1_H
#define SLAVE1_H
#include <Arduino.h>
#include <EEPROM.h>
#include <EEPROMAnything.h>
#include <SPI.h>
#include <SFE_LSM9DS0.h>
#define L1 A7
#define L2 A6
#define L3 A3
#define L4 A10
#define L5 A15
#define L6 A9
#define L7 A2
#define L8 A20
#define L9 A17
#define L10 A16
#define L11 A8
#define L12 A11
#define L13 A12
#define L14 A13
#define L15 A18
#define L16 A19
class LIGHTARRAY{
public:
uint8_t lightData[16] = {0}; // Light sensor data array
uint8_t refData[16] = {0};
uint8_t white[16] = {0};
uint8_t green[16] = {0};
uint8_t colours[16] = {0};
uint8_t pColours[16] = {0}; // previous data
uint8_t ppColours[16] = {0}; // even earlier data
uint8_t coloursSummed[16] = {0};
uint8_t light_i = 0;
uint8_t armFrontSum = 0;
uint8_t armBackSum = 0;
uint8_t armLeftSum = 0;
uint8_t armRightSum = 0;
uint8_t lineLocation = 0;
void init(){
analogReference(EXTERNAL);
pinMode(L1, INPUT);
pinMode(L2, INPUT);
pinMode(L3, INPUT);
pinMode(L4, INPUT);
pinMode(L5, INPUT);
pinMode(L6, INPUT);
pinMode(L7, INPUT);
pinMode(L8, INPUT);
pinMode(L9, INPUT);
pinMode(L10, INPUT);
pinMode(L11, INPUT);
pinMode(L12, INPUT);
pinMode(L13, INPUT);
pinMode(L14, INPUT);
pinMode(L15, INPUT);
pinMode(L16, INPUT);
loadCalibData();
}
void read(){
analogReadResolution(8); // 8 bits of resolution is enough for differentiating between black white and green
analogReadAveraging(0); // averaging DOES NOT EFFECT PERFORMANCE. It is performed on the ADC, not on the uC
lightData[0] = analogRead(L1);
lightData[1] = analogRead(L2);
lightData[2] = analogRead(L3);
lightData[3] = analogRead(L4);
lightData[4] = analogRead(L5);
lightData[5] = analogRead(L6);
lightData[6] = analogRead(L7);
lightData[7] = analogRead(L8);
lightData[8] = analogRead(L9);
lightData[9] = analogRead(L10);
lightData[10] = analogRead(L11);
lightData[11] = analogRead(L12);
lightData[12] = analogRead(L13);
lightData[13] = analogRead(L14);
lightData[14] = analogRead(L15);
lightData[15] = analogRead(L16);
}
void getColours(){
for (int i = 0; i < 16; i++){
colours[i] = lightData[i] > refData[i] ? 1 : 0;
}
if (light_i == 10){
for (int i = 0; i < 16; i++){
coloursSummed[i] = colours[i];
}
light_i = 0;
}
else{
for (int i = 0; i < 16; i++){
coloursSummed[i] += colours[i];
}
light_i++;
}
armFrontSum = coloursSummed[0] + coloursSummed[2] + coloursSummed[1] + coloursSummed[3]; // include light sensor 4
armBackSum = coloursSummed[9] + coloursSummed[11] + coloursSummed[13] + coloursSummed[8];
armRightSum = coloursSummed[7] + coloursSummed[6] + coloursSummed[5] + coloursSummed[4];
armLeftSum = coloursSummed[15] + coloursSummed[14] + coloursSummed[10] + coloursSummed[12];
memcpy(&ppColours, pColours, 16 * sizeof(colours[0]));
memcpy(&pColours, colours, 16 * sizeof(colours[0]));
}
void calibWhite(){
read();
for (int i = 0; i < 16; i++){
white[i] = lightData[i];
}
}
void calibGreen(){
read();
for (int i = 0; i < 16; i++){
green[i] = lightData[i];
}
}
void endCalib(){
for (int i = 0; i < 16; i++){
if (white[i] > green[i] + 2 && (white[i] + green[i])/2 > 80){
refData[i] = (white[i] + green[i])/2;
}
else{
// data isn't good enough
refData[i] = 255;
}
}
saveCalibData();
}
void saveCalibData(){
EEPROM_writeAnything(100, refData);
}
void loadCalibData(){
EEPROM_readAnything(100, refData);
}
private:
};
enum PERIPHERALSTATUS{
NOERRORS,
IMU_ERR,
LIGHTARRAY_ERR,
ADNS_ERR,
IMU_LIGHTARRAY_ERR,
IMU_ADNS_ERR,
LIGHTARRAY_ADNS_ERR,
IMU_LIGHTARRAY_ADNS_ERR
};
// Magnetic Declination/Inclination - see
// http://autoquad.org/wiki/wiki/configuring-autoquad-flightcontroller/autoquad-calibrations/calibration-faq/magnetic-declination-and-inclination/
// Data acquired from http://magnetic-declination.com
#define DECLINATION 10.92 // (Newmarket, Brisbane, Australia)
#define INCLINATION 57.37 // (Newmarket, Brisbane, Australia)
// Uncomment when in China
// #define DECLINATION -5.03 // (Hefei, China)
// #define INCLINATION 48.18 // (Hefei, China)
#define LSM9DS0_CSG 2 // CSG connected to Arduino pin 9
#define LSM9DS0_CSXM 10 // CSXM connected to Arduino pin 10
#define INT1XM 5 // INT1XM tells us when accel data is ready
#define INT2XM 9 // INT2XM tells us when mag data is ready
#define DRDYG 8 // DRDYG tells us when gyro data is ready
class IMU : public LSM9DS0{
public:
IMU() : LSM9DS0(LSM9DS0_CSG, LSM9DS0_CSXM){};
// imu
float gScale = 1.16;
elapsedMicros lastReadG = 0, lastReadM = 0, lastCompFilter = 0;
uint32_t dtG, dtM;
float pitch, yaw, roll;
float abias[3] = {0, 0, 0}, gbias[3] = {0, 0, 0};
float ax, ay, az, gx, gy, gz, mx, my, mz; // variables to hold latest sensor data values
float MagMinX = 0, MagMaxX = 0,
MagMinY = 0, MagMaxY = 0,
MagMinZ = 0, MagMaxZ = 0;
float MagOffsetX, MagOffsetY, MagOffsetZ;
float MagScaleX = 1, MagScaleY = 1, MagScaleZ = 1;
float MagYaw, lMagYaw, MagYawRate;
int16_t bearing;
int16_t offset;
void init(){
// MagMinX = -0.155012;
// MagMaxX = 0.332781;
// MagMinY = -0.138394;
// MagMaxY = 0.311908;
// MagMinZ = 0;
// MagMaxZ = 0;
// MagScaleX = 0.810280932;
// MagScaleY = 0.877742863;
readMagCalibrations(); // read magnetometer calibrations from EEPROM
preCalculateCalibParams();
// Set up interrupt pins as inputs:
pinMode(INT1XM, INPUT);
pinMode(INT2XM, INPUT);
pinMode(DRDYG, INPUT);
uint16_t status = LSM9DS0::begin();
delay(200);
LSM9DS0::setAccelScale(LSM9DS0::A_SCALE_2G);
LSM9DS0::setGyroScale(LSM9DS0::G_SCALE_245DPS);
LSM9DS0::setMagScale(LSM9DS0::M_SCALE_2GS);
LSM9DS0::setAccelODR(LSM9DS0::A_ODR_1600);
LSM9DS0::setAccelABW(LSM9DS0::A_ABW_50); // Choose lowest filter setting for low noise
LSM9DS0::setGyroODR(LSM9DS0::G_ODR_760_BW_100); // Set gyro update rate to 190 Hz with the smallest bandwidth for low noise
LSM9DS0::setMagODR(LSM9DS0::M_ODR_100); // Set magnetometer to update every 80 ms
LSM9DS0::calLSM9DS0(gbias, abias); // not there is a 1s delay with this function
for(int i = 0; i < 10; i++){
read();
delay(1);
}
yaw = atan2(mx,my) * 180/PI;
lMagYaw = yaw;
}
void calibOffset(){
float temp;
for (int i = 0; i < 1000; i++){
read(); // read imu
temp += yaw;
delayMicroseconds(10);
}
offset = temp / 1000;
//TOBEARING360(offset);
// store the offset for potential future use.
storeOffset();
}
void storeOffset(){
EEPROM.write(510, highByte(bearing));
EEPROM.write(511, lowByte(bearing));
}
void getStoredOffset(){
bearing = EEPROM.read(511) | (EEPROM.read(510) << 8);
}
void read(){
if(digitalReadFast(DRDYG) == HIGH){ // When new gyro data is ready
LSM9DS0::readGyro(); // Read raw gyro data
dtG = lastReadG;
lastReadG = 0;
gx = LSM9DS0::calcGyro(LSM9DS0::gx) - gbias[0]; // Convert to degrees per seconds, remove gyro biases
gy = LSM9DS0::calcGyro(LSM9DS0::gy) - gbias[1];
gz = LSM9DS0::calcGyro(LSM9DS0::gz) - gbias[2];
gx *= gScale;
gy *= gScale;
gz *= gScale;
}
if(digitalReadFast(INT1XM) == HIGH){ // When new accelerometer data is ready
LSM9DS0::readAccel(); // Read raw accelerometer data
ax = LSM9DS0::calcAccel(LSM9DS0::ax) - abias[0]; // Convert to g's, remove accelerometer biases
ay = LSM9DS0::calcAccel(LSM9DS0::ay) - abias[1];
az = LSM9DS0::calcAccel(LSM9DS0::az) - abias[2];
}
if(digitalReadFast(INT2XM) == HIGH){ // When new magnetometer data is ready
LSM9DS0::readMag(); // Read raw magnetometer data
mx = LSM9DS0::calcMag(LSM9DS0::mx); // Convert to Gauss and correct for calibration
my = LSM9DS0::calcMag(LSM9DS0::my);
mz = LSM9DS0::calcMag(LSM9DS0::mz);
// Serial.print(MagOffsetX);
// Serial.print('\t');
// Serial.print(MagOffsetY);
// Serial.print('\t');
// Serial.print(MagScaleX);
// Serial.print('\t');
// Serial.print(MagScaleY);
// Serial.print('\t');
// Serial.print(mx, 3);
// Serial.print('\t');
// Serial.println(my, 3);
mx -= MagOffsetX;
my -= MagOffsetY;
mz -= MagOffsetZ;
mx *= MagScaleX;
my *= MagScaleY;
mz *= MagScaleZ;
dtM = lastReadM;
lastReadM = 0;
MagYaw = atan2(mx,my) * 180 / PI;
// float dMagYaw = MagYaw - lMagYaw;
// if (dMagYaw > 180){
// // change in yaw is wrong!
// dMagYaw -= 360;
// }
// else if (dMagYaw < -180){
// dMagYaw += 360;
// }
// Serial.print(dMagYaw);
// Serial.print('\t');
// Serial.print(lMagYaw);
// Serial.print('\t');
// Serial.println(MagYaw);
// MagYawRate = dMagYaw / dtM * 1000000; // change in magnetometer yaw rate in degrees per second
lMagYaw = MagYaw;
}
}
// function to get yaw with complementary filter.
void complementaryFilterBearing(float aa){
uint32_t dtLastCompFilter = lastCompFilter;
lastCompFilter = 0;
yaw += gz * dtLastCompFilter / 1000000;
// the following fixes issues when say yaw is like -175 degrees
// while MagYaw is 175 degrees (comp filter should give around 180 degrees)
// but it'll move it towards zero
if (yaw - MagYaw > 180){
MagYaw += 360;
}
else if (yaw - MagYaw < -180){
MagYaw -= 360;
}
// Serial.print(yaw);
// Serial.print('\t');
// Serial.print(MagYaw);
// Serial.print('\t');
// Serial.print(gz);
yaw = aa * yaw + (1.0 - aa) * MagYaw;
TOBEARING180(yaw);
// Serial.print('\t');
// Serial.println(yaw);
}
void preCalculateCalibParams(){
MagOffsetX = (MagMinX + MagMaxX) / 2.0;
MagOffsetY = (MagMinY + MagMaxY) / 2.0;
MagOffsetZ = (MagMinZ + MagMaxZ) / 2.0;
// soft iron error correction
float VMaxX = MagMaxX - MagOffsetX;
float VMaxY = MagMaxY - MagOffsetY;
float VMaxZ = MagMaxZ - MagOffsetZ;
float VMinX = MagMinX - MagOffsetX;
float VMinY = MagMinY - MagOffsetY;
float VMinZ = MagMinZ - MagOffsetZ;
float avgX = (VMaxX - VMinX)/2;
float avgY = (VMaxY - VMinY)/2;
float avgZ = (VMaxZ - VMinZ)/2;
float avgRadius = avgX + avgY; // scrap the Z axis
avgRadius /= 2;
MagScaleX = avgRadius/avgX;
MagScaleY = avgRadius/avgY;
MagScaleZ = avgRadius/avgZ;
}
void initCalibMagRoutine(){
// don't want compensation/calibrated readings when calibrating!
MagOffsetX = 0;
MagOffsetY = 0;
MagOffsetZ = 0;
MagScaleX = 1;
MagScaleY = 1;
MagScaleZ = 1;
// wait for magnetometer data to come
// while(digitalReadFast(INT2XM) == LOW){};
// LSM9DS0::readMag(); // Read raw magnetometer data
// MagMinX = LSM9DS0::calcMag(LSM9DS0::mx);
// MagMinY = LSM9DS0::calcMag(LSM9DS0::my);
// MagMinZ = LSM9DS0::calcMag(LSM9DS0::mz);
// MagMaxX = MagMinX;
// MagMaxY = MagMinY;
// MagMaxZ = MagMinZ;
MagMinX = 100;
MagMinY = 100;
MagMinZ = 100;
MagMaxX = -100;
MagMaxY = -100;
MagMaxZ = -100;
}
// calibrate magnetomer. Please just rotate the magnetometer around
// until you get pretty much every angle!
void calibMagRoutine(){
read();
if (mx < MagMinX) MagMinX = mx;
if (mx > MagMaxX) MagMaxX = mx;
if (my < MagMinY) MagMinY = my;
if (my > MagMaxY) MagMaxY = my;
if (mz < MagMinZ) MagMinZ = mz;
if (mz > MagMaxZ) MagMaxZ = mz;
}
void storeMagCalibrations(){
EEPROM_writeAnything(0, MagMinX);
EEPROM_writeAnything(4, MagMaxX);
EEPROM_writeAnything(8, MagMinY);
EEPROM_writeAnything(12, MagMaxY);
EEPROM_writeAnything(16, MagMinZ);
EEPROM_writeAnything(20, MagMaxZ);
}
void readMagCalibrations(){
EEPROM_readAnything(0, MagMinX);
EEPROM_readAnything(4, MagMaxX);
EEPROM_readAnything(8, MagMinY);
EEPROM_readAnything(12, MagMaxY);
EEPROM_readAnything(16, MagMinZ);
EEPROM_readAnything(20, MagMaxZ);
}
// calibrate gyro offset (gbias). Keep robot still for 1s.
void calibGyroDrift(){
float dx = 0, dy = 0, dz = 0;
float temp = gScale;
gScale = 1;
yaw = 0;
gbias[0] = 0; gbias[1] = 0; gbias[2] = 0;
while(!Serial.available()){};
while(Serial.available()){Serial.read();}
elapsedMicros calibDriftTime = 0;
calibDriftTime = 0;
while (calibDriftTime < 1000000){
read();
complementaryFilterBearing(1); // full gyro
}
//gbias[2] = yaw;
Serial.print(gbias[0]);
Serial.print('\t');
Serial.print(gbias[1]);
Serial.print('\t');
Serial.println(gbias[2]);
}
};
class SLAVE1 : public HardwareSerial{
public:
enum PERIPHERALSTATUS{
NOERRORS,
IMU_ERR,
LIGHTARRAY_ERR,
ADNS_ERR,
IMU_LIGHTARRAY_ERR,
IMU_ADNS_ERR,
LIGHTARRAY_ADNS_ERR,
IMU_LIGHTARRAY_ADNS_ERR
};
LIGHTARRAY lightArray;
IMU imu;
PERIPHERALSTATUS peripheralStatus = PERIPHERALSTATUS::NOERRORS;
LINELOCATION lineLocation = LINELOCATION::FIELD;
// mouse sensor
uint8_t x, y;
uint8_t checkIfRequested(){
if(HardwareSerial::available() <= 0) return 255;
else return HardwareSerial::read();
}
// packets are ended with a newline characted '\n'. The newline character is not added to the array
void sendPacket(uint8_t *dataOut, uint8_t length){
HardwareSerial::write(dataOut, length);
}
bool receivePacket(uint8_t *dataIn, uint8_t maxLength){
if (HardwareSerial::readBytesUntil('\n', dataIn, maxLength) <= 0){
return false; // this situation should never occur
}
return true;
}
};
SLAVE1 slave1;
#endif | mit |
brochachos/angular-responsive-img | index.html | 13926 | <!DOCTYPE html>
<html ng-app="brc.angular-responsive-img">
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='https://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/pygment_trac.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<title>Angular-responsive-img by sheniff</title>
</head>
<body>
<header>
<div class="inner">
<h1>Angular-responsive-img</h1>
<h2>Angular directive to easily place responsive <img>'s using <picture> element</h2>
<a href="https://github.com/sheniff/angular-responsive-img" class="button"><small>View project on</small>GitHub</a>
</div>
</header>
<div id="content-wrapper">
<div class="inner clearfix">
<section id="main-content">
<p>Load different images based on your window settings.</p>
<h2>
<a name="getting-started" class="anchor" href="#getting-started"><span class="octicon octicon-link"></span></a>Getting started</h2>
<ul>
<li>Use <code>bower</code> to install <code>angular-responsive-img</code>.</li>
</ul><pre><code>bower install angular-responsive-img
</code></pre>
<ul>
<li>Include <code>responsive-img.js</code> or <code>responsive-img.min.js</code> between your JS files.</li>
</ul><div class="highlight highlight-html"><pre>// index.html
<span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span> <span class="na">src=</span><span class="s">"responsive-img.js"</span><span class="nt">></script></span>
</pre></div>
<ul>
<li>Include <code>brc.angular-responsive-img</code> as a module in your project (usually in <code>app.js</code>).</li>
</ul><div class="highlight highlight-javascript"><pre><span class="c1">// app.js</span>
<span class="nx">angular</span><span class="p">.</span><span class="nx">module</span><span class="p">(</span><span class="s1">'myApp'</span><span class="p">,</span> <span class="p">[</span>
<span class="c1">// ...</span>
<span class="s1">'brc.angular-responsive-img'</span>
<span class="c1">// ...</span>
<span class="p">]);</span>
</pre></div>
<ul>
<li>Start using it everywhere!</li>
</ul><div class="highlight highlight-html"><pre>// anywhere.html
<span class="nt"><picture</span> <span class="na">width=</span><span class="s">"200"</span> <span class="na">height=</span><span class="s">"200"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-width: 400"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/400/"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-width: 800"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/800/"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/1000/"</span><span class="nt">></span>
<span class="nt"></picture></span>
</pre></div>
<h2>
<a name="demos" class="anchor" href="#demos"><span class="octicon octicon-link"></span></a>Demos</h2>
<h3>
<a name="based-on-windows-width" class="anchor" href="#based-on-windows-width"><span class="octicon octicon-link"></span></a>Based on window's <strong>width</strong>
</h3>
<p>Try resizing your window under 800px width and then under 400px width.</p>
<picture width="200" height="200">
<source size="max-width: 400" src="http://fakeimg.pl/400/">
<source size="max-width: 800" src="http://fakeimg.pl/800/">
<source src="http://fakeimg.pl/1000/">
</picture>
<div class="highlight highlight-html"><pre><span class="nt"><picture</span> <span class="na">width=</span><span class="s">"200"</span> <span class="na">height=</span><span class="s">"200"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-width: 400"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/400/"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-width: 800"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/800/"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/1000/"</span><span class="nt">></span>
<span class="nt"></picture></span>
</pre></div>
<h3>
<a name="based-on-windows-height" class="anchor" href="#based-on-windows-height"><span class="octicon octicon-link"></span></a>Based on window's <strong>height</strong>
</h3>
<p>Try resizing your window under 400px height and then under 200px height.</p>
<picture width="200" height="200">
<source size="max-height: 200" src="http://fakeimg.pl/200/">
<source size="max-height: 400" src="http://fakeimg.pl/400/">
<source src="http://fakeimg.pl/800/">
</picture>
<div class="highlight highlight-html"><pre><span class="nt"><picture</span> <span class="na">width=</span><span class="s">"200"</span> <span class="na">height=</span><span class="s">"200"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-height: 200"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/200/"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-height: 400"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/400/"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/800/"</span><span class="nt">></span>
<span class="nt"></picture></span>
</pre></div>
<h3>
<a name="based-on-windows-pixel-density" class="anchor" href="#based-on-windows-pixel-density"><span class="octicon octicon-link"></span></a>Based on window's <strong>pixel density</strong>
</h3>
<p>Try using a retina display to see an image twice the size (900px instead of 450px).
Note: Some browsers allow you to see double dpi when you zoom in enough.</p>
<picture width="200" height="200">
<source dpi="2" src="http://fakeimg.pl/900/">
<source src="http://fakeimg.pl/450/">
</picture>
<div class="highlight highlight-html"><pre><span class="nt"><picture</span> <span class="na">width=</span><span class="s">"200"</span> <span class="na">height=</span><span class="s">"200"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">dpi=</span><span class="s">"2"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/900/"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/450/"</span><span class="nt">></span>
<span class="nt"></picture></span>
</pre></div>
<h3>
<a name="mix-them-up-at-will" class="anchor" href="#mix-them-up-at-will"><span class="octicon octicon-link"></span></a>Mix them up at will!</h3>
<p>You can add as much sources as you want. Please note that in case of conflict, the last one declared will show.</p>
<picture width="200" height="200">
<source dpi="2" src="http://fakeimg.pl/900/">
<source size="max-width: 400, max-height: 200" src="http://fakeimg.pl/400x200">
<source size="max-width: 800, max-height: 400" src="http://fakeimg.pl/800x400">
<source src="http://fakeimg.pl/1000x800">
</picture>
<div class="highlight highlight-html"><pre><span class="nt"><picture</span> <span class="na">width=</span><span class="s">"200"</span> <span class="na">height=</span><span class="s">"200"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">dpi=</span><span class="s">"2"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/900/"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-width: 400, max-height: 200"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/400x200"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-width: 800, max-height: 400"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/800x400"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/1000x800"</span><span class="nt">></span>
<span class="nt"></picture></span>
</pre></div>
<h3>
<a name="use-it-for-all-your-images" class="anchor" href="#use-it-for-all-your-images"><span class="octicon octicon-link"></span></a>Use it for all your images!</h3>
<p>Multiple images with different sizes can be set in case you need them.</p>
<picture width="200" height="200">
<source size="max-width: 1000" src="http://fakeimg.pl/800">
<source src="http://fakeimg.pl/900">
</picture>
<picture width="200" height="200">
<source size="max-width: 950" src="http://fakeimg.pl/750">
<source src="http://fakeimg.pl/900">
</picture>
<picture width="200" height="200">
<source size="max-width: 900" src="http://fakeimg.pl/700">
<source src="http://fakeimg.pl/900">
</picture>
<picture width="200" height="200">
<source size="max-width: 850" src="http://fakeimg.pl/650">
<source src="http://fakeimg.pl/900">
</picture>
<picture width="200" height="200">
<source size="max-width: 800" src="http://fakeimg.pl/600">
<source src="http://fakeimg.pl/900">
</picture>
<div class="highlight highlight-html"><pre><span class="nt"><picture</span> <span class="na">width=</span><span class="s">"200"</span> <span class="na">height=</span><span class="s">"200"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-width: 1000"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/800"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/900"</span><span class="nt">></span>
<span class="nt"></picture></span>
<span class="nt"><picture</span> <span class="na">width=</span><span class="s">"200"</span> <span class="na">height=</span><span class="s">"200"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-width: 950"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/750"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/900"</span><span class="nt">></span>
<span class="nt"></picture></span>
<span class="nt"><picture</span> <span class="na">width=</span><span class="s">"200"</span> <span class="na">height=</span><span class="s">"200"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-width: 900"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/700"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/900"</span><span class="nt">></span>
<span class="nt"></picture></span>
<span class="nt"><picture</span> <span class="na">width=</span><span class="s">"200"</span> <span class="na">height=</span><span class="s">"200"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-width: 850"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/650"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/900"</span><span class="nt">></span>
<span class="nt"></picture></span>
<span class="nt"><picture</span> <span class="na">width=</span><span class="s">"200"</span> <span class="na">height=</span><span class="s">"200"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">size=</span><span class="s">"max-width: 800"</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/600"</span><span class="nt">></span>
<span class="nt"><source</span> <span class="na">src=</span><span class="s">"http://fakeimg.pl/900"</span><span class="nt">></span>
<span class="nt"></picture></span>
</pre></div>
</section>
<aside id="sidebar">
<a href="https://github.com/sheniff/angular-responsive-img/zipball/master" class="button">
<small>Download</small>
.zip file
</a>
<a href="https://github.com/sheniff/angular-responsive-img/tarball/master" class="button">
<small>Download</small>
.tar.gz file
</a>
<p class="repo-owner"><a href="https://github.com/sheniff/angular-responsive-img"></a> is maintained by <a href="https://github.com/sheniff">sheniff</a>.</p>
<p>This page was generated by <a href="https://pages.github.com">GitHub Pages</a> using the Architect theme by <a href="https://twitter.com/jasonlong">Jason Long</a>.</p>
</aside>
</div>
</div>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.0/angular.js"></script>
<script type="text/javascript" src="responsive-img.js"></script>
</body>
</html>
| mit |
checkout/checkout-woocommerce-plugin | woocommerce-gateway-checkout-com/includes/lib/checkout-sdk-php/src/Models/Payments/BancontactSource.php | 1552 | <?php
/**
* Checkout.com
* Authorised and regulated as an electronic money institution
* by the UK Financial Conduct Authority (FCA) under number 900816.
*
* PHP version 7
*
* @category SDK
* @package Checkout.com
* @author Platforms Development Team <[email protected]>
* @copyright 2010-2019 Checkout.com
* @license https://opensource.org/licenses/mit-license.html MIT License
* @link https://docs.checkout.com/
*/
namespace Checkout\Models\Payments;
/**
* Payment method Bancontact.
*
* @category SDK
* @package Checkout.com
* @author Platforms Development Team <[email protected]>
* @license https://opensource.org/licenses/mit-license.html MIT License
* @link https://docs.checkout.com/
*/
class BancontactSource extends Source
{
/**
* Qualified name of the class.
*
* @var string
*/
const QUALIFIED_NAME = __CLASS__;
/**
* Name of the model.
*
* @var string
*/
const MODEL_NAME = 'bancontact';
/**
* Magic Methods
*/
/**
* Initialise bancontact.
*
* @param string $name The account_holder_name
* @param string $country The payment_country
* @param string $descriptor The billing_descriptor
*/
public function __construct($name, $country, $descriptor = '')
{
$this->type = static::MODEL_NAME;
$this->account_holder_name = $name;
$this->payment_country = $country;
$this->billing_descriptor = $descriptor;
}
}
| mit |
Ledoux/ShareYourSystem | Pythonlogy/draft/Simulaters/Brianer/draft/07_ExampleDoc.py | 1597 | #import SYS
import ShareYourSystem as SYS
#Definition
MyBrianer=SYS.BrianerClass(
).collect(
"Neurongroupers",
'P',
SYS.NeurongrouperClass(
#Here are defined the brian classic shared arguments for each pop
**{
'NeurongroupingKwargVariablesDict':
{
'N':2,
'model':
'''
Jr : 1
dr/dt = (-r+Jr)/(20*ms) : 1
'''
},
'ConnectingGraspClueVariablesList':
[
SYS.GraspDictClass(
{
'HintVariable':'/NodePointDeriveNoder/<Neurongroupers>PNeurongrouper',
'SynapsingKwargVariablesDict':
{
'model':
'''
J : 1
Jr_post=J*r_pre : 1 (summed)
'''
},
'SynapsingWeigthSymbolStr':'J',
'SynapsingWeigthFloatsArray':SYS.array(
[
[0.,-2.],
[4.,0.]
]
),
"SynapsingDelayDict":{'r':1.*SYS.brian2.ms}
}
)
]
}
).collect(
"StateMoniters",
'Rate',
SYS.MoniterClass(
**{
'MoniteringVariableStr':'r',
'MoniteringRecordTimeIndexIntsArray':[0,1]
}
)
)
).network(
**{
'RecruitingConcludeConditionVariable':[
(
'MroClassesList',
SYS.contains,
SYS.NeurongrouperClass
)
]
}
).brian()
#init variables
map(
lambda __BrianedNeuronGroup:
__BrianedNeuronGroup.__setattr__(
'r',
1.+SYS.array(map(float,xrange(__BrianedNeuronGroup.N)))
),
MyBrianer.BrianedNeuronGroupsList
)
#run
MyBrianer.run(100)
#plot
M=MyBrianer['<Neurongroupers>PNeurongrouper']['<StateMoniters>RateMoniter'].StateMonitor
SYS.plot(M.t, M.r.T)
SYS.show()
| mit |
philleski/tactician | src/tactician/AlgebraicNotation.java | 11982 | package tactician;
/**
* This class is responsible for converting between a {@link Move} object and chess algebraic
* notation. {@link #algebraicToMove(Board, String)} converts a string in algebraic notation to a
* {@link Move} and {@link #moveToAlgebraic(Board, Move)} does the opposite.
*
* @see <a href="https://en.wikipedia.org/wiki/Algebraic_notation_(chess)">Algebraic Notation</a>
* @author Phil Leszczynski
*/
public class AlgebraicNotation {
/**
* Returns a move where the player castles kingside if it is legal, or null otherwise.
*
* @param board the board containing the position
* @return a move that castles kingside if one is legal, null otherwise
*/
private static Move findCastleKingsideMove(Board board) {
for (Move move : board.legalMoves()) {
if (move.source + 2 == move.destination) {
return move;
}
}
return null;
}
/**
* Returns a move where the player castles queenside if it is legal, or null otherwise.
*
* @param board the board containing the position
* @return a move that castles queenside if one is legal, null otherwise
*/
private static Move findCastleQueensideMove(Board board) {
for (Move move : board.legalMoves()) {
if (move.source - 2 == move.destination) {
return move;
}
}
return null;
}
/**
* Returns a pawn move given a board, a starting file for the pawn, a destination square, and a
* piece to promote to (null if the pawn does not promote). If there is no such legal move
* available on the board, returns null.
*
* @param board the board containing the position
* @param file the starting file for the pawn, e.g. 'c'
* @param destination the square where the pawn moves to
* @param promoteTo the type of piece if the pawn promotes, null otherwise
* @return a pawn move on the board that meets the criteria, null if no such move is found
*/
private static Move findPawnMove(Board board, char file, Square destination, Piece promoteTo) {
for (Move move : board.legalMoves()) {
Square sourceSquare = new Square(move.source);
Square destinationSquare = new Square(move.destination);
Piece sourcePiece = board.pieceOnSquare(sourceSquare);
char sourceFile = sourceSquare.getName().charAt(0);
if (sourcePiece != Piece.PAWN) {
continue;
}
if (sourceFile != file) {
continue;
}
if (destination != destinationSquare) {
continue;
}
if (move.promoteTo != promoteTo) {
continue;
}
return move;
}
return null;
}
/**
* Returns a non-pawn move given a board, the type of piece to move, a destination square, a
* start file for the piece if specified, and a start rank for the piece if specified. The start
* file and start rank may be needed to resolve ambiguity since for example it is possible for
* the white player's b1 and e2 knights to go to c3. If the start file is set to 'e', that means
* the e2-knight is intended as the mover. If either the start file or start rank is not needed,
* it should be passed in as '_'.
*
* @param board the board containing the position
* @param mover the type of piece to move
* @param destination the square where the piece moves to
* @param startFile the name of the file if more than one piece of the given type on different
* files can reach the destination square, '_' otherwise
* @param startRank the name of the rank if more than one piece of the given type on different
* ranks can reach the destination square (and startFile is not sufficient to tell the
* difference), '_' otherwise
* @return a non-pawn move on the board that meets the criteria, null if no such move is found
*/
private static Move findNonPawnMove(Board board, Piece mover, Square destination, char startFile,
char startRank) {
for (Move move : board.legalMoves()) {
Square sourceSquare = new Square(move.source);
Square destinationSquare = new Square(move.destination);
Piece sourcePiece = board.pieceOnSquare(sourceSquare);
if (sourcePiece != mover) {
continue;
}
if (destination != destinationSquare) {
continue;
}
if (startFile != '_' && startFile != destinationSquare.getFile()) {
continue;
}
if (startRank != '_' && startRank != destinationSquare.getRank()) {
continue;
}
return move;
}
return null;
}
/**
* Given a board and a move string in algebraic notation, returns a {@link Move} object
* corresponding to that move. It first deals with the special cases for castling moves, "O-O"
* and "O-O-O". Otherwise if the first character is a lowercase letter it is a pawn move and it
* delegates to {@link #findPawnMove(Board, char, Square, Piece)}. Otherwise it is a non-pawn
* move and we look for ambiguity resolving characters such as the 'e' in "Nec3". Finally we
* delegate to {@link #findNonPawnMove(Board, Piece, Square, char, char)}.
*
* @param board the board containing the position
* @param algebraic the string describing the move in algebraic notation
* @return a {@link Move} object if such a legal move is found on the board, null otherwise
*/
public static Move algebraicToMove(Board board, String algebraic) {
if (algebraic.length() < 2) {
System.err.println("Illegal move: too short: " + algebraic);
return null;
}
if (algebraic.equals("O-O")) {
return findCastleKingsideMove(board);
}
if (algebraic.equals("O-O-O")) {
return findCastleQueensideMove(board);
}
String destinationName = "";
Piece promoteTo = null;
if (algebraic.charAt(algebraic.length() - 2) == '=') {
// The move is a pawn promotion and ends with, for example "=Q". So the destination string is
// the last two digits before the equals sign.
destinationName = algebraic.substring(algebraic.length() - 4, algebraic.length() - 2);
promoteTo = Piece.initialToPiece(algebraic.charAt(algebraic.length() - 1));
} else {
destinationName = algebraic.substring(algebraic.length() - 2, algebraic.length());
}
Square destination = new Square(destinationName);
char algebraicPrefix = algebraic.charAt(0);
if (algebraicPrefix >= 'a' && algebraicPrefix <= 'h') {
return findPawnMove(board, algebraicPrefix, destination, promoteTo);
}
Piece mover = Piece.initialToPiece(algebraicPrefix);
String algebraicTrimmed = algebraic.replace("x", "");
int algebraicTrimmedLength = algebraicTrimmed.length();
char matchFile = '_';
char matchRank = '_';
if (algebraicTrimmedLength == 4) {
// The second character is used to resolve ambiguity when two of the same type of piece can
// go to the same destination square. For example if two knights can go to c3, the move can
// be disambiguated as Nbc3 or Nec3. Similarly the first character can be a rank such as
// R1e7.
char resolver = algebraicTrimmed.charAt(1);
if (resolver >= 'a' && resolver <= 'h') {
matchFile = resolver;
} else {
matchRank = resolver;
}
} else if (algebraicTrimmedLength == 5) {
// This is a rare case when both the file and rank are needed to resolve ambiguity. For
// example if there are three white queens on a1, a3, and c1, and the player wishes to move
// the a1-queen to c3, the move would be written as Qa1c3.
matchFile = algebraicTrimmed.charAt(1);
matchRank = algebraicTrimmed.charAt(2);
}
return findNonPawnMove(board, mover, destination, matchFile, matchRank);
}
/**
* Given a board and a move on the board, gets the ambiguity string containing the file and/or
* rank if other pieces of the same type can move to the same destination square. For example if
* there are white knights on b1 and e2, and we wish to move the e2-knight, the ambiguity string
* would be "e". If there are black rooks on g3 and g7, and we wish to move the g7-rook, the
* ambiguity string would be "7". If there are white queens on a1, a3, and c1, and we wish to
* move the a1-queen to c3, the ambiguity string would be "a1" since neither "a" nor "1" is
* sufficient to describe which queen should move. Finally if there are black bishops on a8 and
* b8, and we wish to move the b8-bishop to c7, then the ambiguity string would be "" since only
* one bishop is able to move to c7.
*
* @param board the board containing the position
* @param moveToMatch the move on the board we wish to match, i.e. find other pieces of the same
* type that can move to the same destination square
* @see <a href="https://en.wikipedia.org/wiki/Algebraic_notation_(chess)">Algebraic Notation</a>
* @return the ambiguity string for the board and move, e.g. "e", "7", "a1", or ""
*/
private static String getAmbiguity(Board board, Move moveToMatch) {
Square sourceToMatch = new Square(moveToMatch.source);
Piece moverToMatch = board.pieceOnSquare(sourceToMatch);
char fileToMatch = sourceToMatch.getFile();
char rankToMatch = sourceToMatch.getRank();
boolean matchingFileFound = false;
boolean matchingRankFound = false;
for (Move move : board.legalMoves()) {
Piece mover = board.pieceOnSquare(new Square(move.source));
if (move == moveToMatch) {
// Only search for moves different than the move requested.
continue;
}
if (mover != moverToMatch) {
continue;
}
Square source = new Square(move.source);
char file = source.getFile();
char rank = source.getRank();
if (file == fileToMatch) {
matchingFileFound = true;
}
if (rank == rankToMatch) {
matchingRankFound = true;
}
}
String result = "";
if (matchingFileFound) {
result += fileToMatch;
}
if (matchingRankFound) {
result += rankToMatch;
}
return result;
}
/**
* Given a board and a move on the board, returns the string representing the move in algebraic
* notation. It first deals with the special case castling moves "O-O" and "O-O-O". It then gets
* the prefix which is either the pawn file or the type of piece. It then gets the ambiguity
* string through {@link #getAmbiguity(Board, Move)}. It then inserts the character 'x' if the
* move is a capture. Next it puts in the destination square. Finally it adds in the promotion
* string if there is one, for example "=Q".
*
* @param board the board containing the position
* @param move the move to convert to algebraic notation
* @return a string representing the move in algebraic notation
*/
public static String moveToAlgebraic(Board board, Move move) {
Square sourceSquare = new Square(move.source);
Piece mover = board.pieceOnSquare(sourceSquare);
if (mover == Piece.KING && move.source + 2 == move.destination) {
return "O-O";
}
if (mover == Piece.KING && move.source - 2 == move.destination) {
return "O-O-O";
}
String algebraicPrefix;
if (mover == Piece.PAWN) {
algebraicPrefix = "" + sourceSquare.getFile();
} else {
algebraicPrefix = "" + mover.initial();
}
String ambiguity = getAmbiguity(board, move);
Square destinationSquare = new Square(move.destination);
String captureStr = "";
if (board.allPieces.intersects(destinationSquare)) {
captureStr = "x";
} else if (mover == Piece.PAWN && board.enPassantTarget == (1L << move.destination)) {
captureStr = "x";
}
String destinationSquareName = destinationSquare.getName();
String promoteToStr = "";
if (move.promoteTo != null) {
promoteToStr = "=" + move.promoteTo.initial();
}
return algebraicPrefix + ambiguity + captureStr + destinationSquareName + promoteToStr;
}
}
| mit |
georghinkel/ttc2017smartGrids | solutions/eMoflon/rgse.ttc17.emoflon.tgg.task2/gen/rgse/ttc17/emoflon/tgg/task2/ConformLoadGroupToConformLoadGroup.java | 2906 | /**
*/
package rgse.ttc17.emoflon.tgg.task2;
import gluemodel.CIM.IEC61970.LoadModel.ConformLoadGroup;
import org.eclipse.emf.ecore.EObject;
import org.moflon.tgg.runtime.AbstractCorrespondence;
// <-- [user defined imports]
// [user defined imports] -->
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Conform Load Group To Conform Load Group</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link rgse.ttc17.emoflon.tgg.task2.ConformLoadGroupToConformLoadGroup#getSource <em>Source</em>}</li>
* <li>{@link rgse.ttc17.emoflon.tgg.task2.ConformLoadGroupToConformLoadGroup#getTarget <em>Target</em>}</li>
* </ul>
* </p>
*
* @see rgse.ttc17.emoflon.tgg.task2.Task2Package#getConformLoadGroupToConformLoadGroup()
* @model
* @generated
*/
public interface ConformLoadGroupToConformLoadGroup extends EObject, AbstractCorrespondence {
/**
* Returns the value of the '<em><b>Source</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Source</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Source</em>' reference.
* @see #setSource(ConformLoadGroup)
* @see rgse.ttc17.emoflon.tgg.task2.Task2Package#getConformLoadGroupToConformLoadGroup_Source()
* @model required="true"
* @generated
*/
ConformLoadGroup getSource();
/**
* Sets the value of the '{@link rgse.ttc17.emoflon.tgg.task2.ConformLoadGroupToConformLoadGroup#getSource <em>Source</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Source</em>' reference.
* @see #getSource()
* @generated
*/
void setSource(ConformLoadGroup value);
/**
* Returns the value of the '<em><b>Target</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Target</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Target</em>' reference.
* @see #setTarget(outagePreventionJointarget.ConformLoadGroup)
* @see rgse.ttc17.emoflon.tgg.task2.Task2Package#getConformLoadGroupToConformLoadGroup_Target()
* @model required="true"
* @generated
*/
outagePreventionJointarget.ConformLoadGroup getTarget();
/**
* Sets the value of the '{@link rgse.ttc17.emoflon.tgg.task2.ConformLoadGroupToConformLoadGroup#getTarget <em>Target</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Target</em>' reference.
* @see #getTarget()
* @generated
*/
void setTarget(outagePreventionJointarget.ConformLoadGroup value);
// <-- [user code injected with eMoflon]
// [user code injected with eMoflon] -->
} // ConformLoadGroupToConformLoadGroup
| mit |
jack-trikeapps/maxmind | spec/maxmind/chargeback_request_spec.rb | 691 | require 'spec_helper'
describe Maxmind::ChargebackRequest do
before do
Maxmind.user_id = 'user'
Maxmind.license_key = 'key'
@request = Maxmind::ChargebackRequest.new(:client_ip => '198.51.100.2')
end
it "requires a License Key" do
Maxmind.license_key = nil
expect { @request.send(:validate) }.to raise_error(ArgumentError)
Maxmind.license_key = 'key'
end
it "requires a User ID" do
Maxmind.user_id = nil
expect { @request.send(:validate) }.to raise_error(ArgumentError)
Maxmind.user_id = 'user'
end
it "requires a client IP" do
@request.client_ip = nil
expect { @request.send(:validate) }.to raise_error(ArgumentError)
end
end
| mit |
kishoredbn/barrelfish | usr/eclipseclp/Eplex/eplex.c | 165635 | /* BEGIN LICENSE BLOCK
* Version: CMPL 1.1
*
* The contents of this file are subject to the Cisco-style Mozilla Public
* License Version 1.1 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License
* at www.eclipse-clp.org/license.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is The ECLiPSe Constraint Logic Programming System.
* The Initial Developer of the Original Code is Cisco Systems, Inc.
* Portions created by the Initial Developer are
* Copyright (C) 1995-2006 Cisco Systems, Inc. All Rights Reserved.
*
* Contributor(s): Joachim Schimpf, Kish Shen and Andrew Eremin, IC-Parc
*
* END LICENSE BLOCK */
/*
* ECLiPSe / CPLEX interface
*
* System: ECLiPSe Constraint Logic Programming System
* Author/s: Joachim Schimpf, IC-Parc
* Kish Shen, IC-Parc
* Version: $Id: eplex.c,v 1.16 2014/07/14 01:02:27 jschimpf Exp $
*
*/
/*#define LOG_CALLS*/
#undef LOG_CALLS
#ifdef LOG_CALLS
int log_ctr = 0;
#endif
#ifndef __STDC__
typedef unsigned size_t;
char *getenv();
#else
#include <stdlib.h>
#endif
#include <string.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
# include <stdio.h>
#ifdef WIN32
# include <process.h>
# define unlink(File) _unlink(File)
# define getpid() _getpid()
# define gethostid() 0
# define putenv(s) _putenv(s)
# define PATH_SEPARATOR ";"
#else
# define PATH_SEPARATOR ":"
#endif
/* Kish 2008-08-13:
Cannot define __eprintf() here for PPC Mac OS X -- at least version 10.4
we have access to. It is defined in stdc++, and Mac OS X does not allow
multiple definitions of symbols during linking (for flat_namespace).
versions,
Kish 2008-07-24: define __eprintf() for all cases -- Cisco lab Solaris
has older libraries that does not have __eprintf() defined
code modified from koders.com's definition of __eprintf(), which uses
fiprintf(), which is also undefined for Intel MacOSX. Here eprintf()
is redefined to just the abort. This should be OK, as it is used in
assert.h, which should only be used when debugging
-- Kish Shen 2007-11-22
This is an implementation of the __eprintf function which is
compatible with the assert.h which is distributed with gcc.
This function is provided because in some cases libgcc.a will not
provide __eprintf. This will happen if inhibit_libc is defined,
which is done because at the time that libgcc2.c is compiled, the
correct <stdio.h> may not be available. newlib provides its own
copy of assert.h, which calls __assert, not __eprintf. However, in
some cases you may accidentally wind up compiling with the gcc
assert.h. In such a case, this __eprintf will be used if there
does not happen to be one in libgcc2.c. */
#if !(defined(__APPLE__) && defined(__ppc__))
void
__eprintf (format, file, line, expression)
const char *format;
const char *file;
unsigned int line;
const char *expression;
{
/* (void) fiprintf (stderr, format, file, line, expression);*/
abort ();
}
#endif
# include <limits.h>
# include <math.h>
#if defined(LOG_CALLS)
# define USE_PROBLEM_ARRAY
#endif
/*
* Macros to make code more readable
*/
/* this extra step is needed to allow Call itself to be transformed */
#define Transform_Quoted(Item) Add_Quotes(Item)
#define Add_Quotes(Item) #Item
/* Call logging macros:
Call(Ret, Call) Log and call Call if LOG_CALLS, assign return value to Ret
CallN(Call) Log and call Call if LOG_CALLS, return value is lost
Log only macros (these should be accompanied by an actual call to the
logged call!)
Log1(Call, A1)...Log6(Call, A1,A2,A3,A4,A5,A6)
Log Call if LOG_CALLS. Call should be in printf
form, with appropriate % arguments for the arguments
*/
#ifdef LOG_CALLS
# define Call(Err, C) { \
Fprintf(log_output_, "\n\
"Transform_Quoted(C)";");\
ec_flush(log_output_); \
Err = C;\
}
# define CallN(C) { \
Fprintf(log_output_, "\n\
"Transform_Quoted(C)";");\
ec_flush(log_output_); \
C;\
}
# define Log0(C) {\
Fprintf(log_output_, "\n\
"Transform_Quoted(C)";");\
ec_flush(log_output_);\
}
# define Log1(C,A1) {\
Fprintf(log_output_, "\n\
"Transform_Quoted(C)";",A1);\
ec_flush(log_output_);\
}
# define Log2(C,A1,A2) {\
Fprintf(log_output_, "\n\
"Transform_Quoted(C)";",A1,A2);\
ec_flush(log_output_);\
}
# define Log3(C,A1,A2,A3) {\
Fprintf(log_output_, "\n\
"Transform_Quoted(C)";",A1,A2,A3);\
ec_flush(log_output_);\
}
# define Log4(C,A1,A2,A3,A4) {\
Fprintf(log_output_, "\n\
"Transform_Quoted(C)";",A1,A2,A3,A4); \
ec_flush(log_output_); \
}
# define Log5(C,A1,A2,A3,A4,A5) {\
Fprintf(log_output_, "\n\
"Transform_Quoted(C)";",A1,A2,A3,A4,A5); \
ec_flush(log_output_); \
}
# define Log6(C,A1,A2,A3,A4,A5,A6) {\
Fprintf(log_output_, "\n\
"Transform_Quoted(C)";",A1,A2,A3,A4,A5,A6); \
ec_flush(log_output_); \
}
#else
# define Call(Err, C) {Err = C;}
# define CallN(C) C
# define Log0(C)
# define Log1(C,A1)
# define Log2(C,A1,A2)
# define Log3(C,A1,A2,A3)
# define Log4(C,A1,A2,A3,A4)
# define Log5(C,A1,A2,A3,A4,A5)
# define Log6(C,A1,A2,A3,A4,A5,A6)
#endif
/*
* ECLiPSe declarations
*/
#include "external.h"
#if defined(WIN32) && defined(LOG_CALLS)
/* must be after include of external.h to avoid redefining log_output_ there
Windows workaround for log_output_ not exported in eclipse.def
*/
# define log_output_ ec_stream_id(ec_stream_nr("log_output"))
#endif
/* should be used only if v,t is a number */
#define DoubleVal(v, t) ( IsInteger(t) ? (double) (v).nint : \
IsDouble(t) ? Dbl(v) : coerce_to_double(v,t) )
#define Check_Constant_Range(x) \
{if ((x) < -CPX_INFBOUND || (x) > CPX_INFBOUND) {Bip_Error(RANGE_ERROR);}}
/*
* LpDescOnly can be used if we only want to access
* fields within lp_desc, not in the external solver
* this made a difference in old Xpress, but now there
* is a difference only when logging calls
*/
#define LpDescOnly(vlp, tlp, lpd) Get_Typed_Object(vlp, tlp, &lp_handle_tid, lpd)
#ifdef LOG_CALLS
static int next_matno = 0, current_matno = -1;
# define LpDesc(vlp, tlp, lpd) { \
Get_Typed_Object(vlp, tlp, &lp_handle_tid, (lpd)); \
if ((lpd)->matno != current_matno) \
{ \
Fprintf(log_output_, "\n\
lpd = (lp_desc *) lpdmat[%d];", (lpd)->matno); \
ec_flush(log_output_); \
current_matno = (lpd)->matno; \
} \
}
#else
# define LpDesc(vlp, tlp, lpd) LpDescOnly(vlp, tlp, lpd)
#endif
#define IsArray(t) IsString(t)
#define Check_Array(t) Check_String(t)
#define IArrayStart(pw) ((int *)BufferStart(pw))
#define DArrayStart(pw) ((double *)BufferStart(pw))
#define CArrayStart(pw) ((char *)BufferStart(pw))
#define Return_Unify_Array(v,t,a) Return_Unify_String(v,t,a)
#define DArraySize(pbuf) ((BufferSize(pbuf) - 1) / sizeof(double))
#define IArraySize(pbuf) ((BufferSize(pbuf) - 1) / sizeof(int))
static pword * _create_carray();
static pword * _create_darray();
static pword * _create_iarray();
/*
* Solver-independent constants
*/
/* argument indices in Prolog-level prob-handle */
#define HANDLE_CPH 1 /* C-level handle */
#define HANDLE_STAMP 2 /* timestamp for prob-handle */
#define HANDLE_M_METH 0 /* Outputs: offsets from meth-field */
#define HANDLE_M_AUXMETH 1
#define HANDLE_M_NODEMETH 2
#define HANDLE_M_NODEAUXMETH 3
#define HANDLE_S_SOLS 0 /* Outputs: offsets from sols-field */
#define HANDLE_S_PIS 1
#define HANDLE_S_SLACKS 2
#define HANDLE_S_DJS 3
#define HANDLE_S_CBASE 4
#define HANDLE_S_RBASE 5
#define HANDLE_S_CPCM 6
#define HANDLE_S_IISR 7
#define HANDLE_S_IISC 8
#define HANDLE_S_IISCS 9
#define COL_STAMP 1 /* timestamp for a column (in attribute) */
#define DESCR_EMPTY 0 /* problem descriptor state */
#define DESCR_LOADED 1
#define DESCR_SOLVED_SOL 2
#define DESCR_SOLVED_NOSOL 3
#define DESCR_ABORTED_SOL 4
#define DESCR_ABORTED_NOSOL 5
#define DESCR_UNBOUNDED_NOSOL 6
#define DESCR_UNKNOWN_NOSOL 7
#define CSTR_TYPE_NORM 0 /* correspond to constraint_type_code/2 */
#define CSTR_TYPE_PERMCP 1
#define CSTR_TYPE_CONDCP 2
#define CSTR_STATE_NOTADDED -1
#define CSTR_STATE_VIOLATED -1
#define CSTR_STATE_SAT -2
#define CSTR_STATE_BINDING -3
#define CSTR_STATE_INVALID -4
#define CSTR_STATE_INACTIVE -5
#define MIPSTART_NONE 0
#define MIPSTART_ALL 1
#define MIPSTART_INT 2
#define CP_ACTIVE 1 /* correspond to cp_cond_code/2 */
#define CP_ADDINIT 2
#define NEWROW_INCR 60 /* default sizes for addrow arrays */
#define NEWNZ_INCR 510
#define NEWBD_INCR 510 /* arrays needed for changing bounds */
#define NEWCOL_INCR 1022 /* macsz arrays growth increment */
#define NEWSOS_INCR 32
#define CUTPOOL_INCR 10 /* number of cutpools increment */
#define RoundTo(n,unit) ((n) - ((n) - 1) % (unit) -1 + (unit))
#define Max(x,y) ((x)>(y)?(x):(y))
/* minimum number of words that Type would fit in */
#define NumberOfWords(Type) (1+(sizeof(Type)-1)/sizeof(word))
/*
* Include solver-specific declarations
*/
#ifdef CPLEX
#include "eplex_cplex.h"
#endif
#ifdef GUROBI
#include "eplex_gurobi.h"
#endif
#ifdef XPRESS
#include "eplex_xpress.h"
#endif
#ifdef COIN /* COIN based solvers */
#include "eplex_coin.h"
#endif
/*
* Problem handle
*/
/* Methods for lp_handle_tid */
static void _free_lp_handle(lp_desc *lpd);
static int _strsz_lp_handle(lp_desc *lpd, int quoted);
static int _tostr_lp_handle(lp_desc *lpd, char *buf, int quoted);
/* 2*sizeof(void *) for max. size for a printed address */
#define STRSZ_LP_HANDLE 2*sizeof(void *)+20
static int
_strsz_lp_handle(lp_desc *lpd, int quoted)
{
return STRSZ_LP_HANDLE;
}
static int
_tostr_lp_handle(lp_desc *lpd, char *buf, int quoted)
{
sprintf(buf, "'EPLEX_"Transform_Quoted(SOLVER_SHORT_NAME)"'(16'%" W_MOD "x)", (uword) lpd);
return strlen(buf); /* size of actual string */
}
t_ext_type lp_handle_tid = {
(void (*)(t_ext_ptr)) _free_lp_handle, /* free */
NULL, /* copy */
NULL, /* mark_dids */
(int (*)(t_ext_ptr,int)) _strsz_lp_handle, /* string_size */
(int (*)(t_ext_ptr,char *,int)) _tostr_lp_handle, /* to_string */
NULL, /* equal */
NULL, /* remote_copy */
NULL, /* get */
NULL /* set */
};
typedef struct {
int oldmar, oldmac, oldsos, oldidc;
} untrail_data;
typedef struct {
int idx;
char ctype;
} untrail_ctype;
typedef struct {
double bds[2]; /* bounds: lower, upper */
int idx; /* index of column */
} untrail_bound;
typedef struct {
int old_ptype; /* old problem type */
} untrail_ptype;
/*
* Global data
*/
/* ECLiPSe streams for 4 message types (log,result,warning,error) */
static stream_id solver_streams[4];
/* Atoms used to communicate with the Prolog level */
static dident d_le, d_ge, d_eq, d_optimizer, d_yes, d_no;
/* Global solver environment (!=0 when initialised) */
static CPXENVptr cpx_env = (CPXENVptr) 0;
#ifdef CPLEX
static CPXCHANNELptr cpxresults = (CPXCHANNELptr) 0;
static CPXCHANNELptr cpxwarning = (CPXCHANNELptr) 0;
static CPXCHANNELptr cpxerror = (CPXCHANNELptr) 0;
static CPXCHANNELptr cpxlog = (CPXCHANNELptr) 0;
# if CPLEX >= 8
static void CPXPUBLIC eclipse_out ARGS((void *nst, const char*msg));
# else
static void CPXPUBLIC eclipse_out ARGS((void *nst, char*msg));
# endif
#endif /* CPLEX */
#ifdef XPRESS
/* Type of XPRESS library */
#define XP_OEM_UNKNOWN -1
#define XP_OEM_NO 0
#define XP_OEM_YES 1
static int oem_xpress = XP_OEM_UNKNOWN;
static void XPRS_CC eclipse_out ARGS((XPRSprob prob, void *obj, const char *msg, int len, int msgtype));
#endif /* XPRESS */
#if 0
void *
Malloc(size_t size)
{
void *p;
p = malloc(size);
Fprintf(Current_Error, "%8x malloc(%d)\n", p, size);
ec_flush(Current_Error);
return p;
}
void *
Realloc(void *p, size_t size)
{
Fprintf(Current_Error, "%8x realloc(%d)\n", p, size);
ec_flush(Current_Error);
return realloc(p, size);
}
void
Free(void *p)
{
Fprintf(Current_Error, "%8x free\n", p);
ec_flush(Current_Error);
free(p);
}
#else
#if 1
#define Malloc(size) malloc(size)
#define Realloc(p, size) realloc(p, size)
#define Free(p) free(p)
#else
/* Eclipse's hp_alloc() can cause problems because of private heap limit */
#define Malloc(size) hp_alloc(size)
#define Realloc(p, size) hp_resize(p, size)
#define Free(p) hp_free(p)
#endif
#endif
/* free *p if it is pointing at something */
#define TryFree(p) if (p) { CallN(Free(p)); p = NULL; }
static void _grow_cb_arrays(lp_desc *, int);
static void _grow_numbers_array(lp_desc * lpd, int m);
/*
* Include solver-specific code
*/
#ifdef CPLEX
#include "eplex_cplex.c"
#endif
#ifdef GUROBI
#include "eplex_gurobi.c"
#endif
#ifdef XPRESS
#include "eplex_xpress.c"
#endif
#ifdef COIN /* COIN based solvers */
#include "eplex_coin.c"
#endif
static double
coerce_to_double(value vval, type tval)
{
/* tval MUST be a number type */
value buffer;
tag_desc[TagType(tval)].coerce_to[TDBL](vval, &buffer);
return Dbl(buffer);
}
int
p_cpx_cleanup(value vlp, type tlp)
{
pword handle;
handle.val.all = vlp.all;
handle.tag.all = tlp.all;
return ec_free_handle(handle, &lp_handle_tid);
}
static void
_free_lp_handle(lp_desc *lpd)
{
int i;
#ifdef XPRESS
char name[128];
#endif
if (lpd->descr_state != DESCR_EMPTY)
{
#ifdef CPLEX
if (lpd->lp)
CallN(CPXfreeprob(cpx_env, &lpd->lp));
#endif
#ifdef XPRESS
strcpy(name, lpd->probname);
strcat(name, ".glb");
unlink(name);
if (lpd->lp) CallN(XPRSdestroyprob(lpd->lp));
if (lpd->lpcopy && lpd->lpcopy != lpd->lp) CallN(XPRSdestroyprob(lpd->lpcopy));
Mark_Copy_As_Modified(lpd);
TryFree(lpd->qgtype);
TryFree(lpd->mgcols);
TryFree(lpd->probname);
#endif /* XPRESS */
#ifdef COIN
CallN(coin_free_prob(lpd->lp));
/* lpd->lp allocated with new, and freed with delete by coin_free_prob()
so no need to free here
*/
lpd->lp = NULL;
#endif /* COIN */
TryFree(lpd->rhsx);
TryFree(lpd->senx);
TryFree(lpd->matbeg);
TryFree(lpd->matcnt);
TryFree(lpd->matind);
TryFree(lpd->matval);
TryFree(lpd->bdl);
TryFree(lpd->bdu);
TryFree(lpd->objx);
TryFree(lpd->ctype);
if (lpd->cb_sz)
{
CallN(Free(lpd->cb_index));
TryFree(lpd->cb_index2);
CallN(Free(lpd->cb_value));
}
if (lpd->sossz)
{
CallN(Free(lpd->sostype));
CallN(Free(lpd->sosbeg));
CallN(Free(lpd->sosind));
CallN(Free(lpd->sosref));
}
TryFree(lpd->rngval);
TryFree(lpd->cname);
TryFree(lpd->cstore);
TryFree(lpd->rname);
TryFree(lpd->rstore);
TryFree(lpd->numbers);
TryFree(lpd->zeroes);
TryFree(lpd->dzeroes);
if (lpd->nr_sz)
{
CallN(Free(lpd->rmatbeg));
TryFree(lpd->rcompl);
TryFree(lpd->rindind);
}
if (lpd->nnz_sz)
{
CallN(Free(lpd->rmatind));
CallN(Free(lpd->rmatval));
}
/*
if (lpd->cp_nr_sz)
{
CallN(Free(lpd->cp_rmatbeg));
CallN(Free(lpd->cp_rhsx));
CallN(Free(lpd->cp_senx));
}
if (lpd->cp_nz_sz)
{
CallN(Free(lpd->cp_rmatind));
CallN(Free(lpd->cp_rmatval));
}
*/
if (lpd->cp_nr_sz2)
{
CallN(Free(lpd->cp_rmatbeg2));
CallN(Free(lpd->cp_rhsx2));
CallN(Free(lpd->cp_senx2));
CallN(Free(lpd->cp_active2));
CallN(Free(lpd->cp_initial_add2));
if (lpd->cp_nz_sz2)
{
CallN(Free(lpd->cp_rmatind2));
CallN(Free(lpd->cp_rmatval2));
}
}
for (i=0; i < lpd->cp_npools2; i++) { TryFree(lpd->cp_pools2[i]); }
TryFree(lpd->cp_pools2);
TryFree(lpd->cp_pools_max2);
TryFree(lpd->cp_pools_sz2);
}
#ifdef CPLEX
CPXflushchannel (cpx_env, cpxresults);
CPXflushchannel (cpx_env, cpxlog);
CPXflushchannel (cpx_env, cpxerror);
CPXflushchannel (cpx_env, cpxwarning);
#else
(void) ec_flush(solver_streams[LogType]);
(void) ec_flush(solver_streams[ResType]);
(void) ec_flush(solver_streams[WrnType]);
(void) ec_flush(solver_streams[ErrType]);
#endif
CallN(Free(lpd));
}
/*
* Get a licence if necessary, print message and fail if impossible.
* If ok, do some low-level initialization
*
* As an indication that initialization was successful,
* cpx_env is set not non-NULL, even for XPRESS.
* All functions that do not use a problem handle must make sure that
* the system is initialised by checking whether cpx_env is non-NULL!
*/
int
p_cpx_init(value vlicloc, type tlicloc,
value vserialnum, type tserialnum,
value vsubdir, type tsubdir)
{
int i;
/* Initialise global variables */
for (i=0; i<4; i++)
solver_streams[i] = Current_Null;
d_le = ec_did("=<", 0);
d_ge = ec_did(">=", 0);
d_eq = ec_did("=:=", 0);
d_optimizer = ec_did(SOLVER_ATOMIC_NAME, 0);
d_yes = ec_did("yes", 0);
d_no = ec_did("no", 0);
if (!cpx_env)
{
#ifdef COIN
CallN(coin_create_prob(&cpx_env, NULL));
#endif
# if defined(CPLEX)
char errmsg[512];
int status, dev_status;
char *licloc; /* environment string (CPLEX) */
Check_Integer(tserialnum);
Get_Name(vlicloc, tlicloc, licloc);
if (*licloc == '\0') licloc = NULL;
# if CPLEX >= 7
if (licloc)
{
/* We have a CPLEX runtime key, call CPXRegisterLicense().
* CAUTION: when this call fails, the process may be in a funny
* state. With Cplex 7/8, the thread bindings are changed and
* the process cannot use virtual timers any longer (bug 243).
*/
Log1(CPXRegisterLicense(0, %d), (int) vserialnum.nint);
if (CPXRegisterLicense(licloc, (int) vserialnum.nint))
{
Fprintf(Current_Error, "Invalid CPLEX runtime key.\n");
(void) ec_flush(Current_Error);
Fail;
}
}
/* Note CPLEX prints a banner to stderr in CPXopenCPLEX! */
CallN(cpx_env = CPXopenCPLEX(&dev_status));
if (dev_status)
{
CPXgeterrorstring(cpx_env, dev_status, errmsg);
Fprintf(Current_Error, "%s", errmsg);
(void) ec_flush(Current_Error);
Fail;
}
# if CPLEX >= 8
/* no dual reduction as suggested by manual to get firm infeasible
conclusion for MIP
*/
CallN(CPXsetintparam(cpx_env, CPX_PARAM_REDUCE, 1));
# endif
# else
int rt_status = 0;
CallN(cpx_env = CPXopenCPLEXdevelop(&dev_status));
if (dev_status == 32027) /* out of licences */
{
CPXgeterrorstring(cpx_env, dev_status, errmsg);
Fprintf(Current_Error, "%s", errmsg);
(void) ec_flush(Current_Error);
Fail;
}
if (dev_status != 0) /* other problem, try runtime licence */
{
char *serialnumstring = getenv("ECLIPSECPLEXSERIALNUM");
int serialnum = serialnumstring ? strtol(serialnumstring, NULL, 0) : vserialnum.nint;
if (serialnum)
{
cpx_env = CPXopenCPLEXruntime(&rt_status, serialnum, licloc);
}
else
{
Fprintf(Current_Error, "Couldn't find CPLEX development licence: check setting of CPLEXLICENCE,\nCPLEXLICDIR, CPLEXLICTYPE or set ECLIPSECPLEXSERIALNUM to use a runtime licence.\n", 0);
(void) ec_flush(Current_Error);
Fail;
}
}
if (dev_status && rt_status) /* no licence could be opened */
{
CPXgeterrorstring(cpx_env, dev_status, errmsg);
Fprintf(Current_Error, "DEV: %s", errmsg);
CPXgeterrorstring(cpx_env, rt_status, errmsg);
Fprintf(Current_Error, "RT: %s", errmsg);
(void) ec_flush(Current_Error);
Fail;
}
# endif /* CPLEX < 7 */
status = CPXgetchannels(cpx_env, &cpxresults, &cpxwarning, &cpxerror, &cpxlog);
if (status)
{
CPXgeterrorstring(cpx_env, status, errmsg);
Fprintf(Current_Error, "%s", errmsg);
(void) ec_flush(Current_Error);
Bip_Error(EC_EXTERNAL_ERROR);
}
# endif /* CPLEX */
# ifdef XPRESS
int err;
char slicmsg[256], banner[256];
char *licloc, /* licence location (XPRESS) */
*subdir; /* solver/platform/version-specific stuff (XPRESS 15) */
Check_Integer(tserialnum);
Get_Name(vlicloc, tlicloc, licloc);
Get_Name(vsubdir, tsubdir, subdir);
if (*licloc == '\0') licloc = NULL;
/* Embedded OEM licence handling */
if (oem_xpress == XP_OEM_YES)
{
i = (int) vserialnum.nint;
err = XPRSlicense(&i, slicmsg); /* second call */
}
# ifdef XPRESS_OEM_ICPARC_2002
Handle_OEM_ICPARC
# endif
# if (XPRESS == 15)
{/* Xpress 15 requires the PATH environment variable to be set
to where the license manager lmgrd is, as it execs an
unqualified lmgrd from within XPRSinit()!
*/
const char * curpaths;
char * newpaths;
curpaths = getenv("PATH");
newpaths = Malloc(strlen("PATH=") + strlen(curpaths)
+ strlen(PATH_SEPARATOR) + strlen(subdir) + 1);
strcpy(newpaths, "PATH=");
strcat(newpaths, subdir);
strcat(newpaths, PATH_SEPARATOR);
strcat(newpaths, curpaths);
putenv(newpaths);
}
# endif
err = XPRSinit(licloc);
# if (XPRESS >= 20)
if (err != 0 && err != 32 /* Student mode */)
{
char msg[512];
XPRSgetlicerrmsg(msg, 512);
Fprintf(Current_Error, "%s", msg);
ec_flush(Current_Error);
Fail;
}
XPRSgetbanner(banner);
Fprintf(Current_Output, "%s\n", banner);
# else
{
int ndays;
/* no banner printed in XPRESS 13, print it now as it may contain
extra error information
*/
XPRSgetbanner(banner);
Fprintf(Current_Output, "%s\n", banner);
XPRSgetdaysleft(&ndays);
/* ndays == 0 if license is not time-limited */
if (ndays > 0)
{
Fprintf(Current_Output, "This XPRESS license will expire in %d days.\n\n", ndays);
}
else if (ndays < 0)
{
Fprintf(Current_Error, "This XPRESS license has expired\n\n");
ec_flush(Current_Error);
}
ec_flush(Current_Output);
}
if (err != 0 && err != 32 /* Student mode */)
{
if (err != 8 || oem_xpress == XP_OEM_YES) /* suppress message for OEM library */
{
Fprintf(Current_Error, "XPRESS error (probably licencing problem)\n");
(void) ec_flush(Current_Error);
}
Fail;
}
if (oem_xpress == XP_OEM_YES) /* print the OEM message */
{
Fprintf(Current_Output, slicmsg);
(void) ec_newline(Current_Output);
}
# endif
/* use cpx_env to store the `default problem' */
CallN(XPRScreateprob(&cpx_env));
# endif /* XPRESS */
#ifdef GUROBI
int status;
char *licloc;
Get_Name(vlicloc, tlicloc, licloc);
if (*licloc == '\0') licloc = NULL;
if (licloc && !getenv("GRB_LICENSE_FILE"))
{
char *envstring = Malloc(strlen("GRB_LICENSE_FILE=")+strlen(licloc)+1);
strcat(strcpy(envstring,"GRB_LICENSE_FILE="),licloc);
/* Bug: this putenv does not seem to affect GRBloadenv below (Windows) */
putenv(envstring);
}
status = GRBloadenv(&cpx_env, NULL);
if (status == GRB_ERROR_NO_LICENSE)
{
Fprintf(Current_Error, "Couldn't find Gurobi licence.\n");
ec_flush(Current_Error);
Fail;
}
else if (status)
{
/* can't retrieve error messages yet */
Fprintf(Current_Error, "Gurobi error %d\n", status);
ec_flush(Current_Error);
Bip_Error(EC_EXTERNAL_ERROR);
}
/* switch off solver's own output */
GRBsetintparam(cpx_env, GRB_INT_PAR_OUTPUTFLAG, 0);
#endif /* GUROBI */
}
# ifdef LOG_CALLS
Fprintf(log_output_, "\nvoid step_%d() {\n", log_ctr++);
ec_flush(log_output_);
# endif
Succeed;
}
int
p_cpx_challenge(value v, type t)
{
# ifdef XPRESS
# if defined(WIN32)
int nvalue;
char slicmsg[256];
/* Caution: calling optlicence() twice crashes on some non-oem XPRESSes */
if (oem_xpress != XP_OEM_NO)
{
if (XPRSlicense(&nvalue, slicmsg) != 8)
{
oem_xpress = XP_OEM_YES;
Return_Unify_Integer(v, t, (long) nvalue);
}
}
# endif
oem_xpress = XP_OEM_NO;
# endif
Fail;
}
int
p_cpx_exit()
{
if (cpx_env)
{
CPXcloseCPLEX(&cpx_env);
cpx_env = 0;
}
Succeed;
}
int
p_cpx_prob_init(value vpre, type tpre,
value vcpy, type tcpy,
value vrow, type trow,
value vcol, type tcol,
value vnz, type tnz,
value vdir, type tdir,
value vsense, type tsense,
value vhandle, type thandle)
{
int i;
lp_desc *lpd;
Check_Integer(tpre);
Check_Integer(tcpy);
Check_Integer(trow);
Check_Integer(tcol);
Check_Integer(tnz);
Check_Structure(thandle);
CallN(lpd = (lp_desc *) Malloc(sizeof(lp_desc)));
/*CallN(_clr_lp_desc(lpd));*/
CallN(memset(lpd, 0, sizeof(lp_desc)));
#ifdef USE_PROBLEM_ARRAY
Log1(lpdmat[%d] = lpd, next_matno);
current_matno = next_matno;
lpd->matno = next_matno++;
#endif
#ifdef XPRESS
lpd->copystatus = (vcpy.nint == 1 ? XP_COPYINVALID : XP_COPYOFF);
{/* need unique name so that file names created by XPRESS are unique
dir is a directory path (but may need to be have the directory
separator character (/ or \) added
*/
int dirlen;
#ifdef WIN32
# define BASE_PROB_NAME \\eclipse
#else
# define BASE_PROB_NAME /eclipse
#endif
Check_String(tdir);
dirlen = strlen(StringStart(vdir));
lpd->probname = (char *) Malloc((50+dirlen) * sizeof(char));
sprintf(lpd->probname, "%s"Transform_Quoted(BASE_PROB_NAME)"%u-%u",
StringStart(vdir), gethostid(), getpid());
if (strlen(lpd->probname) > XP_PROBNAME_MAX)
{
Fprintf(Current_Error, "Eplex error: the problem name for Xpress is too long.\n"
"Change tmp_dir to a directory with shorter path length.\n");
ec_flush(Current_Error);
Bip_Error(RANGE_ERROR);
}
}
#endif
lpd->prob_type = PROBLEM_LP;
lpd->presolve = vpre.nint;
lpd->sense = vsense.nint;
lpd->mac = vcol.nint;
lpd->macsz = vcol.nint;
lpd->macadded = 0;
lpd->nidc = 0;
lpd->marsz = vrow.nint; /* max number of rows */
lpd->mar = vrow.nint;
lpd->matnz = vnz.nint; /* number of nonzero coefficients */
/* if vcol/vrow/vnz is 0, malloc arrays of at least size 1. This avoid
calling malloc with size 0, and does create an array (Xpress crashes
if NULL is given in place of an array address in some cases)
This increment should only be done after assigning their original
values to the lpd fields!
*/
if (vcol.nint == 0) vcol.nint++;
if (vrow.nint == 0) vrow.nint++;
if (vnz.nint == 0) vnz.nint++;
lpd->rhsx = (double *) Malloc(vrow.nint * sizeof(double));
lpd->senx = (char *) Malloc(vrow.nint * sizeof(char));
/* one extra element for matbeg, because some representations of the
matrix (e.g. COIN) needs the `matbeg' for vcol+1 to be specified,
so that the end of the last column can be determined without matcnt
*/
lpd->matbeg = (int *) Malloc((1+vcol.nint) * sizeof(int));
lpd->matcnt = (int *) Malloc(vcol.nint * sizeof(int));
lpd->matind = (int *) Malloc(vnz.nint * sizeof(int));
lpd->matval = (double *) Malloc(vnz.nint * sizeof(double));
lpd->bdl = (double *) Malloc(vcol.nint * sizeof(double));
lpd->bdu = (double *) Malloc(vcol.nint * sizeof(double));
lpd->dirtybdflag = 0;
lpd->objx = (double *) Malloc(vcol.nint * sizeof(double));
lpd->ctype = (char *) Malloc(vcol.nint * sizeof(char));
for (i = 0; i < vcol.nint; i++)
{
lpd->bdl[i] = -CPX_INFBOUND;
lpd->bdu[i] = CPX_INFBOUND;
lpd->objx[i] = 0.0;
lpd->ctype[i] = 'C';
}
/* the cutpools fields in lpd should all be zero/NULL at this point, so
they do not need to be initialised
*/
lpd->descr_state = DESCR_LOADED;
lpd->mipstart_dirty = 0;
{/* Return the cplex descriptor in argument HANDLE_CPH of the handle structure. */
vhandle.ptr[HANDLE_CPH] = ec_handle(&lp_handle_tid, lpd);
Make_Stamp(vhandle.ptr+HANDLE_STAMP); /* needed for other trail undos */
}
Succeed;
}
int
p_cpx_get_prob_param(value vlp, type tlp, value vp, type tp, value vval, type tval)
{
lp_desc *lpd;
int i;
Check_Integer(tp);
LpDesc(vlp, tlp, lpd);
switch(vp.nint)
{
case 0: i = lpd->mar; break;
case 1: i = lpd->mac; break;
case 3: i = lpd->sense; break;
case 4: i = lpd->prob_type; break;
case 5: i = lpd->optimum_ctr; break;
case 6: i = lpd->infeas_ctr; break;
case 7: i = lpd->abort_ctr; break;
case 8: i = lpd->sol_itcnt; break;
case 9: i = lpd->sol_nodnum; break;
case 10: i = lpd->descr_state; break;
case 11: i = lpd->sol_state; break;
case 12: CPXupdatemodel(lpd->lp);
i = CPXgetnumnz(cpx_env, lpd->lp); break;
case 13: CPXupdatemodel(lpd->lp);
i = IsMIPProb(lpd->prob_type) ?
CPXgetnumint(cpx_env, lpd->lp) + CPXgetnumbin(cpx_env, lpd->lp) : 0;
break;
case 14: CPXupdatemodel(lpd->lp);
i = IsQPProb(lpd->prob_type) ? CPXgetnumqpnz(cpx_env, lpd->lp) : 0;
break;
case 15: i = lpd->start_mac; break;
/* case 16: i = lpd->cp_nr; break;*/
case 17: i = lpd->cp_nr2; break;
case 18: i = lpd->cp_nact2; break;
default:
Bip_Error(RANGE_ERROR);
}
Return_Unify_Integer(vval, tval, i);
}
int
p_cpx_get_param(value vlp, type tlp, value vp, type tp, value vval, type tval)
{
double dres;
int i, ires;
char sres[STRBUFFERSIZE];
lp_desc *lpd;
#ifndef COIN
if (!cpx_env)
{
Bip_Error(EC_LICENSE_ERROR);
}
#endif
/* lpd is NULL for global/default param */
if (IsHandle(tlp)) {
LpDesc(vlp, tlp, lpd);
if (!lpd->lp) lpd = NULL;
} else lpd = NULL;
if (IsAtom(tp))
{
for(i=0; i<NUMPARAMS+NUMALIASES; ++i) /* lookup the parameter name */
{
if (strcmp(params[i].name, DidName(vp.did)) == 0)
break;
}
if (i==NUMPARAMS+NUMALIASES)
{
Bip_Error(RANGE_ERROR);
}
if (params[i].type == 0 &&
Get_Int_Param(cpx_env, lpd, params[i].num, &ires)
== 0)
{
Return_Unify_Integer(vval, tval, ires);
}
if (params[i].type == 1 &&
Get_Dbl_Param(cpx_env, lpd, params[i].num, &dres)
== 0)
{
Return_Unify_Float(vval, tval, dres);
}
#ifdef SOLVER_HAS_STR_PARAMS
if (params[i].type == 2 &&
Get_Str_Param(cpx_env, lpd, params[i].num, sres)
== 0)
{
value val;
Check_Output_String(tval);
Cstring_To_Prolog(sres, val);
Return_Unify_String(vval, tval, val.ptr);
}
#endif
#ifdef COIN
if (params[i].type == 3 &&
coin_get_solver_intparam((lpd==NULL ? cpx_env : lpd->lp),
params[i].num, &ires)
== 0)
{
Return_Unify_Integer(vval, tval, ires);
}
if (params[i].type == 4 &&
coin_get_solver_dblparam((lpd==NULL ? cpx_env : lpd->lp),
params[i].num, &dres)
== 0)
{
Return_Unify_Float(vval, tval, dres);
}
if (params[i].type == 6 &&
coin_get_eplex_intparam((lpd==NULL ? cpx_env : lpd->lp),
params[i].num, &ires)
== 0)
{
Return_Unify_Integer(vval, tval, ires);
}
if (params[i].type == 8 &&
coin_get_eplex_strparam((lpd==NULL ? cpx_env : lpd->lp),
params[i].num, sres)
== 0)
{
value val;
Check_Output_String(tval);
Cstring_To_Prolog(sres, val);
Return_Unify_String(vval, tval, val.ptr);
}
#endif
Bip_Error(TYPE_ERROR); /* occurs only if params[i].type is wrong */
}
Check_Integer(tp);
switch (vp.nint)
{
case -1: /* get optimizer code */
Return_Unify_Atom(vval, tval, d_optimizer);
case -2: /* get optimizer version */
#ifdef COIN
{
char * ver = Malloc(32*sizeof(char));
pword pw;
coin_get_solver_info(ver);
Make_String(&pw, ver);
Free(ver);
Return_Unify_Pw(vval, tval, pw.val, pw.tag);
}
#else
Return_Unify_Integer(vval, tval, SOLVER_VERSION_INT);
#endif
case -3: /* has_qp */
#ifdef HAS_QUADRATIC
Return_Unify_Atom(vval, tval, d_yes);
#else
Return_Unify_Atom(vval, tval, d_no);
#endif
case -4: /* has_miqp */
#ifdef HAS_MIQP
Return_Unify_Atom(vval, tval, d_yes);
#else
Return_Unify_Atom(vval, tval, d_no);
#endif
case -5: /* has_indicator_constraints */
#ifdef HAS_INDICATOR_CONSTRAINTS
Return_Unify_Atom(vval, tval, d_yes);
#else
Return_Unify_Atom(vval, tval, d_no);
#endif
default:
Bip_Error(RANGE_ERROR);
}
}
int
p_cpx_set_param(value vlp, type tlp, value vp, type tp, value vval, type tval)
/* fails if parameter unknown */
{
int i;
int err = 1;
lp_desc *lpd;
Check_Atom(tp);
#ifndef COIN
if (!cpx_env)
{
Bip_Error(EC_LICENSE_ERROR);
}
#endif
/* lpd is NULL for global/default param */
if (IsHandle(tlp)) {
LpDesc(vlp, tlp, lpd);
if (!lpd->lp) lpd = NULL;
} else lpd = NULL;
#ifndef SOLVER_HAS_LOCAL_PARAMETERS
if (lpd != NULL)
{
Fprintf(Current_Error, "Eplex error: per solver instance parameters are not supported for this solver. Use global parameters instead.\n");
Bip_Error(UNIMPLEMENTED);
}
#endif
for(i=0; i<NUMPARAMS+NUMALIASES; ++i) /* lookup the parameter name */
{
if (strcmp(params[i].name, DidName(vp.did)) == 0)
break;
}
if (i==NUMPARAMS+NUMALIASES)
{
Fail;
}
if (params[i].type == 0 && IsInteger(tval))
{
/* Log4 because Set_Int_Param expands into 4 arg for Xpress */
Log4(Set_Int_Param(cpx_env, lpd, %d, %d), params[i].num, vval.nint,
params[i].num, vval.nint);
err = Set_Int_Param(cpx_env, lpd, params[i].num, vval.nint);
}
else if (params[i].type == 1 && IsDouble(tval))
{
Log4(Set_Dbl_Param(cpx_env, lpd, %d, %f), params[i].num, Dbl(vval),
params[i].num, Dbl(vval));
err = Set_Dbl_Param(cpx_env, lpd, params[i].num, Dbl(vval));
}
#ifdef SOLVER_HAS_STR_PARAMS
else if (params[i].type == 2 && (IsAtom(tval) || IsString(tval)))
{
char *s = IsAtom(tval)? DidName(vval.did): StringStart(vval);
if (strlen(s) >= STRBUFFERSIZE) Bip_Error(RANGE_ERROR);/*too large*/
Call(err, Set_Str_Param(cpx_env, lpd, params[i].num, s));
}
#endif
#if defined(XPRESS) && defined(WIN32)
else if (params[i].type == 3 && (IsAtom(tval) || IsString(tval)))
{
char *s = IsAtom(tval)? DidName(vval.did): StringStart(vval);
err = XPRSsetlogfile(lpd->lp, s);
}
#endif
#ifdef COIN
/* Solver dependent parameters */
else if (params[i].type == 3 && IsInteger(tval))
{
err = coin_set_solver_intparam((lpd == NULL ? cpx_env : lpd->lp), params[i].num, vval.nint);
}
else if (params[i].type == 4 && IsDouble(tval))
{
err = coin_set_solver_dblparam((lpd == NULL ? cpx_env : lpd->lp), params[i].num, Dbl(vval));
}
else if (params[i].type == 6 && IsInteger(tval))
{
err = coin_set_eplex_intparam((lpd == NULL ? cpx_env : lpd->lp), params[i].num, vval.nint);
}
/* no double params defined yet
else if (params[i].type == 7 && IsDouble(tval))
{
err = coin_set_eplex_dblparam((lpd == NULL ? cpx_env : lpd->lp), params[i].num, Dbl(vval));
}
*/
else if (params[i].type == 8 && (IsAtom(tval) || IsString(tval)))
{
char *s = IsAtom(tval)? DidName(vval.did): StringStart(vval);
err = coin_set_eplex_strparam((lpd == NULL ? cpx_env : lpd->lp), params[i].num, s);
}
#endif
if (err) {
Bip_Error(TYPE_ERROR);
}
Succeed;
}
/*----------------------------------------------------------------------*
* Message and error output
*----------------------------------------------------------------------*/
#ifdef CPLEX
static void CPXPUBLIC
# if CPLEX >= 8
eclipse_out(void * nst, const char * msg)
# else
eclipse_out(void * nst, char * msg)
# endif
{
(void) ec_outf((stream_id) nst, msg, strlen(msg));
(void) ec_flush((stream_id) nst);
}
int
p_cpx_output_stream(value vc, type tc, value vwhat, type twhat, value vs, type ts)
{
stream_id nst;
CPXCHANNELptr ch;
pword pw;
int err;
if (!cpx_env)
{
Bip_Error(EC_LICENSE_ERROR);
}
pw.val = vs; pw.tag = ts;
err = ec_get_stream(pw, &nst);
if (err) { Bip_Error(err); }
Check_Integer(tc);
switch (vc.nint) {
case 0: ch = cpxresults; break;
case 1: ch = cpxerror; break;
case 2: ch = cpxwarning; break;
case 3: ch = cpxlog; break;
default: Bip_Error(RANGE_ERROR);
}
Check_Integer(twhat);
if (vwhat.nint == 0)
{
CPXdelfuncdest(cpx_env, ch, (void *) nst, eclipse_out);
} else {
/* raise error only if adding a stream */
if (CPXaddfuncdest(cpx_env, ch, (void *) nst, eclipse_out))
{ Bip_Error(EC_EXTERNAL_ERROR); }
}
Succeed;
}
#else
# ifdef XPRESS
static void XPRS_CC
eclipse_out(XPRSprob lp, void * obj, const char * msg, int len, int msgtype)
{
if (msgtype >= 1 && msgtype <= 4)
{
/* filter out and not print unwanted messages */
if (msgtype == 3)
{
/* it seems that there are no other way of filtering out
warning messages than to check the msg string
*/
if (strncmp(msg, "?140 ", 5) == 0) return; /* basis lost */
if (strncmp(msg, "?359 ", 5) == 0) return; /* illegal int bounds */
}
/* Fprintf(solver_streams[msgtype-1], "*%d*", msgtype); */
(void) ec_outf(solver_streams[msgtype-1], (char*) msg, len);
(void) ec_newline(solver_streams[msgtype-1]);
}
/* flushing is done in cleanup */
}
# endif
# ifdef COIN
void
eclipse_out(int msgtype, const char* message)
{
(void) ec_outf(solver_streams[msgtype], message, strlen(message));
(void) ec_newline(solver_streams[msgtype]);
}
# endif
int
p_cpx_output_stream(value vc, type tc, value vwhat, type twhat, value vs, type ts)
{
stream_id nst;
stream_id *solver_stream;
pword pw;
int err;
# ifdef XPRESS
if (!cpx_env)
{
Bip_Error(EC_LICENSE_ERROR);
}
# endif
pw.val = vs; pw.tag = ts;
err = ec_get_stream(pw, &nst);
if (err) { Bip_Error(err); }
Check_Integer(tc);
Check_Integer(twhat);
switch (vc.nint) {
case 0: solver_stream = &solver_streams[ResType]; break;
case 1: solver_stream = &solver_streams[ErrType]; break;
case 2: solver_stream = &solver_streams[WrnType]; break;
case 3: solver_stream = &solver_streams[LogType]; break;
default: Bip_Error(RANGE_ERROR);
}
if (vwhat.nint == 1)
*solver_stream = nst;
else if (*solver_stream == nst)
*solver_stream = Current_Null;
Succeed;
}
#endif
/*----------------------------------------------------------------------*
* Initial setup
*----------------------------------------------------------------------*/
int
p_cpx_get_rhs(value vlp, type tlp, value vpool, type tpool, value vi, type ti,
value vsense, type tsense, value vval, type tval)
{
lp_desc *lpd;
Prepare_Requests
double rhs[1];
char sen[1];
dident sense;
LpDesc(vlp, tlp, lpd);
switch (vpool.nint)
{
case CSTR_TYPE_NORM:
SetPreSolve(lpd->presolve);
CPXupdatemodel(lpd->lp); /* before CPXget... */
if (CPXgetrhs(cpx_env, lpd->lp, rhs, (int) vi.nint, (int) vi.nint))
{ Bip_Error(EC_EXTERNAL_ERROR); }
if (CPXgetsense(cpx_env, lpd->lp, sen, (int) vi.nint, (int) vi.nint))
{ Bip_Error(EC_EXTERNAL_ERROR); }
break;
/*
case CSTR_TYPE_PERMCP:
sen[0] = lpd->cp_senx[vi.nint];
rhs[0] = lpd->cp_rhsx[vi.nint];
break;
*/
case CSTR_TYPE_CONDCP:
sen[0] = lpd->cp_senx2[vi.nint];
rhs[0] = lpd->cp_rhsx2[vi.nint];
break;
default:
Bip_Error(RANGE_ERROR);
break;
}
sense = sen[0] == SOLVER_SENSE_LE ? d_le :
sen[0] == SOLVER_SENSE_GE ? d_ge : d_eq;
Request_Unify_Atom(vsense, tsense, sense);
Request_Unify_Float(vval, tval, rhs[0]);
Return_Unify;
}
int
p_cpx_set_rhs_coeff(value vlp, type tlp, value vi, type ti, value vsense, type tsense, value vval, type tval)
{
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(ti);
Check_Number(tval);
if (vi.nint >= lpd->marsz) { Bip_Error(RANGE_ERROR); }
Check_Atom(tsense);
if (vsense.did == d_le) lpd->senx[vi.nint] = SOLVER_SENSE_LE;
else if (vsense.did == d_ge) lpd->senx[vi.nint] = SOLVER_SENSE_GE;
else if (vsense.did == d_eq) lpd->senx[vi.nint] = SOLVER_SENSE_EQ;
else { Bip_Error(RANGE_ERROR); }
lpd->rhsx[vi.nint] = DoubleVal(vval, tval);
Check_Constant_Range(lpd->rhsx[vi.nint]);
Succeed;
}
int
p_cpx_set_obj_coeff(value vlp, type tlp, value vj, type tj, value vval, type tval)
{
lp_desc *lpd;
int j;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(tj);
Check_Number(tval);
j = vj.nint;
if (j >= lpd->mac) { Bip_Error(RANGE_ERROR); }
if (j >= lpd->macadded) j -= lpd->macadded; /* added col */
lpd->objx[j] = DoubleVal(vval, tval);
Check_Constant_Range(lpd->objx[j]);
Succeed;
}
#if 0
int
p_cpx_get_obj_coeff(value vlp, type tlp, value vj, type tj, value vval, type tval)
{
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(tj);
if (vj.nint >= lpd->mac) { Bip_Error(RANGE_ERROR); }
Return_Unify_Float(vval, tval, lpd->objx[vj.nint]);
}
#endif
int
p_cpx_set_qobj_coeff(value vlp, type tlp, value vi, type ti, value vj, type tj, value vval, type tval)
{
lp_desc *lpd;
double coef;
int i;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(ti);
Check_Integer(tj);
Check_Number(tval);
if (IsInteger(tval)) {
coef = (double) vval.nint;
} else {
Check_Float(tval);
coef = DoubleVal(vval, tval);
Check_Constant_Range(coef);
}
if (vj.nint >= lpd->mac || vi.nint >= lpd->mac) { Bip_Error(RANGE_ERROR); }
if (lpd->cb_cnt == 0) /* first quadratic coefficient */
{
/* change the problem type to quadratic if linear */
switch (lpd->prob_type)
{
case PROBLEM_LP:
lpd->prob_type = PROBLEM_QP;
break;
case PROBLEM_MIP:
lpd->prob_type = PROBLEM_MIQP;
break;
case PROBLEM_QP:
case PROBLEM_MIQP:
/* nothing to be done if already quadratic */
break;
default:
Fprintf(Current_Error,
"Eplex error: quadratic objective coefficients cannot be added to problem type %d\n.",
lpd->prob_type);
Bip_Error(RANGE_ERROR);
}
}
if (lpd->cb_cnt >= lpd->cb_sz) /* grow arrays if necessary */
_grow_cb_arrays(lpd, 1);
i = lpd->cb_cnt++;
lpd->cb_index[i] = vi.nint;
lpd->cb_index2[i] = vj.nint;
lpd->cb_value[i] = vi.nint==vj.nint ? 2*coef : coef;
Succeed;
}
int
p_cpx_load_varname(value vlp, type tlp, value vj, type tj, value vname, type tname)
{
lp_desc *lpd;
#ifdef XPRESS
int maxlen = 128;
size_t namelen;
char buffer[128];
#endif
Check_Integer(tj);
Check_String(tname);
LpDesc(vlp, tlp, lpd);
if (vj.nint >= lpd->mac) { Bip_Error(RANGE_ERROR); }
#ifdef XPRESS
/* need to use temp. buffer in XPRESS as string is length limited */
namelen = strlen(StringStart(vname));
if (maxlen >= (int) namelen) {
/* just in case the call fails, assign some maxlen in that case */
if (XPRSgetintcontrol(lpd->lp, XPRS_MPSNAMELENGTH, &maxlen) != 0) maxlen = 8;
strcpy(buffer, StringStart(vname));
} else {
strncpy(buffer, StringStart(vname), (size_t) maxlen);
buffer[maxlen] = '\0';
}
Log5({
char buffer[%d];
strncpy(buffer, "%s", %d);
XPRSaddnames(lpd->lp, 2, buffer, %d, %d);
}, maxlen, buffer, maxlen, vj.nint, vj.nint);
XPRSaddnames(lpd->lp, 2, buffer, vj.nint, vj.nint);
#else
/* this assumes that vname.str will be copied upto first \0 */
/* we use CPXchgname() as this is in version 4 */
Log2(CPXchgname(cpx_env, lpd->lp, 'c', %d, %s), vj.nint, StringStart(vname));
CPXchgname(cpx_env, lpd->lp, 'c', vj.nint, StringStart(vname));
#endif
Succeed;
}
/*----------------------------------------------------------------------*
* Changing rhs
* cplex_change_rhs(++CPH, ++Size, ++RowIdxs, ++RhsCoeffs)
* Changes the rhs coefficients. RowIdxs and RhsCoeffs are lists of length
* Size. There is no provision for backtracking: the changes should be
* undone with another call to cplex_change_rhs
*/
int
p_cpx_change_rhs(value vlp, type tlp, value vsize, type tsize,
value vidxs, type tidxs, value vvals, type tvals)
{
lp_desc *lpd;
int i, err;
LpDesc(vlp, tlp, lpd);
Check_Integer(tsize);
if (vsize.nint > 0)
{
double *rhs = (double *) Malloc(vsize.nint * sizeof(double));
int *idxs = (int *) Malloc(vsize.nint * sizeof(int));
for (i=0; i<vsize.nint; ++i)
{
if (IsList(tidxs) && IsList(tvals))
{
pword *ihead = vidxs.ptr;
pword *itail = ihead + 1;
pword *vhead = vvals.ptr;
pword *vtail = vhead + 1;
Dereference_(ihead);
Dereference_(vhead);
if (!IsInteger(ihead->tag) || !IsNumber(vhead->tag))
{
Free(idxs);
Free(rhs);
Bip_Error(TYPE_ERROR);
}
idxs[i] = ihead->val.nint;
rhs[i] = DoubleVal(vhead->val, vhead->tag);
/* check that the row index and rhs value are in range... */
if (idxs[i] < 0 || idxs[i] >= lpd->mar ||
rhs[i] < -CPX_INFBOUND || rhs[i] > CPX_INFBOUND)
{
Free(idxs);
Free(rhs);
Bip_Error(RANGE_ERROR);
}
Dereference_(itail);
Dereference_(vtail);
tidxs = itail->tag;
vidxs = itail->val;
tvals = vtail->tag;
vvals = vtail->val;
}
else
{
Free(idxs);
Free(rhs);
Bip_Error(TYPE_ERROR);
}
}
Call(err, CPXchgrhs(cpx_env, lpd->lp, vsize.nint, idxs, rhs));
Free(idxs);
Free(rhs);
if (err) { Bip_Error(EC_EXTERNAL_ERROR); }
}
Succeed;
}
/*----------------------------------------------------------------------*
* Changing column bounds
* cplex_change_cols_bounds(++CPH, ++Size, ++Idxs, ++Los, ++His)
* Changes the lower and upper bounds of columns. Idxs, Los, His are
* lists of length Size. There is no provision for backtracking: the
* changes should be undone with another call to cplex_change_cols_bounds
*
*/
int
p_cpx_change_cols_bounds(value vlp, type tlp, value vsize, type tsize,
value vidxs, type tidxs, value vlos, type tlos, value vhis, type this)
{
lp_desc *lpd;
int i, err, size;
LpDesc(vlp, tlp, lpd);
Check_Integer(tsize);
size = vsize.nint*2;
if (size > 0)
{
double *bds = (double *) Malloc(size * sizeof(double));
int *idxs = (int *) Malloc(size * sizeof(double));
char *types = (char *) Malloc(size * sizeof(char));
for (i=0; i<size; )
{
if (IsList(tidxs) && IsList(tlos) && IsList(this))
{
pword *ihead = vidxs.ptr;
pword *itail = ihead + 1;
pword *lohead = vlos.ptr;
pword *lotail = lohead + 1;
pword *uphead = vhis.ptr;
pword *uptail = uphead + 1;
Dereference_(ihead);
Dereference_(lohead);
Dereference_(uphead);
if (!IsInteger(ihead->tag) || !IsNumber(lohead->tag) ||
!IsNumber(uphead->tag))
{
Free(bds);
Free(idxs);
Free(types);
Bip_Error(TYPE_ERROR);
}
idxs[i] = ihead->val.nint;
if (idxs[i] < 0 || idxs[i] >= lpd->mac)
{
Free(bds);
Free(idxs);
Free(types);
Bip_Error(RANGE_ERROR);
}
bds[i] = DoubleVal(lohead->val, lohead->tag);
if (bds[i] <= -CPX_INFBOUND) bds[i] = -CPX_INFBOUND;
types[i++] = 'L';
idxs[i] = ihead->val.nint;
bds[i] = DoubleVal(uphead->val, uphead->tag);
if (bds[i] >= CPX_INFBOUND) bds[i] = CPX_INFBOUND;
if (bds[i] < bds[i-1])
{
Free(bds);
Free(idxs);
Free(types);
Fail;
}
types[i++] = 'U';
Dereference_(itail);
Dereference_(lotail);
Dereference_(uptail);
tidxs = itail->tag;
vidxs = itail->val;
tlos = lotail->tag;
vlos = lotail->val;
this = uptail->tag;
vhis = uptail->val;
} else
{
Free(bds);
Free(idxs);
Free(types);
Bip_Error(TYPE_ERROR);
}
}
Call(err, CPXchgbds(cpx_env, lpd->lp, size, idxs, types, bds));
Free(bds);
Free(idxs);
Free(types);
if (err) { Bip_Error(EC_EXTERNAL_ERROR); }
}
Succeed;
}
int
p_cpx_lo_hi(value vlo, type tlo, value vhi, type thi)
{
Prepare_Requests;
Request_Unify_Float(vlo, tlo, -CPX_INFBOUND);
Request_Unify_Float(vhi, thi, CPX_INFBOUND);
Return_Unify;
}
/*----------------------------------------------------------------------*
* Changing problem type
*/
static void _cpx_reset_probtype ARGS((pword*,word*,int,int));
static void
_cpx_reset_probtype(pword * pw, word * pdata, int size, int flags)
{
int err;
lp_desc *lpd = ExternalData(pw[HANDLE_CPH].val.ptr);
if (!lpd)
return; /* stale handle */
if (lpd->descr_state != DESCR_EMPTY)
{
#ifdef CPLEX
switch (((untrail_ptype*) pdata)->old_ptype)
{
case PROBLEM_LP:
Call(err, CPXchgprobtype(cpx_env, lpd->lp, CPXPROB_LP));
break;
case PROBLEM_QP:
Call(err, CPXchgprobtype(cpx_env, lpd->lp, CPXPROB_QP));
break;
default:
Fprintf(Current_Error, "Eplex problem: Trying to reset an Eplex problem to a unsupported type: %i.\n",
((untrail_ptype*) pdata)->old_ptype);
ec_flush(Current_Error);
return;
}
#endif
lpd->prob_type = ((untrail_ptype*) pdata)->old_ptype;
#ifdef SOLVE_MIP_COPY
if (lpd->copystatus != XP_COPYOFF && lpd->lp != lpd->lpcopy)
{
CallN(XPRSdestroyprob(lpd->lpcopy));
CallN(lpd->lpcopy = lpd->lp);
Mark_Copy_As_Modified(lpd);
}
#endif
}
}
int
p_cpx_change_lp_to_mip(value vhandle, type thandle)
{
lp_desc *lpd;
int err;
untrail_ptype pdata;
LpDesc(vhandle.ptr[HANDLE_CPH].val, vhandle.ptr[HANDLE_CPH].tag, lpd);
pdata.old_ptype = lpd->prob_type;
/* all columns are assumed to be type 'C' by changing to MIP. Any
integer columns will be set explicitly later
*/
switch (pdata.old_ptype)
{
case PROBLEM_LP:
lpd->prob_type = PROBLEM_MIP;
Call(err, CPXchgprobtype(cpx_env, lpd->lp, CPXPROB_MILP));
break;
case PROBLEM_QP:
#ifdef HAS_MIQP
lpd->prob_type = PROBLEM_MIQP;
Call(err, CPXchgprobtype(cpx_env, lpd->lp, CPXPROB_MIQP));
#else
Fprintf(Current_Error, "Eplex error: this solver does not support solving of quadratic MIP problems.\n");
ec_flush(Current_Error);
Bip_Error(UNIMPLEMENTED);
#endif
break;
case PROBLEM_MIQP:
case PROBLEM_MIP:
return PSUCCEED;
default:
Fprintf(Current_Error, "Eplex error: trying to change problem to mixed integer from an unexpected state.\n");
ec_flush(Current_Error);
Bip_Error(RANGE_ERROR);
break;
}
if (err) { Bip_Error(EC_EXTERNAL_ERROR); }
#ifdef SOLVE_MIP_COPY
if (lpd->copystatus != XP_COPYOFF)
{
Call(err, XPRScreateprob(&lpd->lpcopy));
if (err) { Bip_Error(EC_EXTERNAL_ERROR); }
Mark_Copy_As_Modified(lpd);
}
#endif
ec_trail_undo(_cpx_reset_probtype, vhandle.ptr, NULL, (word*)&pdata, NumberOfWords(untrail_ptype), TRAILED_WORD32);
return PSUCCEED;
}
/* cplex_set_problem_type(CPH, ProbType, SetSolverType)
changes the problem type to ProbType. Used to set and reset the problem
type during probing, when the problem type might be changed temporarily.
SetSolverType applies to external solvers which has its own problem type
(currently CPLEX): it specifies if the external solver's problem type
should be set as well (1 = yes, 0 = no). CPLEX's problem type cannot
always be changed when setting a problem type before a probe, e.g.
CPXPROB_FIXEDMILP/MIQP can only be set if there is already a MILP/MIQP
solution. Therefore, in these cases, the solver's problem type is only
changed during the solving of the problem in p_cpx_optimise().
*/
int
p_cpx_set_problem_type(value vlp, type tlp, value vtype, type ttype,
value vsetsolver, type tsetsolver)
{
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(ttype);
Check_Integer(tsetsolver);
#ifdef CPLEX
if (vsetsolver.nint == 1)
{
int err;
switch (vtype.nint)
{
case PROBLEM_LP:
Call(err,CPXchgprobtype(cpx_env, lpd->lp, CPXPROB_LP));
break;
case PROBLEM_MIP:
# ifndef HAS_RELAXEDLP
if (CPXgetprobtype(cpx_env, lpd->lp) == CPXPROB_LP &&
lpd->ctype != NULL)
{
/* this assumes that we have copied the ctype information
of original MIP problem to lpd->ctype
*/
Call(err, CPXcopyctype(cpx_env, lpd->lp, lpd->ctype));
TryFree(lpd->ctype);
}
else
# endif
{
Call(err,CPXchgprobtype(cpx_env, lpd->lp, CPXPROB_MILP));
}
break;
case PROBLEM_QP:
Call(err,CPXchgprobtype(cpx_env, lpd->lp, CPXPROB_QP));
break;
# ifdef HAS_MIQP
case PROBLEM_MIQP:
if (CPXgetprobtype(cpx_env, lpd->lp) == CPXPROB_QP &&
lpd->ctype != NULL)
{
/* this assumes that we have copied the ctype information
of original MIQP problem to lpd->ctype
*/
Call(err, CPXcopyctype(cpx_env, lpd->lp, lpd->ctype));
TryFree(lpd->ctype);
}
else
{
Call(err,CPXchgprobtype(cpx_env, lpd->lp, CPXPROB_MILP));
}
break;
case PROBLEM_FIXEDQ:
Call(err, CPXchgprobtype(cpx_env, lpd->lp, CPXPROB_FIXEDMIQP));
break;
# endif
case PROBLEM_FIXEDL:
Call(err,CPXchgprobtype(cpx_env, lpd->lp, CPXPROB_FIXEDMILP));
break;
default:
Bip_Error(RANGE_ERROR);
}
if (err) Bip_Error(EC_EXTERNAL_ERROR);
}
#endif
lpd->prob_type = vtype.nint;
Succeed;
}
/*----------------------------------------------------------------------*
* Changing column type
*/
#define Get_Col_Bounds(j, lo0,hi0) { \
if (CPXgetlb(cpx_env, lpd->lp, &lo0, j, j)) \
{ Bip_Error(EC_EXTERNAL_ERROR); } \
if (CPXgetub(cpx_env, lpd->lp, &hi0, j, j)) \
{ Bip_Error(EC_EXTERNAL_ERROR); } \
}
#define Change_Col_Bound(j, Which, oldlo, oldhi, newbd, Stamp, changed) {\
untrail_bound udata; \
udata.bds[0] = oldlo; \
udata.bds[1] = oldhi; \
udata.idx = j; \
\
Log3( \
{\n\
int myj = %d;\n\
double bd = %.15e;\n\
CPXchgbds(cpx_env, lpd->lp, 1, &myj, "%s", &bd);\n\
}, j, newbd, Which \
); \
\
CPXchgbds(cpx_env, lpd->lp, 1, &j, Which, &newbd); \
changed = 1; \
ec_trail_undo(_cpx_restore_bounds, vhandle.ptr, \
Stamp, (word *) &udata, \
NumberOfWords(untrail_bound), TRAILED_WORD32); \
}
static void _cpx_restore_bounds ARGS((pword*,word*,int,int));
static void _cpx_reset_col_type ARGS((pword*,word*,int,int));
int
p_cpx_change_col_type(value vhandle, type thandle,
value vj, type tj,
value vtype, type ttype)
{
int idx[1], res;
char ctype[1];
untrail_ctype udata;
lp_desc *lpd;
#if defined(HAS_NARROW_INT_RANGE) || defined(HAS_INTLB_BUG)
double lo0, hi0;
#endif
Check_Structure(thandle);
LpDesc(vhandle.ptr[HANDLE_CPH].val, vhandle.ptr[HANDLE_CPH].tag, lpd);
Check_Integer(tj);
if (vj.nint >= lpd->mac || vj.nint < 0) { Bip_Error(RANGE_ERROR); }
SetPreSolve(lpd->presolve);
Mark_Copy_As_Modified(lpd);
idx[0] = vj.nint;
CPXupdatemodel(lpd->lp); /* before CPXget... */
res = CPXgetctype(cpx_env, lpd->lp, ctype, vj.nint, vj.nint);
if (res != 0) { Bip_Error(EC_EXTERNAL_ERROR); }
if ((char) vtype.nint != ctype[0]) {
/* only need to change if new column type different */
udata.idx = vj.nint;
udata.ctype = ctype[0];
/* if change is from B->I, just ignore it (user could have posted
extra integer constraints)
*/
if (!((char) vtype.nint == 'I' && (char) ctype[0] == 'B'))
{
ctype[0] = (char) vtype.nint;
#if defined(HAS_NARROW_INT_RANGE) || defined(HAS_INTLB_BUG)
{/* Xpress 14 likes its integers to have smaller bounds */
Get_Col_Bounds(idx[0], lo0, hi0);
# ifdef HAS_NARROW_INT_RANGE
/* no timestamp on these column bound changes: they will always
be untrailed. This is because the type changes may be
applied to multiple merged columns, and we need to
ensure that the bound change is always undone
*/
if (lo0 < -XPRS_MAXINT)
{
double intbound = -XPRS_MAXINT;
int changed; /* dummy here for the macro */
Change_Col_Bound(idx[0], "L", lo0, hi0,
intbound, NULL, changed);
lo0 = intbound; /* for HAS_INTLB_BUG below */
}
if (hi0 > XPRS_MAXINT)
{
double intbound = XPRS_MAXINT;
int changed; /* dummy here for the macro */
Change_Col_Bound(idx[0], "U", lo0, hi0,
intbound, NULL, changed);
}
# endif
}
#endif
res = CPXchgctype(cpx_env, lpd->lp, 1, idx, ctype);
Log2(
{int idx[1];
char ctype[1];
idx[0] = %d;
ctype[0] = '%c';
CPXchgctype(cpx_env,lpd->lp,1, idx, ctype);
}, idx[0], ctype[0]);
#ifdef HAS_INTLB_BUG
/* After changing a column type to integer, the lower bound is
lost (set to 0) if it was negative (Xpress 13-15)
Reported to Dash 2004-10-19
*/
{
char btype[1];
double lo1[1];
btype[0] = 'L';
lo1[0] = lo0;
XPRSchgbounds(lpd->lp, 1, idx, btype, lo1);
}
Log2({\n\
int myj = %d;\n\
double bd = %.15e;\n\
XPRSchgbounds(lpd->lp, 1, &myj, "L", &bd);\n\
}, idx[0], lo0);
#endif
if (res != 0) { Bip_Error(EC_EXTERNAL_ERROR); }
ec_trail_undo(_cpx_reset_col_type, vhandle.ptr, NULL, (word*)&udata, NumberOfWords(untrail_ctype), TRAILED_WORD32);
}
}
Succeed;
}
static void _cpx_reset_col_type(pword * phandle, word * udata, int size, int flags)
{
int idx[1];
char octype[1];
lp_desc *lpd = ExternalData(phandle[HANDLE_CPH].val.ptr);
if (!lpd)
return; /* stale handle */
idx[0] = ((untrail_ctype*) udata)->idx;
octype[0] = ((untrail_ctype*) udata)->ctype;
#if 0
Fprintf(Current_Error, "Resetting col %d to %c, in gc:%d\n",
idx[0], octype[0], ec_.m.vm_flags & NO_EXIT);
ec_flush(Current_Error);
#endif
if (lpd->descr_state != DESCR_EMPTY)
{
Log2(
{int idx[1];\n\
char octype[1];\n\
idx[0] = %d;\n\
octype[0] = '%c';\n\
CPXchgctype(cpx_env,lpd->lp,1, idx, octype);\n\
}, idx[0], octype[0]);
if (CPXchgctype(cpx_env, lpd->lp, 1, idx, octype))
{
Fprintf(Current_Error, "Error in Changing column %d to type %c\n",
idx[0], octype[0]);
ec_flush(Current_Error);
return;
}
Mark_Copy_As_Modified(lpd);
}
}
/*----------------------------------------------------------------------*
* Adding constraints
*----------------------------------------------------------------------*/
/*
* We first collect the new row/col data in (growable) arrays using
* p_cpx_set_matbeg(), p_cpx_set_matval() and p_cpx_set_obj_coeff() [cols]
* p_cpx_new_row() and p_cpx_add_coeff() [rows].
* Then, the information is transferred to the solver (and trailed)
* by calling p_cpx_flush_new_rowcols().
* On failure, the constraints get removed by _cpx_del_rowcols().
*
* added by AE 25/10/02
* this is for adding rows whose index in the external
* solver we want to know for sure - when we get duals
* in colgen we really have to know we are getting the right
* ones associated with the sp cost function vars
* this requires all variables to have their index already in the attribute
*/
#define New_Row(nrs, nr_sz, senx, rhsx, rmatbeg, nnz, sense, vrhs, trhs, ExtraAlloc) {\
if (nrs+1 >= nr_sz) /* allocate/grow arrays */\
{\
CallN(nr_sz += NEWROW_INCR);\
CallN(senx = (char *) Realloc(senx, nr_sz*sizeof(char)));\
CallN(rhsx = (double *) Realloc(rhsx, nr_sz*sizeof(double)));\
CallN(rmatbeg = (int *) Realloc(rmatbeg, nr_sz*sizeof(int)));\
ExtraAlloc; \
}\
senx[nrs] = (char) sense;\
rhsx[nrs] = DoubleVal(vrhs, trhs);\
Check_Constant_Range(rhsx[nrs]);\
rmatbeg[nrs] = nnz;\
++nrs;\
}
int
p_cpx_new_row(value vlp, type tlp, value vsense, type tsense,
value vrhs, type trhs, value vgtype, type tgtype,
value vidx, type tidx)
{
lp_desc *lpd;
int idx, sense;
LpDescOnly(vlp, tlp, lpd);
Check_Number(trhs);
Check_Integer(tgtype);
Check_Atom(tsense);
if (vsense.did == d_le) sense = SOLVER_SENSE_LE;
else if (vsense.did == d_ge) sense = SOLVER_SENSE_GE;
else if (vsense.did == d_eq) sense = SOLVER_SENSE_EQ;
else { Bip_Error(RANGE_ERROR); }
switch (vgtype.nint)
{
case CSTR_TYPE_NORM:
idx = lpd->mar+lpd->nr;
New_Row(lpd->nr, lpd->nr_sz, lpd->senx, lpd->rhsx, lpd->rmatbeg,
lpd->nnz, sense, vrhs, trhs, {});
break;
/*
case CSTR_TYPE_PERMCP:
idx = lpd->cp_nr;
New_Row(lpd->cp_nr, lpd->cp_nr_sz, lpd->cp_senx, lpd->cp_rhsx,
lpd->cp_rmatbeg, lpd->cp_nnz, sense, vrhs, trhs, {});
break;
*/
case CSTR_TYPE_CONDCP:
idx = lpd->cp_nr2;
New_Row(lpd->cp_nr2, lpd->cp_nr_sz2, lpd->cp_senx2, lpd->cp_rhsx2,
lpd->cp_rmatbeg2, lpd->cp_nnz2, sense, vrhs, trhs,
{CallN(lpd->cp_active2 = (char *) Realloc(lpd->cp_active2, lpd->cp_nr_sz2*sizeof(char)));
CallN(lpd->cp_initial_add2 = (char *) Realloc(lpd->cp_initial_add2, lpd->cp_nr_sz2*sizeof(char)));
});
break;
default:
Bip_Error(RANGE_ERROR);
break;
}
Return_Unify_Integer(vidx, tidx, idx);
}
int
p_cpx_new_row_idc(value vlp, type tlp, value vsense, type tsense,
value vrhs, type trhs, value vcompl, type tcompl,
value vindind, type tindind)
{
int sense;
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
Check_Number(trhs);
Check_Integer(tcompl);
Check_Integer(tindind);
Check_Atom(tsense);
if (vsense.did == d_le) sense = SOLVER_SENSE_LE;
else if (vsense.did == d_ge) sense = SOLVER_SENSE_GE;
else if (vsense.did == d_eq) sense = SOLVER_SENSE_EQ;
else { Bip_Error(RANGE_ERROR); }
if (lpd->nr+1 >= lpd->nr_sz) /* allocate/grow arrays */
{
CallN(lpd->nr_sz += NEWROW_INCR);
CallN(lpd->senx = (char *) Realloc(lpd->senx, lpd->nr_sz*sizeof(char)));
CallN(lpd->rhsx = (double *) Realloc(lpd->rhsx, lpd->nr_sz*sizeof(double)));
CallN(lpd->rmatbeg = (int *) Realloc(lpd->rmatbeg, lpd->nr_sz*sizeof(int)));
CallN(lpd->rcompl = (char *) Realloc(lpd->rcompl, lpd->nr_sz*sizeof(char)));
CallN(lpd->rindind = (int *) Realloc(lpd->rindind, lpd->nr_sz*sizeof(int)));
} else if (!lpd->rcompl) {
/* Only used for IDC, may not be allocated yet */
CallN(lpd->rcompl = (char *) Malloc(lpd->nr_sz*sizeof(char)));
CallN(lpd->rindind = (int *) Malloc(lpd->nr_sz*sizeof(int)));
}
lpd->senx[lpd->nr] = (char) sense;
lpd->rhsx[lpd->nr] = DoubleVal(vrhs, trhs);
Check_Constant_Range(lpd->rhsx[lpd->nr]);
lpd->rmatbeg[lpd->nr] = lpd->nnz;
lpd->rcompl[lpd->nr] = vcompl.nint; /* complement flag */
lpd->rindind[lpd->nr] = vindind.nint; /* indicator variable index */
++lpd->nr;
Succeed;
}
#define Add_Row_Coeff(nnz_sz, nnzs, rmatind, rmatval, idxj, val, tag) {\
if (nnzs >= nnz_sz) /* allocate/grow arrays */\
{\
CallN(nnz_sz += NEWNZ_INCR);\
CallN(rmatind = (int *) Realloc(rmatind, nnz_sz*sizeof(int)));\
CallN(rmatval = (double *) Realloc(rmatval, nnz_sz*sizeof(double)));\
}\
if (idxj >= lpd->mac) { Bip_Error(RANGE_ERROR); }\
rmatind[nnzs] = idxj;\
rmatval[nnzs] = DoubleVal(val, tag);\
Check_Constant_Range(rmatval[nnzs]);\
++nnzs;\
}
int
p_cpx_add_coeff(value vlp, type tlp, value vj, type tj, value v, type t, value vpool, type tpool)
{
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(tj);
Check_Number(t);
Check_Integer(tpool);
switch (vpool.nint)
{
case CSTR_TYPE_NORM:
Add_Row_Coeff(lpd->nnz_sz, lpd->nnz, lpd->rmatind, lpd->rmatval, vj.nint, v, t);
break;
/*
case CSTR_TYPE_PERMCP:
Add_Row_Coeff(lpd->cp_nz_sz, lpd->cp_nnz, lpd->cp_rmatind, lpd->cp_rmatval, vj.nint, v, t);
break;
*/
case CSTR_TYPE_CONDCP:
Add_Row_Coeff(lpd->cp_nz_sz2, lpd->cp_nnz2, lpd->cp_rmatind2, lpd->cp_rmatval2, vj.nint, v, t);
break;
default:
Bip_Error(RANGE_ERROR);
break;
}
Succeed;
}
static void
_grow_numbers_array(lp_desc * lpd, int m) /* make sure array contains 0..m-1 */
{
if (m > lpd->numsz) /* grow auxiliary array if necessary */
{
int i = lpd->numsz;
m = Max(m, i+NEWCOL_INCR);
lpd->numsz = m;
# ifdef LOG_CALLS
if (i == 0)
Fprintf(log_output_, "\n\
lpd->numbers = (int *) malloc(%d*sizeof(int));\n\
lpd->zeroes = (int *) malloc(%d*sizeof(int));\n\
lpd->dzeroes = (double *) malloc(%d*sizeof(double));", m, m, m);
else
Fprintf(log_output_, "\n\
lpd->numbers = (int *) realloc(lpd->numbers, %d*sizeof(int));\n\
lpd->zeroes = (int *) realloc(lpd->zeroes, %d*sizeof(int));\n\
lpd->dzeroes = (int *) realloc(lpd->dzeroes, %d*sizeof(double));", m, m, m);
Fprintf(log_output_, "\n\
{ int i; for (i=%d; i<%d; i++)\n\
{ lpd->numbers[i] = i; lpd->zeroes[i] = 0; lpd->dzeroes[i] = 0.0; } }", i, m);
# endif
if (i == 0) {
lpd->numbers = (int *) Malloc(m*sizeof(int));
lpd->zeroes = (int *) Malloc(m*sizeof(int));
lpd->dzeroes = (double *) Malloc(m*sizeof(double));
} else {
lpd->numbers = (int *) Realloc(lpd->numbers, m*sizeof(int));
lpd->zeroes = (int *) Realloc(lpd->zeroes, m*sizeof(int));
lpd->dzeroes = (double *) Realloc(lpd->dzeroes, m*sizeof(double));
}
for (; i < m; i++) {
lpd->numbers[i] = i;
lpd->zeroes[i] = 0;
lpd->dzeroes[i] = 0.0;
}
}
}
static void _cpx_restore_bounds(pword * phandle, word * udata, int size, int undo_context)
{
lp_desc *lpd = ExternalData(phandle[HANDLE_CPH].val.ptr);
if (!lpd)
return; /* stale handle */
if (lpd->descr_state != DESCR_EMPTY)
{
/* lp has not been cleaned up */
int idx[2];
int res;
untrail_bound adata; /* needed to ensure proper alignment */
memcpy(&adata, udata, sizeof(untrail_bound));
idx[0] = adata.idx;
idx[1] = adata.idx;
Log4(
{
int idx[2];
double bds[2];
idx[0] = %d;
idx[1] = %d;
bds[0] = %.15e;
bds[1] = %.15e;
CPXchgbds(cpx_env, lpd->lp, 2, idx, "LU", bds);
}, idx[0], idx[1], adata.bds[0], adata.bds[1]
);
res = CPXchgbds(cpx_env, lpd->lp, 2, idx, "LU", adata.bds);
if (res != 0)
{
Fprintf(Current_Error, "Eplex external solver error while trying to restore bounds.to column %d\n", idx[0]);
ec_flush(Current_Error);
}
}
}
static void
reset_sos(lp_desc * lpd, int oldsos)
{
if (lpd->nsos_added > oldsos)
{
if (cpx_delsos(lpd, oldsos, lpd->nsos_added))
{
Fprintf(Current_Error, "Error in deleting SOSs %d..%d\n",
oldsos, lpd->nsos_added);
ec_flush(Current_Error);
}
lpd->nsos = lpd->nsos_added = oldsos;
}
}
static void
reset_idc(lp_desc * lpd, int oldidc)
{
#ifdef HAS_INDICATOR_CONSTRAINTS
if (lpd->nidc > oldidc)
{
if (CPXdelindconstrs(cpx_env, lpd->lp, oldidc, lpd->nidc-1))
{
Fprintf(Current_Error, "Error in deleting indicator constraints %d..%d\n",
oldidc, lpd->nidc-1);
ec_flush(Current_Error);
}
lpd->nidc = oldidc;
}
#endif
}
static void
reset_rowcols(lp_desc * lpd, int oldmar, int oldmac)
{
#ifdef CPLEX
if (lpd->mar > oldmar)
{
Log2(CPXdelrows(cpx_env, lpd->lp, %d, %d), oldmar, lpd->mar-1);
if (CPXdelrows(cpx_env, lpd->lp, oldmar, lpd->mar-1))
{
Fprintf(Current_Error, "Error in CPXdelrows(%d..%d)\n",
oldmar, lpd->mar-1);
ec_flush(Current_Error);
}
lpd->mar = oldmar;
}
if (lpd->macadded > oldmac)
{
Log2(CPXdelcols(cpx_env, lpd->lp, %d, %d), oldmac, lpd->macadded-1);
if (CPXdelcols(cpx_env, lpd->lp, oldmac, lpd->macadded-1))
{
Fprintf(Current_Error, "Error in CPXdelcols(%d..%d)\n",
oldmac, lpd->macadded-1);
ec_flush(Current_Error);
}
lpd->macadded = oldmac;
}
#else
int ndr = lpd->mar - oldmar;
int ndc = lpd->macadded - oldmac;
int m = Max(lpd->mar,lpd->macadded);
_grow_numbers_array(lpd, m); /* if necessary */
if (ndr > 0)
{
Log2(XPRSdelrows(lpd->lp,%d, &lpd->numbers[%d]), ndr,oldmar);
if (XPRSdelrows(lpd->lp, ndr, &lpd->numbers[oldmar]))
{
Fprintf(Current_Error, "Error in deleting rows %d..%d\n",
oldmar, oldmar+ndr-1);
ec_flush(Current_Error);
}
lpd->mar = oldmar;
}
if (ndc > 0)
{
Log2(XPRSdelcols(lpd->lp,%d, &lpd->numbers[%d]), ndc,oldmac);
if (XPRSdelcols(lpd->lp, ndc, &lpd->numbers[oldmac]))
{
Fprintf(Current_Error, "Error in deleting cols %d..%d\n",
oldmac, oldmac+ndc-1);
ec_flush(Current_Error);
}
lpd->macadded = oldmac;
}
#endif
lpd->mac = lpd->macadded;
Mark_Copy_As_Modified(lpd);
}
static void _cpx_del_rowcols(pword * phandle,word * udata, int size, int flags)
{
lp_desc *lpd = ExternalData(phandle[HANDLE_CPH].val.ptr);
int oldmar = ((untrail_data*) udata)->oldmar,
oldmac = ((untrail_data*) udata)->oldmac,
oldsos = ((untrail_data*) udata)->oldsos,
oldidc = ((untrail_data*) udata)->oldidc;
if (lpd && lpd->descr_state != DESCR_EMPTY)
{
#if 0
Fprintf(Current_Error,
"Removing rows %d..%d, cols %d..%d, soss %d..%d, idcs %d..%d, in gc:%d\n",
oldmar, lpd->mar-1, oldmac, lpd->macadded-1,
oldsos, lpd->nsos_added, oldidc, lpd->nidc,
ec_.m.vm_flags & NO_EXIT);
ec_flush(Current_Error);
#endif
reset_idc(lpd, oldidc);
reset_sos(lpd, oldsos);
reset_rowcols(lpd, oldmar, oldmac);
}
}
/*
* flush_new_rowcols(+Handle, +HasObjCoeffs) expects the following input:
*
* lpd->mac new column count (>= macadded, those already added)
* lpd->objx objective coefficients for new vars only (if HasObjCoeffs)
* lpd->matnz number of nonzero coefficients for new vars in old constraints
* lpd->matxxx those nonzero coefficients
* lpd->ctype types for new vars only
*
* lpd->nr number of rows to add
* lpd->senx row senses
* lpd->rhsx row RHSs
* lpd->nnz number of nonzero coefficients to add
* lpd->rmatxxx those nonzero coefficients
*
* We may add only columns or only rows.
*/
/* newcolobjs == 1 if non-zero objective coeffs are to be added */
int
p_cpx_flush_new_rowcols(value vhandle, type thandle, value vnewcolobjs, type tnewcolobjs)
{
lp_desc *lpd;
int res, coladded, rowadded, nzadded;
Check_Structure(thandle);
LpDesc(vhandle.ptr[HANDLE_CPH].val, vhandle.ptr[HANDLE_CPH].tag, lpd);
Check_Integer(tnewcolobjs);
coladded = lpd->mac - lpd->macadded;
rowadded = lpd->nr;
nzadded = lpd->nnz;
/***
Fprintf(Current_Error, "Adding rows %d..%d, cols %d..%d\n",
lpd->mar, lpd->mar+rowadded-1,
lpd->mac, lpd->mac+coladded-1);
ec_flush(Current_Error);
***/
SetPreSolve(lpd->presolve);
Mark_Copy_As_Modified(lpd);
#ifdef LOG_CALLS
{
int i;
Fprintf(log_output_, "\n\
lpd->nr = %d;", lpd->nr);
Fprintf(log_output_, "\n\
lpd->matnz = %d;", lpd->matnz);
/* needed by OSI */
Fprintf(log_output_, "\n\
lpd->mac = %d;", lpd->mac);
if (vnewcolobjs.nint)
{
for (i=0; i<coladded; ++i)
{
Fprintf(log_output_, "\n\
lpd->objx[%d] = %.15e;", i, lpd->objx[i]);
}
}
for (i=0; i<coladded; ++i)
{
Fprintf(log_output_, "\n\
lpd->bdl[%d] = %.15e;\n\
lpd->bdu[%d] = %.15e;", i, lpd->bdl[i], i, lpd->bdu[i]);
}
for (i=0; i<lpd->matnz; ++i)
{
Fprintf(log_output_, "\n\
lpd->matind[%d] = %d;\n\
lpd->matval[%d] = %.15e;", i, lpd->matind[i], i, lpd->matval[i]);
}
if (lpd->matnz > 0)
{
for (i=0; i<coladded; ++i)
{
Fprintf(log_output_, "\n\
lpd->matbeg[%d] = %d;", i, lpd->matbeg[i]);
}
}
for (i=0; i<lpd->nr; ++i)
{
Fprintf(log_output_, "\n\
lpd->senx[%d] = '%c';\n\
lpd->rhsx[%d] = %.15e;\n\
lpd->rmatbeg[%d] = %d;",
i, lpd->senx[i], i, lpd->rhsx[i], i, lpd->rmatbeg[i]);
}
Fprintf(log_output_, "\n\
lpd->nnz = %d;", lpd->nnz);
for (i=0; i<lpd->nnz; ++i)
{
Fprintf(log_output_, "\n\
lpd->rmatind[%d] = %d;\n\
lpd->rmatval[%d] = %.15e;",
i, lpd->rmatind[i], i, lpd->rmatval[i]);
}
}
#endif
if (coladded)
{
_grow_numbers_array(lpd, coladded+1); /* for zeroes[] */
Log2(CPXaddcols(cpx_env, lpd->lp, %d, lpd->matnz,
%s, (lpd->matnz ? lpd->matbeg : lpd->zeroes),
lpd->matind, lpd->matval, lpd->bdl, lpd->bdu, NULL),
coladded, (vnewcolobjs.nint ? "lpd->objx" : "lpd->dzeroes"));
res = CPXaddcols(cpx_env, lpd->lp, coladded, lpd->matnz,
(vnewcolobjs.nint ? lpd->objx : lpd->dzeroes),
(lpd->matnz ? lpd->matbeg : lpd->zeroes),
lpd->matind, lpd->matval, lpd->bdl, lpd->bdu, NULL);
TryFree(lpd->objx);
TryFree(lpd->matbeg);
TryFree(lpd->matind);
TryFree(lpd->matval);
lpd->matnz = 0;
if (lpd->dirtybdflag & 3)
{
if (lpd->dirtybdflag & 1) TryFree(lpd->bdl);
if (lpd->dirtybdflag & 2) TryFree(lpd->bdu);
lpd->dirtybdflag = 0;
}
if (IsMIPProb(lpd->prob_type) && res == 0)
{
int i, colidx;
if (lpd->qgtype) CallN(Free(lpd->qgtype));
lpd->qgtype = NULL;
if (lpd->mgcols) CallN(Free(lpd->mgcols));
lpd->mgcols = Malloc(coladded*sizeof(int));
Log1(lpd->mgcols = (int *) malloc(%d*sizeof(int)), coladded);
/* we reuse mgcols for the index of the added columns. We set the
type for all columns, as Dash does not specify what types
columns are set to in XPRSaddcols().
*/
for ((i=0, colidx=lpd->macadded); i < coladded; (i++, colidx++))
{
lpd->mgcols[i] = colidx;
Log2(lpd->mgcols[%d] = %d, i, colidx);
Log2(lpd->ctype[%d] = %d, i, lpd->ctype[i]);
}
CPXupdatemodel(lpd->lp); /* columns must be added before type can be set */
Log1(CPXchgctype(cpx_env, lpd->lp, %d, lpd->mgcols, lpd->ctype),
coladded);
res = CPXchgctype(cpx_env, lpd->lp, coladded,
lpd->mgcols, lpd->ctype);
}
if (res != 0) { Bip_Error(EC_EXTERNAL_ERROR); }
}
CPXupdatemodel(lpd->lp); /* columns must be added before rows can be created */
if (rowadded)
{
Log2(CPXaddrows(cpx_env, lpd->lp, 0, %d, %d, lpd->rhsx, lpd->senx,
lpd->rmatbeg, lpd->rmatind, lpd->rmatval, NULL, NULL),
rowadded, nzadded);
res = CPXaddrows(cpx_env, lpd->lp, 0, rowadded, nzadded,
lpd->rhsx, lpd->senx, lpd->rmatbeg, lpd->rmatind,
lpd->rmatval, NULL, NULL);
if (res != 0) { Bip_Error(EC_EXTERNAL_ERROR); }
}
if (coladded || rowadded)
{
untrail_data udata;
udata.oldmac = lpd->macadded;
udata.oldmar = lpd->mar;
udata.oldsos = lpd->nsos_added;
udata.oldidc = lpd->nidc;
ec_trail_undo(_cpx_del_rowcols, vhandle.ptr, vhandle.ptr+HANDLE_STAMP, (word*) &udata, NumberOfWords(untrail_data), TRAILED_WORD32);
}
lpd->macadded = lpd->mac; /* remember what we added */
lpd->mar += rowadded;
lpd->nr = lpd->nnz = 0; /* maybe shrink arrays here */
Succeed;
}
/*
* Add Indicator Constraints from descriptor arrays to solver
* Input:
* lpd->nr number of indicator rows to add
* lpd->senx row senses
* lpd->rhsx row RHSs
* lpd->nnz number of nonzero coefficients to add
* lpd->rmatxxx those nonzero coefficients
* lpd->rcompl the complement flags
* lpd->rindind the indicator variable indexes
*/
int
p_cpx_flush_idcs(value vhandle, type thandle)
{
#ifdef HAS_INDICATOR_CONSTRAINTS
int i;
lp_desc *lpd;
untrail_data udata;
Check_Structure(thandle);
LpDesc(vhandle.ptr[HANDLE_CPH].val, vhandle.ptr[HANDLE_CPH].tag, lpd);
if (lpd->nr == 0)
Succeed;
/* trail first, in case we abort during adding */
udata.oldmac = lpd->macadded;
udata.oldmar = lpd->mar;
udata.oldsos = lpd->nsos_added;
udata.oldidc = lpd->nidc;
ec_trail_undo(_cpx_del_rowcols, vhandle.ptr, vhandle.ptr+HANDLE_STAMP, (word*) &udata, NumberOfWords(untrail_data), TRAILED_WORD32);
lpd->rmatbeg[lpd->nr] = lpd->nnz;
for(i=0; lpd->nr>0; --lpd->nr,++i)
{
#if 0
int k;
Fprintf(Current_Error, "CPXaddindconstr(%d,%d,%d,%f,%d,...,...)\n",
lpd->rindind[i], lpd->rcompl[i],
lpd->rmatbeg[i+1]-lpd->rmatbeg[i], /* nzcnt */
lpd->rhsx[i], lpd->senx[i]);
for(k=lpd->rmatbeg[i];k<lpd->rmatbeg[i+1];++k) {
Fprintf(Current_Error, "%d:%f, ", lpd->rmatind[k], lpd->rmatval[k]);
}
(void) ec_newline(Current_Error);
(void) ec_flush(Current_Error);
#endif
if (CPXaddindconstr(cpx_env, lpd->lp, lpd->rindind[i], lpd->rcompl[i],
lpd->rmatbeg[i+1]-lpd->rmatbeg[i], /* nzcnt */
lpd->rhsx[i], lpd->senx[i],
lpd->rmatind+lpd->rmatbeg[i], lpd->rmatval+lpd->rmatbeg[i],
NULL))
{
Bip_Error(EC_EXTERNAL_ERROR);
}
++lpd->nidc;
}
/* could free/resize arrays here */
Succeed;
#else
Bip_Error(UNIMPLEMENTED);
#endif
}
/*----------------------------------------------------------------------*
* Updating variable bounds
*----------------------------------------------------------------------*/
/* the *impose* procedures are for columns that have been added to the
external solver already.
*/
int
p_cpx_impose_col_lwb(value vhandle, type thandle,
value vatt, type tatt,
value vj, type tj,
value vlo, type tlo,
value vchanged, type tchanged)
{
lp_desc *lpd;
double lo0, hi0, newlo;
int j, changed = 0;
Check_Integer(tj);
Check_Float(tlo);
LpDesc(vhandle.ptr[HANDLE_CPH].val, vhandle.ptr[HANDLE_CPH].tag, lpd);
if (lpd->descr_state == DESCR_EMPTY)
{
Fprintf(Current_Error, "Eplex error: empty handle\n");
(void) ec_flush(Current_Error);
Bip_Error(EC_EXTERNAL_ERROR);
}
j = (int) vj.nint;
if (j >= lpd->macadded) { Bip_Error(RANGE_ERROR); }
if ((newlo = Dbl(vlo)) < -CPX_INFBOUND) newlo = -CPX_INFBOUND;
CPXupdatemodel(lpd->lp); /* make sure bounds are up-to-date */
Get_Col_Bounds(j, lo0, hi0);
if (newlo > hi0)
{
double ftol;
Get_Feasibility_Tolerance(cpx_env, lpd, &ftol);
if (newlo <= hi0 + ftol) newlo = hi0;
else { Fail; }
}
if (lo0 < newlo)
{
Change_Col_Bound(j, "L", lo0, hi0, newlo, vatt.ptr+COL_STAMP, changed);
}
Return_Unify_Integer(vchanged, tchanged, changed);
}
int
p_cpx_impose_col_upb(value vhandle, type thandle,
value vatt, type tatt,
value vj, type tj,
value vhi, type thi,
value vchanged, type tchanged)
{
lp_desc *lpd;
double lo0, hi0, newhi;
int j, changed = 0;
LpDesc(vhandle.ptr[HANDLE_CPH].val, vhandle.ptr[HANDLE_CPH].tag, lpd);
Check_Integer(tj);
Check_Float(thi);
if (lpd->descr_state == DESCR_EMPTY)
{
Fprintf(Current_Error, "Eplex error: empty handle\n");
(void) ec_flush(Current_Error);
Bip_Error(EC_EXTERNAL_ERROR);
}
j = (int) vj.nint;
if (j >= lpd->macadded) { Bip_Error(RANGE_ERROR); }
if ((newhi = Dbl(vhi)) > CPX_INFBOUND) newhi = CPX_INFBOUND;
CPXupdatemodel(lpd->lp); /* make sure bounds are up-to-date */
Get_Col_Bounds(j, lo0, hi0);
if (newhi < lo0)
{
double ftol;
Get_Feasibility_Tolerance(cpx_env, lpd, &ftol);
if (newhi >= lo0 - ftol) newhi = lo0;
else { Fail; }
}
if (hi0 > newhi)
{
Change_Col_Bound(j, "U", lo0, hi0, newhi, vatt.ptr+COL_STAMP, changed);
}
Return_Unify_Integer(vchanged, tchanged, changed);
}
int
p_cpx_impose_col_bounds(value vhandle, type thandle,
value vatt, type tatt,
value vj, type tj,
value vflag, type tflag,
value vlo, type tlo,
value vhi, type thi,
value vchanged, type tchanged)
{
lp_desc *lpd;
double lo0, hi0, newlo, newhi;
int res, j, flag, changed = 0;
char ctype[1];
Check_Integer(tj);
Check_Integer(tflag);
Check_Float(thi);
Check_Float(tlo);
LpDesc(vhandle.ptr[HANDLE_CPH].val, vhandle.ptr[HANDLE_CPH].tag, lpd);
if (lpd->descr_state == DESCR_EMPTY)
{
Fprintf(Current_Error, "Eplex error: empty handle\n");
(void) ec_flush(Current_Error);
Bip_Error(EC_EXTERNAL_ERROR);
}
CPXupdatemodel(lpd->lp); /* make sure types and bounds are up-to-date */
j = (int) vj.nint;
if (j >= lpd->macadded || j < 0) { Bip_Error(RANGE_ERROR); }
if ((newhi = Dbl(vhi)) > CPX_INFBOUND) newhi = CPX_INFBOUND;
if ((newlo = Dbl(vlo)) < -CPX_INFBOUND) newlo = -CPX_INFBOUND;
flag = (int) vflag.nint;
if (flag == 0) {
/* flag == 0 ==> we can widen the bound. Check to make sure that the new
bounds are not too wide, i.e. invalid for the column type
*/
switch (lpd->prob_type)
{
case PROBLEM_MIP:
case PROBLEM_MIQP:
res = CPXgetctype(cpx_env, lpd->lp, ctype, vj.nint, vj.nint);
if (res != 0) { Bip_Error(EC_EXTERNAL_ERROR); }
if (ctype[0] == 'B' && (newhi > 1 || newhi < 0 || newlo > 1 || newlo < 0))
{ Bip_Error(RANGE_ERROR); }
#ifdef HAS_NARROW_INT_RANGE
if (ctype[0] == 'I' && (newhi > XPRS_MAXINT || newhi < -XPRS_MAXINT || newlo > XPRS_MAXINT || newlo < -XPRS_MAXINT))
{ Bip_Error(RANGE_ERROR); }
#endif
default:
break;
}
}
Get_Col_Bounds(j, lo0, hi0);
if (newhi < newlo) { Fail; }
if (flag && (newhi < lo0))
{
double ftol;
/* if new bound outside but within tolerance of old bound, ignore change */
Get_Feasibility_Tolerance(cpx_env, lpd, &ftol);
if (newhi >= lo0 - ftol)
{
newhi = lo0;
if (newlo > newhi) newlo = lo0; /* make sure other bound is consistent! */
}
else
{
Fail;
}
}
if (flag && (newlo > hi0))
{
double ftol;
Get_Feasibility_Tolerance(cpx_env, lpd, &ftol);
if (newlo <= hi0 + ftol)
{
newlo = hi0;
if (newhi < newlo) newhi = hi0;
} else
{
Fail;
}
}
if (newhi == newlo)
{
if (newhi != hi0 || newhi != lo0)
Change_Col_Bound(j, "B", lo0, hi0, newlo, vatt.ptr+COL_STAMP,
changed);
}
else
{
if (newhi < hi0 || (!flag && newhi > hi0)) Change_Col_Bound(j, "U", lo0, hi0, newhi,
vatt.ptr+COL_STAMP, changed);
if (newlo > lo0 || (!flag && newlo < lo0)) Change_Col_Bound(j, "L", lo0, hi0, newlo,
vatt.ptr+COL_STAMP, changed);
}
Return_Unify_Integer(vchanged, tchanged, changed);
}
int
p_cpx_get_col_bounds(value vlp, type tlp,
value vj, type tj,
value vlo, type tlo,
value vhi, type thi)
{
Prepare_Requests
lp_desc *lpd;
double lo, hi;
int j;
LpDesc(vlp, tlp, lpd);
Check_Integer(tj);
j = vj.nint;
if (lpd->descr_state == DESCR_EMPTY)
{
Fprintf(Current_Error, "Eplex error: empty handle\n");
(void) ec_flush(Current_Error);
Bip_Error(EC_EXTERNAL_ERROR);
}
if (lpd->lp == NULL)
{/* solver not created for problem yet, get bounds from arrays */
Request_Unify_Float(vhi, thi, lpd->bdu[j]);
Request_Unify_Float(vlo, tlo, lpd->bdl[j]);
Return_Unify;
}
else if (j >= lpd->mac || j < 0)
{/* invalid column index */
Bip_Error(RANGE_ERROR);
}
else if (j >= lpd->macadded)
{/* column not yet added to solver, get bounds from arrays */
j -= lpd->macadded; /* arrays are for new added columns only */
Request_Unify_Float(vhi, thi, lpd->bdu[j]);
Request_Unify_Float(vlo, tlo, lpd->bdl[j]);
Return_Unify;
}
else
{
CPXupdatemodel(lpd->lp); /* before CPXget... */
if (CPXgetub(cpx_env, lpd->lp, &hi, (int) vj.nint, (int) vj.nint))
{
Bip_Error(EC_EXTERNAL_ERROR);
}
if (CPXgetlb(cpx_env, lpd->lp, &lo, (int) vj.nint, (int) vj.nint))
{
Bip_Error(EC_EXTERNAL_ERROR);
}
Request_Unify_Float(vhi, thi, hi);
Request_Unify_Float(vlo, tlo, lo);
Return_Unify;
}
}
/*
* cplex_set_new_cols(CPH, AddedCols, NewObjCoeffs, NewLos, NewHis, NonZeros)
*
* Sets the following fields:
* lpd->mac +AddedCold
* lpd->matnz +NonZeros
* lpd->matxxx get resized for AddedCols and NonZeros
* lpd->ctype resized to AddedCols only and initialised to 'C'
* lpd->bdl/bdu resized to AddedCols or maczs?? and filled
* lpd->objx resized to AddedCols, if NewObjCoeffs given
*/
int
p_cpx_set_new_cols(value vlp, type tlp, value vadded, type tadded, value vobjs, type tobjs, value vlos, type tlos, value vhis, type this, value vnzs, type tnzs)
{
/* the column `buffer arrays' are needed by CPLEX and Xpress's interface
to pass information for the columns. Except for ctype
and possibly bdl, bdu, we simpy pass
default values to the solver on setup/adding columns
*/
lp_desc *lpd;
int i;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(tadded);
Check_Integer(tnzs);
if (vadded.nint == 0) { Succeed; } /* no added columns, return now! */
lpd->mac += vadded.nint;
lpd->matnz = vnzs.nint;
TryFree(lpd->matind);
TryFree(lpd->matval);
if (vnzs.nint > 0)
{
lpd->matind = (int *) Malloc((size_t) vnzs.nint*sizeof(int));
lpd->matval = (double *) Malloc((size_t) vnzs.nint*sizeof(double));
Log1(lpd->matind = (int *) malloc((size_t) %d*sizeof(int)), vnzs.nint);
Log1(lpd->matval = (double *) Malloc((size_t) %d*sizeof(double)), vnzs.nint);
}
TryFree(lpd->ctype);
TryFree(lpd->matbeg);
TryFree(lpd->matcnt);
lpd->ctype = (char *) Malloc((size_t) vadded.nint*sizeof(char));
/* +1 for matbeg required by COIN */
lpd->matbeg = (int *) Malloc((size_t) (vadded.nint+1)*sizeof(int));
lpd->matcnt = (int *) Malloc((size_t) vadded.nint*sizeof(int));
Log3({\n\
lpd->ctype = (char *) Malloc((size_t) %d*sizeof(char));\n\
lpd->matbeg = (int *) Malloc((size_t) %d*sizeof(int));\n\
lpd->matcnt = (int *) Malloc((size_t) %d*sizeof(int));\n\
}, vadded.nint, vadded.nint, vadded.nint);
for (i=0; i<vadded.nint; i++) lpd->ctype[i] = 'C';
/* treatment of bounds arrays lpd->bdl, lpd->bdu:
if columns with non-default bounds were added immediately previously
the bounds arrays will have been freed in p_cpx_flush_new_rowcols so
any existing bounds arrays contain default values and are length lpd->macsz
1) if vadded.nint > lpd->macsz any existing arrays are too small:
a) if we have non-default bounds to apply we free any existing array
and Malloc a new one of correct size vadded.nint since Realloc may
have to copy the contents of the existing array and free it and we
need to overwrite the entries again anyway
b) if we have default bounds to apply we just expand the existing array
with Realloc and initialize the new positions
2) otherwise any existing arrays are big enough:
a) if we have non-default bounds to apply we overwrite the necessary entries
b) if we have default bounds to apply we have nothing to do
if we have non-default bounds we set the appropriate bit of the lpd->dirtybdflag
so that the arrays can be freed in p_cpx_flush_new_rowcols
*/
if (vadded.nint > lpd->macsz) /* any existing bound arrays are too small */
{
if (IsList(tlos)) /* non-default lower bounds */
{
/* since Realloc may copy and free and we need to overwrite entries
anyway it is probably better to free and Malloc */
TryFree(lpd->bdl);
lpd->bdl = (double *) Malloc((size_t) vadded.nint*sizeof(double));
Log1(lpd->bdl = (double *) malloc(%d*sizeof(double)), vadded.nint);
if (IsList(this)) /* non-default upper bounds */
{
/* both bounds arrays are non-default and will be freed
immediately after flushing: no need to increase lpd->macsz since
we will need to Malloc new bounds arrays of correct size next
time around anyway */
TryFree(lpd->bdu);
lpd->bdu = (double *) Malloc((size_t) vadded.nint*sizeof(double));
Log1(lpd->bdu = (double *) malloc(%d*sizeof(double)), vadded.nint);
/* fill the bounds arrays with explicit bounds */
for (i = 0; (IsList(tlos) && IsList(this)); ++i)
{
pword *lhead = vlos.ptr;
pword *ltail = lhead + 1;
pword *hhead = vhis.ptr;
pword *htail = hhead + 1;
double lo, hi;
Dereference_(lhead);
if (IsInteger(lhead->tag)) {
lo = (double) lhead->val.nint;
} else {
Check_Float(lhead->tag);
lo = Dbl(lhead->val);
}
lpd->bdl[i] = (lo < -CPX_INFBOUND ? -CPX_INFBOUND : lo);
Dereference_(hhead);
if (IsInteger(hhead->tag)) {
hi = (double) hhead->val.nint;
} else {
Check_Float(hhead->tag);
hi = Dbl(hhead->val);
}
lpd->bdu[i] = (hi > CPX_INFBOUND ? CPX_INFBOUND : hi);
Dereference_(ltail);
tlos = ltail->tag;
vlos = ltail->val;
Dereference_(htail);
this = htail->tag;
vhis = htail->val;
}
/* check that there are the right number of bds */
if (i != vadded.nint) { Bip_Error(RANGE_ERROR) }
/* mark both arrays as "dirty" */
lpd->dirtybdflag |= 3;
}
else /* default upper bounds */
{
int newcsz;
newcsz = Max(vadded.nint, lpd->macsz+NEWCOL_INCR);
if (lpd->bdu == NULL) /* upper bounds array freed */
{
lpd->bdu = (double *) Malloc((size_t) newcsz*sizeof(double));
Log1(lpd->bdu = (double *) malloc(%d*sizeof(double)), newcsz);
for (i=0; i<newcsz; i++)
{
lpd->bdu[i] = CPX_INFBOUND;
}
}
else
{
lpd->bdu = (double *) Realloc(lpd->bdu, (size_t) newcsz*sizeof(double));
Log1(lpd->bdu = (double *) realloc(%d*sizeof(double)), newcsz);
for (i=lpd->macsz; i<newcsz; i++)
{
lpd->bdu[i] = CPX_INFBOUND;
}
}
lpd->macsz = newcsz;
/* fill the lower bounds array with explicit bounds */
for (i = 0; (IsList(tlos)); ++i)
{
pword *lhead = vlos.ptr;
pword *ltail = lhead + 1;
double lo;
Dereference_(lhead);
if (IsInteger(lhead->tag)) {
lo = (double) lhead->val.nint;
} else {
Check_Float(lhead->tag);
lo = Dbl(lhead->val);
}
lpd->bdl[i] = (lo < -CPX_INFBOUND ? -CPX_INFBOUND : lo);
Dereference_(ltail);
tlos = ltail->tag;
vlos = ltail->val;
}
/* check that there are the right number of bds */
if (i != vadded.nint) { Bip_Error(RANGE_ERROR) }
/* mark lower bounds array as "dirty" */
lpd->dirtybdflag |= 1;
}
}
else if (IsList(this)) /* default lower bounds, non-default upper bounds */
{
int newcsz;
newcsz = Max(vadded.nint, lpd->macsz+NEWCOL_INCR);
if (lpd->bdl == NULL) /* lower bounds array freed */
{
lpd->bdl = (double *) Malloc((size_t) newcsz*sizeof(double));
Log1(lpd->bdl = (double *) malloc(%d*sizeof(double)), newcsz);
for (i=0; i<newcsz; i++)
{
lpd->bdl[i] = -CPX_INFBOUND;
}
}
else
{
lpd->bdl = (double *) Realloc(lpd->bdl, (size_t) newcsz*sizeof(double));
Log1(lpd->bdl = (double *) realloc(%d*sizeof(double)), newcsz);
for (i=lpd->macsz; i<newcsz; i++)
{
lpd->bdl[i] = -CPX_INFBOUND;
}
}
lpd->macsz = newcsz;
TryFree(lpd->bdu);
lpd->bdu = (double *) Malloc((size_t) vadded.nint*sizeof(double));
Log1(lpd->bdu = (double *) malloc(%d*sizeof(double)), vadded.nint);
/* fill the upper bounds array with explicit bounds */
for (i = 0; (IsList(this)); ++i)
{
pword *hhead = vhis.ptr;
pword *htail = hhead + 1;
double hi;
Dereference_(hhead);
if (IsInteger(hhead->tag)) {
hi = (double) hhead->val.nint;
} else {
Check_Float(hhead->tag);
hi = Dbl(hhead->val);
}
lpd->bdu[i] = (hi > CPX_INFBOUND ? CPX_INFBOUND : hi);
Dereference_(htail);
this = htail->tag;
vhis = htail->val;
}
/* check that there are the right number of bds */
if (i != vadded.nint) { Bip_Error(RANGE_ERROR) }
/* mark upper bounds array as "dirty" */
lpd->dirtybdflag |= 2;
}
else /* default bounds */
{
int newcsz;
newcsz = Max(vadded.nint, lpd->macsz+NEWCOL_INCR);
if (lpd->bdl == NULL) /* lower bounds array freed */
{
lpd->bdl = (double *) Malloc((size_t) newcsz*sizeof(double));
Log1(lpd->bdl = (double *) malloc(%d*sizeof(double)), newcsz);
for (i=0; i<newcsz; i++)
{
lpd->bdl[i] = -CPX_INFBOUND;
}
}
else
{
lpd->bdl = (double *) Realloc(lpd->bdl, (size_t) newcsz*sizeof(double));
Log1(lpd->bdl = (double *) realloc(%d*sizeof(double)), newcsz);
for (i=lpd->macsz; i<newcsz; i++)
{
lpd->bdl[i] = -CPX_INFBOUND;
}
}
if (lpd->bdu == NULL) /* upper bounds array freed */
{
lpd->bdu = (double *) Malloc((size_t) newcsz*sizeof(double));
Log1(lpd->bdu = (double *) malloc(%d*sizeof(double)), newcsz);
for (i=0; i<newcsz; i++)
{
lpd->bdu[i] = CPX_INFBOUND;
}
}
else
{
lpd->bdu = (double *) Realloc(lpd->bdu, (size_t) newcsz*sizeof(double));
Log1(lpd->bdu = (double *) malloc(%d*sizeof(double)), newcsz);
for (i=lpd->macsz; i<newcsz; i++)
{
lpd->bdu[i] = CPX_INFBOUND;
}
}
lpd->macsz = newcsz;
}
}
else /* any existing bound arrays are big enough */
{
if (IsList(tlos)) /* non-default lower bounds */
{
if (lpd->bdl == NULL)
{
lpd->bdl = (double *) Malloc((size_t) vadded.nint*sizeof(double));
Log1(lpd->bdl = (double *) malloc(%d*sizeof(double)), vadded.nint);
}
if (IsList(this)) /* non-default upper bounds */
{
if (lpd->bdu == NULL)
{
lpd->bdu = (double *) Malloc((size_t) vadded.nint*sizeof(double));
Log1(lpd->bdu = (double *) malloc(%d*sizeof(double)), vadded.nint);
}
/* fill the bounds arrays with explicit bounds */
for (i = 0; (IsList(tlos) && IsList(this)); ++i)
{
pword *lhead = vlos.ptr;
pword *ltail = lhead + 1;
pword *hhead = vhis.ptr;
pword *htail = hhead + 1;
double lo, hi;
Dereference_(lhead);
if (IsInteger(lhead->tag)) {
lo = (double) lhead->val.nint;
} else {
Check_Float(lhead->tag);
lo = Dbl(lhead->val);
}
lpd->bdl[i] = (lo < -CPX_INFBOUND ? -CPX_INFBOUND : lo);
Dereference_(hhead);
if (IsInteger(hhead->tag)) {
hi = (double) hhead->val.nint;
} else {
Check_Float(hhead->tag);
hi = Dbl(hhead->val);
}
lpd->bdu[i] = (hi > CPX_INFBOUND ? CPX_INFBOUND : hi);
Dereference_(ltail);
tlos = ltail->tag;
vlos = ltail->val;
Dereference_(htail);
this = htail->tag;
vhis = htail->val;
}
/* check that there are the right number of bds */
if (i != vadded.nint) { Bip_Error(RANGE_ERROR) }
/* mark both arrays as "dirty" */
lpd->dirtybdflag |= 3;
}
else /* default upper bounds */
{
if (lpd->bdu == NULL) /* upper bounds array freed */
{
lpd->bdu = (double *) Malloc((size_t) lpd->macsz*sizeof(double));
Log1(lpd->bdu = (double *) malloc(%d*sizeof(double)), lpd->macsz);
for (i=0; i<lpd->macsz; i++)
{
lpd->bdu[i] = CPX_INFBOUND;
}
}
/* fill the lower bounds array with explicit bounds */
for (i = 0; (IsList(tlos)); ++i)
{
pword *lhead = vlos.ptr;
pword *ltail = lhead + 1;
double lo;
Dereference_(lhead);
if (IsInteger(lhead->tag)) {
lo = (double) lhead->val.nint;
} else {
Check_Float(lhead->tag);
lo = Dbl(lhead->val);
}
lpd->bdl[i] = (lo < -CPX_INFBOUND ? -CPX_INFBOUND : lo);
Dereference_(ltail);
tlos = ltail->tag;
vlos = ltail->val;
}
/* check that there are the right number of bds */
if (i != vadded.nint) { Bip_Error(RANGE_ERROR) }
/* mark lower bounds array as "dirty" */
lpd->dirtybdflag |= 1;
}
}
else if (IsList(this)) /* default lower bounds, non-default upper bounds */
{
if (lpd->bdl == NULL) /* lower bounds array freed */
{
lpd->bdl = (double *) Malloc((size_t) lpd->macsz*sizeof(double));
Log1(lpd->bdl = (double *) malloc(%d*sizeof(double)), lpd->macsz);
for (i=0; i<lpd->macsz; i++)
{
lpd->bdl[i] = -CPX_INFBOUND;
}
}
/* fill the upper bounds array with explicit bounds */
for (i = 0; (IsList(this)); ++i)
{
pword *hhead = vhis.ptr;
pword *htail = hhead + 1;
double hi;
Dereference_(hhead);
if (IsInteger(hhead->tag)) {
hi = (double) hhead->val.nint;
} else {
Check_Float(hhead->tag);
hi = Dbl(hhead->val);
}
lpd->bdu[i] = (hi > CPX_INFBOUND ? CPX_INFBOUND : hi);
Dereference_(htail);
this = htail->tag;
vhis = htail->val;
}
/* check that there are the right number of bds */
if (i != vadded.nint) { Bip_Error(RANGE_ERROR) }
/* mark upper bounds array as "dirty" */
lpd->dirtybdflag |= 2;
}
else /* default bounds */
{
if (lpd->bdl == NULL) /* lower bounds array freed */
{
lpd->bdl = (double *) Malloc((size_t) lpd->macsz*sizeof(double));
Log1(lpd->bdl = (double *) malloc(%d*sizeof(double)), lpd->macsz);
for (i=0; i<lpd->macsz; i++)
{
lpd->bdl[i] = -CPX_INFBOUND;
}
}
if (lpd->bdu == NULL) /* upper bounds array freed */
{
lpd->bdu = (double *) Malloc((size_t) lpd->macsz*sizeof(double));
Log1(lpd->bdu = (double *) malloc(%d*sizeof(double)), lpd->macsz);
for (i=0; i<lpd->macsz; i++)
{
lpd->bdu[i] = CPX_INFBOUND;
}
}
}
}
/* fill the objective coefficients array if specified */
if (IsList(tobjs))
{
if (IsList(tobjs)) /* only if there are objective coefficients */
{
TryFree(lpd->objx);
Log1(lpd->objx = (double *) malloc((size_t) %d*sizeof(double)), vadded.nint);
lpd->objx = (double *) Malloc((size_t) vadded.nint*sizeof(double));
}
for (i = 0; IsList(tobjs); ++i)
{
pword *head = vobjs.ptr;
pword *tail = head + 1;
double coeff;
Dereference_(head);
if (IsInteger(head->tag)) {
coeff = (double) head->val.nint;
} else {
Check_Float(head->tag);
coeff = Dbl(head->val);
Check_Constant_Range(coeff);
}
lpd->objx[i] = coeff;
Dereference_(tail);
tobjs = tail->tag;
vobjs = tail->val;
}
/* check that there are the right number of objs */
if (i != vadded.nint) { Bip_Error(RANGE_ERROR) }
}
Succeed;
}
int
p_cpx_init_type(value vlp, type tlp, value vj, type tj, value vtype, type ttype)
{
lp_desc *lpd;
int j;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(tj);
j = vj.nint;
if (j >= lpd->mac) { Bip_Error(RANGE_ERROR); }
if (j >= lpd->macadded) j -= lpd->macadded; /* added col */
lpd->ctype[j] = (char) vtype.nint;
if (vtype.nint != 'C')
{
switch (lpd->prob_type)
{
case PROBLEM_LP:
lpd->prob_type = PROBLEM_MIP;
break;
#ifdef HAS_MIQP
case PROBLEM_QP:
lpd->prob_type = PROBLEM_MIQP;
break;
case PROBLEM_MIQP:
#endif
case PROBLEM_MIP:
break;
default:
Fprintf(Current_Error, "Eplex error: this solver does not support solving of quadratic MIP problems.\n");
ec_flush(Current_Error);
Bip_Error(EC_EXTERNAL_ERROR);
break;
}
#ifdef XPRESS
++lpd->ngents;
#endif
}
Succeed;
}
/* Set bounds for new variables in buffer arrays.
* Used for initial setup and for adding variables.
*/
int
p_cpx_init_bound(value vlp, type tlp, value vj, type tj, value vwhich, type twhich, value vval, type tval)
{
lp_desc *lpd;
int j;
double bd;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(tj);
Check_Atom(twhich);
Check_Float(tval);
bd = Dbl(vval);
j = vj.nint;
if (j >= lpd->mac) { Bip_Error(RANGE_ERROR); }
if (j >= lpd->macadded) j -= lpd->macadded; /* added col */
if (vwhich.did == d_le) { /* upper bound */
if (bd < lpd->bdl[j]) { Fail; }
if (bd < lpd->bdu[j]) { lpd->bdu[j] = bd; lpd->dirtybdflag |= 2; }
} else if (vwhich.did == d_ge) { /* lower bound */
if (bd > lpd->bdu[j]) { Fail; }
if (bd > lpd->bdl[j]) { lpd->bdl[j] = bd; lpd->dirtybdflag |= 1; }
} else if (vwhich.did == d_eq) { /* both bounds */
if (bd < lpd->bdl[j] || lpd->bdu[j] < bd) { Fail; }
lpd->bdl[j] = lpd->bdu[j] = bd;
lpd->dirtybdflag |= 3;
} else {
Bip_Error(RANGE_ERROR);
}
Succeed;
}
/*----------------------------------------------------------------------*
* Retrieving variable type and bounds
*----------------------------------------------------------------------*/
int
p_cpx_get_col_type(value vlp, type tlp, value vj, type tj, value vtype, type ttype)
{
lp_desc *lpd;
char ctype[1];
LpDesc(vlp, tlp, lpd);
Check_Integer(tj);
if (vj.nint >= lpd->mac || vj.nint < 0) { Bip_Error(RANGE_ERROR); }
SetPreSolve(lpd->presolve);
if (IsMIPProb(lpd->prob_type))
{
CPXupdatemodel(lpd->lp); /* before CPXget... */
if (CPXgetctype(cpx_env, lpd->lp, ctype, (int) vj.nint, (int) vj.nint))
{
Bip_Error(EC_EXTERNAL_ERROR);
}
}
else
{
ctype[0] = 'C';
}
Return_Unify_Integer(vtype, ttype, (int) ctype[0]);
}
/*----------------------------------------------------------------------*
* Updating objective
*----------------------------------------------------------------------*/
static void
_grow_cb_arrays(lp_desc * lpd, int with_index2)
{
if (lpd->cb_sz == 0)
{
#ifdef LOG_CALLS
Fprintf(log_output_, "\n\
lpd->cb_sz = %d;\n\
lpd->cb_index = (int *) malloc(lpd->cb_sz*sizeof(int));\n\
lpd->cb_value = (double *) malloc(lpd->cb_sz*sizeof(double));",
NEWBD_INCR);
if (with_index2)
Fprintf(log_output_, "\n\
lpd->cb_index2 = (int *) malloc(lpd->cb_sz*sizeof(int));");
ec_flush(log_output_);
#endif
lpd->cb_sz = NEWBD_INCR;
lpd->cb_index = (int *) Malloc(NEWBD_INCR*sizeof(int));
if (with_index2)
lpd->cb_index2 = (int *) Malloc(NEWBD_INCR*sizeof(int));
lpd->cb_value = (double *) Malloc(NEWBD_INCR*sizeof(double));
}
else
{
#ifdef LOG_CALLS
Fprintf(log_output_, "\n\
lpd->cb_sz += %d;\n\
lpd->cb_index = (int *) realloc(lpd->cb_index, lpd->cb_sz*sizeof(int));\n\
lpd->cb_value = (double *) realloc(lpd->cb_value, lpd->cb_sz*sizeof(double));",
NEWBD_INCR);
if (with_index2)
{
Fprintf(log_output_, "\n\
lpd->cb_index2 = lpd->cb_index2\n\
? (int *) realloc(lpd->cb_index2, lpd->cb_sz*sizeof(int))\n\
: (int *) malloc(lpd->cb_sz*sizeof(int));");
}
else if (lpd->cb_index2)
{
Fprintf(log_output_, "\n\
free(lpd->cb_index2);\n\
lpd->cb_index2 = 0;");
}
ec_flush(log_output_);
#endif
lpd->cb_sz += NEWBD_INCR;
lpd->cb_index = (int *) Realloc(lpd->cb_index, lpd->cb_sz*sizeof(int));
lpd->cb_value = (double *) Realloc(lpd->cb_value, lpd->cb_sz*sizeof(double));
if (with_index2)
{
lpd->cb_index2 = lpd->cb_index2
? (int *) Realloc(lpd->cb_index2, lpd->cb_sz*sizeof(int))
: (int *) Malloc(lpd->cb_sz*sizeof(int));
}
else if (lpd->cb_index2)
{
Free(lpd->cb_index2);
lpd->cb_index2 = 0;
}
}
}
int
p_cpx_new_obj_coeff(value vlp, type tlp, value vj, type tj, value vcoeff, type tcoeff)
{
lp_desc *lpd;
double coeff;
int i;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(tj);
if (vj.nint >= lpd->mac)
{ Bip_Error(RANGE_ERROR); }
if (IsInteger(tcoeff)) {
coeff = (double) vcoeff.nint;
} else {
Check_Float(tcoeff);
coeff = Dbl(vcoeff);
Check_Constant_Range(coeff);
}
if (lpd->cb_cnt >= lpd->cb_sz) /* grow arrays if necessary */
{
_grow_cb_arrays(lpd, 0);
}
i = lpd->cb_cnt++;
lpd->cb_index[i] = vj.nint;
lpd->cb_value[i] = coeff;
Succeed;
}
int
p_cpx_flush_obj(value vlp, type tlp)
{
lp_desc *lpd;
LpDesc(vlp, tlp, lpd);
if (lpd->cb_cnt == 0)
{
Succeed;
}
SetPreSolve(lpd->presolve);
Mark_Copy_As_Modified(lpd);
#ifdef LOG_CALLS
{
int i;
for (i=0; i<lpd->cb_cnt; ++i)
{
Fprintf(log_output_, "\n\
lpd->cb_index[%d] = %d;\n\
lpd->cb_value[%d] = %.15e;",
i, lpd->cb_index[i], i, lpd->cb_value[i]);
}
Log1(CPXchgobj(cpx_env, lpd->lp, %d, lpd->cb_index, lpd->cb_value), lpd->cb_cnt);
}
#endif
if (CPXchgobj(cpx_env, lpd->lp, lpd->cb_cnt, lpd->cb_index, lpd->cb_value))
{
Bip_Error(EC_EXTERNAL_ERROR);
}
lpd->cb_cnt = 0;
Succeed;
}
int
p_cpx_new_qobj_coeff(value vlp, type tlp,
value vi, type ti,
value vj, type tj,
value vcoeff, type tcoeff)
{
lp_desc *lpd;
double coeff;
Check_Integer(ti);
Check_Integer(tj);
LpDesc(vlp, tlp, lpd);
if (vj.nint >= lpd->mac || vi.nint >= lpd->mac)
{ Bip_Error(RANGE_ERROR); }
if (IsInteger(tcoeff)) {
coeff = (double) vcoeff.nint;
} else {
Check_Float(tcoeff);
coeff = Dbl(vcoeff);
Check_Constant_Range(coeff);
}
if (vi.nint==vj.nint)
coeff *= 2;
SetPreSolve(lpd->presolve);
Log3(CPXchgqpcoef(cpx_env, lpd->lp, %d,%d,%.15e), vi.nint, vj.nint, coeff);
if (CPXchgqpcoef(cpx_env, lpd->lp, vi.nint, vj.nint, coeff))
{
Bip_Error(EC_EXTERNAL_ERROR);
}
Succeed;
}
int
p_cpx_change_obj_sense(value vlp, type tlp, value vsense, type tsense)
{
lp_desc *lpd;
Check_Integer(tsense);
LpDesc(vlp, tlp, lpd);
SetPreSolve(lpd->presolve);
lpd->sense = vsense.nint;
CPXchgobjsen(cpx_env, lpd->lp, vsense.nint);
#ifdef SOLVE_MIP_COPY
if (lpd->copystatus != XP_COPYOFF) Mark_Copy_As_Modified(lpd);
#endif
Succeed;
}
/*----------------------------------------------------------------------*
* Initial matrix setup
*----------------------------------------------------------------------*/
int
p_cpx_set_matbeg(value vlp, type tlp,
value vj, type tj,
value vk, type tk,
value vk1, type tk1)
{
lp_desc *lpd;
int j;
Check_Integer(tk);
Check_Integer(tk1);
Check_Integer(tj);
j = vj.nint;
LpDescOnly(vlp, tlp, lpd);
if (j >= lpd->mac || j < 0) { Bip_Error(RANGE_ERROR); }
if (j >= lpd->macadded) j -= lpd->macadded; /* added col */
lpd->matbeg[j] = vk.nint;
lpd->matcnt[j] = vk1.nint - vk.nint;
Succeed;
}
int
p_cpx_set_matval(value vlp, type tlp,
value vk, type tk,
value vi, type ti,
value vval, type tval)
{
lp_desc *lpd;
Check_Integer(tk);
Check_Integer(ti);
Check_Number(tval);
LpDescOnly(vlp, tlp, lpd);
if (vk.nint >= lpd->matnz || vk.nint < 0 ||
vi.nint >= lpd->mar || vi.nint < SOLVER_MAT_BASE)
{ Bip_Error(RANGE_ERROR); }
lpd->matind[vk.nint] = vi.nint;
lpd->matval[vk.nint] = DoubleVal(vval, tval);
Check_Constant_Range(lpd->matval[vk.nint]);
Succeed;
}
int
p_cpx_loadprob(value vlp, type tlp)
{
int err;
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
SetPreSolve(lpd->presolve);
lpd->start_mac = lpd->mac;
if (lpd->nsos) {
if (lpd->prob_type == PROBLEM_QP)
lpd->prob_type = PROBLEM_MIQP;
else
lpd->prob_type = PROBLEM_MIP;
}
#ifndef HAS_MIQP
if (lpd->prob_type == PROBLEM_MIQP)
{
Fprintf(Current_Error, "Eplex error: this solver does not support solving of quadratic MIP problems.\n");
ec_flush(Current_Error);
Bip_Error(UNIMPLEMENTED);
}
#endif
#ifdef LOG_CALLS
{
int i;
# ifndef DUMPMAT
# ifdef XPRESS
Fprintf(log_output_, "\n\
lpd->probname = (char *) malloc(16*sizeof(char));\n\
strcpy(lpd->probname, \"eclipse\");"
);
# endif
# ifdef CPLEX
Log1(lpd->sense = %d, lpd->sense);
# endif
Fprintf(log_output_, "\n\
lpd->sense = %d;\n\
lpd->macsz = %d;\n\
lpd->marsz = %d;\n\
lpd->matnz = %d;\n\
lpd->mac = %d;\n\
lpd->mar = %d;\n\
lpd->rhsx = (double *) malloc(lpd->marsz * sizeof(double));\n\
lpd->senx = (char *) malloc(lpd->marsz * sizeof(char));\n\
lpd->matbeg = (int *) malloc((lpd->macsz+1) * sizeof(int));\n\
lpd->matcnt = (int *) malloc(lpd->macsz * sizeof(int));\n\
lpd->matind = (int *) malloc(lpd->matnz * sizeof(int));\n\
lpd->matval = (double *) malloc(lpd->matnz * sizeof(double));\n\
lpd->bdl = (double *) malloc(lpd->macsz * sizeof(double));\n\
lpd->bdu = (double *) malloc(lpd->macsz * sizeof(double));\n\
lpd->objx = (double *) malloc(lpd->macsz * sizeof(double));\n\
lpd->ctype = (char *) malloc(lpd->macsz * sizeof(char));",
lpd->sense,(lpd->macsz ? lpd->macsz : 1), (lpd->marsz ? lpd->marsz: 1), (lpd->matnz? lpd->matnz : 1),
lpd->mac, lpd->mar);
for (i=0; i<lpd->mac; ++i)
{
Fprintf(log_output_, "\n\tlpd->objx[%d] = %.15e;", i, lpd->objx[i]);
Fprintf(log_output_, "\n\tlpd->bdl[%d] = %.15e;", i, lpd->bdl[i]);
Fprintf(log_output_, "\n\tlpd->bdu[%d] = %.15e;", i, lpd->bdu[i]);
Fprintf(log_output_, "\n\tlpd->matbeg[%d] = %d;", i, lpd->matbeg[i]);
Fprintf(log_output_, "\n\tlpd->matcnt[%d] = %d;", i, lpd->matcnt[i]);
}
for (i=0; i<lpd->mar; ++i)
{
Fprintf(log_output_, "\n\tlpd->rhsx[%d] = %.15e;", i, lpd->rhsx[i]);
Fprintf(log_output_, "\n\tlpd->senx[%d] = '%c';", i, lpd->senx[i]);
}
for (i=0; i<lpd->matnz; ++i)
{
Fprintf(log_output_, "\n\tlpd->matind[%d] = %d;", i, lpd->matind[i]);
Fprintf(log_output_, "\n\tlpd->matval[%d] = %.15e;", i, lpd->matval[i]);
}
# else /* DUMPMAT */
dump_problem(lpd);
# endif
}
#endif /* LOG_CALLS */
lpd->lp = NULL;
#ifdef GUROBI
if (cpx_loadprob(lpd))
{
Bip_Error(EC_EXTERNAL_ERROR);
}
#endif
#ifdef CPLEX
CallN(lpd->lp = CPXcreateprob(cpx_env, &err, "eclipse"));
if (lpd->lp == NULL)
{
if (err == CPXERR_NO_ENVIRONMENT) {
Fprintf(Current_Error, "Unable to create problem in CPLEX: licensing problem?\n");
ec_flush(Current_Error);
}
Bip_Error(EC_EXTERNAL_ERROR);
}
#endif
#ifdef COIN
CallN(coin_create_prob(&(lpd->lp), cpx_env));
#endif
#if defined(CPLEX) || defined(COIN)
CallN(lpd->lpcopy = lpd->lp); /* no need for a copy in CPLEX */
Call(err, CPXcopylp(cpx_env, lpd->lp, lpd->mac, lpd->mar,
lpd->sense, lpd->objx, lpd->rhsx, lpd->senx,
lpd->matbeg, lpd->matcnt, lpd->matind, lpd->matval,
lpd->bdl, lpd->bdu, NULL));
if (err)
{ Bip_Error(EC_EXTERNAL_ERROR); }
if (IsMIPProb(lpd->prob_type))
{
# if defined(LOG_CALLS)
/* no need to log for XPRESS as ctype array not used directly */
{ int i;
for (i=0; i<lpd->mac; ++i)
{
Fprintf(log_output_, "\n\tlpd->ctype[%d] = '%c';", i, lpd->ctype[i]);
}
}
# endif
Call(err, CPXcopyctype(cpx_env, lpd->lp, lpd->ctype));
if (err)
{ Bip_Error(EC_EXTERNAL_ERROR); }
}
if (lpd->nsos)
{
#if defined(CPLEX) && CPLEX < 10
if (CPXaddsos(cpx_env, lpd->lp, lpd->nsos, lpd->nsosnz, lpd->sostype,
NULL, lpd->sosbeg, lpd->sosind, lpd->sosref))
#else
if (CPXaddsos(cpx_env, lpd->lp, lpd->nsos, lpd->nsosnz, lpd->sostype,
lpd->sosbeg, lpd->sosind, lpd->sosref, NULL))
#endif
{ Bip_Error(EC_EXTERNAL_ERROR); }
lpd->nsos_added = lpd->nsos;
}
if IsQPProb(lpd->prob_type)
{
# ifdef HAS_QUADRATIC
int i;
# ifdef HAS_MIQP
int ptype = (lpd->prob_type == PROBLEM_QP ? CPXPROB_QP : CPXPROB_MIQP);
# else
int ptype = CPXPROB_QP;
# endif
if (CPXgetprobtype(cpx_env, lpd->lp) != ptype)
{
Call(err, CPXchgprobtype(cpx_env, lpd->lp, ptype));
if (err != 0)
{ Bip_Error(EC_EXTERNAL_ERROR); }
}
# ifdef CPLEX
for (i=0; i<lpd->cb_cnt; ++i)
{
Log3(CPXchgqpcoef(cpx_env, lpd->lp, %d, %d, %f),
lpd->cb_index[i], lpd->cb_index2[i], lpd->cb_value[i]);
if (CPXchgqpcoef(cpx_env, lpd->lp, lpd->cb_index[i],
lpd->cb_index2[i], lpd->cb_value[i]))
{ Bip_Error(EC_EXTERNAL_ERROR); }
}
lpd->cb_cnt = 0;
# elif defined(COIN)
coin_set_qobj(lpd->lp, lpd->mac, lpd->cb_cnt, lpd->cb_index, lpd->cb_index2, lpd->cb_value);
# endif
# else /* !HAS_QUADRATIC */
Fprintf(Current_Error, "Eplex error: Quadratic problems not supported for this solver!\n");
ec_flush(Current_Error);
Bip_Error(EC_EXTERNAL_ERROR);
# endif
}
#endif /* CPLEX || COIN */
#ifdef XPRESS
Call(err, XPRScreateprob(&lpd->lp));
if (lpd->copystatus != XP_COPYOFF)
{
Mark_Copy_As_Modified(lpd);
if (IsMIPProb(lpd->prob_type))
{
if (err == 0) { Call(err, XPRScreateprob(&lpd->lpcopy)); }
}
else
CallN(lpd->lpcopy = lpd->lp);
}
else
CallN(lpd->lpcopy = lpd->lp);
if (err && (err != 32/*student version*/))
{
char errmsg[256];
XPRSgetlasterror(lpd->lp, errmsg);
Fprintf(Current_Error, "Eplex error: %s\n", errmsg);
ec_flush(Current_Error);
Bip_Error(EC_EXTERNAL_ERROR);
}
CallN(XPRScopycontrols(lpd->lp, cpx_env));
/* Switch presolve off if requested, otherwise leave cpx_env's defaults */
if (lpd->presolve == 0)
{
CallN(XPRSsetintcontrol(lpd->lp, XPRS_PRESOLVE, 0));
CallN(XPRSsetintcontrol(lpd->lp, XPRS_MIPPRESOLVE, 0));
}
/* this call back was done globally before version 13 */
XPRSsetcbmessage(lpd->lp, eclipse_out, NULL);
/* the problem is now always loaded with XPRSloadglobal()
as suggested by David Nielsen @ Dash 2004-09-28
For a quadratic problem, the quadratic terms are then added
*/
if (lpd->ngents) /* has integers */
{
int i,j;
/* don't know whether these arrays can be temporary */
Log1({
lpd->ngents = %i;\n\
lpd->nsos = 0;\n\
lpd->sossz = 0;\n\
lpd->sostype = NULL;\n\
lpd->sosbeg = NULL;\n\
lpd->sosind = NULL;\n\
lpd->sosref = NULL;\n\
}, lpd->ngents);
CallN(lpd->qgtype = (char *)Malloc(lpd->ngents*sizeof(char)));
CallN(lpd->mgcols = (int *)Malloc(lpd->ngents*sizeof(int)));
for (i=0,j=0; i < lpd->mac; i++)
{
if (lpd->ctype[i] != 'C')
{
Log4({\n\
lpd->qgtype[%i] = '%c';\n\
lpd->mgcols[%i] = %i;\n\
}, j, lpd->ctype[i], j, i);
lpd->qgtype[j] = lpd->ctype[i]; /* 'B' or 'I' */
lpd->mgcols[j++] = i;
}
}
/* correct the count, in case there were duplicates
* in the integer list (yes it happened...) */
lpd->ngents = j;
Log1(lpd->ngents = %i, j);
}
else
{
lpd->qgtype = NULL;
lpd->mgcols = NULL;
}
Call(err, XPRSloadglobal(lpd->lp, lpd->probname,
lpd->mac, lpd->mar, lpd->senx, lpd->rhsx, NULL, lpd->objx,
lpd->matbeg, lpd->matcnt, lpd->matind, lpd->matval,
lpd->bdl, lpd->bdu,
lpd->ngents, lpd->nsos, lpd->qgtype, lpd->mgcols, NULL,
lpd->sostype, lpd->sosbeg, lpd->sosind, lpd->sosref));
if (err) { Bip_Error(EC_EXTERNAL_ERROR); }
if (lpd->cb_cnt) /* has quadratic objective terms */
{
# ifdef LOG_CALLS
int i;
Fprintf(log_output_, "\n\tlpd->cb_cnt = %d;", lpd->cb_cnt);
for(i=0; i< lpd->cb_cnt; ++i)
{
Fprintf(log_output_, "\n\tlpd->cb_index[%d] = %d;", i, lpd->cb_index[i]);
Fprintf(log_output_, "\n\tlpd->cb_index2[%d] = %d;", i, lpd->cb_index2[i]);
Fprintf(log_output_, "\n\tlpd->cb_value[%d] = %.15e;", i, lpd->cb_value[i]);
}
# endif
Call(err, XPRSchgmqobj(lpd->lp, lpd->cb_cnt,
lpd->cb_index, lpd->cb_index2, lpd->cb_value));
lpd->cb_cnt = 0;
if (err) { Bip_Error(EC_EXTERNAL_ERROR); }
}
#endif /* XPRESS */
/* free our copy of the problem */
Free(lpd->rhsx); lpd->rhsx = NULL;
Free(lpd->senx); lpd->senx = NULL;
Free(lpd->matbeg); lpd->matbeg = NULL;
Free(lpd->matcnt); lpd->matcnt = NULL;
Free(lpd->matind); lpd->matind = NULL;
Free(lpd->matval); lpd->matval = NULL;
Free(lpd->bdl); lpd->bdl = NULL;
Free(lpd->bdu); lpd->bdu = NULL;
Free(lpd->ctype); lpd->ctype = NULL;
Free(lpd->objx); lpd->objx = NULL;
lpd->matnz = 0;
lpd->macsz = 0;
if (lpd->nsos)
{
lpd->nsos_added = lpd->nsos;
Free(lpd->sosbeg); lpd->sosbeg = NULL;
Free(lpd->sosind); lpd->sosind = NULL;
Free(lpd->sosref); lpd->sosref = NULL;
lpd->nsosnz = 0;
}
lpd->macadded = lpd->mac;
Succeed;
}
/* add initial cutpool constraints to problem */
static int
_setup_initial_cp_constraints(lp_desc * lpd, int add_all, int * unadded_cntp,
int * cp_unadded, int * cp_map2)
{
double * rhs, * rmatval;
int * rmatbeg, * rmatind, i, offset, first = -1,
cp_rcnt2 = 0, rcnt = 0;
char * senx;
rmatbeg = (int *)Malloc((lpd->cp_nr2+1)*sizeof(int));
for (i=0; i < lpd->cp_nr2; i++)
{
if (lpd->cp_active2[i] == 1)
{
if (lpd->cp_initial_add2[i] == 1 || add_all)
{/* active, added initially (or add all active constraints) */
if (first == -1)
{
first = i;
offset = lpd->cp_rmatbeg2[first];
}
/* rmatbeg need to be offset from the start of array */
rmatbeg[cp_rcnt2] = lpd->cp_rmatbeg2[i] - offset;
cp_map2[i] = cp_rcnt2++;
rcnt++;
continue;
} else
{ /* active, but not added initially */
cp_map2[i] = CSTR_STATE_NOTADDED; /* not added yet */
cp_unadded[(*unadded_cntp)++] = i;
}
} else
{/* not active */
cp_map2[i] = CSTR_STATE_INACTIVE; /* not active */
}
if (rcnt > 0)
{/* there are some rows to add... */
rhs = &lpd->cp_rhsx2[first];
rmatind = &lpd->cp_rmatind2[offset];
rmatval = &lpd->cp_rmatval2[offset];
senx = &lpd->cp_senx2[first];
CPXaddrows(cpx_env, lpd->lp, 0, rcnt,
(lpd->cp_rmatbeg2[i] - offset),
rhs, senx, rmatbeg, rmatind, rmatval, NULL, NULL);
rcnt = 0;
first = -1;
}
}
if (rcnt > 0)
{/* there are some rows to add... */
rhs = &lpd->cp_rhsx2[first];
rmatind = &lpd->cp_rmatind2[offset];
rmatval = &lpd->cp_rmatval2[offset];
senx = &lpd->cp_senx2[first];
CPXaddrows(cpx_env, lpd->lp, 0, rcnt,
(lpd->cp_nnz2 - offset),
rhs, senx, rmatbeg, rmatind, rmatval, NULL, NULL);
rcnt = 0;
first = -1;
}
lpd->mar += cp_rcnt2;
lpd->cp_nact2 = cp_rcnt2;
if (cp_rcnt2 > 0) { Mark_Copy_As_Modified(lpd); }
Free(rmatbeg);
return 0;
}
/*----------------------------------------------------------------------*
* Read/write
*----------------------------------------------------------------------*/
int
p_cpx_lpwrite(value vfile, type tfile, value vformat, type tformat,
value vlp, type tlp)
{
lp_desc *lpd;
char has_cp = 0, *file, *format;
int oldmar, res;
Get_Name(vformat, tformat, format);
Get_Name(vfile, tfile, file);
LpDesc(vlp, tlp, lpd);
oldmar = lpd->mar;
SetPreSolve(lpd->presolve);
if (lpd->cp_nr2 > 0)
{
int unadded_cnt = 0, * cp_unadded, * cp_map2;
cp_unadded = (int *)Malloc(lpd->cp_nr2*sizeof(int));
cp_map2 = (int *)Malloc(lpd->cp_nr2*sizeof(int));
if (_setup_initial_cp_constraints(lpd, 1, &unadded_cnt, cp_unadded, cp_map2) == -1)
{
reset_rowcols(lpd, oldmar, lpd->mac);
Bip_Error(RANGE_ERROR);
}
}
res = cpx_write(lpd, file, format);
reset_rowcols(lpd, oldmar, lpd->mac);
if (res == 0)
{
Succeed;
} else
{
Bip_Error(EC_EXTERNAL_ERROR);
}
}
int
p_cpx_lpread(value vfile, type tfile,
value vformat, type tformat,
value vpresolve, type tpresolve,
value vhandle, type thandle)
{
lp_desc *lpd;
char *file, *format;
int res;
#if defined(CPLEX) || defined(XPRESS)
if (!cpx_env)
{
Bip_Error(EC_LICENSE_ERROR);
}
#endif
Get_Name(vfile, tfile, file);
Get_Name(vformat, tformat, format);
Check_Structure(thandle);
Check_Integer(tpresolve);
CallN((lpd = (lp_desc *) Malloc(sizeof(lp_desc))));
/*CallN(_clr_lp_desc(lpd));*/
CallN(memset(lpd, 0, sizeof(lp_desc)));
/* the logged code needs to be hand-adjusted to put file in scope */
Log1({char *file = "%s";}, file);
lpd->presolve = vpresolve.nint;
#ifdef USE_PROBLEM_ARRAY
Log1(lpdmat[%d] = lpd, next_matno);
current_matno = next_matno;
lpd->matno = next_matno++;
#endif
if (cpx_read(lpd, file, format))
{
Bip_Error(EC_EXTERNAL_ERROR);
}
lpd->start_mac = lpd->macadded = lpd->mac;
lpd->descr_state = DESCR_LOADED;
{/* Return the cplex descriptor in argument HANDLE_CPH of the handle structure. */
vhandle.ptr[HANDLE_CPH] = ec_handle(&lp_handle_tid, lpd);
Make_Stamp(vhandle.ptr+HANDLE_STAMP); /* needed for other trail undos */
}
Succeed;
}
void
_create_result_darray(value vhandle, int pos, int size, pword* pw, double** start)
{
pword *argp = &vhandle.ptr[pos];
Dereference_(argp);
if (IsRef(argp->tag))
*start = NULL;
else
{
pw->tag.kernel = TSTRG;
pw->val.ptr = _create_darray(size);
*start = DArrayStart(pw->val.ptr);
}
}
void
_create_result_iarray(value vhandle, int pos, int size, pword *pw, int** start)
{
pword *argp = &vhandle.ptr[pos];
Dereference_(argp);
if (IsRef(argp->tag))
*start = NULL;
else
{
pw->tag.kernel = TSTRG;
pw->val.ptr = _create_iarray(size);
*start = IArrayStart(pw->val.ptr);
}
}
/*----------------------------------------------------------------------*
* Accessing Infeasible information
*----------------------------------------------------------------------*/
#ifdef SUPPORT_IIS
static int
_get_iis(lp_desc * lpd, int * nrowsp, int * ncolsp, int * rowidxs, int * colidxs, char * colstats)
{
int status;
int i;
# ifdef CPLEX
int * rowstatbuf, * colstatbuf;
rowstatbuf = Malloc(sizeof(int) * *nrowsp);
colstatbuf = Malloc(sizeof(int) * *ncolsp);
# endif
Get_Conflict(lpd->lp, status, rowidxs, rowstatbuf, nrowsp, colidxs, colstatbuf, ncolsp);
# ifdef CPLEX
switch (status)
{
case CPX_STAT_CONFLICT_MINIMAL:
for(i=0;i<*ncolsp;i++)
{
switch (colstatbuf[i])
{
# ifdef HAS_GENERAL_CONFLICT_REFINER
case CPX_CONFLICT_MEMBER:
colstats[i] = 'b';
break;
# endif
case CPX_CONFLICT_LB:
colstats[i] = 'l';
break;
case CPX_CONFLICT_UB:
colstats[i] = 'u';
break;
default:
colstats[i] = 'x';
break;
}
}
Free(rowstatbuf);
Free(colstatbuf);
break;
default:
Free(rowstatbuf);
Free(colstatbuf);
return -1;
break;
# ifdef HAS_GENERAL_CONFLICT_REFINER
case CPX_STAT_CONFLICT_FEASIBLE:
/* An infeaible problem can return CONFLICT_FEASIBLE, with no conflict set, probably because
problem is near feasible.
*/
*nrowsp = 0;
*ncolsp = 0;
Free(rowstatbuf);
Free(colstatbuf);
return 1;
break;
# endif
}
# endif
# ifdef XPRESS
if (!status) {
for(i=0;i<*ncolsp;i++) colstats[i] = 'x';
} else {
return -1;
}
# endif
return 0;
}
#endif /* SUPPORT_IIS */
/*----------------------------------------------------------------------*
* Solve
*----------------------------------------------------------------------*/
static int
_cstr_state(lp_desc * lpd, int row, char add_cp_cstr, double * sols, double tol)
{
int lastarg, argpos;
double lhs = 0.0, slack;
/* add_cp_cstr == 2 if unbounded result -- simply add all constraints
in this case by returning violated state
*/
if (add_cp_cstr == 2) return CSTR_STATE_VIOLATED;
lastarg = (row < lpd->cp_nr2 - 1 ? lpd->cp_rmatbeg2[row+1] : lpd->cp_nnz2);
for (argpos = lpd->cp_rmatbeg2[row] ; argpos < lastarg ; argpos++)
{
lhs += sols[lpd->cp_rmatind2[argpos]] * lpd->cp_rmatval2[argpos];
}
/* definition of slack for all row types except ranged rows, which we
don't use
*/
slack = lpd->cp_rhsx2[row] - lhs;
switch (lpd->cp_senx2[row])
{
case SOLVER_SENSE_LE:
return (slack<-tol ? CSTR_STATE_VIOLATED
: (slack<=tol ? CSTR_STATE_BINDING : CSTR_STATE_SAT));
break;
case SOLVER_SENSE_GE:
return (slack > tol ? CSTR_STATE_VIOLATED
: (slack >= -tol ? CSTR_STATE_BINDING : CSTR_STATE_SAT));
break;
case SOLVER_SENSE_EQ:
return (slack <= tol && slack >= -tol ? CSTR_STATE_BINDING
: CSTR_STATE_VIOLATED);
break;
default:
/* constraint type out of range */
return CSTR_STATE_INVALID;
break;
}
}
/* cplex_optimise(Handle, SolveMethods, TimeOut, WriteBefore, MipStart,
OutputPos, OptResult, OptStatus, WorstBound, BestBound)
optimises problem in Handle. Handle is needed to access the result
arrays located in Handle by the OutputPos arguments.
OptResult is the resulting status after the optimisation, OptStatus is
the optimiser-dependent status returned by the optimiser. Worst and
Best bounds are the bounds on the optimal solution determined by the
solver.
Any solution state must be extracted from the optimiser in this procedure,
as it modifies the problem by first adding the cutpool constraints before
calling the optimiser and then removing them before exiting.
*/
int
p_cpx_optimise(value vhandle, type thandle, value vmeths, type tmeths,
value vtimeout, type ttimeout, value vdump, type tdump,
value vmipstart, type tmipstart,
value vout, type tout, value vres, type tres, value vstat, type tstat,
value vworst, type tworst, value vbest, type tbest)
{
lp_desc *lpd;
int res, oldmar;
int solspos, pispos, slackspos, djspos, cbasepos, rbasepos, cpcondmappos;
int iis_rowspos, iis_colspos, iis_colstatspos;
pword * pw, outsols, outpis, outslacks, outdjs, outcbase, outrbase;
/* outdjs: when adding a solver, check to make sure that the reduced
cost is of the same sign as what we defined (and what CPLEX and
XPress uses). Reverse the signs before returning to ECLiPSe if required!
*/
struct lp_meth meth;
struct lp_sol sol;
char has_cp = 0; /* has cutpool constraints added */
char add_cp_cstr = 0;
char *file = NULL;
char *format = NULL;
double bestbound, worstbound;
int * cp_unadded, last_violated_idx, violated_cnt, unadded_cnt = 0;
int * cp_map2;
pword * old_tg;
/*********************************************************************
* Type Checking and Initialisation *
*********************************************************************/
Prepare_Requests
Check_Structure(thandle);
Check_Structure(tmeths);
Check_Integer(tout);
Check_Integer(tmipstart);
Check_Number(ttimeout);
LpDesc(vhandle.ptr[HANDLE_CPH].val, vhandle.ptr[HANDLE_CPH].tag, lpd);
if (lpd->descr_state == DESCR_EMPTY)
{
Fprintf(Current_Error, "Eplex optimise: empty handle\n");
(void) ec_flush(Current_Error);
Bip_Error(EC_EXTERNAL_ERROR);
}
/* m(Method,AuxMeth,NodeMeth,NodeAuxMeth) */
pw = &vmeths.ptr[1];
Dereference_(pw);
Check_Integer(pw->tag);
meth.meth = pw->val.nint;
pw = &vmeths.ptr[2];
Dereference_(pw);
Check_Integer(pw->tag);
meth.auxmeth = pw->val.nint;
pw = &vmeths.ptr[3];
Dereference_(pw);
Check_Integer(pw->tag);
meth.node_meth = pw->val.nint;
pw = &vmeths.ptr[4];
Dereference_(pw);
Check_Integer(pw->tag);
meth.node_auxmeth = pw->val.nint;
/* positions for output arrays in the Prolog handle */
solspos = vout.nint + HANDLE_S_SOLS;
pispos = vout.nint + HANDLE_S_PIS;
slackspos = vout.nint + HANDLE_S_SLACKS;
djspos = vout.nint + HANDLE_S_DJS;
cbasepos = vout.nint + HANDLE_S_CBASE;
rbasepos = vout.nint + HANDLE_S_RBASE;
cpcondmappos = vout.nint + HANDLE_S_CPCM;
iis_rowspos = vout.nint + HANDLE_S_IISR;
iis_colspos = vout.nint + HANDLE_S_IISC;
iis_colstatspos = vout.nint + HANDLE_S_IISCS;
if (IsStructure(tdump))
{ /* write_before_solve(Format,File) */
pw = &vdump.ptr[1];
Dereference_(pw);
Get_Name(pw->val, pw->tag, format);
pw = &vdump.ptr[2];
Dereference_(pw);
Get_Name(pw->val, pw->tag, file);
}
SetPreSolve(lpd->presolve);
oldmar = lpd->mar;
if (lpd->cp_nr2 > 0)
{
pword map;
_create_result_iarray(vhandle, cpcondmappos, lpd->cp_nr2, &map, &cp_map2);
cp_unadded = (int *)Malloc(lpd->cp_nr2*sizeof(int));
if (_setup_initial_cp_constraints(lpd, 0, &unadded_cnt, cp_unadded, cp_map2) == -1)
{
reset_rowcols(lpd, oldmar, lpd->mac);
Bip_Error(RANGE_ERROR);
}
if (cp_map2)
ec_assign(vhandle.ptr+cpcondmappos, map.val, map.tag);
has_cp = 1;
}
/* initialise the lp_sol structure
*/
pw = &vhandle.ptr[solspos];
Dereference_(pw);
sol.oldmac = IsArray(pw->tag) ? DArraySize(pw->val.ptr) : 0;
sol.oldsols = IsArray(pw->tag) ? DArrayStart(pw->val.ptr) : NULL;
_create_result_darray(vhandle, solspos, lpd->mac, &outsols, &sol.sols);
#ifdef HAS_LIMITED_MIP_RESULTS
if (IsMIPProb(lpd->prob_type)) {
sol.djs = NULL;
sol.cbase = NULL;
} else
#endif
{/* djs, basis, pis are available for non-MIP problems only for CPLEX;
for XPRESS, the returned values are for the optimal LP node
*/
_create_result_darray(vhandle, djspos, lpd->mac, &outdjs, &sol.djs);
_create_result_iarray(vhandle, cbasepos, lpd->mac, &outcbase, &sol.cbase);
}
/* allocate the row-wise arrays later as these may need to be expanded
with the addition cutpool constraints
*/
old_tg = TG;
_create_result_darray(vhandle, slackspos, lpd->mar, &outslacks, &sol.slacks);
#ifdef HAS_LIMITED_MIP_RESULTS
if (IsMIPProb(lpd->prob_type)) {
sol.pis = NULL;
sol.rbase = NULL;
} else
#endif
{
_create_result_iarray(vhandle, rbasepos, lpd->mar, &outrbase, &sol.rbase);
_create_result_darray(vhandle, pispos, lpd->mar, &outpis, &sol.pis);
}
sol.mac = lpd->mac;
Log6({
sol.sols = (double *) malloc(sizeof(double) * %d);\n\
sol.pis = (double *) malloc(sizeof(double) * %d);\n\
sol.slacks = (double *) malloc(sizeof(double) * %d);\n\
sol.djs = (double *) malloc(sizeof(double) * %d);\n\
sol.cbase = (int *) malloc(sizeof(int) * %d);
sol.rbase = (int *) malloc(sizeof(int) * %d);
}, lpd->mac, lpd->mar, lpd->mar, lpd->mac, lpd->mac, lpd->mar);
/* configure solver with timeout and solution methods
*/
if (cpx_prepare_solve(lpd, &meth,
#ifdef XPRESS
&sol,
#endif
DoubleVal(vtimeout,ttimeout)))
{
reset_rowcols(lpd, oldmar, lpd->mac);
Bip_Error(EC_EXTERNAL_ERROR);
}
meth.option_mipstart = vmipstart.nint;
/* if solution values are unavailable, and there are unadded cutpool
constraints, abort with RANGE_ERROR as we can't check for violations
*/
if (unadded_cnt > 0 && sol.sols == NULL)
{
reset_rowcols(lpd, oldmar, lpd->mac);
Bip_Error(RANGE_ERROR);
}
/*********************************************************************
* Solve Problem with the External Solver *
* depending on problem type, call the appropriate routine *
* may solve multiple times with cutpool constraints *
*********************************************************************/
do
{
int i;
violated_cnt = 0;
if (IsStructure(tdump))
{
cpx_write(lpd, file, format); /* ignore any errors here */
}
/* Run the solver
*/
if (cpx_solve(lpd, &meth, &sol, &bestbound, &worstbound))
{
if (has_cp) reset_rowcols(lpd, oldmar, lpd->mac);
Bip_Error(EC_EXTERNAL_ERROR);
}
#ifdef LOG_CALLS
Fprintf(log_output_, "\n}\nvoid step_%d() {\n", log_ctr++);
ec_flush(log_output_);
current_matno = -1; /* no current mat, exited from procedure */
#endif
/*********************************************************************
* Get Result from External Solver *
* Get the result for the optimisation from the external *
* solver if there is one *
*********************************************************************/
switch (lpd->descr_state)
{
case DESCR_SOLVED_SOL:
case DESCR_ABORTED_SOL:
add_cp_cstr = 1;
if (cpx_get_soln_state(lpd, &sol))
{
if (has_cp) reset_rowcols(lpd, oldmar, lpd->mac);
Bip_Error(EC_EXTERNAL_ERROR);
}
break;
case DESCR_SOLVED_NOSOL:
add_cp_cstr = 0;
/* no solution; state always fail */
#ifdef SUPPORT_IIS
{
pword *argp = &vhandle.ptr[iis_rowspos];
Dereference_(argp);
if (!IsRef(argp->tag))
{
int iis_nrows, iis_ncols;
int err;
pword * old_tg1;
pword iis_rowidxs, iis_colidxs, iis_colstats;
Find_Conflict(err, lpd->lp, iis_nrows, iis_ncols);
if (err)
{/* we can't simply abort here if an error occurs, just create dummy arrays
and do not proceed to try to get the IIS */
iis_nrows = 0;
iis_ncols = 0;
}
old_tg1 = TG;
iis_rowidxs.val.ptr = _create_iarray(iis_nrows);
iis_rowidxs.tag.kernel = TSTRG;
iis_colidxs.val.ptr = _create_iarray(iis_ncols);
iis_colidxs.tag.kernel = TSTRG;
iis_colstats.val.ptr = _create_carray(iis_ncols);
iis_colstats.tag.kernel = TSTRG;
if (!err && (_get_iis(lpd, &iis_nrows, &iis_ncols,
IArrayStart(iis_rowidxs.val.ptr), IArrayStart(iis_colidxs.val.ptr),
CArrayStart(iis_colstats.val.ptr))
!= 0)
)
{
/* something went wrong; reallocate iis arrays with 0 size */
TG = old_tg1;
iis_nrows = 0;
iis_ncols = 0;
iis_rowidxs.val.ptr = _create_iarray(0);
iis_colidxs.val.ptr = _create_iarray(0);
iis_colstats.val.ptr = _create_carray(0);
}
ec_assign(vhandle.ptr+iis_rowspos, iis_rowidxs.val, iis_rowidxs.tag);
ec_assign(vhandle.ptr+iis_colspos, iis_colidxs.val, iis_colidxs.tag);
ec_assign(vhandle.ptr+iis_colstatspos, iis_colstats.val, iis_colstats.tag);
}
}
#endif
break;
default:
{
#ifdef HAS_POSTSOLVE
int presolve; /* postsolve prob. if it is left in a presolved state */
if (XPRSgetintattrib(lpd->lp, XPRS_PRESOLVESTATE, &presolve))
{
if (presolve & 2) /* is in a presolve state */
CallN(XPRSpostsolve(lpd->lp)); /* post-solve problem if possible */
}
#endif
if (lpd->descr_state == DESCR_UNBOUNDED_NOSOL ||
lpd->descr_state == DESCR_UNKNOWN_NOSOL)
{/* no result this time, but add all cutpool constraints
and resolve may give a solution
*/
add_cp_cstr = 2;
} else
{/* no results, and adding more constraints will not improve the
situation */
add_cp_cstr = 0;
}
}}
#ifdef COIN
coin_reset_prob(lpd);
#endif
if (add_cp_cstr)
{
int zerobeg = 0, offset, nzcount, j;
double ftol;
Get_Feasibility_Tolerance(cpx_env, lpd, &ftol);
i = 0;
last_violated_idx = -1;
while (i < unadded_cnt)
{
if ((j = cp_unadded[i]) >= 0)
{
switch (cp_map2[j] = _cstr_state(lpd,j,add_cp_cstr,sol.sols,ftol))
{
case CSTR_STATE_VIOLATED:
violated_cnt++;
offset = lpd->cp_rmatbeg2[j];
nzcount = ( j < lpd->cp_nr2-1 ? lpd->cp_rmatbeg2[j+1] - offset : lpd->cp_nnz2 - offset);
CPXaddrows(cpx_env, lpd->lp, 0, 1, nzcount,
&(lpd->cp_rhsx2[j]), &(lpd->cp_senx2[j]),
&zerobeg, /* only one row */
&(lpd->cp_rmatind2[offset]),
&(lpd->cp_rmatval2[offset]), NULL, NULL);
lpd->mar++;
cp_map2[j] = lpd->cp_nact2++;
/* set last_violated_idx if it is not valid */
if (last_violated_idx < 0) last_violated_idx = i;
break;
case CSTR_STATE_SAT: /* satisfied, but not binding */
case CSTR_STATE_BINDING: /* satisfied and binding */
if (last_violated_idx >= 0)
{
cp_unadded[last_violated_idx] = last_violated_idx - i;
last_violated_idx = -1;
}
break;
case CSTR_STATE_INVALID: /* error */
Bip_Error(RANGE_ERROR);
break;
}
i++;
} else
{/* j < 0 : j is -displacement to unadded cstr */
i -= j;
}
}
if (last_violated_idx >= 0) cp_unadded[last_violated_idx] = last_violated_idx- i;
if (violated_cnt > 0)
{
Mark_Copy_As_Modified(lpd);
TG = old_tg; /* reallocate row-wise result arrays */
if (sol.slacks != NULL)
_create_result_darray(vhandle, slackspos, lpd->mar, &outslacks, &sol.slacks);
if (sol.rbase != NULL)
_create_result_iarray(vhandle, rbasepos, lpd->mar, &outrbase, &sol.rbase);
if (sol.pis != NULL)
_create_result_darray(vhandle, pispos, lpd->mar, &outpis, &sol.pis);
}
} /* if (add_cp_cstr) */
} while (violated_cnt > 0); /* do ... */
Request_Unify_Integer(vres, tres, lpd->descr_state);
Request_Unify_Integer(vstat, tstat, lpd->sol_state);
/* (-)HUGE_VAL is used for the maximum best/worst bound instead of
(-)CPX_INFBOUND because:
1) The objective value can exceed CPX_INFBOUND
2) We use 1.0Inf at the ECLiPSe level for unbounded objective
value
Note worst and best bounds are unified even for failure case
(for use in any future failure handler)
*/
Request_Unify_Float(vworst, tworst, worstbound);
Request_Unify_Float(vbest, tbest, bestbound);
if (add_cp_cstr == 1)
{/* have results */
if (sol.sols != NULL)
ec_assign(vhandle.ptr+solspos, outsols.val, outsols.tag);
if (sol.pis != NULL)
ec_assign(vhandle.ptr+pispos, outpis.val, outpis.tag);
if (sol.slacks != NULL)
ec_assign(vhandle.ptr+slackspos, outslacks.val, outslacks.tag);
if (sol.djs != NULL)
ec_assign(vhandle.ptr+djspos, outdjs.val, outdjs.tag);
if (sol.cbase != NULL)
ec_assign(vhandle.ptr+cbasepos, outcbase.val, outcbase.tag);
if (sol.rbase != NULL)
ec_assign(vhandle.ptr+rbasepos, outrbase.val, outrbase.tag);
}
else
{
pword pw;
/* no solution; reset arrays as these states might not fail */
Make_Nil(&pw);
if (sol.sols != NULL)
ec_assign(vhandle.ptr+solspos, pw.val, pw.tag);
if (sol.pis != NULL)
ec_assign(vhandle.ptr+pispos, pw.val, pw.tag);
if (sol.slacks != NULL)
ec_assign(vhandle.ptr+slackspos, pw.val, pw.tag);
if (sol.djs != NULL)
ec_assign(vhandle.ptr+djspos, pw.val, pw.tag);
if (sol.cbase != NULL)
ec_assign(vhandle.ptr+cbasepos, pw.val, pw.tag);
if (sol.rbase != NULL)
ec_assign(vhandle.ptr+rbasepos, pw.val, pw.tag);
}
if (has_cp) reset_rowcols(lpd, oldmar, lpd->mac);
Return_Unify;
}
int
p_cpx_loadbase(value vlp, type tlp, value vcarr, type tcarr, value vrarr, type trarr)
{
lp_desc *lpd;
int res;
Check_Array(tcarr);
Check_Array(trarr);
LpDesc(vlp, tlp, lpd);
SetPreSolve(lpd->presolve);
if (lpd->mac == IArraySize(vcarr.ptr) && lpd->mar == IArraySize(vrarr.ptr)) {
/* Finx b58: only load basis if current row/col == array sizes */
#ifdef LOG_CALLS
Fprintf(log_output_, "\niloadbasis(...);");
#endif
res = CPXcopybase(cpx_env, lpd->lp, IArrayStart(vcarr.ptr), IArrayStart(vrarr.ptr));
if (res != 0) { Bip_Error(EC_EXTERNAL_ERROR); }
}
Succeed;
}
#ifdef COIN
int
p_cpx_loadorder(value vlp, type tlp, value vn, type tn, value vl, type tl)
{
Succeed;
}
#else
int
p_cpx_loadorder(value vlp, type tlp, value vn, type tn, value vl, type tl)
{
lp_desc *lpd;
int *idx, *prio;
#ifdef CPLEX
int *bdir;
#endif
#ifdef XPRESS
char *bdir;
#endif
int i, res;
pword *buf = TG;
Check_Integer(tn);
if (vn.nint <= 0) Succeed; /* no need to load anything */
LpDesc(vlp, tlp, lpd);
Push_Buffer(vn.nint*3*sizeof(int));
idx = (int*) BufferStart(buf);
prio = (int*) (BufferStart(buf) + vn.nint*sizeof(int));
#ifdef CPLEX
bdir = (int*) (BufferStart(buf) + vn.nint*2*sizeof(int));
#endif
#ifdef XPRESS
bdir = (char*) (BufferStart(buf) + vn.nint*2*sizeof(int));
#endif
i = 0;
while (IsList(tl))
{
pword *car = vl.ptr;
pword *cdr = car + 1;
pword *pw;
Dereference_(car);
Check_Structure(car->tag);
if (DidArity(car->val.ptr->val.did) != 3)
{ Bip_Error(RANGE_ERROR); }
pw = car->val.ptr + 1; /* colindex */
Dereference_(pw);
idx[i] = pw->val.nint;
pw = car->val.ptr + 2; /* priority */
Dereference_(pw);
prio[i] = pw->val.nint;
pw = car->val.ptr + 3; /* direction */
Dereference_(pw);
#ifdef CPLEX
bdir[i] = pw->val.nint;
#endif
#ifdef XPRESS
bdir[i] = pw->val.nint == 1 ? 'D' : pw->val.nint == 2 ? 'U' : 'N';
#endif
++i;
Dereference_(cdr);
tl = cdr->tag;
vl = cdr->val;
}
Check_List(tl);
if (i != vn.nint)
{ Bip_Error(RANGE_ERROR); }
#ifdef LOG_CALLS
Fprintf(log_output_, "\nloaddir(...);"); ec_flush(log_output_);
#endif
SetPreSolve(lpd->presolve);
res = CPXcopyorder(cpx_env, lpd->lp, i, idx, prio, bdir);
TG = buf; /* pop aux arrays */
if (res != 0) { Bip_Error(EC_EXTERNAL_ERROR); }
Succeed;
}
#endif
/*
* Add SOSs from descriptor arrays to solver
*/
int
p_cpx_flush_sos(value vhandle, type thandle)
{
#ifdef HAS_NO_ADDSOS
Bip_Error(UNIMPLEMENTED);
#else
lp_desc *lpd;
untrail_data udata;
Check_Structure(thandle);
LpDesc(vhandle.ptr[HANDLE_CPH].val, vhandle.ptr[HANDLE_CPH].tag, lpd);
if (lpd->nsos <= lpd->nsos_added)
Succeed;
#if defined(CPLEX) && CPLEX < 10
if (CPXaddsos(cpx_env, lpd->lp, lpd->nsos, lpd->nsosnz, lpd->sostype,
NULL, lpd->sosbeg, lpd->sosind, lpd->sosref))
#else
if (CPXaddsos(cpx_env, lpd->lp, lpd->nsos, lpd->nsosnz, lpd->sostype,
lpd->sosbeg, lpd->sosind, lpd->sosref, NULL))
#endif
{
Bip_Error(EC_EXTERNAL_ERROR);
}
udata.oldmac = lpd->macadded;
udata.oldmar = lpd->mar;
udata.oldsos = lpd->nsos_added;
udata.oldidc = lpd->nidc;
ec_trail_undo(_cpx_del_rowcols, vhandle.ptr, vhandle.ptr+HANDLE_STAMP, (word*) &udata, NumberOfWords(untrail_data), TRAILED_WORD32);
lpd->nsos_added = lpd->nsos;
/* could free/resize arrays here */
Succeed;
#endif
}
/*
* Set up SOS arrays in descriptor
*/
int
p_cpx_add_new_sos(value vlp, type tlp,
value vsostype, type tsostype, /* 1 or 2 */
value vn, type tn, /* member count */
value vl, type tl) /* member list */
{
lp_desc *lpd;
double weight;
int i, nnewsos;
Check_Integer(tsostype);
Check_Integer(tn);
LpDescOnly(vlp, tlp, lpd);
if (vn.nint <= vsostype.nint)
Succeed; /* return immediately if sos set is trivial */
/* the temporary array index of the new SOS */
nnewsos = lpd->nsos - lpd->nsos_added;
++lpd->nsos;
if (nnewsos+1 >= lpd->sossz)
{
/* allocate enough space for the new sos */
/* CAUTION: in this array must have at least nnewsos+1 elements !!! */
if (lpd->sossz == 0)
{
lpd->sossz = NEWSOS_INCR;
lpd->sosbeg = (int *) Malloc(NEWSOS_INCR*sizeof(int));
}
else
{
lpd->sossz += NEWSOS_INCR;
lpd->sosbeg = (int *) Realloc(lpd->sosbeg, lpd->sossz*sizeof(int));
}
}
lpd->sosbeg[nnewsos] = lpd->nsosnz;
lpd->sosbeg[nnewsos+1] = lpd->nsosnz + vn.nint;
/* allocate enough space for the sos members */
i = lpd->nsosnz;
lpd->nsosnz += vn.nint;
if (lpd->nsosnz > lpd->sosnzsz)
{
if (lpd->sosnzsz == 0)
{
lpd->sosnzsz = RoundTo(lpd->nsosnz, 512);
lpd->sostype = (sostype_t *) Malloc(lpd->sosnzsz*sizeof(sostype_t));
lpd->sosind = (int *) Malloc(lpd->sosnzsz*sizeof(int));
lpd->sosref = (double *) Malloc(lpd->sosnzsz*sizeof(double));
}
else
{
lpd->sosnzsz = RoundTo(lpd->nsosnz, 512);
lpd->sostype = (sostype_t *) Realloc(lpd->sostype, lpd->sosnzsz*sizeof(sostype_t));
lpd->sosind = (int *) Realloc(lpd->sosind, lpd->sosnzsz*sizeof(int));
lpd->sosref = (double *) Realloc(lpd->sosref, lpd->sosnzsz*sizeof(double));
}
}
for (weight = 1.0; IsList(tl); weight += 1.0, ++i)
{
pword *car = vl.ptr;
pword *cdr = car + 1;
Dereference_(car);
if (!IsInteger(car->tag))
{ Bip_Error(TYPE_ERROR); }
lpd->sostype[i] = vsostype.nint==1 ? SOLVER_SOS_TYPE1 : SOLVER_SOS_TYPE2;
lpd->sosind[i] = (int) car->val.nint;
lpd->sosref[i] = weight;
Dereference_(cdr);
tl = cdr->tag;
vl = cdr->val;
}
Check_List(tl);
if (i != lpd->nsosnz)
{ Bip_Error(RANGE_ERROR); }
Succeed;
}
int
p_cpx_get_objval(value vlp, type tlp, value v, type t)
{
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
Return_Unify_Float(v, t, lpd->objval);
}
#if 0 /* not used */
int
p_cpx_get_coef(value vlp, type tlp,
value vi, type ti,
value vj, type tj,
value vc, type tc)
{
#ifdef CPLEX
lp_desc *lpd;
double d;
LpDesc(vlp, tlp, lpd);
SetPreSolve(lpd->presolve);
Check_Integer(ti);
Check_Integer(tj);
if (vi.nint >= lpd->mar || vj.nint >= lpd->mac) { Bip_Error(RANGE_ERROR); }
CPXupdatemodel(lpd->lp); /* before CPXget... */
if (CPXgetcoef(cpx_env, lpd->lp, vi.nint, vj.nint, &d) != 0)
{ Bip_Error(EC_EXTERNAL_ERROR); }
Return_Unify_Float(vc, tc, d);
#else
Bip_Error(UNIMPLEMENTED);
#endif
}
#endif
/*
* Retrieve the matrix coefficients:
* - First call cplex_get_row(+CPH, +CType, +I, -Base) which
* prepares for retrieval of row i of constraint type CType:
* normal constraints:
* retrieves the coefficients of row I into the rmatind/rmatval
* arrays
* cutpool constraints:
* setup lpd->nnz to the non-zero size for row i, and set Base
* to the offset to coefficients for row i in the appropriate
* rmatind/rmatval arrays
* - Then call cplex_get_col_coef(+CPH, +CType, +Base, -J, -C) which returns
* one nonzero column J and the corresponding coefficient C. Successive
* calls return the other nonzero columns in decreasing order. When no
* nonzero column is left, cplex_get_col_coef/3 fails. The row number is
* the one given in the preceding cpx_get_row/2 call. */
int
p_cpx_get_row(value vlp, type tlp, value vpool, type tpool,
value vi, type ti, value vbase, type tbase)
{
lp_desc *lpd;
int base;
LpDesc(vlp, tlp, lpd);
Check_Integer(ti);
CPXupdatemodel(lpd->lp); /* before CPXget... */
switch (vpool.nint)
{
case CSTR_TYPE_NORM:
{
int ncols;
int rmatbeg[2];
#ifdef CPLEX
int surplus;
#endif
base = 0; /* read one constraint only */
ncols = lpd->mac;
if (ncols > lpd->nnz_sz) /* allocate/grow arrays */
{
if (lpd->nnz_sz == 0)
{
lpd->nnz_sz = ncols;
lpd->rmatind = (int *) Malloc(ncols*sizeof(int));
lpd->rmatval = (double *) Malloc(ncols*sizeof(double));
}
else
{
lpd->nnz_sz = ncols;
lpd->rmatind = (int *) Realloc(lpd->rmatind, ncols*sizeof(int));
lpd->rmatval = (double *) Realloc(lpd->rmatval, ncols*sizeof(double));
}
}
SetPreSolve(lpd->presolve);
/* note that for COIN, CPXgetrows maps to coin_getrow, which gets
one row only
*/
if (
CPXgetrows(cpx_env, lpd->lp, &lpd->nnz, rmatbeg, lpd->rmatind,
lpd->rmatval, lpd->nnz_sz, &surplus, vi.nint, vi.nint)
)
{ Bip_Error(EC_EXTERNAL_ERROR); }
break;
}
/*
case CSTR_TYPE_PERMCP:
base = lpd->cp_rmatbeg[vi.nint];
lpd->nnz = (vi.nint == lpd->cp_nr-1 ? lpd->cp_nnz-base : lpd->cp_rmatbeg[vi.nint+1]-base);
break;
*/
case CSTR_TYPE_CONDCP:
base = lpd->cp_rmatbeg2[vi.nint];
lpd->nnz = (vi.nint == lpd->cp_nr2-1 ? lpd->cp_nnz2-base : lpd->cp_rmatbeg2[vi.nint+1]-base);
break;
default:
Bip_Error(RANGE_ERROR);
break;
}
Return_Unify_Integer(vbase, tbase, base);
}
/* returns the coeff vc for vj'th argument of the Prolog variable array
NOTE: assumes variable array created from a list in reverse column order
*/
int
p_cpx_get_col_coef(value vlp, type tlp, value vpool, type tpool,
value vbase, type tbase,
value vj, type tj, value vc, type tc)
{
int i;
lp_desc *lpd;
Prepare_Requests
LpDescOnly(vlp, tlp, lpd);
if (lpd->nnz == 0)
{ Fail; }
--lpd->nnz;
i = vbase.nint + lpd->nnz;
switch (vpool.nint)
{
/*
case CSTR_TYPE_PERMCP:
Request_Unify_Integer(vj, tj, (lpd->mac+SOLVER_MAT_BASE - lpd->cp_rmatind[i]));
Request_Unify_Float(vc, tc, lpd->cp_rmatval2[i]);
break;
*/
case CSTR_TYPE_CONDCP:
Request_Unify_Integer(vj, tj, (lpd->mac+SOLVER_MAT_BASE - lpd->cp_rmatind2[i]));
Request_Unify_Float(vc, tc, lpd->cp_rmatval2[i]);
break;
case CSTR_TYPE_NORM:
Request_Unify_Integer(vj, tj, (lpd->mac+SOLVER_MAT_BASE - lpd->rmatind[i]));
Request_Unify_Float(vc, tc, lpd->rmatval[i]);
break;
default:
Bip_Error(RANGE_ERROR);
}
Return_Unify;
}
int
p_cpx_get_obj_coef(value vlp, type tlp, value vj, type tj, value vc, type tc)
{
lp_desc *lpd;
double d[1];
Check_Integer(tj);
LpDesc(vlp, tlp, lpd);
if (vj.nint >= lpd->mac) { Bip_Error(RANGE_ERROR); }
SetPreSolve(lpd->presolve);
CPXupdatemodel(lpd->lp); /* before CPXget... */
if (CPXgetobj(cpx_env, lpd->lp, d, (int) vj.nint, (int) vj.nint) != 0)
{ Bip_Error(EC_EXTERNAL_ERROR); }
Return_Unify_Float(vc, tc, d[0]);
}
/*----------------------------------------------------------------------*
* Global stack arrays (used for answer vectors)
*----------------------------------------------------------------------*/
int
p_create_darray(value vi, type ti, value varr, type tarr)
{
pword *pbuf;
Check_Integer(ti);
pbuf = _create_darray(vi.nint);
Return_Unify_String(varr, tarr, pbuf);
}
static pword *
_create_carray(int i)
{
pword *pbuf = TG;
Push_Buffer(i*sizeof(char) + 1);
return pbuf;
}
static pword *
_create_darray(int i)
{
pword *pbuf = TG;
Push_Buffer(i*sizeof(double) + 1);
return pbuf;
}
static pword *
_create_iarray(int i)
{
pword *pbuf = TG;
Push_Buffer(i*sizeof(int) + 1);
return pbuf;
}
int
p_darray_size(value varr, type tarr, value vi, type ti)
{
Check_Array(tarr);
Return_Unify_Integer(vi, ti, DArraySize(varr.ptr));
}
int
p_get_darray_element(value varr, type tarr, value vi, type ti, value vel, type tel)
{
double f;
Check_Array(tarr);
Check_Integer(ti);
/* RANGE_ERROR if vi.nint is negative -- as it is a large unsigned */
if ((unsigned) vi.nint >= DArraySize(varr.ptr))
{ Bip_Error(RANGE_ERROR); }
f = ((double *) BufferStart(varr.ptr))[vi.nint];
Return_Unify_Float(vel, tel, f);
}
int
p_set_darray_element(value varr, type tarr, value vi, type ti, value vel, type tel)
{
Check_Array(tarr);
Check_Integer(ti);
Check_Float(tel);
Check_Number(tel);
if ((unsigned) vi.nint >= DArraySize(varr.ptr))
{ Bip_Error(RANGE_ERROR); }
if (GB <= varr.ptr && varr.ptr < TG)
{
((double *) BufferStart(varr.ptr))[vi.nint] = DoubleVal(vel, tel);
Succeed;
}
else /* nondeterministic */
{
Bip_Error(UNIMPLEMENTED);
}
}
int
p_darray_list(value varr, type tarr, value vmr, type tmr, value vlst, type tlst)
{
pword list;
pword *car;
pword *cdr = &list;
unsigned i;
Check_Array(tarr);
Check_Integer(tmr);
if (vmr.nint > DArraySize(varr.ptr)) Bip_Error(RANGE_ERROR);
for (i = 0; i < vmr.nint; ++i)
{
car = TG;
Push_List_Frame();
Make_List(cdr, car);
Make_Float(car, ((double *) BufferStart(varr.ptr))[i]);
cdr = car + 1;
}
Make_Nil(cdr);
Return_Unify_Pw(vlst, tlst, list.val, list.tag);
}
/* returns the base (start) of the solver matrix (0 or 1) */
int
p_cpx_matrix_base(value vbase, type tbase)
{
Return_Unify_Integer(vbase, tbase, SOLVER_MAT_BASE);
}
int
p_cpx_matrix_offset(value voff, type toff)
{
Return_Unify_Integer(voff, toff, SOLVER_MAT_OFFSET);
}
/*----------------------------------------------------------------------*
* CutPools
*----------------------------------------------------------------------*/
/* cutpools implemented using the rowwise representation of a problem
used by CPLEX and Xpress. These are then added to the problem before
optimisation. There two types of cutpools: unconditional and
conditional, each representing by its own data structures in the handle.
Rows in the conditional cutpool have a `name' associated with them, which
group the rows into different virtual pools. These virtual pools correspond
conceptually to the different cutpools in a MP solver
*/
int
p_cpx_get_cutpool_size(value vlp, type tlp, value vnr, type tnr, value vnnz, type tnnz)
{
lp_desc *lpd;
Prepare_Requests
LpDescOnly(vlp, tlp, lpd);
Request_Unify_Integer(vnr, tnr, lpd->cp_nr2);
Request_Unify_Integer(vnnz, tnnz, lpd->cp_nnz2);
Return_Unify;
}
int
p_cpx_reset_cutpool_size(value vlp, type tlp,
value vnr, type tnr, value vnnz, type tnnz)
{
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(tnr);
Check_Integer(tnnz);
if (vnr.nint > lpd->cp_nr2 || vnr.nint < 0) {Bip_Error(RANGE_ERROR);}
lpd->cp_nr2 = vnr.nint;
if (vnnz.nint > lpd->cp_nnz2 || vnnz.nint < 0) {Bip_Error(RANGE_ERROR);}
lpd->cp_nnz2 = vnnz.nint;
Succeed;
}
int
p_cpx_set_cpcstr_cond(value vlp, type tlp, value vidx, type tidx,
value vtype, type ttype, value vc, type tc)
{
int i;
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(tidx);
Check_Integer(ttype);
Check_Integer(tc);
if (vidx.nint < 0 || vidx.nint >= lpd->cp_nr2) { Bip_Error(RANGE_ERROR); }
switch (vtype.nint)
{
case CP_ACTIVE: /* active state */
if (vc.nint != 0 && vc.nint != 1) { Bip_Error(RANGE_ERROR); }
lpd->cp_active2[vidx.nint] = (char) vc.nint;
break;
case CP_ADDINIT: /* add initially */
if (vc.nint != 0 && vc.nint != 1) { Bip_Error(RANGE_ERROR); }
lpd->cp_initial_add2[vidx.nint] = (char) vc.nint;
break;
default:
Bip_Error(RANGE_ERROR);
break;
}
Succeed;
}
int
p_cpx_init_cpcstr(value vlp, type tlp, value vidx, type tidx, value vgrp, type tgrp,
value vact, type tact, value vinit_add, type tinit_add)
{
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(tidx);
Check_Integer(tgrp);
Check_Integer(tact);
Check_Integer(tinit_add);
lpd->cp_initial_add2[vidx.nint] = (char) vinit_add.nint;
lpd->cp_active2[vidx.nint] = (char) vact.nint;
if (lpd->cp_pools_max2[vgrp.nint] >= lpd->cp_pools_sz2[vgrp.nint])
{
lpd->cp_pools_sz2[vgrp.nint] += NEWROW_INCR;
lpd->cp_pools2[vgrp.nint] = (int *) Realloc(lpd->cp_pools2[vgrp.nint],lpd->cp_pools_sz2[vgrp.nint]*sizeof(int));
}
lpd->cp_pools2[vgrp.nint][lpd->cp_pools_max2[vgrp.nint]++] = vidx.nint;
return PSUCCEED;
}
#define Expand_Named_CutPool_Arrays(lpd, n) { \
int sz = lpd->cp_npools_sz2 += CUTPOOL_INCR; \
/* expand the arrays */\
lpd->cp_pools2 = (int **) Realloc(lpd->cp_pools2,sz*sizeof(int *));\
lpd->cp_pools_max2 = (int *) Realloc(lpd->cp_pools_max2,sz*sizeof(int));\
lpd->cp_pools_sz2 = (int *) Realloc(lpd->cp_pools_sz2,sz*sizeof(int));\
lpd->cp_names2 = (char **) Realloc(lpd->cp_names2,sz*sizeof(char *));\
for (i = n+1; i < sz; i++) \
{ /* initialise the new elements (except n - which will be filled \
by Create_New_CutPool) */\
lpd->cp_pools2[i] = NULL;\
lpd->cp_names2[i] = NULL; \
lpd->cp_pools_max2[i] = 0;\
lpd->cp_pools_sz2[i] = 0;\
}\
}
#define Create_New_CutPool(lpd, n, name) { \
lpd->cp_pools_sz2[n] = NEWROW_INCR; \
lpd->cp_pools_max2[n] = 0; \
lpd->cp_pools2[n] = Malloc(NEWROW_INCR*sizeof(int)); \
lpd->cp_names2[n] = Malloc((strlen(name)+1)*sizeof(char)); \
strcpy(lpd->cp_names2[n], name); \
}
int
p_cpx_get_named_cp_index(value vlp, type tlp, value vname, type tname,
value vnew, type tnew, value vidx, type tidx)
{
int i, n;
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(tnew);
if (lpd->cp_npools_sz2 == 0)
{/* create the default group the first time we use the named groups */
lpd->cp_npools2 = 1;
Expand_Named_CutPool_Arrays(lpd, 0);
Create_New_CutPool(lpd, 0, "[]");
}
if (IsNil(tname)) i = 0; /* default group */
else
{/* user defined named group */
Check_Atom(tname);
for(i=1; i < lpd->cp_npools2; ++i)
{
if (strcmp(lpd->cp_names2[i], DidName(vname.did)) == 0) break;
}
if (i == lpd->cp_npools2)
{/* name was not found */
if (vnew.nint == 0) { Fail; } /* don't create new group */
else if ((n = lpd->cp_npools2++) >= lpd->cp_npools_sz2)
{
Expand_Named_CutPool_Arrays(lpd, n);
}
Create_New_CutPool(lpd, n, DidName(vname.did));
}
}
Return_Unify_Integer(vidx, tidx, i);
}
int
p_cpx_get_cpcstr_info(value vlp, type tlp, value vidx, type tidx,
value vitype, type titype, value vval, type tval)
{
int i, val;
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(titype);
Check_Integer(tidx);
if (vidx.nint < 0 || vidx.nint >= lpd->cp_nr2) { Bip_Error(RANGE_ERROR);}
switch (vitype.nint)
{
case CP_ACTIVE: /* active state */
val = (int) lpd->cp_active2[vidx.nint];
break;
case CP_ADDINIT:
val = (int) lpd->cp_initial_add2[vidx.nint];
break;
default:
Bip_Error(RANGE_ERROR);
break;
}
Return_Unify_Integer(vval, tval, val);
}
int
p_cpx_get_named_cpcstr_indices(value vlp, type tlp, value vpidx, type tpidx,
value vilst, type tilst)
{
int i;
pword list;
pword * head, * next = &list;
lp_desc *lpd;
LpDescOnly(vlp, tlp, lpd);
Check_Integer(tpidx);
if (vpidx.nint < 0 || vpidx.nint >= lpd->cp_npools2) Bip_Error(RANGE_ERROR);
for (i=0; i < lpd->cp_pools_max2[vpidx.nint]; i++)
{
head = TG;
Push_List_Frame();
Make_List(next, head);
Make_Integer(head, lpd->cp_pools2[vpidx.nint][i]);
next = head + 1;
}
Make_Nil(next);
Return_Unify_Pw(vilst, tilst, list.val, list.tag);
}
/*----------------------------------------------------------------------*
* Extending basis matrices
*----------------------------------------------------------------------*/
int
p_create_extended_iarray(value varr, type tarr, value vi, type ti, value vxarr, type txarr)
{
pword *pbuf;
Check_Integer(ti);
Check_Array(tarr);
pbuf = _create_iarray(vi.nint + IArraySize(varr.ptr));
Return_Unify_String(vxarr, txarr, pbuf);
}
int
p_create_extended_darray(value varr, type tarr, value vi, type ti, value vxarr, type txarr)
{
pword *pbuf;
Check_Integer(ti);
Check_Array(tarr);
pbuf = _create_darray(vi.nint + DArraySize(varr.ptr));
Return_Unify_String(vxarr, txarr, pbuf);
}
int
p_decode_basis(value varr, type tarr, value vout, type tout)
{
int i,n;
int *v;
pword *pw = TG;
Check_Array(tarr);
v = IArrayStart(varr.ptr);
n = IArraySize(varr.ptr);
Push_Struct_Frame(Did("[]",n));
for (i = 0; i < n; ++i)
{
Make_Integer(&pw[i+1], v[i]);
}
Return_Unify_Structure(vout, tout, pw);
}
int
p_copy_extended_column_basis(value varr, type tarr, value vlos, type tlos,
value vhis, type this, value vxarr, type txarr)
{
unsigned i;
int *v;
int *vx;
Check_Array(tarr);
Check_Array(txarr);
Check_List(tlos);
Check_List(this);
v = IArrayStart(varr.ptr);
vx = IArrayStart(vxarr.ptr);
/*
* Note that this assumes the basis status array contains
* the status of the problem variables (columns) only
* and not the status of the slack variables (rows).
* We want to add status for the new columns so we must:
* 1) copy the existing variables' status
* 2) add the CPX_COL_FREE_SUPER status for the new columns
*/
for (i = 0; i < IArraySize(varr.ptr); ++i)
{
vx[i] = v[i];
}
for (i = IArraySize(varr.ptr); i < IArraySize(vxarr.ptr); ++i)
{
if (IsList(tlos) && IsList(this))
{
double lo, hi;
pword *car = vlos.ptr;
pword *cdr = car + 1;
Dereference_(car); Check_Double(car->tag);
lo = Dbl(car->val);
Dereference_(cdr); tlos = cdr->tag; vlos = cdr->val;
car = vhis.ptr;
cdr = car + 1;
Dereference_(car); Check_Double(car->tag);
hi = Dbl(car->val);
Dereference_(cdr); this = cdr->tag; vhis = cdr->val;
/* The following are the settings determined by experimentation */
if (hi <= 0.0)
vx[i] = CPX_COL_AT_UPPER;
else if (lo > -CPX_INFBOUND)
vx[i] = CPX_COL_AT_LOWER;
else
vx[i] = CPX_COL_FREE_SUPER;
}
else { Bip_Error(TYPE_ERROR); }
}
Check_Nil(tlos);
Succeed;
}
int
p_copy_extended_arrays(value vbarr, type tbarr, value vsarr, type tsarr, value vdarr, type tdarr, value vxbarr, type txbarr, value vxsarr, type txsarr, value vxdarr, type txdarr)
{
int i;
int *vb;
int *vxb;
double *vs;
double *vxs;
double *vd;
double *vxd;
Check_Array(tbarr);
Check_Array(tsarr);
Check_Array(tdarr);
Check_Array(txbarr);
Check_Array(txsarr);
Check_Array(txdarr);
vb = IArrayStart(vbarr.ptr);
vxb = IArrayStart(vxbarr.ptr);
vs = DArrayStart(vsarr.ptr);
vxs = DArrayStart(vxsarr.ptr);
vd = DArrayStart(vdarr.ptr);
vxd = DArrayStart(vxdarr.ptr);
/*
* Note that this assumes the basis status array contains
* the status of the problem variables (columns) only
* and not the status of the slack variables (rows).
* We want to add status for the new columns so we must:
* 1) copy the existing variables' status, solution value
* 2) add the CPX_COL_FREE_SUPER status, 0.0 solution value
* and 0.0 reduced cost for the new columns
*/
for (i = 0; i < IArraySize(vbarr.ptr); ++i)
{
vxb[i] = vb[i];
vxs[i] = vs[i];
vxd[i] = vd[i];
}
for (i = IArraySize(vbarr.ptr); i < IArraySize(vxbarr.ptr); ++i)
{
vxb[i] = CPX_COL_FREE_SUPER;
vxs[i] = 0.0;
vxd[i] = 0.0;
}
Succeed;
}
/*----------------------------------------------------------------------*
* Accessing iarrays
*----------------------------------------------------------------------*/
int
p_create_iarray(value vi, type ti, value varr, type tarr)
{
pword *pbuf;
Check_Integer(ti);
pbuf = _create_iarray(vi.nint);
Return_Unify_String(varr, tarr, pbuf);
}
int
p_iarray_size(value varr, type tarr, value vi, type ti)
{
Check_Array(tarr);
Return_Unify_Integer(vi, ti, IArraySize(varr.ptr));
}
int
p_get_iarray_element(value varr, type tarr, value vi, type ti, value vel, type tel)
{
int i;
Check_Array(tarr);
Check_Integer(ti);
if ((unsigned) vi.nint >= IArraySize(varr.ptr))
{ Bip_Error(RANGE_ERROR); }
i = ((int *) BufferStart(varr.ptr))[vi.nint];
Return_Unify_Integer(vel, tel, i);
}
int
p_set_iarray_element(value varr, type tarr, value vi, type ti, value vel, type tel)
{
Check_Array(tarr);
Check_Integer(ti);
Check_Integer(tel);
if ((unsigned) vi.nint >= IArraySize(varr.ptr))
{ Bip_Error(RANGE_ERROR); }
if (GB <= varr.ptr && varr.ptr < TG)
{
((int *) BufferStart(varr.ptr))[vi.nint] = vel.nint;
Succeed;
}
else /* nondeterministic */
{
Bip_Error(UNIMPLEMENTED);
}
}
int
p_iarray_list(value varr, type tarr, value vlst, type tlst)
{
pword list;
pword *car;
pword *cdr = &list;
unsigned i;
Check_Array(tarr);
for (i = 0; i < IArraySize(varr.ptr); ++i)
{
car = TG;
Push_List_Frame();
Make_List(cdr, car);
Make_Integer(car, ((int *) BufferStart(varr.ptr))[i]);
cdr = car + 1;
}
Make_Nil(cdr);
Return_Unify_Pw(vlst, tlst, list.val, list.tag);
}
#ifdef DUMPMAT
int
dump_problem(lp_desc * lpd)
{
int i;
Fprintf(log_output_, "\n\
lpd->macsz = %d;\n\
lpd->marsz = %d;\n\
lpd->matnz = %d;\n\
lpd->mac = %d;\n\
lpd->mar = %d;\n\
lpd->rhsx = a_rhsx;\n\
lpd->senx = a_senx;\n\
lpd->matbeg = a_matbeg;\n\
lpd->matcnt = a_matcnt;\n\
lpd->matind = a_matind;\n\
lpd->matval = a_matval;\n\
lpd->bdl = a_bdl;\n\
lpd->bdu = a_bdu;\n\
lpd->objx = a_objx;\n\
lpd->ctype = a_ctype;",
lpd->macsz, lpd->marsz, lpd->matnz,
lpd->mac, lpd->mar);
Fprintf(log_output_, "\n\
/*\n\
* Problem data\n\
*/\n\
");
Fprintf(log_output_, "double a_objx[%d] ={\n", lpd->mac);
for (i=0; i<lpd->mac; ++i)
Fprintf(log_output_, "%.15e,\n", lpd->objx[i]);
Fprintf(log_output_, "};\n\n");
Fprintf(log_output_, "double a_bdl[%d] ={\n", lpd->mac);
for (i=0; i<lpd->mac; ++i)
Fprintf(log_output_, "%.15e,\n", lpd->bdl[i]);
Fprintf(log_output_, "};\n\n");
Fprintf(log_output_, "double a_bdu[%d] ={\n", lpd->mac);
for (i=0; i<lpd->mac; ++i)
Fprintf(log_output_, "%.15e,\n", lpd->bdu[i]);
Fprintf(log_output_, "};\n\n");
Fprintf(log_output_, "int a_matbeg[%d] ={\n", lpd->mac);
for (i=0; i<lpd->mac; ++i)
Fprintf(log_output_, "%d,\n", lpd->matbeg[i]);
Fprintf(log_output_, "};\n\n");
Fprintf(log_output_, "int a_matcnt[%d] ={\n", lpd->mac);
for (i=0; i<lpd->mac; ++i)
Fprintf(log_output_, "%d,\n", lpd->matcnt[i]);
Fprintf(log_output_, "};\n\n");
Fprintf(log_output_, "char a_ctype[%d] ={\n", lpd->mac);
for (i=0; i<lpd->mac; ++i)
Fprintf(log_output_, "'%c',\n", lpd->ctype[i]);
Fprintf(log_output_, "};\n\n");
Fprintf(log_output_, "double a_rhsx[%d] ={\n", lpd->mar);
for (i=0; i<lpd->mar; ++i)
Fprintf(log_output_, "%.15e,\n", lpd->rhsx[i]);
Fprintf(log_output_, "};\n\n");
Fprintf(log_output_, "char a_senx[%d] ={\n", lpd->mar);
for (i=0; i<lpd->mar; ++i)
Fprintf(log_output_, "'%c',\n", lpd->senx[i]);
Fprintf(log_output_, "};\n\n");
Fprintf(log_output_, "int a_matind[%d] ={\n", lpd->matnz);
for (i=0; i<lpd->matnz; ++i)
Fprintf(log_output_, "%d,\n", lpd->matind[i]);
Fprintf(log_output_, "};\n\n");
Fprintf(log_output_, "double a_matval[%d] ={\n", lpd->matnz);
for (i=0; i<lpd->matnz; ++i)
Fprintf(log_output_, "%.15e,\n", lpd->matval[i]);
Fprintf(log_output_, "};\n\n");
Fprintf(log_output_, "\n\
/*\n\
* End data\n\
*/\n\
");
# if 0
Fprintf(log_output_, "\n\
lpd->cb_sz = %d;\n\
lpd->cb_index = a_cb_index;\n\
lpd->cb_index2 = a_cb_index2;\n\
lpd->cb_value = a_cb_value;\n\
lpd->cb_cnt = %d;",
lpd->cb_cnt, lpd->cb_cnt);
Fprintf(log_output_, "int a_cb_index[%d] ={\n", lpd->cb_cnt);
for (i=0; i<lpd->cb_cnt; ++i)
Fprintf(log_output_, "%d,\n", lpd->cb_index[i]);
Fprintf(log_output_, "};\n\n");
Fprintf(log_output_, "int a_cb_index2[%d] ={\n", lpd->cb_cnt);
for (i=0; i<lpd->cb_cnt; ++i)
Fprintf(log_output_, "%d,\n", lpd->cb_index2[i]);
Fprintf(log_output_, "};\n\n");
Fprintf(log_output_, "double a_cb_value[%d] ={\n", lpd->cb_cnt);
for (i=0; i<lpd->cb_cnt; ++i)
Fprintf(log_output_, "%.15e,\n", lpd->cb_value[i]);
Fprintf(log_output_, "};\n\n");
# endif
}
#endif
| mit |
Cielak1357/SportsInsider | static/nba/nba.html | 212 |
<div class="nbaDiv" ng-controller="nbaCtrl">
<iframe scrolling="no" class="nbaFrame" src="http://www.nba.com/standings/team_record_comparison/conferenceNew_Std_Div.html?ls=iref%3Anba%3Agnav"></iframe>
</div>
| mit |
orleans-tech/s01e03-discover-node-js | 07-api-rest-go/src/server/src/infrastructure/sqlitehandler.go | 657 | package infrastructure
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
"log"
)
type SqliteHandler struct {
Path string
Connect *sql.DB
}
func (handler *SqliteHandler) Open() error {
db, err := sql.Open("sqlite3", handler.Path)
if err != nil {
log.Panic(err)
}
handler.Connect = db
return err
}
func (handler *SqliteHandler) Close() {
if handler.Connect != nil {
handler.Connect.Close()
handler.Connect = nil
}
}
func (handler SqliteHandler) Db() *sql.DB {
return handler.Connect
}
func NewSqliteHandler(path string) *SqliteHandler {
sqliteHandler := new(SqliteHandler)
sqliteHandler.Path = path
return sqliteHandler
}
| mit |
AsrOneSdk/azure-sdk-for-net | sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ProxyResource.cs | 2124 | // <auto-generated>
// 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.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.Management.Compute.Models
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// The resource model definition for an Azure Resource Manager proxy
/// resource. It will not have tags and a location
/// </summary>
public partial class ProxyResource : IResource
{
/// <summary>
/// Initializes a new instance of the ProxyResource class.
/// </summary>
public ProxyResource()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the ProxyResource class.
/// </summary>
/// <param name="id">Resource Id</param>
/// <param name="name">Resource name</param>
/// <param name="type">Resource type</param>
public ProxyResource(string id = default(string), string name = default(string), string type = default(string))
{
Id = id;
Name = name;
Type = type;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets resource Id
/// </summary>
[JsonProperty(PropertyName = "id")]
public string Id { get; private set; }
/// <summary>
/// Gets resource name
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; private set; }
/// <summary>
/// Gets resource type
/// </summary>
[JsonProperty(PropertyName = "type")]
public string Type { get; private set; }
}
}
| mit |
j-froehlich/magento2_wk | vendor/magento/module-paypal/Block/Payment/Form/Billing/Agreement.php | 1961 | <?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Paypal\Block\Payment\Form\Billing;
/**
* Paypal Billing Agreement form block
*/
class Agreement extends \Magento\Payment\Block\Form
{
/**
* @var string
*/
protected $_template = 'Magento_Paypal::payment/form/billing/agreement.phtml';
/**
* @var \Magento\Paypal\Model\Billing\AgreementFactory
*/
protected $_agreementFactory;
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory,
array $data = []
) {
$this->_agreementFactory = $agreementFactory;
parent::__construct($context, $data);
$this->_isScopePrivate = true;
}
/**
* @return void
*/
protected function _construct()
{
parent::_construct();
$this->setTransportName(
\Magento\Paypal\Model\Payment\Method\Billing\AbstractAgreement::TRANSPORT_BILLING_AGREEMENT_ID
);
}
/**
* Retrieve available customer billing agreements
*
* @return array
*/
public function getBillingAgreements()
{
$data = [];
/** @var \Magento\Quote\Model\Quote $quote */
$quote = $this->getParentBlock()->getQuote();
if (!$quote || !$quote->getCustomerId()) {
return $data;
}
$collection = $this->_agreementFactory->create()->getAvailableCustomerBillingAgreements(
$quote->getCustomerId()
);
foreach ($collection as $item) {
$data[$item->getId()] = $item->getReferenceId();
}
return $data;
}
}
| mit |
chenwenzhang/frontend-scaffolding | src/pages/freemarker/index/html.js | 137 | const template = require("../../../layouts/hbs-loader")("base.ftl");
module.exports = template({
body: require("./html/body.ftl")
}); | mit |
kevinbarabash/tsbuild | README.md | 590 | # tsbuild #
fast builds for projects using TypeScript + Browserify
## Usage ##
var tsbuild = require("tsbuild");
tsbuild({
filename: "processing-debugger.ts",
srcDir: "./src",
libDir: "./lib",
distDir: "./dist",
standalone: "ProcessingDebugger"
});
- filename - main entry
- srcDir - root folder where __filename__ and other source reside
- libDir - destination of commonjs modules
- distDir - destination of universal modules
- standalone - symbol name to export to the global context when a module loader is not being used
| mit |
NBKlepp/fda | scalation_1.2/src/main/scala/scalation/random/RNG.scala | 5752 |
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** @author John Miller
* @version 1.2
* @date Sat Mar 22 14:39:30 EDT 2014
* @see LICENSE (MIT style license file).
*/
package scalation.random
import scala.math.floor
import scalation.util.{Error, time}
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** The `RNG` abstract class is the base class for all ScalaTion Random Number
* Generators. The subclasses must implement a 'gen' method that generates
* random real numbers in the range (0, 1). They must also implement an 'igen'
* methods to return stream values.
* @param stream the random number stream index
*/
abstract class RNG (stream: Int)
extends Error
{
if (stream < 0 || stream >= RandomSeeds.seeds.length) {
flaw ("constructor", "the stream must be in the range 0 to " + (RandomSeeds.seeds.length - 1))
} // if
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** Return the theoretical mean for the random number generator's 'gen' method.
*/
val mean = 0.5
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** Compute the probability function (pf), i.e., the probability density
* function (pdf).
* @param z the mass point whose probability density is sought
*/
def pf (z: Double): Double = if (0.0 <= z && z <= 1.0) 1.0 else 0.0
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** Return the next random number as a real `Double` in the interval (0, 1).
*/
def gen: Double
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** Return the next stream value as an integer `Int`.
*/
def igen: Int
} // RNG class
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** The `RNGStream` object allows for random selection of streams for applications
* where reproducibility of random numbers is not desired.
*/
object RNGStream
{
/** Use Java's random number generator to randomly select one of ScalaTion's
* random number streams: 0 until `RandomSeeds`.seeds.length
* "If you use the nullary constructor, new Random(), then 'System.currentTimeMillis'
* will be used for the seed, which is good enough for almost all cases."
* @see stackoverflow.com/questions/22530702/what-is-seed-in-util-random
* @see docs.oracle.com/javase/8/docs/api/index.html
*/
private val javaRNG = new java.util.Random ()
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** Return a randomly selected random number stream.
*/
def ranStream: Int = javaRNG.nextInt (RandomSeeds.seeds.length)
} // RNGStream
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** The `RNGTest` object conducts three simple tests of the Random Number
* Generators: (1) Speed Test, (2) Means Test and (3) Chi-square Goodness of Fit Test.
* FIX: need to add (3) Variance Test and (4) K-S Goodness of Fit Test.
*/
object RNGTest extends App with Error
{
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** Perform a Means Test (average of generated rn's close to mean for distribution).
* @param rn the random number generator to test
*/
def meansTest (rn: RNG)
{
println ("\nTest the `" + rn.getClass.getSimpleName () + "` random number generator")
val tries = 5
val reps = 10000000
var sum = 0.0
for (i <- 0 until tries) {
time { for (i <- 0 until reps) sum += rn.gen }
println ("gen: sum = " + sum)
println ("rn.mean = " + rn.mean + " estimate = " + sum / reps.toDouble)
sum = 0.0
} // for
} // meansTest
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** Perform a Chi-square Goodness of Fit Test. Compare the random number's
* histogram (generated by repeatedly calling 'gen') to the probability
* function pf (pdf).
* @param rn the random number generator to test
*/
def distrTest (rn: RNG)
{
println ("\nTest the " + rn.getClass.getSimpleName () + " random number generator")
val nints = 50 // number of intervals
val reps = 1000000 // number of replications
val e = reps / nints // expected value: pf (x)
val sum = Array.ofDim [Int] (nints)
for (i <- 0 until reps) {
val j = floor (rn.gen * nints).toInt // interval number
if (0 <= j && j < nints) sum (j) += 1
} // for
var chi2 = 0.0 // sum up for Chi-square statistic
for (i <- sum.indices) {
val o = sum(i) // observed value: height of histogram
chi2 += (o - e)*(o - e) / e
print ("\tsum (" + i + ") = " + o + " : " + e + " ")
if (i % 5 == 4) println ()
} // for
var n = nints - 1 // degrees of freedom
if (n < 2) flaw ("distrTest", "use more intervals to increase the degrees of freedom")
if (n > 49) n = 49
println ("\nchi2 = " + chi2 + " : chi2(0.95, " + n + ") = " + Quantile.chiSquareInv (0.95, n))
} // distrTest
val generators = Array (Random (), Random2 (), Random3 ())
for (g <- generators) {
meansTest (g)
distrTest (g)
} // for
} // RNGTest
| mit |
rocky0904/mozu-dotnet | Mozu.Api/Contracts/ProductRuntime/ResolvedPriceList.cs | 1219 |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Codezu.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
namespace Mozu.Api.Contracts.ProductRuntime
{
///
/// Mozu.ProductRuntime.Contracts.ResolvedPriceList ApiType DOCUMENT_HERE
///
public class ResolvedPriceList
{
///
///The localized description in text for the object, displayed per the locale code. For example, descriptions are used for product descriptions, attributes, and pre-authorization transaction types.
///
public string Description { get; set; }
///
///The user supplied name that appears in . You can use this field for identification purposes.
///
public string Name { get; set; }
///
///The code of the price list to which the customer resolves.
///
public string PriceListCode { get; set; }
///
///The internal id of the price list to which the customer resolves.
///
public int PriceListId { get; set; }
}
} | mit |
driftyco/ionic | core/src/components/backdrop/usage/stencil.md | 865 | ```tsx
import { Component, h } from '@stencil/core';
@Component({
tag: 'backdrop-example',
styleUrl: 'backdrop-example.css'
})
export class BackdropExample {
render() {
const enableBackdropDismiss = false;
const showBackdrop = false;
const shouldPropagate = false;
return [
// Default backdrop
<ion-backdrop></ion-backdrop>,
// Backdrop that is not tappable
<ion-backdrop tappable={false}></ion-backdrop>,
// Backdrop that is not visible
<ion-backdrop visible={false}></ion-backdrop>,
// Backdrop with propagation
<ion-backdrop stopPropagation={false}></ion-backdrop>,
// Backdrop that sets dynamic properties
<ion-backdrop
tappable={enableBackdropDismiss}
visible={showBackdrop}
stopPropagation={shouldPropagate}>
</ion-backdrop>
];
}
}
``` | mit |
1fish2/the-blue-alliance-android | android/src/main/java/com/thebluealliance/androidclient/gcm/GCMBroadcastReceiver.java | 881 | package com.thebluealliance.androidclient.gcm;
import com.thebluealliance.androidclient.TbaLogger;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.WakefulBroadcastReceiver;
public class GCMBroadcastReceiver extends WakefulBroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
TbaLogger.d("Got GCM Message. " + intent);
// Explicitly specify that GcmIntentService will handle the intent.
ComponentName comp = new ComponentName(context.getPackageName(),
GCMMessageHandler.class.getName());
// Start the service, keeping the device awake while it is launching.
startWakefulService(context, intent.setComponent(comp));
setResultCode(Activity.RESULT_OK);
}
}
| mit |
javlaking/testangular2ci | src/components/login/index.ts | 30 | export * from './login-form';
| mit |
Xe0n0/LeetCode | Remove Duplicates from Sorted List II.cpp | 1211 | //1. consider terminate and return when found a bound condition.
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *deleteDuplicates(ListNode *head) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if (head == NULL) return head;
ListNode *p = head;
ListNode *b = new ListNode(-1);
b->next = head;
ListNode *preprev = b;
ListNode *prev = p;
p = p->next;
while (p) {
if (p->val == prev->val) {
while (p && p->val == prev->val) {
p = p->next;
}
preprev->next = p;
if (p == NULL) return b->next;
prev = p;
p = p->next;
}
else {
preprev = prev;
prev = p;
p = p->next;
}
}
return b->next;
}
}; | mit |
guotao2000/ecmall | temp/caches/0090/c71737c6413b27861acfd0ee34eefe35.cache.php | 14910 | <?php
/**
* @Created By ECMall PhpCacheServer
* @Time:2015-01-23 00:46:43
*/
if(filemtime(__FILE__) + 1800 < time())return false;
return array (
'id' => 2397,
'goods' =>
array (
'goods_id' => '2397',
'store_id' => '131',
'type' => 'material',
'goods_name' => '烤干熟虾皮100g',
'description' => '<p style="text-align: center;"><img src="http://wap.bqmart.cn/data/files/store_131/goods_167/201412171822472737.jpg" alt="6925979200319_01.jpg" /><img src="http://wap.bqmart.cn/data/files/store_131/goods_172/201412171822527262.jpg" alt="6925979200319_02.jpg" /><img src="http://wap.bqmart.cn/data/files/store_131/goods_177/201412171822575660.jpg" alt="6925979200319_03.jpg" /></p>',
'cate_id' => '810',
'cate_name' => '生鲜 冷冻食品',
'brand' => '',
'spec_qty' => '0',
'spec_name_1' => '',
'spec_name_2' => '',
'if_show' => '1',
'if_seckill' => '0',
'closed' => '0',
'close_reason' => NULL,
'add_time' => '1418782986',
'last_update' => '1418782986',
'default_spec' => '2401',
'default_image' => 'data/files/store_131/goods_160/small_201412171822404085.jpg',
'recommended' => '0',
'cate_id_1' => '780',
'cate_id_2' => '810',
'cate_id_3' => '0',
'cate_id_4' => '0',
'price' => '18.00',
'tags' =>
array (
0 => '虾皮',
),
'cuxiao_ids' => NULL,
'from_goods_id' => '0',
'quanzhong' => NULL,
'state' => '1',
'_specs' =>
array (
0 =>
array (
'spec_id' => '2401',
'goods_id' => '2397',
'spec_1' => '',
'spec_2' => '',
'color_rgb' => '',
'price' => '18.00',
'stock' => '1000',
'sku' => '6925979200319',
),
),
'_images' =>
array (
0 =>
array (
'image_id' => '3506',
'goods_id' => '2397',
'image_url' => 'data/files/store_131/goods_160/201412171822404085.jpg',
'thumbnail' => 'data/files/store_131/goods_160/small_201412171822404085.jpg',
'sort_order' => '1',
'file_id' => '14400',
),
),
'_scates' =>
array (
),
'views' => '2',
'collects' => '0',
'carts' => '0',
'orders' => '0',
'sales' => '0',
'comments' => '0',
'related_info' =>
array (
),
),
'store_data' =>
array (
'store_id' => '131',
'store_name' => '海尔绿城店',
'owner_name' => '倍全',
'owner_card' => '370832200104057894',
'region_id' => '2213',
'region_name' => '中国 山东 济南 历下区',
'address' => '',
'zipcode' => '',
'tel' => '0531-86940405',
'sgrade' => '系统默认',
'apply_remark' => '',
'credit_value' => '0',
'praise_rate' => '0.00',
'domain' => '',
'state' => '1',
'close_reason' => '',
'add_time' => '1418929047',
'end_time' => '0',
'certification' => 'autonym,material',
'sort_order' => '65535',
'recommended' => '0',
'theme' => '',
'store_banner' => NULL,
'store_logo' => 'data/files/store_131/other/store_logo.jpg',
'description' => '',
'image_1' => '',
'image_2' => '',
'image_3' => '',
'im_qq' => '',
'im_ww' => '',
'im_msn' => '',
'hot_search' => '',
'business_scope' => '',
'online_service' =>
array (
),
'hotline' => '',
'pic_slides' => '',
'pic_slides_wap' => '{"1":{"url":"data/files/store_131/pic_slides_wap/pic_slides_wap_1.jpg","link":"http://wap.bqmart.cn/index.php?app=zhuanti&id=6"},"2":{"url":"data/files/store_131/pic_slides_wap/pic_slides_wap_2.jpg","link":"http://wap.bqmart.cn/index.php?keyword= %E6%B4%97%E8%A1%A3%E5%B9%B2%E6%B4%97&app=store&act=search&id=131"},"3":{"url":"data/files/store_131/pic_slides_wap/pic_slides_wap_3.jpg","link":"http://wap.bqmart.cn/index.php?app=search&cate_id=691&id=131"}}',
'enable_groupbuy' => '0',
'enable_radar' => '1',
'waptheme' => '',
'is_open_pay' => '0',
'area_peisong' => NULL,
'power_coupon' => '0',
's_long' => '117.131236',
's_lat' => '36.644393',
'user_name' => 'bq4053',
'email' => '[email protected]',
'certifications' =>
array (
0 => 'autonym',
1 => 'material',
),
'credit_image' => 'http://wap.bqmart.cn/themes/store/default/styles/default/images/heart_1.gif',
'store_owner' =>
array (
'user_id' => '131',
'user_name' => 'bq4053',
'email' => '[email protected]',
'password' => '9cbf8a4dcb8e30682b927f352d6559a0',
'real_name' => '新生活家园',
'gender' => '0',
'birthday' => '',
'phone_tel' => NULL,
'phone_mob' => NULL,
'im_qq' => '',
'im_msn' => '',
'im_skype' => NULL,
'im_yahoo' => NULL,
'im_aliww' => NULL,
'reg_time' => '1418928900',
'last_login' => '1421877406',
'last_ip' => '119.162.42.80',
'logins' => '126',
'ugrade' => '0',
'portrait' => NULL,
'outer_id' => '0',
'activation' => NULL,
'feed_config' => NULL,
'uin' => '0',
'parentid' => '0',
'user_level' => '0',
'from_weixin' => '0',
'wx_openid' => NULL,
'wx_nickname' => NULL,
'wx_city' => NULL,
'wx_country' => NULL,
'wx_province' => NULL,
'wx_language' => NULL,
'wx_headimgurl' => NULL,
'wx_subscribe_time' => '0',
'wx_id' => '0',
'from_public' => '0',
'm_storeid' => '0',
),
'store_navs' =>
array (
),
'kmenus' => false,
'kmenusinfo' =>
array (
),
'radio_new' => 1,
'radio_recommend' => 1,
'radio_hot' => 1,
'goods_count' => '1109',
'store_gcates' =>
array (
),
'functions' =>
array (
'editor_multimedia' => 'editor_multimedia',
'coupon' => 'coupon',
'groupbuy' => 'groupbuy',
'enable_radar' => 'enable_radar',
'seckill' => 'seckill',
),
'hot_saleslist' =>
array (
2483 =>
array (
'goods_id' => '2483',
'goods_name' => '七度空间纯棉表层透气夜用超薄卫生巾10片状',
'default_image' => 'data/files/store_131/goods_110/small_201412180915101043.jpg',
'price' => '9.60',
'sales' => '7',
),
2067 =>
array (
'goods_id' => '2067',
'goods_name' => '黑牛高钙豆奶粉480g',
'default_image' => 'data/files/store_131/goods_19/small_201412171103393194.gif',
'price' => '15.80',
'sales' => '7',
),
2674 =>
array (
'goods_id' => '2674',
'goods_name' => '美汁源果粒橙450ml果汁',
'default_image' => 'data/files/store_131/goods_5/small_201412181056459752.jpg',
'price' => '3.00',
'sales' => '5',
),
2481 =>
array (
'goods_id' => '2481',
'goods_name' => '心相印红卷纸单包装120g卫生纸',
'default_image' => 'data/files/store_131/goods_71/small_201412180914313610.jpg',
'price' => '2.50',
'sales' => '4',
),
2690 =>
array (
'goods_id' => '2690',
'goods_name' => '乐百氏脉动水蜜桃600ml',
'default_image' => 'data/files/store_131/goods_101/small_201412181105019926.jpg',
'price' => '4.00',
'sales' => '3',
),
2732 =>
array (
'goods_id' => '2732',
'goods_name' => '怡泉+c500ml功能饮料',
'default_image' => 'data/files/store_131/goods_115/small_201412181125154319.jpg',
'price' => '4.00',
'sales' => '1',
),
3036 =>
array (
'goods_id' => '3036',
'goods_name' => '【39元区】羊毛外套 羊绒大衣',
'default_image' => 'data/files/store_131/goods_186/small_201501041619467368.jpg',
'price' => '39.00',
'sales' => '1',
),
2254 =>
array (
'goods_id' => '2254',
'goods_name' => '圣牧全程有机奶1X12X250ml',
'default_image' => 'data/files/store_131/goods_69/small_201412171617496624.jpg',
'price' => '98.00',
'sales' => '1',
),
2505 =>
array (
'goods_id' => '2505',
'goods_name' => '康师傅香辣牛肉面五连包103gx5方便面',
'default_image' => 'data/files/store_131/goods_70/small_201412180931105307.jpg',
'price' => '12.80',
'sales' => '0',
),
2100 =>
array (
'goods_id' => '2100',
'goods_name' => '蜡笔小新雪梨味可吸果冻80g',
'default_image' => 'data/files/store_131/goods_29/small_201412171350295329.jpg',
'price' => '1.00',
'sales' => '0',
),
),
'collect_goodslist' =>
array (
2824 =>
array (
'goods_id' => '2824',
'goods_name' => '蒙牛冠益乳草莓味风味发酵乳450g',
'default_image' => 'data/files/store_131/goods_12/small_201412181310121305.jpg',
'price' => '13.50',
'collects' => '1',
),
2481 =>
array (
'goods_id' => '2481',
'goods_name' => '心相印红卷纸单包装120g卫生纸',
'default_image' => 'data/files/store_131/goods_71/small_201412180914313610.jpg',
'price' => '2.50',
'collects' => '1',
),
5493 =>
array (
'goods_id' => '5493',
'goods_name' => '青岛啤酒奥古特500ml',
'default_image' => 'data/files/store_42/goods_0/small_201412181433205122.jpg',
'price' => '9.80',
'collects' => '1',
),
2895 =>
array (
'goods_id' => '2895',
'goods_name' => '品食客手抓饼葱香味400g速冻食品',
'default_image' => 'data/files/store_131/goods_103/small_201412181421434694.jpg',
'price' => '11.80',
'collects' => '1',
),
2483 =>
array (
'goods_id' => '2483',
'goods_name' => '七度空间纯棉表层透气夜用超薄卫生巾10片状',
'default_image' => 'data/files/store_131/goods_110/small_201412180915101043.jpg',
'price' => '9.60',
'collects' => '1',
),
2067 =>
array (
'goods_id' => '2067',
'goods_name' => '黑牛高钙豆奶粉480g',
'default_image' => 'data/files/store_131/goods_19/small_201412171103393194.gif',
'price' => '15.80',
'collects' => '1',
),
2594 =>
array (
'goods_id' => '2594',
'goods_name' => '康师傅蜂蜜绿茶490ml',
'default_image' => 'data/files/store_131/goods_10/small_201412181016503047.jpg',
'price' => '3.00',
'collects' => '1',
),
2154 =>
array (
'goods_id' => '2154',
'goods_name' => '迪士尼巧克力味心宠杯25g',
'default_image' => 'data/files/store_131/goods_110/small_201412171515106856.jpg',
'price' => '2.50',
'collects' => '1',
),
2801 =>
array (
'goods_id' => '2801',
'goods_name' => '海天苹果醋450ml',
'default_image' => 'data/files/store_131/goods_47/small_201412181157271271.jpg',
'price' => '6.50',
'collects' => '1',
),
2505 =>
array (
'goods_id' => '2505',
'goods_name' => '康师傅香辣牛肉面五连包103gx5方便面',
'default_image' => 'data/files/store_131/goods_70/small_201412180931105307.jpg',
'price' => '12.80',
'collects' => '0',
),
),
'left_rec_goods' =>
array (
2067 =>
array (
'goods_name' => '黑牛高钙豆奶粉480g',
'default_image' => 'data/files/store_131/goods_19/small_201412171103393194.gif',
'price' => '15.80',
'sales' => '7',
'goods_id' => '2067',
),
2481 =>
array (
'goods_name' => '心相印红卷纸单包装120g卫生纸',
'default_image' => 'data/files/store_131/goods_71/small_201412180914313610.jpg',
'price' => '2.50',
'sales' => '4',
'goods_id' => '2481',
),
2594 =>
array (
'goods_name' => '康师傅蜂蜜绿茶490ml',
'default_image' => 'data/files/store_131/goods_10/small_201412181016503047.jpg',
'price' => '3.00',
'sales' => '0',
'goods_id' => '2594',
),
2483 =>
array (
'goods_name' => '七度空间纯棉表层透气夜用超薄卫生巾10片状',
'default_image' => 'data/files/store_131/goods_110/small_201412180915101043.jpg',
'price' => '9.60',
'sales' => '7',
'goods_id' => '2483',
),
5493 =>
array (
'goods_name' => '青岛啤酒奥古特500ml',
'default_image' => 'data/files/store_42/goods_0/small_201412181433205122.jpg',
'price' => '9.80',
'sales' => '0',
'goods_id' => '5493',
),
),
),
'cur_local' =>
array (
0 =>
array (
'text' => '所有分类',
'url' => 'index.php?app=category',
),
1 =>
array (
'text' => '生鲜',
'url' => 'index.php?app=search&cate_id=780',
),
2 =>
array (
'text' => '冷冻食品',
'url' => 'index.php?app=search&cate_id=810',
),
3 =>
array (
'text' => '商品详情',
),
),
'share' =>
array (
4 =>
array (
'title' => '开心网',
'link' => 'http://www.kaixin001.com/repaste/share.php?rtitle=%E7%83%A4%E5%B9%B2%E7%86%9F%E8%99%BE%E7%9A%AE100g-%E5%BE%AE%E4%BF%A1%E5%95%86%E5%9F%8E&rurl=http%3A%2F%2Fwap.bqmart.cn%2Findex.php%3Fapp%3Dgoods%26id%3D2397',
'type' => 'share',
'sort_order' => 255,
'logo' => 'data/system/kaixin001.gif',
),
3 =>
array (
'title' => 'QQ书签',
'link' => 'http://shuqian.qq.com/post?from=3&title=%E7%83%A4%E5%B9%B2%E7%86%9F%E8%99%BE%E7%9A%AE100g-%E5%BE%AE%E4%BF%A1%E5%95%86%E5%9F%8E++++++&uri=http%3A%2F%2Fwap.bqmart.cn%2Findex.php%3Fapp%3Dgoods%26id%3D2397&jumpback=2&noui=1',
'type' => 'collect',
'sort_order' => 255,
'logo' => 'data/system/qqshuqian.gif',
),
2 =>
array (
'title' => '人人网',
'link' => 'http://share.renren.com/share/buttonshare.do?link=http%3A%2F%2Fwap.bqmart.cn%2Findex.php%3Fapp%3Dgoods%26id%3D2397&title=%E7%83%A4%E5%B9%B2%E7%86%9F%E8%99%BE%E7%9A%AE100g-%E5%BE%AE%E4%BF%A1%E5%95%86%E5%9F%8E',
'type' => 'share',
'sort_order' => 255,
'logo' => 'data/system/renren.gif',
),
1 =>
array (
'title' => '百度收藏',
'link' => 'http://cang.baidu.com/do/add?it=%E7%83%A4%E5%B9%B2%E7%86%9F%E8%99%BE%E7%9A%AE100g-%E5%BE%AE%E4%BF%A1%E5%95%86%E5%9F%8E++++++&iu=http%3A%2F%2Fwap.bqmart.cn%2Findex.php%3Fapp%3Dgoods%26id%3D2397&fr=ien#nw=1',
'type' => 'collect',
'sort_order' => 255,
'logo' => 'data/system/baidushoucang.gif',
),
),
);
?> | mit |
staticmatrix/Triangle | src/framework/controls/dtpicker/dtpicker.js | 82149 | Jx().package("T.UI.Controls", function(J){
// 严格模式
'use strict';
var _crrentPluginId = 0;
var defaults = {
// 选项
// fooOption: true,
// 覆写 类方法
// parseData: undefined,
// 事件
// onFooSelected: undefined,
// onFooChange: function(e, data){}
timeZone: 'Etc/UTC',
// format: false,
format: 'YYYY-MM-DD HH:mm:ss',
dayViewHeaderFormat: 'MMMM YYYY',
// extraFormats: false,
stepping: 1,
minDate: false,
maxDate: false,
useCurrent: true,
// collapse: true,
// locale: moment.locale(),
defaultDate: false,
disabledDates: false,
enabledDates: false,
icons: {
time: 'glyphicon glyphicon-time',
date: 'glyphicon glyphicon-calendar',
up: 'glyphicon glyphicon-chevron-up',
down: 'glyphicon glyphicon-chevron-down',
previous: 'glyphicon glyphicon-chevron-left',
next: 'glyphicon glyphicon-chevron-right',
today: 'glyphicon glyphicon-screenshot',
clear: 'glyphicon glyphicon-trash',
close: 'glyphicon glyphicon-remove'
},
tooltips: {
today: '现在',
clear: '清除',
close: '关闭',
selectMonth: '选择月份',
prevMonth: '上一月',
nextMonth: '下一月',
selectYear: '选择年份',
prevYear: '上一年',
nextYear: '下一年',
selectDecade: '选择年代',
prevDecade: '上一年代',
nextDecade: '下一年代',
prevCentury: '上一世纪',
nextCentury: '下一世纪',
pickHour: '选择小时',
incrementHour: '增加小时',
decrementHour: '减少小时',
pickMinute: '选择分钟',
incrementMinute: '增加分钟',
decrementMinute: '减少分钟',
pickSecond: '选择秒',
incrementSecond: '增加秒',
decrementSecond: '减少秒',
togglePeriod: 'AM/PM',
selectTime: '选择时间'
},
// useStrict: false,
// sideBySide: false,
daysOfWeekDisabled: false,
calendarWeeks: false,
viewMode: 'days',
// toolbarPlacement: 'default',
showTodayButton: true,
showClear: true,
showClose: true,
// widgetPositioning: {
// horizontal: 'auto',
// vertical: 'auto'
// },
// widgetParent: null,
ignoreReadonly: false,
keepOpen: false,
focusOnShow: true,
inline: false,
keepInvalid: false,
datepickerInput: '.datepickerinput',
// debug: false,
allowInputToggle: false,
disabledTimeIntervals: false,
disabledHours: false,
enabledHours: false,
// viewValue: false
};
var attributeMap = {
// fooOption: 'foo-option'
format: 'format'
};
// 常量
var viewModes = ['days', 'months', 'years', 'decades'],
keyMap = {
'up': 38,
38: 'up',
'down': 40,
40: 'down',
'left': 37,
37: 'left',
'right': 39,
39: 'right',
'tab': 9,
9: 'tab',
'escape': 27,
27: 'escape',
'enter': 13,
13: 'enter',
'pageUp': 33,
33: 'pageUp',
'pageDown': 34,
34: 'pageDown',
'shift': 16,
16: 'shift',
'control': 17,
17: 'control',
'space': 32,
32: 'space',
't': 84,
84: 't',
'delete': 46,
46: 'delete'
},
keyState = {};
// moment.js 接口
function getMoment (format, d) {
// var tzEnabled = false,
// returnMoment,
// currentZoneOffset,
// incomingZoneOffset,
// timeZoneIndicator,
// dateWithTimeZoneInfo;
// if (moment.tz !== undefined && this.settings.timeZone !== undefined && this.settings.timeZone !== null && this.settings.timeZone !== '') {
// tzEnabled = true;
// }
// if (d === undefined || d === null) {
// if (tzEnabled) {
// returnMoment = moment().tz(this.settings.timeZone).startOf('d');
// } else {
// returnMoment = moment().startOf('d');
// }
// } else {
// if (tzEnabled) {
// currentZoneOffset = moment().tz(this.settings.timeZone).utcOffset();
// incomingZoneOffset = moment(d, parseFormats, this.settings.useStrict).utcOffset();
// if (incomingZoneOffset !== currentZoneOffset) {
// timeZoneIndicator = moment().tz(this.settings.timeZone).format('Z');
// dateWithTimeZoneInfo = moment(d, parseFormats, this.settings.useStrict).format('YYYY-MM-DD[T]HH:mm:ss') + timeZoneIndicator;
// returnMoment = moment(dateWithTimeZoneInfo, parseFormats, this.settings.useStrict).tz(this.settings.timeZone);
// } else {
// returnMoment = moment(d, parseFormats, this.settings.useStrict).tz(this.settings.timeZone);
// }
// } else {
// returnMoment = moment(d, parseFormats, this.settings.useStrict);
// }
// }
var returnMoment;
if (d === undefined || d === null) {
returnMoment= moment().startOf('d');
}
else{
// returnMoment = moment(d, format, this.settings.useStrict);
// Moment's parser is very forgiving, and this can lead to undesired behavior.
// As of version 2.3.0, you may specify a boolean for the last argument to make Moment use strict parsing.
// Strict parsing requires that the format and input match exactly.
returnMoment = moment(d, format, false);
}
return returnMoment;
}
// 格式,细粒度
function isEnabled(format, granularity) {
switch (granularity) {
case 'y':
return format.indexOf('Y') !== -1;
case 'M':
return format.indexOf('M') !== -1;
case 'd':
return format.toLowerCase().indexOf('d') !== -1;
case 'h':
case 'H':
return format.toLowerCase().indexOf('h') !== -1;
case 'm':
return format.indexOf('m') !== -1;
case 's':
return format.indexOf('s') !== -1;
default:
return false;
}
}
function hasTime(format) {
return (isEnabled(format, 'h') || isEnabled(format, 'm') || isEnabled(format, 's'));
}
function hasDate(format) {
return (isEnabled(format, 'y') || isEnabled(format, 'M') || isEnabled(format, 'd'));
}
function isValid(settings, targetMoment, granularity) {
if (!targetMoment.isValid()) {
return false;
}
if (settings.disabledDates && granularity === 'd' && settings.disabledDates[targetMoment.format('YYYY-MM-DD')] === true) {
return false;
}
if (settings.enabledDates && granularity === 'd' && (settings.enabledDates[targetMoment.format('YYYY-MM-DD')] !== true)) {
return false;
}
if (settings.minDate && targetMoment.isBefore(settings.minDate, granularity)) {
return false;
}
if (settings.maxDate && targetMoment.isAfter(settings.maxDate, granularity)) {
return false;
}
if (settings.daysOfWeekDisabled && granularity === 'd' && settings.daysOfWeekDisabled.indexOf(targetMoment.day()) !== -1) {
return false;
}
if (settings.disabledHours && (granularity === 'h' || granularity === 'm' || granularity === 's') && settings.disabledHours[targetMoment.format('H')] === true) {
return false;
}
if (settings.enabledHours && (granularity === 'h' || granularity === 'm' || granularity === 's') && (settings.enabledHours[targetMoment.format('H')] !== true)) {
return false;
}
if (settings.disabledTimeIntervals && (granularity === 'h' || granularity === 'm' || granularity === 's')) {
var found = false;
$.each(settings.disabledTimeIntervals, function () {
if (targetMoment.isBetween(this[0], this[1])) {
found = true;
return false;
}
});
if (found) {
return false;
}
}
return true;
}
// notifyEvent: function (e) {
// if (e.type === 'dp.change' && ((e.date && e.date.isSame(e.oldDate)) || (!e.date && !e.oldDate))) {
// return;
// }
// element.trigger(e);
// },
var Widget=new J.Class({
defaults: defaults,
attributeMap: attributeMap,
settings: {},
value: null,
// data: {},
// templates: {},
use24Hours: false,
minViewModeNumber: 0, // 最小视图模式,选到这个模式以后关闭弹出窗口。
currentViewMode: 0,
// 构造函数
init: function(elements, options){
this.inputElements = elements;
// 直接使用容器类实例的设置
this.settings=options;
// // TODO:临时措施
// this.use24Hours= false;
// this.currentViewMode= 0;
this.initFormatting();
// this.initSettings(options);
// // this.value= this.element.val();
var now= getMoment(this.settings.format);
this.value= now;
this.viewValue=this.value;
this.buildHtml();
this.initElements();
this.buildObservers();
this.bindEvents();
// this.bindEventsInterface();
this.refresh();
},
initFormatting: function () {
// Time LT 8:30 PM
// Time with seconds LTS 8:30:25 PM
// Month numeral, day of month, year L 09/04/1986
// l 9/4/1986
// Month name, day of month, year LL September 4 1986
// ll Sep 4 1986
// Month name, day of month, year, time LLL September 4 1986 8:30 PM
// lll Sep 4 1986 8:30 PM
// Month name, day of month, day of week, year, time LLLL Thursday, September 4 1986 8:30 PM
// llll Thu, Sep 4 1986 8:30 PM
// var format= this.settings.format || 'L LT';
// var context= this;
// this.actualFormat = format.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput) {
// var value= context.getValue();
// var newinput = value.localeData().longDateFormat(formatInput) || formatInput;
// return newinput.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput2) { //temp fix for #740
// return value.localeData().longDateFormat(formatInput2) || formatInput2;
// });
// });
// parseFormats = this.settings.extraFormats ? this.settings.extraFormats.slice() : [];
// parseFormats = [];
// if (parseFormats.indexOf(format) < 0 && parseFormats.indexOf(this.actualFormat) < 0) {
// parseFormats.push(this.actualFormat);
// }
// this.use24Hours = (this.actualFormat.toLowerCase().indexOf('a') < 1 && this.actualFormat.replace(/\[.*?\]/g, '').indexOf('h') < 1);
this.use24Hours = (this.settings.format.toLowerCase().indexOf('a') < 1 && this.settings.format.replace(/\[.*?\]/g, '').indexOf('h') < 1);
if (isEnabled(this.settings.format, 'y')) {
this.minViewModeNumber = 2;
}
if (isEnabled(this.settings.format, 'M')) {
this.minViewModeNumber = 1;
}
if (isEnabled(this.settings.format, 'd')) {
this.minViewModeNumber = 0;
}
this.currentViewMode = Math.max(this.minViewModeNumber, this.currentViewMode);
},
buildHtml: function(){
// 星期表头
var currentDate= this.viewValue.clone().startOf('w').startOf('d');
var htmlDow= this.settings.calendarWeeks === true ? '<th class="cw">#</th>' : '';
while (currentDate.isBefore(this.viewValue.clone().endOf('w'))) {
htmlDow += '<th class="dow">'+currentDate.format('dd')+'</th>';
currentDate.add(1, 'd');
}
htmlDow= '<tr>'+htmlDow+'</tr>';
// 月份
var monthsShort = this.viewValue.clone().startOf('y').startOf('d');
var htmlMonths= '';
while (monthsShort.isSame(this.viewValue, 'y')) {
htmlMonths += '<span class="month" data-action="selectMonth">'+monthsShort.format('MMM')+'</span>';
monthsShort.add(1, 'M');
}
// 日期视图
var dateView = ''+
'<div class="datepicker'+((hasDate(this.settings.format) && hasTime(this.settings.format)) ? ' col-md-6' : '')+'">'+
' <div class="datepicker-days">'+
' <table class="table-condensed">'+
' <thead>'+
' <tr>'+
' <th class="prev" data-action="previous"><span class="'+this.settings.icons.previous+'" title="'+this.settings.tooltips.prevMonth+'"></span></th>'+
' <th class="picker-switch" data-action="pickerSwitch" colspan="'+(this.settings.calendarWeeks ? '6' : '5')+'" title="'+this.settings.tooltips.selectMonth+'"></th>'+
' <th class="next" data-action="next"><span class="'+this.settings.icons.next+'" title="'+this.settings.tooltips.nextMonth+'"></span></th>'+
' </tr>'+
htmlDow+
' </thead>'+
' <tbody>'+
' </tbody>'+
' <table/>'+
' </div>'+
' <div class="datepicker-months">'+
' <table class="table-condensed">'+
' <thead>'+
' <tr>'+
' <th class="prev" data-action="previous"><span class="'+this.settings.icons.previous+'" title="'+this.settings.tooltips.prevYear+'"></span></th>'+
' <th class="picker-switch" data-action="pickerSwitch" colspan="'+(this.settings.calendarWeeks ? '6' : '5')+'" title="'+this.settings.tooltips.selectYear+'"></th>'+
' <th class="next" data-action="next"><span class="'+this.settings.icons.next+'" title="'+this.settings.tooltips.nextYear+'"></span></th>'+
' </tr>'+
' </thead>'+
' <tbody>'+
' <tr><td colspan="'+(this.settings.calendarWeeks ? '8' : '7')+'">'+htmlMonths+'</td></tr>'+
' </tbody>'+
' <table/>'+
' </div>'+
' <div class="datepicker-years">'+
' <table class="table-condensed">'+
' <thead>'+
' <tr>'+
' <th class="prev" data-action="previous"><span class="'+this.settings.icons.previous+'" title="'+this.settings.tooltips.prevDecade+'"></span></th>'+
' <th class="picker-switch" data-action="pickerSwitch" colspan="'+(this.settings.calendarWeeks ? '6' : '5')+'" title="'+this.settings.tooltips.selectDecade+'"></th>'+
' <th class="next" data-action="next"><span class="'+this.settings.icons.next+'" title="'+this.settings.tooltips.nextDecade+'"></span></th>'+
' </tr>'+
' </thead>'+
' <tbody>'+
' <tr><td colspan="'+(this.settings.calendarWeeks ? '8' : '7')+'"></td></tr>'+
' </tbody>'+
' <table/>'+
' </div>'+
' <div class="datepicker-decades">'+
' <table class="table-condensed">'+
' <thead>'+
' <tr>'+
' <th class="prev" data-action="previous"><span class="'+this.settings.icons.previous+'" title="'+this.settings.tooltips.prevCentury+'"></span></th>'+
' <th class="picker-switch" data-action="pickerSwitch" colspan="'+(this.settings.calendarWeeks ? '6' : '5')+'"></th>'+
' <th class="next" data-action="next"><span class="'+this.settings.icons.next+'" title="'+this.settings.tooltips.nextCentury+'"></span></th>'+
' </tr>'+
' </thead>'+
' <tbody>'+
' <tr><td colspan="'+(this.settings.calendarWeeks ? '8' : '7')+'"></td></tr>'+
' </tbody>'+
' <table/>'+
' </div>'+
'</div>';
// 小时选择按钮
var htmlHours= '';
if(isEnabled(this.settings.format, 'h')){
var currentHour = this.viewValue.clone().startOf('d');
if (this.viewValue.hour() > 11 && !this.use24Hours) {
currentHour.hour(12);
}
while (currentHour.isSame(this.viewValue, 'd') && (this.use24Hours || (this.viewValue.hour() < 12 && currentHour.hour() < 12) || this.viewValue.hour() > 11)) {
if (currentHour.hour() % 4 === 0) {
htmlHours += '<tr>';
}
htmlHours += ''+
'<td data-action="selectHour" class="hour' + (!isValid(this.settings,currentHour, 'h') ? ' disabled' : '') + '">' +
currentHour.format(this.use24Hours ? 'HH' : 'hh') +
'</td>';
if (currentHour.hour() % 4 === 3) {
htmlHours += '</tr>';
}
currentHour.add(1, 'h');
}
}
// 分钟选择按钮
var htmlMinutes= '';
if(isEnabled(this.settings.format, 'm')){
var currentMinute = this.viewValue.clone().startOf('h');
var step = this.settings.stepping === 1 ? 5 : this.settings.stepping;
while (this.viewValue.isSame(currentMinute, 'h')) {
if (currentMinute.minute() % (step * 4) === 0) {
htmlMinutes += '<tr>';
}
htmlMinutes +=''+
'<td data-action="selectMinute" class="minute' + (!isValid(this.settings,currentMinute, 'm') ? ' disabled' : '') + '">' +
currentMinute.format('mm') +
'</td>';
if (currentMinute.minute() % (step * 4) === step * 3) {
htmlMinutes += '</tr>';
}
currentMinute.add(step, 'm');
}
}
// 秒选择按钮
var htmlSeconds= '';
if(isEnabled(this.settings.format, 's')){
var currentSecond = this.viewValue.clone().startOf('m');
while (this.viewValue.isSame(currentSecond, 'm')) {
if (currentSecond.second() % 20 === 0) {
htmlSeconds += '<tr>';
}
htmlSeconds += ''+
'<td data-action="selectSecond" class="second' + (!isValid(this.settings,currentSecond, 's') ? ' disabled' : '') + '">' +
currentSecond.format('ss') +
'</td>';
if (currentSecond.second() % 20 === 15) {
htmlSeconds += '</tr>';
}
currentSecond.add(5, 's');
}
}
// 时间视图
var timeView = ''+
'<div class="timepicker'+((hasDate(this.settings.format) && hasTime(this.settings.format)) ? ' col-md-6' : '')+'">'+
' <div class="timepicker-picker">'+
' <table class="table-condensed">'+
' <tr>'+
(isEnabled(this.settings.format, 'h') ?
' <td>'+
' <a href="#" class="btn" data-action="incrementHours" tabindex="-1" title="'+this.settings.tooltips.incrementHour+'">'+
' <span class="'+this.settings.icons.up+'"></span>'+
' </a>'+
' </td>' : '')+
(isEnabled(this.settings.format, 'm') ?
((isEnabled(this.settings.format, 'h') ?
' <td class="separator"></td>' : '')+
' <td>'+
' <a href="#" class="btn" data-action="incrementMinutes" tabindex="-1" title="'+this.settings.tooltips.incrementMinute+'">'+
' <span class="'+this.settings.icons.up+'"></span>'+
' </a>'+
' </td>') : '')+
(isEnabled(this.settings.format, 's') ?
((isEnabled(this.settings.format, 'm') ?
' <td class="separator"></td>' : '')+
' <td>'+
' <a href="#" class="btn" data-action="incrementSeconds" tabindex="-1" title="'+this.settings.tooltips.incrementSecond+'">'+
' <span class="'+this.settings.icons.up+'"></span>'+
' </a>'+
' </td>') : '')+
(this.use24Hours ?
' <td class="separator"></td>' : '')+
' </tr>'+
' <tr>'+
(isEnabled(this.settings.format, 'h') ?
' <td>'+
' <span class="timepicker-hour" data-action="showHours" data-time-component="hours" title="'+this.settings.tooltips.pickHour+'"></span>'+
' </td>' : '')+
(isEnabled(this.settings.format, 'm') ?
((isEnabled(this.settings.format, 'h') ?
' <td class="separator">:</td>' : '')+
' <td>'+
' <span class="timepicker-minute" data-action="showMinutes" data-time-component="minutes" title="'+this.settings.tooltips.pickMinute+'"></span>'+
' </td>') : '')+
(isEnabled(this.settings.format, 's') ?
((isEnabled(this.settings.format, 'm') ?
' <td class="separator">:</td>' : '')+
' <td>'+
' <span class="timepicker-second" data-action="showSeconds" data-time-component="seconds" title="'+this.settings.tooltips.pickSecond+'"></span>'+
' </td>') : '')+
(this.use24Hours ?
' <td class="separator">'+
' <button class="btn btn-primary" data-action="togglePeriod" tabindex="-1" title="'+this.settings.tooltips.togglePeriod+'"></button>'+
' </td>' : '')+
' </tr>'+
' <tr>'+
' <td>'+
' <a href="#" class="btn" data-action="decrementHours" tabindex="-1" title="'+this.settings.tooltips.decrementHour+'">'+
' <span class="'+this.settings.icons.down+'"></span>'+
' </a>'+
' </td>'+
(isEnabled(this.settings.format, 'm') ?
((isEnabled(this.settings.format, 'h') ?
' <td class="separator"></td>' : '')+
' <td>'+
' <a href="#" class="btn" data-action="decrementMinutes" tabindex="-1" title="'+this.settings.tooltips.decrementMinute+'">'+
' <span class="'+this.settings.icons.down+'"></span>'+
' </a>'+
' </td>') : '')+
(isEnabled(this.settings.format, 's') ?
((isEnabled(this.settings.format, 'm') ?
' <td class="separator"></td>' : '')+
' <td>'+
' <a href="#" class="btn" data-action="decrementSeconds" tabindex="-1" title="'+this.settings.tooltips.decrementSecond+'">'+
' <span class="'+this.settings.icons.down+'"></span>'+
' </a>'+
' </td>') : '')+
(this.use24Hours ?
' <td class="separator"></td>' : '')+
' </tr>'+
' </table>'+
' </div>'+
(isEnabled(this.settings.format, 'h') ?
' <div class="timepicker-hours">'+
' <table class="table-condensed">'+htmlHours+'</table>'+
' </div>' : '')+
(isEnabled(this.settings.format, 'm') ?
' <div class="timepicker-minutes">'+
' <table class="table-condensed">'+htmlMinutes+'</table>'+
' </div>' : '')+
(isEnabled(this.settings.format, 's') ?
' <div class="timepicker-seconds">'+
' <table class="table-condensed">'+htmlSeconds+'</table>'+
' </div>' : '')+
'</div>';
var toolbar2 = ''+
'<table class="table-condensed">'+
' <tbody>'+
' <tr>'+
(this.settings.showTodayButton ?
' <td><a data-action="today" title="'+this.settings.tooltips.today+'"><span class="'+this.settings.icons.today+'"></span></a></td>' : '')+
// ((!this.settings.sideBySide && hasDate(this.settings.format) && hasTime(this.settings.format))?
// ' <td><a data-action="togglePicker" title="'+this.settings.tooltips.selectTime+'"><span class="'+this.settings.icons.time+'"></span></a></td>' : '')+
(this.settings.showClear ?
' <td><a data-action="clear" title="'+this.settings.tooltips.clear+'"><span class="'+this.settings.icons.clear+'"></span></a></td>' : '')+
(this.settings.showClose ?
' <td><a data-action="close" title="'+this.settings.tooltips.close+'"><span class="'+this.settings.icons.close+'"></span></a></td>' : '')+
' </tr>'+
' </tbody>'+
'</table>';
// var toolbar = '<li class="'+'picker-switch' + (this.settings.collapse ? ' accordion-toggle' : '')+'">'+toolbar2+'<li>';
var toolbar = '<li class="picker-switch">'+toolbar2+'<li>';
var templateCssClass= 't-dtpicker-widget';
if (!this.settings.inline) {
templateCssClass += ' dropdown-menu';
}
if (this.use24Hours) {
templateCssClass += ' usetwentyfour';
}
if (isEnabled(this.settings.format, 's') && !this.use24Hours) {
templateCssClass += ' wider';
}
var htmlTemplate = '';
if (hasDate(this.settings.format) && hasTime(this.settings.format)) {
htmlTemplate = ''+
'<div class="'+templateCssClass+' timepicker-sbs">'+
' <div class="row">'+
dateView+
timeView+
toolbar+
' </div>'+
'</div>';
}
else{
htmlTemplate = ''+
'<div class="'+templateCssClass+'">'+
' <ul class="list-unstyled">'+
(hasDate(this.settings.format) ?
' <li>'+dateView+'</li>' : '')+ // '+(this.settings.collapse && hasTime(this.settings.format) ? ' class="collapse in"' : '')+'
(hasTime(this.settings.format) ?
' <li>'+dateView+'</li>' : '')+ // '+(this.settings.collapse && hasTime(this.settings.format) ? ' class="collapse in"' : '')+'
' <li>'+toolbar+'</li>'+
' </ul>'+
'</div>';
}
this.container= $(htmlTemplate);
this.inputElements.view.after(this.container);
// this.inputElements.widgetContainer.append(this.container);
},
initElements: function(){
// var context= this;
this.elements={
// original: this.element//,
decades: $('.datepicker-decades', this.container),
years: $('.datepicker-years', this.container),
months: $('.datepicker-months', this.container),
days: $('.datepicker-days', this.container),
hour: $('.timepicker-hour', this.container),
hours: $('.timepicker-hours', this.container),
minute: $('.timepicker-minute', this.container),
minutes: $('.timepicker-minutes', this.container),
second: $('.timepicker-second', this.container),
seconds: $('.timepicker-seconds', this.container)//,
// view: $('input[type=text]', this.container)
// getTab: function(levelIndex){
// var tabSelector='.t-level-tab-'+levelIndex;
// return $(tabSelector, context.container);
// }
};
if(this.settings.inline){
this.show();
}
this.elements.hours.hide();
this.elements.minutes.hide();
this.elements.seconds.hide();
},
buildObservers: function(){
var context= this;
var datePickerModes= [
{
navFnc: 'M',
navStep: 1
},
{
navFnc: 'y',
navStep: 1
},
{
navFnc: 'y',
navStep: 10
},
{
navFnc: 'y',
navStep: 100
}
];
this.observers= {
next: function () {
var navStep = datePickerModes[this.currentViewMode].navStep;
var navFnc = datePickerModes[this.currentViewMode].navFnc;
this.viewValue.add(navStep, navFnc);
// TODO: with ViewMode
this.refreshDate();
// viewUpdate(navFnc);
},
previous: function () {
var navFnc = datePickerModes[this.currentViewMode].navFnc;
var navStep = datePickerModes[this.currentViewMode].navStep;
this.viewValue.subtract(navStep, navFnc);
// TODO: with ViewMode
this.refreshDate();
// viewUpdate(navFnc);
},
pickerSwitch: function () {
this.showMode(1);
},
selectMonth: function (e) {
var month = $(e.target).closest('tbody').find('span').index($(e.target));
this.viewValue.month(month);
if (this.currentViewMode === this.minViewModeNumber) {
this.setValue(this.value.clone().year(this.viewValue.year()).month(this.viewValue.month()));
if (!this.settings.inline) {
this.hide();
}
} else {
this.showMode(-1);
// fillDate();
this.refreshDays();
}
// viewUpdate('M');
},
selectYear: function (e) {
var year = parseInt($(e.target).text(), 10) || 0;
this.viewValue.year(year);
if (this.currentViewMode === this.minViewModeNumber) {
this.setValue(this.value.clone().year(this.viewValue.year()));
if (!this.settings.inline) {
this.hide();
}
} else {
this.showMode(-1);
this.refreshMonths();
}
// viewUpdate('YYYY');
},
selectDecade: function (e) {
var year = parseInt($(e.target).data('selection'), 10) || 0;
this.viewValue.year(year);
if (this.currentViewMode === this.minViewModeNumber) {
this.setValue(this.value.clone().year(this.viewValue.year()));
if (!this.settings.inline) {
this.hide();
}
} else {
this.showMode(-1);
this.refreshYears();
}
// viewUpdate('YYYY');
},
selectDay: function (e) {
var day = this.viewValue.clone();
if ($(e.target).is('.old')) {
day.subtract(1, 'M');
}
if ($(e.target).is('.new')) {
day.add(1, 'M');
}
this.setValue(day.date(parseInt($(e.target).text(), 10)));
if (!hasTime(this.settings.format) && !this.settings.keepOpen && !this.settings.inline) {
this.hide();
}
},
incrementHours: function () {
var newDate = this.value.clone().add(1, 'h');
if (isValid(this.settings,newDate, 'h')) {
this.setValue(newDate);
}
},
incrementMinutes: function () {
var newDate = this.value.clone().add(this.settings.stepping, 'm');
if (isValid(this.settings,newDate, 'm')) {
this.setValue(newDate);
}
},
incrementSeconds: function () {
var newDate = this.value.clone().add(1, 's');
if (isValid(this.settings,newDate, 's')) {
this.setValue(newDate);
}
},
decrementHours: function () {
var newDate = this.value.clone().subtract(1, 'h');
if (isValid(this.settings,newDate, 'h')) {
this.setValue(newDate);
}
},
decrementMinutes: function () {
var newDate = this.value.clone().subtract(this.settings.stepping, 'm');
if (isValid(this.settings,newDate, 'm')) {
this.setValue(newDate);
}
},
decrementSeconds: function () {
var newDate = this.value.clone().subtract(1, 's');
if (isValid(this.settings,newDate, 's')) {
this.setValue(newDate);
}
},
togglePeriod: function () {
this.setValue(this.value.clone().add((this.value.hours() >= 12) ? -12 : 12, 'h'));
},
// togglePicker: function (e) {
// var $this = $(e.target),
// $parent = $this.closest('ul'),
// expanded = $parent.find('.in'),
// closed = $parent.find('.collapse:not(.in)'),
// collapseData;
// if (expanded && expanded.length) {
// collapseData = expanded.data('collapse');
// if (collapseData && collapseData.transitioning) {
// return;
// }
// if (expanded.collapse) { // if collapse plugin is available through bootstrap.js then use it
// expanded.collapse('hide');
// closed.collapse('show');
// } else { // otherwise just toggle in class on the two views
// expanded.removeClass('in');
// closed.addClass('in');
// }
// if ($this.is('span')) {
// $this.toggleClass(this.settings.icons.time + ' ' + this.settings.icons.date);
// } else {
// $this.find('span').toggleClass(this.settings.icons.time + ' ' + this.settings.icons.date);
// }
// // NOTE: uncomment if toggled state will be restored in show()
// //if (component) {
// // component.find('span').toggleClass(this.settings.icons.time + ' ' + this.settings.icons.date);
// //}
// }
// },
showPicker: function () {
context.container.find('.timepicker > div:not(.timepicker-picker)').hide();
context.container.find('.timepicker .timepicker-picker').show();
},
showHours: function () {
context.container.find('.timepicker .timepicker-picker').hide();
context.container.find('.timepicker .timepicker-hours').show();
},
showMinutes: function () {
context.container.find('.timepicker .timepicker-picker').hide();
context.container.find('.timepicker .timepicker-minutes').show();
},
showSeconds: function () {
context.container.find('.timepicker .timepicker-picker').hide();
context.container.find('.timepicker .timepicker-seconds').show();
},
selectHour: function (e) {
var hour = parseInt($(e.target).text(), 10);
if (!this.use24Hours) {
if (this.value.hours() >= 12) {
if (hour !== 12) {
hour += 12;
}
} else {
if (hour === 12) {
hour = 0;
}
}
}
this.setValue(this.value.clone().hours(hour));
this.observers.showPicker.call(this);
},
selectMinute: function (e) {
this.setValue(this.value.clone().minutes(parseInt($(e.target).text(), 10)));
this.observers.showPicker();
},
selectSecond: function (e) {
this.setValue(this.value.clone().seconds(parseInt($(e.target).text(), 10)));
this.observers.showPicker();
},
clear: function(){
this.clear();
},
today: function () {
var todaysDate = getMoment();
if (isValid(this.settings,todaysDate, 'd')) {
this.setValue(todaysDate);
}
},
close: function(){
this.hide();
}
};
this.keyBinds= {
up: function (widget) {
if (!widget) {
return;
}
var d = this.date() || getMoment(this.settings.format);
if (widget.find('.datepicker').is(':visible')) {
this.date(d.clone().subtract(7, 'd'));
} else {
this.date(d.clone().add(this.stepping(), 'm'));
}
},
down: function (widget) {
if (!widget) {
this.show();
return;
}
var d = this.date() || getMoment(this.settings.format);
if (widget.find('.datepicker').is(':visible')) {
this.date(d.clone().add(7, 'd'));
} else {
this.date(d.clone().subtract(this.stepping(), 'm'));
}
},
'control up': function (widget) {
if (!widget) {
return;
}
var d = this.date() || getMoment(this.settings.format);
if (widget.find('.datepicker').is(':visible')) {
this.date(d.clone().subtract(1, 'y'));
} else {
this.date(d.clone().add(1, 'h'));
}
},
'control down': function (widget) {
if (!widget) {
return;
}
var d = this.date() || getMoment(this.settings.format);
if (widget.find('.datepicker').is(':visible')) {
this.date(d.clone().add(1, 'y'));
} else {
this.date(d.clone().subtract(1, 'h'));
}
},
left: function (widget) {
if (!widget) {
return;
}
var d = this.date() || getMoment(this.settings.format);
if (widget.find('.datepicker').is(':visible')) {
this.date(d.clone().subtract(1, 'd'));
}
},
right: function (widget) {
if (!widget) {
return;
}
var d = this.date() || getMoment(this.settings.format);
if (widget.find('.datepicker').is(':visible')) {
this.date(d.clone().add(1, 'd'));
}
},
pageUp: function (widget) {
if (!widget) {
return;
}
var d = this.date() || getMoment(this.settings.format);
if (widget.find('.datepicker').is(':visible')) {
this.date(d.clone().subtract(1, 'M'));
}
},
pageDown: function (widget) {
if (!widget) {
return;
}
var d = this.date() || getMoment(this.settings.format);
if (widget.find('.datepicker').is(':visible')) {
this.date(d.clone().add(1, 'M'));
}
},
enter: function () {
this.hide();
},
escape: function () {
this.hide();
},
//tab: function (widget) { //this break the flow of the form. disabling for now
// var toggle = widget.find('.picker-switch a[data-action="togglePicker"]');
// if(toggle.length > 0) toggle.click();
//},
'control space': function (widget) {
if (widget.find('.timepicker').is(':visible')) {
widget.find('.btn[data-action="togglePeriod"]').click();
}
},
t: function () {
this.date(getMoment(this.settings.format));
},
'delete': function () {
this.clear();
}
};
},
bindEvents: function(){
var context= this;
var element= this.element;
this.inputElements.button.on('click', $.proxy(this.show, this));
this.container.on('click', '[data-action]', $.proxy(this.doAction, this)); // this handles clicks on the widget
this.container.on('mousedown', false);
$(window).on('resize', $.proxy(this.place, this));
// element.on('click', $.proxy(this.onFooClick, this));
},
// bindEventsInterface: function(){
// var context= this;
// var element= this.element;
// if(this.settings.onFooSelected){
// element.on('click.t.template', $.proxy(this.settings.onFooSelected, this));
// }
// },
render: function(){},
// 事件处理
// onFooClick: function(e, data){
// ;
// },
place: function () {
// var position = (component || element).position(),
// offset = (component || element).offset(),
var position = this.inputElements.view.position();
var offset = this.inputElements.view.offset();
// vertical = this.settings.widgetPositioning.vertical,
// horizontal = this.settings.widgetPositioning.horizontal,
var vertical;
var horizontal;
var parent;
// if (this.settings.widgetParent) {
// parent = this.settings.widgetParent.append(widget);
// } else if (element.is('input')) {
// parent = this.inputElements.view.after(this.container).parent();
// } else if (this.settings.inline) {
// parent = this.inputElements.view.append(widget);
// return;
// } else {
// parent = this.inputElements.view;
// this.inputElements.view.children().first().after(widget);
// }
parent = this.inputElements.view.parent();
// Top and bottom logic
// if (vertical === 'auto') {
if (offset.top + this.container.height() * 1.5 >= $(window).height() + $(window).scrollTop() &&
this.container.height() + this.inputElements.view.outerHeight() < offset.top) {
vertical = 'top';
} else {
vertical = 'bottom';
}
// }
// // Left and right logic
// if (horizontal === 'auto') {
if (parent.width() < offset.left + this.container.outerWidth() / 2 &&
offset.left + this.container.outerWidth() > $(window).width()) {
horizontal = 'right';
} else {
horizontal = 'left';
}
// }
if (vertical === 'top') {
this.container.addClass('top').removeClass('bottom');
} else {
this.container.addClass('bottom').removeClass('top');
}
if (horizontal === 'right') {
this.container.addClass('pull-right');
} else {
this.container.removeClass('pull-right');
}
// find the first parent element that has a relative css positioning
if (parent.css('position') !== 'relative') {
parent = parent.parents().filter(function () {
return $(this).css('position') === 'relative';
}).first();
}
// if (parent.length === 0) {
// throw new Error('datetimepicker component should be placed within a relative positioned container');
// }
this.container.css({
top: vertical === 'top' ? 'auto' : position.top + this.inputElements.view.outerHeight(),
bottom: vertical === 'top' ? position.top + this.inputElements.view.outerHeight() : 'auto',
left: horizontal === 'left' ? (parent === this.inputElements.view ? 0 : position.left) : 'auto',
right: horizontal === 'left' ? 'auto' : parent.outerWidth() - this.inputElements.view.outerWidth() - (parent === this.inputElements.view ? 0 : position.left)
});
},
// viewUpdate: function (e) {
// if (e === 'y') {
// e = 'YYYY';
// }
// // notifyEvent({
// // type: 'dp.update',
// // change: e,
// // viewValue: this.viewValue.clone()
// // });
// },
// dir 方向 加一或减一
showMode: function (dir) {
if (dir) {
this.currentViewMode = Math.max(this.minViewModeNumber, Math.min(3, this.currentViewMode + dir));
}
// this.container.find('.datepicker > div').hide().filter('.datepicker-' + datePickerModes[this.currentViewMode].clsName).show();
this.container.find('.datepicker > div').hide().filter('.datepicker-' + viewModes[this.currentViewMode]).show();
},
fillDate: function () {
},
fillTime: function () {
},
// update: function () {
// if (!widget) {
// return;
// }
// fillDate();
// fillTime();
// },
// setValue: function (targetMoment) {
// var oldDate = unset ? null : this.value;
// // case of calling setValue(null or false)
// if (!targetMoment) {
// unset = true;
// input.val('');
// element.data('date', '');
// notifyEvent({
// type: 'dp.change',
// date: false,
// oldDate: oldDate
// });
// update();
// return;
// }
// targetMoment = targetMoment.clone().locale(this.settings.locale);
// if (this.settings.stepping !== 1) {
// targetMoment.minutes((Math.round(targetMoment.minutes() / this.settings.stepping) * this.settings.stepping) % 60).seconds(0);
// }
// if (isValid(this.settings,targetMoment)) {
// this.value = targetMoment;
// this.viewValue = this.value.clone();
// input.val(this.value.format(this.actualFormat));
// element.data('date', this.value.format(this.actualFormat));
// unset = false;
// update();
// notifyEvent({
// type: 'dp.change',
// date: this.value.clone(),
// oldDate: oldDate
// });
// } else {
// if (!this.settings.keepInvalid) {
// input.val(unset ? '' : this.value.format(this.actualFormat));
// }
// notifyEvent({
// type: 'dp.error',
// date: targetMoment
// });
// }
// },
hide: function () {
///<summary>Hides the widget. Possibly will emit dp.hide</summary>
// var transitioning = false;
// if (!widget) {
// return picker;
// }
// Ignore event if in the middle of a picker transition
// this.container.find('.collapse').each(function () {
// var collapseData = $(this).data('collapse');
// if (collapseData && collapseData.transitioning) {
// transitioning = true;
// return false;
// }
// return true;
// });
// if (transitioning) {
// return;// picker;
// }
// if (component && component.hasClass('btn')) {
// component.toggleClass('active');
this.inputElements.button.toggleClass('active');
// }
this.container.hide();
$(window).off('resize', this.place);
this.container.off('click', '[data-action]');
this.container.off('mousedown', false);
// this.container.remove();
// widget = false;
// notifyEvent({
// type: 'dp.hide',
// date: this.value.clone()
// });
this.inputElements.view.blur();
// return picker;
},
clear: function () {
this.setValue(null);
this.viewValue= getMoment(this.settings.format);
},
/********************************************************************************
*
* Widget UI interaction functions
*
********************************************************************************/
doAction: function (e) {
var jqTarget= $(e.currentTarget);
if (jqTarget.is('.disabled')) {
return false;
}
var action= jqTarget.data('action');
this.observers[action].apply(this, arguments);
return false;
},
show: function () {
if(this.inputElements.original.prop('disabled')){
return;
}
// ///<summary>Shows the widget. Possibly will emit dp.show and dp.change</summary>
// var currentMoment,
// useCurrentGranularity = {
// 'year': function (m) {
// return m.month(0).date(1).hours(0).seconds(0).minutes(0);
// },
// 'month': function (m) {
// return m.date(1).hours(0).seconds(0).minutes(0);
// },
// 'day': function (m) {
// return m.hours(0).seconds(0).minutes(0);
// },
// 'hour': function (m) {
// return m.seconds(0).minutes(0);
// },
// 'minute': function (m) {
// return m.seconds(0);
// }
// };
// if (input.prop('disabled') || (!this.settings.ignoreReadonly && input.prop('readonly')) || widget) {
// return picker;
// }
// if (input.val() !== undefined && input.val().trim().length !== 0) {
// setValue(this.parseInputDate(input.val().trim()));
// // } else if (this.settings.useCurrent && unset && ((input.is('input') && input.val().trim().length === 0) || this.settings.inline)) {
// } else if (this.settings.useCurrent && ((input.is('input') && input.val().trim().length === 0) || this.settings.inline)) {
// currentMoment = getMoment();
// if (typeof this.settings.useCurrent === 'string') {
// currentMoment = useCurrentGranularity[this.settings.useCurrent](currentMoment);
// }
// setValue(currentMoment);
// }
// widget = getTemplate();
// fillDow();
// fillMonths();
// widget.find('.timepicker-hours').hide();
// widget.find('.timepicker-minutes').hide();
// widget.find('.timepicker-seconds').hide();
// update();
// if (component && component.hasClass('btn')) {
// component.toggleClass('active');
// }
// widget.show();
this.showMode();
this.place();
this.container.show();
// if (this.settings.focusOnShow && !input.is(':focus')) {
// input.focus();
// }
// notifyEvent({
// type: 'dp.show'
// });
// return picker;
},
toggle: function () {
/// <summary>Shows or hides the widget</summary>
return (widget ? hide() : show());
},
keydown: function (e) {
var handler = null,
index,
index2,
pressedKeys = [],
pressedModifiers = {},
currentKey = e.which,
keyBindKeys,
allModifiersPressed,
pressed = 'p';
keyState[currentKey] = pressed;
for (index in keyState) {
if (keyState.hasOwnProperty(index) && keyState[index] === pressed) {
pressedKeys.push(index);
if (parseInt(index, 10) !== currentKey) {
pressedModifiers[index] = true;
}
}
}
for (index in this.settings.keyBinds) {
if (this.settings.keyBinds.hasOwnProperty(index) && typeof (this.settings.keyBinds[index]) === 'function') {
keyBindKeys = index.split(' ');
if (keyBindKeys.length === pressedKeys.length && keyMap[currentKey] === keyBindKeys[keyBindKeys.length - 1]) {
allModifiersPressed = true;
for (index2 = keyBindKeys.length - 2; index2 >= 0; index2--) {
if (!(keyMap[keyBindKeys[index2]] in pressedModifiers)) {
allModifiersPressed = false;
break;
}
}
if (allModifiersPressed) {
handler = this.settings.keyBinds[index];
break;
}
}
}
}
if (handler) {
handler.call(picker, widget);
e.stopPropagation();
e.preventDefault();
}
},
keyup: function (e) {
keyState[e.which] = 'r';
e.stopPropagation();
e.preventDefault();
},
change: function (e) {
var val = $(e.target).val().trim(),
parsedDate = val ? this.parseInputDate(val) : null;
setValue(parsedDate);
e.stopImmediatePropagation();
return false;
},
indexGivenDates: function (givenDatesArray) {
// Store given enabledDates and disabledDates as keys.
// This way we can check their existence in O(1) time instead of looping through whole array.
// (for example: options.enabledDates['2014-02-27'] === true)
var givenDatesIndexed = {};
$.each(givenDatesArray, function () {
var dDate = this.parseInputDate(this);
if (dDate.isValid()) {
givenDatesIndexed[dDate.format('YYYY-MM-DD')] = true;
}
});
return (Object.keys(givenDatesIndexed).length) ? givenDatesIndexed : false;
},
indexGivenHours: function (givenHoursArray) {
// Store given enabledHours and disabledHours as keys.
// This way we can check their existence in O(1) time instead of looping through whole array.
// (for example: options.enabledHours['2014-02-27'] === true)
var givenHoursIndexed = {};
$.each(givenHoursArray, function () {
givenHoursIndexed[this] = true;
});
return (Object.keys(givenHoursIndexed).length) ? givenHoursIndexed : false;
},
// API
refresh: function(){
this.refreshDate();
this.refreshTime();
},
refreshDate: function(){
if (!hasDate(this.settings.format)) {
return;
}
this.refreshDecades();
this.refreshYears();
this.refreshMonths();
this.refreshDays();
},
refreshDecades: function(){
var decadesViewHeader = this.elements.decades.find('th');
var startDecade = moment({y: this.viewValue.year() - (this.viewValue.year() % 100) - 1});
var startedAt = startDecade.clone();
var endDecade = startDecade.clone().add(100, 'y');
this.elements.decades.find('.disabled').removeClass('disabled');
if (startDecade.isSame(moment({y: 1900})) || (this.settings.minDate && this.settings.minDate.isAfter(startDecade, 'y'))) {
decadesViewHeader.eq(0).addClass('disabled');
}
decadesViewHeader.eq(1).text(startDecade.year() + '-' + endDecade.year());
if (startDecade.isSame(moment({y: 2000})) || (this.settings.maxDate && this.settings.maxDate.isBefore(endDecade, 'y'))) {
decadesViewHeader.eq(2).addClass('disabled');
}
var htmlTemplate = '';
while (!startDecade.isAfter(endDecade, 'y')) {
htmlTemplate += ''+
'<span '+
' data-action="selectDecade" '+
' class="decade' + (startDecade.isSame(this.value, 'y') ? ' active' : '') + (!isValid(this.settings,startDecade, 'y') ? ' disabled' : '') + '" '+
' data-selection="' + (startDecade.year() + 6) + '">' +
(startDecade.year() + 1) + ' - ' + (startDecade.year() + 12) +
'</span>';
startDecade.add(12, 'y');
}
htmlTemplate += '<span></span><span></span><span></span>'; //push the dangling block over, at least this way it's even
this.elements.decades.find('td').html(htmlTemplate);
decadesViewHeader.eq(1).text((startedAt.year() + 1) + '-' + (startDecade.year()));
},
refreshYears: function(){
var yearsViewHeader = this.elements.years.find('th');
var startYear = this.viewValue.clone().subtract(5, 'y');
var endYear = this.viewValue.clone().add(6, 'y');
this.elements.years.find('.disabled').removeClass('disabled');
if (this.settings.minDate && this.settings.minDate.isAfter(startYear, 'y')) {
yearsViewHeader.eq(0).addClass('disabled');
}
yearsViewHeader.eq(1).text(startYear.year() + '-' + endYear.year());
if (this.settings.maxDate && this.settings.maxDate.isBefore(endYear, 'y')) {
yearsViewHeader.eq(2).addClass('disabled');
}
var htmlTemplate = '';
while (!startYear.isAfter(endYear, 'y')) {
htmlTemplate += ''+
'<span '+
' data-action="selectYear" '+
' class="year' + (startYear.isSame(this.value, 'y') ? ' active' : '') + (!isValid(this.settings,startYear, 'y') ? ' disabled' : '') + '">' +
startYear.year() +
'</span>';
startYear.add(1, 'y');
}
this.elements.years.find('td').html(htmlTemplate);
},
refreshMonths: function(){
var monthsViewHeader = this.elements.months.find('th');
var months = this.elements.months.find('tbody').find('span');
this.elements.months.find('.disabled').removeClass('disabled');
if (!isValid(this.settings,this.viewValue.clone().subtract(1, 'y'), 'y')) {
monthsViewHeader.eq(0).addClass('disabled');
}
monthsViewHeader.eq(1).text(this.viewValue.year());
if (!isValid(this.settings,this.viewValue.clone().add(1, 'y'), 'y')) {
monthsViewHeader.eq(2).addClass('disabled');
}
// 当前月
months.removeClass('active');
if (this.value.isSame(this.viewValue, 'y')) {
months.eq(this.value.month()).addClass('active');
}
var context= this;
months.each(function (index) {
if (!isValid(context.settings,context.viewValue.clone().month(index), 'M')) {
$(this).addClass('disabled');
}
});
},
refreshDays: function(){
var daysViewHeader = this.elements.days.find('th');
this.elements.days.find('.disabled').removeClass('disabled');
if (!isValid(this.settings,this.viewValue.clone().subtract(1, 'M'), 'M')) {
daysViewHeader.eq(0).addClass('disabled');
}
daysViewHeader.eq(1).text(this.viewValue.format(this.settings.dayViewHeaderFormat));
if (!isValid(this.settings,this.viewValue.clone().add(1, 'M'), 'M')) {
daysViewHeader.eq(2).addClass('disabled');
}
// 本月第一个星期的第一天
var currentDate = this.viewValue.clone().startOf('M').startOf('w').startOf('d');
var htmlTemplate= '';
for (var i = 0; i < 42; i++) { //always display 42 days (should show 6 weeks)
var clsName = '';
if (currentDate.isBefore(this.viewValue, 'M')) {
clsName += ' old';
}
if (currentDate.isAfter(this.viewValue, 'M')) {
clsName += ' new';
}
if (currentDate.isSame(this.value, 'd')) {
clsName += ' active';
}
if (!isValid(this.settings,currentDate, 'd')) {
clsName += ' disabled';
}
if (currentDate.isSame(getMoment(), 'd')) {
clsName += ' today';
}
if (currentDate.day() === 0 || currentDate.day() === 6) {
clsName += ' weekend';
}
htmlTemplate += ''+
(currentDate.weekday() === 0 ?
'<tr>' : '')+
(this.settings.calendarWeeks ?
' <td class="cw">'+currentDate.week()+'</td>' : '')+
' <td '+
' data-action="selectDay" '+
' data-day="' + currentDate.format('L') + '" '+
' class="day' + clsName + '">' +
currentDate.date() +
' </td>'+
(currentDate.weekday() === 6 ?
'</tr>' : '');
currentDate.add(1, 'd');
}
this.elements.days.find('tbody').empty().append(htmlTemplate);
},
refreshTime: function(){
if (!hasTime(this.settings.format)) {
return;
}
if (!this.use24Hours) {
var toggle = this.container.find('.timepicker [data-action=togglePeriod]');
var newDate = this.value.clone().add((this.value.hours() >= 12) ? -12 : 12, 'h');
toggle.text(this.value.format('A'));
if (isValid(this.settings,newDate, 'h')) {
toggle.removeClass('disabled');
} else {
toggle.addClass('disabled');
}
}
this.refreshHours();
this.refreshMinutes();
this.refreshSeconds();
},
refreshHours: function(){
var currentHour = this.viewValue.clone().startOf('d');
this.elements.hour.text(currentHour.format(this.use24Hours ? 'HH' : 'hh'));
},
refreshMinutes: function(){
var currentMinute = this.viewValue.clone().startOf('h');
this.elements.minute.text(currentMinute.format('mm'));
},
refreshSeconds: function(){
var currentSecond = this.viewValue.clone().startOf('m');
this.elements.second.text(currentSecond.format('ss'));
},
setValue: function(value){
// var oValue= this.parseInputDate(value);
if(!value || !isValid(this.settings,value)){
this.inputElements.original.val('');
this.inputElements.view.val('');
this.value=null;
}
else{
this.inputElements.original.val(value.format(this.settings.format));
this.inputElements.view.val(value.format(this.settings.format));
this.value=value;
}
},
enable: function(){},
disable: function(){},
destroy: function(){}
});
this.DTPicker = new J.Class({extend: T.UI.BaseControl},{
defaults: defaults,
attributeMap: attributeMap,
settings: {},
templates: {},
elements: {},
// minViewModeNumber: 0, // 最小视图模式,选到这个模式以后关闭弹出窗口。
// currentViewMode: 0,
// use24Hours: true,
// viewValue: false,
// widget: false,
// picker: {},
// date,
// input,
// component: false,
// actualFormat,
// parseFormats,
// datePickerModes: [
// {
// clsName: 'days',
// navFnc: 'M',
// navStep: 1
// },
// {
// clsName: 'months',
// navFnc: 'y',
// navStep: 1
// },
// {
// clsName: 'years',
// navFnc: 'y',
// navStep: 10
// },
// {
// clsName: 'decades',
// navFnc: 'y',
// navStep: 100
// }
// ],
// verticalModes: ['top', 'bottom', 'auto'],
// horizontalModes: ['left', 'right', 'auto'],
// toolbarPlacements: ['default', 'top', 'bottom'],
// 构造函数
init: function(element, options){
var jqElement=$(element);
// this.elements.original= $(element);
// // 防止多次初始化
// if (this.isInitialized()) {
// return this.getRef();
// }
// this.initialize(element);
// $.extend(true, options, dataToOptions());
// picker.options(options);
this.initSettings(jqElement, options);
this.initStates(jqElement);
this.buildHtml(jqElement);
this.initElements();
this.buildObservers();
this.bindEvents();
// this.bindEventsInterface();
// if (!this.settings.inline && !input.is('input')) {
// throw new Error('Could not initialize DateTimePicker without an input element');
// }
if (this.settings.inline) {
this.show();
}
},
initStates: function(element){
// this.value= this.element.val();
// Set defaults for date here now instead of in var declaration
// this.initFormatting();
// if (input.is('input') && input.val().trim().length !== 0) {
// this.setValue(this.parseInputDate(input.val().trim()));
// }
// else if (this.settings.defaultDate && input.attr('placeholder') === undefined) {
// this.setValue(this.settings.defaultDate);
// }
// this.setValue(this.parseInputDate(this.element.val().trim()));
// this.setValue(this.parseInputDate(element.val().trim()));
var value= this.parseInputDate(element.val().trim());
if(!value || !isValid(this.settings,value)){
element.val('');
}
else{
element.val(value.format(this.settings.format));
}
},
buildHtml: function(element){
var htmlTemplate = ''+
'<div class="t-dtpicker-container input-group">' +
' <input type="text" class="form-control">' + // data-toggle="dropdown"
' <div class="input-group-btn">' +
' <button type="button" class="btn btn-default">' + // data-toggle="modal" data-target="#myModal">
' <span class="glyphicon glyphicon-calendar"></span>' +
' </button>' +
' </div>' +
// ' <div class="t-dtpicker-widget-container">'+ // dropdown-menu
// ' </div>'+
'</div>';
var container = $(htmlTemplate);
this.elements={
original: element,
container: container,
view: $('input[type=text]', container),
button: $('button', container)//,
// widgetContainer: $('.t-dtpicker-widget-container', container)//,
// getTab: function(levelIndex){
// var tabSelector='.t-level-tab-'+levelIndex;
// return $(tabSelector, context.container);
// }
};
// this.element.after(this.container);
},
initElements: function(){
// var context= this;
// // initializing element and component attributes
// if (this.element.is('input')) {
// input = element;
// } else {
// input = element.find(this.settings.datepickerInput);
// if (input.size() === 0) {
// input = element.find('input');
// } else if (!input.is('input')) {
// throw new Error('CSS class "' + this.settings.datepickerInput + '" cannot be applied to non input element');
// }
// }
// if (element.hasClass('input-group')) {
// // in case there is more then one 'input-group-addon' Issue #48
// if (element.find('.datepickerbutton').size() === 0) {
// component = element.find('.input-group-addon');
// } else {
// component = element.find('.datepickerbutton');
// }
// }
// var elements={
// // original: this.element,
// view: $('input[type=text]', this.container),
// button: $('button', this.container),
// widgetContainer: $('.t-dtpicker-widget-container', this.container)//,
// // getTab: function(levelIndex){
// // var tabSelector='.t-level-tab-'+levelIndex;
// // return $(tabSelector, context.container);
// // }
// };
// this.elements= $.extend(true, {}, this.elements, elements);
this.elements.original.before(this.elements.container);
this.elements.original.hide();
this.elements.view.val(this.elements.original.val());
if (this.elements.original.prop('disabled')) {
this.disable();
}
this.widget= new Widget(this.elements, this.settings);
},
transferAttributes: function(){
//this.settings.placeholder = this.$source.attr('data-placeholder') || this.settings.placeholder
//this.$element.attr('placeholder', this.settings.placeholder)
// this.elements.target.attr('name', this.elements.original.attr('name'))
// this.elements.target.val(this.elements.original.val())
// this.elements.original.removeAttr('name') // Remove from source otherwise form will pass parameter twice.
this.elements.view.attr('required', this.elements.original.attr('required'))
this.elements.view.attr('rel', this.elements.original.attr('rel'))
this.elements.view.attr('title', this.elements.original.attr('title'))
this.elements.view.attr('class', this.elements.original.attr('class'))
this.elements.view.attr('tabindex', this.elements.original.attr('tabindex'))
this.elements.original.removeAttr('tabindex')
if (this.elements.original.attr('disabled')!==undefined){
this.disable();
}
},
buildObservers: function(){},
bindEvents: function(){
var context= this;
var element= this.elements.original;
this.elements.view.on({
'change': $.proxy(this.change, this),
// 'blur': this.settings.debug ? '' : hide,
'blur': $.proxy(this.hide, this),
'keydown': $.proxy(this.keydown, this),
'keyup': $.proxy(this.keyup, this),
// 'focus': this.settings.allowInputToggle ? show : ''
'focus': $.proxy(this.widget.show, this.widget),
'click': $.proxy(this.widget.show, this.widget)
});
// if (this.elements.original.is('input')) {
// input.on({
// 'focus': show
// });
// } else if (component) {
// component.on('click', toggle);
// component.on('mousedown', false);
// }
// element.on('click', $.proxy(this.onFooClick, this));
},
// bindEventsInterface: function(){
// var context= this;
// var element= this.elements.original;
// if(this.settings.onFooSelected){
// element.on('click.t.template', $.proxy(this.settings.onFooSelected, this));
// }
// },
render: function(){},
// 事件处理
// onFooClick: function(e, data){
// ;
// },
parseInputDate: function (inputDate) {
if (this.settings.parseInputDate === undefined) {
if (moment.isMoment(inputDate) || inputDate instanceof Date) {
inputDate = moment(inputDate);
} else {
inputDate = getMoment(this.settings.format, inputDate);
}
} else {
inputDate = this.settings.parseInputDate(inputDate);
}
// inputDate.locale(this.settings.locale);
return inputDate;
},
// API
getValue: function(){
var sValue= this.elements.original.val();
var oValue= this.parseInputDate(sValue);
return oValue;
},
setValue: function(value){
// var oValue= this.parseInputDate(value);
if(!value || !isValid(this.settings,value)){
this.elements.original.val('');
}
else{
this.elements.original.val(value.format(this.settings.format));
}
},
refresh: function(){},
enable: function(){
this.elements.original.prop('disabled', false);
this.elements.button.removeClass('disabled');
},
disable: function(){
this.hide();
this.elements.original.prop('disabled', true);
this.elements.button.addClass('disabled');
},
destroy: function(){
this.hide();
this.elements.original.off({
'change': change,
'blur': blur,
'keydown': keydown,
'keyup': keyup,
'focus': this.settings.allowInputToggle ? hide : ''
});
// if (this.elements.original.is('input')) {
// input.off({
// 'focus': show
// });
// } else if (component) {
// component.off('click', toggle);
// component.off('mousedown', false);
// }
// this.elements.original.removeData('DateTimePicker');
// this.elements.original.removeData('date');
}
});
});
| mit |
youngguns-nl/moneybird_php_api | docs/classes/Moneybird.RecurringTemplate.Detail.html | 41524 | <!DOCTYPE html><html xmlns:date="http://exslt.org/dates-and-times" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta charset="utf-8">
<title>phpDocumentor » \Moneybird\RecurringTemplate\Detail</title>
<meta name="author" content="Mike van Riel">
<meta name="description" content="">
<link href="../css/template.css" rel="stylesheet" media="all">
<script src="../js/jquery-1.7.1.min.js" type="text/javascript"></script><script src="../js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script><script src="../js/jquery.mousewheel.min.js" type="text/javascript"></script><script src="../js/bootstrap.js" type="text/javascript"></script><script src="../js/template.js" type="text/javascript"></script><script src="../js/prettify/prettify.min.js" type="text/javascript"></script><link rel="shortcut icon" href="../img/favicon.ico">
<link rel="apple-touch-icon" href="../img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png">
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner"><div class="container">
<a 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></a><a class="brand" href="../index.html">phpDocumentor</a><div class="nav-collapse"><ul class="nav">
<li class="dropdown">
<a href="#api" class="dropdown-toggle" data-toggle="dropdown">
API Documentation <b class="caret"></b></a><ul class="dropdown-menu">
<li><a>Namespaces</a></li>
<li><a href="../namespaces/Moneybird.html"><i class="icon-th"></i> Moneybird</a></li>
<li><a href="../namespaces/global.html"><i class="icon-th"></i> global</a></li>
</ul>
</li>
<li class="dropdown" id="charts-menu">
<a href="#charts" class="dropdown-toggle" data-toggle="dropdown">
Charts <b class="caret"></b></a><ul class="dropdown-menu"><li><a href="../graph_class.html"><i class="icon-list-alt"></i> Class hierarchy diagram</a></li></ul>
</li>
<li class="dropdown" id="reports-menu">
<a href="#reports" class="dropdown-toggle" data-toggle="dropdown">
Reports <b class="caret"></b></a><ul class="dropdown-menu">
<li><a href="../errors.html"><i class="icon-remove-sign"></i> Errors
<span class="label label-info">622</span></a></li>
<li><a href="../markers.html"><i class="icon-map-marker"></i> Markers
<ul><li>todo
<span class="label label-info">1</span>
</li></ul></a></li>
<li><a href="../deprecated.html"><i class="icon-stop"></i> Deprecated elements
<span class="label label-info">0</span></a></li>
</ul>
</li>
</ul></div>
</div></div>
<div class="go_to_top"><a href="#___" style="color: inherit">Back to top <i class="icon-upload icon-white"></i></a></div>
</div>
<div id="___" class="container">
<noscript><div class="alert alert-warning">
Javascript is disabled; several features are only available
if Javascript is enabled.
</div></noscript>
<div class="row">
<div class="span4">
<span class="btn-group visibility" data-toggle="buttons-checkbox"><button class="btn public active" title="Show public elements">Public</button><button class="btn protected" title="Show protected elements">Protected</button><button class="btn private" title="Show private elements">Private</button><button class="btn inherited active" title="Show inherited elements">Inherited</button></span><div class="btn-group view pull-right" data-toggle="buttons-radio">
<button class="btn details" title="Show descriptions and method names"><i class="icon-list"></i></button><button class="btn simple" title="Show only method names"><i class="icon-align-justify"></i></button>
</div>
<ul class="side-nav nav nav-list">
<li class="nav-header">
<i class="icon-custom icon-method"></i> Methods</li>
<li class="method public inherited"><a href="#__construct" title="__construct :: Construct a new object and extract data"><span class="description">Construct a new object and extract data</span><pre>__construct()</pre></a></li>
<li class="method public inherited"><a href="#__get" title="__get :: Proxy to disclose method"><span class="description">Proxy to disclose method</span><pre>__get()</pre></a></li>
<li class="method public inherited"><a href="#__set" title="__set :: Magic set method
Do not allow set"><span class="description">Magic set method
Do not allow set</span><pre>__set()</pre></a></li>
<li class="method public inherited"><a href="#disclose" title="disclose :: Discloses all values of the object that should be visible in the view layer."><span class="description">Discloses all values of the object that should be visible in the view layer.</span><pre>disclose()</pre></a></li>
<li class="method public inherited"><a href="#getDirtyAttributes" title="getDirtyAttributes :: Returns an array representation of this object's dirty attributes"><span class="description">Returns an array representation of this object's dirty attributes</span><pre>getDirtyAttributes()</pre></a></li>
<li class="method public inherited"><a href="#getId" title="getId :: Return the objects id or null"><span class="description">Return the objects id or null</span><pre>getId()</pre></a></li>
<li class="method public inherited"><a href="#isDeleted" title="isDeleted :: Get delete status"><span class="description">Get delete status</span><pre>isDeleted()</pre></a></li>
<li class="method public inherited"><a href="#isDirty" title="isDirty :: Returns true if the object contains any dirty attributes"><span class="description">Returns true if the object contains any dirty attributes</span><pre>isDirty()</pre></a></li>
<li class="method public inherited"><a href="#setData" title="setData :: Sets data"><span class="description">Sets data</span><pre>setData()</pre></a></li>
<li class="method public inherited"><a href="#setDeleted" title="setDeleted :: Mark deleted"><span class="description">Mark deleted</span><pre>setDeleted()</pre></a></li>
<li class="method public inherited"><a href="#toArray" title="toArray :: Get array representation of Subject"><span class="description">Get array representation of Subject</span><pre>toArray()</pre></a></li>
<li class="nav-header protected">» Protected</li>
<li class="method protected inherited"><a href="#_initDisclosedAttributes" title="_initDisclosedAttributes :: Create disclosedAttributes array"><span class="description">Create disclosedAttributes array</span><pre>_initDisclosedAttributes()</pre></a></li>
<li class="method protected inherited"><a href="#_initVars" title="_initVars :: Initialize vars"><span class="description">Initialize vars</span><pre>_initVars()</pre></a></li>
<li class="method protected inherited"><a href="#copy" title="copy :: Copy the object"><span class="description">Copy the object</span><pre>copy()</pre></a></li>
<li class="method protected inherited"><a href="#extract" title="extract :: Extract will take an array and try to automatically map the array values
to properties in this object"><span class="description">Extract will take an array and try to automatically map the array values
to properties in this object</span><pre>extract()</pre></a></li>
<li class="method protected inherited"><a href="#init" title="init :: Initialize"><span class="description">Initialize</span><pre>init()</pre></a></li>
<li class="method protected inherited"><a href="#reload" title="reload :: Adopt the data from $self"><span class="description">Adopt the data from $self</span><pre>reload()</pre></a></li>
<li class="method protected inherited"><a href="#selfToArray" title="selfToArray :: Returns an array representation of this object"><span class="description">Returns an array representation of this object</span><pre>selfToArray()</pre></a></li>
<li class="method protected inherited"><a href="#setClean" title="setClean :: Set dirty state to clean"><span class="description">Set dirty state to clean</span><pre>setClean()</pre></a></li>
<li class="method protected inherited"><a href="#setDirty" title="setDirty :: Set dirty state to dirty"><span class="description">Set dirty state to dirty</span><pre>setDirty()</pre></a></li>
<li class="method protected inherited"><a href="#setDirtyState" title="setDirtyState :: Set dirty state based on bool"><span class="description">Set dirty state based on bool</span><pre>setDirtyState()</pre></a></li>
<li class="method protected inherited"><a href="#validate" title="validate :: Validate object"><span class="description">Validate object</span><pre>validate()</pre></a></li>
<li class="nav-header">
<i class="icon-custom icon-property"></i> Properties</li>
<li class="nav-header protected">» Protected</li>
<li class="property protected inherited"><a href="#%24_deleted" title="$_deleted :: "><span class="description">$_deleted</span><pre>$_deleted</pre></a></li>
<li class="property protected inherited"><a href="#%24_dirtyAttr" title="$_dirtyAttr :: Array of attributes that are dirty"><span class="description">Array of attributes that are dirty</span><pre>$_dirtyAttr</pre></a></li>
<li class="property protected inherited"><a href="#%24_discloseAttr" title="$_discloseAttr :: Array containing attributes to disclose"><span class="description">Array containing attributes to disclose</span><pre>$_discloseAttr</pre></a></li>
<li class="property protected inherited"><a href="#%24_disclosure" title="$_disclosure :: Disclosure"><span class="description">Disclosure</span><pre>$_disclosure</pre></a></li>
<li class="property protected inherited"><a href="#%24_readonlyAttr" title="$_readonlyAttr :: Array of attributes that can't be modified"><span class="description">Array of attributes that can't be modified</span><pre>$_readonlyAttr</pre></a></li>
<li class="property protected inherited"><a href="#%24_requiredAttr" title="$_requiredAttr :: Array of attributes that are required"><span class="description">Array of attributes that are required</span><pre>$_requiredAttr</pre></a></li>
<li class="property protected inherited"><a href="#%24amount" title="$amount :: "><span class="description">$amount</span><pre>$amount</pre></a></li>
<li class="property protected inherited"><a href="#%24createdAt" title="$createdAt :: "><span class="description">$createdAt</span><pre>$createdAt</pre></a></li>
<li class="property protected inherited"><a href="#%24description" title="$description :: "><span class="description">$description</span><pre>$description</pre></a></li>
<li class="property protected inherited"><a href="#%24id" title="$id :: "><span class="description">$id</span><pre>$id</pre></a></li>
<li class="property protected inherited"><a href="#%24ledgerAccountId" title="$ledgerAccountId :: "><span class="description">$ledgerAccountId</span><pre>$ledgerAccountId</pre></a></li>
<li class="property protected inherited"><a href="#%24price" title="$price :: "><span class="description">$price</span><pre>$price</pre></a></li>
<li class="property protected inherited"><a href="#%24rowOrder" title="$rowOrder :: "><span class="description">$rowOrder</span><pre>$rowOrder</pre></a></li>
<li class="property protected inherited"><a href="#%24tax" title="$tax :: "><span class="description">$tax</span><pre>$tax</pre></a></li>
<li class="property protected inherited"><a href="#%24taxRateId" title="$taxRateId :: "><span class="description">$taxRateId</span><pre>$taxRateId</pre></a></li>
<li class="property protected inherited"><a href="#%24totalPriceExclTax" title="$totalPriceExclTax :: "><span class="description">$totalPriceExclTax</span><pre>$totalPriceExclTax</pre></a></li>
<li class="property protected inherited"><a href="#%24totalPriceInclTax" title="$totalPriceInclTax :: "><span class="description">$totalPriceInclTax</span><pre>$totalPriceInclTax</pre></a></li>
<li class="property protected inherited"><a href="#%24updatedAt" title="$updatedAt :: "><span class="description">$updatedAt</span><pre>$updatedAt</pre></a></li>
</ul>
</div>
<div class="span8">
<a name="%5CMoneybird%5CRecurringTemplate%5CDetail" id="\Moneybird\RecurringTemplate\Detail"></a><ul class="breadcrumb">
<li>
<a href="../index.html"><i class="icon-custom icon-class"></i></a><span class="divider">\</span>
</li>
<li><a href="../namespaces/Moneybird.html">Moneybird</a></li>
<span class="divider">\</span><li><a href="../namespaces/Moneybird.RecurringTemplate.html">RecurringTemplate</a></li>
<li class="active">
<span class="divider">\</span><a href="../classes/Moneybird.RecurringTemplate.Detail.html">Detail</a>
</li>
</ul>
<div href="../classes/Moneybird.RecurringTemplate.Detail.html" class="element class">
<p class="short_description">RecurringTemplate_Detail</p>
<div class="details">
<p class="long_description"></p>
<h3>
<i class="icon-custom icon-method"></i> Methods</h3>
<a name="__construct" id="__construct"></a><div class="element clickable method public __construct" data-toggle="collapse" data-target=".__construct .collapse">
<h2>Construct a new object and extract data</h2>
<pre>__construct(array $data, bool $isDirty) </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::__construct()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::__construct()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$data</h4>
<code>array</code>
</div>
<div class="subelement argument">
<h4>$isDirty</h4>
<code>bool</code><p>new data is dirty, defaults to true</p></div>
</div></div>
</div>
<a name="__get" id="__get"></a><div class="element clickable method public __get" data-toggle="collapse" data-target=".__get .collapse">
<h2>Proxy to disclose method</h2>
<pre>__get(String $key) : mixed</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::__get()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::__get()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$key</h4>
<code>String</code>
</div>
<h3>Returns</h3>
<div class="subelement response"><code>mixed</code></div>
</div></div>
</div>
<a name="__set" id="__set"></a><div class="element clickable method public __set" data-toggle="collapse" data-target=".__set .collapse">
<h2>Magic set method
Do not allow set</h2>
<pre>__set(string $name, mixed $value) </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::__set()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::__set()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$name</h4>
<code>string</code>
</div>
<div class="subelement argument">
<h4>$value</h4>
<code>mixed</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code><a href="../classes/Moneybird.Domainmodel.Exception.html">\Moneybird\Domainmodel\Exception</a></code></th>
<td></td>
</tr></table>
</div></div>
</div>
<a name="disclose" id="disclose"></a><div class="element clickable method public disclose" data-toggle="collapse" data-target=".disclose .collapse">
<h2>Discloses all values of the object that should be visible in the view layer.</h2>
<pre>disclose(mixed $key) : mixed</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>access</th>
<td>public</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::disclose()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::disclose()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$key</h4>
<code>mixed</code>
</div>
<h3>Returns</h3>
<div class="subelement response"><code>mixed</code></div>
</div></div>
</div>
<a name="getDirtyAttributes" id="getDirtyAttributes"></a><div class="element clickable method public getDirtyAttributes" data-toggle="collapse" data-target=".getDirtyAttributes .collapse">
<h2>Returns an array representation of this object's dirty attributes</h2>
<pre>getDirtyAttributes() : array</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>access</th>
<td>public</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::getDirtyAttributes()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::getDirtyAttributes()</td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response"><code>array</code></div>
</div></div>
</div>
<a name="getId" id="getId"></a><div class="element clickable method public getId" data-toggle="collapse" data-target=".getId .collapse">
<h2>Return the objects id or null</h2>
<pre>getId() : int</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::getId()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::getId()</td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response"><code>int</code></div>
</div></div>
</div>
<a name="isDeleted" id="isDeleted"></a><div class="element clickable method public isDeleted" data-toggle="collapse" data-target=".isDeleted .collapse">
<h2>Get delete status</h2>
<pre>isDeleted() : bool</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::isDeleted()</td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response"><code>bool</code></div>
</div></div>
</div>
<a name="isDirty" id="isDirty"></a><div class="element clickable method public isDirty" data-toggle="collapse" data-target=".isDirty .collapse">
<h2>Returns true if the object contains any dirty attributes</h2>
<pre>isDirty() : bool</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>access</th>
<td>public</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::isDirty()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::isDirty()</td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response"><code>bool</code></div>
</div></div>
</div>
<a name="setData" id="setData"></a><div class="element clickable method public setData" data-toggle="collapse" data-target=".setData .collapse">
<h2>Sets data</h2>
<pre>setData(array $data, bool $isDirty) </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::setData()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::setData()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$data</h4>
<code>array</code>
</div>
<div class="subelement argument">
<h4>$isDirty</h4>
<code>bool</code><p>new data is dirty, defaults to true</p></div>
</div></div>
</div>
<a name="setDeleted" id="setDeleted"></a><div class="element clickable method public setDeleted" data-toggle="collapse" data-target=".setDeleted .collapse">
<h2>Mark deleted</h2>
<pre>setDeleted() </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::setDeleted()</td>
</tr></table>
</div></div>
</div>
<a name="toArray" id="toArray"></a><div class="element clickable method public toArray" data-toggle="collapse" data-target=".toArray .collapse">
<h2>Get array representation of Subject</h2>
<pre>toArray() : Array</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Mapper\Mapable::toArray()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::toArray()</td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response"><code>Array</code></div>
</div></div>
</div>
<a name="_initDisclosedAttributes" id="_initDisclosedAttributes"></a><div class="element clickable method protected _initDisclosedAttributes" data-toggle="collapse" data-target="._initDisclosedAttributes .collapse">
<h2>Create disclosedAttributes array</h2>
<pre>_initDisclosedAttributes() </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::_initDisclosedAttributes()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::_initDisclosedAttributes()</td>
</tr>
</table>
</div></div>
</div>
<a name="_initVars" id="_initVars"></a><div class="element clickable method protected _initVars" data-toggle="collapse" data-target="._initVars .collapse">
<h2>Initialize vars</h2>
<pre>_initVars() </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::_initVars()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::_initVars()</td>
</tr>
</table>
</div></div>
</div>
<a name="copy" id="copy"></a><div class="element clickable method protected copy" data-toggle="collapse" data-target=".copy .collapse">
<h2>Copy the object</h2>
<pre>copy(array $filter) : \Moneybird\Domainmodel\self</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::copy()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::copy()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$filter</h4>
<code>Array</code><p>Attributes not to copy</p></div>
<h3>Returns</h3>
<div class="subelement response"><code>\Moneybird\Domainmodel\self</code></div>
</div></div>
</div>
<a name="extract" id="extract"></a><div class="element clickable method protected extract" data-toggle="collapse" data-target=".extract .collapse">
<h2>Extract will take an array and try to automatically map the array values
to properties in this object</h2>
<pre>extract(array $values, Array $filter, bool $isDirty) </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>access</th>
<td>protected</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::extract()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::extract()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$values</h4>
<code>Array</code>
</div>
<div class="subelement argument">
<h4>$filter</h4>
<code>Array</code>
</div>
<div class="subelement argument">
<h4>$isDirty</h4>
<code>bool</code><p>new data is dirty, defaults to true</p></div>
</div></div>
</div>
<a name="init" id="init"></a><div class="element clickable method protected init" data-toggle="collapse" data-target=".init .collapse">
<h2>Initialize</h2>
<pre>init() </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::init()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::init()</td>
</tr>
</table>
</div></div>
</div>
<a name="reload" id="reload"></a><div class="element clickable method protected reload" data-toggle="collapse" data-target=".reload .collapse">
<h2>Adopt the data from $self</h2>
<pre>reload(\Moneybird\Domainmodel\AbstractModel $self) : \Moneybird\Domainmodel\self</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::reload()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::reload()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$self</h4>
<code><a href="../classes/Moneybird.Domainmodel.AbstractModel.html">\Moneybird\Domainmodel\AbstractModel</a></code>
</div>
<h3>Returns</h3>
<div class="subelement response"><code>\Moneybird\Domainmodel\self</code></div>
</div></div>
</div>
<a name="selfToArray" id="selfToArray"></a><div class="element clickable method protected selfToArray" data-toggle="collapse" data-target=".selfToArray .collapse">
<h2>Returns an array representation of this object</h2>
<pre>selfToArray(array $filter) : array</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>access</th>
<td>protected</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::selfToArray()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::selfToArray()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$filter</h4>
<code></code>
</div>
<h3>Returns</h3>
<div class="subelement response"><code>array</code></div>
</div></div>
</div>
<a name="setClean" id="setClean"></a><div class="element clickable method protected setClean" data-toggle="collapse" data-target=".setClean .collapse">
<h2>Set dirty state to clean</h2>
<pre>setClean(string $attr) : \Moneybird\Domainmodel\self</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::setClean()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::setClean()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$attr</h4>
<code>string</code><p>Name of attribute, if null (default) set all attribures clean</p>
</div>
<h3>Returns</h3>
<div class="subelement response"><code>\Moneybird\Domainmodel\self</code></div>
</div></div>
</div>
<a name="setDirty" id="setDirty"></a><div class="element clickable method protected setDirty" data-toggle="collapse" data-target=".setDirty .collapse">
<h2>Set dirty state to dirty</h2>
<pre>setDirty(string $attr) : \Moneybird\Domainmodel\self</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::setDirty()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::setDirty()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$attr</h4>
<code>string</code><p>Name of attribute, if null (default) set all attribures dirty</p>
</div>
<h3>Returns</h3>
<div class="subelement response"><code>\Moneybird\Domainmodel\self</code></div>
</div></div>
</div>
<a name="setDirtyState" id="setDirtyState"></a><div class="element clickable method protected setDirtyState" data-toggle="collapse" data-target=".setDirtyState .collapse">
<h2>Set dirty state based on bool</h2>
<pre>setDirtyState(bool $isDirty, string $attr) : \Moneybird\Domainmodel\self</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::setDirtyState()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::setDirtyState()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$isDirty</h4>
<code>bool</code>
</div>
<div class="subelement argument">
<h4>$attr</h4>
<code>string</code><p>Name of attribute, if null (default) change state of all attribures</p>
</div>
<h3>Returns</h3>
<div class="subelement response"><code>\Moneybird\Domainmodel\self</code></div>
</div></div>
</div>
<a name="validate" id="validate"></a><div class="element clickable method protected validate" data-toggle="collapse" data-target=".validate .collapse">
<h2>Validate object</h2>
<pre>validate() : bool</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::validate()</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::validate()</td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response"><code>bool</code></div>
</div></div>
</div>
<h3>
<i class="icon-custom icon-property"></i> Properties</h3>
<a name="%24_deleted" id="$_deleted"> </a><div class="element clickable property protected $_deleted" data-toggle="collapse" data-target=".$_deleted .collapse">
<h2>$_deleted</h2>
<pre>$_deleted </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$_deleted</td>
</tr></table>
</div></div>
</div>
<a name="%24_dirtyAttr" id="$_dirtyAttr"> </a><div class="element clickable property protected $_dirtyAttr" data-toggle="collapse" data-target=".$_dirtyAttr .collapse">
<h2>Array of attributes that are dirty</h2>
<pre>$_dirtyAttr : Array</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::$$_dirtyAttr</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$_dirtyAttr</td>
</tr>
</table>
</div></div>
</div>
<a name="%24_discloseAttr" id="$_discloseAttr"> </a><div class="element clickable property protected $_discloseAttr" data-toggle="collapse" data-target=".$_discloseAttr .collapse">
<h2>Array containing attributes to disclose</h2>
<pre>$_discloseAttr : array</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>access</th>
<td>protected</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::$$_discloseAttr</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$_discloseAttr</td>
</tr>
</table>
</div></div>
</div>
<a name="%24_disclosure" id="$_disclosure"> </a><div class="element clickable property protected $_disclosure" data-toggle="collapse" data-target=".$_disclosure .collapse">
<h2>Disclosure</h2>
<pre>$_disclosure : <a href="../classes/Moneybird.Disclosure.html">\Moneybird\Disclosure</a></pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>access</th>
<td>protected</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::$$_disclosure</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$_disclosure</td>
</tr>
</table>
</div></div>
</div>
<a name="%24_readonlyAttr" id="$_readonlyAttr"> </a><div class="element clickable property protected $_readonlyAttr" data-toggle="collapse" data-target=".$_readonlyAttr .collapse">
<h2>Array of attributes that can't be modified</h2>
<pre>$_readonlyAttr : Array</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$_readonlyAttr</td>
</tr></table>
</div></div>
</div>
<a name="%24_requiredAttr" id="$_requiredAttr"> </a><div class="element clickable property protected $_requiredAttr" data-toggle="collapse" data-target=".$_requiredAttr .collapse">
<h2>Array of attributes that are required</h2>
<pre>$_requiredAttr : Array</pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\Moneybird\Domainmodel\AbstractModel::$$_requiredAttr</td>
</tr>
<tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$_requiredAttr</td>
</tr>
</table>
</div></div>
</div>
<a name="%24amount" id="$amount"> </a><div class="element clickable property protected $amount" data-toggle="collapse" data-target=".$amount .collapse">
<h2>$amount</h2>
<pre>$amount </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$amount</td>
</tr></table>
</div></div>
</div>
<a name="%24createdAt" id="$createdAt"> </a><div class="element clickable property protected $createdAt" data-toggle="collapse" data-target=".$createdAt .collapse">
<h2>$createdAt</h2>
<pre>$createdAt </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$createdAt</td>
</tr></table>
</div></div>
</div>
<a name="%24description" id="$description"> </a><div class="element clickable property protected $description" data-toggle="collapse" data-target=".$description .collapse">
<h2>$description</h2>
<pre>$description </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$description</td>
</tr></table>
</div></div>
</div>
<a name="%24id" id="$id"> </a><div class="element clickable property protected $id" data-toggle="collapse" data-target=".$id .collapse">
<h2>$id</h2>
<pre>$id </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$id</td>
</tr></table>
</div></div>
</div>
<a name="%24ledgerAccountId" id="$ledgerAccountId"> </a><div class="element clickable property protected $ledgerAccountId" data-toggle="collapse" data-target=".$ledgerAccountId .collapse">
<h2>$ledgerAccountId</h2>
<pre>$ledgerAccountId </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$ledgerAccountId</td>
</tr></table>
</div></div>
</div>
<a name="%24price" id="$price"> </a><div class="element clickable property protected $price" data-toggle="collapse" data-target=".$price .collapse">
<h2>$price</h2>
<pre>$price </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$price</td>
</tr></table>
</div></div>
</div>
<a name="%24rowOrder" id="$rowOrder"> </a><div class="element clickable property protected $rowOrder" data-toggle="collapse" data-target=".$rowOrder .collapse">
<h2>$rowOrder</h2>
<pre>$rowOrder </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$rowOrder</td>
</tr></table>
</div></div>
</div>
<a name="%24tax" id="$tax"> </a><div class="element clickable property protected $tax" data-toggle="collapse" data-target=".$tax .collapse">
<h2>$tax</h2>
<pre>$tax </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$tax</td>
</tr></table>
</div></div>
</div>
<a name="%24taxRateId" id="$taxRateId"> </a><div class="element clickable property protected $taxRateId" data-toggle="collapse" data-target=".$taxRateId .collapse">
<h2>$taxRateId</h2>
<pre>$taxRateId </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$taxRateId</td>
</tr></table>
</div></div>
</div>
<a name="%24totalPriceExclTax" id="$totalPriceExclTax"> </a><div class="element clickable property protected $totalPriceExclTax" data-toggle="collapse" data-target=".$totalPriceExclTax .collapse">
<h2>$totalPriceExclTax</h2>
<pre>$totalPriceExclTax </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$totalPriceExclTax</td>
</tr></table>
</div></div>
</div>
<a name="%24totalPriceInclTax" id="$totalPriceInclTax"> </a><div class="element clickable property protected $totalPriceInclTax" data-toggle="collapse" data-target=".$totalPriceInclTax .collapse">
<h2>$totalPriceInclTax</h2>
<pre>$totalPriceInclTax </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$totalPriceInclTax</td>
</tr></table>
</div></div>
</div>
<a name="%24updatedAt" id="$updatedAt"> </a><div class="element clickable property protected $updatedAt" data-toggle="collapse" data-target=".$updatedAt .collapse">
<h2>$updatedAt</h2>
<pre>$updatedAt </pre>
<div class="labels"><span class="label">Inherited</span></div>
<div class="row collapse"><div class="detail-description">
<p class="long_description"></p>
<table class="table table-bordered"><tr>
<th>inherited_from</th>
<td>\Moneybird\Detail\AbstractDetail::$$updatedAt</td>
</tr></table>
</div></div>
</div>
</div>
</div>
</div>
</div>
<div class="row"><footer class="span12">
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a8</a> and<br>
generated on 2013-07-12T22:19:08+02:00.<br></footer></div>
</div>
</body>
</html>
| mit |
albertodall/eShopOnContainers | src/Services/Webhooks/Webhooks.API/Exceptions/WebhooksDomainException.cs | 121 | using System;
namespace Webhooks.API.Exceptions
{
public class WebhooksDomainException : Exception
{
}
}
| mit |
zkweb-framework/ZKWeb.Plugins | src/ZKWeb.Plugins/Common.Currency/src/Components/Currencies/RUB.cs | 412 | using ZKWeb.Plugins.Common.Currency.src.Components.Interfaces;
using ZKWebStandard.Ioc;
namespace ZKWeb.Plugins.Common.Currency.src.Components.Currencies {
/// <summary>
/// 卢布
/// </summary>
[ExportMany]
public class RUB : ICurrency {
public string Type { get { return "RUB"; } }
public string Prefix { get { return "₽"; } }
public string Suffix { get { return null; } }
}
}
| mit |
gampleman/praxis | lib/api_browser/app/views/menu.html | 1684 | <div class="sidebar fixed-if-fits hidden-print">
<div class="row">
<div class="col-sm-12">
<p>
<div ng-if="versions.length > 1" dropdown dropdown-append-to-body>
<button type="button" class="btn btn-success" dropdown-toggle ng-disabled="disabled">
{{:: versionLabel}}: {{selectedVersion}} <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li ng-repeat="version in versions">
<a ng-click="select(version)" dropdown-toggle>{{version}}</a>
</li>
</ul>
</div>
<div ng-if="versions.length == 1" class="btn btn-success">
{{:: versionLabel}}: {{selectedVersion}}
</div>
</p>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<tabset justified="true" class="tab-list-group">
<tab heading="Resources" active="active.resources">
<div class="list-group">
<menu-item ng-repeat="link in availableResources() | orderBy: 'name'" link="link" toplevel="true"></menu-item>
</div>
</tab>
<tab heading="Schemas" active="active.schemas">
<div class="list-group">
<menu-item ng-repeat="link in availableSchemas() | orderBy: 'name'" link="link" toplevel="true"></menu-item>
</div>
</tab>
<tab heading="Traits" active="active.traits" ng-if="availableTraits().length > 0">
<div class="list-group">
<menu-item ng-repeat="link in availableTraits() | orderBy: 'name'" link="link" toplevel="true"></menu-item>
</div>
</tab>
</tabset>
</div>
</div>
</div>
| mit |
jackcook/GCHelper | README.md | 4216 | # GCHelper
GCHelper is a Swift implementation for GameKit built off of the GameKitHelper class described in [this tutorial](http://www.raywenderlich.com/60980/game-center-tutorial-how-to-make-a-simple-multiplayer-game-with-sprite-kit-part-1) by [Ali Hafizji](https://twitter.com/Ali_hafizji). If you like this project, feel free to star it or watch it for updates. If you end up using it in one of your apps, I would love to hear about it! Let me know on Twitter [@jackcook36](https://twitter.com/jackcook36).
## Features
- Authenticate the user in one line of code
- Update achievements, also in one line of code
- Create a match in...
- Just about everything is do-able with just one line of code
---
## Installation
### CocoaPods
You can add GCHelper to your project by adding it to your [Podfile](https://cocoapods.org).
CocoaPods 0.36 adds support for libraries written in Swift through the use of embedded frameworks. To use GCHelper, it is important that you put the `use_frameworks!` flag in your Podfile.
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'GCHelper', '~> 0.5'
```
### Manually
If you prefer to not use a dependency manager, you can download GCHelper.swift and drag it into your project instead. Note that this eliminates the need to include the `import` statement at the top of your Swift files.
---
## Implementation
### Authenticating the User
Before doing anything with Game Center, the user needs to be signed in. This instance is often configured in your app's `application:didFinishLaunchingWithOptions:` method
```swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
GCHelper.sharedInstance.authenticateLocalUser()
return true
}
```
### Creating a Match
A match needs to be created in order for a multiplayer game to work.
```swift
GCHelper.sharedInstance.findMatchWithMinPlayers(2, maxPlayers: 4, viewController: self, delegate: self)
```
### Sending Data
Once a match has been created, you can send data between players with `NSData` objects.
```swift
let success = GCHelper.sharedInstance.match.sendDataToAllPlayers(data, withDataMode: .Reliable, error: nil)
guard success else {
print("An unknown error occured while sending data")
}
```
> I realize that this method isn't actually provided by GCHelper, but it's definitely worth noting in here.
### Report Achievement Progress
If you have created any achievements in iTunes Connect, you can access those achievements and update their progress with this method. The `percent` value can be set to zero or 100 if percentages aren't used for this particular achievement.
```swift
GCHelper.sharedInstance.reportAchievementIdentifier("achievementIdentifier", percent: 35.4)
```
### Update Leaderboard Score
Similarly to achievements, if you have created a leaderboard in iTunes Connect, you can set the score for the signed in account with this method.
```swift
GCHelper.sharedInstance.reportLeaderboardIdentifier("leaderboardIdentifier", score: 87)
```
### Show GKGameCenterViewController
GCHelper also contains a method to display Apple's GameKit interfaces. These can be used to show achievements, leaderboards, or challenges, as is defined by the use of the `viewState` value. In this case, `self` is the presenting view controller.
```swift
GCHelper.sharedInstance.showGameCenter(self, viewState: .Achievements)
```
---
## GCHelperDelegate Methods
To receive updates about the match, there are three delegate methods that you can implement in your code.
### Beginning of Match
This method is fired when the match begins.
```swift
func matchStarted() {
}
```
### End of Match
This method is fired at the end of the match, whether it is due to an error such as a player being disconnected or you actually ending the match.
```swift
func matchEnded() {
}
```
### Receiving Data
I mentioned how to send data earlier, this is the method you would use to receive that data.
```swift
func match(match: GKMatch, didReceiveData data: NSData, fromPlayer playerID: String) {
}
```
---
## License
GCHelper is available under the MIT license. See the LICENSE file for details.
| mit |
selvasingh/azure-sdk-for-java | sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/DecryptResult.java | 1715 | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.security.keyvault.keys.cryptography.models;
import com.azure.core.annotation.Immutable;
import com.azure.core.util.CoreUtils;
/**
* Represents the details of decrypt operation result.
*/
@Immutable
public final class DecryptResult {
/**
* The decrypted content.
*/
private final byte[] plainText;
/**
* The encrypyion algorithm used for the encryption operation.
*/
private final EncryptionAlgorithm algorithm;
/**
* The identifier of the key used for the decryption operation.
*/
private final String keyId;
/**
* Creates the instance of Decrypt Result holding decrypted content.
* @param plainText The decrypted content.
* @param algorithm The algorithm used to decrypt the content.
* @param keyId The identifier of the key usd for the decryption operation.
*/
public DecryptResult(byte[] plainText, EncryptionAlgorithm algorithm, String keyId) {
this.plainText = CoreUtils.clone(plainText);
this.algorithm = algorithm;
this.keyId = keyId;
}
/**
* Get the identifier of the key used for the decryption operation
* @return the key identifier
*/
public String getKeyId() {
return keyId;
}
/**
* Get the encrypted content.
* @return The decrypted content.
*/
public byte[] getPlainText() {
return CoreUtils.clone(plainText);
}
/**
* Get the algorithm used for decryption.
* @return The algorithm used.
*/
public EncryptionAlgorithm getAlgorithm() {
return algorithm;
}
}
| mit |
RWOverdijk/aurelia-form | dist/commonjs/component/form-field.js | 6802 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.FormField = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _class3, _temp;
var _config = require('../config');
var _aureliaFramework = require('aurelia-framework');
var _aureliaViewManager = require('aurelia-view-manager');
var _logger = require('../logger');
function _initDefineProp(target, property, descriptor, context) {
if (!descriptor) return;
Object.defineProperty(target, property, {
enumerable: descriptor.enumerable,
configurable: descriptor.configurable,
writable: descriptor.writable,
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
});
}
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
var desc = {};
Object['ke' + 'ys'](descriptor).forEach(function (key) {
desc[key] = descriptor[key];
});
desc.enumerable = !!desc.enumerable;
desc.configurable = !!desc.configurable;
if ('value' in desc || desc.initializer) {
desc.writable = true;
}
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
return decorator(target, property, desc) || desc;
}, desc);
if (context && desc.initializer !== void 0) {
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
desc.initializer = undefined;
}
if (desc.initializer === void 0) {
Object['define' + 'Property'](target, property, desc);
desc = null;
}
return desc;
}
function _initializerWarningHelper(descriptor, context) {
throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
}
var FormField = exports.FormField = (_dec = (0, _aureliaFramework.customElement)('form-field'), _dec2 = (0, _aureliaViewManager.resolvedView)('spoonx/form', 'form-field'), _dec3 = (0, _aureliaFramework.inject)(_config.Config, _aureliaViewManager.ViewManager, Element), _dec4 = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), _dec5 = (0, _aureliaFramework.computedFrom)('value', 'element'), _dec6 = (0, _aureliaFramework.computedFrom)('element'), _dec7 = (0, _aureliaFramework.computedFrom)('element'), _dec8 = (0, _aureliaFramework.computedFrom)('view'), _dec9 = (0, _aureliaFramework.computedFrom)('element'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = (_temp = _class3 = function () {
function FormField(config, viewManager, element) {
_initDefineProp(this, 'element', _descriptor, this);
_initDefineProp(this, 'model', _descriptor2, this);
_initDefineProp(this, 'value', _descriptor3, this);
_initDefineProp(this, 'message', _descriptor4, this);
_initDefineProp(this, 'description', _descriptor5, this);
this.config = config;
this.viewManager = viewManager;
this.formField = this;
this.elementDOM = element;
}
FormField.prototype.attached = function attached() {
if (!this.element.key) {
_logger.logger.debug('key not defined in element of type ' + this.element.type + ' using model for value');
}
if (this.element.attached) {
this.element.attached.call(this, this.elementDOM);
}
};
FormField.prototype.detached = function detached() {
if (this.element.detached) {
this.element.detached.call(this, this.elementDOM);
}
};
FormField.prototype.elementChanged = function elementChanged(element) {
this.element.id = 'sx-form-' + element.type + '-' + element.key + '-' + FormField.elementCount;
FormField.elementCount += 1;
return this.element;
};
_createClass(FormField, [{
key: 'visible',
get: function get() {
return typeof this.element.hidden === 'function' ? this.element.hidden(this.value) : !this.element.hidden;
}
}, {
key: 'label',
get: function get() {
return this.element.label || this.element.key;
}
}, {
key: 'view',
get: function get() {
var type = this.type;
this.element.type = type;
return this.viewManager.resolve('spoonx/form', type);
}
}, {
key: 'hasViewModel',
get: function get() {
return !this.view.endsWith('.html');
}
}, {
key: 'type',
get: function get() {
var type = this.element.type;
var alias = this.config.fetch('aliases', type);
var previous = [];
while (alias && !(alias in previous)) {
type = alias;
alias = this.config.fetch('aliases', type);
previous.push(type);
}
return type;
}
}]);
return FormField;
}(), _class3.elementCount = 0, _temp), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'element', [_aureliaFramework.bindable], {
enumerable: true,
initializer: null
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'model', [_aureliaFramework.bindable], {
enumerable: true,
initializer: null
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'value', [_dec4], {
enumerable: true,
initializer: null
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'message', [_aureliaFramework.bindable], {
enumerable: true,
initializer: null
}), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, 'description', [_aureliaFramework.bindable], {
enumerable: true,
initializer: null
}), _applyDecoratedDescriptor(_class2.prototype, 'visible', [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, 'visible'), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, 'label', [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, 'label'), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, 'view', [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, 'view'), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, 'hasViewModel', [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, 'hasViewModel'), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, 'type', [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, 'type'), _class2.prototype)), _class2)) || _class) || _class) || _class); | mit |
imasaru/sabbath-school-lessons | src/et/2020-03/10/01.md | 1638 | ---
title: Põnev viis kaasa lüüa
date: 29/08/2020
---
### Selle nädala õppeaine
1Ms 1:1, 2, 26, 2Ms 18:21–25, 1Kr 12:12–25; Ap 16:11–15, 40, Ap 4:31; Ap 12:12.
> <p>Juhtsalm</p>
> „Siis ta ütles oma jüngritele: „Lõikust on palju, töötegijaid aga vähe. Paluge siis lõikuse Issandat, et ta saadaks töötegijaid välja oma lõikusele!““ (Mt 9:37, 38).
Keegi on öelnud: „Numbrites on jõud.“ Teatud mõttes on öeldu tõsi. Oled sa märganud, et sinu motivatsioon tervisesporti teha on suurem siis, kui teed seda rühmas, mitte aga iga päev üksi? Palju inimesi astub terviseklubidesse, jõusaalidesse ja treenimisasutustesse, kuna nad usuvad, et teistega koos harjutavad nad rohkem ja tunnevad suuremat naudingut. Samamoodi on Jumal loonud meid sõpruskonnaks. Oleme sotsiaalsed olevused ja see, mis kehtib tervisespordi kohta, kehtib elus paljude muudegi nähtuste kohta: meil läheb paremini, kui meil on sotsiaalne tugisüsteem. Eriti õige on see vaimulikes küsimustes.
Kogu Piiblis näeme väikegruppe kui Jumala meetodit meie usku kinnitada, Tema Sõna tundmist kasvatada, meie palve-elu süvendada ja meid tunnistamiseks ette valmistada. Isa, Poeg ja Püha Vaim osalesid väikegrupi teenistuses. Mooses oli väikegrupi juht. Jeesus asutas jüngritest oma väikegrupi ning Paulus reisis Rooma riigis evangeeliumitööd tegevatest kaaslastest väikegrupiga.
Selle nädala õppetunnis pöörame tähelepanu väikegruppide piibellikule alusele ning avastame, et sinu jaoks on üks põnev kaasalöömise võimalus.
_Selle nädala_ _õppetükki õppides valmistud hingamispäevaks, 5. septembriks._ | mit |
TheParrotsAreComing/PAWS | src/Controller/CatsAdoptionEventsController.php | 4276 | <?php
namespace App\Controller;
use App\Controller\AppController;
/**
* CatsAdoptionEvents Controller
*
* @property \App\Model\Table\CatsAdoptionEventsTable $CatsAdoptionEvents
*/
class CatsAdoptionEventsController extends AppController
{
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$this->paginate = [
'contain' => ['Cats', 'AdoptionEvents']
];
$catsAdoptionEvents = $this->paginate($this->CatsAdoptionEvents);
$this->set(compact('catsAdoptionEvents'));
$this->set('_serialize', ['catsAdoptionEvents']);
}
/**
* View method
*
* @param string|null $id Cats Adoption Event id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$catsAdoptionEvent = $this->CatsAdoptionEvents->get($id, [
'contain' => ['Cats', 'AdoptionEvents']
]);
$this->set('catsAdoptionEvent', $catsAdoptionEvent);
$this->set('_serialize', ['catsAdoptionEvent']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$catsAdoptionEvent = $this->CatsAdoptionEvents->newEntity();
if ($this->request->is('post')) {
$catsAdoptionEvent = $this->CatsAdoptionEvents->patchEntity($catsAdoptionEvent, $this->request->data);
if ($this->CatsAdoptionEvents->save($catsAdoptionEvent)) {
$this->Flash->success(__('The cats adoption event has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The cats adoption event could not be saved. Please, try again.'));
}
$cats = $this->CatsAdoptionEvents->Cats->find('list', ['limit' => 200]);
$adoptionEvents = $this->CatsAdoptionEvents->AdoptionEvents->find('list', ['limit' => 200]);
$this->set(compact('catsAdoptionEvent', 'cats', 'adoptionEvents'));
$this->set('_serialize', ['catsAdoptionEvent']);
}
/**
* Edit method
*
* @param string|null $id Cats Adoption Event id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$catsAdoptionEvent = $this->CatsAdoptionEvents->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$catsAdoptionEvent = $this->CatsAdoptionEvents->patchEntity($catsAdoptionEvent, $this->request->data);
if ($this->CatsAdoptionEvents->save($catsAdoptionEvent)) {
$this->Flash->success(__('The cats adoption event has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The cats adoption event could not be saved. Please, try again.'));
}
$cats = $this->CatsAdoptionEvents->Cats->find('list', ['limit' => 200]);
$adoptionEvents = $this->CatsAdoptionEvents->AdoptionEvents->find('list', ['limit' => 200]);
$this->set(compact('catsAdoptionEvent', 'cats', 'adoptionEvents'));
$this->set('_serialize', ['catsAdoptionEvent']);
}
/**
* Delete method
*
* @param string|null $id Cats Adoption Event id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$catsAdoptionEvent = $this->CatsAdoptionEvents->get($id);
if ($this->CatsAdoptionEvents->delete($catsAdoptionEvent)) {
$this->Flash->success(__('The cats adoption event has been deleted.'));
} else {
$this->Flash->error(__('The cats adoption event could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}
| mit |
themondobot/mondo-ruby | CHANGELOG.md | 897 | ## 0.4.7 - Novermber 15, 2015
- Fix webhooks bugs
## 0.4.6 - Novermber 14, 2015
- Only fetch account_if if not set
## 0.4.5 - Novermber 14, 2015
- Add support for balance
## 0.4.4 - Novermber 14, 2015
- Deeply nested hash support - make Feed Item creation work again
## 0.4.3 - Novermber 14, 2015
- Added support for emoji
## 0.4.2 - Novermber 14, 2015
- Added support for registering, listing & deleting web-hooks
## 0.4.2 - Novermber 13, 2015
- Added support to deregister attachments
## 0.4.2 - Novermber 13, 2015
- Fix to fetch account_id on initialisation of client (API changed)
- Added support for attachments on transactions
## 0.3.2 - September 19, 2015
- Catch nil merchants
## 0.3.0 - September 19, 2015
- Added support for Merchant and Address
## 0.2.0 - September 19, 2015
- Added support for FeedItems
## 0.1.0 - September 12, 2015
- Initial release
| mit |
fluuffy/Hazelnut-Mocha | inc/stm32f4xx_it.h | 3158 | /**
******************************************************************************
* @file GPIO/GPIO_IOToggle/Inc/stm32f4xx_it.h
* @author MCD Application Team
* @version V1.2.4
* @date 29-January-2016
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4xx_IT_H
#define __STM32F4xx_IT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F4xx_IT_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| mit |
maelsan/etna-projects | archives/NTN/src/loadGrid.c | 588 | #include "../include/loadGrid.h"
#include <stdlib.h>
void loadGrid(int x, int y)
{
int grid[x][y];
int countX;
int countY;
int numberMines;
numberMines = (x * y) % 10;
countX = 0;
countY = 0;
while (1)
{
grid[countX][countY] = completeGrid(numberMines);
numberMines -= 1;
countX = (countX < (x - 1)) ? (countX + 1) : countX;
countY = (countY < (y - 1)) ? (countY + 1) : countY;
if (countX >= (x - 1) && countY >= (y - 1))
break;
}
}
static int completeGrid(numberMines)
{
if (numberMines <= 0)
return (0);
else
return (-1);
}
| mit |
kotlin-graphics/imgui | glfw/src/main/java/module-info.java | 276 | module kotlin.graphics.imgui.glfw {
requires kotlin.stdlib;
requires kotlin.graphics.imgui.core;
requires kotlin.graphics.uno.core;
requires kotlin.graphics.glm;
requires kotlin.graphics.kool;
requires org.lwjgl.glfw;
exports imgui.impl.glfw;
} | mit |
serek/rspec-arel-matchers | spec/rspec/arel_matchers/matchers/have_where_clause_spec.rb | 872 | require 'spec_helper'
describe 'have_where_clause' do
class Test < ActiveRecord::Base
OLD_CUTOFF = 10.days.ago
scope :active, -> { where(active: true) }
scope :old, -> { where(Test.arel_table[:updated_at].lt(OLD_CUTOFF)) }
end
class Test2 < ActiveRecord::Base
has_many :tests
end
it 'should return true with a simple correct match' do
expect(Test.where(name: 'john')).to have_where_clause(Test, :name, :eq, 'john')
end
it 'should work for joined tables' do
expect(Test2.joins(:tests).merge(Test.active)).to have_where_clause(Test, :active, :eq, true)
end
it 'should fail when a clause is not there' do
expect(Test.where(name: 'john')).to_not have_where_clause(Test, :name, :eq, 'doe')
end
it 'can do other comparisons' do
expect(Test.old).to have_where_clause(Test, :updated_at, :lt, Test::OLD_CUTOFF)
end
end
| mit |
promisedlandt/cookbook-vim_config | recipes/default.rb | 1565 | # add a plugin manager
unless node[:vim_config][:skip_plugin_manager]
if ["pathogen","unbundle", "vundle"].include?(node[:vim_config][:plugin_manager].to_s)
include_recipe "vim_config::_plugin_manager"
else
Chef::Log.warn "Plugin manager not set or not recognized: #{ node[:vim_config][:plugin_manager] }"
end
end
include_recipe "git::default" unless node[:vim_config][:skip_git_installation]
include_recipe "mercurial::default" unless node[:vim_config][:skip_mercurial_installation] || node[:vim_config][:bundles][:hg].empty?
if node[:vim_config][:force_update]
file node[:vim_config][:config_file_path] do
action :delete
end
[node[:vim_config][:config_dir], node[:vim_config][:bundle_dir]].each do |dir|
directory dir do
action :delete
recursive true
end
end
end
directory node[:vim_config][:bundle_dir] do
owner node[:vim_config][:owner]
group node[:vim_config][:owner_group]
mode "0755"
recursive true
action :create
end
# manage config file(s)
include_recipe "vim_config::_config"
node[:vim_config][:bundles][:git].each do |bundle|
vim_config_git bundle do
action :create
end
end
node[:vim_config][:bundles][:hg].each do |bundle|
vim_config_mercurial bundle do
action :create
end
end
node[:vim_config][:bundles][:vim].each do |name, version|
vim_config_vim name do
version version
action :create
end
end
if node[:vim_config][:manage_plugin_folder]
plugin_dirs_to_delete.each do |dir|
directory dir do
recursive true
action :delete
end
end
end
| mit |
nakov/OpenJudgeSystem | Open Judge System/Web/OJS.Web/Areas/Administration/ViewModels/Contest/ChangeParticipationEndTimeViewModel.cs | 3487 | namespace OJS.Web.Areas.Administration.ViewModels.Contest
{
using System;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.SqlServer;
using System.Linq.Expressions;
using System.Web.Mvc;
using OJS.Data.Models;
using Resource = Resources.Areas.Administration.Contests.Views.ChangeTime;
public class ChangeParticipationEndTimeViewModel
{
private static readonly int DefaultBufferTimeInMinutes = 30;
public ChangeParticipationEndTimeViewModel()
{
}
public ChangeParticipationEndTimeViewModel(
ChangeParticipationEndTimeByTimeIntervalViewModel changeByIntervalModel)
{
this.ContesId = changeByIntervalModel.ContesId;
this.ContestName = changeByIntervalModel.ContestName;
this.TimeInMinutes = changeByIntervalModel.TimeInMinutes;
this.ChangeByInterval = changeByIntervalModel;
this.ChangeByUser = new ChangeParticipationEndTimeByUserViewModel
{
ContesId = this.ContesId,
ContestName = this.ContestName
};
}
public ChangeParticipationEndTimeViewModel(ChangeParticipationEndTimeByUserViewModel changebyUserModel)
{
this.ContesId = changebyUserModel.ContesId;
this.ContestName = changebyUserModel.ContestName;
this.TimeInMinutes = changebyUserModel.TimeInMinutes;
this.ChangeByUser = changebyUserModel;
this.ChangeByInterval = new ChangeParticipationEndTimeByTimeIntervalViewModel
{
ContesId = this.ContesId,
ContestName = this.ContestName
};
}
public static Expression<Func<Contest, ChangeParticipationEndTimeViewModel>> FromContest =>
contest => new ChangeParticipationEndTimeViewModel
{
ContesId = contest.Id,
ContestName = contest.Name,
ChangeByInterval = new ChangeParticipationEndTimeByTimeIntervalViewModel
{
ContesId = contest.Id,
ContestName = contest.Name,
ParticipantsCreatedBeforeDateTime = DateTime.Now,
ParticipantsCreatedAfterDateTime = SqlFunctions.DateAdd(
"minute",
((contest.Duration.Value.Hours * 60) + contest.Duration.Value.Minutes + DefaultBufferTimeInMinutes) * -1,
DateTime.Now)
},
ChangeByUser = new ChangeParticipationEndTimeByUserViewModel
{
ContesId = contest.Id,
ContestName = contest.Name
}
};
[HiddenInput(DisplayValue = false)]
public int ContesId { get; set; }
[Display(Name = nameof(Resource.Contest), ResourceType = typeof(Resource))]
public string ContestName { get; set; }
[Display(Name = nameof(Resource.Time_in_minutes_information), ResourceType = typeof(Resource))]
[Required(
ErrorMessageResourceName = nameof(Resource.Time_required_error),
ErrorMessageResourceType = typeof(Resource))]
public int TimeInMinutes { get; set; }
public ChangeParticipationEndTimeByTimeIntervalViewModel ChangeByInterval { get; set; }
public ChangeParticipationEndTimeByUserViewModel ChangeByUser { get; set; }
}
} | mit |
gzc/leetcode | cpp/871-880/Stone Game.cpp | 96 | class Solution {
public:
bool stoneGame(vector<int>& piles) {
return true;
}
};
| mit |
henningjp/CoolProp | Web/docker/build_docs.sh | 1061 | #!/bin/bash
set -v
set -e
# This script is intended to be run INSIDE the docker container, and
# if all goes to plan, the _build/html folder should contain the contents
# of the build
# Turn on our conda environment
source activate docs
# Try to install dependencies on the fly, or rely on the existing environment
#conda install six numpy cython matplotlib requests jinja2 pyyaml
# Build/Install CoolProp and check
cd /coolprop/wrappers/Python
python setup.py bdist_wheel --dist-dir dist cmake=default,64
pip install -vvv --force-reinstall --ignore-installed --upgrade --no-index `ls dist/CoolProp*.whl`
rm -rf dist
cd /coolprop
python -c "import CoolProp; print(CoolProp.__gitrevision__)"
python -c "import CoolProp; print(CoolProp.__file__)"
# Run the slow stuff, if needed, or demanded
cd /coolprop/Web/scripts
python -u __init__.py $1
# Doxygen
cd /coolprop
doxygen --version && doxygen Doxyfile
# api documentation
cd /coolprop/Web
sphinx-apidoc -T -f -e -o apidoc ../wrappers/Python/CoolProp
# All the rest of the docs
cd /coolprop/Web
make html | mit |
delMar43/wlandsuite | src/main/java/de/ailis/wlandsuite/io/BitOutputStream.java | 7613 | /*
* $Id$
* Copyright (C) 2006 Klaus Reimer <[email protected]>
*
* 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.
*/
package de.ailis.wlandsuite.io;
import java.io.IOException;
import java.io.OutputStream;
/**
* The bit output stream can be used to write a stream bit by bit. But it also
* provides other useful methods like writing 16 or 32 bit values which also
* works in a not-byte aligned stream. So if you write 4 bits then you are still
* able to write the next 16 bits as a word.
*
* If you have written not-byte aligned data (for example just 7 bits instead of
* 8) then you MUST flush() the stream so these 8 bits are written (With an
* appended zero bit). If you close() the stream then flush() is called
* automatically.
*
* @author Klaus Reimer ([email protected])
* @version $Revision$
*/
public abstract class BitOutputStream extends OutputStream
{
/** The current byte */
private int currentByte;
/** The current bit */
private byte currentBit = 0;
/**
* Writes a bit to the output stream.
*
* @param bit
* The bit to write
* @throws IOException
* When file operation fails.
*/
public void writeBit(final byte bit) throws IOException
{
writeBit(bit, false);
}
/**
* Writes a bit to the output stream. This method can write the bits in
* reversed order.
*
* @param bit
* The bit to write
* @param reverse
* If bits should be written in reversed order
* @throws IOException
* When file operation fails.
*/
public void writeBit(final byte bit, final boolean reverse) throws IOException
{
if (reverse)
{
this.currentByte = this.currentByte
| (((bit & 1) << this.currentBit));
}
else
{
this.currentByte = (this.currentByte << 1) | (bit & 1);
}
this.currentBit++;
if (this.currentBit > 7)
{
write(this.currentByte);
this.currentByte = 0;
this.currentBit = 0;
}
}
/**
* Writes the specified number of bits. The bits can be written in reverse
* order if the reverse flag is set.
*
* @param value
* The value containing the bits to write
* @param quantity
* The number of bits to write
* @param reverse
* If the bits should be written reversed.
* @throws IOException
* When file operation fails.
*/
public void writeBits(final int value, final int quantity, final boolean reverse)
throws IOException
{
byte b;
for (int i = 0; i < quantity; i++)
{
if (reverse)
{
b = (byte) ((value >> i) & 1);
}
else
{
b = (byte) ((value >> (quantity - i - 1)) & 1);
}
writeBit(b, reverse);
}
}
/**
* Writes a bit to the output stream.
*
* @param bit
* The bit to write
* @throws IOException
* When file operation fails.
*/
public void writeBit(final boolean bit) throws IOException
{
writeBit((byte) (bit ? 1 : 0));
}
/**
* Writes a byte to the stream.
*
* @param b
* The byte to write
* @throws IOException
* When file operation fails.
*/
public void writeByte(final int b) throws IOException
{
if (this.currentBit == 0)
{
write(b);
}
else
{
for (int i = 7; i >= 0; i--)
{
writeBit((byte) ((b >> i) & 1));
}
}
}
/**
* Writes a signed byte.
*
* @param b
* The byte to write
* @throws IOException
* When file operation fails.
*/
public void writeSignedByte(final int b) throws IOException
{
if (b < 0)
{
writeByte(b + 256);
}
else
{
writeByte(b);
}
}
/**
* Writes a 2-byte word to the stream.
*
* @param word
* The word to write
* @throws IOException
* When file operation fails.
*/
public void writeWord(final int word) throws IOException
{
writeByte(word & 0xff);
writeByte((word >> 8) & 0xff);
}
/**
* Writes a 4-byte integer to the stream.
*
* @param integer
* The integer to write
* @throws IOException
* When file operation fails.
*/
public void writeInt(final long integer) throws IOException
{
writeByte((int) (integer & 0xff));
writeByte((int) ((integer >> 8) & 0xff));
writeByte((int) ((integer >> 16) & 0xff));
writeByte((int) ((integer >> 24) & 0xff));
}
/**
* Writes a 3-byte integer to the stream.
*
* @param integer
* The integer to write
* @throws IOException
* When file operation fails.
*/
public void writeInt3(final int integer) throws IOException
{
writeByte(integer & 0xff);
writeByte((integer >> 8) & 0xff);
writeByte((integer >> 16) & 0xff);
}
/**
* Flush the output to make sure all bits are written even if they don't
* fill a whole byte.
*
* @throws IOException
* When file operation fails.
*/
@Override
public void flush() throws IOException
{
flush(false);
}
/**
* Flush the output to make sure all bits are written even if they don't
* fill a whole byte.
*
* @param reverse In bits are written in reverese order
* @throws IOException
* When file operation fails.
*/
public void flush(final boolean reverse) throws IOException
{
if (this.currentBit != 0)
{
if (!reverse)
{
this.currentByte = this.currentByte << (8 - this.currentBit);
}
write(this.currentByte);
}
}
/**
* Closes the connected output stream and makes sure the last byte is
* written.
*
* @throws IOException
* When file operation fails.
*/
@Override
public void close() throws IOException
{
flush();
super.close();
}
}
| mit |
huoxudong125/Z.ExtensionMethods | test/Z.Core.Test/System.Boolean/Boolean.ToString.cs | 1005 | // Copyright (c) 2015 ZZZ Projects. All rights reserved
// Licensed under MIT License (MIT) (https://github.com/zzzprojects/Z.ExtensionMethods)
// Website: http://www.zzzprojects.com/
// Feedback / Feature Requests / Issues : http://zzzprojects.uservoice.com/forums/283927
// All ZZZ Projects products: Entity Framework Extensions / Bulk Operations / Extension Methods /Icon Library
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Z.Core.Test
{
[TestClass]
public class System_Boolean_ToString
{
[TestMethod]
public void ToString()
{
// Type
bool @thisTrue = true;
bool @thisFalse = false;
// Exemples
string result1 = @thisTrue.ToString("Fizz", "Buzz"); // return "Fizz";
string result2 = @thisFalse.ToString("Fizz", "Buzz"); // return "Buzz";
// Unit Test
Assert.AreEqual("Fizz", result1);
Assert.AreEqual("Buzz", result2);
}
}
} | mit |
andrewwiik/VTHSCompSciClub | admin/contacts/js/contactServices.js | 1741 | 'use strict';
angular.module('contactServices', [])
// Factory responsible for assembling the form data before it's passed over the php
.factory('assembleFormDataService', function(){
return {
populateFormData: function(fname, lname, address, city, zipcode, mnumber, lnumber, relation, email, photoSubmit){
var formData = new FormData();
formData.append("fname", fname);
formData.append("lname", lname);
formData.append("address", address);
formData.append("city", city);
formData.append("zipcode", zipcode);
formData.append("mnumber", mnumber);
formData.append("lnumber", lnumber);
formData.append("relation", relation);
formData.append("email", email);
formData.append("photo", photoSubmit);
return formData;
}
};
})
// One big team service that handles the individual components we'll need for the teams
.factory('contactService', ['$http', function($http){
return {
contactsList: function(callback){
$http.get('contacts/contacts.php?action=list').success(callback);
},
contactsDetails: function(id, callback){
$http.get('contacts/contacts.php?action=detail&id=' + id).success(callback);
},
addContacts: function(readyFormData, callback){
$http.post('contacts/contacts.php?action=add', readyFormData, { transformRequest: angular.identity, headers: { "Content-Type": undefined } }).success(callback);
},
editContact: function(id, readyFormData, callback){
$http.post('contacts/contacts.php?action=edit&id=' + id, readyFormData, { transformRequest: angular.identity, headers: { "Content-Type": undefined } }).success(callback);
},
deleteContact: function(id, callback){
$http.post('contacts/contacts.php?action=delete&id=' + id).success(callback);
}
}
}]);
| mit |
dotKom/studlan | apps/authentication/models.py | 674 | # -*- coding: utf-8 -*-
import datetime
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
class RegisterToken(models.Model):
user = models.ForeignKey(User)
token = models.CharField(_(u'token'), max_length=32)
created = models.DateTimeField(_(u'created'), editable=False, auto_now_add=True)
@property
def is_valid(self):
valid_period = datetime.timedelta(days=1)
now = datetime.datetime.now()
return now < self.created + valid_period
class Meta:
verbose_name = _(u'register token')
verbose_name_plural = _(u'register tokens')
| mit |
imasaru/sabbath-school-lessons | src/sv/2020-03/01/01.md | 1678 | ---
title: Varför vittna?
date: 27/06/2020
---
> <p>Nyckeltext</p>
> ”Att be så är riktigt och behagar Gud, vår frälsare, som vill att alla människor skall räddas och komma till insikt om sanningen” (1 Tim. 2:3, 4).
### Veckans Huvudtexter
Jak. 5:19, 20; Luk. 15:6; Sef. 3:17; Joh. 7:37, 38; 1 Tim. 2:3, 4; 2 Kor. 5:14, 15.
Guds stora längtan för alla och överallt är att de ska svara på hans kärlek, ta emot hans nåd, förvandlas av hans Ande och bli räddade till hans rike. Han önskar ingenting högre än vår frälsning. Hans kärlek är gränslös. Hans nåd kan inte mätas. Hans medlidande är större än vi kan beskriva. Hans förlåtelse är ofattbar. Hans makt är oändlig. I kontrast till hedniska gudar som krävde offer har vår Gud gett det överlägsna offret. Oavsett hur mycket vi vill bli frälsta längtar Gud ännu mer efter att få frälsa oss. ”Att be så är riktigt och behagar Gud, vår frälsare, som vill att alla människor skall räddas och komma till insikt om sanningen” (1 Tim. 2:3, 4). Hans hjärta längtar efter din och min frälsning.
Vittnande handlar helt om Jesus. Det handlar om vad han har gjort för att rädda oss, hur han har förvandlat våra liv och om de förunderliga sanningarna i hans Ord som talar om för oss vem han är och om skönheten i hans karaktär. Varför vittna? När vi förstår vem han är och förundrar oss över hans nåd och kraften i hans kärlek kan vi inte hålla tyst. Varför vittna? När vi får del av honom träder vi in i hans glädje över att se människor återlösta av hans nåd och förvandlade av hans kärlek.
_Studiematerial för den 28 juni – 4 juli 2020_ | mit |
nvisionative/Dnn.Platform | DNN Platform/Admin Modules/Dnn.Modules.ModuleCreator/Templates/C#/Module - User Control/_CONTROL_.ascx.cs | 1111 | //
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
#region Using Statements
using System;
using DotNetNuke.Entities.Modules;
#endregion
namespace _OWNER_._MODULE_
{
public partial class _CONTROL_ : PortalModuleBase
{
#region Event Handlers
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
cmdSave.Click += cmdSave_Click;
cmdCancel.Click += cmdCancel_Click;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!Page.IsPostBack)
{
txtField.Text = (string)Settings["field"];
}
}
protected void cmdSave_Click(object sender, EventArgs e)
{
ModuleController.Instance.UpdateModuleSetting(ModuleId, "field", txtField.Text);
DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "Update Successful", DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.GreenSuccess);
}
protected void cmdCancel_Click(object sender, EventArgs e)
{
}
#endregion
}
}
| mit |
tauheedahmed/ecosys | project_files/_vti_cnf/frmMainAppts.aspx.cs | 109 | vti_encoding:SR|utf8-nl
vti_timelastmodified:TR|31 Jul 2007 14:34:52 -0000
vti_extenderversion:SR|4.0.2.7802
| mit |
yelmontaser/DunglasApiBundle | Api/Operation/Operation.php | 1264 | <?php
/*
* This file is part of the DunglasApiBundle package.
*
* (c) Kévin Dunglas <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Dunglas\ApiBundle\Api\Operation;
use Symfony\Component\Routing\Route;
/**
* {@inheritdoc}
*
* @author Kévin Dunglas <[email protected]>
*/
class Operation implements OperationInterface
{
/**
* @var Route
*/
private $route;
/**
* @var string
*/
private $routeName;
/**
* @var array
*/
private $context;
/**
* @param Route $route
* @param string $routeName
* @param array $context
*/
public function __construct(Route $route, $routeName, array $context = [])
{
$this->route = $route;
$this->routeName = $routeName;
$this->context = $context;
}
/**
* {@inheritdoc}
*/
public function getRoute()
{
return $this->route;
}
/**
* {@inheritdoc}
*/
public function getRouteName()
{
return $this->routeName;
}
/**
* {@inheritdoc}
*/
public function getContext()
{
return $this->context;
}
}
| mit |
rokn/Count_Words_2015 | fetched_code/ruby/iseq_loader_checker.rb | 2424 | # frozen_string_literal: false
begin
require '-test-/iseq_load/iseq_load'
rescue LoadError
end
require 'tempfile'
class RubyVM::InstructionSequence
def disasm_if_possible
begin
self.disasm
rescue Encoding::CompatibilityError, EncodingError, SecurityError
nil
end
end
def self.compare_dump_and_load i1, dumper, loader
dump = dumper.call(i1)
return i1 unless dump
i2 = loader.call(dump)
# compare disassembled result
d1 = i1.disasm_if_possible
d2 = i2.disasm_if_possible
if d1 != d2
STDERR.puts "expected:"
STDERR.puts d1
STDERR.puts "actual:"
STDERR.puts d2
t1 = Tempfile.new("expected"); t1.puts d1; t1.close
t2 = Tempfile.new("actual"); t2.puts d2; t2.close
system("diff -u #{t1.path} #{t2.path}") # use diff if available
exit(1)
end
i2
end
CHECK_TO_A = ENV['RUBY_ISEQ_DUMP_DEBUG'] == 'to_a'
CHECK_TO_BINARY = ENV['RUBY_ISEQ_DUMP_DEBUG'] == 'to_binary'
def self.translate i1
# check to_a/load_iseq
i2_ary = compare_dump_and_load(i1,
proc{|iseq|
ary = iseq.to_a
ary[9] == :top ? ary : nil
},
proc{|ary|
RubyVM::InstructionSequence.iseq_load(ary)
}) if CHECK_TO_A && defined?(RubyVM::InstructionSequence.iseq_load)
# check to_binary
i2_bin = compare_dump_and_load(i1,
proc{|iseq|
begin
iseq.to_binary
rescue RuntimeError => e # not a toplevel
# STDERR.puts [:failed, e, iseq].inspect
nil
end
},
proc{|bin|
iseq = RubyVM::InstructionSequence.load_from_binary(bin)
# STDERR.puts iseq.inspect
iseq
}) if CHECK_TO_BINARY
# return value
i2_bin if CHECK_TO_BINARY
end if CHECK_TO_A || CHECK_TO_BINARY
end
#require_relative 'x'; exit(1)
| mit |
daviddao/rf-optimizer | standard-RAxML-master/ancestralStates.c | 23268 | /* RAxML-VI-HPC (version 2.2) a program for sequential and parallel estimation of phylogenetic trees
* Copyright August 2006 by Alexandros Stamatakis
*
* Partially derived from
* fastDNAml, a program for estimation of phylogenetic trees from sequences by Gary J. Olsen
*
* and
*
* Programs of the PHYLIP package by Joe Felsenstein.
*
* This program is free software; you may redistribute it and/or modify its
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program 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 General Public License
* for more details.
*
*
* For any other enquiries send an Email to Alexandros Stamatakis
* [email protected]
*
* When publishing work that is based on the results from RAxML-VI-HPC please cite:
*
* Alexandros Stamatakis:"RAxML-VI-HPC: maximum likelihood-based phylogenetic analyses with thousands of taxa and mixed models".
* Bioinformatics 2006; doi: 10.1093/bioinformatics/btl446
*/
#ifndef WIN32
#include <sys/times.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
#endif
#include <limits.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "axml.h"
extern char workdir[1024];
extern char run_id[128];
extern const char binaryStateNames[2];
extern const char dnaStateNames[4];
extern const char protStateNames[20];
extern const char genericStateNames[32];
static char getStateCharacter(int dataType, int state)
{
char
result;
assert(MIN_MODEL < dataType && dataType < MAX_MODEL);
switch(dataType)
{
case BINARY_DATA:
result = binaryStateNames[state];
break;
case DNA_DATA:
result = dnaStateNames[state];
break;
case AA_DATA:
result = protStateNames[state];
break;
case GENERIC_32:
result = genericStateNames[state];
break;
default:
assert(0);
}
return result;
}
static void makeP_Flex_Ancestral(double *rptr, double *EI, double *EIGN, int numberOfCategories, double *left, const int numStates)
{
int
i,
j,
k;
const int
rates = numStates - 1,
statesSquare = numStates * numStates;
double
z1 = 0.0,
lz1[64],
d1[64];
assert(numStates <= 64);
for(i = 0; i < rates; i++)
lz1[i] = EIGN[i] * z1;
for(i = 0; i < numberOfCategories; i++)
{
for(j = 0; j < rates; j++)
d1[j] = EXP (rptr[i] * lz1[j]);
for(j = 0; j < numStates; j++)
{
left[statesSquare * i + numStates * j] = 1.0;
for(k = 1; k < numStates; k++)
left[statesSquare * i + numStates * j + k] = d1[k-1] * EI[rates * j + (k-1)];
}
}
}
static void ancestralCat(double *v, double *sumBuffer, double *diagptable, int i, int numStates)
{
int
l,
j;
double
*ancestral = &sumBuffer[numStates * i],
sum = 0.0,
*term = (double*)rax_malloc(sizeof(double) * numStates);
for(l = 0; l < numStates; l++)
{
double
ump_x1 = 0.0;
for(j = 0; j < numStates; j++)
ump_x1 += v[j] * diagptable[l * numStates + j];
sum += ump_x1;
term[l] = ump_x1;
}
for(l = 0; l < numStates; l++)
ancestral[l] = term[l] / sum;
rax_free(term);
}
static void newviewFlexCat_Ancestral(int tipCase, double *extEV,
int *cptr,
double *x1, double *x2, double *tipVector,
unsigned char *tipX1, unsigned char *tipX2,
int n, double *left, double *right, const int numStates, double *diagptable, double *sumBuffer)
{
double
*x3 = (double *)rax_malloc(sizeof(double) * numStates),
*le, *ri, *v, *vl, *vr,
ump_x1, ump_x2, x1px2;
int
i, l, j, scale;
const int
statesSquare = numStates * numStates;
switch(tipCase)
{
case TIP_TIP:
{
for (i = 0; i < n; i++)
{
le = &left[cptr[i] * statesSquare];
ri = &right[cptr[i] * statesSquare];
vl = &(tipVector[numStates * tipX1[i]]);
vr = &(tipVector[numStates * tipX2[i]]);
v = x3;
for(l = 0; l < numStates; l++)
v[l] = 0.0;
for(l = 0; l < numStates; l++)
{
ump_x1 = 0.0;
ump_x2 = 0.0;
for(j = 0; j < numStates; j++)
{
ump_x1 += vl[j] * le[l * numStates + j];
ump_x2 += vr[j] * ri[l * numStates + j];
}
x1px2 = ump_x1 * ump_x2;
for(j = 0; j < numStates; j++)
v[j] += x1px2 * extEV[l * numStates + j];
}
ancestralCat(v, sumBuffer, &diagptable[cptr[i] * statesSquare], i, numStates);
}
}
break;
case TIP_INNER:
{
for (i = 0; i < n; i++)
{
le = &left[cptr[i] * statesSquare];
ri = &right[cptr[i] * statesSquare];
vl = &(tipVector[numStates * tipX1[i]]);
vr = &x2[numStates * i];
v = x3;
for(l = 0; l < numStates; l++)
v[l] = 0.0;
for(l = 0; l < numStates; l++)
{
ump_x1 = 0.0;
ump_x2 = 0.0;
for(j = 0; j < numStates; j++)
{
ump_x1 += vl[j] * le[l * numStates + j];
ump_x2 += vr[j] * ri[l * numStates + j];
}
x1px2 = ump_x1 * ump_x2;
for(j = 0; j < numStates; j++)
v[j] += x1px2 * extEV[l * numStates + j];
}
scale = 1;
for(l = 0; scale && (l < numStates); l++)
scale = ((v[l] < minlikelihood) && (v[l] > minusminlikelihood));
if(scale)
{
for(l = 0; l < numStates; l++)
v[l] *= twotothe256;
}
ancestralCat(v, sumBuffer, &diagptable[cptr[i] * statesSquare], i, numStates);
}
}
break;
case INNER_INNER:
for(i = 0; i < n; i++)
{
le = &left[cptr[i] * statesSquare];
ri = &right[cptr[i] * statesSquare];
vl = &x1[numStates * i];
vr = &x2[numStates * i];
v = x3;
for(l = 0; l < numStates; l++)
v[l] = 0.0;
for(l = 0; l < numStates; l++)
{
ump_x1 = 0.0;
ump_x2 = 0.0;
for(j = 0; j < numStates; j++)
{
ump_x1 += vl[j] * le[l * numStates + j];
ump_x2 += vr[j] * ri[l * numStates + j];
}
x1px2 = ump_x1 * ump_x2;
for(j = 0; j < numStates; j++)
v[j] += x1px2 * extEV[l * numStates + j];
}
scale = 1;
for(l = 0; scale && (l < numStates); l++)
scale = ((v[l] < minlikelihood) && (v[l] > minusminlikelihood));
if(scale)
{
for(l = 0; l < numStates; l++)
v[l] *= twotothe256;
}
ancestralCat(v, sumBuffer, &diagptable[cptr[i] * statesSquare], i, numStates);
}
break;
default:
assert(0);
}
rax_free(x3);
}
static void ancestralGamma(double *_v, double *sumBuffer, double *diagptable, int i, int numStates, int gammaStates)
{
int
statesSquare = numStates * numStates,
k,
j,
l;
double
*v,
*ancestral = &sumBuffer[gammaStates * i],
sum = 0.0,
*term = (double*)rax_malloc(sizeof(double) * numStates);
for(l = 0; l < numStates; l++)
term[l] = 0.0;
for(k = 0; k < 4; k++)
{
v = &(_v[numStates * k]);
for(l = 0; l < numStates; l++)
{
double
al = 0.0;
for(j = 0; j < numStates; j++)
al += v[j] * diagptable[k * statesSquare + l * numStates + j];
term[l] += al;
sum += al;
}
}
for(l = 0; l < numStates; l++)
ancestral[l] = term[l] / sum;
rax_free(term);
}
static void newviewFlexGamma_Ancestral(int tipCase,
double *x1, double *x2, double *extEV, double *tipVector,
unsigned char *tipX1, unsigned char *tipX2,
int n, double *left, double *right,
const int numStates, double *diagptable, double *sumBuffer)
{
double
*v,
*x3 = (double*)rax_malloc(sizeof(double) * 4 * numStates);
double x1px2;
int i, j, l, k, scale;
double *vl, *vr, al, ar;
const int
statesSquare = numStates * numStates,
gammaStates = 4 * numStates;
switch(tipCase)
{
case TIP_TIP:
{
for(i = 0; i < n; i++)
{
for(k = 0; k < 4; k++)
{
vl = &(tipVector[numStates * tipX1[i]]);
vr = &(tipVector[numStates * tipX2[i]]);
v = &(x3[numStates * k]);
for(l = 0; l < numStates; l++)
v[l] = 0;
for(l = 0; l < numStates; l++)
{
al = 0.0;
ar = 0.0;
for(j = 0; j < numStates; j++)
{
al += vl[j] * left[k * statesSquare + l * numStates + j];
ar += vr[j] * right[k * statesSquare + l * numStates + j];
}
x1px2 = al * ar;
for(j = 0; j < numStates; j++)
v[j] += x1px2 * extEV[numStates * l + j];
}
}
ancestralGamma(x3, sumBuffer, diagptable, i, numStates, gammaStates);
}
}
break;
case TIP_INNER:
{
for (i = 0; i < n; i++)
{
for(k = 0; k < 4; k++)
{
vl = &(tipVector[numStates * tipX1[i]]);
vr = &(x2[gammaStates * i + numStates * k]);
v = &(x3[numStates * k]);
for(l = 0; l < numStates; l++)
v[l] = 0;
for(l = 0; l < numStates; l++)
{
al = 0.0;
ar = 0.0;
for(j = 0; j < numStates; j++)
{
al += vl[j] * left[k * statesSquare + l * numStates + j];
ar += vr[j] * right[k * statesSquare + l * numStates + j];
}
x1px2 = al * ar;
for(j = 0; j < numStates; j++)
v[j] += x1px2 * extEV[numStates * l + j];
}
}
v = x3;
scale = 1;
for(l = 0; scale && (l < gammaStates); l++)
scale = (ABS(v[l]) < minlikelihood);
if(scale)
{
for(l = 0; l < gammaStates; l++)
v[l] *= twotothe256;
}
ancestralGamma(x3, sumBuffer, diagptable, i, numStates, gammaStates);
}
}
break;
case INNER_INNER:
for (i = 0; i < n; i++)
{
for(k = 0; k < 4; k++)
{
vl = &(x1[gammaStates * i + numStates * k]);
vr = &(x2[gammaStates * i + numStates * k]);
v = &(x3[numStates * k]);
for(l = 0; l < numStates; l++)
v[l] = 0;
for(l = 0; l < numStates; l++)
{
al = 0.0;
ar = 0.0;
for(j = 0; j < numStates; j++)
{
al += vl[j] * left[k * statesSquare + l * numStates + j];
ar += vr[j] * right[k * statesSquare + l * numStates + j];
}
x1px2 = al * ar;
for(j = 0; j < numStates; j++)
v[j] += x1px2 * extEV[numStates * l + j];
}
}
v = x3;
scale = 1;
for(l = 0; scale && (l < gammaStates); l++)
scale = ((ABS(v[l]) < minlikelihood));
if (scale)
{
for(l = 0; l < gammaStates; l++)
v[l] *= twotothe256;
}
ancestralGamma(x3, sumBuffer, diagptable, i, numStates, gammaStates);
}
break;
default:
assert(0);
}
rax_free(x3);
}
void newviewIterativeAncestral(tree *tr)
{
traversalInfo
*ti = tr->td[0].ti;
int
i,
model;
assert(!tr->saveMemory);
for(i = 1; i < tr->td[0].count; i++)
{
traversalInfo
*tInfo = &ti[i];
for(model = 0; model < tr->NumberOfModels; model++)
{
double
*x1_start = (double*)NULL,
*x2_start = (double*)NULL,
*left = (double*)NULL,
*right = (double*)NULL,
qz,
rz;
unsigned char
*tipX1 = (unsigned char *)NULL,
*tipX2 = (unsigned char *)NULL;
size_t
states = (size_t)tr->partitionData[model].states,
width = tr->partitionData[model].width;
switch(tInfo->tipCase)
{
case TIP_TIP:
tipX1 = tr->partitionData[model].yVector[tInfo->qNumber];
tipX2 = tr->partitionData[model].yVector[tInfo->rNumber];
break;
case TIP_INNER:
tipX1 = tr->partitionData[model].yVector[tInfo->qNumber];
x2_start = tr->partitionData[model].xVector[tInfo->rNumber - tr->mxtips - 1];
break;
case INNER_INNER:
x1_start = tr->partitionData[model].xVector[tInfo->qNumber - tr->mxtips - 1];
x2_start = tr->partitionData[model].xVector[tInfo->rNumber - tr->mxtips - 1];
break;
default:
assert(0);
}
left = tr->partitionData[model].left;
right = tr->partitionData[model].right;
if(tr->multiBranch)
{
qz = tInfo->qz[model];
rz = tInfo->rz[model];
}
else
{
qz = tInfo->qz[0];
rz = tInfo->rz[0];
}
switch(tr->rateHetModel)
{
case CAT:
{
double
*diagptable = (double*)rax_malloc(tr->partitionData[model].numberOfCategories * states * states * sizeof(double));
makeP_Flex(qz, rz, tr->partitionData[model].perSiteRates,
tr->partitionData[model].EI,
tr->partitionData[model].EIGN,
tr->partitionData[model].numberOfCategories, left, right, states);
makeP_Flex_Ancestral(tr->partitionData[model].perSiteRates,
tr->partitionData[model].EI,
tr->partitionData[model].EIGN,
tr->partitionData[model].numberOfCategories, diagptable, states);
newviewFlexCat_Ancestral(tInfo->tipCase, tr->partitionData[model].EV, tr->partitionData[model].rateCategory,
x1_start, x2_start, tr->partitionData[model].tipVector,
tipX1, tipX2, width, left, right, states, diagptable,
tr->partitionData[model].sumBuffer);
rax_free(diagptable);
}
break;
case GAMMA:
case GAMMA_I:
{
double
*diagptable = (double*)rax_malloc(4 * states * states * sizeof(double));
makeP_Flex(qz, rz, tr->partitionData[model].gammaRates,
tr->partitionData[model].EI,
tr->partitionData[model].EIGN,
4, left, right, states);
makeP_Flex_Ancestral(tr->partitionData[model].gammaRates,
tr->partitionData[model].EI,
tr->partitionData[model].EIGN,
4, diagptable, states);
newviewFlexGamma_Ancestral(tInfo->tipCase,
x1_start, x2_start,
tr->partitionData[model].EV,
tr->partitionData[model].tipVector,
tipX1, tipX2,
width, left, right, states, diagptable, tr->partitionData[model].sumBuffer);
rax_free(diagptable);
}
break;
default:
assert(0);
}
}
}
}
static void traversalInfoAncestralRoot(nodeptr p, traversalInfo *ti, int *counter, int maxTips, int numBranches)
{
int
i;
nodeptr
q = p,
r = p->back;
for(i = 0; i < numBranches; i++)
{
double
z = sqrt(q->z[i]);
if(z < zmin)
z = zmin;
if(z > zmax)
z = zmax;
z = log(z);
ti[*counter].qz[i] = z;
ti[*counter].rz[i] = z;
}
if(isTip(r->number, maxTips) && isTip(q->number, maxTips))
{
ti[*counter].tipCase = TIP_TIP;
ti[*counter].qNumber = q->number;
ti[*counter].rNumber = r->number;
*counter = *counter + 1;
}
else
{
if(isTip(r->number, maxTips) || isTip(q->number, maxTips))
{
nodeptr tmp;
if(isTip(r->number, maxTips))
{
tmp = r;
r = q;
q = tmp;
}
ti[*counter].tipCase = TIP_INNER;
ti[*counter].qNumber = q->number;
ti[*counter].rNumber = r->number;
*counter = *counter + 1;
}
else
{
ti[*counter].tipCase = INNER_INNER;
ti[*counter].qNumber = q->number;
ti[*counter].rNumber = r->number;
*counter = *counter + 1;
}
}
}
void newviewGenericAncestral (tree *tr, nodeptr p, boolean atRoot)
{
if(atRoot)
{
tr->td[0].count = 1;
traversalInfoAncestralRoot(p, &(tr->td[0].ti[0]), &(tr->td[0].count), tr->mxtips, tr->numBranches);
if(tr->td[0].count > 1)
{
#ifdef _USE_PTHREADS
masterBarrier(THREAD_NEWVIEW_ANCESTRAL, tr);
#else
newviewIterativeAncestral(tr);
#endif
}
}
else
{
if(isTip(p->number, tr->mxtips))
return;
tr->td[0].count = 1;
computeTraversalInfo(p, &(tr->td[0].ti[0]), &(tr->td[0].count), tr->mxtips, tr->numBranches);
if(tr->td[0].count > 1)
{
#ifdef _USE_PTHREADS
masterBarrier(THREAD_NEWVIEW_ANCESTRAL, tr);
#else
newviewIterativeAncestral(tr);
#endif
}
}
}
typedef struct {
double *probs;
char c;
int states;
} ancestralState;
static void computeAncestralRec(tree *tr, nodeptr p, int *counter, FILE *probsFile, FILE *statesFile, boolean atRoot)
{
#ifdef _USE_PTHREADS
size_t
accumulatedOffset = 0;
#endif
int
model,
globalIndex = 0;
ancestralState
*a = (ancestralState *)rax_malloc(sizeof(ancestralState) * tr->cdta->endsite),
*unsortedA = (ancestralState *)rax_malloc(sizeof(ancestralState) * tr->rdta->sites);
if(!atRoot)
{
if(isTip(p->number, tr->mxtips))
return;
computeAncestralRec(tr, p->next->back, counter, probsFile, statesFile, atRoot);
computeAncestralRec(tr, p->next->next->back, counter, probsFile, statesFile, atRoot);
newviewGeneric(tr, p);
}
newviewGenericAncestral(tr, p, atRoot);
#ifdef _USE_PTHREADS
masterBarrier(THREAD_GATHER_ANCESTRAL, tr);
#endif
if(atRoot)
{
fprintf(probsFile, "ROOT\n");
fprintf(statesFile, "ROOT ");
}
else
{
fprintf(probsFile, "%d\n", p->number);
fprintf(statesFile, "%d ", p->number);
}
for(model = 0; model < tr->NumberOfModels; model++)
{
int
offset,
i,
width = tr->partitionData[model].upper - tr->partitionData[model].lower,
states = tr->partitionData[model].states;
#ifdef _USE_PTHREADS
double
*ancestral = &tr->ancestralStates[accumulatedOffset];
#else
double
*ancestral = tr->partitionData[model].sumBuffer;
#endif
if(tr->rateHetModel == CAT)
offset = 1;
else
offset = 4;
for(i = 0; i < width; i++, globalIndex++)
{
double
equal = 1.0 / (double)states,
max = -1.0;
boolean
approximatelyEqual = TRUE;
int
max_l = -1,
l;
char
c;
a[globalIndex].states = states;
a[globalIndex].probs = (double *)rax_malloc(sizeof(double) * states);
for(l = 0; l < states; l++)
{
double
value = ancestral[offset * states * i + l];
if(value > max)
{
max = value;
max_l = l;
}
approximatelyEqual = approximatelyEqual && (ABS(equal - value) < 0.000001);
a[globalIndex].probs[l] = value;
}
if(approximatelyEqual)
c = '?';
else
c = getStateCharacter(tr->partitionData[model].dataType, max_l);
a[globalIndex].c = c;
}
#ifdef _USE_PTHREADS
accumulatedOffset += width * offset * states;
#endif
}
{
int
j,
k;
for(j = 0; j < tr->cdta->endsite; j++)
{
for(k = 0; k < tr->rdta->sites; k++)
if(j == tr->patternPosition[k])
{
int
sorted = j,
unsorted = tr->columnPosition[k] - 1;
unsortedA[unsorted].states = a[sorted].states;
unsortedA[unsorted].c = a[sorted].c;
unsortedA[unsorted].probs = (double*)rax_malloc(sizeof(double) * unsortedA[unsorted].states);
memcpy(unsortedA[unsorted].probs, a[sorted].probs, sizeof(double) * a[sorted].states);
}
}
for(k = 0; k < tr->rdta->sites; k++)
{
for(j = 0; j < unsortedA[k].states; j++)
fprintf(probsFile, "%f ", unsortedA[k].probs[j]);
fprintf(probsFile, "\n");
fprintf(statesFile, "%c", unsortedA[k].c);
}
fprintf(probsFile, "\n");
fprintf(statesFile, "\n");
}
*counter = *counter + 1;
{
int j;
for(j = 0; j < tr->rdta->sites; j++)
rax_free(unsortedA[j].probs);
for(j = 0; j < tr->cdta->endsite; j++)
rax_free(a[j].probs);
}
rax_free(a);
rax_free(unsortedA);
}
static char *ancestralTreeRec(char *treestr, tree *tr, nodeptr p)
{
if(isTip(p->number, tr->rdta->numsp))
{
sprintf(treestr, "%s", tr->nameList[p->number]);
while (*treestr)
treestr++;
}
else
{
*treestr++ = '(';
treestr = ancestralTreeRec(treestr, tr, p->next->back);
*treestr++ = ',';
treestr = ancestralTreeRec(treestr, tr, p->next->next->back);
*treestr++ = ')';
sprintf(treestr, "%d", p->number);
}
while (*treestr)
treestr++;
return treestr;
}
static char *ancestralTree(char *treestr, tree *tr)
{
*treestr++ = '(';
treestr = ancestralTreeRec(treestr, tr, tr->leftRootNode);
*treestr++ = ',';
treestr = ancestralTreeRec(treestr, tr, tr->rightRootNode);
*treestr++ = ')';
sprintf(treestr, "ROOT");
while (*treestr)
treestr++;
*treestr++ = ';';
*treestr++ = '\0';
while (*treestr) treestr++;
return treestr;
}
void computeAncestralStates(tree *tr, double referenceLikelihood)
{
int
counter = 0;
char
treeFileName[2048],
ancestralProbsFileName[2048],
ancestralStatesFileName[2048];
FILE
*treeFile,
*probsFile,
*statesFile;
#ifdef _USE_PTHREADS
tr->ancestralStates = (double*)rax_malloc(getContiguousVectorLength(tr) * sizeof(double));
#endif
strcpy(ancestralProbsFileName, workdir);
strcpy(ancestralStatesFileName, workdir);
strcpy(treeFileName, workdir);
strcat(ancestralProbsFileName, "RAxML_marginalAncestralProbabilities.");
strcat(ancestralStatesFileName, "RAxML_marginalAncestralStates.");
strcat(treeFileName, "RAxML_nodeLabelledRootedTree.");
strcat(ancestralProbsFileName, run_id);
strcat(ancestralStatesFileName, run_id);
strcat(treeFileName, run_id);
probsFile = myfopen(ancestralProbsFileName, "w");
statesFile = myfopen(ancestralStatesFileName, "w");
treeFile = myfopen(treeFileName, "w");
assert(tr->leftRootNode == tr->rightRootNode->back);
computeAncestralRec(tr, tr->leftRootNode, &counter, probsFile, statesFile, FALSE);
computeAncestralRec(tr, tr->rightRootNode, &counter, probsFile, statesFile, FALSE);
computeAncestralRec(tr, tr->rightRootNode, &counter, probsFile, statesFile, TRUE);
evaluateGeneric(tr, tr->rightRootNode);
if(fabs(tr->likelihood - referenceLikelihood) > 0.5)
{
printf("Something suspiciuous is going on with the marginal ancestral probability computations\n");
assert(0);
}
assert(counter == tr->mxtips - 1);
ancestralTree(tr->tree_string, tr);
fprintf(treeFile, "%s\n", tr->tree_string);
fclose(probsFile);
fclose(statesFile);
fclose(treeFile);
printBothOpen("Marginal Ancestral Probabilities written to file:\n%s\n\n", ancestralProbsFileName);
printBothOpen("Ancestral Sequences based on Marginal Ancestral Probabilities written to file:\n%s\n\n", ancestralStatesFileName);
printBothOpen("Node-laballed ROOTED tree written to file:\n%s\n", treeFileName);
}
| mit |
JoseLuis11/Traskilada-Web | app/assets/css/owner_login.css | 2167 | @import url(http://fonts.googleapis.com/css?family=Roboto);
.loginmodal-container {
padding: 30px;
max-width: 350px;
width: 100%;
background-color: #F7F7F7;
margin: 0 auto;
border-radius: 2px;
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
overflow: hidden;
font-family: roboto;
}
.loginmodal-container h1 {
text-align: center;
font-size: 1.8em;
font-family: roboto;
}
.loginmodal-container input[type=submit] {
width: 100%;
display: block;
margin-bottom: 10px;
position: relative;
}
.loginmodal-container input[type=text], input[type=password] {
height: 44px;
font-size: 16px;
width: 100%;
margin-bottom: 10px;
-webkit-appearance: none;
background: #fff;
border: 1px solid #d9d9d9;
border-top: 1px solid #c0c0c0;
/* border-radius: 2px; */
padding: 0 8px;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.loginmodal-container input[type=text]:hover, input[type=password]:hover {
border: 1px solid #b9b9b9;
border-top: 1px solid #a0a0a0;
-moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
.loginmodal {
text-align: center;
font-size: 14px;
font-family: 'Arial', sans-serif;
font-weight: 700;
height: 36px;
padding: 0 8px;
/* border-radius: 3px; */
/* -webkit-user-select: none;
user-select: none; */
}
.loginmodal-submit {
/* border: 1px solid #3079ed; */
border: 0px;
color: #fff;
text-shadow: 0 1px rgba(0,0,0,0.1);
background-color: #4d90fe;
padding: 17px 0px;
font-family: roboto;
font-size: 14px;
/* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#4787ed)); */
}
.loginmodal-submit:hover {
/* border: 1px solid #2f5bb7; */
border: 0px;
text-shadow: 0 1px rgba(0,0,0,0.3);
background-color: #357ae8;
/* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#357ae8)); */
}
.loginmodal-container a {
text-decoration: none;
color: #666;
font-weight: 400;
text-align: center;
display: inline-block;
opacity: 0.6;
transition: opacity ease 0.5s;
}
.login-help{
font-size: 12px;
} | mit |
github/codeql | csharp/ql/test/query-tests/Bad Practices/Control-Flow/ConstantCondition/ConstantConditionGood.cs | 90 | class Good
{
public int Max(int a, int b)
{
return a > b ? a : b;
}
}
| mit |
sugiuraii/WebSocketGaugeClientNeo | src/index/webpack.config.js | 3486 | /*
* The MIT License
*
* Copyright 2017 kuniaki.
*
* 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.
*/
var webpack = require('webpack');
module.exports = {
entry:
{
"index": './index.ts'
},
devtool: "source-map",
output:
{
path: __dirname + "/../../public_html/",
filename: "./js/[name].js"
},
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js']
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Popper: ['popper.js', 'default']
})
],
module: {
loaders: [
{test: /\.tsx?$/, loader: 'ts-loader'},
{test: /\.png$/, loader: "file-loader?name=img/[name].[ext]"},
{test: /\.html$/, loader: "file-loader?name=[name].[ext]"},
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.svg$/, loader: 'url-loader?mimetype=image/svg+xml' },
{ test: /\.woff$/, loader: 'url-loader?mimetype=application/font-woff' },
{ test: /\.woff2$/, loader: 'url-loader?mimetype=application/font-woff' },
{ test: /\.eot$/, loader: 'url-loader?mimetype=application/font-woff' },
{ test: /\.ttf$/, loader: 'url-loader?mimetype=application/font-woff' },
{
test: /\.(scss)$/,
use: [{
loader: 'style-loader' // inject CSS to page
}, {
loader: 'css-loader' // translates CSS into CommonJS modules
}, {
loader: 'postcss-loader', // Run post css actions
options: {
plugins: function () { // post css plugins, can be exported to postcss.config.js
return [
require('precss'),
require('autoprefixer')
];
}
}
}, {
loader: 'sass-loader' // compiles SASS to CSS
}]
}
]
}
};
| mit |
GridProtectionAlliance/openECA | Source/Demo/PowerCalculator/PowerCalculator/Model/Test/Power.cs | 325 | // COMPILER GENERATED CODE
// THIS WILL BE OVERWRITTEN AT EACH GENERATION
// EDIT AT YOUR OWN RISK
using System.Runtime.CompilerServices;
namespace PowerCalculator.Model.Test
{
[CompilerGenerated]
public class Power
{
public double Real { get; set; }
public double Reactive { get; set; }
}
} | mit |
cmbruns/osgswig | examples/ruby/viewer.rb | 711 | #!/usr/bin/ruby
#
# Demonstation for Ruby
#
puts $LOAD_PATH
# extend the load path for wosg
$LOAD_PATH << '../../bin/ruby'
# include all necessary libs
require 'wosg'
require 'wosgDB'
require 'wosgProducer'
class Viewer
def initialize()
# open a viewer
@viewer = WosgProducer::Viewer.new
# open
@viewer.setUpViewer(WosgProducer::Viewer::STANDARD_SETTINGS)
puts "Reading Data ... "
n = WosgDB::readNodeFile("cow.osg")
root = Wosg::Group.new()
root.addChild(n)
@viewer.setSceneData(root)
puts "Show the Window ... "
@viewer.realize()
end
def run()
while [email protected]()
@viewer.sync
@viewer.update
@viewer.frame
end
end
end
v = Viewer.new
v.run
| mit |
forstermatth/LIIS | refman/search/variables_62.js | 120 | var searchData=
[
['basepath',['BASEPATH',['../index_8php.html#ad39801cabfd338dc5524466fe793fda9',1,'index.php']]]
];
| mit |
ladygagapowerbot/bachelor-thesis-implementation | lib/Encog/apidocs/org/encog/util/package-summary.html | 10631 | <!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_24) on Wed Apr 17 10:23:36 UTC 2013 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
org.encog.util (Encog Core 3.2.0-SNAPSHOT API)
</TITLE>
<META NAME="date" CONTENT="2013-04-17">
<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 = "org.encog.util (Encog Core 3.2.0-SNAPSHOT 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="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.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/encog/plugin/system/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../org/encog/util/arrayutil/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?org/encog/util/package-summary.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-summary.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>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<H2>
Package org.encog.util
</H2>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Class Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../org/encog/util/EncogValidate.html" title="class in org.encog.util">EncogValidate</A></B></TD>
<TD>Used to validate if training is valid.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../org/encog/util/EngineArray.html" title="class in org.encog.util">EngineArray</A></B></TD>
<TD>Some array functions used by Encog.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../org/encog/util/Format.html" title="class in org.encog.util">Format</A></B></TD>
<TD>Provides the ability for Encog to format numbers and times.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../org/encog/util/HTMLReport.html" title="class in org.encog.util">HTMLReport</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../org/encog/util/ImageSize.html" title="class in org.encog.util">ImageSize</A></B></TD>
<TD>Simple class to determine the size of an image.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../org/encog/util/ObjectPair.html" title="class in org.encog.util">ObjectPair<A,B></A></B></TD>
<TD>A pair of objects.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../org/encog/util/ParamsHolder.html" title="class in org.encog.util">ParamsHolder</A></B></TD>
<TD>A class that can be used to parse parameters stored in a map.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../org/encog/util/ResourceLoader.html" title="class in org.encog.util">ResourceLoader</A></B></TD>
<TD>Used to load resources from the JAR file.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../org/encog/util/SimpleParser.html" title="class in org.encog.util">SimpleParser</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../org/encog/util/Stopwatch.html" title="class in org.encog.util">Stopwatch</A></B></TD>
<TD>A stopwatch, meant to emulate the C# Stopwatch class.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../org/encog/util/YahooSearch.html" title="class in org.encog.util">YahooSearch</A></B></TD>
<TD>YahooSearch: Perform a search using Yahoo.</TD>
</TR>
</TABLE>
<P>
<DL>
</DL>
<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="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.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/encog/plugin/system/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../org/encog/util/arrayutil/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?org/encog/util/package-summary.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-summary.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>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2013. All Rights Reserved.
</BODY>
</HTML>
| mit |
mishapivo/mishapivo.github.io | aqua-ui-kits/creative_material-bootstrap-wizard/wizard-list-place.html | 15029 | <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Material Bootstrap Wizard by Creative Tim</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
<meta name="viewport" content="width=device-width" />
<link rel="apple-touch-icon" sizes="76x76" href="assets/img/apple-icon.png" />
<link rel="icon" type="image/png" href="assets/img/favicon.png" />
<!-- Fonts and icons -->
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Slab:400,700|Material+Icons" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" />
<!-- CSS Files -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet" />
<link href="assets/css/material-bootstrap-wizard.css" rel="stylesheet" />
<!-- CSS Just for demo purpose, don't include it in your project -->
<link href="assets/css/demo.css" rel="stylesheet" />
</head>
<body>
<div class="image-container set-full-height" style="background-image: url('assets/img/wizard-city.jpg')">
<!-- Creative Tim Branding -->
<a href="http://creative-tim.com">
<div class="logo-container">
<div class="logo">
<img src="assets/img/new_logo.png">
</div>
<div class="brand">
Creative Tim
</div>
</div>
</a>
<!-- Made With Material Kit -->
<a href="http://demos.creative-tim.com/material-kit/index.html?ref=material-bootstrap-wizard" class="made-with-mk">
<div class="brand">MK</div>
<div class="made-with">Made with <strong>Material Kit</strong></div>
</a>
<!-- Big container -->
<div class="container">
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<!-- Wizard container -->
<div class="wizard-container">
<div class="card wizard-card" data-color="purple" id="wizard">
<form action="" method="">
<!-- You can switch " data-color="rose" " with one of the next bright colors: "blue", "green", "orange", "purple" -->
<div class="wizard-header">
<h3 class="wizard-title">
List Your Place
</h3>
<h5>This information will let us know more about your place.</h5>
</div>
<div class="wizard-navigation">
<ul>
<li><a href="#location" data-toggle="tab">Location</a></li>
<li><a href="#type" data-toggle="tab">Type</a></li>
<li><a href="#facilities" data-toggle="tab">Facilities</a></li>
<li><a href="#description" data-toggle="tab">Description</a></li>
</ul>
</div>
<div class="tab-content">
<div class="tab-pane" id="location">
<div class="row">
<div class="col-sm-12">
<h4 class="info-text"> Let's start with the basic details</h4>
</div>
<div class="col-sm-5 col-sm-offset-1">
<div class="form-group label-floating">
<label class="control-label">City</label>
<input type="text" class="form-control" id="exampleInputEmail1">
</div>
</div>
<div class="col-sm-5">
<div class="form-group label-floating">
<label class="control-label">Country</label>
<select name="country" class="form-control">
<option disabled="" selected=""></option>
<option value="Afghanistan"> Afghanistan </option>
<option value="Albania"> Albania </option>
<option value="Algeria"> Algeria </option>
<option value="American Samoa"> American Samoa </option>
<option value="Andorra"> Andorra </option>
<option value="Angola"> Angola </option>
<option value="Anguilla"> Anguilla </option>
<option value="Antarctica"> Antarctica </option>
<option value="...">...</option>
</select>
</div>
</div>
<div class="col-sm-5 col-sm-offset-1">
<div class="form-group label-floating">
<label class="control-label">Accommodates</label>
<select class="form-control">
<option disabled="" selected=""></option>
<option>1 Person</option>
<option>2 Persons </option>
<option>3 Persons</option>
<option>4 Persons</option>
<option>5 Persons</option>
<option>6+ Persons</option>
</select>
</div>
</div>
<div class="col-sm-5">
<div class="form-group label-floating">
<label class="control-label">Rent price</label>
<div class="input-group">
<input type="text" class="form-control">
<span class="input-group-addon">$</span>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="type">
<h4 class="info-text">What type of location do you have? </h4>
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<div class="col-sm-4 col-sm-offset-2">
<div class="choice" data-toggle="wizard-radio" rel="tooltip" title="Select this option if you have a house.">
<input type="radio" name="type" value="House">
<div class="icon">
<i class="material-icons">home</i>
</div>
<h6>House</h6>
</div>
</div>
<div class="col-sm-4">
<div class="choice" data-toggle="wizard-radio" rel="tooltip" title="Select this option if you have an appartment">
<input type="radio" name="type" value="Appartment">
<div class="icon">
<i class="material-icons">hotel</i>
</div>
<h6>Appartment</h6>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="facilities">
<h4 class="info-text">Tell us more about facilities. </h4>
<div class="row">
<div class="col-sm-5 col-sm-offset-1">
<div class="form-group label-floating">
<label class="control-label">Your place is good for</label>
<select class="form-control">
<option disabled="" selected=""></option>
<option>Business</option>
<option>Vacation </option>
<option>Work</option>
</select>
</div>
</div>
<div class="col-sm-5">
<div class="form-group label-floating">
<label class="control-label">Is air conditioning included ?</label>
<select class="form-control">
<option disabled="" selected=""></option>
<option>Yes</option>
<option>No </option>
</select>
</div>
</div>
<div class="col-sm-5 col-sm-offset-1">
<div class="form-group label-floating">
<label class="control-label">Does your place have wi-fi?</label>
<select class="form-control">
<option disabled="" selected=""></option>
<option>Yes</option>
<option>No </option>
</select>
</div>
</div>
<div class="col-sm-5">
<div class="form-group label-floating">
<label class="control-label">Is breakfast included?</label>
<select class="form-control">
<option disabled="" selected=""></option>
<option>Yes</option>
<option>No </option>
</select>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="description">
<div class="row">
<h4 class="info-text"> Drop us a small description. </h4>
<div class="col-sm-6 col-sm-offset-1">
<div class="form-group label-floating">
<label class="control-label">Place description</label>
<textarea class="form-control" placeholder="" rows="9"></textarea>
</div>
</div>
<div class="col-sm-4">
<div class="form-group label-floating">
<label class="control-label">Example</label>
<p class="description">"The place is really nice. We use it every sunday when we go fishing. It is so awesome."</p>
</div>
</div>
</div>
</div>
</div>
<div class="wizard-footer">
<div class="pull-right">
<input type='button' class='btn btn-next btn-fill btn-primary btn-wd' name='next' value='Next' />
<input type='button' class='btn btn-finish btn-fill btn-primary btn-wd' name='finish' value='Finish' />
</div>
<div class="pull-left">
<input type='button' class='btn btn-previous btn-fill btn-default btn-wd' name='previous' value='Previous' />
</div>
<div class="clearfix"></div>
</div>
</form>
</div>
</div> <!-- wizard container -->
</div>
</div> <!-- row -->
</div> <!-- big container -->
<div class="footer">
<div class="container text-center">
Made with <i class="fa fa-heart heart"></i> by <a href="http://www.creative-tim.com">Creative Tim</a>. Free download <a href="http://www.creative-tim.com/product/bootstrap-wizard">here.</a>
</div>
</div>
</div>
</body>
<!-- Core JS Files -->
<script src="assets/js/jquery-2.2.4.min.js" type="text/javascript"></script>
<script src="assets/js/bootstrap.min.js" type="text/javascript"></script>
<script src="assets/js/jquery.bootstrap.js" type="text/javascript"></script>
<!-- Plugin for the Wizard -->
<script src="assets/js/material-bootstrap-wizard.js"></script>
<!-- More information about jquery.validate here: http://jqueryvalidation.org/ -->
<script src="assets/js/jquery.validate.min.js"></script>
</html>
| mit |
zeusjs/widgets | test/mock_views/radio_tabs_1.html | 659 | <zs-radio-tabs selection="currentTab" ondeselect="onDeselect()">
<zs-radio-tab-pane heading="Foobar" item="foo"
subheading="Foobar subhead">
<div class="nested-block">
This is foo
</div>
</zs-radio-tab-pane>
<zs-radio-tab-pane heading="Barbaz"
item="bar"
subheading="Barbaz subhead">
<div class="nested-block">
This is bar
</div>
</zs-radio-tab-pane>
<zs-radio-tab-pane heading="Zoom"
item="zoom"
subheading="Zoom subhead">
<div class="nested-block">
This is zoom
</div>
</zs-radio-tab-pane>
</zs-radio-tabs>
| mit |
enclose-io/compiler | current/test/parallel/test-repl-tab-complete.js | 19230 | // Copyright Joyent, Inc. and other Node contributors.
//
// 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.
'use strict';
const common = require('../common');
const ArrayStream = require('../common/arraystream');
const {
hijackStderr,
restoreStderr
} = require('../common/hijackstdio');
const assert = require('assert');
const path = require('path');
const fixtures = require('../common/fixtures');
const { builtinModules } = require('module');
const hasInspector = process.features.inspector;
if (!common.isMainThread)
common.skip('process.chdir is not available in Workers');
// We have to change the directory to ../fixtures before requiring repl
// in order to make the tests for completion of node_modules work properly
// since repl modifies module.paths.
process.chdir(fixtures.fixturesDir);
const repl = require('repl');
function getNoResultsFunction() {
return common.mustCall((err, data) => {
assert.ifError(err);
assert.deepStrictEqual(data[0], []);
});
}
const works = [['inner.one'], 'inner.o'];
const putIn = new ArrayStream();
const testMe = repl.start('', putIn);
// Some errors are passed to the domain, but do not callback
testMe._domain.on('error', assert.ifError);
// Tab Complete will not break in an object literal
putIn.run([
'var inner = {',
'one:1'
]);
testMe.complete('inner.o', getNoResultsFunction());
testMe.complete('console.lo', common.mustCall(function(error, data) {
assert.deepStrictEqual(data, [['console.log'], 'console.lo']);
}));
testMe.complete('console?.lo', common.mustCall((error, data) => {
assert.deepStrictEqual(data, [['console?.log'], 'console?.lo']);
}));
testMe.complete('console?.zzz', common.mustCall((error, data) => {
assert.deepStrictEqual(data, [[], 'console?.zzz']);
}));
testMe.complete('console?.', common.mustCall((error, data) => {
assert(data[0].includes('console?.log'));
assert.strictEqual(data[1], 'console?.');
}));
// Tab Complete will return globally scoped variables
putIn.run(['};']);
testMe.complete('inner.o', common.mustCall(function(error, data) {
assert.deepStrictEqual(data, works);
}));
putIn.run(['.clear']);
// Tab Complete will not break in an ternary operator with ()
putIn.run([
'var inner = ( true ',
'?',
'{one: 1} : '
]);
testMe.complete('inner.o', getNoResultsFunction());
putIn.run(['.clear']);
// Tab Complete will return a simple local variable
putIn.run([
'var top = function() {',
'var inner = {one:1};'
]);
testMe.complete('inner.o', getNoResultsFunction());
// When you close the function scope tab complete will not return the
// locally scoped variable
putIn.run(['};']);
testMe.complete('inner.o', getNoResultsFunction());
putIn.run(['.clear']);
// Tab Complete will return a complex local variable
putIn.run([
'var top = function() {',
'var inner = {',
' one:1',
'};'
]);
testMe.complete('inner.o', getNoResultsFunction());
putIn.run(['.clear']);
// Tab Complete will return a complex local variable even if the function
// has parameters
putIn.run([
'var top = function(one, two) {',
'var inner = {',
' one:1',
'};'
]);
testMe.complete('inner.o', getNoResultsFunction());
putIn.run(['.clear']);
// Tab Complete will return a complex local variable even if the
// scope is nested inside an immediately executed function
putIn.run([
'var top = function() {',
'(function test () {',
'var inner = {',
' one:1',
'};'
]);
testMe.complete('inner.o', getNoResultsFunction());
putIn.run(['.clear']);
// The definition has the params and { on a separate line.
putIn.run([
'var top = function() {',
'r = function test (',
' one, two) {',
'var inner = {',
' one:1',
'};'
]);
testMe.complete('inner.o', getNoResultsFunction());
putIn.run(['.clear']);
// Currently does not work, but should not break, not the {
putIn.run([
'var top = function() {',
'r = function test ()',
'{',
'var inner = {',
' one:1',
'};'
]);
testMe.complete('inner.o', getNoResultsFunction());
putIn.run(['.clear']);
// Currently does not work, but should not break
putIn.run([
'var top = function() {',
'r = function test (',
')',
'{',
'var inner = {',
' one:1',
'};'
]);
testMe.complete('inner.o', getNoResultsFunction());
putIn.run(['.clear']);
// Make sure tab completion works on non-Objects
putIn.run([
'var str = "test";'
]);
testMe.complete('str.len', common.mustCall(function(error, data) {
assert.deepStrictEqual(data, [['str.length'], 'str.len']);
}));
putIn.run(['.clear']);
// Tab completion should not break on spaces
const spaceTimeout = setTimeout(function() {
throw new Error('timeout');
}, 1000);
testMe.complete(' ', common.mustCall(function(error, data) {
assert.ifError(error);
assert.strictEqual(data[1], '');
assert.ok(data[0].includes('globalThis'));
clearTimeout(spaceTimeout);
}));
// Tab completion should pick up the global "toString" object, and
// any other properties up the "global" object's prototype chain
testMe.complete('toSt', common.mustCall(function(error, data) {
assert.deepStrictEqual(data, [['toString'], 'toSt']);
}));
// Own properties should shadow properties on the prototype
putIn.run(['.clear']);
putIn.run([
'var x = Object.create(null);',
'x.a = 1;',
'x.b = 2;',
'var y = Object.create(x);',
'y.a = 3;',
'y.c = 4;'
]);
testMe.complete('y.', common.mustCall(function(error, data) {
assert.deepStrictEqual(data, [['y.b', '', 'y.a', 'y.c'], 'y.']);
}));
// Tab complete provides built in libs for require()
putIn.run(['.clear']);
testMe.complete('require(\'', common.mustCall(function(error, data) {
assert.strictEqual(error, null);
builtinModules.forEach((lib) => {
assert(
data[0].includes(lib) || lib.startsWith('_') || lib.includes('/'),
`${lib} not found`
);
});
const newModule = 'foobar';
assert(!builtinModules.includes(newModule));
repl.builtinModules.push(newModule);
testMe.complete('require(\'', common.mustCall((_, [modules]) => {
assert.strictEqual(data[0].length + 1, modules.length);
assert(modules.includes(newModule));
}));
}));
testMe.complete("require\t( 'n", common.mustCall(function(error, data) {
assert.strictEqual(error, null);
assert.strictEqual(data.length, 2);
assert.strictEqual(data[1], 'n');
// There is only one Node.js module that starts with n:
assert.strictEqual(data[0][0], 'net');
assert.strictEqual(data[0][1], '');
// It's possible to pick up non-core modules too
data[0].slice(2).forEach((completion) => {
assert.match(completion, /^n/);
});
}));
{
const expected = ['@nodejsscope', '@nodejsscope/'];
// Require calls should handle all types of quotation marks.
for (const quotationMark of ["'", '"', '`']) {
putIn.run(['.clear']);
testMe.complete('require(`@nodejs', common.mustCall((err, data) => {
assert.strictEqual(err, null);
assert.deepStrictEqual(data, [expected, '@nodejs']);
}));
putIn.run(['.clear']);
// Completions should not be greedy in case the quotation ends.
const input = `require(${quotationMark}@nodejsscope${quotationMark}`;
testMe.complete(input, common.mustCall((err, data) => {
assert.strictEqual(err, null);
assert.deepStrictEqual(data, [[], undefined]);
}));
}
}
{
putIn.run(['.clear']);
// Completions should find modules and handle whitespace after the opening
// bracket.
testMe.complete('require \t("no_ind', common.mustCall((err, data) => {
assert.strictEqual(err, null);
assert.deepStrictEqual(data, [['no_index', 'no_index/'], 'no_ind']);
}));
}
// Test tab completion for require() relative to the current directory
{
putIn.run(['.clear']);
const cwd = process.cwd();
process.chdir(__dirname);
['require(\'.', 'require(".'].forEach((input) => {
testMe.complete(input, common.mustCall((err, data) => {
assert.strictEqual(err, null);
assert.strictEqual(data.length, 2);
assert.strictEqual(data[1], '.');
assert.strictEqual(data[0].length, 2);
assert.ok(data[0].includes('./'));
assert.ok(data[0].includes('../'));
}));
});
['require(\'..', 'require("..'].forEach((input) => {
testMe.complete(input, common.mustCall((err, data) => {
assert.strictEqual(err, null);
assert.deepStrictEqual(data, [['../'], '..']);
}));
});
['./', './test-'].forEach((path) => {
[`require('${path}`, `require("${path}`].forEach((input) => {
testMe.complete(input, common.mustCall((err, data) => {
assert.strictEqual(err, null);
assert.strictEqual(data.length, 2);
assert.strictEqual(data[1], path);
assert.ok(data[0].includes('./test-repl-tab-complete'));
}));
});
});
['../parallel/', '../parallel/test-'].forEach((path) => {
[`require('${path}`, `require("${path}`].forEach((input) => {
testMe.complete(input, common.mustCall((err, data) => {
assert.strictEqual(err, null);
assert.strictEqual(data.length, 2);
assert.strictEqual(data[1], path);
assert.ok(data[0].includes('../parallel/test-repl-tab-complete'));
}));
});
});
{
const path = '../fixtures/repl-folder-extensions/f';
testMe.complete(`require('${path}`, common.mustCall((err, data) => {
assert.ifError(err);
assert.strictEqual(data.length, 2);
assert.strictEqual(data[1], path);
assert.ok(data[0].includes('../fixtures/repl-folder-extensions/foo.js'));
}));
}
process.chdir(cwd);
}
// Make sure tab completion works on context properties
putIn.run(['.clear']);
putIn.run([
'var custom = "test";'
]);
testMe.complete('cus', common.mustCall(function(error, data) {
assert.deepStrictEqual(data, [['custom'], 'cus']);
}));
// Make sure tab completion doesn't crash REPL with half-baked proxy objects.
// See: https://github.com/nodejs/node/issues/2119
putIn.run(['.clear']);
putIn.run([
'var proxy = new Proxy({}, {ownKeys: () => { throw new Error(); }});'
]);
testMe.complete('proxy.', common.mustCall(function(error, data) {
assert.strictEqual(error, null);
assert(Array.isArray(data));
}));
// Make sure tab completion does not include integer members of an Array
putIn.run(['.clear']);
putIn.run(['var ary = [1,2,3];']);
testMe.complete('ary.', common.mustCall(function(error, data) {
assert.strictEqual(data[0].includes('ary.0'), false);
assert.strictEqual(data[0].includes('ary.1'), false);
assert.strictEqual(data[0].includes('ary.2'), false);
}));
// Make sure tab completion does not include integer keys in an object
putIn.run(['.clear']);
putIn.run(['var obj = {1:"a","1a":"b",a:"b"};']);
testMe.complete('obj.', common.mustCall(function(error, data) {
assert.strictEqual(data[0].includes('obj.1'), false);
assert.strictEqual(data[0].includes('obj.1a'), false);
assert(data[0].includes('obj.a'));
}));
// Don't try to complete results of non-simple expressions
putIn.run(['.clear']);
putIn.run(['function a() {}']);
testMe.complete('a().b.', getNoResultsFunction());
// Works when prefixed with spaces
putIn.run(['.clear']);
putIn.run(['var obj = {1:"a","1a":"b",a:"b"};']);
testMe.complete(' obj.', common.mustCall((error, data) => {
assert.strictEqual(data[0].includes('obj.1'), false);
assert.strictEqual(data[0].includes('obj.1a'), false);
assert(data[0].includes('obj.a'));
}));
// Works inside assignments
putIn.run(['.clear']);
testMe.complete('var log = console.lo', common.mustCall((error, data) => {
assert.deepStrictEqual(data, [['console.log'], 'console.lo']);
}));
// Tab completion for defined commands
putIn.run(['.clear']);
testMe.complete('.b', common.mustCall((error, data) => {
assert.deepStrictEqual(data, [['break'], 'b']);
}));
putIn.run(['.clear']);
putIn.run(['var obj = {"hello, world!": "some string", "key": 123}']);
testMe.complete('obj.', common.mustCall((error, data) => {
assert.strictEqual(data[0].includes('obj.hello, world!'), false);
assert(data[0].includes('obj.key'));
}));
// Tab completion for files/directories
{
putIn.run(['.clear']);
process.chdir(__dirname);
const readFileSyncs = ['fs.readFileSync("', 'fs.promises.readFileSync("'];
if (!common.isWindows) {
readFileSyncs.forEach((readFileSync) => {
const fixturePath = `${readFileSync}../fixtures/test-repl-tab-completion`;
testMe.complete(fixturePath, common.mustCall((err, data) => {
assert.strictEqual(err, null);
assert.ok(data[0][0].includes('.hiddenfiles'));
assert.ok(data[0][1].includes('hellorandom.txt'));
assert.ok(data[0][2].includes('helloworld.js'));
}));
testMe.complete(`${fixturePath}/hello`,
common.mustCall((err, data) => {
assert.strictEqual(err, null);
assert.ok(data[0][0].includes('hellorandom.txt'));
assert.ok(data[0][1].includes('helloworld.js'));
})
);
testMe.complete(`${fixturePath}/.h`,
common.mustCall((err, data) => {
assert.strictEqual(err, null);
assert.ok(data[0][0].includes('.hiddenfiles'));
})
);
testMe.complete(`${readFileSync}./xxxRandom/random`,
common.mustCall((err, data) => {
assert.strictEqual(err, null);
assert.strictEqual(data[0].length, 0);
})
);
const testPath = fixturePath.slice(0, -1);
testMe.complete(testPath, common.mustCall((err, data) => {
assert.strictEqual(err, null);
assert.ok(data[0][0].includes('test-repl-tab-completion'));
assert.strictEqual(
data[1],
path.basename(testPath)
);
}));
});
}
}
[
Array,
Buffer,
Uint8Array,
Uint16Array,
Uint32Array,
Uint8ClampedArray,
Int8Array,
Int16Array,
Int32Array,
Float32Array,
Float64Array,
].forEach((type) => {
putIn.run(['.clear']);
if (type === Array) {
putIn.run([
'var ele = [];',
'for (let i = 0; i < 1e6 + 1; i++) ele[i] = 0;',
'ele.biu = 1;'
]);
} else if (type === Buffer) {
putIn.run(['var ele = Buffer.alloc(1e6 + 1); ele.biu = 1;']);
} else {
putIn.run([`var ele = new ${type.name}(1e6 + 1); ele.biu = 1;`]);
}
hijackStderr(common.mustNotCall());
testMe.complete('ele.', common.mustCall((err, data) => {
restoreStderr();
assert.ifError(err);
const ele = (type === Array) ?
[] :
(type === Buffer ?
Buffer.alloc(0) :
new type(0));
assert.strictEqual(data[0].includes('ele.biu'), true);
data[0].forEach((key) => {
if (!key || key === 'ele.biu') return;
assert.notStrictEqual(ele[key.substr(4)], undefined);
});
}));
});
// check Buffer.prototype.length not crashing.
// Refs: https://github.com/nodejs/node/pull/11961
putIn.run['.clear'];
testMe.complete('Buffer.prototype.', common.mustCall());
const testNonGlobal = repl.start({
input: putIn,
output: putIn,
useGlobal: false
});
const builtins = [['Infinity', 'Int16Array', 'Int32Array',
'Int8Array'], 'I'];
if (common.hasIntl) {
builtins[0].push('Intl');
}
testNonGlobal.complete('I', common.mustCall((error, data) => {
assert.deepStrictEqual(data, builtins);
}));
// To test custom completer function.
// Sync mode.
const customCompletions = 'aaa aa1 aa2 bbb bb1 bb2 bb3 ccc ddd eee'.split(' ');
const testCustomCompleterSyncMode = repl.start({
prompt: '',
input: putIn,
output: putIn,
completer: function completer(line) {
const hits = customCompletions.filter((c) => c.startsWith(line));
// Show all completions if none found.
return [hits.length ? hits : customCompletions, line];
}
});
// On empty line should output all the custom completions
// without complete anything.
testCustomCompleterSyncMode.complete('', common.mustCall((error, data) => {
assert.deepStrictEqual(data, [
customCompletions,
''
]);
}));
// On `a` should output `aaa aa1 aa2` and complete until `aa`.
testCustomCompleterSyncMode.complete('a', common.mustCall((error, data) => {
assert.deepStrictEqual(data, [
'aaa aa1 aa2'.split(' '),
'a'
]);
}));
// To test custom completer function.
// Async mode.
const testCustomCompleterAsyncMode = repl.start({
prompt: '',
input: putIn,
output: putIn,
completer: function completer(line, callback) {
const hits = customCompletions.filter((c) => c.startsWith(line));
// Show all completions if none found.
callback(null, [hits.length ? hits : customCompletions, line]);
}
});
// On empty line should output all the custom completions
// without complete anything.
testCustomCompleterAsyncMode.complete('', common.mustCall((error, data) => {
assert.deepStrictEqual(data, [
customCompletions,
''
]);
}));
// On `a` should output `aaa aa1 aa2` and complete until `aa`.
testCustomCompleterAsyncMode.complete('a', common.mustCall((error, data) => {
assert.deepStrictEqual(data, [
'aaa aa1 aa2'.split(' '),
'a'
]);
}));
// Tab completion in editor mode
const editorStream = new ArrayStream();
const editor = repl.start({
stream: editorStream,
terminal: true,
useColors: false
});
editorStream.run(['.clear']);
editorStream.run(['.editor']);
editor.completer('Uin', common.mustCall((error, data) => {
assert.deepStrictEqual(data, [['Uint'], 'Uin']);
}));
editorStream.run(['.clear']);
editorStream.run(['.editor']);
editor.completer('var log = console.l', common.mustCall((error, data) => {
assert.deepStrictEqual(data, [['console.log'], 'console.l']);
}));
{
// Tab completion of lexically scoped variables
const stream = new ArrayStream();
const testRepl = repl.start({ stream });
stream.run([`
let lexicalLet = true;
const lexicalConst = true;
class lexicalKlass {}
`]);
['Let', 'Const', 'Klass'].forEach((type) => {
const query = `lexical${type[0]}`;
const expected = hasInspector ? [[`lexical${type}`], query] :
[[], `lexical${type[0]}`];
testRepl.complete(query, common.mustCall((error, data) => {
assert.deepStrictEqual(data, expected);
}));
});
}
| mit |
awmartin/spatialpixel | Sketches/README.md | 53 | # Sketches
Contains sample code from Spatial Pixel.
| mit |
ParkDyel/practice | WebDev/FE/JS/Reactjs/PRWF/src/index.js | 599 | import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, Link, browserHistory } from 'react-router';
import App from './App';
import NotFound from './Pages/NotFound/NotFound';
import Users from './Pages/Users/Users';
import Chats from './Pages/Chats/Chats';
import './index.css';
ReactDOM.render(
<Router history={browserHistory}>
<Route path="/" component={App}>
<Route path="users" component={Users}/>
<Route path="chats" component={Chats}/>
</Route>
<Route path="*" component={NotFound}/>
</Router>,
document.getElementById('root'));
| mit |
abstractive/celluloid-smtp | lib/celluloid/smtp.rb | 784 | require 'celluloid/current'
require 'celluloid/io'
module Celluloid
module SMTP
require 'celluloid/smtp/constants'
require 'celluloid/smtp/logging'
require 'celluloid/smtp/version'
require 'celluloid/smtp/extensions'
class Server
include SMTP::Extensions
require 'celluloid/smtp/server'
require 'celluloid/smtp/server/protector'
require 'celluloid/smtp/server/handler'
require 'celluloid/smtp/server/transporter'
end
class Connection
include SMTP::Extensions
require 'celluloid/smtp/connection/errors'
require 'celluloid/smtp/connection/events'
require 'celluloid/smtp/connection/parser'
require 'celluloid/smtp/connection/automata'
require 'celluloid/smtp/connection'
end
end
end
| mit |
Gincusoft/aksi | application/modules/messaging/views/outbox/detail.php | 5440 | <div class="col-md-6 col-md-offset-3">
<div class="box box-success direct-chat direct-chat-success">
<div class="box-header with-border">
<h1 class="box-title"><i class="fa fa-file-text-o"></i> <?php echo $title; ?></h1>
<div class="pull-right">
<i class="fa fa-close" onclick="closeModal()"></i>
</div>
</div>
<form id="ff" class="">
<input type="hidden" name="dest_number" value="<?php echo $title; ?>">
<div class="box-body">
<div class="direct-chat-messages" style="height: 400px; overflow-x: hidden; word-break: break-all">
<?php
$udh = '';
$sms_type = 1;
$i=0;
$img = base_url('assets/images/employee/male.png');
foreach ($sms as $value) {
if ($value->udh != '' && $value->sms_type == $sms_type && $value->udh == $udh) {
echo "<script>$('#msg-{$i}').append('{$value->sms_text}');</script>";
} else {
$i++;
if ($value->sms_type == 3) { // inbox
echo "
<div class='direct-chat-msg col-md-11'>
<div class='direct-chat-info clearfix'>
<span class='direct-chat-name pull-left'>{$value->sender_id}</span>
<span class='direct-chat-timestamp pull-right'>{$value->sms_date} <i class='fa fa-arrow-circle-down'></i></span>
</div>
<img class='direct-chat-img' src='{$img}' alt='message user image'>
<div class='direct-chat-text' id='msg-{$i}'>
{$value->sms_text}
</div>
</div>
";
} else { //outbox & sentitems
if ($value->sms_type == 1) {
$status = 'fa fa-clock-o';
} else if ($value->sms_type == 2) {
if (strripos($value->status, 'SendingOk') !== FALSE) {
$status = 'fa fa-check-circle';
} else {
$status = 'fa fa-exclamation-circle';
}
}
echo "
<div class='direct-chat-msg col-md-11 right pull-right'>
<div class='direct-chat-info clearfix'>
<span class='direct-chat-name pull-right'>{$value->sender_id}</span>
<span class='direct-chat-timestamp pull-left'>{$value->sms_date} <i class='{$status}'></i></span>
</div>
<img class='direct-chat-img' src='{$img}' alt='message user image'>
<div class='direct-chat-text text-right' id='msg-{$i}'>
{$value->sms_text}
</div>
</div>
";
}
}
$sms_type = $value->sms_type;
$udh = $value->udh;
}
?>
</div>
</div>
<div class="box-footer text-right">
<div class="col-md-1 form-control-static" id="char-count">
</div>
<div class="col-md-11">
<div class="input-group input-group-">
<input name="sms_text" id="sms_text" type="text" class="form-control" autofocus="" required="" autocomplete="off">
<span class="input-group-btn">
<button class="btn btn-success" id="save_btn" type="submit" data-loading-text="<i class='fa fa-refresh fa-spin'></i> Mengirim..."><i class="fa fa-send"></i> Kirim</button>
</span>
</div>
</div>
</div>
</form>
</div>
</div>
<script>
$(document).ready(function() {
$('#sms_text').keyup(function() {
var smsText = $(this).val();
$('#char-count').html(smsText.length);
console.log(smsText);
});
autoScroll();
$('#ff').submit(function(e) {
e.preventDefault();
var btn = $('#save_btn');
$.ajax({
url: '<?php echo base_url('messaging/inbox/sending'); ?>',
type: 'post',
data: $('#ff').serialize(),
dataType: 'json',
beforeSend: function() {
btn.button('loading');
},
success: function(data) {
var img = '<?php echo base_url('assets/images/employee/male.png'); ?>';
var html = '<div class="direct-chat-msg right col-md-11 pull-right">\n\
<div class="direct-chat-info clearfix">\n\
<span class="direct-chat-name pull-right">' + data.sender_id + '</span>\n\
<span class="direct-chat-timestamp pull-left">' + data.sms_date + ' <i class="fa fa-clock-o"></i></span>\n\
</div>\n\
<img class="direct-chat-img" src="'+img+'" alt="message user image">\n\
<div class="direct-chat-text text-right">\n\
' + data.sms_text + '\n\
</div>\n\
</div>';
$('.direct-chat-messages').append(html);
autoScroll();
$('#sms_text').val('');
},
complete: function() {
btn.button('reset');
reloadTable('dataTable');
$('#char-count').html(0);
}
});
});
});
function autoScroll() {
$('.direct-chat-messages').scrollTop($('.direct-chat-messages')[0].scrollHeight);
}
</script> | mit |
NTUTVisualScript/Visual_Script | static/javascript/blockly/core/events.js | 11197 | /**
* @license
* Visual Blocks Editor
*
* Copyright 2016 Google Inc.
* https://developers.google.com/blockly/
*
* 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.
*/
/**
* @fileoverview Events fired as a result of actions in Blockly's editor.
* @author [email protected] (Neil Fraser)
*/
'use strict';
/**
* Events fired as a result of actions in Blockly's editor.
* @namespace Blockly.Events
*/
goog.provide('Blockly.Events');
goog.require('Blockly.utils');
/**
* Group ID for new events. Grouped events are indivisible.
* @type {string}
* @private
*/
Blockly.Events.group_ = '';
/**
* Sets whether the next event should be added to the undo stack.
* @type {boolean}
*/
Blockly.Events.recordUndo = true;
/**
* Allow change events to be created and fired.
* @type {number}
* @private
*/
Blockly.Events.disabled_ = 0;
/**
* Name of event that creates a block. Will be deprecated for BLOCK_CREATE.
* @const
*/
Blockly.Events.CREATE = 'create';
/**
* Name of event that creates a block.
* @const
*/
Blockly.Events.BLOCK_CREATE = Blockly.Events.CREATE;
/**
* Name of event that deletes a block. Will be deprecated for BLOCK_DELETE.
* @const
*/
Blockly.Events.DELETE = 'delete';
/**
* Name of event that deletes a block.
* @const
*/
Blockly.Events.BLOCK_DELETE = Blockly.Events.DELETE;
/**
* Name of event that changes a block. Will be deprecated for BLOCK_CHANGE.
* @const
*/
Blockly.Events.CHANGE = 'change';
/**
* Name of event that changes a block.
* @const
*/
Blockly.Events.BLOCK_CHANGE = Blockly.Events.CHANGE;
/**
* Name of event that moves a block. Will be deprecated for BLOCK_MOVE.
* @const
*/
Blockly.Events.MOVE = 'move';
/**
* Name of event that moves a block.
* @const
*/
Blockly.Events.BLOCK_MOVE = Blockly.Events.MOVE;
/**
* Name of event that creates a variable.
* @const
*/
Blockly.Events.VAR_CREATE = 'var_create';
/**
* Name of event that deletes a variable.
* @const
*/
Blockly.Events.VAR_DELETE = 'var_delete';
/**
* Name of event that renames a variable.
* @const
*/
Blockly.Events.VAR_RENAME = 'var_rename';
/**
* Name of event that records a UI change.
* @const
*/
Blockly.Events.UI = 'ui';
/**
* Name of event that creates a comment.
* @const
*/
Blockly.Events.COMMENT_CREATE = 'comment_create';
/**
* Name of event that deletes a comment.
* @const
*/
Blockly.Events.COMMENT_DELETE = 'comment_delete';
/**
* Name of event that changes a comment.
* @const
*/
Blockly.Events.COMMENT_CHANGE = 'comment_change';
/**
* Name of event that moves a comment.
* @const
*/
Blockly.Events.COMMENT_MOVE = 'comment_move';
/**
* List of events queued for firing.
* @private
*/
Blockly.Events.FIRE_QUEUE_ = [];
/**
* Create a custom event and fire it.
* @param {!Blockly.Events.Abstract} event Custom data for event.
*/
Blockly.Events.fire = function(event) {
if (!Blockly.Events.isEnabled()) {
return;
}
if (!Blockly.Events.FIRE_QUEUE_.length) {
// First event added; schedule a firing of the event queue.
setTimeout(Blockly.Events.fireNow_, 0);
}
Blockly.Events.FIRE_QUEUE_.push(event);
};
/**
* Fire all queued events.
* @private
*/
Blockly.Events.fireNow_ = function() {
var queue = Blockly.Events.filter(Blockly.Events.FIRE_QUEUE_, true);
Blockly.Events.FIRE_QUEUE_.length = 0;
for (var i = 0, event; event = queue[i]; i++) {
var workspace = Blockly.Workspace.getById(event.workspaceId);
if (workspace) {
workspace.fireChangeListener(event);
}
}
};
/**
* Filter the queued events and merge duplicates.
* @param {!Array.<!Blockly.Events.Abstract>} queueIn Array of events.
* @param {boolean} forward True if forward (redo), false if backward (undo).
* @return {!Array.<!Blockly.Events.Abstract>} Array of filtered events.
*/
Blockly.Events.filter = function(queueIn, forward) {
var queue = queueIn.slice(); // Shallow copy of queue.
if (!forward) {
// Undo is merged in reverse order.
queue.reverse();
}
var mergedQueue = [];
var hash = Object.create(null);
// Merge duplicates.
for (var i = 0, event; event = queue[i]; i++) {
if (!event.isNull()) {
var key = [event.type, event.blockId, event.workspaceId].join(' ');
var lastEntry = hash[key];
var lastEvent = lastEntry ? lastEntry.event : null;
if (!lastEntry) {
// Each item in the hash table has the event and the index of that event
// in the input array. This lets us make sure we only merge adjacent
// move events.
hash[key] = { event: event, index: i};
mergedQueue.push(event);
} else if (event.type == Blockly.Events.MOVE &&
lastEntry.index == i - 1) {
// Merge move events.
lastEvent.newParentId = event.newParentId;
lastEvent.newInputName = event.newInputName;
lastEvent.newCoordinate = event.newCoordinate;
lastEntry.index = i;
} else if (event.type == Blockly.Events.CHANGE &&
event.element == lastEvent.element &&
event.name == lastEvent.name) {
// Merge change events.
lastEvent.newValue = event.newValue;
} else if (event.type == Blockly.Events.UI &&
event.element == 'click' &&
(lastEvent.element == 'commentOpen' ||
lastEvent.element == 'mutatorOpen' ||
lastEvent.element == 'warningOpen')) {
// Merge click events.
lastEvent.newValue = event.newValue;
} else {
// Collision: newer events should merge into this event to maintain order
hash[key] = { event: event, index: 1};
mergedQueue.push(event);
}
}
}
// Filter out any events that have become null due to merging.
queue = mergedQueue.filter(function(e) { return !e.isNull(); });
if (!forward) {
// Restore undo order.
queue.reverse();
}
// Move mutation events to the top of the queue.
// Intentionally skip first event.
for (var i = 1, event; event = queue[i]; i++) {
if (event.type == Blockly.Events.CHANGE &&
event.element == 'mutation') {
queue.unshift(queue.splice(i, 1)[0]);
}
}
return queue;
};
/**
* Modify pending undo events so that when they are fired they don't land
* in the undo stack. Called by Blockly.Workspace.clearUndo.
*/
Blockly.Events.clearPendingUndo = function() {
for (var i = 0, event; event = Blockly.Events.FIRE_QUEUE_[i]; i++) {
event.recordUndo = false;
}
};
/**
* Stop sending events. Every call to this function MUST also call enable.
*/
Blockly.Events.disable = function() {
Blockly.Events.disabled_++;
};
/**
* Start sending events. Unless events were already disabled when the
* corresponding call to disable was made.
*/
Blockly.Events.enable = function() {
Blockly.Events.disabled_--;
};
/**
* Returns whether events may be fired or not.
* @return {boolean} True if enabled.
*/
Blockly.Events.isEnabled = function() {
return Blockly.Events.disabled_ == 0;
};
/**
* Current group.
* @return {string} ID string.
*/
Blockly.Events.getGroup = function() {
return Blockly.Events.group_;
};
/**
* Start or stop a group.
* @param {boolean|string} state True to start new group, false to end group.
* String to set group explicitly.
*/
Blockly.Events.setGroup = function(state) {
if (typeof state == 'boolean') {
Blockly.Events.group_ = state ? Blockly.utils.genUid() : '';
} else {
Blockly.Events.group_ = state;
}
};
/**
* Compute a list of the IDs of the specified block and all its descendants.
* @param {!Blockly.Block} block The root block.
* @return {!Array.<string>} List of block IDs.
* @private
*/
Blockly.Events.getDescendantIds_ = function(block) {
var ids = [];
var descendants = block.getDescendants(false);
for (var i = 0, descendant; descendant = descendants[i]; i++) {
ids[i] = descendant.id;
}
return ids;
};
/**
* Decode the JSON into an event.
* @param {!Object} json JSON representation.
* @param {!Blockly.Workspace} workspace Target workspace for event.
* @return {!Blockly.Events.Abstract} The event represented by the JSON.
*/
Blockly.Events.fromJson = function(json, workspace) {
// TODO: Should I have a way to register a new event into here?
var event;
switch (json.type) {
case Blockly.Events.CREATE:
event = new Blockly.Events.Create(null);
break;
case Blockly.Events.DELETE:
event = new Blockly.Events.Delete(null);
break;
case Blockly.Events.CHANGE:
event = new Blockly.Events.Change(null, '', '', '', '');
break;
case Blockly.Events.MOVE:
event = new Blockly.Events.Move(null);
break;
case Blockly.Events.VAR_CREATE:
event = new Blockly.Events.VarCreate(null);
break;
case Blockly.Events.VAR_DELETE:
event = new Blockly.Events.VarDelete(null);
break;
case Blockly.Events.VAR_RENAME:
event = new Blockly.Events.VarRename(null, '');
break;
case Blockly.Events.UI:
event = new Blockly.Events.Ui(null);
break;
case Blockly.Events.COMMENT_CREATE:
event = new Blockly.Events.CommentCreate(null);
break;
case Blockly.Events.COMMENT_CHANGE:
event = new Blockly.Events.CommentChange(null);
break;
case Blockly.Events.COMMENT_MOVE:
event = new Blockly.Events.CommentMove(null);
break;
case Blockly.Events.COMMENT_DELETE:
event = new Blockly.Events.CommentDelete(null);
break;
default:
throw Error('Unknown event type.');
}
event.fromJson(json);
event.workspaceId = workspace.id;
return event;
};
/**
* Enable/disable a block depending on whether it is properly connected.
* Use this on applications where all blocks should be connected to a top block.
* Recommend setting the 'disable' option to 'false' in the config so that
* users don't try to reenable disabled orphan blocks.
* @param {!Blockly.Events.Abstract} event Custom data for event.
*/
Blockly.Events.disableOrphans = function(event) {
if (event.type == Blockly.Events.MOVE ||
event.type == Blockly.Events.CREATE) {
var workspace = Blockly.Workspace.getById(event.workspaceId);
var block = workspace.getBlockById(event.blockId);
if (block) {
if (block.getParent() && !block.getParent().disabled) {
var children = block.getDescendants(false);
for (var i = 0, child; child = children[i]; i++) {
child.setDisabled(false);
}
} else if ((block.outputConnection || block.previousConnection) &&
!workspace.isDragging()) {
do {
block.setDisabled(true);
block = block.getNextBlock();
} while (block);
}
}
}
};
| mit |
AltisourceLabs/ecloudmanager | tmrk-cloudapi/src/main/java/org/ecloudmanager/tmrk/cloudapi/model/ArrayOfInternetServiceType.java | 2395 | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911
// .1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.07.16 at 03:24:22 PM EEST
//
package org.ecloudmanager.tmrk.cloudapi.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for ArrayOfInternetServiceType complex type.
* <p/>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p/>
* <pre>
* <complexType name="ArrayOfInternetServiceType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="InternetService" type="{}InternetServiceType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfInternetServiceType", propOrder = {
"internetService"
})
public class ArrayOfInternetServiceType {
@XmlElement(name = "InternetService", nillable = true)
protected List<InternetServiceType> internetService;
/**
* Gets the value of the internetService property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the internetService property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getInternetService().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link InternetServiceType }
*/
public List<InternetServiceType> getInternetService() {
if (internetService == null) {
internetService = new ArrayList<InternetServiceType>();
}
return this.internetService;
}
}
| mit |
QuattroResearch/HELMMonomerService | test-output/old/Default suite/methods.html | 834 | <h2>Methods run, sorted chronologically</h2><h3>>> means before, << means after</h3><p/><br/><em>Default suite</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
<table border="1">
<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr>
<tr bgcolor="c26598"> <td>18/07/12 17:38:05</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="MonomerLibrarySQLiteTest.testSymbolInDatabase()[pri:0, instance:org.helm.monomerservice.MonomerLibrarySQLiteTest@57536d79]">testSymbolInDatabase</td>
<td>main@513169028</td> <td></td> </tr>
</table>
| mit |
eronde/vim_suggest | tests/test_utils.py | 9992 | from py_word_suggest.utils import *
import pytest
raw_json = """
{"lang:nl:0:ben":[["ik", 22.0], ["er", 8.0], ["een", 7.0], ["je", 5.0]],"lang:nl:0:Ik":[["heb", 66.0], ["ben", 52.0], ["denk", 15.0], [
"wil", 13.0], ["acht", 1.0]],"lang:eng:0:I":[["am", 100], ["want", 246], ["love", 999]],"lang:eng:0:am":[["the",100], ["Alice", 50],["Bob", 45]]}
"""
invalid_json = """
test
"""
@pytest.fixture(scope="session")
def invalid_json_file(tmpdir_factory):
fn = tmpdir_factory.mktemp("data_tmp").join("test_invalid.json")
fn.write(invalid_json)
invalid_json_fn = fn
return fn
@pytest.fixture(scope="session")
def raw_json_file(tmpdir_factory):
f = tmpdir_factory.mktemp("data_tmp").join("test.json")
f.write(raw_json)
return f
def setUp(invalid_json_file):
invalid_json_file
@pytest.mark.parametrize("testInput, expectedOutput, state",
[
(b'{"lang:nl:0:Ik":[["heb", 66.0], ["ben", 52.0], ["denk", 15.0], ["wil", 13.0], ["acht", 1.0]]}', {
'lang:nl:0:Ik': [['heb', 66.0], ['ben', 52.0], ['denk', 15.0], ['wil', 13.0], ['acht', 1.0]]}, 'normalState'),
('{"lang:nl:0:Ik":[["heb", 66.0], ["ben", 52.0], ["denk", 15.0], ["wil", 13.0], ["acht", 1.0]]}', {
'lang:nl:0:Ik': [['heb', 66.0], ['ben', 52.0], ['denk', 15.0], ['wil', 13.0], ['acht', 1.0]]}, 'normalState'),
('"lang:nl"', "Error load_json_string, jsonString, '\"lang:nl\"' needs to be a string represetation of a json object, jsonString needs to be set between braces. A str item needs to be set between double quotes.", 'errorState'),
(b'"lang:nl"', "Error load_json_string, jsonString, 'b'\"lang:nl\"'' needs to be a string represetation of a json object, jsonString needs to be set between braces. A str item needs to be set between double quotes.", 'errorState'),
(b'\'lang\':0"', "Error load_json_string, jsonString, 'b'\\'lang\\':0\"'' needs to be a string represetation of a json object, jsonString needs to be set between braces. A str item needs to be set between double quotes.", 'errorState'),
(0, "Error load_json_string, jsonString, '0' needs to be a string represetation of a json object, jsonString needs to be set between braces. A str item needs to be set between double quotes.", 'errorState'),
]
)
def test_load_json_from_string(testInput, expectedOutput, state):
"""utils, Json from string"""
# Test normal behavior
if state == 'normalState':
assert load_json_string(testInput) == expectedOutput
# Test expect error
if state == 'errorState':
with pytest.raises(utilsError) as e:
load_json_string(testInput)
assert str(e.value) == expectedOutput
@pytest.mark.parametrize("testInput, expectedOutput, state",
[
('\"lang:nl:0:Ik\"', {"lang:nl:0:Ik": [["heb", 66.0], ["ben", 52.0], [
"denk", 15.0], ["wil", 13.0], ["acht", 1.0]]}, 'normalState'),
('\"lang:nl:0:Ik', "Error, grep_jsonstring_from_system: '\"lang:nl:0:Ik' needs to be a str type and need to be between double quotes.", 'errorState'),
('lang:nl:0:Ik\"', "Error, grep_jsonstring_from_system: 'lang:nl:0:Ik\"' needs to be a str type and need to be between double quotes.", 'errorState'),
('lang:nl:0:Ik', "Error, grep_jsonstring_from_system: 'lang:nl:0:Ik' needs to be a str type and need to be between double quotes.", 'errorState'),
(0, "Error, grep_jsonstring_from_system: '0' needs to be a str type and need to be between double quotes.", 'errorState'),
('\"NoKeyFound\"', False, 'normalState'),
('\"NO-MATCH\"', False, 'normalState'),
('\"NOEXISTINGFILE\"', "Error, grep_jsonstring_from_system: File NOEXISTINGFILE not exists or is busy.", 'fileError'),
# ('lang:nl:0:Ik' ,b'"lang:nl:0:Ik":[["heb", 66.0], ["ben", 52.0], ["denk", 15.0], ["wil", 13.0], ["acht", 1.0]]','":.*]]','defaultArguments'),
]
)
def test_grep_jsonstring_from_system(raw_json_file, testInput, expectedOutput, state):
"""utils, Grep bigram from file with system jq util"""
# Test default argument
if state == 'fileError':
raw_json_file = 'NOEXISTINGFILE'
with pytest.raises(utilsError) as e:
grep_jsonstring_from_system(testInput, raw_json_file)
assert str(e.value) == expectedOutput
# Test normal behavior
if state == 'normalState':
assert grep_jsonstring_from_system(
testInput, raw_json_file) == expectedOutput
# Test expect error
if state == 'errorState':
# pudb.set_trace()
with pytest.raises(utilsError) as e:
grep_jsonstring_from_system(testInput, raw_json_file)
# pudb.set_trace()
assert str(e.value) == expectedOutput
@pytest.mark.parametrize("testInput,expected_output",
[
('', True),
(None, True),
('NonWwhiteSpaces', False),
('String with white-space', True),
(10, False)
]
)
def test_is_empty(testInput, expected_output):
"""utils, is_empty: Check if an object is empty or contains spaces"""
assert is_empty(testInput) == expected_output
@pytest.mark.parametrize("testInput,expectedOutput",
[
("String", True),
(['lol,lol2'], True),
(('lol', 'lol2'), True),
({'lol', 'lol2'}, True),
(10, False),
(None, False)
]
)
def test_is_iterable(testInput, expectedOutput):
"""utils, is_iterable Check if an object is iterable"""
assert is_iterable(testInput) == expectedOutput
@pytest.mark.parametrize("testInput, collection, expectedOutput, errorState",
[
('Love', ['I', 'Love', 'python'], True, False),
('love', ['I', 'Love', 'python'], False, False),
('', ['I', 'Love', 'python'], False, False),
(None, ['I', 'Love', 'python'], False, False),
(None, "String",
"Error: collection is not iterable or is a string", True),
('Love', 8, "Error: collection is not iterable or is a string", True), (
'Love', None, "Error: collection is not iterable or is a string", True),
]
)
def test_containing(testInput, collection, expectedOutput, errorState):
"""utils: Check if collection contains an item"""
if errorState is False:
assert containing(collection, testInput) == expectedOutput
else:
with pytest.raises(utilsError) as e:
containing(collection, testInput)
assert str(e.value) == expectedOutput
@pytest.mark.parametrize("testInput, expectedOutput, state",
[
(None, {"lang:nl:0:ben": [["ik", 22.0], ["er", 8.0], ["een", 7.0], ["je", 5.0]], "lang:nl:0:Ik":[["heb", 66.0], ["ben", 52.0], ["denk", 15.0], [
"wil", 13.0], ["acht", 1.0]], "lang:eng:0:I":[["am", 100], ["want", 246], ["love", 999]], "lang:eng:0:am":[["the", 100], ["Alice", 50], ["Bob", 45]]}, 'normalState'),
(None, "Error, load_data_from_json: \'NOEXISTINGFILE\' does not exists.",
'noFileExistState'),
(None, "Error, load_data_from_json: '{}' needs to be a json object.",
'invalidJsonState'),
(None, "Error, load_data_from_json: Function recuires a filename (str).",
'ValueErrorState'),
(13458, "Error, load_data_from_json: Function recuires a filename (str).",
'ValueErrorState'),
(True, "Error, load_data_from_json: Function recuires a filename (str).",
'ValueErrorState'),
(False, "Error, load_data_from_json: Function recuires a filename (str).",
'ValueErrorState'),
]
)
def test_load_json_from_file(raw_json_file, invalid_json_file, testInput, expectedOutput, state):
"""utils, load json data from file"""
# Test default argument
# Test normal behavior
if state == 'normalState':
assert load_data_from_json(str(raw_json_file)) == expectedOutput
# Test noFileExistState
if state == 'noFileExistState':
raw_json_file = 'NOEXISTINGFILE'
with pytest.raises(FileNotFoundError) as e:
load_data_from_json(raw_json_file)
assert str(e.value) == expectedOutput
# Test invalid_json_file error
if state == 'invalidJsonState':
with pytest.raises(utilsError) as e:
load_data_from_json(str(invalid_json_file))
assert str(e.value) == expectedOutput.format(str(invalid_json_file))
# Test noFileExistState
if state == 'ValueErrorState':
with pytest.raises(ValueError) as e:
load_data_from_json(testInput)
assert str(e.value) == expectedOutput
| mit |
kombatcoin/KAP | src/qt/locale/bitcoin_ar.ts | 97707 | <?xml version="1.0" ?><!DOCTYPE TS><TS language="ar" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About KappaCoin</source>
<translation>عن KappaCoin</translation>
</message>
<message>
<location line="+39"/>
<source><b>KappaCoin</b> version</source>
<translation>نسخة <b>KappaCoin</b></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 ([email protected]) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The KappaCoin developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>دفتر العناوين</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>أنقر على الماوس مرتين لتعديل عنوان</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>قم بعمل عنوان جديد</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>قم بنسخ القوانين المختارة لحافظة النظام</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your KappaCoin 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 type="unfinished"/>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a KappaCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</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 KappaCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&أمسح</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your KappaCoin 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 type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR KAPPACOINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-56"/>
<source>KappaCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your kappacoins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Show information about KappaCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation type="unfinished"/>
</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 KappaCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for KappaCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>KappaCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation type="unfinished"/>
</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 KappaCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation type="unfinished"/>
</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 KappaCoin 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 KappaCoin addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>KappaCoin client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to KappaCoin network</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></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><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><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><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 type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid KappaCoin 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 type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. KappaCoin 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 type="unfinished"/>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid KappaCoin address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>KappaCoin-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start KappaCoin after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start KappaCoin on system login</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Automatically open the KappaCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Connect to the KappaCoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting KappaCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Whether to show KappaCoin addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting KappaCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the KappaCoin 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 type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</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 kappacoin: 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 type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the KappaCoin-Qt help message to get a list with possible KappaCoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-104"/>
<source>KappaCoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>KappaCoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Open the KappaCoin 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 type="unfinished"/>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the KappaCoin 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 type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</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 type="unfinished"/>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a KappaCoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</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. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation type="unfinished"/>
</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 KappaCoin address</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</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. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified KappaCoin address</source>
<translation type="unfinished"/>
</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 KappaCoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Enter KappaCoin signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The KappaCoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation type="unfinished"/>
</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><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 type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</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>KappaCoin version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or kappacoind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: kappacoin.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: kappacoind.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation type="unfinished"/>
</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: 9333 or testnet: 19333)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation type="unfinished"/>
</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: 9332 or testnet: 19332)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation type="unfinished"/>
</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=kappacoinrpc
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 "KappaCoin Alert" [email protected]
</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. KappaCoin 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 type="unfinished"/>
</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 KappaCoin will not work properly.</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</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 type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the KappaCoin Wiki for SSL setup instructions)</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of KappaCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart KappaCoin to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. KappaCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation type="unfinished"/>
</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 type="unfinished"/>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation type="unfinished"/>
</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> | mit |
lixiaoyan/x-view | tags/raw.js | 279 | var x = require("x-view");
var Raw = x.createClass({
propTypes: {
html: x.type.string
},
init: function() {
x.event.on(this, "updated", this.updateHTML);
},
updateHTML: function() {
this.root.innerHTML = this.props.html;
}
});
x.register("x-raw", Raw);
| mit |
albertp007/mathnet-numerics | src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs | 60593 | // <copyright file="SparseMatrix.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2013 Math.NET
//
// 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.
// </copyright>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using MathNet.Numerics.LinearAlgebra.Storage;
namespace MathNet.Numerics.LinearAlgebra.Complex
{
#if NOSYSNUMERICS
using Numerics;
#else
using System.Numerics;
#endif
/// <summary>
/// A Matrix with sparse storage, intended for very large matrices where most of the cells are zero.
/// The underlying storage scheme is 3-array compressed-sparse-row (CSR) Format.
/// <a href="http://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_.28CSR_or_CRS.29">Wikipedia - CSR</a>.
/// </summary>
[Serializable]
[DebuggerDisplay("SparseMatrix {RowCount}x{ColumnCount}-Complex {NonZerosCount}-NonZero")]
public class SparseMatrix : Matrix
{
readonly SparseCompressedRowMatrixStorage<Complex> _storage;
/// <summary>
/// Gets the number of non zero elements in the matrix.
/// </summary>
/// <value>The number of non zero elements.</value>
public int NonZerosCount
{
get { return _storage.ValueCount; }
}
/// <summary>
/// Create a new sparse matrix straight from an initialized matrix storage instance.
/// The storage is used directly without copying.
/// Intended for advanced scenarios where you're working directly with
/// storage for performance or interop reasons.
/// </summary>
public SparseMatrix(SparseCompressedRowMatrixStorage<Complex> storage)
: base(storage)
{
_storage = storage;
}
/// <summary>
/// Create a new square sparse matrix with the given number of rows and columns.
/// All cells of the matrix will be initialized to zero.
/// Zero-length matrices are not supported.
/// </summary>
/// <exception cref="ArgumentException">If the order is less than one.</exception>
public SparseMatrix(int order)
: this(order, order)
{
}
/// <summary>
/// Create a new sparse matrix with the given number of rows and columns.
/// All cells of the matrix will be initialized to zero.
/// Zero-length matrices are not supported.
/// </summary>
/// <exception cref="ArgumentException">If the row or column count is less than one.</exception>
public SparseMatrix(int rows, int columns)
: this(new SparseCompressedRowMatrixStorage<Complex>(rows, columns))
{
}
/// <summary>
/// Create a new sparse matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfMatrix(Matrix<Complex> matrix)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfMatrix(matrix.Storage));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfArray(Complex[,] array)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfArray(array));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given indexed enumerable.
/// Keys must be provided at most once, zero is assumed if a key is omitted.
/// This new matrix will be independent from the enumerable.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfIndexed(int rows, int columns, IEnumerable<Tuple<int, int, Complex>> enumerable)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfIndexedEnumerable(rows, columns, enumerable));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given enumerable.
/// The enumerable is assumed to be in row-major order (row by row).
/// This new matrix will be independent from the enumerable.
/// A new memory block will be allocated for storing the vector.
/// </summary>
/// <seealso href="http://en.wikipedia.org/wiki/Row-major_order"/>
public static SparseMatrix OfRowMajor(int rows, int columns, IEnumerable<Complex> rowMajor)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfRowMajorEnumerable(rows, columns, rowMajor));
}
/// <summary>
/// Create a new sparse matrix with the given number of rows and columns as a copy of the given array.
/// The array is assumed to be in column-major order (column by column).
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
/// <seealso href="http://en.wikipedia.org/wiki/Row-major_order"/>
public static SparseMatrix OfColumnMajor(int rows, int columns, IList<Complex> columnMajor)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfColumnMajorList(rows, columns, columnMajor));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given enumerable of enumerable columns.
/// Each enumerable in the master enumerable specifies a column.
/// This new matrix will be independent from the enumerables.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfColumns(IEnumerable<IEnumerable<Complex>> data)
{
return OfColumnArrays(data.Select(v => v.ToArray()).ToArray());
}
/// <summary>
/// Create a new sparse matrix as a copy of the given enumerable of enumerable columns.
/// Each enumerable in the master enumerable specifies a column.
/// This new matrix will be independent from the enumerables.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfColumns(int rows, int columns, IEnumerable<IEnumerable<Complex>> data)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfColumnEnumerables(rows, columns, data));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given column arrays.
/// This new matrix will be independent from the arrays.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfColumnArrays(params Complex[][] columns)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfColumnArrays(columns));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given column arrays.
/// This new matrix will be independent from the arrays.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfColumnArrays(IEnumerable<Complex[]> columns)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfColumnArrays((columns as Complex[][]) ?? columns.ToArray()));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given column vectors.
/// This new matrix will be independent from the vectors.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfColumnVectors(params Vector<Complex>[] columns)
{
var storage = new VectorStorage<Complex>[columns.Length];
for (int i = 0; i < columns.Length; i++)
{
storage[i] = columns[i].Storage;
}
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfColumnVectors(storage));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given column vectors.
/// This new matrix will be independent from the vectors.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfColumnVectors(IEnumerable<Vector<Complex>> columns)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfColumnVectors(columns.Select(c => c.Storage).ToArray()));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given enumerable of enumerable rows.
/// Each enumerable in the master enumerable specifies a row.
/// This new matrix will be independent from the enumerables.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfRows(IEnumerable<IEnumerable<Complex>> data)
{
return OfRowArrays(data.Select(v => v.ToArray()).ToArray());
}
/// <summary>
/// Create a new sparse matrix as a copy of the given enumerable of enumerable rows.
/// Each enumerable in the master enumerable specifies a row.
/// This new matrix will be independent from the enumerables.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfRows(int rows, int columns, IEnumerable<IEnumerable<Complex>> data)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfRowEnumerables(rows, columns, data));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given row arrays.
/// This new matrix will be independent from the arrays.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfRowArrays(params Complex[][] rows)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfRowArrays(rows));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given row arrays.
/// This new matrix will be independent from the arrays.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfRowArrays(IEnumerable<Complex[]> rows)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfRowArrays((rows as Complex[][]) ?? rows.ToArray()));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given row vectors.
/// This new matrix will be independent from the vectors.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfRowVectors(params Vector<Complex>[] rows)
{
var storage = new VectorStorage<Complex>[rows.Length];
for (int i = 0; i < rows.Length; i++)
{
storage[i] = rows[i].Storage;
}
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfRowVectors(storage));
}
/// <summary>
/// Create a new sparse matrix as a copy of the given row vectors.
/// This new matrix will be independent from the vectors.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfRowVectors(IEnumerable<Vector<Complex>> rows)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfRowVectors(rows.Select(r => r.Storage).ToArray()));
}
/// <summary>
/// Create a new sparse matrix with the diagonal as a copy of the given vector.
/// This new matrix will be independent from the vector.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfDiagonalVector(Vector<Complex> diagonal)
{
var m = new SparseMatrix(diagonal.Count, diagonal.Count);
m.SetDiagonal(diagonal);
return m;
}
/// <summary>
/// Create a new sparse matrix with the diagonal as a copy of the given vector.
/// This new matrix will be independent from the vector.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfDiagonalVector(int rows, int columns, Vector<Complex> diagonal)
{
var m = new SparseMatrix(rows, columns);
m.SetDiagonal(diagonal);
return m;
}
/// <summary>
/// Create a new sparse matrix with the diagonal as a copy of the given array.
/// This new matrix will be independent from the array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfDiagonalArray(Complex[] diagonal)
{
var m = new SparseMatrix(diagonal.Length, diagonal.Length);
m.SetDiagonal(diagonal);
return m;
}
/// <summary>
/// Create a new sparse matrix with the diagonal as a copy of the given array.
/// This new matrix will be independent from the array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
public static SparseMatrix OfDiagonalArray(int rows, int columns, Complex[] diagonal)
{
var m = new SparseMatrix(rows, columns);
m.SetDiagonal(diagonal);
return m;
}
/// <summary>
/// Create a new sparse matrix and initialize each value to the same provided value.
/// </summary>
public static SparseMatrix Create(int rows, int columns, Complex value)
{
if (value == Complex.Zero) return new SparseMatrix(rows, columns);
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfValue(rows, columns, value));
}
/// <summary>
/// Create a new sparse matrix and initialize each value using the provided init function.
/// </summary>
public static SparseMatrix Create(int rows, int columns, Func<int, int, Complex> init)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfInit(rows, columns, init));
}
/// <summary>
/// Create a new diagonal sparse matrix and initialize each diagonal value to the same provided value.
/// </summary>
public static SparseMatrix CreateDiagonal(int rows, int columns, Complex value)
{
if (value == Complex.Zero) return new SparseMatrix(rows, columns);
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfDiagonalInit(rows, columns, i => value));
}
/// <summary>
/// Create a new diagonal sparse matrix and initialize each diagonal value using the provided init function.
/// </summary>
public static SparseMatrix CreateDiagonal(int rows, int columns, Func<int, Complex> init)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfDiagonalInit(rows, columns, init));
}
/// <summary>
/// Create a new square sparse identity matrix where each diagonal value is set to One.
/// </summary>
public static SparseMatrix CreateIdentity(int order)
{
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfDiagonalInit(order, order, i => One));
}
/// <summary>
/// Returns a new matrix containing the lower triangle of this matrix.
/// </summary>
/// <returns>The lower triangle of this matrix.</returns>
public override Matrix<Complex> LowerTriangle()
{
var result = Build.SameAs(this);
LowerTriangleImpl(result);
return result;
}
/// <summary>
/// Puts the lower triangle of this matrix into the result matrix.
/// </summary>
/// <param name="result">Where to store the lower triangle.</param>
/// <exception cref="ArgumentNullException">If <paramref name="result"/> is <see langword="null" />.</exception>
/// <exception cref="ArgumentException">If the result matrix's dimensions are not the same as this matrix.</exception>
public override void LowerTriangle(Matrix<Complex> result)
{
if (result == null)
{
throw new ArgumentNullException("result");
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
{
throw DimensionsDontMatch<ArgumentException>(this, result);
}
if (ReferenceEquals(this, result))
{
var tmp = Build.SameAs(result);
LowerTriangle(tmp);
tmp.CopyTo(result);
}
else
{
result.Clear();
LowerTriangleImpl(result);
}
}
/// <summary>
/// Puts the lower triangle of this matrix into the result matrix.
/// </summary>
/// <param name="result">Where to store the lower triangle.</param>
private void LowerTriangleImpl(Matrix<Complex> result)
{
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
for (var row = 0; row < result.RowCount; row++)
{
var endIndex = rowPointers[row + 1];
for (var j = rowPointers[row]; j < endIndex; j++)
{
if (row >= columnIndices[j])
{
result.At(row, columnIndices[j], values[j]);
}
}
}
}
/// <summary>
/// Returns a new matrix containing the upper triangle of this matrix.
/// </summary>
/// <returns>The upper triangle of this matrix.</returns>
public override Matrix<Complex> UpperTriangle()
{
var result = Build.SameAs(this);
UpperTriangleImpl(result);
return result;
}
/// <summary>
/// Puts the upper triangle of this matrix into the result matrix.
/// </summary>
/// <param name="result">Where to store the lower triangle.</param>
/// <exception cref="ArgumentNullException">If <paramref name="result"/> is <see langword="null" />.</exception>
/// <exception cref="ArgumentException">If the result matrix's dimensions are not the same as this matrix.</exception>
public override void UpperTriangle(Matrix<Complex> result)
{
if (result == null)
{
throw new ArgumentNullException("result");
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
{
throw DimensionsDontMatch<ArgumentException>(this, result);
}
if (ReferenceEquals(this, result))
{
var tmp = Build.SameAs(result);
UpperTriangle(tmp);
tmp.CopyTo(result);
}
else
{
result.Clear();
UpperTriangleImpl(result);
}
}
/// <summary>
/// Puts the upper triangle of this matrix into the result matrix.
/// </summary>
/// <param name="result">Where to store the lower triangle.</param>
private void UpperTriangleImpl(Matrix<Complex> result)
{
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
for (var row = 0; row < result.RowCount; row++)
{
var endIndex = rowPointers[row + 1];
for (var j = rowPointers[row]; j < endIndex; j++)
{
if (row <= columnIndices[j])
{
result.At(row, columnIndices[j], values[j]);
}
}
}
}
/// <summary>
/// Returns a new matrix containing the lower triangle of this matrix. The new matrix
/// does not contain the diagonal elements of this matrix.
/// </summary>
/// <returns>The lower triangle of this matrix.</returns>
public override Matrix<Complex> StrictlyLowerTriangle()
{
var result = Build.SameAs(this);
StrictlyLowerTriangleImpl(result);
return result;
}
/// <summary>
/// Puts the strictly lower triangle of this matrix into the result matrix.
/// </summary>
/// <param name="result">Where to store the lower triangle.</param>
/// <exception cref="ArgumentNullException">If <paramref name="result"/> is <see langword="null" />.</exception>
/// <exception cref="ArgumentException">If the result matrix's dimensions are not the same as this matrix.</exception>
public override void StrictlyLowerTriangle(Matrix<Complex> result)
{
if (result == null)
{
throw new ArgumentNullException("result");
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
{
throw DimensionsDontMatch<ArgumentException>(this, result);
}
if (ReferenceEquals(this, result))
{
var tmp = Build.SameAs(result);
StrictlyLowerTriangle(tmp);
tmp.CopyTo(result);
}
else
{
result.Clear();
StrictlyLowerTriangleImpl(result);
}
}
/// <summary>
/// Puts the strictly lower triangle of this matrix into the result matrix.
/// </summary>
/// <param name="result">Where to store the lower triangle.</param>
private void StrictlyLowerTriangleImpl(Matrix<Complex> result)
{
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
for (var row = 0; row < result.RowCount; row++)
{
var endIndex = rowPointers[row + 1];
for (var j = rowPointers[row]; j < endIndex; j++)
{
if (row > columnIndices[j])
{
result.At(row, columnIndices[j], values[j]);
}
}
}
}
/// <summary>
/// Returns a new matrix containing the upper triangle of this matrix. The new matrix
/// does not contain the diagonal elements of this matrix.
/// </summary>
/// <returns>The upper triangle of this matrix.</returns>
public override Matrix<Complex> StrictlyUpperTriangle()
{
var result = Build.SameAs(this);
StrictlyUpperTriangleImpl(result);
return result;
}
/// <summary>
/// Puts the strictly upper triangle of this matrix into the result matrix.
/// </summary>
/// <param name="result">Where to store the lower triangle.</param>
/// <exception cref="ArgumentNullException">If <paramref name="result"/> is <see langword="null" />.</exception>
/// <exception cref="ArgumentException">If the result matrix's dimensions are not the same as this matrix.</exception>
public override void StrictlyUpperTriangle(Matrix<Complex> result)
{
if (result == null)
{
throw new ArgumentNullException("result");
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
{
throw DimensionsDontMatch<ArgumentException>(this, result);
}
if (ReferenceEquals(this, result))
{
var tmp = Build.SameAs(result);
StrictlyUpperTriangle(tmp);
tmp.CopyTo(result);
}
else
{
result.Clear();
StrictlyUpperTriangleImpl(result);
}
}
/// <summary>
/// Puts the strictly upper triangle of this matrix into the result matrix.
/// </summary>
/// <param name="result">Where to store the lower triangle.</param>
private void StrictlyUpperTriangleImpl(Matrix<Complex> result)
{
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
for (var row = 0; row < result.RowCount; row++)
{
var endIndex = rowPointers[row + 1];
for (var j = rowPointers[row]; j < endIndex; j++)
{
if (row < columnIndices[j])
{
result.At(row, columnIndices[j], values[j]);
}
}
}
}
/// <summary>
/// Negate each element of this matrix and place the results into the result matrix.
/// </summary>
/// <param name="result">The result of the negation.</param>
protected override void DoNegate(Matrix<Complex> result)
{
CopyTo(result);
DoMultiply(-1, result);
}
/// <summary>Calculates the induced infinity norm of this matrix.</summary>
/// <returns>The maximum absolute row sum of the matrix.</returns>
public override double InfinityNorm()
{
var rowPointers = _storage.RowPointers;
var values = _storage.Values;
var norm = 0d;
for (var i = 0; i < RowCount; i++)
{
var startIndex = rowPointers[i];
var endIndex = rowPointers[i + 1];
if (startIndex == endIndex)
{
continue;
}
var s = 0d;
for (var j = startIndex; j < endIndex; j++)
{
s += values[j].Magnitude;
}
norm = Math.Max(norm, s);
}
return norm;
}
/// <summary>Calculates the entry-wise Frobenius norm of this matrix.</summary>
/// <returns>The square root of the sum of the squared values.</returns>
public override double FrobeniusNorm()
{
var aat = (SparseCompressedRowMatrixStorage<Complex>) (this*ConjugateTranspose()).Storage;
var norm = 0d;
for (var i = 0; i < aat.RowCount; i++)
{
var startIndex = aat.RowPointers[i];
var endIndex = aat.RowPointers[i + 1];
if (startIndex == endIndex)
{
continue;
}
for (var j = startIndex; j < endIndex; j++)
{
if (i == aat.ColumnIndices[j])
{
norm += aat.Values[j].Magnitude;
}
}
}
return Math.Sqrt(norm);
}
/// <summary>
/// Adds another matrix to this matrix.
/// </summary>
/// <param name="other">The matrix to add to this matrix.</param>
/// <param name="result">The matrix to store the result of the addition.</param>
/// <exception cref="ArgumentNullException">If the other matrix is <see langword="null"/>.</exception>
/// <exception cref="ArgumentOutOfRangeException">If the two matrices don't have the same dimensions.</exception>
protected override void DoAdd(Matrix<Complex> other, Matrix<Complex> result)
{
var sparseOther = other as SparseMatrix;
var sparseResult = result as SparseMatrix;
if (sparseOther == null || sparseResult == null)
{
base.DoAdd(other, result);
return;
}
if (ReferenceEquals(this, other))
{
if (!ReferenceEquals(this, result))
{
CopyTo(result);
}
Control.LinearAlgebraProvider.ScaleArray(2.0, sparseResult._storage.Values, sparseResult._storage.Values);
return;
}
SparseMatrix left;
if (ReferenceEquals(sparseOther, sparseResult))
{
left = this;
}
else if (ReferenceEquals(this, sparseResult))
{
left = sparseOther;
}
else
{
CopyTo(sparseResult);
left = sparseOther;
}
var leftStorage = left._storage;
for (var i = 0; i < leftStorage.RowCount; i++)
{
var endIndex = leftStorage.RowPointers[i + 1];
for (var j = leftStorage.RowPointers[i]; j < endIndex; j++)
{
var columnIndex = leftStorage.ColumnIndices[j];
var resVal = leftStorage.Values[j] + result.At(i, columnIndex);
result.At(i, columnIndex, resVal);
}
}
}
/// <summary>
/// Subtracts another matrix from this matrix.
/// </summary>
/// <param name="other">The matrix to subtract to this matrix.</param>
/// <param name="result">The matrix to store the result of subtraction.</param>
/// <exception cref="ArgumentNullException">If the other matrix is <see langword="null"/>.</exception>
/// <exception cref="ArgumentOutOfRangeException">If the two matrices don't have the same dimensions.</exception>
protected override void DoSubtract(Matrix<Complex> other, Matrix<Complex> result)
{
var sparseOther = other as SparseMatrix;
var sparseResult = result as SparseMatrix;
if (sparseOther == null || sparseResult == null)
{
base.DoSubtract(other, result);
return;
}
if (ReferenceEquals(this, other))
{
result.Clear();
return;
}
var otherStorage = sparseOther._storage;
if (ReferenceEquals(this, sparseResult))
{
for (var i = 0; i < otherStorage.RowCount; i++)
{
var endIndex = otherStorage.RowPointers[i + 1];
for (var j = otherStorage.RowPointers[i]; j < endIndex; j++)
{
var columnIndex = otherStorage.ColumnIndices[j];
var resVal = sparseResult.At(i, columnIndex) - otherStorage.Values[j];
result.At(i, columnIndex, resVal);
}
}
}
else
{
if (!ReferenceEquals(sparseOther, sparseResult))
{
sparseOther.CopyTo(sparseResult);
}
sparseResult.Negate(sparseResult);
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
for (var i = 0; i < RowCount; i++)
{
var endIndex = rowPointers[i + 1];
for (var j = rowPointers[i]; j < endIndex; j++)
{
var columnIndex = columnIndices[j];
var resVal = sparseResult.At(i, columnIndex) + values[j];
result.At(i, columnIndex, resVal);
}
}
}
}
/// <summary>
/// Multiplies each element of the matrix by a scalar and places results into the result matrix.
/// </summary>
/// <param name="scalar">The scalar to multiply the matrix with.</param>
/// <param name="result">The matrix to store the result of the multiplication.</param>
protected override void DoMultiply(Complex scalar, Matrix<Complex> result)
{
if (scalar == 1.0)
{
CopyTo(result);
return;
}
if (scalar == 0.0 || NonZerosCount == 0)
{
result.Clear();
return;
}
var sparseResult = result as SparseMatrix;
if (sparseResult == null)
{
result.Clear();
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
for (var row = 0; row < RowCount; row++)
{
var start = rowPointers[row];
var end = rowPointers[row + 1];
if (start == end)
{
continue;
}
for (var index = start; index < end; index++)
{
var column = columnIndices[index];
result.At(row, column, values[index] * scalar);
}
}
}
else
{
if (!ReferenceEquals(this, result))
{
CopyTo(sparseResult);
}
Control.LinearAlgebraProvider.ScaleArray(scalar, sparseResult._storage.Values, sparseResult._storage.Values);
}
}
/// <summary>
/// Multiplies this matrix with another matrix and places the results into the result matrix.
/// </summary>
/// <param name="other">The matrix to multiply with.</param>
/// <param name="result">The result of the multiplication.</param>
protected override void DoMultiply(Matrix<Complex> other, Matrix<Complex> result)
{
var sparseOther = other as SparseMatrix;
var sparseResult = result as SparseMatrix;
if (sparseOther != null && sparseResult != null)
{
DoMultiplySparse(sparseOther, sparseResult);
return;
}
var diagonalOther = other.Storage as DiagonalMatrixStorage<Complex>;
if (diagonalOther != null && sparseResult != null)
{
var diagonal = diagonalOther.Data;
if (other.ColumnCount == other.RowCount)
{
Storage.MapIndexedTo(result.Storage, (i, j, x) => x*diagonal[j], Zeros.AllowSkip, ExistingData.Clear);
}
else
{
result.Storage.Clear();
Storage.MapSubMatrixIndexedTo(result.Storage, (i, j, x) => x*diagonal[j], 0, 0, RowCount, 0, 0, ColumnCount, Zeros.AllowSkip, ExistingData.AssumeZeros);
}
return;
}
result.Clear();
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
var denseOther = other.Storage as DenseColumnMajorMatrixStorage<Complex>;
if (denseOther != null)
{
// in this case we can directly address the underlying data-array
for (var row = 0; row < RowCount; row++)
{
var startIndex = rowPointers[row];
var endIndex = rowPointers[row + 1];
if (startIndex == endIndex)
{
continue;
}
for (var column = 0; column < other.ColumnCount; column++)
{
int otherColumnStartPosition = column * other.RowCount;
var sum = Complex.Zero;
for (var index = startIndex; index < endIndex; index++)
{
sum += values[index] * denseOther.Data[otherColumnStartPosition + columnIndices[index]];
}
result.At(row, column, sum);
}
}
return;
}
var columnVector = new DenseVector(other.RowCount);
for (var row = 0; row < RowCount; row++)
{
var startIndex = rowPointers[row];
var endIndex = rowPointers[row + 1];
if (startIndex == endIndex)
{
continue;
}
for (var column = 0; column < other.ColumnCount; column++)
{
// Multiply row of matrix A on column of matrix B
other.Column(column, columnVector);
var sum = Complex.Zero;
for (var index = startIndex; index < endIndex; index++)
{
sum += values[index] * columnVector[columnIndices[index]];
}
result.At(row, column, sum);
}
}
}
void DoMultiplySparse(SparseMatrix other, SparseMatrix result)
{
result.Clear();
var ax = _storage.Values;
var ap = _storage.RowPointers;
var ai = _storage.ColumnIndices;
var bx = other._storage.Values;
var bp = other._storage.RowPointers;
var bi = other._storage.ColumnIndices;
int rows = RowCount;
int cols = other.ColumnCount;
int[] cp = result._storage.RowPointers;
var marker = new int[cols];
for (int ib = 0; ib < cols; ib++)
{
marker[ib] = -1;
}
int count = 0;
for (int i = 0; i < rows; i++)
{
// For each row of A
for (int j = ap[i]; j < ap[i + 1]; j++)
{
// Row number to be added
int a = ai[j];
for (int k = bp[a]; k < bp[a + 1]; k++)
{
int b = bi[k];
if (marker[b] != i)
{
marker[b] = i;
count++;
}
}
}
// Record non-zero count.
cp[i + 1] = count;
}
var ci = new int[count];
var cx = new Complex[count];
for (int ib = 0; ib < cols; ib++)
{
marker[ib] = -1;
}
count = 0;
for (int i = 0; i < rows; i++)
{
int rowStart = cp[i];
for (int j = ap[i]; j < ap[i + 1]; j++)
{
int a = ai[j];
Complex aEntry = ax[j];
for (int k = bp[a]; k < bp[a + 1]; k++)
{
int b = bi[k];
Complex bEntry = bx[k];
if (marker[b] < rowStart)
{
marker[b] = count;
ci[marker[b]] = b;
cx[marker[b]] = aEntry * bEntry;
count++;
}
else
{
cx[marker[b]] += aEntry * bEntry;
}
}
}
}
result._storage.Values = cx;
result._storage.ColumnIndices = ci;
result._storage.Normalize();
}
/// <summary>
/// Multiplies this matrix with a vector and places the results into the result vector.
/// </summary>
/// <param name="rightSide">The vector to multiply with.</param>
/// <param name="result">The result of the multiplication.</param>
protected override void DoMultiply(Vector<Complex> rightSide, Vector<Complex> result)
{
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
for (var row = 0; row < RowCount; row++)
{
var startIndex = rowPointers[row];
var endIndex = rowPointers[row + 1];
if (startIndex == endIndex)
{
continue;
}
var sum = Complex.Zero;
for (var index = startIndex; index < endIndex; index++)
{
sum += values[index] * rightSide[columnIndices[index]];
}
result[row] = sum;
}
}
/// <summary>
/// Multiplies this matrix with transpose of another matrix and places the results into the result matrix.
/// </summary>
/// <param name="other">The matrix to multiply with.</param>
/// <param name="result">The result of the multiplication.</param>
protected override void DoTransposeAndMultiply(Matrix<Complex> other, Matrix<Complex> result)
{
var otherSparse = other as SparseMatrix;
var resultSparse = result as SparseMatrix;
if (otherSparse == null || resultSparse == null)
{
base.DoTransposeAndMultiply(other, result);
return;
}
resultSparse.Clear();
var rowPointers = _storage.RowPointers;
var values = _storage.Values;
var otherStorage = otherSparse._storage;
for (var j = 0; j < RowCount; j++)
{
var startIndexOther = otherStorage.RowPointers[j];
var endIndexOther = otherStorage.RowPointers[j + 1];
if (startIndexOther == endIndexOther)
{
continue;
}
for (var i = 0; i < RowCount; i++)
{
// Multiply row of matrix A on row of matrix B
var startIndexThis = rowPointers[i];
var endIndexThis = rowPointers[i + 1];
if (startIndexThis == endIndexThis)
{
continue;
}
var sum = Complex.Zero;
for (var index = startIndexOther; index < endIndexOther; index++)
{
var ind = _storage.FindItem(i, otherStorage.ColumnIndices[index]);
if (ind >= 0)
{
sum += otherStorage.Values[index] * values[ind];
}
}
resultSparse._storage.At(i, j, sum + result.At(i, j));
}
}
}
/// <summary>
/// Pointwise multiplies this matrix with another matrix and stores the result into the result matrix.
/// </summary>
/// <param name="other">The matrix to pointwise multiply with this one.</param>
/// <param name="result">The matrix to store the result of the pointwise multiplication.</param>
protected override void DoPointwiseMultiply(Matrix<Complex> other, Matrix<Complex> result)
{
result.Clear();
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
for (var i = 0; i < RowCount; i++)
{
var endIndex = rowPointers[i + 1];
for (var j = rowPointers[i]; j < endIndex; j++)
{
var resVal = values[j]*other.At(i, columnIndices[j]);
if (!resVal.IsZero())
{
result.At(i, columnIndices[j], resVal);
}
}
}
}
/// <summary>
/// Pointwise divide this matrix by another matrix and stores the result into the result matrix.
/// </summary>
/// <param name="divisor">The matrix to pointwise divide this one by.</param>
/// <param name="result">The matrix to store the result of the pointwise division.</param>
protected override void DoPointwiseDivide(Matrix<Complex> divisor, Matrix<Complex> result)
{
result.Clear();
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
for (var i = 0; i < RowCount; i++)
{
var endIndex = rowPointers[i + 1];
for (var j = rowPointers[i]; j < endIndex; j++)
{
if (!values[j].IsZero())
{
result.At(i, columnIndices[j], values[j]/divisor.At(i, columnIndices[j]));
}
}
}
}
public override void KroneckerProduct(Matrix<Complex> other, Matrix<Complex> result)
{
if (other == null)
{
throw new ArgumentNullException("other");
}
if (result == null)
{
throw new ArgumentNullException("result");
}
if (result.RowCount != (RowCount*other.RowCount) || result.ColumnCount != (ColumnCount*other.ColumnCount))
{
throw DimensionsDontMatch<ArgumentOutOfRangeException>(this, other, result);
}
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
for (var i = 0; i < RowCount; i++)
{
var endIndex = rowPointers[i + 1];
for (var j = rowPointers[i]; j < endIndex; j++)
{
if (!values[j].IsZero())
{
result.SetSubMatrix(i*other.RowCount, other.RowCount, columnIndices[j]*other.ColumnCount, other.ColumnCount, values[j]*other);
}
}
}
}
/// <summary>
/// Evaluates whether this matrix is symmetric.
/// </summary>
public override bool IsSymmetric()
{
if (RowCount != ColumnCount)
{
return false;
}
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
for (var row = 0; row < RowCount; row++)
{
var start = rowPointers[row];
var end = rowPointers[row + 1];
if (start == end)
{
continue;
}
for (var index = start; index < end; index++)
{
var column = columnIndices[index];
if (!values[index].Equals(At(column, row)))
{
return false;
}
}
}
return true;
}
/// <summary>
/// Evaluates whether this matrix is hermitian (conjugate symmetric).
/// </summary>
public override bool IsHermitian()
{
if (RowCount != ColumnCount)
{
return false;
}
var rowPointers = _storage.RowPointers;
var columnIndices = _storage.ColumnIndices;
var values = _storage.Values;
for (var row = 0; row < RowCount; row++)
{
var start = rowPointers[row];
var end = rowPointers[row + 1];
if (start == end)
{
continue;
}
for (var index = start; index < end; index++)
{
var column = columnIndices[index];
if (!values[index].Equals(At(column, row).Conjugate()))
{
return false;
}
}
}
return true;
}
/// <summary>
/// Adds two matrices together and returns the results.
/// </summary>
/// <remarks>This operator will allocate new memory for the result. It will
/// choose the representation of either <paramref name="leftSide"/> or <paramref name="rightSide"/> depending on which
/// is denser.</remarks>
/// <param name="leftSide">The left matrix to add.</param>
/// <param name="rightSide">The right matrix to add.</param>
/// <returns>The result of the addition.</returns>
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="leftSide"/> and <paramref name="rightSide"/> don't have the same dimensions.</exception>
/// <exception cref="ArgumentNullException">If <paramref name="leftSide"/> or <paramref name="rightSide"/> is <see langword="null" />.</exception>
public static SparseMatrix operator +(SparseMatrix leftSide, SparseMatrix rightSide)
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
}
if (leftSide.RowCount != rightSide.RowCount || leftSide.ColumnCount != rightSide.ColumnCount)
{
throw DimensionsDontMatch<ArgumentOutOfRangeException>(leftSide, rightSide);
}
return (SparseMatrix)leftSide.Add(rightSide);
}
/// <summary>
/// Returns a <strong>Matrix</strong> containing the same values of <paramref name="rightSide"/>.
/// </summary>
/// <param name="rightSide">The matrix to get the values from.</param>
/// <returns>A matrix containing a the same values as <paramref name="rightSide"/>.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="rightSide"/> is <see langword="null" />.</exception>
public static SparseMatrix operator +(SparseMatrix rightSide)
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
}
return (SparseMatrix)rightSide.Clone();
}
/// <summary>
/// Subtracts two matrices together and returns the results.
/// </summary>
/// <remarks>This operator will allocate new memory for the result. It will
/// choose the representation of either <paramref name="leftSide"/> or <paramref name="rightSide"/> depending on which
/// is denser.</remarks>
/// <param name="leftSide">The left matrix to subtract.</param>
/// <param name="rightSide">The right matrix to subtract.</param>
/// <returns>The result of the addition.</returns>
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="leftSide"/> and <paramref name="rightSide"/> don't have the same dimensions.</exception>
/// <exception cref="ArgumentNullException">If <paramref name="leftSide"/> or <paramref name="rightSide"/> is <see langword="null" />.</exception>
public static SparseMatrix operator -(SparseMatrix leftSide, SparseMatrix rightSide)
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
}
if (leftSide.RowCount != rightSide.RowCount || leftSide.ColumnCount != rightSide.ColumnCount)
{
throw DimensionsDontMatch<ArgumentOutOfRangeException>(leftSide, rightSide);
}
return (SparseMatrix)leftSide.Subtract(rightSide);
}
/// <summary>
/// Negates each element of the matrix.
/// </summary>
/// <param name="rightSide">The matrix to negate.</param>
/// <returns>A matrix containing the negated values.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="rightSide"/> is <see langword="null" />.</exception>
public static SparseMatrix operator -(SparseMatrix rightSide)
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
}
return (SparseMatrix)rightSide.Negate();
}
/// <summary>
/// Multiplies a <strong>Matrix</strong> by a constant and returns the result.
/// </summary>
/// <param name="leftSide">The matrix to multiply.</param>
/// <param name="rightSide">The constant to multiply the matrix by.</param>
/// <returns>The result of the multiplication.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="leftSide"/> is <see langword="null" />.</exception>
public static SparseMatrix operator *(SparseMatrix leftSide, Complex rightSide)
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
}
return (SparseMatrix)leftSide.Multiply(rightSide);
}
/// <summary>
/// Multiplies a <strong>Matrix</strong> by a constant and returns the result.
/// </summary>
/// <param name="leftSide">The matrix to multiply.</param>
/// <param name="rightSide">The constant to multiply the matrix by.</param>
/// <returns>The result of the multiplication.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="rightSide"/> is <see langword="null" />.</exception>
public static SparseMatrix operator *(Complex leftSide, SparseMatrix rightSide)
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
}
return (SparseMatrix)rightSide.Multiply(leftSide);
}
/// <summary>
/// Multiplies two matrices.
/// </summary>
/// <remarks>This operator will allocate new memory for the result. It will
/// choose the representation of either <paramref name="leftSide"/> or <paramref name="rightSide"/> depending on which
/// is denser.</remarks>
/// <param name="leftSide">The left matrix to multiply.</param>
/// <param name="rightSide">The right matrix to multiply.</param>
/// <returns>The result of multiplication.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="leftSide"/> or <paramref name="rightSide"/> is <see langword="null" />.</exception>
/// <exception cref="ArgumentException">If the dimensions of <paramref name="leftSide"/> or <paramref name="rightSide"/> don't conform.</exception>
public static SparseMatrix operator *(SparseMatrix leftSide, SparseMatrix rightSide)
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
}
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
}
if (leftSide.ColumnCount != rightSide.RowCount)
{
throw DimensionsDontMatch<ArgumentException>(leftSide, rightSide);
}
return (SparseMatrix)leftSide.Multiply(rightSide);
}
/// <summary>
/// Multiplies a <strong>Matrix</strong> and a Vector.
/// </summary>
/// <param name="leftSide">The matrix to multiply.</param>
/// <param name="rightSide">The vector to multiply.</param>
/// <returns>The result of multiplication.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="leftSide"/> or <paramref name="rightSide"/> is <see langword="null" />.</exception>
public static SparseVector operator *(SparseMatrix leftSide, SparseVector rightSide)
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
}
return (SparseVector)leftSide.Multiply(rightSide);
}
/// <summary>
/// Multiplies a Vector and a <strong>Matrix</strong>.
/// </summary>
/// <param name="leftSide">The vector to multiply.</param>
/// <param name="rightSide">The matrix to multiply.</param>
/// <returns>The result of multiplication.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="leftSide"/> or <paramref name="rightSide"/> is <see langword="null" />.</exception>
public static SparseVector operator *(SparseVector leftSide, SparseMatrix rightSide)
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
}
return (SparseVector)rightSide.LeftMultiply(leftSide);
}
/// <summary>
/// Multiplies a <strong>Matrix</strong> by a constant and returns the result.
/// </summary>
/// <param name="leftSide">The matrix to multiply.</param>
/// <param name="rightSide">The constant to multiply the matrix by.</param>
/// <returns>The result of the multiplication.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="leftSide"/> is <see langword="null" />.</exception>
public static SparseMatrix operator %(SparseMatrix leftSide, Complex rightSide)
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
}
return (SparseMatrix)leftSide.Remainder(rightSide);
}
public override string ToTypeString()
{
return string.Format("SparseMatrix {0}x{1}-Complex {2:P2} Filled", RowCount, ColumnCount, NonZerosCount / (RowCount * (double)ColumnCount));
}
}
}
| mit |
AzureZhao/android-developer-cn | reference/android/provider/SyncStateContract.html | 85468 | <!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>SyncStateContract - 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="5" 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="selected 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="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>Interfaces</h2>
<ul>
<li class="api apilevel-1"><a href="../../../reference/android/provider/BaseColumns.html">BaseColumns</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.AttendeesColumns.html">CalendarContract.AttendeesColumns</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.CalendarAlertsColumns.html">CalendarContract.CalendarAlertsColumns</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.CalendarCacheColumns.html">CalendarContract.CalendarCacheColumns</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.CalendarColumns.html">CalendarContract.CalendarColumns</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.CalendarSyncColumns.html">CalendarContract.CalendarSyncColumns</a></li>
<li class="api apilevel-15"><a href="../../../reference/android/provider/CalendarContract.ColorsColumns.html">CalendarContract.ColorsColumns</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.EventDaysColumns.html">CalendarContract.EventDaysColumns</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.EventsColumns.html">CalendarContract.EventsColumns</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.ExtendedPropertiesColumns.html">CalendarContract.ExtendedPropertiesColumns</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.RemindersColumns.html">CalendarContract.RemindersColumns</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.SyncColumns.html">CalendarContract.SyncColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.ContactMethodsColumns.html">Contacts.ContactMethodsColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.ExtensionsColumns.html">Contacts.ExtensionsColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.GroupsColumns.html">Contacts.GroupsColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.OrganizationColumns.html">Contacts.OrganizationColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.PeopleColumns.html">Contacts.PeopleColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.PhonesColumns.html">Contacts.PhonesColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.PhotosColumns.html">Contacts.PhotosColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.PresenceColumns.html">Contacts.PresenceColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.SettingsColumns.html">Contacts.SettingsColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.BaseSyncColumns.html">ContactsContract.BaseSyncColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.BaseTypes.html">ContactsContract.CommonDataKinds.BaseTypes</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.CommonColumns.html">ContactsContract.CommonDataKinds.CommonColumns</a></li>
<li class="api apilevel-11"><a href="../../../reference/android/provider/ContactsContract.ContactNameColumns.html">ContactsContract.ContactNameColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.ContactOptionsColumns.html">ContactsContract.ContactOptionsColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.ContactsColumns.html">ContactsContract.ContactsColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.ContactStatusColumns.html">ContactsContract.ContactStatusColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.DataColumns.html">ContactsContract.DataColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.DataColumnsWithJoins.html">ContactsContract.DataColumnsWithJoins</a></li>
<li class="api apilevel-18"><a href="../../../reference/android/provider/ContactsContract.DataUsageStatColumns.html">ContactsContract.DataUsageStatColumns</a></li>
<li class="api apilevel-18"><a href="../../../reference/android/provider/ContactsContract.DeletedContactsColumns.html">ContactsContract.DeletedContactsColumns</a></li>
<li class="api apilevel-11"><a href="../../../reference/android/provider/ContactsContract.DisplayNameSources.html">ContactsContract.DisplayNameSources</a></li>
<li class="api apilevel-11"><a href="../../../reference/android/provider/ContactsContract.FullNameStyle.html">ContactsContract.FullNameStyle</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.GroupsColumns.html">ContactsContract.GroupsColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.PhoneLookupColumns.html">ContactsContract.PhoneLookupColumns</a></li>
<li class="api apilevel-11"><a href="../../../reference/android/provider/ContactsContract.PhoneticNameStyle.html">ContactsContract.PhoneticNameStyle</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.PresenceColumns.html">ContactsContract.PresenceColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.RawContactsColumns.html">ContactsContract.RawContactsColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.SettingsColumns.html">ContactsContract.SettingsColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.StatusColumns.html">ContactsContract.StatusColumns</a></li>
<li class="api apilevel-15"><a href="../../../reference/android/provider/ContactsContract.StreamItemPhotosColumns.html">ContactsContract.StreamItemPhotosColumns</a></li>
<li class="api apilevel-15"><a href="../../../reference/android/provider/ContactsContract.StreamItemsColumns.html">ContactsContract.StreamItemsColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.SyncColumns.html">ContactsContract.SyncColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.AlbumColumns.html">MediaStore.Audio.AlbumColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.ArtistColumns.html">MediaStore.Audio.ArtistColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.AudioColumns.html">MediaStore.Audio.AudioColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.GenresColumns.html">MediaStore.Audio.GenresColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.PlaylistsColumns.html">MediaStore.Audio.PlaylistsColumns</a></li>
<li class="api apilevel-11"><a href="../../../reference/android/provider/MediaStore.Files.FileColumns.html">MediaStore.Files.FileColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Images.ImageColumns.html">MediaStore.Images.ImageColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.MediaColumns.html">MediaStore.MediaColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Video.VideoColumns.html">MediaStore.Video.VideoColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/OpenableColumns.html">OpenableColumns</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/SyncStateContract.Columns.html">SyncStateContract.Columns</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.BaseMmsColumns.html">Telephony.BaseMmsColumns</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.CanonicalAddressesColumns.html">Telephony.CanonicalAddressesColumns</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.TextBasedSmsColumns.html">Telephony.TextBasedSmsColumns</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.ThreadsColumns.html">Telephony.ThreadsColumns</a></li>
</ul>
</li>
<li><h2>Classes</h2>
<ul>
<li class="api apilevel-9"><a href="../../../reference/android/provider/AlarmClock.html">AlarmClock</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Browser.html">Browser</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Browser.BookmarkColumns.html">Browser.BookmarkColumns</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Browser.SearchColumns.html">Browser.SearchColumns</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.html">CalendarContract</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.Attendees.html">CalendarContract.Attendees</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.CalendarAlerts.html">CalendarContract.CalendarAlerts</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.CalendarCache.html">CalendarContract.CalendarCache</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.CalendarEntity.html">CalendarContract.CalendarEntity</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.Calendars.html">CalendarContract.Calendars</a></li>
<li class="api apilevel-15"><a href="../../../reference/android/provider/CalendarContract.Colors.html">CalendarContract.Colors</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.EventDays.html">CalendarContract.EventDays</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.Events.html">CalendarContract.Events</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.EventsEntity.html">CalendarContract.EventsEntity</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.ExtendedProperties.html">CalendarContract.ExtendedProperties</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.Instances.html">CalendarContract.Instances</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.Reminders.html">CalendarContract.Reminders</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/CalendarContract.SyncState.html">CalendarContract.SyncState</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/CallLog.html">CallLog</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/CallLog.Calls.html">CallLog.Calls</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.html">Contacts</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.ContactMethods.html">Contacts.ContactMethods</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.Extensions.html">Contacts.Extensions</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.GroupMembership.html">Contacts.GroupMembership</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.Groups.html">Contacts.Groups</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.Intents.html">Contacts.Intents</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.Intents.Insert.html">Contacts.Intents.Insert</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.Intents.UI.html">Contacts.Intents.UI</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.Organizations.html">Contacts.Organizations</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.People.html">Contacts.People</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.People.ContactMethods.html">Contacts.People.ContactMethods</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.People.Extensions.html">Contacts.People.Extensions</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.People.Phones.html">Contacts.People.Phones</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.Phones.html">Contacts.Phones</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.Photos.html">Contacts.Photos</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Contacts.Settings.html">Contacts.Settings</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.html">ContactsContract</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.AggregationExceptions.html">ContactsContract.AggregationExceptions</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.html">ContactsContract.CommonDataKinds</a></li>
<li class="api apilevel-18"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.Contactables.html">ContactsContract.CommonDataKinds.Contactables</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.Email.html">ContactsContract.CommonDataKinds.Email</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.Event.html">ContactsContract.CommonDataKinds.Event</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.GroupMembership.html">ContactsContract.CommonDataKinds.GroupMembership</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.Identity.html">ContactsContract.CommonDataKinds.Identity</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.Im.html">ContactsContract.CommonDataKinds.Im</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.Nickname.html">ContactsContract.CommonDataKinds.Nickname</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.Note.html">ContactsContract.CommonDataKinds.Note</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.Organization.html">ContactsContract.CommonDataKinds.Organization</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.Phone.html">ContactsContract.CommonDataKinds.Phone</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.Photo.html">ContactsContract.CommonDataKinds.Photo</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.Relation.html">ContactsContract.CommonDataKinds.Relation</a></li>
<li class="api apilevel-9"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.SipAddress.html">ContactsContract.CommonDataKinds.SipAddress</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.StructuredName.html">ContactsContract.CommonDataKinds.StructuredName</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.StructuredPostal.html">ContactsContract.CommonDataKinds.StructuredPostal</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.CommonDataKinds.Website.html">ContactsContract.CommonDataKinds.Website</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.Contacts.html">ContactsContract.Contacts</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.Contacts.AggregationSuggestions.html">ContactsContract.Contacts.AggregationSuggestions</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.Contacts.Data.html">ContactsContract.Contacts.Data</a></li>
<li class="api apilevel-11"><a href="../../../reference/android/provider/ContactsContract.Contacts.Entity.html">ContactsContract.Contacts.Entity</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.Contacts.Photo.html">ContactsContract.Contacts.Photo</a></li>
<li class="api apilevel-15"><a href="../../../reference/android/provider/ContactsContract.Contacts.StreamItems.html">ContactsContract.Contacts.StreamItems</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.Data.html">ContactsContract.Data</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/ContactsContract.DataUsageFeedback.html">ContactsContract.DataUsageFeedback</a></li>
<li class="api apilevel-18"><a href="../../../reference/android/provider/ContactsContract.DeletedContacts.html">ContactsContract.DeletedContacts</a></li>
<li class="api apilevel-11"><a href="../../../reference/android/provider/ContactsContract.Directory.html">ContactsContract.Directory</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/ContactsContract.DisplayPhoto.html">ContactsContract.DisplayPhoto</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.Groups.html">ContactsContract.Groups</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.Intents.html">ContactsContract.Intents</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.Intents.Insert.html">ContactsContract.Intents.Insert</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.PhoneLookup.html">ContactsContract.PhoneLookup</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.Presence.html">ContactsContract.Presence</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/ContactsContract.Profile.html">ContactsContract.Profile</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/ContactsContract.ProfileSyncState.html">ContactsContract.ProfileSyncState</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.QuickContact.html">ContactsContract.QuickContact</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.RawContacts.html">ContactsContract.RawContacts</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.RawContacts.Data.html">ContactsContract.RawContacts.Data</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/ContactsContract.RawContacts.DisplayPhoto.html">ContactsContract.RawContacts.DisplayPhoto</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.RawContacts.Entity.html">ContactsContract.RawContacts.Entity</a></li>
<li class="api apilevel-15"><a href="../../../reference/android/provider/ContactsContract.RawContacts.StreamItems.html">ContactsContract.RawContacts.StreamItems</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.RawContactsEntity.html">ContactsContract.RawContactsEntity</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.Settings.html">ContactsContract.Settings</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.StatusUpdates.html">ContactsContract.StatusUpdates</a></li>
<li class="api apilevel-15"><a href="../../../reference/android/provider/ContactsContract.StreamItemPhotos.html">ContactsContract.StreamItemPhotos</a></li>
<li class="api apilevel-15"><a href="../../../reference/android/provider/ContactsContract.StreamItems.html">ContactsContract.StreamItems</a></li>
<li class="api apilevel-15"><a href="../../../reference/android/provider/ContactsContract.StreamItems.StreamItemPhotos.html">ContactsContract.StreamItems.StreamItemPhotos</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/ContactsContract.SyncState.html">ContactsContract.SyncState</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/DocumentsContract.html">DocumentsContract</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/DocumentsContract.Document.html">DocumentsContract.Document</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/DocumentsContract.Root.html">DocumentsContract.Root</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/DocumentsProvider.html">DocumentsProvider</a></li>
<li class="api apilevel-3"><a href="../../../reference/android/provider/LiveFolders.html">LiveFolders</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.html">MediaStore</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.html">MediaStore.Audio</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.Albums.html">MediaStore.Audio.Albums</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.Artists.html">MediaStore.Audio.Artists</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.Artists.Albums.html">MediaStore.Audio.Artists.Albums</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.Genres.html">MediaStore.Audio.Genres</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.Genres.Members.html">MediaStore.Audio.Genres.Members</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.Media.html">MediaStore.Audio.Media</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.Playlists.html">MediaStore.Audio.Playlists</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Audio.Playlists.Members.html">MediaStore.Audio.Playlists.Members</a></li>
<li class="api apilevel-11"><a href="../../../reference/android/provider/MediaStore.Files.html">MediaStore.Files</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Images.html">MediaStore.Images</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Images.Media.html">MediaStore.Images.Media</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Images.Thumbnails.html">MediaStore.Images.Thumbnails</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Video.html">MediaStore.Video</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/MediaStore.Video.Media.html">MediaStore.Video.Media</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/MediaStore.Video.Thumbnails.html">MediaStore.Video.Thumbnails</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/SearchRecentSuggestions.html">SearchRecentSuggestions</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Settings.html">Settings</a></li>
<li class="api apilevel-17"><a href="../../../reference/android/provider/Settings.Global.html">Settings.Global</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Settings.NameValueTable.html">Settings.NameValueTable</a></li>
<li class="api apilevel-3"><a href="../../../reference/android/provider/Settings.Secure.html">Settings.Secure</a></li>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Settings.System.html">Settings.System</a></li>
<li class="selected api apilevel-5"><a href="../../../reference/android/provider/SyncStateContract.html">SyncStateContract</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/SyncStateContract.Constants.html">SyncStateContract.Constants</a></li>
<li class="api apilevel-5"><a href="../../../reference/android/provider/SyncStateContract.Helpers.html">SyncStateContract.Helpers</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.html">Telephony</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Carriers.html">Telephony.Carriers</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Mms.html">Telephony.Mms</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Mms.Addr.html">Telephony.Mms.Addr</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Mms.Draft.html">Telephony.Mms.Draft</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Mms.Inbox.html">Telephony.Mms.Inbox</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Mms.Intents.html">Telephony.Mms.Intents</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Mms.Outbox.html">Telephony.Mms.Outbox</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Mms.Part.html">Telephony.Mms.Part</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Mms.Rate.html">Telephony.Mms.Rate</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Mms.Sent.html">Telephony.Mms.Sent</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.MmsSms.html">Telephony.MmsSms</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.MmsSms.PendingMessages.html">Telephony.MmsSms.PendingMessages</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Sms.html">Telephony.Sms</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Sms.Conversations.html">Telephony.Sms.Conversations</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Sms.Draft.html">Telephony.Sms.Draft</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Sms.Inbox.html">Telephony.Sms.Inbox</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Sms.Intents.html">Telephony.Sms.Intents</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Sms.Outbox.html">Telephony.Sms.Outbox</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Sms.Sent.html">Telephony.Sms.Sent</a></li>
<li class="api apilevel-19"><a href="../../../reference/android/provider/Telephony.Threads.html">Telephony.Threads</a></li>
<li class="api apilevel-3"><a href="../../../reference/android/provider/UserDictionary.html">UserDictionary</a></li>
<li class="api apilevel-3"><a href="../../../reference/android/provider/UserDictionary.Words.html">UserDictionary.Words</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/VoicemailContract.html">VoicemailContract</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/VoicemailContract.Status.html">VoicemailContract.Status</a></li>
<li class="api apilevel-14"><a href="../../../reference/android/provider/VoicemailContract.Voicemails.html">VoicemailContract.Voicemails</a></li>
</ul>
</li>
<li><h2>Exceptions</h2>
<ul>
<li class="api apilevel-1"><a href="../../../reference/android/provider/Settings.SettingNotFoundException.html">Settings.SettingNotFoundException</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="#nestedclasses">Nested Classes</a>
| <a href="#pubctors">Ctors</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 5</a>
</div>
</div><!-- end api-info-block -->
<!-- ======== START OF CLASS DATA ======== -->
<div id="jd-header">
public
class
<h1 itemprop="name">SyncStateContract</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-5">
<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">android.provider.SyncStateContract</td>
</tr>
</table>
<div class="jd-descr">
<h2>Class Overview</h2>
<p itemprop="articleBody">The ContentProvider contract for associating data with ana data array account.
This may be used by providers that want to store this data in a standard way.
</p>
</div><!-- jd-descr -->
<div class="jd-descr">
<h2>Summary</h2>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<table id="nestedclasses" class="jd-sumtable"><tr><th colspan="12">Nested Classes</th></tr>
<tr class="alt-color api apilevel-5" >
<td class="jd-typecol"><nobr>
interface</nobr></td>
<td class="jd-linkcol"><a href="../../../reference/android/provider/SyncStateContract.Columns.html">SyncStateContract.Columns</a></td>
<td class="jd-descrcol" width="100%"> </td>
</tr>
<tr class=" api apilevel-5" >
<td class="jd-typecol"><nobr>
class</nobr></td>
<td class="jd-linkcol"><a href="../../../reference/android/provider/SyncStateContract.Constants.html">SyncStateContract.Constants</a></td>
<td class="jd-descrcol" width="100%"> </td>
</tr>
<tr class="alt-color api apilevel-5" >
<td class="jd-typecol"><nobr>
class</nobr></td>
<td class="jd-linkcol"><a href="../../../reference/android/provider/SyncStateContract.Helpers.html">SyncStateContract.Helpers</a></td>
<td class="jd-descrcol" width="100%"> </td>
</tr>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<table id="pubctors" class="jd-sumtable"><tr><th colspan="12">Public Constructors</th></tr>
<tr class="alt-color api apilevel-5" >
<td class="jd-typecol"><nobr>
</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../reference/android/provider/SyncStateContract.html#SyncStateContract()">SyncStateContract</a></span>()</nobr>
</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 ======== -->
<h2>Public Constructors</h2>
<A NAME="SyncStateContract()"></A>
<div class="jd-details api apilevel-5">
<h4 class="jd-details-title">
<span class="normal">
public
</span>
<span class="sympad">SyncStateContract</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 5</a></div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p></p></div>
</div>
</div>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- Protected ctors -->
<!-- ========= METHOD DETAIL ======== -->
<!-- Public methdos -->
<!-- ========= 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>
| mit |
inventree/InvenTree | InvenTree/build/apps.py | 150 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class BuildConfig(AppConfig):
name = 'build'
| mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.