hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 98
values | lang stringclasses 21
values | max_stars_repo_path stringlengths 3 945 | max_stars_repo_name stringlengths 4 118 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 945 | max_issues_repo_name stringlengths 4 118 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 945 | max_forks_repo_name stringlengths 4 135 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1 1.03M | max_line_length int64 2 1.03M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5b0912d5b74c19e6986c7e1b5e039af6e1e9939c | 28 | cxx | C++ | src/interfaces/interfaces.cxx | adelindobre/upm | dc45cd78595c7c24c8a8574c63bb48b5bb99c5aa | [
"MIT"
] | 2 | 2017-06-19T13:14:30.000Z | 2018-07-12T06:17:49.000Z | src/interfaces/interfaces.cxx | adelindobre/upm | dc45cd78595c7c24c8a8574c63bb48b5bb99c5aa | [
"MIT"
] | 1 | 2018-11-13T18:03:56.000Z | 2018-11-14T18:17:57.000Z | src/interfaces/interfaces.cxx | adelindobre/upm | dc45cd78595c7c24c8a8574c63bb48b5bb99c5aa | [
"MIT"
] | 4 | 2017-03-06T14:39:59.000Z | 2018-06-28T11:07:41.000Z | #include "iLightSensor.hpp"
| 14 | 27 | 0.785714 |
ba3d348e4f9c549630e17be3a9e2f9bdddc15cb8 | 1,182 | go | Go | main/main.go | cdfmlr/stus | ae8c3fa77040a43cafe8f5f19323fd616fd9894f | [
"Apache-2.0"
] | null | null | null | main/main.go | cdfmlr/stus | ae8c3fa77040a43cafe8f5f19323fd616fd9894f | [
"Apache-2.0"
] | null | null | null | main/main.go | cdfmlr/stus | ae8c3fa77040a43cafe8f5f19323fd616fd9894f | [
"Apache-2.0"
] | null | null | null | // Copyright (c) 2020 CDFMLR. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
package main
import (
"flag"
"fmt"
"net/http"
"strconv"
"stus/data"
"stus/service"
)
func main() {
var port int
var staticDir string
var dbDialect string
var dbSource string
flag.IntVar(&port, "port", 9001, "`port` for service")
flag.StringVar(&staticDir, "static", "./static", "static (web ui) `dist` path")
flag.StringVar(&dbDialect, "db_dialect", "mysql", "`dialect` of database. Expect one of mssql, mysql, postgres and sqlite")
flag.StringVar(&dbSource, "db_source", "c:000123@/stus?charset=utf8&parseTime=True&loc=Local", "database `source`")
flag.Parse()
database := data.NewDatabase(dbDialect, dbSource)
db, err := database.Open()
if err != nil {
panic(err)
}
server := service.NewService(db, staticDir)
fmt.Println("Listen and serve at http://0.0.0.0:" + strconv.Itoa(port))
err = http.ListenAndServe(":"+strconv.Itoa(port), server)
if err != nil {
panic(err)
}
}
| 26.863636 | 124 | 0.693739 |
c0735561ac5aeba9eb98aca4aef2f602646addfc | 368,182 | html | HTML | Web/yui2/docs/button.js.html | Inflectra/library-information-system | f6417125fb0339463a0b821f1bb5138af51477c2 | [
"Apache-2.0"
] | 17 | 2015-02-10T15:32:59.000Z | 2022-03-27T20:01:14.000Z | Web/yui2/docs/button.js.html | Inflectra/library-information-system | f6417125fb0339463a0b821f1bb5138af51477c2 | [
"Apache-2.0"
] | 34 | 2015-01-07T22:42:00.000Z | 2020-11-15T17:45:50.000Z | Web/yui2/docs/button.js.html | Inflectra/library-information-system | f6417125fb0339463a0b821f1bb5138af51477c2 | [
"Apache-2.0"
] | 11 | 2015-02-06T22:06:10.000Z | 2022-03-27T20:12:30.000Z | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>API: button button.js (YUI Library)</title>
<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" />
<link rel="stylesheet" type="text/css" href="assets/api.css" />
<script type="text/javascript" src="assets/api-js"></script>
<script type="text/javascript" src="assets/ac-js"></script>
</head>
<body id="yahoo-com">
<div id="doc3" class="yui-t2">
<div id="hd">
<h1><a href="http://developer.yahoo.com/yui/" title="Yahoo! UI Library">Yahoo! UI Library</a></h1>
<h3>Button <span class="subtitle">2.8.0r4</span></h3>
<a href="./index.html" title="Yahoo! UI Library">Yahoo! UI Library</a>
> <a href="./module_button.html" title="button">button</a>
> button.js (source view)
<form onsubmit="return false">
<div id="propertysearch">
Search: <input autocomplete="off" id="searchinput" />
<div id="searchresults">
</div>
</div>
</form>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
<fieldset>
<legend>Filters</legend>
<span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
<span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
<span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
</fieldset>
</form>
<div id="srcout">
<style>
#doc3 .classopts { display:none; }
</style>
<div class="highlight" ><pre><span class="c">/**</span>
<span class="c">* @module button</span>
<span class="c">* @description <p>The Button Control enables the creation of rich, graphical </span>
<span class="c">* buttons that function like traditional HTML form buttons. <em>Unlike</em> </span>
<span class="c">* traditional HTML form buttons, buttons created with the Button Control can have </span>
<span class="c">* a label that is different from its value. With the inclusion of the optional </span>
<span class="c">* <a href="module_menu.html">Menu Control</a>, the Button Control can also be</span>
<span class="c">* used to create menu buttons and split buttons, controls that are not </span>
<span class="c">* available natively in HTML. The Button Control can also be thought of as a </span>
<span class="c">* way to create more visually engaging implementations of the browser's </span>
<span class="c">* default radio-button and check-box controls.</p></span>
<span class="c">* <p>The Button Control supports the following types:</p></span>
<span class="c">* <dl></span>
<span class="c">* <dt>push</dt></span>
<span class="c">* <dd>Basic push button that can execute a user-specified command when </span>
<span class="c">* pressed.</dd></span>
<span class="c">* <dt>link</dt></span>
<span class="c">* <dd>Navigates to a specified url when pressed.</dd></span>
<span class="c">* <dt>submit</dt></span>
<span class="c">* <dd>Submits the parent form when pressed.</dd></span>
<span class="c">* <dt>reset</dt></span>
<span class="c">* <dd>Resets the parent form when pressed.</dd></span>
<span class="c">* <dt>checkbox</dt></span>
<span class="c">* <dd>Maintains a "checked" state that can be toggled on and off.</dd></span>
<span class="c">* <dt>radio</dt></span>
<span class="c">* <dd>Maintains a "checked" state that can be toggled on and off. Use with </span>
<span class="c">* the ButtonGroup class to create a set of controls that are mutually </span>
<span class="c">* exclusive; checking one button in the set will uncheck all others in </span>
<span class="c">* the group.</dd></span>
<span class="c">* <dt>menu</dt></span>
<span class="c">* <dd>When pressed will show/hide a menu.</dd></span>
<span class="c">* <dt>split</dt></span>
<span class="c">* <dd>Can execute a user-specified command or display a menu when pressed.</dd></span>
<span class="c">* </dl></span>
<span class="c">* @title Button</span>
<span class="c">* @namespace YAHOO.widget</span>
<span class="c">* @requires yahoo, dom, element, event</span>
<span class="c">* @optional container, menu</span>
<span class="c">*/</span>
<span class="o">(</span><span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="c">/**</span>
<span class="c"> * The Button class creates a rich, graphical button.</span>
<span class="c"> * @param {String} p_oElement String specifying the id attribute of the </span>
<span class="c"> * <code>&#60;input&#62;</code>, <code>&#60;button&#62;</code>,</span>
<span class="c"> * <code>&#60;a&#62;</code>, or <code>&#60;span&#62;</code> element to </span>
<span class="c"> * be used to create the button.</span>
<span class="c"> * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c"> * one-html.html#ID-6043025">HTMLInputElement</a>|<a href="http://www.w3.org</span>
<span class="c"> * /TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-34812697"></span>
<span class="c"> * HTMLButtonElement</a>|<a href="</span>
<span class="c"> * http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#</span>
<span class="c"> * ID-33759296">HTMLElement</a>} p_oElement Object reference for the </span>
<span class="c"> * <code>&#60;input&#62;</code>, <code>&#60;button&#62;</code>, </span>
<span class="c"> * <code>&#60;a&#62;</code>, or <code>&#60;span&#62;</code> element to be </span>
<span class="c"> * used to create the button.</span>
<span class="c"> * @param {Object} p_oElement Object literal specifying a set of </span>
<span class="c"> * configuration attributes used to create the button.</span>
<span class="c"> * @param {Object} p_oAttributes Optional. Object literal specifying a set </span>
<span class="c"> * of configuration attributes used to create the button.</span>
<span class="c"> * @namespace YAHOO.widget</span>
<span class="c"> * @class Button</span>
<span class="c"> * @constructor</span>
<span class="c"> * @extends YAHOO.util.Element</span>
<span class="c"> */</span>
<span class="c">// Shorthard for utilities</span>
<span class="c"></span>
<span class="k">var</span> <span class="nx">Dom</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">,</span>
<span class="nx">Event</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">,</span>
<span class="nx">Lang</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">,</span>
<span class="nx">UA</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">env</span><span class="o">.</span><span class="nx">ua</span><span class="o">,</span>
<span class="nx">Overlay</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Overlay</span><span class="o">,</span>
<span class="nx">Menu</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Menu</span><span class="o">,</span>
<span class="c">// Private member variables</span>
<span class="c"></span>
<span class="nx">m_oButtons</span> <span class="o">=</span> <span class="o">{},</span> <span class="c">// Collection of all Button instances</span>
<span class="c"></span> <span class="nx">m_oOverlayManager</span> <span class="o">=</span> <span class="kc">null</span><span class="o">,</span> <span class="c">// YAHOO.widget.OverlayManager instance</span>
<span class="c"></span> <span class="nx">m_oSubmitTrigger</span> <span class="o">=</span> <span class="kc">null</span><span class="o">,</span> <span class="c">// The button that submitted the form </span>
<span class="c"></span> <span class="nx">m_oFocusedButton</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span> <span class="c">// The button that has focus</span>
<span class="c"></span>
<span class="c">// Private methods</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c"> * @method createInputElement</span>
<span class="c"> * @description Creates an <code>&#60;input&#62;</code> element of the </span>
<span class="c"> * specified type.</span>
<span class="c"> * @private</span>
<span class="c"> * @param {String} p_sType String specifying the type of </span>
<span class="c"> * <code>&#60;input&#62;</code> element to create.</span>
<span class="c"> * @param {String} p_sName String specifying the name of </span>
<span class="c"> * <code>&#60;input&#62;</code> element to create.</span>
<span class="c"> * @param {String} p_sValue String specifying the value of </span>
<span class="c"> * <code>&#60;input&#62;</code> element to create.</span>
<span class="c"> * @param {String} p_bChecked Boolean specifying if the </span>
<span class="c"> * <code>&#60;input&#62;</code> element is to be checked.</span>
<span class="c"> * @return {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c"> * one-html.html#ID-6043025">HTMLInputElement</a>}</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">createInputElement</span><span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_sName</span><span class="o">,</span> <span class="nx">p_sValue</span><span class="o">,</span> <span class="nx">p_bChecked</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oInput</span><span class="o">,</span>
<span class="nx">sInput</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">p_sType</span><span class="o">)</span> <span class="o">&&</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">p_sName</span><span class="o">))</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">UA</span><span class="o">.</span><span class="nx">ie</span><span class="o">)</span> <span class="o">{</span>
<span class="c">/*</span>
<span class="c"> For IE it is necessary to create the element with the </span>
<span class="c"> "type," "name," "value," and "checked" properties set all </span>
<span class="c"> at once.</span>
<span class="c"> */</span>
<span class="nx">sInput</span> <span class="o">=</span> <span class="s2">"<input type=\""</span> <span class="o">+</span> <span class="nx">p_sType</span> <span class="o">+</span> <span class="s2">"\" name=\""</span> <span class="o">+</span>
<span class="nx">p_sName</span> <span class="o">+</span> <span class="s2">"\""</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_bChecked</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">sInput</span> <span class="o">+=</span> <span class="s2">" checked"</span><span class="o">;</span>
<span class="o">}</span>
<span class="nx">sInput</span> <span class="o">+=</span> <span class="s2">">"</span><span class="o">;</span>
<span class="nx">oInput</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="nx">sInput</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">oInput</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">"input"</span><span class="o">);</span>
<span class="nx">oInput</span><span class="o">.</span><span class="nx">name</span> <span class="o">=</span> <span class="nx">p_sName</span><span class="o">;</span>
<span class="nx">oInput</span><span class="o">.</span><span class="nx">type</span> <span class="o">=</span> <span class="nx">p_sType</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_bChecked</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oInput</span><span class="o">.</span><span class="nx">checked</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="nx">oInput</span><span class="o">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">p_sValue</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">oInput</span><span class="o">;</span>
<span class="o">}</span>
<span class="c">/**</span>
<span class="c"> * @method setAttributesFromSrcElement</span>
<span class="c"> * @description Gets the values for all the attributes of the source element </span>
<span class="c"> * (either <code>&#60;input&#62;</code> or <code>&#60;a&#62;</code>) that </span>
<span class="c"> * map to Button configuration attributes and sets them into a collection </span>
<span class="c"> * that is passed to the Button constructor.</span>
<span class="c"> * @private</span>
<span class="c"> * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c"> * one-html.html#ID-6043025">HTMLInputElement</a>|<a href="http://www.w3.org/</span>
<span class="c"> * TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-</span>
<span class="c"> * 48250443">HTMLAnchorElement</a>} p_oElement Object reference to the HTML </span>
<span class="c"> * element (either <code>&#60;input&#62;</code> or <code>&#60;span&#62;</span>
<span class="c"> * </code>) used to create the button.</span>
<span class="c"> * @param {Object} p_oAttributes Object reference for the collection of </span>
<span class="c"> * configuration attributes used to create the button.</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">setAttributesFromSrcElement</span><span class="o">(</span><span class="nx">p_oElement</span><span class="o">,</span> <span class="nx">p_oAttributes</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sSrcElementNodeName</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">(),</span>
<span class="nx">sClass</span> <span class="o">=</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">CLASS_NAME_PREFIX</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">CSS_CLASS_NAME</span><span class="o">),</span>
<span class="nx">me</span> <span class="o">=</span> <span class="k">this</span><span class="o">,</span>
<span class="nx">oAttribute</span><span class="o">,</span>
<span class="nx">oRootNode</span><span class="o">,</span>
<span class="nx">sText</span><span class="o">;</span>
<span class="c">/**</span>
<span class="c"> * @method setAttributeFromDOMAttribute</span>
<span class="c"> * @description Gets the value of the specified DOM attribute and sets it </span>
<span class="c"> * into the collection of configuration attributes used to configure </span>
<span class="c"> * the button.</span>
<span class="c"> * @private</span>
<span class="c"> * @param {String} p_sAttribute String representing the name of the </span>
<span class="c"> * attribute to retrieve from the DOM element.</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">setAttributeFromDOMAttribute</span><span class="o">(</span><span class="nx">p_sAttribute</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(!(</span><span class="nx">p_sAttribute</span> <span class="k">in</span> <span class="nx">p_oAttributes</span><span class="o">))</span> <span class="o">{</span>
<span class="c">/*</span>
<span class="c"> Need to use "getAttributeNode" instead of "getAttribute" </span>
<span class="c"> because using "getAttribute," IE will return the innerText </span>
<span class="c"> of a <code>&#60;button&#62;</code> for the value attribute </span>
<span class="c"> rather than the value of the "value" attribute.</span>
<span class="c"> */</span>
<span class="nx">oAttribute</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">getAttributeNode</span><span class="o">(</span><span class="nx">p_sAttribute</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oAttribute</span> <span class="o">&&</span> <span class="o">(</span><span class="s2">"value"</span> <span class="k">in</span> <span class="nx">oAttribute</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Setting attribute \""</span> <span class="o">+</span> <span class="nx">p_sAttribute</span> <span class="o">+</span>
<span class="s2">"\" using source element's attribute value of \""</span> <span class="o">+</span>
<span class="nx">oAttribute</span><span class="o">.</span><span class="nx">value</span> <span class="o">+</span> <span class="s2">"\""</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="nx">me</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="nx">p_oAttributes</span><span class="o">[</span><span class="nx">p_sAttribute</span><span class="o">]</span> <span class="o">=</span> <span class="nx">oAttribute</span><span class="o">.</span><span class="nx">value</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="c">/**</span>
<span class="c"> * @method setFormElementProperties</span>
<span class="c"> * @description Gets the value of the attributes from the form element </span>
<span class="c"> * and sets them into the collection of configuration attributes used to </span>
<span class="c"> * configure the button.</span>
<span class="c"> * @private</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">setFormElementProperties</span><span class="o">()</span> <span class="o">{</span>
<span class="nx">setAttributeFromDOMAttribute</span><span class="o">(</span><span class="s2">"type"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_oAttributes</span><span class="o">.</span><span class="nx">type</span> <span class="o">==</span> <span class="s2">"button"</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">p_oAttributes</span><span class="o">.</span><span class="nx">type</span> <span class="o">=</span> <span class="s2">"push"</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(!(</span><span class="s2">"disabled"</span> <span class="k">in</span> <span class="nx">p_oAttributes</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">p_oAttributes</span><span class="o">.</span><span class="nx">disabled</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">disabled</span><span class="o">;</span>
<span class="o">}</span>
<span class="nx">setAttributeFromDOMAttribute</span><span class="o">(</span><span class="s2">"name"</span><span class="o">);</span>
<span class="nx">setAttributeFromDOMAttribute</span><span class="o">(</span><span class="s2">"value"</span><span class="o">);</span>
<span class="nx">setAttributeFromDOMAttribute</span><span class="o">(</span><span class="s2">"title"</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">switch</span> <span class="o">(</span><span class="nx">sSrcElementNodeName</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">case</span> <span class="s2">"A"</span><span class="o">:</span>
<span class="nx">p_oAttributes</span><span class="o">.</span><span class="nx">type</span> <span class="o">=</span> <span class="s2">"link"</span><span class="o">;</span>
<span class="nx">setAttributeFromDOMAttribute</span><span class="o">(</span><span class="s2">"href"</span><span class="o">);</span>
<span class="nx">setAttributeFromDOMAttribute</span><span class="o">(</span><span class="s2">"target"</span><span class="o">);</span>
<span class="k">break</span><span class="o">;</span>
<span class="nx">case</span> <span class="s2">"INPUT"</span><span class="o">:</span>
<span class="nx">setFormElementProperties</span><span class="o">();</span>
<span class="k">if</span> <span class="o">(!(</span><span class="s2">"checked"</span> <span class="k">in</span> <span class="nx">p_oAttributes</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">p_oAttributes</span><span class="o">.</span><span class="nx">checked</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">checked</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">break</span><span class="o">;</span>
<span class="nx">case</span> <span class="s2">"BUTTON"</span><span class="o">:</span>
<span class="nx">setFormElementProperties</span><span class="o">();</span>
<span class="nx">oRootNode</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">hasClass</span><span class="o">(</span><span class="nx">oRootNode</span><span class="o">,</span> <span class="nx">sClass</span> <span class="o">+</span> <span class="s2">"-checked"</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">p_oAttributes</span><span class="o">.</span><span class="nx">checked</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">hasClass</span><span class="o">(</span><span class="nx">oRootNode</span><span class="o">,</span> <span class="nx">sClass</span> <span class="o">+</span> <span class="s2">"-disabled"</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">p_oAttributes</span><span class="o">.</span><span class="nx">disabled</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
<span class="nx">p_oElement</span><span class="o">.</span><span class="nx">removeAttribute</span><span class="o">(</span><span class="s2">"value"</span><span class="o">);</span>
<span class="nx">p_oElement</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="s2">"type"</span><span class="o">,</span> <span class="s2">"button"</span><span class="o">);</span>
<span class="k">break</span><span class="o">;</span>
<span class="o">}</span>
<span class="nx">p_oElement</span><span class="o">.</span><span class="nx">removeAttribute</span><span class="o">(</span><span class="s2">"id"</span><span class="o">);</span>
<span class="nx">p_oElement</span><span class="o">.</span><span class="nx">removeAttribute</span><span class="o">(</span><span class="s2">"name"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(!(</span><span class="s2">"tabindex"</span> <span class="k">in</span> <span class="nx">p_oAttributes</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">p_oAttributes</span><span class="o">.</span><span class="nx">tabindex</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">tabIndex</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(!(</span><span class="s2">"label"</span> <span class="k">in</span> <span class="nx">p_oAttributes</span><span class="o">))</span> <span class="o">{</span>
<span class="c">// Set the "label" property</span>
<span class="c"></span>
<span class="nx">sText</span> <span class="o">=</span> <span class="nx">sSrcElementNodeName</span> <span class="o">==</span> <span class="s2">"INPUT"</span> <span class="o">?</span>
<span class="nx">p_oElement</span><span class="o">.</span><span class="nx">value</span> <span class="o">:</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">innerHTML</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sText</span> <span class="o">&&</span> <span class="nx">sText</span><span class="o">.</span><span class="nx">length</span> <span class="o">></span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">p_oAttributes</span><span class="o">.</span><span class="k">label</span> <span class="o">=</span> <span class="nx">sText</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="c">/**</span>
<span class="c"> * @method initConfig</span>
<span class="c"> * @description Initializes the set of configuration attributes that are </span>
<span class="c"> * used to instantiate the button.</span>
<span class="c"> * @private</span>
<span class="c"> * @param {Object} Object representing the button's set of </span>
<span class="c"> * configuration attributes.</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">initConfig</span><span class="o">(</span><span class="nx">p_oConfig</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oAttributes</span> <span class="o">=</span> <span class="nx">p_oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">,</span>
<span class="nx">oSrcElement</span> <span class="o">=</span> <span class="nx">oAttributes</span><span class="o">.</span><span class="nx">srcelement</span><span class="o">,</span>
<span class="nx">sSrcElementNodeName</span> <span class="o">=</span> <span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">(),</span>
<span class="nx">me</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sSrcElementNodeName</span> <span class="o">==</span> <span class="k">this</span><span class="o">.</span><span class="nx">NODE_NAME</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">p_oConfig</span><span class="o">.</span><span class="nx">element</span> <span class="o">=</span> <span class="nx">oSrcElement</span><span class="o">;</span>
<span class="nx">p_oConfig</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">id</span><span class="o">;</span>
<span class="nx">Dom</span><span class="o">.</span><span class="nx">getElementsBy</span><span class="o">(</span><span class="k">function</span> <span class="o">(</span><span class="nx">p_oElement</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">switch</span> <span class="o">(</span><span class="nx">p_oElement</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">())</span> <span class="o">{</span>
<span class="nx">case</span> <span class="s2">"BUTTON"</span><span class="o">:</span>
<span class="nx">case</span> <span class="s2">"A"</span><span class="o">:</span>
<span class="nx">case</span> <span class="s2">"INPUT"</span><span class="o">:</span>
<span class="nx">setAttributesFromSrcElement</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="nx">me</span><span class="o">,</span> <span class="nx">p_oElement</span><span class="o">,</span>
<span class="nx">oAttributes</span><span class="o">);</span>
<span class="k">break</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">},</span> <span class="s2">"*"</span><span class="o">,</span> <span class="nx">oSrcElement</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">switch</span> <span class="o">(</span><span class="nx">sSrcElementNodeName</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">case</span> <span class="s2">"BUTTON"</span><span class="o">:</span>
<span class="nx">case</span> <span class="s2">"A"</span><span class="o">:</span>
<span class="nx">case</span> <span class="s2">"INPUT"</span><span class="o">:</span>
<span class="nx">setAttributesFromSrcElement</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">oSrcElement</span><span class="o">,</span>
<span class="nx">oAttributes</span><span class="o">);</span>
<span class="k">break</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="c">// Constructor</span>
<span class="c"></span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Button</span> <span class="o">=</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oElement</span><span class="o">,</span> <span class="nx">p_oAttributes</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">Overlay</span> <span class="o">&&</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Overlay</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Overlay</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Overlay</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">Menu</span> <span class="o">&&</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Menu</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Menu</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Menu</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">var</span> <span class="nx">fnSuperClass</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Button</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">constructor</span><span class="o">,</span>
<span class="nx">oConfig</span><span class="o">,</span>
<span class="nx">oElement</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">arguments</span><span class="o">.</span><span class="nx">length</span> <span class="o">==</span> <span class="m">1</span> <span class="o">&&</span> <span class="o">!</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">p_oElement</span><span class="o">)</span> <span class="o">&&</span> <span class="o">!</span><span class="nx">p_oElement</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">p_oElement</span><span class="o">.</span><span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">p_oElement</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">generateId</span><span class="o">();</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"No value specified for the button's \"id\" "</span> <span class="o">+</span>
<span class="s2">"attribute. Setting button id to \""</span> <span class="o">+</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">id</span> <span class="o">+</span>
<span class="s2">"\"."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="o">}</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"No source HTML element. Building the button "</span> <span class="o">+</span>
<span class="s2">"using the set of configuration attributes."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="nx">fnSuperClass</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">createButtonElement</span><span class="o">(</span><span class="nx">p_oElement</span><span class="o">.</span><span class="nx">type</span><span class="o">)),</span> <span class="nx">p_oElement</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">oConfig</span> <span class="o">=</span> <span class="o">{</span> <span class="nx">element</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span> <span class="nx">attributes</span><span class="o">:</span> <span class="o">(</span><span class="nx">p_oAttributes</span> <span class="o">||</span> <span class="o">{})</span> <span class="o">};</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">p_oElement</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">oElement</span> <span class="o">=</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">p_oElement</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oElement</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">.</span><span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">;</span>
<span class="o">}</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Building the button using an existing "</span> <span class="o">+</span>
<span class="s2">"HTML element as a source element."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="nx">oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">.</span><span class="nx">srcelement</span> <span class="o">=</span> <span class="nx">oElement</span><span class="o">;</span>
<span class="nx">initConfig</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">oConfig</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">element</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Source element could not be used "</span> <span class="o">+</span>
<span class="s2">"as is. Creating a new HTML element for "</span> <span class="o">+</span>
<span class="s2">"the button."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="nx">oConfig</span><span class="o">.</span><span class="nx">element</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">createButtonElement</span><span class="o">(</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">.</span><span class="nx">type</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">fnSuperClass</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">oConfig</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="nx">oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">p_oElement</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">.</span><span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_oElement</span><span class="o">.</span><span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">id</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">generateId</span><span class="o">();</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"No value specified for the button's "</span> <span class="o">+</span>
<span class="s2">"\"id\" attribute. Setting button id to \""</span> <span class="o">+</span>
<span class="nx">oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">.</span><span class="nx">id</span> <span class="o">+</span> <span class="s2">"\"."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Building the button using an existing HTML "</span> <span class="o">+</span>
<span class="s2">"element as a source element."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="nx">oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">.</span><span class="nx">srcelement</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">;</span>
<span class="nx">initConfig</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">oConfig</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">element</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Source element could not be used as is."</span> <span class="o">+</span>
<span class="s2">" Creating a new HTML element for the button."</span><span class="o">,</span>
<span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="nx">oConfig</span><span class="o">.</span><span class="nx">element</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">createButtonElement</span><span class="o">(</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">.</span><span class="nx">type</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">fnSuperClass</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">oConfig</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="nx">oConfig</span><span class="o">.</span><span class="nx">attributes</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">};</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">extend</span><span class="o">(</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Button</span><span class="o">,</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Element</span><span class="o">,</span> <span class="o">{</span>
<span class="c">// Protected properties</span>
<span class="c"></span>
<span class="c">/** </span>
<span class="c"> * @property _button</span>
<span class="c"> * @description Object reference to the button's internal </span>
<span class="c"> * <code>&#60;a&#62;</code> or <code>&#60;button&#62;</code> element.</span>
<span class="c"> * @default null</span>
<span class="c"> * @protected</span>
<span class="c"> * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c"> * level-one-html.html#ID-48250443">HTMLAnchorElement</a>|<a href="</span>
<span class="c"> * http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html</span>
<span class="c"> * #ID-34812697">HTMLButtonElement</a></span>
<span class="c"> */</span>
<span class="nx">_button</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/** </span>
<span class="c"> * @property _menu</span>
<span class="c"> * @description Object reference to the button's menu.</span>
<span class="c"> * @default null</span>
<span class="c"> * @protected</span>
<span class="c"> * @type {<a href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a>|</span>
<span class="c"> * <a href="YAHOO.widget.Menu.html">YAHOO.widget.Menu</a>}</span>
<span class="c"> */</span>
<span class="nx">_menu</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/** </span>
<span class="c"> * @property _hiddenFields</span>
<span class="c"> * @description Object reference to the <code>&#60;input&#62;</code> </span>
<span class="c"> * element, or array of HTML form elements used to represent the button</span>
<span class="c"> * when its parent form is submitted.</span>
<span class="c"> * @default null</span>
<span class="c"> * @protected</span>
<span class="c"> * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c"> * level-one-html.html#ID-6043025">HTMLInputElement</a>|Array</span>
<span class="c"> */</span>
<span class="nx">_hiddenFields</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/** </span>
<span class="c"> * @property _onclickAttributeValue</span>
<span class="c"> * @description Object reference to the button's current value for the </span>
<span class="c"> * "onclick" configuration attribute.</span>
<span class="c"> * @default null</span>
<span class="c"> * @protected</span>
<span class="c"> * @type Object</span>
<span class="c"> */</span>
<span class="nx">_onclickAttributeValue</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="c">/** </span>
<span class="c"> * @property _activationKeyPressed</span>
<span class="c"> * @description Boolean indicating if the key(s) that toggle the button's </span>
<span class="c"> * "active" state have been pressed.</span>
<span class="c"> * @default false</span>
<span class="c"> * @protected</span>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="nx">_activationKeyPressed</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
<span class="c">/** </span>
<span class="c"> * @property _activationButtonPressed</span>
<span class="c"> * @description Boolean indicating if the mouse button that toggles </span>
<span class="c"> * the button's "active" state has been pressed.</span>
<span class="c"> * @default false</span>
<span class="c"> * @protected</span>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="nx">_activationButtonPressed</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
<span class="c">/** </span>
<span class="c"> * @property _hasKeyEventHandlers</span>
<span class="c"> * @description Boolean indicating if the button's "blur", "keydown" and </span>
<span class="c"> * "keyup" event handlers are assigned</span>
<span class="c"> * @default false</span>
<span class="c"> * @protected</span>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="nx">_hasKeyEventHandlers</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
<span class="c">/** </span>
<span class="c"> * @property _hasMouseEventHandlers</span>
<span class="c"> * @description Boolean indicating if the button's "mouseout," </span>
<span class="c"> * "mousedown," and "mouseup" event handlers are assigned</span>
<span class="c"> * @default false</span>
<span class="c"> * @protected</span>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="nx">_hasMouseEventHandlers</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
<span class="c">/** </span>
<span class="c"> * @property _nOptionRegionX</span>
<span class="c"> * @description Number representing the X coordinate of the leftmost edge of the Button's </span>
<span class="c"> * option region. Applies only to Buttons of type "split".</span>
<span class="c"> * @default 0</span>
<span class="c"> * @protected</span>
<span class="c"> * @type Number</span>
<span class="c"> */</span>
<span class="nx">_nOptionRegionX</span><span class="o">:</span> <span class="m">0</span><span class="o">,</span>
<span class="c">// Constants</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c"> * @property CLASS_NAME_PREFIX</span>
<span class="c"> * @description Prefix used for all class names applied to a Button.</span>
<span class="c"> * @default "yui-"</span>
<span class="c"> * @final</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="nx">CLASS_NAME_PREFIX</span><span class="o">:</span> <span class="s2">"yui-"</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @property NODE_NAME</span>
<span class="c"> * @description The name of the node to be used for the button's </span>
<span class="c"> * root element.</span>
<span class="c"> * @default "SPAN"</span>
<span class="c"> * @final</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="nx">NODE_NAME</span><span class="o">:</span> <span class="s2">"SPAN"</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @property CHECK_ACTIVATION_KEYS</span>
<span class="c"> * @description Array of numbers representing keys that (when pressed) </span>
<span class="c"> * toggle the button's "checked" attribute.</span>
<span class="c"> * @default [32]</span>
<span class="c"> * @final</span>
<span class="c"> * @type Array</span>
<span class="c"> */</span>
<span class="nx">CHECK_ACTIVATION_KEYS</span><span class="o">:</span> <span class="o">[</span><span class="m">32</span><span class="o">],</span>
<span class="c">/**</span>
<span class="c"> * @property ACTIVATION_KEYS</span>
<span class="c"> * @description Array of numbers representing keys that (when presed) </span>
<span class="c"> * toggle the button's "active" state.</span>
<span class="c"> * @default [13, 32]</span>
<span class="c"> * @final</span>
<span class="c"> * @type Array</span>
<span class="c"> */</span>
<span class="nx">ACTIVATION_KEYS</span><span class="o">:</span> <span class="o">[</span><span class="m">13</span><span class="o">,</span> <span class="m">32</span><span class="o">],</span>
<span class="c">/**</span>
<span class="c"> * @property OPTION_AREA_WIDTH</span>
<span class="c"> * @description Width (in pixels) of the area of a split button that </span>
<span class="c"> * when pressed will display a menu.</span>
<span class="c"> * @default 20</span>
<span class="c"> * @final</span>
<span class="c"> * @type Number</span>
<span class="c"> */</span>
<span class="nx">OPTION_AREA_WIDTH</span><span class="o">:</span> <span class="m">20</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @property CSS_CLASS_NAME</span>
<span class="c"> * @description String representing the CSS class(es) to be applied to </span>
<span class="c"> * the button's root element.</span>
<span class="c"> * @default "button"</span>
<span class="c"> * @final</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="nx">CSS_CLASS_NAME</span><span class="o">:</span> <span class="s2">"button"</span><span class="o">,</span>
<span class="c">// Protected attribute setter methods</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c"> * @method _setType</span>
<span class="c"> * @description Sets the value of the button's "type" attribute.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {String} p_sType String indicating the value for the button's </span>
<span class="c"> * "type" attribute.</span>
<span class="c"> */</span>
<span class="nx">_setType</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sType</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_sType</span> <span class="o">==</span> <span class="s2">"split"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"option"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onOption</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _setLabel</span>
<span class="c"> * @description Sets the value of the button's "label" attribute.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {String} p_sLabel String indicating the value for the button's </span>
<span class="c"> * "label" attribute.</span>
<span class="c"> */</span>
<span class="nx">_setLabel</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sLabel</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">p_sLabel</span><span class="o">;</span>
<span class="c">/*</span>
<span class="c"> Remove and add the default class name from the root element</span>
<span class="c"> for Gecko to ensure that the button shrinkwraps to the label.</span>
<span class="c"> Without this the button will not be rendered at the correct </span>
<span class="c"> width when the label changes. The most likely cause for this </span>
<span class="c"> bug is button's use of the Gecko-specific CSS display type of </span>
<span class="c"> "-moz-inline-box" to simulate "inline-block" supported by IE, </span>
<span class="c"> Safari and Opera.</span>
<span class="c"> */</span>
<span class="k">var</span> <span class="nx">sClass</span><span class="o">,</span>
<span class="nx">nGeckoVersion</span> <span class="o">=</span> <span class="nx">UA</span><span class="o">.</span><span class="nx">gecko</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">nGeckoVersion</span> <span class="o">&&</span> <span class="nx">nGeckoVersion</span> <span class="o"><</span> <span class="m">1</span><span class="o">.</span><span class="m">9</span> <span class="o">&&</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">inDocument</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"element"</span><span class="o">)))</span> <span class="o">{</span>
<span class="nx">sClass</span> <span class="o">=</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">CLASS_NAME_PREFIX</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">CSS_CLASS_NAME</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="nx">sClass</span><span class="o">);</span>
<span class="nx">Lang</span><span class="o">.</span><span class="nx">later</span><span class="o">(</span><span class="m">0</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">addClass</span><span class="o">,</span> <span class="nx">sClass</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _setTabIndex</span>
<span class="c"> * @description Sets the value of the button's "tabindex" attribute.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Number} p_nTabIndex Number indicating the value for the </span>
<span class="c"> * button's "tabindex" attribute.</span>
<span class="c"> */</span>
<span class="nx">_setTabIndex</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_nTabIndex</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">.</span><span class="nx">tabIndex</span> <span class="o">=</span> <span class="nx">p_nTabIndex</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _setTitle</span>
<span class="c"> * @description Sets the value of the button's "title" attribute.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {String} p_nTabIndex Number indicating the value for </span>
<span class="c"> * the button's "title" attribute.</span>
<span class="c"> */</span>
<span class="nx">_setTitle</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sTitle</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">!=</span> <span class="s2">"link"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">.</span><span class="nx">title</span> <span class="o">=</span> <span class="nx">p_sTitle</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _setDisabled</span>
<span class="c"> * @description Sets the value of the button's "disabled" attribute.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Boolean} p_bDisabled Boolean indicating the value for </span>
<span class="c"> * the button's "disabled" attribute.</span>
<span class="c"> */</span>
<span class="nx">_setDisabled</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_bDisabled</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">!=</span> <span class="s2">"link"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_bDisabled</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_menu</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_menu</span><span class="o">.</span><span class="nx">hide</span><span class="o">();</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">hasFocus</span><span class="o">())</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">blur</span><span class="o">();</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="s2">"disabled"</span><span class="o">,</span> <span class="s2">"disabled"</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="s2">"disabled"</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"hover"</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"active"</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"focus"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">.</span><span class="nx">removeAttribute</span><span class="o">(</span><span class="s2">"disabled"</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"disabled"</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _setHref</span>
<span class="c"> * @description Sets the value of the button's "href" attribute.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {String} p_sHref String indicating the value for the button's </span>
<span class="c"> * "href" attribute.</span>
<span class="c"> */</span>
<span class="nx">_setHref</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sHref</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">==</span> <span class="s2">"link"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">.</span><span class="nx">href</span> <span class="o">=</span> <span class="nx">p_sHref</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _setTarget</span>
<span class="c"> * @description Sets the value of the button's "target" attribute.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {String} p_sTarget String indicating the value for the button's </span>
<span class="c"> * "target" attribute.</span>
<span class="c"> */</span>
<span class="nx">_setTarget</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sTarget</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">==</span> <span class="s2">"link"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="s2">"target"</span><span class="o">,</span> <span class="nx">p_sTarget</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _setChecked</span>
<span class="c"> * @description Sets the value of the button's "target" attribute.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Boolean} p_bChecked Boolean indicating the value for </span>
<span class="c"> * the button's "checked" attribute.</span>
<span class="c"> */</span>
<span class="nx">_setChecked</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_bChecked</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"checkbox"</span> <span class="o">||</span> <span class="nx">sType</span> <span class="o">==</span> <span class="s2">"radio"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_bChecked</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="s2">"checked"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"checked"</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _setMenu</span>
<span class="c"> * @description Sets the value of the button's "menu" attribute.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Object} p_oMenu Object indicating the value for the button's </span>
<span class="c"> * "menu" attribute.</span>
<span class="c"> */</span>
<span class="nx">_setMenu</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oMenu</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">bLazyLoad</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"lazyloadmenu"</span><span class="o">),</span>
<span class="nx">oButtonElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"element"</span><span class="o">),</span>
<span class="nx">sMenuCSSClassName</span><span class="o">,</span>
<span class="c">/*</span>
<span class="c"> Boolean indicating if the value of p_oMenu is an instance </span>
<span class="c"> of YAHOO.widget.Menu or YAHOO.widget.Overlay.</span>
<span class="c"> */</span>
<span class="nx">bInstance</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
<span class="nx">oMenu</span><span class="o">,</span>
<span class="nx">oMenuElement</span><span class="o">,</span>
<span class="nx">oSrcElement</span><span class="o">;</span>
<span class="k">function</span> <span class="nx">onAppendTo</span><span class="o">()</span> <span class="o">{</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">render</span><span class="o">(</span><span class="nx">oButtonElement</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="s2">"appendTo"</span><span class="o">,</span> <span class="nx">onAppendTo</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">function</span> <span class="nx">setMenuContainer</span><span class="o">()</span> <span class="o">{</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">queueProperty</span><span class="o">(</span><span class="s2">"container"</span><span class="o">,</span> <span class="nx">oButtonElement</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="s2">"appendTo"</span><span class="o">,</span> <span class="nx">setMenuContainer</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">function</span> <span class="nx">initMenu</span><span class="o">()</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oContainer</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oMenu</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">oMenu</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"menuclassname"</span><span class="o">));</span>
<span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">oMenu</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">CLASS_NAME_PREFIX</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">+</span> <span class="s2">"-button-menu"</span><span class="o">);</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">showEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_onMenuShow</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">hideEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_onMenuHide</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">renderEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_onMenuRender</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Menu</span> <span class="o">&&</span> <span class="nx">oMenu</span> <span class="k">instanceof</span> <span class="nx">Menu</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">bLazyLoad</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oContainer</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"container"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oContainer</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">queueProperty</span><span class="o">(</span><span class="s2">"container"</span><span class="o">,</span> <span class="nx">oContainer</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"appendTo"</span><span class="o">,</span> <span class="nx">setMenuContainer</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">queueProperty</span><span class="o">(</span><span class="s2">"clicktohide"</span><span class="o">,</span> <span class="kc">false</span><span class="o">);</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">keyDownEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_onMenuKeyDown</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="s2">"click"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onMenuClick</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"selectedMenuItemChange"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onSelectedMenuItemChange</span><span class="o">);</span>
<span class="nx">oSrcElement</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="o">.</span><span class="nx">srcElement</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oSrcElement</span> <span class="o">&&</span> <span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">()</span> <span class="o">==</span> <span class="s2">"SELECT"</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">"none"</span><span class="o">;</span>
<span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">oSrcElement</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">Overlay</span> <span class="o">&&</span> <span class="nx">oMenu</span> <span class="k">instanceof</span> <span class="nx">Overlay</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">m_oOverlayManager</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">m_oOverlayManager</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">OverlayManager</span><span class="o">();</span>
<span class="o">}</span>
<span class="nx">m_oOverlayManager</span><span class="o">.</span><span class="nx">register</span><span class="o">(</span><span class="nx">oMenu</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_menu</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">bInstance</span> <span class="o">&&</span> <span class="o">!</span><span class="nx">bLazyLoad</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">inDocument</span><span class="o">(</span><span class="nx">oButtonElement</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">render</span><span class="o">(</span><span class="nx">oButtonElement</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"appendTo"</span><span class="o">,</span> <span class="nx">onAppendTo</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Overlay</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Menu</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">sMenuCSSClassName</span> <span class="o">=</span> <span class="nx">Menu</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">CSS_CLASS_NAME</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_oMenu</span> <span class="o">&&</span> <span class="nx">Menu</span> <span class="o">&&</span> <span class="o">(</span><span class="nx">p_oMenu</span> <span class="k">instanceof</span> <span class="nx">Menu</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">oMenu</span> <span class="o">=</span> <span class="nx">p_oMenu</span><span class="o">;</span>
<span class="nx">bInstance</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="nx">initMenu</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">Overlay</span> <span class="o">&&</span> <span class="nx">p_oMenu</span> <span class="o">&&</span> <span class="o">(</span><span class="nx">p_oMenu</span> <span class="k">instanceof</span> <span class="nx">Overlay</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">oMenu</span> <span class="o">=</span> <span class="nx">p_oMenu</span><span class="o">;</span>
<span class="nx">bInstance</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">queueProperty</span><span class="o">(</span><span class="s2">"visible"</span><span class="o">,</span> <span class="kc">false</span><span class="o">);</span>
<span class="nx">initMenu</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">Menu</span> <span class="o">&&</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isArray</span><span class="o">(</span><span class="nx">p_oMenu</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">oMenu</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Menu</span><span class="o">(</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">generateId</span><span class="o">(),</span> <span class="o">{</span> <span class="nx">lazyload</span><span class="o">:</span> <span class="nx">bLazyLoad</span><span class="o">,</span> <span class="nx">itemdata</span><span class="o">:</span> <span class="nx">p_oMenu</span> <span class="o">});</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_menu</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="o">;</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"appendTo"</span><span class="o">,</span> <span class="nx">initMenu</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">p_oMenu</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">oMenuElement</span> <span class="o">=</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">p_oMenu</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oMenuElement</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Menu</span> <span class="o">&&</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">hasClass</span><span class="o">(</span><span class="nx">oMenuElement</span><span class="o">,</span> <span class="nx">sMenuCSSClassName</span><span class="o">)</span> <span class="o">||</span>
<span class="nx">oMenuElement</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">()</span> <span class="o">==</span> <span class="s2">"SELECT"</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oMenu</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Menu</span><span class="o">(</span><span class="nx">p_oMenu</span><span class="o">,</span> <span class="o">{</span> <span class="nx">lazyload</span><span class="o">:</span> <span class="nx">bLazyLoad</span> <span class="o">});</span>
<span class="nx">initMenu</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">Overlay</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oMenu</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Overlay</span><span class="o">(</span><span class="nx">p_oMenu</span><span class="o">,</span> <span class="o">{</span> <span class="nx">visible</span><span class="o">:</span> <span class="kc">false</span> <span class="o">});</span>
<span class="nx">initMenu</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">p_oMenu</span> <span class="o">&&</span> <span class="nx">p_oMenu</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Menu</span> <span class="o">&&</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">hasClass</span><span class="o">(</span><span class="nx">p_oMenu</span><span class="o">,</span> <span class="nx">sMenuCSSClassName</span><span class="o">)</span> <span class="o">||</span>
<span class="nx">p_oMenu</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">()</span> <span class="o">==</span> <span class="s2">"SELECT"</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oMenu</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Menu</span><span class="o">(</span><span class="nx">p_oMenu</span><span class="o">,</span> <span class="o">{</span> <span class="nx">lazyload</span><span class="o">:</span> <span class="nx">bLazyLoad</span> <span class="o">});</span>
<span class="nx">initMenu</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">Overlay</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">p_oMenu</span><span class="o">.</span><span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Dom</span><span class="o">.</span><span class="nx">generateId</span><span class="o">(</span><span class="nx">p_oMenu</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">oMenu</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Overlay</span><span class="o">(</span><span class="nx">p_oMenu</span><span class="o">,</span> <span class="o">{</span> <span class="nx">visible</span><span class="o">:</span> <span class="kc">false</span> <span class="o">});</span>
<span class="nx">initMenu</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _setOnClick</span>
<span class="c"> * @description Sets the value of the button's "onclick" attribute.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Object} p_oObject Object indicating the value for the button's </span>
<span class="c"> * "onclick" attribute.</span>
<span class="c"> */</span>
<span class="nx">_setOnClick</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oObject</span><span class="o">)</span> <span class="o">{</span>
<span class="c">/*</span>
<span class="c"> Remove any existing listeners if a "click" event handler </span>
<span class="c"> has already been specified.</span>
<span class="c"> */</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_onclickAttributeValue</span> <span class="o">&&</span>
<span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_onclickAttributeValue</span> <span class="o">!=</span> <span class="nx">p_oObject</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="s2">"click"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onclickAttributeValue</span><span class="o">.</span><span class="nx">fn</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_onclickAttributeValue</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">_onclickAttributeValue</span> <span class="o">&&</span>
<span class="nx">Lang</span><span class="o">.</span><span class="nx">isObject</span><span class="o">(</span><span class="nx">p_oObject</span><span class="o">)</span> <span class="o">&&</span>
<span class="nx">Lang</span><span class="o">.</span><span class="nx">isFunction</span><span class="o">(</span><span class="nx">p_oObject</span><span class="o">.</span><span class="nx">fn</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"click"</span><span class="o">,</span> <span class="nx">p_oObject</span><span class="o">.</span><span class="nx">fn</span><span class="o">,</span> <span class="nx">p_oObject</span><span class="o">.</span><span class="nx">obj</span><span class="o">,</span> <span class="nx">p_oObject</span><span class="o">.</span><span class="nx">scope</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_onclickAttributeValue</span> <span class="o">=</span> <span class="nx">p_oObject</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">// Protected methods</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c"> * @method _isActivationKey</span>
<span class="c"> * @description Determines if the specified keycode is one that toggles </span>
<span class="c"> * the button's "active" state.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Number} p_nKeyCode Number representing the keycode to </span>
<span class="c"> * be evaluated.</span>
<span class="c"> * @return {Boolean}</span>
<span class="c"> */</span>
<span class="nx">_isActivationKey</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_nKeyCode</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">),</span>
<span class="nx">aKeyCodes</span> <span class="o">=</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"checkbox"</span> <span class="o">||</span> <span class="nx">sType</span> <span class="o">==</span> <span class="s2">"radio"</span><span class="o">)</span> <span class="o">?</span>
<span class="k">this</span><span class="o">.</span><span class="nx">CHECK_ACTIVATION_KEYS</span> <span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">ACTIVATION_KEYS</span><span class="o">,</span>
<span class="nx">nKeyCodes</span> <span class="o">=</span> <span class="nx">aKeyCodes</span><span class="o">.</span><span class="nx">length</span><span class="o">,</span>
<span class="nx">bReturnVal</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
<span class="nx">i</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">nKeyCodes</span> <span class="o">></span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">i</span> <span class="o">=</span> <span class="nx">nKeyCodes</span> <span class="o">-</span> <span class="m">1</span><span class="o">;</span>
<span class="k">do</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_nKeyCode</span> <span class="o">==</span> <span class="nx">aKeyCodes</span><span class="o">[</span><span class="nx">i</span><span class="o">])</span> <span class="o">{</span>
<span class="nx">bReturnVal</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="k">break</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">while</span> <span class="o">(</span><span class="nx">i</span><span class="o">--);</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">bReturnVal</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _isSplitButtonOptionKey</span>
<span class="c"> * @description Determines if the specified keycode is one that toggles </span>
<span class="c"> * the display of the split button's menu.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> * @return {Boolean}</span>
<span class="c"> */</span>
<span class="nx">_isSplitButtonOptionKey</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">bShowMenu</span> <span class="o">=</span> <span class="o">(</span><span class="nx">Event</span><span class="o">.</span><span class="nx">getCharCode</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">==</span> <span class="m">40</span><span class="o">);</span>
<span class="k">var</span> <span class="nx">onKeyPress</span> <span class="o">=</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">preventDefault</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="s2">"keypress"</span><span class="o">,</span> <span class="nx">onKeyPress</span><span class="o">);</span>
<span class="o">};</span>
<span class="c">// Prevent the browser from scrolling the window</span>
<span class="c"></span> <span class="k">if</span> <span class="o">(</span><span class="nx">bShowMenu</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">UA</span><span class="o">.</span><span class="nx">opera</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"keypress"</span><span class="o">,</span> <span class="nx">onKeyPress</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">preventDefault</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">bShowMenu</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _addListenersToForm</span>
<span class="c"> * @description Adds event handlers to the button's form.</span>
<span class="c"> * @protected</span>
<span class="c"> */</span>
<span class="nx">_addListenersToForm</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oForm</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getForm</span><span class="o">(),</span>
<span class="nx">onFormKeyPress</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Button</span><span class="o">.</span><span class="nx">onFormKeyPress</span><span class="o">,</span>
<span class="nx">bHasKeyPressListener</span><span class="o">,</span>
<span class="nx">oSrcElement</span><span class="o">,</span>
<span class="nx">aListeners</span><span class="o">,</span>
<span class="nx">nListeners</span><span class="o">,</span>
<span class="nx">i</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oForm</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="nx">oForm</span><span class="o">,</span> <span class="s2">"reset"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onFormReset</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="nx">oForm</span><span class="o">,</span> <span class="s2">"submit"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onFormSubmit</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="nx">oSrcElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"srcelement"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">==</span> <span class="s2">"submit"</span> <span class="o">||</span>
<span class="o">(</span><span class="nx">oSrcElement</span> <span class="o">&&</span> <span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">type</span> <span class="o">==</span> <span class="s2">"submit"</span><span class="o">))</span>
<span class="o">{</span>
<span class="nx">aListeners</span> <span class="o">=</span> <span class="nx">Event</span><span class="o">.</span><span class="nx">getListeners</span><span class="o">(</span><span class="nx">oForm</span><span class="o">,</span> <span class="s2">"keypress"</span><span class="o">);</span>
<span class="nx">bHasKeyPressListener</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">aListeners</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">nListeners</span> <span class="o">=</span> <span class="nx">aListeners</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">nListeners</span> <span class="o">></span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">i</span> <span class="o">=</span> <span class="nx">nListeners</span> <span class="o">-</span> <span class="m">1</span><span class="o">;</span>
<span class="k">do</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">aListeners</span><span class="o">[</span><span class="nx">i</span><span class="o">].</span><span class="nx">fn</span> <span class="o">==</span> <span class="nx">onFormKeyPress</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">bHasKeyPressListener</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="k">break</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">while</span> <span class="o">(</span><span class="nx">i</span><span class="o">--);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">bHasKeyPressListener</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="nx">oForm</span><span class="o">,</span> <span class="s2">"keypress"</span><span class="o">,</span> <span class="nx">onFormKeyPress</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _showMenu</span>
<span class="c"> * @description Shows the button's menu.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event) that triggered </span>
<span class="c"> * the display of the menu.</span>
<span class="c"> */</span>
<span class="nx">_showMenu</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">MenuManager</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">MenuManager</span><span class="o">.</span><span class="nx">hideVisible</span><span class="o">();</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">m_oOverlayManager</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">m_oOverlayManager</span><span class="o">.</span><span class="nx">hideAll</span><span class="o">();</span>
<span class="o">}</span>
<span class="k">var</span> <span class="nx">oMenu</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_menu</span><span class="o">,</span>
<span class="nx">aMenuAlignment</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"menualignment"</span><span class="o">),</span>
<span class="nx">bFocusMenu</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"focusmenu"</span><span class="o">),</span>
<span class="nx">fnFocusMethod</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_renderedMenu</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">"context"</span><span class="o">,</span>
<span class="o">[</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"element"</span><span class="o">),</span> <span class="nx">aMenuAlignment</span><span class="o">[</span><span class="m">0</span><span class="o">],</span> <span class="nx">aMenuAlignment</span><span class="o">[</span><span class="m">1</span><span class="o">]]);</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">"preventcontextoverlap"</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">"constraintoviewport"</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">queueProperty</span><span class="o">(</span><span class="s2">"context"</span><span class="o">,</span>
<span class="o">[</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"element"</span><span class="o">),</span> <span class="nx">aMenuAlignment</span><span class="o">[</span><span class="m">0</span><span class="o">],</span> <span class="nx">aMenuAlignment</span><span class="o">[</span><span class="m">1</span><span class="o">]]);</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">queueProperty</span><span class="o">(</span><span class="s2">"preventcontextoverlap"</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">queueProperty</span><span class="o">(</span><span class="s2">"constraintoviewport"</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
<span class="o">}</span>
<span class="c">/*</span>
<span class="c"> Refocus the Button before showing its Menu in case the call to </span>
<span class="c"> YAHOO.widget.MenuManager.hideVisible() resulted in another element in the </span>
<span class="c"> DOM being focused after another Menu was hidden.</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">focus</span><span class="o">();</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Menu</span> <span class="o">&&</span> <span class="nx">oMenu</span> <span class="o">&&</span> <span class="o">(</span><span class="nx">oMenu</span> <span class="k">instanceof</span> <span class="nx">Menu</span><span class="o">))</span> <span class="o">{</span>
<span class="c">// Since Menus automatically focus themselves when made visible, temporarily </span>
<span class="c"></span> <span class="c">// replace the Menu focus method so that the value of the Button's "focusmenu"</span>
<span class="c"></span> <span class="c">// attribute determines if the Menu should be focus when made visible.</span>
<span class="c"></span>
<span class="nx">fnFocusMethod</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="o">.</span><span class="nx">focus</span><span class="o">;</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">focus</span> <span class="o">=</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{};</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_renderedMenu</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">"minscrollheight"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"menuminscrollheight"</span><span class="o">));</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">"maxheight"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"menumaxheight"</span><span class="o">));</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">queueProperty</span><span class="o">(</span><span class="s2">"minscrollheight"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"menuminscrollheight"</span><span class="o">));</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">queueProperty</span><span class="o">(</span><span class="s2">"maxheight"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"menumaxheight"</span><span class="o">));</span>
<span class="o">}</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">show</span><span class="o">();</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">focus</span> <span class="o">=</span> <span class="nx">fnFocusMethod</span><span class="o">;</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">align</span><span class="o">();</span>
<span class="c">/*</span>
<span class="c"> Stop the propagation of the event so that the MenuManager </span>
<span class="c"> doesn't blur the menu after it gets focus.</span>
<span class="c"> */</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">.</span><span class="nx">type</span> <span class="o">==</span> <span class="s2">"mousedown"</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">stopPropagation</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">bFocusMenu</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">focus</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">Overlay</span> <span class="o">&&</span> <span class="nx">oMenu</span> <span class="o">&&</span> <span class="o">(</span><span class="nx">oMenu</span> <span class="k">instanceof</span> <span class="nx">Overlay</span><span class="o">))</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">_renderedMenu</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">render</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"element"</span><span class="o">).</span><span class="nx">parentNode</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">show</span><span class="o">();</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">align</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _hideMenu</span>
<span class="c"> * @description Hides the button's menu.</span>
<span class="c"> * @protected</span>
<span class="c"> */</span>
<span class="nx">_hideMenu</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oMenu</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_menu</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oMenu</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">hide</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">// Protected event handlers</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c"> * @method _onMouseOver</span>
<span class="c"> * @description "mouseover" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onMouseOver</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">),</span>
<span class="nx">oElement</span><span class="o">,</span>
<span class="nx">nOptionRegionX</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">===</span> <span class="s2">"split"</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"element"</span><span class="o">);</span>
<span class="nx">nOptionRegionX</span> <span class="o">=</span>
<span class="o">(</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getX</span><span class="o">(</span><span class="nx">oElement</span><span class="o">)</span> <span class="o">+</span> <span class="o">(</span><span class="nx">oElement</span><span class="o">.</span><span class="nx">offsetWidth</span> <span class="o">-</span> <span class="k">this</span><span class="o">.</span><span class="nx">OPTION_AREA_WIDTH</span><span class="o">));</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_nOptionRegionX</span> <span class="o">=</span> <span class="nx">nOptionRegionX</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">_hasMouseEventHandlers</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">===</span> <span class="s2">"split"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"mousemove"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onMouseMove</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"mouseout"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onMouseOut</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hasMouseEventHandlers</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="s2">"hover"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">===</span> <span class="s2">"split"</span> <span class="o">&&</span> <span class="o">(</span><span class="nx">Event</span><span class="o">.</span><span class="nx">getPageX</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">></span> <span class="nx">nOptionRegionX</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="s2">"hoveroption"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_activationButtonPressed</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="s2">"active"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_bOptionPressed</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="s2">"activeoption"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_activationButtonPressed</span> <span class="o">||</span> <span class="k">this</span><span class="o">.</span><span class="nx">_bOptionPressed</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="nb">document</span><span class="o">,</span> <span class="s2">"mouseup"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onDocumentMouseUp</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onMouseMove</span>
<span class="c"> * @description "mousemove" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onMouseMove</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">nOptionRegionX</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_nOptionRegionX</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">nOptionRegionX</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Event</span><span class="o">.</span><span class="nx">getPageX</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">></span> <span class="nx">nOptionRegionX</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="s2">"hoveroption"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"hoveroption"</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onMouseOut</span>
<span class="c"> * @description "mouseout" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onMouseOut</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"hover"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">!=</span> <span class="s2">"menu"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"active"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_activationButtonPressed</span> <span class="o">||</span> <span class="k">this</span><span class="o">.</span><span class="nx">_bOptionPressed</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="nb">document</span><span class="o">,</span> <span class="s2">"mouseup"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onDocumentMouseUp</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">===</span> <span class="s2">"split"</span> <span class="o">&&</span> <span class="o">(</span><span class="nx">Event</span><span class="o">.</span><span class="nx">getPageX</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">></span> <span class="k">this</span><span class="o">.</span><span class="nx">_nOptionRegionX</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"hoveroption"</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onDocumentMouseUp</span>
<span class="c"> * @description "mouseup" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onDocumentMouseUp</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_activationButtonPressed</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_bOptionPressed</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="k">var</span> <span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">),</span>
<span class="nx">oTarget</span><span class="o">,</span>
<span class="nx">oMenuElement</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"menu"</span> <span class="o">||</span> <span class="nx">sType</span> <span class="o">==</span> <span class="s2">"split"</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oTarget</span> <span class="o">=</span> <span class="nx">Event</span><span class="o">.</span><span class="nx">getTarget</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">);</span>
<span class="nx">oMenuElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_menu</span><span class="o">.</span><span class="nx">element</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oTarget</span> <span class="o">!=</span> <span class="nx">oMenuElement</span> <span class="o">&&</span>
<span class="o">!</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">isAncestor</span><span class="o">(</span><span class="nx">oMenuElement</span><span class="o">,</span> <span class="nx">oTarget</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">((</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"menu"</span> <span class="o">?</span>
<span class="s2">"active"</span> <span class="o">:</span> <span class="s2">"activeoption"</span><span class="o">));</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hideMenu</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="nb">document</span><span class="o">,</span> <span class="s2">"mouseup"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onDocumentMouseUp</span><span class="o">);</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onMouseDown</span>
<span class="c"> * @description "mousedown" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onMouseDown</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sType</span><span class="o">,</span>
<span class="nx">bReturnVal</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="k">function</span> <span class="nx">onMouseUp</span><span class="o">()</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hideMenu</span><span class="o">();</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="s2">"mouseup"</span><span class="o">,</span> <span class="nx">onMouseUp</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">((</span><span class="nx">p_oEvent</span><span class="o">.</span><span class="nx">which</span> <span class="o">||</span> <span class="nx">p_oEvent</span><span class="o">.</span><span class="nx">button</span><span class="o">)</span> <span class="o">==</span> <span class="m">1</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">hasFocus</span><span class="o">())</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">focus</span><span class="o">();</span>
<span class="o">}</span>
<span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"split"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Event</span><span class="o">.</span><span class="nx">getPageX</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">></span> <span class="k">this</span><span class="o">.</span><span class="nx">_nOptionRegionX</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s2">"option"</span><span class="o">,</span> <span class="nx">p_oEvent</span><span class="o">);</span>
<span class="nx">bReturnVal</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="s2">"active"</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_activationButtonPressed</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"menu"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">isActive</span><span class="o">())</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hideMenu</span><span class="o">();</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_activationButtonPressed</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_showMenu</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_activationButtonPressed</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="s2">"active"</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_activationButtonPressed</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"split"</span> <span class="o">||</span> <span class="nx">sType</span> <span class="o">==</span> <span class="s2">"menu"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hideMenuTimer</span> <span class="o">=</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">later</span><span class="o">(</span><span class="m">250</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">,</span> <span class="o">[</span><span class="s2">"mouseup"</span><span class="o">,</span> <span class="nx">onMouseUp</span><span class="o">]);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">bReturnVal</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onMouseUp</span>
<span class="c"> * @description "mouseup" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onMouseUp</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">),</span>
<span class="nx">oHideMenuTimer</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_hideMenuTimer</span><span class="o">,</span>
<span class="nx">bReturnVal</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oHideMenuTimer</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oHideMenuTimer</span><span class="o">.</span><span class="nx">cancel</span><span class="o">();</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"checkbox"</span> <span class="o">||</span> <span class="nx">sType</span> <span class="o">==</span> <span class="s2">"radio"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="s2">"checked"</span><span class="o">,</span> <span class="o">!(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"checked"</span><span class="o">)));</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_activationButtonPressed</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">!=</span> <span class="s2">"menu"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"active"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"split"</span> <span class="o">&&</span> <span class="nx">Event</span><span class="o">.</span><span class="nx">getPageX</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">></span> <span class="k">this</span><span class="o">.</span><span class="nx">_nOptionRegionX</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">bReturnVal</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">bReturnVal</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onFocus</span>
<span class="c"> * @description "focus" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onFocus</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oElement</span><span class="o">;</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="s2">"focus"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_activationKeyPressed</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="s2">"active"</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">m_oFocusedButton</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">_hasKeyEventHandlers</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">;</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="nx">oElement</span><span class="o">,</span> <span class="s2">"blur"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onBlur</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="nx">oElement</span><span class="o">,</span> <span class="s2">"keydown"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onKeyDown</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="nx">oElement</span><span class="o">,</span> <span class="s2">"keyup"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onKeyUp</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hasKeyEventHandlers</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s2">"focus"</span><span class="o">,</span> <span class="nx">p_oEvent</span><span class="o">);</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onBlur</span>
<span class="c"> * @description "blur" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onBlur</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"focus"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">!=</span> <span class="s2">"menu"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"active"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_activationKeyPressed</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="nb">document</span><span class="o">,</span> <span class="s2">"keyup"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onDocumentKeyUp</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">m_oFocusedButton</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
<span class="k">this</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s2">"blur"</span><span class="o">,</span> <span class="nx">p_oEvent</span><span class="o">);</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onDocumentKeyUp</span>
<span class="c"> * @description "keyup" event handler for the document.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onDocumentKeyUp</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_isActivationKey</span><span class="o">(</span><span class="nx">Event</span><span class="o">.</span><span class="nx">getCharCode</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_activationKeyPressed</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="nb">document</span><span class="o">,</span> <span class="s2">"keyup"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onDocumentKeyUp</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onKeyDown</span>
<span class="c"> * @description "keydown" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onKeyDown</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oMenu</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_menu</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">==</span> <span class="s2">"split"</span> <span class="o">&&</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_isSplitButtonOptionKey</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s2">"option"</span><span class="o">,</span> <span class="nx">p_oEvent</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_isActivationKey</span><span class="o">(</span><span class="nx">Event</span><span class="o">.</span><span class="nx">getCharCode</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)))</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">==</span> <span class="s2">"menu"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_showMenu</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_activationKeyPressed</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="s2">"active"</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oMenu</span> <span class="o">&&</span> <span class="nx">oMenu</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">"visible"</span><span class="o">)</span> <span class="o">&&</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">getCharCode</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">==</span> <span class="m">27</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">hide</span><span class="o">();</span>
<span class="k">this</span><span class="o">.</span><span class="nx">focus</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onKeyUp</span>
<span class="c"> * @description "keyup" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onKeyUp</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sType</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_isActivationKey</span><span class="o">(</span><span class="nx">Event</span><span class="o">.</span><span class="nx">getCharCode</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)))</span> <span class="o">{</span>
<span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"checkbox"</span> <span class="o">||</span> <span class="nx">sType</span> <span class="o">==</span> <span class="s2">"radio"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="s2">"checked"</span><span class="o">,</span> <span class="o">!(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"checked"</span><span class="o">)));</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_activationKeyPressed</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">!=</span> <span class="s2">"menu"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="s2">"active"</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onClick</span>
<span class="c"> * @description "click" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onClick</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">),</span>
<span class="nx">oForm</span><span class="o">,</span>
<span class="nx">oSrcElement</span><span class="o">,</span>
<span class="nx">bReturnVal</span><span class="o">;</span>
<span class="nx">switch</span> <span class="o">(</span><span class="nx">sType</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">case</span> <span class="s2">"submit"</span><span class="o">:</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">.</span><span class="nx">returnValue</span> <span class="o">!==</span> <span class="kc">false</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">submitForm</span><span class="o">();</span>
<span class="o">}</span>
<span class="k">break</span><span class="o">;</span>
<span class="nx">case</span> <span class="s2">"reset"</span><span class="o">:</span>
<span class="nx">oForm</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getForm</span><span class="o">();</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oForm</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oForm</span><span class="o">.</span><span class="nx">reset</span><span class="o">();</span>
<span class="o">}</span>
<span class="k">break</span><span class="o">;</span>
<span class="nx">case</span> <span class="s2">"split"</span><span class="o">:</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_nOptionRegionX</span> <span class="o">></span> <span class="m">0</span> <span class="o">&&</span>
<span class="o">(</span><span class="nx">Event</span><span class="o">.</span><span class="nx">getPageX</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">></span> <span class="k">this</span><span class="o">.</span><span class="nx">_nOptionRegionX</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">bReturnVal</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hideMenu</span><span class="o">();</span>
<span class="nx">oSrcElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"srcelement"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oSrcElement</span> <span class="o">&&</span> <span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">type</span> <span class="o">==</span> <span class="s2">"submit"</span> <span class="o">&&</span>
<span class="nx">p_oEvent</span><span class="o">.</span><span class="nx">returnValue</span> <span class="o">!==</span> <span class="kc">false</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">submitForm</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">break</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">bReturnVal</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onDblClick</span>
<span class="c"> * @description "dblclick" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onDblClick</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">bReturnVal</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">==</span> <span class="s2">"split"</span> <span class="o">&&</span> <span class="nx">Event</span><span class="o">.</span><span class="nx">getPageX</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">></span> <span class="k">this</span><span class="o">.</span><span class="nx">_nOptionRegionX</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">bReturnVal</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">bReturnVal</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onAppendTo</span>
<span class="c"> * @description "appendTo" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onAppendTo</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="c">/*</span>
<span class="c"> It is necessary to call "_addListenersToForm" using </span>
<span class="c"> "setTimeout" to make sure that the button's "form" property </span>
<span class="c"> returns a node reference. Sometimes, if you try to get the </span>
<span class="c"> reference immediately after appending the field, it is null.</span>
<span class="c"> */</span>
<span class="nx">Lang</span><span class="o">.</span><span class="nx">later</span><span class="o">(</span><span class="m">0</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_addListenersToForm</span><span class="o">);</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onFormReset</span>
<span class="c"> * @description "reset" event handler for the button's form.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event </span>
<span class="c"> * object passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onFormReset</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">),</span>
<span class="nx">oMenu</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_menu</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"checkbox"</span> <span class="o">||</span> <span class="nx">sType</span> <span class="o">==</span> <span class="s2">"radio"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">resetValue</span><span class="o">(</span><span class="s2">"checked"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Menu</span> <span class="o">&&</span> <span class="nx">oMenu</span> <span class="o">&&</span> <span class="o">(</span><span class="nx">oMenu</span> <span class="k">instanceof</span> <span class="nx">Menu</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">resetValue</span><span class="o">(</span><span class="s2">"selectedMenuItem"</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onFormSubmit</span>
<span class="c"> * @description "submit" event handler for the button's form.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event </span>
<span class="c"> * object passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onFormSubmit</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">createHiddenFields</span><span class="o">();</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onDocumentMouseDown</span>
<span class="c"> * @description "mousedown" event handler for the document.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onDocumentMouseDown</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oTarget</span> <span class="o">=</span> <span class="nx">Event</span><span class="o">.</span><span class="nx">getTarget</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">),</span>
<span class="nx">oButtonElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"element"</span><span class="o">),</span>
<span class="nx">oMenuElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_menu</span><span class="o">.</span><span class="nx">element</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oTarget</span> <span class="o">!=</span> <span class="nx">oButtonElement</span> <span class="o">&&</span>
<span class="o">!</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">isAncestor</span><span class="o">(</span><span class="nx">oButtonElement</span><span class="o">,</span> <span class="nx">oTarget</span><span class="o">)</span> <span class="o">&&</span>
<span class="nx">oTarget</span> <span class="o">!=</span> <span class="nx">oMenuElement</span> <span class="o">&&</span>
<span class="o">!</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">isAncestor</span><span class="o">(</span><span class="nx">oMenuElement</span><span class="o">,</span> <span class="nx">oTarget</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hideMenu</span><span class="o">();</span>
<span class="c">// In IE when the user mouses down on a focusable element</span>
<span class="c"></span> <span class="c">// that element will be focused and become the "activeElement".</span>
<span class="c"></span> <span class="c">// (http://msdn.microsoft.com/en-us/library/ms533065(VS.85).aspx)</span>
<span class="c"></span> <span class="c">// However, there is a bug in IE where if there is a </span>
<span class="c"></span> <span class="c">// positioned element with a focused descendant that is </span>
<span class="c"></span> <span class="c">// hidden in response to the mousedown event, the target of </span>
<span class="c"></span> <span class="c">// the mousedown event will appear to have focus, but will </span>
<span class="c"></span> <span class="c">// not be set as the activeElement. This will result </span>
<span class="c"></span> <span class="c">// in the element not firing key events, even though it</span>
<span class="c"></span> <span class="c">// appears to have focus. The following call to "setActive"</span>
<span class="c"></span> <span class="c">// fixes this bug.</span>
<span class="c"></span>
<span class="k">if</span> <span class="o">(</span><span class="nx">UA</span><span class="o">.</span><span class="nx">ie</span> <span class="o">&&</span> <span class="nx">oTarget</span><span class="o">.</span><span class="nx">focus</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oTarget</span><span class="o">.</span><span class="nx">setActive</span><span class="o">();</span>
<span class="o">}</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="nb">document</span><span class="o">,</span> <span class="s2">"mousedown"</span><span class="o">,</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_onDocumentMouseDown</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onOption</span>
<span class="c"> * @description "option" event handler for the button.</span>
<span class="c"> * @protected</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onOption</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">hasClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">CLASS_NAME_PREFIX</span> <span class="o">+</span> <span class="s2">"split-button-activeoption"</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hideMenu</span><span class="o">();</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_bOptionPressed</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_showMenu</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_bOptionPressed</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onMenuShow</span>
<span class="c"> * @description "show" event handler for the button's menu.</span>
<span class="c"> * @private</span>
<span class="c"> * @param {String} p_sType String representing the name of the event </span>
<span class="c"> * that was fired.</span>
<span class="c"> */</span>
<span class="nx">_onMenuShow</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sType</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="nb">document</span><span class="o">,</span> <span class="s2">"mousedown"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onDocumentMouseDown</span><span class="o">,</span>
<span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="k">var</span> <span class="nx">sState</span> <span class="o">=</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">==</span> <span class="s2">"split"</span><span class="o">)</span> <span class="o">?</span> <span class="s2">"activeoption"</span> <span class="o">:</span> <span class="s2">"active"</span><span class="o">;</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addStateCSSClasses</span><span class="o">(</span><span class="nx">sState</span><span class="o">);</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onMenuHide</span>
<span class="c"> * @description "hide" event handler for the button's menu.</span>
<span class="c"> * @private</span>
<span class="c"> * @param {String} p_sType String representing the name of the event </span>
<span class="c"> * that was fired.</span>
<span class="c"> */</span>
<span class="nx">_onMenuHide</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sType</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sState</span> <span class="o">=</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">==</span> <span class="s2">"split"</span><span class="o">)</span> <span class="o">?</span> <span class="s2">"activeoption"</span> <span class="o">:</span> <span class="s2">"active"</span><span class="o">;</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeStateCSSClasses</span><span class="o">(</span><span class="nx">sState</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">==</span> <span class="s2">"split"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_bOptionPressed</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onMenuKeyDown</span>
<span class="c"> * @description "keydown" event handler for the button's menu.</span>
<span class="c"> * @private</span>
<span class="c"> * @param {String} p_sType String representing the name of the event </span>
<span class="c"> * that was fired.</span>
<span class="c"> * @param {Array} p_aArgs Array of arguments sent when the event </span>
<span class="c"> * was fired.</span>
<span class="c"> */</span>
<span class="nx">_onMenuKeyDown</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oEvent</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Event</span><span class="o">.</span><span class="nx">getCharCode</span><span class="o">(</span><span class="nx">oEvent</span><span class="o">)</span> <span class="o">==</span> <span class="m">27</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">focus</span><span class="o">();</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">==</span> <span class="s2">"split"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_bOptionPressed</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onMenuRender</span>
<span class="c"> * @description "render" event handler for the button's menu.</span>
<span class="c"> * @private</span>
<span class="c"> * @param {String} p_sType String representing the name of the </span>
<span class="c"> * event thatwas fired.</span>
<span class="c"> */</span>
<span class="nx">_onMenuRender</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sType</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oButtonElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"element"</span><span class="o">),</span>
<span class="nx">oButtonParent</span> <span class="o">=</span> <span class="nx">oButtonElement</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">,</span>
<span class="nx">oMenu</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_menu</span><span class="o">,</span>
<span class="nx">oMenuElement</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span>
<span class="nx">oSrcElement</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="o">.</span><span class="nx">srcElement</span><span class="o">,</span>
<span class="nx">oItem</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oButtonParent</span> <span class="o">!=</span> <span class="nx">oMenuElement</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oButtonParent</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oMenuElement</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_renderedMenu</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="c">// If the user has designated an <option> of the Menu's source </span>
<span class="c"></span> <span class="c">// <select> element to be selected, sync the selectedIndex with </span>
<span class="c"></span> <span class="c">// the "selectedMenuItem" Attribute.</span>
<span class="c"></span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oSrcElement</span> <span class="o">&&</span>
<span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">.</span><span class="nx">toLowerCase</span><span class="o">()</span> <span class="o">===</span> <span class="s2">"select"</span> <span class="o">&&</span>
<span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">value</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oItem</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="o">.</span><span class="nx">getItem</span><span class="o">(</span><span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">selectedIndex</span><span class="o">);</span>
<span class="c">// Set the value of the "selectedMenuItem" attribute</span>
<span class="c"></span> <span class="c">// silently since this is the initial set--synchronizing </span>
<span class="c"></span> <span class="c">// the value of the source <SELECT> element in the DOM with </span>
<span class="c"></span> <span class="c">// its corresponding Menu instance.</span>
<span class="c"></span>
<span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="s2">"selectedMenuItem"</span><span class="o">,</span> <span class="nx">oItem</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
<span class="c">// Call the "_onSelectedMenuItemChange" method since the </span>
<span class="c"></span> <span class="c">// attribute was set silently.</span>
<span class="c"></span>
<span class="k">this</span><span class="o">.</span><span class="nx">_onSelectedMenuItemChange</span><span class="o">({</span> <span class="nx">newValue</span><span class="o">:</span> <span class="nx">oItem</span> <span class="o">});</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onMenuClick</span>
<span class="c"> * @description "click" event handler for the button's menu.</span>
<span class="c"> * @private</span>
<span class="c"> * @param {String} p_sType String representing the name of the event </span>
<span class="c"> * that was fired.</span>
<span class="c"> * @param {Array} p_aArgs Array of arguments sent when the event </span>
<span class="c"> * was fired.</span>
<span class="c"> */</span>
<span class="nx">_onMenuClick</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oItem</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="o">[</span><span class="m">1</span><span class="o">],</span>
<span class="nx">oSrcElement</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oItem</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="s2">"selectedMenuItem"</span><span class="o">,</span> <span class="nx">oItem</span><span class="o">);</span>
<span class="nx">oSrcElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"srcelement"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oSrcElement</span> <span class="o">&&</span> <span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">type</span> <span class="o">==</span> <span class="s2">"submit"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">submitForm</span><span class="o">();</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hideMenu</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onSelectedMenuItemChange</span>
<span class="c"> * @description "selectedMenuItemChange" event handler for the Button's</span>
<span class="c"> * "selectedMenuItem" attribute.</span>
<span class="c"> * @param {Event} event Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onSelectedMenuItemChange</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">event</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oSelected</span> <span class="o">=</span> <span class="nx">event</span><span class="o">.</span><span class="nx">prevValue</span><span class="o">,</span>
<span class="nx">oItem</span> <span class="o">=</span> <span class="nx">event</span><span class="o">.</span><span class="nx">newValue</span><span class="o">,</span>
<span class="nx">sPrefix</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">CLASS_NAME_PREFIX</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oSelected</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="nx">oSelected</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="o">(</span><span class="nx">sPrefix</span> <span class="o">+</span> <span class="s2">"button-selectedmenuitem"</span><span class="o">));</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oItem</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">oItem</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="o">(</span><span class="nx">sPrefix</span> <span class="o">+</span> <span class="s2">"button-selectedmenuitem"</span><span class="o">));</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method _onLabelClick</span>
<span class="c"> * @description "click" event handler for the Button's</span>
<span class="c"> * <code>&#60;label&#62;</code> element.</span>
<span class="c"> * @param {Event} event Object representing the DOM event object </span>
<span class="c"> * passed back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">_onLabelClick</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">event</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">focus</span><span class="o">();</span>
<span class="k">var</span> <span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"radio"</span> <span class="o">||</span> <span class="nx">sType</span> <span class="o">==</span> <span class="s2">"checkbox"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="s2">"checked"</span><span class="o">,</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"checked"</span><span class="o">)));</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">// Public methods</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c"> * @method createButtonElement</span>
<span class="c"> * @description Creates the button's HTML elements.</span>
<span class="c"> * @param {String} p_sType String indicating the type of element </span>
<span class="c"> * to create.</span>
<span class="c"> * @return {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c"> * level-one-html.html#ID-58190037">HTMLElement</a>}</span>
<span class="c"> */</span>
<span class="nx">createButtonElement</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sType</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sNodeName</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">NODE_NAME</span><span class="o">,</span>
<span class="nx">oElement</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="nx">sNodeName</span><span class="o">);</span>
<span class="nx">oElement</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">"<"</span> <span class="o">+</span> <span class="nx">sNodeName</span> <span class="o">+</span> <span class="s2">" class=\"first-child\">"</span> <span class="o">+</span>
<span class="o">(</span><span class="nx">p_sType</span> <span class="o">==</span> <span class="s2">"link"</span> <span class="o">?</span> <span class="s2">"<a></a>"</span> <span class="o">:</span>
<span class="s2">"<button type=\"button\"></button>"</span><span class="o">)</span> <span class="o">+</span> <span class="s2">"</"</span> <span class="o">+</span> <span class="nx">sNodeName</span> <span class="o">+</span> <span class="s2">">"</span><span class="o">;</span>
<span class="k">return</span> <span class="nx">oElement</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method addStateCSSClasses</span>
<span class="c"> * @description Appends state-specific CSS classes to the button's root </span>
<span class="c"> * DOM element.</span>
<span class="c"> */</span>
<span class="nx">addStateCSSClasses</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sState</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">),</span>
<span class="nx">sPrefix</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">CLASS_NAME_PREFIX</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">p_sState</span><span class="o">))</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_sState</span> <span class="o">!=</span> <span class="s2">"activeoption"</span> <span class="o">&&</span> <span class="nx">p_sState</span> <span class="o">!=</span> <span class="s2">"hoveroption"</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">sPrefix</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">CSS_CLASS_NAME</span> <span class="o">+</span> <span class="o">(</span><span class="s2">"-"</span> <span class="o">+</span> <span class="nx">p_sState</span><span class="o">));</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">sPrefix</span> <span class="o">+</span> <span class="nx">sType</span> <span class="o">+</span> <span class="o">(</span><span class="s2">"-button-"</span> <span class="o">+</span> <span class="nx">p_sState</span><span class="o">));</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method removeStateCSSClasses</span>
<span class="c"> * @description Removes state-specific CSS classes to the button's root </span>
<span class="c"> * DOM element.</span>
<span class="c"> */</span>
<span class="nx">removeStateCSSClasses</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sState</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">),</span>
<span class="nx">sPrefix</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">CLASS_NAME_PREFIX</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">p_sState</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="nx">sPrefix</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">CSS_CLASS_NAME</span> <span class="o">+</span> <span class="o">(</span><span class="s2">"-"</span> <span class="o">+</span> <span class="nx">p_sState</span><span class="o">));</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="nx">sPrefix</span> <span class="o">+</span> <span class="nx">sType</span> <span class="o">+</span> <span class="o">(</span><span class="s2">"-button-"</span> <span class="o">+</span> <span class="nx">p_sState</span><span class="o">));</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method createHiddenFields</span>
<span class="c"> * @description Creates the button's hidden form field and appends it </span>
<span class="c"> * to its parent form.</span>
<span class="c"> * @return {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c"> * level-one-html.html#ID-6043025">HTMLInputElement</a>|Array}</span>
<span class="c"> */</span>
<span class="nx">createHiddenFields</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">removeHiddenFields</span><span class="o">();</span>
<span class="k">var</span> <span class="nx">oForm</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getForm</span><span class="o">(),</span>
<span class="nx">oButtonField</span><span class="o">,</span>
<span class="nx">sType</span><span class="o">,</span>
<span class="nx">bCheckable</span><span class="o">,</span>
<span class="nx">oMenu</span><span class="o">,</span>
<span class="nx">oMenuItem</span><span class="o">,</span>
<span class="nx">sButtonName</span><span class="o">,</span>
<span class="nx">oValue</span><span class="o">,</span>
<span class="nx">oMenuField</span><span class="o">,</span>
<span class="nx">oReturnVal</span><span class="o">,</span>
<span class="nx">sMenuFieldName</span><span class="o">,</span>
<span class="nx">oMenuSrcElement</span><span class="o">,</span>
<span class="nx">bMenuSrcElementIsSelect</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oForm</span> <span class="o">&&</span> <span class="o">!</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"disabled"</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">sType</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">);</span>
<span class="nx">bCheckable</span> <span class="o">=</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"checkbox"</span> <span class="o">||</span> <span class="nx">sType</span> <span class="o">==</span> <span class="s2">"radio"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">((</span><span class="nx">bCheckable</span> <span class="o">&&</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"checked"</span><span class="o">))</span> <span class="o">||</span> <span class="o">(</span><span class="nx">m_oSubmitTrigger</span> <span class="o">==</span> <span class="k">this</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Creating hidden field."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="nx">oButtonField</span> <span class="o">=</span> <span class="nx">createInputElement</span><span class="o">((</span><span class="nx">bCheckable</span> <span class="o">?</span> <span class="nx">sType</span> <span class="o">:</span> <span class="s2">"hidden"</span><span class="o">),</span>
<span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"name"</span><span class="o">),</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"value"</span><span class="o">),</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"checked"</span><span class="o">));</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oButtonField</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">bCheckable</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oButtonField</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">"none"</span><span class="o">;</span>
<span class="o">}</span>
<span class="nx">oForm</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oButtonField</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="nx">oMenu</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_menu</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Menu</span> <span class="o">&&</span> <span class="nx">oMenu</span> <span class="o">&&</span> <span class="o">(</span><span class="nx">oMenu</span> <span class="k">instanceof</span> <span class="nx">Menu</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Creating hidden field for menu."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="nx">oMenuItem</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"selectedMenuItem"</span><span class="o">);</span>
<span class="nx">oMenuSrcElement</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="o">.</span><span class="nx">srcElement</span><span class="o">;</span>
<span class="nx">bMenuSrcElementIsSelect</span> <span class="o">=</span> <span class="o">(</span><span class="nx">oMenuSrcElement</span> <span class="o">&&</span>
<span class="nx">oMenuSrcElement</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">()</span> <span class="o">==</span> <span class="s2">"SELECT"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oMenuItem</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oValue</span> <span class="o">=</span> <span class="o">(</span><span class="nx">oMenuItem</span><span class="o">.</span><span class="nx">value</span> <span class="o">===</span> <span class="kc">null</span> <span class="o">||</span> <span class="nx">oMenuItem</span><span class="o">.</span><span class="nx">value</span> <span class="o">===</span> <span class="s2">""</span><span class="o">)</span> <span class="o">?</span>
<span class="nx">oMenuItem</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">"text"</span><span class="o">)</span> <span class="o">:</span> <span class="nx">oMenuItem</span><span class="o">.</span><span class="nx">value</span><span class="o">;</span>
<span class="nx">sButtonName</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"name"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">bMenuSrcElementIsSelect</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">sMenuFieldName</span> <span class="o">=</span> <span class="nx">oMenuSrcElement</span><span class="o">.</span><span class="nx">name</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">sButtonName</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">sMenuFieldName</span> <span class="o">=</span> <span class="o">(</span><span class="nx">sButtonName</span> <span class="o">+</span> <span class="s2">"_options"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oValue</span> <span class="o">&&</span> <span class="nx">sMenuFieldName</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oMenuField</span> <span class="o">=</span> <span class="nx">createInputElement</span><span class="o">(</span><span class="s2">"hidden"</span><span class="o">,</span> <span class="nx">sMenuFieldName</span><span class="o">,</span> <span class="nx">oValue</span><span class="o">);</span>
<span class="nx">oForm</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oMenuField</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">bMenuSrcElementIsSelect</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oMenuField</span> <span class="o">=</span> <span class="nx">oForm</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oMenuSrcElement</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oButtonField</span> <span class="o">&&</span> <span class="nx">oMenuField</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hiddenFields</span> <span class="o">=</span> <span class="o">[</span><span class="nx">oButtonField</span><span class="o">,</span> <span class="nx">oMenuField</span><span class="o">];</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(!</span><span class="nx">oButtonField</span> <span class="o">&&</span> <span class="nx">oMenuField</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hiddenFields</span> <span class="o">=</span> <span class="nx">oMenuField</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">oButtonField</span> <span class="o">&&</span> <span class="o">!</span><span class="nx">oMenuField</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hiddenFields</span> <span class="o">=</span> <span class="nx">oButtonField</span><span class="o">;</span>
<span class="o">}</span>
<span class="nx">oReturnVal</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_hiddenFields</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">oReturnVal</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method removeHiddenFields</span>
<span class="c"> * @description Removes the button's hidden form field(s) from its </span>
<span class="c"> * parent form.</span>
<span class="c"> */</span>
<span class="nx">removeHiddenFields</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oField</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_hiddenFields</span><span class="o">,</span>
<span class="nx">nFields</span><span class="o">,</span>
<span class="nx">i</span><span class="o">;</span>
<span class="k">function</span> <span class="nx">removeChild</span><span class="o">(</span><span class="nx">p_oElement</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">inDocument</span><span class="o">(</span><span class="nx">p_oElement</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">p_oElement</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">p_oElement</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oField</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isArray</span><span class="o">(</span><span class="nx">oField</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">nFields</span> <span class="o">=</span> <span class="nx">oField</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">nFields</span> <span class="o">></span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">i</span> <span class="o">=</span> <span class="nx">nFields</span> <span class="o">-</span> <span class="m">1</span><span class="o">;</span>
<span class="k">do</span> <span class="o">{</span>
<span class="nx">removeChild</span><span class="o">(</span><span class="nx">oField</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
<span class="o">}</span>
<span class="k">while</span> <span class="o">(</span><span class="nx">i</span><span class="o">--);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">removeChild</span><span class="o">(</span><span class="nx">oField</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_hiddenFields</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method submitForm</span>
<span class="c"> * @description Submits the form to which the button belongs. Returns </span>
<span class="c"> * true if the form was submitted successfully, false if the submission </span>
<span class="c"> * was cancelled.</span>
<span class="c"> * @protected</span>
<span class="c"> * @return {Boolean}</span>
<span class="c"> */</span>
<span class="nx">submitForm</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oForm</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getForm</span><span class="o">(),</span>
<span class="nx">oSrcElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"srcelement"</span><span class="o">),</span>
<span class="c">/*</span>
<span class="c"> Boolean indicating if the event fired successfully </span>
<span class="c"> (was not cancelled by any handlers)</span>
<span class="c"> */</span>
<span class="nx">bSubmitForm</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
<span class="nx">oEvent</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oForm</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">==</span> <span class="s2">"submit"</span> <span class="o">||</span> <span class="o">(</span><span class="nx">oSrcElement</span> <span class="o">&&</span> <span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">type</span> <span class="o">==</span> <span class="s2">"submit"</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">m_oSubmitTrigger</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">UA</span><span class="o">.</span><span class="nx">ie</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">bSubmitForm</span> <span class="o">=</span> <span class="nx">oForm</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s2">"onsubmit"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span> <span class="c">// Gecko, Opera, and Safari</span>
<span class="c"></span>
<span class="nx">oEvent</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createEvent</span><span class="o">(</span><span class="s2">"HTMLEvents"</span><span class="o">);</span>
<span class="nx">oEvent</span><span class="o">.</span><span class="nx">initEvent</span><span class="o">(</span><span class="s2">"submit"</span><span class="o">,</span> <span class="kc">true</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
<span class="nx">bSubmitForm</span> <span class="o">=</span> <span class="nx">oForm</span><span class="o">.</span><span class="nx">dispatchEvent</span><span class="o">(</span><span class="nx">oEvent</span><span class="o">);</span>
<span class="o">}</span>
<span class="c">/*</span>
<span class="c"> In IE and Safari, dispatching a "submit" event to a form </span>
<span class="c"> WILL cause the form's "submit" event to fire, but WILL NOT </span>
<span class="c"> submit the form. Therefore, we need to call the "submit" </span>
<span class="c"> method as well.</span>
<span class="c"> */</span>
<span class="k">if</span> <span class="o">((</span><span class="nx">UA</span><span class="o">.</span><span class="nx">ie</span> <span class="o">||</span> <span class="nx">UA</span><span class="o">.</span><span class="nx">webkit</span><span class="o">)</span> <span class="o">&&</span> <span class="nx">bSubmitForm</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oForm</span><span class="o">.</span><span class="nx">submit</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">bSubmitForm</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method init</span>
<span class="c"> * @description The Button class's initialization method.</span>
<span class="c"> * @param {String} p_oElement String specifying the id attribute of the </span>
<span class="c"> * <code>&#60;input&#62;</code>, <code>&#60;button&#62;</code>,</span>
<span class="c"> * <code>&#60;a&#62;</code>, or <code>&#60;span&#62;</code> element to </span>
<span class="c"> * be used to create the button.</span>
<span class="c"> * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c"> * level-one-html.html#ID-6043025">HTMLInputElement</a>|<a href="http://</span>
<span class="c"> * www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html</span>
<span class="c"> * #ID-34812697">HTMLButtonElement</a>|<a href="http://www.w3.org/TR</span>
<span class="c"> * /2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-33759296"></span>
<span class="c"> * HTMLElement</a>} p_oElement Object reference for the </span>
<span class="c"> * <code>&#60;input&#62;</code>, <code>&#60;button&#62;</code>, </span>
<span class="c"> * <code>&#60;a&#62;</code>, or <code>&#60;span&#62;</code> element to be </span>
<span class="c"> * used to create the button.</span>
<span class="c"> * @param {Object} p_oElement Object literal specifying a set of </span>
<span class="c"> * configuration attributes used to create the button.</span>
<span class="c"> * @param {Object} p_oAttributes Optional. Object literal specifying a </span>
<span class="c"> * set of configuration attributes used to create the button.</span>
<span class="c"> */</span>
<span class="nx">init</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oElement</span><span class="o">,</span> <span class="nx">p_oAttributes</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sNodeName</span> <span class="o">=</span> <span class="nx">p_oAttributes</span><span class="o">.</span><span class="nx">type</span> <span class="o">==</span> <span class="s2">"link"</span> <span class="o">?</span> <span class="s2">"a"</span> <span class="o">:</span> <span class="s2">"button"</span><span class="o">,</span>
<span class="nx">oSrcElement</span> <span class="o">=</span> <span class="nx">p_oAttributes</span><span class="o">.</span><span class="nx">srcelement</span><span class="o">,</span>
<span class="nx">oButton</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">getElementsByTagName</span><span class="o">(</span><span class="nx">sNodeName</span><span class="o">)[</span><span class="m">0</span><span class="o">],</span>
<span class="nx">oInput</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">oButton</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oInput</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">getElementsByTagName</span><span class="o">(</span><span class="s2">"input"</span><span class="o">)[</span><span class="m">0</span><span class="o">];</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oInput</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oButton</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">"button"</span><span class="o">);</span>
<span class="nx">oButton</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="s2">"type"</span><span class="o">,</span> <span class="s2">"button"</span><span class="o">);</span>
<span class="nx">oInput</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">.</span><span class="nx">replaceChild</span><span class="o">(</span><span class="nx">oButton</span><span class="o">,</span> <span class="nx">oInput</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_button</span> <span class="o">=</span> <span class="nx">oButton</span><span class="o">;</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Button</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">init</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">p_oElement</span><span class="o">,</span> <span class="nx">p_oAttributes</span><span class="o">);</span>
<span class="k">var</span> <span class="nx">sId</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"id"</span><span class="o">),</span>
<span class="nx">sButtonId</span> <span class="o">=</span> <span class="nx">sId</span> <span class="o">+</span> <span class="s2">"-button"</span><span class="o">;</span>
<span class="nx">oButton</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="nx">sButtonId</span><span class="o">;</span>
<span class="k">var</span> <span class="nx">aLabels</span><span class="o">,</span>
<span class="nx">oLabel</span><span class="o">;</span>
<span class="k">var</span> <span class="nx">hasLabel</span> <span class="o">=</span> <span class="k">function</span> <span class="o">(</span><span class="nx">element</span><span class="o">)</span> <span class="o">{</span>
<span class="k">return</span> <span class="o">(</span><span class="nx">element</span><span class="o">.</span><span class="nx">htmlFor</span> <span class="o">===</span> <span class="nx">sId</span><span class="o">);</span>
<span class="o">};</span>
<span class="k">var</span> <span class="nx">setLabel</span> <span class="o">=</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="nx">oLabel</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">((</span><span class="nx">UA</span><span class="o">.</span><span class="nx">ie</span> <span class="o">?</span> <span class="s2">"htmlFor"</span> <span class="o">:</span> <span class="s2">"for"</span><span class="o">),</span> <span class="nx">sButtonId</span><span class="o">);</span>
<span class="o">};</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oSrcElement</span> <span class="o">&&</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">!=</span> <span class="s2">"link"</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">aLabels</span> <span class="o">=</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">getElementsBy</span><span class="o">(</span><span class="nx">hasLabel</span><span class="o">,</span> <span class="s2">"label"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isArray</span><span class="o">(</span><span class="nx">aLabels</span><span class="o">)</span> <span class="o">&&</span> <span class="nx">aLabels</span><span class="o">.</span><span class="nx">length</span> <span class="o">></span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oLabel</span> <span class="o">=</span> <span class="nx">aLabels</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="nx">m_oButtons</span><span class="o">[</span><span class="nx">sId</span><span class="o">]</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>
<span class="k">var</span> <span class="nx">sPrefix</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">CLASS_NAME_PREFIX</span><span class="o">;</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">sPrefix</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">CSS_CLASS_NAME</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">sPrefix</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">+</span> <span class="s2">"-button"</span><span class="o">);</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">,</span> <span class="s2">"focus"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onFocus</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"mouseover"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onMouseOver</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"mousedown"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onMouseDown</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"mouseup"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onMouseUp</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"click"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onClick</span><span class="o">);</span>
<span class="c">// Need to reset the value of the "onclick" Attribute so that any</span>
<span class="c"></span> <span class="c">// handlers registered via the "onclick" Attribute are fired after </span>
<span class="c"></span> <span class="c">// Button's default "_onClick" listener.</span>
<span class="c"></span>
<span class="k">var</span> <span class="nx">fnOnClick</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"onclick"</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="s2">"onclick"</span><span class="o">,</span> <span class="kc">null</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="s2">"onclick"</span><span class="o">,</span> <span class="nx">fnOnClick</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"dblclick"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onDblClick</span><span class="o">);</span>
<span class="k">var</span> <span class="nx">oParentNode</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oLabel</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"replaceLabel"</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">set</span><span class="o">(</span><span class="s2">"label"</span><span class="o">,</span> <span class="nx">oLabel</span><span class="o">.</span><span class="nx">innerHTML</span><span class="o">);</span>
<span class="nx">oParentNode</span> <span class="o">=</span> <span class="nx">oLabel</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">;</span>
<span class="nx">oParentNode</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">oLabel</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"appendTo"</span><span class="o">,</span> <span class="nx">setLabel</span><span class="o">);</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="nx">oLabel</span><span class="o">,</span> <span class="s2">"click"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onLabelClick</span><span class="o">,</span> <span class="kc">null</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_label</span> <span class="o">=</span> <span class="nx">oLabel</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"appendTo"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onAppendTo</span><span class="o">);</span>
<span class="k">var</span> <span class="nx">oContainer</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"container"</span><span class="o">),</span>
<span class="nx">oElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"element"</span><span class="o">),</span>
<span class="nx">bElInDoc</span> <span class="o">=</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">inDocument</span><span class="o">(</span><span class="nx">oElement</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oContainer</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oSrcElement</span> <span class="o">&&</span> <span class="nx">oSrcElement</span> <span class="o">!=</span> <span class="nx">oElement</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oParentNode</span> <span class="o">=</span> <span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oParentNode</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oParentNode</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">oSrcElement</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">oContainer</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">onContentReady</span><span class="o">(</span><span class="nx">oContainer</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">appendTo</span><span class="o">,</span> <span class="nx">oContainer</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">on</span><span class="o">(</span><span class="s2">"init"</span><span class="o">,</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="nx">Lang</span><span class="o">.</span><span class="nx">later</span><span class="o">(</span><span class="m">0</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">appendTo</span><span class="o">,</span> <span class="nx">oContainer</span><span class="o">);</span>
<span class="o">});</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(!</span><span class="nx">bElInDoc</span> <span class="o">&&</span> <span class="nx">oSrcElement</span> <span class="o">&&</span> <span class="nx">oSrcElement</span> <span class="o">!=</span> <span class="nx">oElement</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oParentNode</span> <span class="o">=</span> <span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oParentNode</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s2">"beforeAppendTo"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s2">"beforeAppendTo"</span><span class="o">,</span>
<span class="nx">target</span><span class="o">:</span> <span class="nx">oParentNode</span>
<span class="o">});</span>
<span class="nx">oParentNode</span><span class="o">.</span><span class="nx">replaceChild</span><span class="o">(</span><span class="nx">oElement</span><span class="o">,</span> <span class="nx">oSrcElement</span><span class="o">);</span>
<span class="k">this</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s2">"appendTo"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s2">"appendTo"</span><span class="o">,</span>
<span class="nx">target</span><span class="o">:</span> <span class="nx">oParentNode</span>
<span class="o">});</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">!=</span> <span class="s2">"link"</span> <span class="o">&&</span> <span class="nx">bElInDoc</span> <span class="o">&&</span> <span class="nx">oSrcElement</span> <span class="o">&&</span>
<span class="nx">oSrcElement</span> <span class="o">==</span> <span class="nx">oElement</span><span class="o">)</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_addListenersToForm</span><span class="o">();</span>
<span class="o">}</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Initialization completed."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="k">this</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s2">"init"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s2">"init"</span><span class="o">,</span>
<span class="nx">target</span><span class="o">:</span> <span class="k">this</span>
<span class="o">});</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method initAttributes</span>
<span class="c"> * @description Initializes all of the configuration attributes used to </span>
<span class="c"> * create the button.</span>
<span class="c"> * @param {Object} p_oAttributes Object literal specifying a set of </span>
<span class="c"> * configuration attributes used to create the button.</span>
<span class="c"> */</span>
<span class="nx">initAttributes</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oAttributes</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oAttributes</span> <span class="o">=</span> <span class="nx">p_oAttributes</span> <span class="o">||</span> <span class="o">{};</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Button</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">initAttributes</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span>
<span class="nx">oAttributes</span><span class="o">);</span>
<span class="c">/**</span>
<span class="c"> * @attribute type</span>
<span class="c"> * @description String specifying the button's type. Possible </span>
<span class="c"> * values are: "push," "link," "submit," "reset," "checkbox," </span>
<span class="c"> * "radio," "menu," and "split."</span>
<span class="c"> * @default "push"</span>
<span class="c"> * @type String</span>
<span class="c"> * @writeonce</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"type"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="o">(</span><span class="nx">oAttributes</span><span class="o">.</span><span class="nx">type</span> <span class="o">||</span> <span class="s2">"push"</span><span class="o">),</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">,</span>
<span class="nx">writeOnce</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_setType</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute label</span>
<span class="c"> * @description String specifying the button's text label </span>
<span class="c"> * or innerHTML.</span>
<span class="c"> * @default null</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"label"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="nx">oAttributes</span><span class="o">.</span><span class="k">label</span><span class="o">,</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_setLabel</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute value</span>
<span class="c"> * @description Object specifying the value for the button.</span>
<span class="c"> * @default null</span>
<span class="c"> * @type Object</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"value"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="nx">oAttributes</span><span class="o">.</span><span class="nx">value</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute name</span>
<span class="c"> * @description String specifying the name for the button.</span>
<span class="c"> * @default null</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"name"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="nx">oAttributes</span><span class="o">.</span><span class="nx">name</span><span class="o">,</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute tabindex</span>
<span class="c"> * @description Number specifying the tabindex for the button.</span>
<span class="c"> * @default null</span>
<span class="c"> * @type Number</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"tabindex"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="nx">oAttributes</span><span class="o">.</span><span class="nx">tabindex</span><span class="o">,</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isNumber</span><span class="o">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_setTabIndex</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute title</span>
<span class="c"> * @description String specifying the title for the button.</span>
<span class="c"> * @default null</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">configureAttribute</span><span class="o">(</span><span class="s2">"title"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="nx">oAttributes</span><span class="o">.</span><span class="nx">title</span><span class="o">,</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_setTitle</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute disabled</span>
<span class="c"> * @description Boolean indicating if the button should be disabled. </span>
<span class="c"> * (Disabled buttons are dimmed and will not respond to user input </span>
<span class="c"> * or fire events. Does not apply to button's of type "link.")</span>
<span class="c"> * @default false</span>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"disabled"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="o">(</span><span class="nx">oAttributes</span><span class="o">.</span><span class="nx">disabled</span> <span class="o">||</span> <span class="kc">false</span><span class="o">),</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isBoolean</span><span class="o">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_setDisabled</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute href</span>
<span class="c"> * @description String specifying the href for the button. Applies</span>
<span class="c"> * only to buttons of type "link."</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"href"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="nx">oAttributes</span><span class="o">.</span><span class="nx">href</span><span class="o">,</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_setHref</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute target</span>
<span class="c"> * @description String specifying the target for the button. </span>
<span class="c"> * Applies only to buttons of type "link."</span>
<span class="c"> * @type String</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"target"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="nx">oAttributes</span><span class="o">.</span><span class="nx">target</span><span class="o">,</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_setTarget</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute checked</span>
<span class="c"> * @description Boolean indicating if the button is checked. </span>
<span class="c"> * Applies only to buttons of type "radio" and "checkbox."</span>
<span class="c"> * @default false</span>
<span class="c"> * @type Boolean</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"checked"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="o">(</span><span class="nx">oAttributes</span><span class="o">.</span><span class="nx">checked</span> <span class="o">||</span> <span class="kc">false</span><span class="o">),</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isBoolean</span><span class="o">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_setChecked</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute container</span>
<span class="c"> * @description HTML element reference or string specifying the id </span>
<span class="c"> * attribute of the HTML element that the button's markup should be </span>
<span class="c"> * rendered into.</span>
<span class="c"> * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c"> * level-one-html.html#ID-58190037">HTMLElement</a>|String</span>
<span class="c"> * @default null</span>
<span class="c"> * @writeonce</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"container"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="nx">oAttributes</span><span class="o">.</span><span class="nx">container</span><span class="o">,</span>
<span class="nx">writeOnce</span><span class="o">:</span> <span class="kc">true</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute srcelement</span>
<span class="c"> * @description Object reference to the HTML element (either </span>
<span class="c"> * <code>&#60;input&#62;</code> or <code>&#60;span&#62;</code>) </span>
<span class="c"> * used to create the button.</span>
<span class="c"> * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c"> * level-one-html.html#ID-58190037">HTMLElement</a>|String</span>
<span class="c"> * @default null</span>
<span class="c"> * @writeonce</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"srcelement"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="nx">oAttributes</span><span class="o">.</span><span class="nx">srcelement</span><span class="o">,</span>
<span class="nx">writeOnce</span><span class="o">:</span> <span class="kc">true</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute menu</span>
<span class="c"> * @description Object specifying the menu for the button. </span>
<span class="c"> * The value can be one of the following:</span>
<span class="c"> * <ul></span>
<span class="c"> * <li>Object specifying a rendered <a href="YAHOO.widget.Menu.html"></span>
<span class="c"> * YAHOO.widget.Menu</a> instance.</li></span>
<span class="c"> * <li>Object specifying a rendered <a href="YAHOO.widget.Overlay.html"></span>
<span class="c"> * YAHOO.widget.Overlay</a> instance.</li></span>
<span class="c"> * <li>String specifying the id attribute of the <code>&#60;div&#62;</span>
<span class="c"> * </code> element used to create the menu. By default the menu </span>
<span class="c"> * will be created as an instance of </span>
<span class="c"> * <a href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a>. </span>
<span class="c"> * If the <a href="YAHOO.widget.Menu.html#CSS_CLASS_NAME"></span>
<span class="c"> * default CSS class name for YAHOO.widget.Menu</a> is applied to </span>
<span class="c"> * the <code>&#60;div&#62;</code> element, it will be created as an</span>
<span class="c"> * instance of <a href="YAHOO.widget.Menu.html">YAHOO.widget.Menu</span>
<span class="c"> * </a>.</li><li>String specifying the id attribute of the </span>
<span class="c"> * <code>&#60;select&#62;</code> element used to create the menu.</span>
<span class="c"> * </li><li>Object specifying the <code>&#60;div&#62;</code> element</span>
<span class="c"> * used to create the menu.</li></span>
<span class="c"> * <li>Object specifying the <code>&#60;select&#62;</code> element</span>
<span class="c"> * used to create the menu.</li></span>
<span class="c"> * <li>Array of object literals, each representing a set of </span>
<span class="c"> * <a href="YAHOO.widget.MenuItem.html">YAHOO.widget.MenuItem</a> </span>
<span class="c"> * configuration attributes.</li></span>
<span class="c"> * <li>Array of strings representing the text labels for each menu </span>
<span class="c"> * item in the menu.</li></span>
<span class="c"> * </ul></span>
<span class="c"> * @type <a href="YAHOO.widget.Menu.html">YAHOO.widget.Menu</a>|<a </span>
<span class="c"> * href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a>|<a </span>
<span class="c"> * href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c"> * one-html.html#ID-58190037">HTMLElement</a>|String|Array</span>
<span class="c"> * @default null</span>
<span class="c"> * @writeonce</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"menu"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_setMenu</span><span class="o">,</span>
<span class="nx">writeOnce</span><span class="o">:</span> <span class="kc">true</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute lazyloadmenu</span>
<span class="c"> * @description Boolean indicating the value to set for the </span>
<span class="c"> * <a href="YAHOO.widget.Menu.html#lazyLoad">"lazyload"</a></span>
<span class="c"> * configuration property of the button's menu. Setting </span>
<span class="c"> * "lazyloadmenu" to <code>true </code> will defer rendering of </span>
<span class="c"> * the button's menu until the first time it is made visible. </span>
<span class="c"> * If "lazyloadmenu" is set to <code>false</code>, the button's </span>
<span class="c"> * menu will be rendered immediately if the button is in the </span>
<span class="c"> * document, or in response to the button's "appendTo" event if </span>
<span class="c"> * the button is not yet in the document. In either case, the </span>
<span class="c"> * menu is rendered into the button's parent HTML element. </span>
<span class="c"> * <em>This attribute does not apply if a </span>
<span class="c"> * <a href="YAHOO.widget.Menu.html">YAHOO.widget.Menu</a> or </span>
<span class="c"> * <a href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a> </span>
<span class="c"> * instance is passed as the value of the button's "menu" </span>
<span class="c"> * configuration attribute. <a href="YAHOO.widget.Menu.html"></span>
<span class="c"> * YAHOO.widget.Menu</a> or <a href="YAHOO.widget.Overlay.html"></span>
<span class="c"> * YAHOO.widget.Overlay</a> instances should be rendered before </span>
<span class="c"> * being set as the value for the "menu" configuration </span>
<span class="c"> * attribute.</em></span>
<span class="c"> * @default true</span>
<span class="c"> * @type Boolean</span>
<span class="c"> * @writeonce</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"lazyloadmenu"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="o">(</span><span class="nx">oAttributes</span><span class="o">.</span><span class="nx">lazyloadmenu</span> <span class="o">===</span> <span class="kc">false</span> <span class="o">?</span> <span class="kc">false</span> <span class="o">:</span> <span class="kc">true</span><span class="o">),</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isBoolean</span><span class="o">,</span>
<span class="nx">writeOnce</span><span class="o">:</span> <span class="kc">true</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute menuclassname</span>
<span class="c"> * @description String representing the CSS class name to be </span>
<span class="c"> * applied to the root element of the button's menu.</span>
<span class="c"> * @type String</span>
<span class="c"> * @default "yui-button-menu"</span>
<span class="c"> * @writeonce</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"menuclassname"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="o">(</span><span class="nx">oAttributes</span><span class="o">.</span><span class="nx">menuclassname</span> <span class="o">||</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">CLASS_NAME_PREFIX</span> <span class="o">+</span> <span class="s2">"button-menu"</span><span class="o">)),</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_setMenuClassName</span><span class="o">,</span>
<span class="nx">writeOnce</span><span class="o">:</span> <span class="kc">true</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute menuminscrollheight</span>
<span class="c"> * @description Number defining the minimum threshold for the "menumaxheight" </span>
<span class="c"> * configuration attribute. When set this attribute is automatically applied </span>
<span class="c"> * to all submenus.</span>
<span class="c"> * @default 90</span>
<span class="c"> * @type Number</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"menuminscrollheight"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="o">(</span><span class="nx">oAttributes</span><span class="o">.</span><span class="nx">menuminscrollheight</span> <span class="o">||</span> <span class="m">90</span><span class="o">),</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isNumber</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute menumaxheight</span>
<span class="c"> * @description Number defining the maximum height (in pixels) for a menu's </span>
<span class="c"> * body element (<code>&#60;div class="bd"&#60;</code>). Once a menu's body </span>
<span class="c"> * exceeds this height, the contents of the body are scrolled to maintain </span>
<span class="c"> * this value. This value cannot be set lower than the value of the </span>
<span class="c"> * "minscrollheight" configuration property.</span>
<span class="c"> * @type Number</span>
<span class="c"> * @default 0</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"menumaxheight"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="o">(</span><span class="nx">oAttributes</span><span class="o">.</span><span class="nx">menumaxheight</span> <span class="o">||</span> <span class="m">0</span><span class="o">),</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isNumber</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute menualignment</span>
<span class="c"> * @description Array defining how the Button's Menu is aligned to the Button. </span>
<span class="c"> * The default value of ["tl", "bl"] aligns the Menu's top left corner to the Button's </span>
<span class="c"> * bottom left corner.</span>
<span class="c"> * @type Array</span>
<span class="c"> * @default ["tl", "bl"]</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"menualignment"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="o">(</span><span class="nx">oAttributes</span><span class="o">.</span><span class="nx">menualignment</span> <span class="o">||</span> <span class="o">[</span><span class="s2">"tl"</span><span class="o">,</span> <span class="s2">"bl"</span><span class="o">]),</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isArray</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute selectedMenuItem</span>
<span class="c"> * @description Object representing the item in the button's menu </span>
<span class="c"> * that is currently selected.</span>
<span class="c"> * @type YAHOO.widget.MenuItem</span>
<span class="c"> * @default null</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"selectedMenuItem"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">null</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute onclick</span>
<span class="c"> * @description Object literal representing the code to be executed </span>
<span class="c"> * when the button is clicked. Format:<br> <code> {<br> </span>
<span class="c"> * <strong>fn:</strong> Function, &#47;&#47; The handler to call </span>
<span class="c"> * when the event fires.<br> <strong>obj:</strong> Object, </span>
<span class="c"> * &#47;&#47; An object to pass back to the handler.<br> </span>
<span class="c"> * <strong>scope:</strong> Object &#47;&#47; The object to use </span>
<span class="c"> * for the scope of the handler.<br> } </code></span>
<span class="c"> * @type Object</span>
<span class="c"> * @default null</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"onclick"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="nx">oAttributes</span><span class="o">.</span><span class="nx">onclick</span><span class="o">,</span>
<span class="nx">method</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_setOnClick</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute focusmenu</span>
<span class="c"> * @description Boolean indicating whether or not the button's menu </span>
<span class="c"> * should be focused when it is made visible.</span>
<span class="c"> * @type Boolean</span>
<span class="c"> * @default true</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"focusmenu"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="o">(</span><span class="nx">oAttributes</span><span class="o">.</span><span class="nx">focusmenu</span> <span class="o">===</span> <span class="kc">false</span> <span class="o">?</span> <span class="kc">false</span> <span class="o">:</span> <span class="kc">true</span><span class="o">),</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isBoolean</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @attribute replaceLabel</span>
<span class="c"> * @description Boolean indicating whether or not the text of the </span>
<span class="c"> * button's <code>&#60;label&#62;</code> element should be used as</span>
<span class="c"> * the source for the button's label configuration attribute and </span>
<span class="c"> * removed from the DOM.</span>
<span class="c"> * @type Boolean</span>
<span class="c"> * @default false</span>
<span class="c"> */</span>
<span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s2">"replaceLabel"</span><span class="o">,</span> <span class="o">{</span>
<span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
<span class="nx">validator</span><span class="o">:</span> <span class="nx">Lang</span><span class="o">.</span><span class="nx">isBoolean</span><span class="o">,</span>
<span class="nx">writeOnce</span><span class="o">:</span> <span class="kc">true</span>
<span class="o">});</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method focus</span>
<span class="c"> * @description Causes the button to receive the focus and fires the </span>
<span class="c"> * button's "focus" event.</span>
<span class="c"> */</span>
<span class="nx">focus</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"disabled"</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">.</span><span class="nx">focus</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method blur</span>
<span class="c"> * @description Causes the button to lose focus and fires the button's</span>
<span class="c"> * "blur" event.</span>
<span class="c"> */</span>
<span class="nx">blur</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"disabled"</span><span class="o">))</span> <span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">.</span><span class="nx">blur</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method hasFocus</span>
<span class="c"> * @description Returns a boolean indicating whether or not the button </span>
<span class="c"> * has focus.</span>
<span class="c"> * @return {Boolean}</span>
<span class="c"> */</span>
<span class="nx">hasFocus</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="o">(</span><span class="nx">m_oFocusedButton</span> <span class="o">==</span> <span class="k">this</span><span class="o">);</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method isActive</span>
<span class="c"> * @description Returns a boolean indicating whether or not the button </span>
<span class="c"> * is active.</span>
<span class="c"> * @return {Boolean}</span>
<span class="c"> */</span>
<span class="nx">isActive</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="k">this</span><span class="o">.</span><span class="nx">hasClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">CLASS_NAME_PREFIX</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">CSS_CLASS_NAME</span> <span class="o">+</span> <span class="s2">"-active"</span><span class="o">);</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method getMenu</span>
<span class="c"> * @description Returns a reference to the button's menu.</span>
<span class="c"> * @return {<a href="YAHOO.widget.Overlay.html"></span>
<span class="c"> * YAHOO.widget.Overlay</a>|<a </span>
<span class="c"> * href="YAHOO.widget.Menu.html">YAHOO.widget.Menu</a>}</span>
<span class="c"> */</span>
<span class="nx">getMenu</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="k">this</span><span class="o">.</span><span class="nx">_menu</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method getForm</span>
<span class="c"> * @description Returns a reference to the button's parent form.</span>
<span class="c"> * @return {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-</span>
<span class="c"> * 20000929/level-one-html.html#ID-40002357">HTMLFormElement</a>}</span>
<span class="c"> */</span>
<span class="nx">getForm</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oButton</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">,</span>
<span class="nx">oForm</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oButton</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oForm</span> <span class="o">=</span> <span class="nx">oButton</span><span class="o">.</span><span class="nx">form</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">oForm</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/** </span>
<span class="c"> * @method getHiddenFields</span>
<span class="c"> * @description Returns an <code>&#60;input&#62;</code> element or </span>
<span class="c"> * array of form elements used to represent the button when its parent </span>
<span class="c"> * form is submitted. </span>
<span class="c"> * @return {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c"> * level-one-html.html#ID-6043025">HTMLInputElement</a>|Array}</span>
<span class="c"> */</span>
<span class="nx">getHiddenFields</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="k">this</span><span class="o">.</span><span class="nx">_hiddenFields</span><span class="o">;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method destroy</span>
<span class="c"> * @description Removes the button's element from its parent element and </span>
<span class="c"> * removes all event handlers.</span>
<span class="c"> */</span>
<span class="nx">destroy</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Destroying ..."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="k">var</span> <span class="nx">oElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"element"</span><span class="o">),</span>
<span class="nx">oMenu</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_menu</span><span class="o">,</span>
<span class="nx">oLabel</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_label</span><span class="o">,</span>
<span class="nx">oParentNode</span><span class="o">,</span>
<span class="nx">aButtons</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oMenu</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Destroying menu."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">m_oOverlayManager</span> <span class="o">&&</span> <span class="nx">m_oOverlayManager</span><span class="o">.</span><span class="nx">find</span><span class="o">(</span><span class="nx">oMenu</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">m_oOverlayManager</span><span class="o">.</span><span class="nx">remove</span><span class="o">(</span><span class="nx">oMenu</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">oMenu</span><span class="o">.</span><span class="nx">destroy</span><span class="o">();</span>
<span class="o">}</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Removing DOM event listeners."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">purgeElement</span><span class="o">(</span><span class="nx">oElement</span><span class="o">);</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">purgeElement</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_button</span><span class="o">);</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="nb">document</span><span class="o">,</span> <span class="s2">"mouseup"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onDocumentMouseUp</span><span class="o">);</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="nb">document</span><span class="o">,</span> <span class="s2">"keyup"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onDocumentKeyUp</span><span class="o">);</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="nb">document</span><span class="o">,</span> <span class="s2">"mousedown"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onDocumentMouseDown</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oLabel</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="nx">oLabel</span><span class="o">,</span> <span class="s2">"click"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onLabelClick</span><span class="o">);</span>
<span class="nx">oParentNode</span> <span class="o">=</span> <span class="nx">oLabel</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">;</span>
<span class="nx">oParentNode</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">oLabel</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">var</span> <span class="nx">oForm</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getForm</span><span class="o">();</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oForm</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="nx">oForm</span><span class="o">,</span> <span class="s2">"reset"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onFormReset</span><span class="o">);</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="nx">oForm</span><span class="o">,</span> <span class="s2">"submit"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onFormSubmit</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Removing CustomEvent listeners."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="k">this</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>
<span class="nx">oParentNode</span> <span class="o">=</span> <span class="nx">oElement</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oParentNode</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oParentNode</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">oElement</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Removing from document."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="nx">delete</span> <span class="nx">m_oButtons</span><span class="o">[</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"id"</span><span class="o">)];</span>
<span class="k">var</span> <span class="nx">sClass</span> <span class="o">=</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">CLASS_NAME_PREFIX</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">CSS_CLASS_NAME</span><span class="o">);</span>
<span class="nx">aButtons</span> <span class="o">=</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">getElementsByClassName</span><span class="o">(</span><span class="nx">sClass</span><span class="o">,</span>
<span class="k">this</span><span class="o">.</span><span class="nx">NODE_NAME</span><span class="o">,</span> <span class="nx">oForm</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isArray</span><span class="o">(</span><span class="nx">aButtons</span><span class="o">)</span> <span class="o">&&</span> <span class="nx">aButtons</span><span class="o">.</span><span class="nx">length</span> <span class="o">===</span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="nx">oForm</span><span class="o">,</span> <span class="s2">"keypress"</span><span class="o">,</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Button</span><span class="o">.</span><span class="nx">onFormKeyPress</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Destroyed."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="o">},</span>
<span class="nx">fireEvent</span><span class="o">:</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sType</span> <span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sType</span> <span class="o">=</span> <span class="nx">arguments</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>
<span class="c">// Disabled buttons should not respond to DOM events</span>
<span class="c"></span>
<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">DOM_EVENTS</span><span class="o">[</span><span class="nx">sType</span><span class="o">]</span> <span class="o">&&</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"disabled"</span><span class="o">))</span> <span class="o">{</span>
<span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Button</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">.</span><span class="nx">apply</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">);</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @method toString</span>
<span class="c"> * @description Returns a string representing the button.</span>
<span class="c"> * @return {String}</span>
<span class="c"> */</span>
<span class="nx">toString</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="o">(</span><span class="s2">"Button "</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"id"</span><span class="o">));</span>
<span class="o">}</span>
<span class="o">});</span>
<span class="c">/**</span>
<span class="c"> * @method YAHOO.widget.Button.onFormKeyPress</span>
<span class="c"> * @description "keypress" event handler for the button's form.</span>
<span class="c"> * @param {Event} p_oEvent Object representing the DOM event object passed </span>
<span class="c"> * back by the event utility (YAHOO.util.Event).</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Button</span><span class="o">.</span><span class="nx">onFormKeyPress</span> <span class="o">=</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oEvent</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">oTarget</span> <span class="o">=</span> <span class="nx">Event</span><span class="o">.</span><span class="nx">getTarget</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">),</span>
<span class="nx">nCharCode</span> <span class="o">=</span> <span class="nx">Event</span><span class="o">.</span><span class="nx">getCharCode</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">),</span>
<span class="nx">sNodeName</span> <span class="o">=</span> <span class="nx">oTarget</span><span class="o">.</span><span class="nx">nodeName</span> <span class="o">&&</span> <span class="nx">oTarget</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">(),</span>
<span class="nx">sType</span> <span class="o">=</span> <span class="nx">oTarget</span><span class="o">.</span><span class="nx">type</span><span class="o">,</span>
<span class="c">/*</span>
<span class="c"> Boolean indicating if the form contains any enabled or </span>
<span class="c"> disabled YUI submit buttons</span>
<span class="c"> */</span>
<span class="nx">bFormContainsYUIButtons</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
<span class="nx">oButton</span><span class="o">,</span>
<span class="nx">oYUISubmitButton</span><span class="o">,</span> <span class="c">// The form's first, enabled YUI submit button</span>
<span class="c"></span>
<span class="c">/*</span>
<span class="c"> The form's first, enabled HTML submit button that precedes any </span>
<span class="c"> YUI submit button</span>
<span class="c"> */</span>
<span class="nx">oPrecedingSubmitButton</span><span class="o">,</span>
<span class="nx">oEvent</span><span class="o">;</span>
<span class="k">function</span> <span class="nx">isSubmitButton</span><span class="o">(</span><span class="nx">p_oElement</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">sId</span><span class="o">,</span>
<span class="nx">oSrcElement</span><span class="o">;</span>
<span class="nx">switch</span> <span class="o">(</span><span class="nx">p_oElement</span><span class="o">.</span><span class="nx">nodeName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">())</span> <span class="o">{</span>
<span class="nx">case</span> <span class="s2">"INPUT"</span><span class="o">:</span>
<span class="nx">case</span> <span class="s2">"BUTTON"</span><span class="o">:</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">p_oElement</span><span class="o">.</span><span class="nx">type</span> <span class="o">==</span> <span class="s2">"submit"</span> <span class="o">&&</span> <span class="o">!</span><span class="nx">p_oElement</span><span class="o">.</span><span class="nx">disabled</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">bFormContainsYUIButtons</span> <span class="o">&&</span> <span class="o">!</span><span class="nx">oPrecedingSubmitButton</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oPrecedingSubmitButton</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">break</span><span class="o">;</span>
<span class="nx">default</span><span class="o">:</span>
<span class="nx">sId</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">id</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sId</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oButton</span> <span class="o">=</span> <span class="nx">m_oButtons</span><span class="o">[</span><span class="nx">sId</span><span class="o">];</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oButton</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">bFormContainsYUIButtons</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">oButton</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"disabled"</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">oSrcElement</span> <span class="o">=</span> <span class="nx">oButton</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"srcelement"</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(!</span><span class="nx">oYUISubmitButton</span> <span class="o">&&</span> <span class="o">(</span><span class="nx">oButton</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"type"</span><span class="o">)</span> <span class="o">==</span> <span class="s2">"submit"</span> <span class="o">||</span>
<span class="o">(</span><span class="nx">oSrcElement</span> <span class="o">&&</span> <span class="nx">oSrcElement</span><span class="o">.</span><span class="nx">type</span> <span class="o">==</span> <span class="s2">"submit"</span><span class="o">)))</span> <span class="o">{</span>
<span class="nx">oYUISubmitButton</span> <span class="o">=</span> <span class="nx">oButton</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">break</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">nCharCode</span> <span class="o">==</span> <span class="m">13</span> <span class="o">&&</span> <span class="o">((</span><span class="nx">sNodeName</span> <span class="o">==</span> <span class="s2">"INPUT"</span> <span class="o">&&</span> <span class="o">(</span><span class="nx">sType</span> <span class="o">==</span> <span class="s2">"text"</span> <span class="o">||</span>
<span class="nx">sType</span> <span class="o">==</span> <span class="s2">"password"</span> <span class="o">||</span> <span class="nx">sType</span> <span class="o">==</span> <span class="s2">"checkbox"</span> <span class="o">||</span> <span class="nx">sType</span> <span class="o">==</span> <span class="s2">"radio"</span> <span class="o">||</span>
<span class="nx">sType</span> <span class="o">==</span> <span class="s2">"file"</span><span class="o">))</span> <span class="o">||</span> <span class="nx">sNodeName</span> <span class="o">==</span> <span class="s2">"SELECT"</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">Dom</span><span class="o">.</span><span class="nx">getElementsBy</span><span class="o">(</span><span class="nx">isSubmitButton</span><span class="o">,</span> <span class="s2">"*"</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oPrecedingSubmitButton</span><span class="o">)</span> <span class="o">{</span>
<span class="c">/*</span>
<span class="c"> Need to set focus to the first enabled submit button</span>
<span class="c"> to make sure that IE includes its name and value </span>
<span class="c"> in the form's data set.</span>
<span class="c"> */</span>
<span class="nx">oPrecedingSubmitButton</span><span class="o">.</span><span class="nx">focus</span><span class="o">();</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(!</span><span class="nx">oPrecedingSubmitButton</span> <span class="o">&&</span> <span class="nx">oYUISubmitButton</span><span class="o">)</span> <span class="o">{</span>
<span class="c">/*</span>
<span class="c"> Need to call "preventDefault" to ensure that the form doesn't end up getting</span>
<span class="c"> submitted twice.</span>
<span class="c"> */</span>
<span class="nx">Event</span><span class="o">.</span><span class="nx">preventDefault</span><span class="o">(</span><span class="nx">p_oEvent</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">UA</span><span class="o">.</span><span class="nx">ie</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oYUISubmitButton</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"element"</span><span class="o">).</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s2">"onclick"</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">oEvent</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createEvent</span><span class="o">(</span><span class="s2">"HTMLEvents"</span><span class="o">);</span>
<span class="nx">oEvent</span><span class="o">.</span><span class="nx">initEvent</span><span class="o">(</span><span class="s2">"click"</span><span class="o">,</span> <span class="kc">true</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">UA</span><span class="o">.</span><span class="nx">gecko</span> <span class="o"><</span> <span class="m">1</span><span class="o">.</span><span class="m">9</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oYUISubmitButton</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s2">"click"</span><span class="o">,</span> <span class="nx">oEvent</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">oYUISubmitButton</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">"element"</span><span class="o">).</span><span class="nx">dispatchEvent</span><span class="o">(</span><span class="nx">oEvent</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @method YAHOO.widget.Button.addHiddenFieldsToForm</span>
<span class="c"> * @description Searches the specified form and adds hidden fields for </span>
<span class="c"> * instances of YAHOO.widget.Button that are of type "radio," "checkbox," </span>
<span class="c"> * "menu," and "split."</span>
<span class="c"> * @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c"> * one-html.html#ID-40002357">HTMLFormElement</a>} p_oForm Object reference </span>
<span class="c"> * for the form to search.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Button</span><span class="o">.</span><span class="nx">addHiddenFieldsToForm</span> <span class="o">=</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_oForm</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">proto</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Button</span><span class="o">.</span><span class="nx">prototype</span><span class="o">,</span>
<span class="nx">aButtons</span> <span class="o">=</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">getElementsByClassName</span><span class="o">(</span>
<span class="o">(</span><span class="nx">proto</span><span class="o">.</span><span class="nx">CLASS_NAME_PREFIX</span> <span class="o">+</span> <span class="nx">proto</span><span class="o">.</span><span class="nx">CSS_CLASS_NAME</span><span class="o">),</span>
<span class="s2">"*"</span><span class="o">,</span>
<span class="nx">p_oForm</span><span class="o">),</span>
<span class="nx">nButtons</span> <span class="o">=</span> <span class="nx">aButtons</span><span class="o">.</span><span class="nx">length</span><span class="o">,</span>
<span class="nx">oButton</span><span class="o">,</span>
<span class="nx">sId</span><span class="o">,</span>
<span class="nx">i</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">nButtons</span> <span class="o">></span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">"Form contains "</span> <span class="o">+</span> <span class="nx">nButtons</span> <span class="o">+</span> <span class="s2">" YUI buttons."</span><span class="o">,</span> <span class="s2">"info"</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">toString</span><span class="o">());</span>
<span class="k">for</span> <span class="o">(</span><span class="nx">i</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span> <span class="nx">i</span> <span class="o"><</span> <span class="nx">nButtons</span><span class="o">;</span> <span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
<span class="nx">sId</span> <span class="o">=</span> <span class="nx">aButtons</span><span class="o">[</span><span class="nx">i</span><span class="o">].</span><span class="nx">id</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">sId</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oButton</span> <span class="o">=</span> <span class="nx">m_oButtons</span><span class="o">[</span><span class="nx">sId</span><span class="o">];</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">oButton</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">oButton</span><span class="o">.</span><span class="nx">createHiddenFields</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @method YAHOO.widget.Button.getButton</span>
<span class="c"> * @description Returns a button with the specified id.</span>
<span class="c"> * @param {String} p_sId String specifying the id of the root node of the </span>
<span class="c"> * HTML element representing the button to be retrieved.</span>
<span class="c"> * @return {YAHOO.widget.Button}</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Button</span><span class="o">.</span><span class="nx">getButton</span> <span class="o">=</span> <span class="k">function</span> <span class="o">(</span><span class="nx">p_sId</span><span class="o">)</span> <span class="o">{</span>
<span class="k">return</span> <span class="nx">m_oButtons</span><span class="o">[</span><span class="nx">p_sId</span><span class="o">];</span>
<span class="o">};</span>
<span class="c">// Events</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c"> * @event focus</span>
<span class="c"> * @description Fires when the menu item receives focus. Passes back a </span>
<span class="c"> * single object representing the original DOM event object passed back by </span>
<span class="c"> * the event utility (YAHOO.util.Event) when the event was fired. See </span>
<span class="c"> * <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> </span>
<span class="c"> * for more information on listening for this event.</span>
<span class="c"> * @type YAHOO.util.CustomEvent</span>
<span class="c"> */</span>
<span class="c">/**</span>
<span class="c"> * @event blur</span>
<span class="c"> * @description Fires when the menu item loses the input focus. Passes back </span>
<span class="c"> * a single object representing the original DOM event object passed back by </span>
<span class="c"> * the event utility (YAHOO.util.Event) when the event was fired. See </span>
<span class="c"> * <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for </span>
<span class="c"> * more information on listening for this event.</span>
<span class="c"> * @type YAHOO.util.CustomEvent</span>
<span class="c"> */</span>
<span class="c">/**</span>
<span class="c"> * @event option</span>
<span class="c"> * @description Fires when the user invokes the button's option. Passes </span>
<span class="c"> * back a single object representing the original DOM event (either </span>
<span class="c"> * "mousedown" or "keydown") that caused the "option" event to fire. See </span>
<span class="c"> * <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> </span>
<span class="c"> * for more information on listening for this event.</span>
<span class="c"> * @type YAHOO.util.CustomEvent</span>
<span class="c"> */</span>
<span class="o">})();</span>
</pre></div>
</div>
</div>
</div>
<div class="yui-b">
<div class="nav">
<div id="moduleList" class="module">
<h4>Modules</h4>
<ul class="content">
<li class=""><a href="module_animation.html" title="animation">animation</a></li>
<li class=""><a href="module_autocomplete.html" title="autocomplete">autocomplete</a></li>
<li class="selected"><a href="module_button.html" title="button">button</a></li>
<li class=""><a href="module_calendar.html" title="calendar">calendar</a></li>
<li class=""><a href="module_carousel.html" title="carousel">carousel</a></li>
<li class=""><a href="module_charts.html" title="charts">charts</a></li>
<li class=""><a href="module_colorpicker.html" title="colorpicker">colorpicker</a></li>
<li class=""><a href="module_connection.html" title="connection">connection</a></li>
<li class=""><a href="module_container.html" title="container">container</a></li>
<li class=""><a href="module_cookie.html" title="cookie">cookie</a></li>
<li class=""><a href="module_datasource.html" title="datasource">datasource</a></li>
<li class=""><a href="module_datatable.html" title="datatable">datatable</a></li>
<li class=""><a href="module_datemath.html" title="datemath">datemath</a></li>
<li class=""><a href="module_dom.html" title="dom">dom</a></li>
<li class=""><a href="module_dragdrop.html" title="dragdrop">dragdrop</a></li>
<li class=""><a href="module_editor.html" title="editor">editor</a></li>
<li class=""><a href="module_element.html" title="element">element</a></li>
<li class=""><a href="module_element-delegate.html" title="element-delegate">element-delegate</a></li>
<li class=""><a href="module_event.html" title="event">event</a></li>
<li class=""><a href="module_event-delegate.html" title="event-delegate">event-delegate</a></li>
<li class=""><a href="module_event-mouseenter.html" title="event-mouseenter">event-mouseenter</a></li>
<li class=""><a href="module_event-simulate.html" title="event-simulate">event-simulate</a></li>
<li class=""><a href="module_get.html" title="get">get</a></li>
<li class=""><a href="module_history.html" title="history">history</a></li>
<li class=""><a href="module_imagecropper.html" title="imagecropper">imagecropper</a></li>
<li class=""><a href="module_imageloader.html" title="imageloader">imageloader</a></li>
<li class=""><a href="module_json.html" title="json">json</a></li>
<li class=""><a href="module_layout.html" title="layout">layout</a></li>
<li class=""><a href="module_logger.html" title="logger">logger</a></li>
<li class=""><a href="module_menu.html" title="menu">menu</a></li>
<li class=""><a href="module_paginator.html" title="paginator">paginator</a></li>
<li class=""><a href="module_profiler.html" title="profiler">profiler</a></li>
<li class=""><a href="module_profilerviewer.html" title="profilerviewer">profilerviewer</a></li>
<li class=""><a href="module_progressbar.html" title="progressbar">progressbar</a></li>
<li class=""><a href="module_resize.html" title="resize">resize</a></li>
<li class=""><a href="module_selector.html" title="selector">selector</a></li>
<li class=""><a href="module_slider.html" title="slider">slider</a></li>
<li class=""><a href="module_storage.html" title="Storage">Storage</a></li>
<li class=""><a href="module_stylesheet.html" title="stylesheet">stylesheet</a></li>
<li class=""><a href="module_swf.html" title="swf">swf</a></li>
<li class=""><a href="module_swfdetect.html" title="swfdetect">swfdetect</a></li>
<li class=""><a href="module_swfstore.html" title="swfstore">swfstore</a></li>
<li class=""><a href="module_tabview.html" title="tabview">tabview</a></li>
<li class=""><a href="module_treeview.html" title="treeview">treeview</a></li>
<li class=""><a href="module_uploader.html" title="uploader">uploader</a></li>
<li class=""><a href="module_yahoo.html" title="yahoo">yahoo</a></li>
<li class=""><a href="module_yuiloader.html" title="yuiloader">yuiloader</a></li>
<li class=""><a href="module_yuitest.html" title="yuitest">yuitest</a></li>
</ul>
</div>
<div id="classList" class="module">
<h4>Classes</h4>
<ul class="content">
<li class=""><a href="YAHOO.widget.Button.html" title="YAHOO.widget.Button">YAHOO.widget.Button</a></li>
<li class=""><a href="YAHOO.widget.ButtonGroup.html" title="YAHOO.widget.ButtonGroup">YAHOO.widget.ButtonGroup</a></li>
</ul>
</div>
<div id="fileList" class="module">
<h4>Files</h4>
<ul class="content">
<li class="selected"><a href="button.js.html" title="button.js">button.js</a></li>
<li class=""><a href="buttongroup.js.html" title="buttongroup.js">buttongroup.js</a></li>
</ul>
</div>
</div>
</div>
</div>
<div id="ft">
<hr />
Copyright © 2009 Yahoo! Inc. All rights reserved.
</div>
</div>
<script type="text/javascript">
ALL_YUI_PROPS = [{"access": "protected", "host": "YAHOO.widget.Button", "name": "_activationButtonPressed", "url": "YAHOO.widget.Button.html#property__activationButtonPressed", "type": "property"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_activationKeyPressed", "url": "YAHOO.widget.Button.html#property__activationKeyPressed", "type": "property"}, {"access": "", "host": "YAHOO.widget.Button", "name": "ACTIVATION_KEYS", "url": "YAHOO.widget.Button.html#property_ACTIVATION_KEYS", "type": "property"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "addButton", "url": "YAHOO.widget.ButtonGroup.html#method_addButton", "type": "method"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "addButtons", "url": "YAHOO.widget.ButtonGroup.html#method_addButtons", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_addListenersToForm", "url": "YAHOO.widget.Button.html#method__addListenersToForm", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "addStateCSSClasses", "url": "YAHOO.widget.Button.html#method_addStateCSSClasses", "type": "method"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "beforeCheckedButtonChange", "url": "YAHOO.widget.ButtonGroup.html#event_beforeCheckedButtonChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeCheckedChange", "url": "YAHOO.widget.Button.html#event_beforeCheckedChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "beforeContainerChange", "url": "YAHOO.widget.ButtonGroup.html#event_beforeContainerChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeContainerChange", "url": "YAHOO.widget.Button.html#event_beforeContainerChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "beforeDisabledChange", "url": "YAHOO.widget.ButtonGroup.html#event_beforeDisabledChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeDisabledChange", "url": "YAHOO.widget.Button.html#event_beforeDisabledChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeFocusmenuChange", "url": "YAHOO.widget.Button.html#event_beforeFocusmenuChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeHrefChange", "url": "YAHOO.widget.Button.html#event_beforeHrefChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeLabelChange", "url": "YAHOO.widget.Button.html#event_beforeLabelChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeLazyloadmenuChange", "url": "YAHOO.widget.Button.html#event_beforeLazyloadmenuChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeMenualignmentChange", "url": "YAHOO.widget.Button.html#event_beforeMenualignmentChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeMenuChange", "url": "YAHOO.widget.Button.html#event_beforeMenuChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeMenuclassnameChange", "url": "YAHOO.widget.Button.html#event_beforeMenuclassnameChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeMenumaxheightChange", "url": "YAHOO.widget.Button.html#event_beforeMenumaxheightChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeMenuminscrollheightChange", "url": "YAHOO.widget.Button.html#event_beforeMenuminscrollheightChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "beforeNameChange", "url": "YAHOO.widget.ButtonGroup.html#event_beforeNameChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeNameChange", "url": "YAHOO.widget.Button.html#event_beforeNameChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeOnclickChange", "url": "YAHOO.widget.Button.html#event_beforeOnclickChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeReplaceLabelChange", "url": "YAHOO.widget.Button.html#event_beforeReplaceLabelChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeSelectedMenuItemChange", "url": "YAHOO.widget.Button.html#event_beforeSelectedMenuItemChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeSrcelementChange", "url": "YAHOO.widget.Button.html#event_beforeSrcelementChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeTabindexChange", "url": "YAHOO.widget.Button.html#event_beforeTabindexChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeTargetChange", "url": "YAHOO.widget.Button.html#event_beforeTargetChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeTitleChange", "url": "YAHOO.widget.Button.html#event_beforeTitleChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeTypeChange", "url": "YAHOO.widget.Button.html#event_beforeTypeChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "beforeValueChange", "url": "YAHOO.widget.ButtonGroup.html#event_beforeValueChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "beforeValueChange", "url": "YAHOO.widget.Button.html#event_beforeValueChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "blur", "url": "YAHOO.widget.Button.html#method_blur", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "blur", "url": "YAHOO.widget.Button.html#event_blur", "type": "event"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_button", "url": "YAHOO.widget.Button.html#property__button", "type": "property"}, {"access": "protected", "host": "YAHOO.widget.ButtonGroup", "name": "_buttons", "url": "YAHOO.widget.ButtonGroup.html#property__buttons", "type": "property"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "check", "url": "YAHOO.widget.ButtonGroup.html#method_check", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "CHECK_ACTIVATION_KEYS", "url": "YAHOO.widget.Button.html#property_CHECK_ACTIVATION_KEYS", "type": "property"}, {"access": "", "host": "YAHOO.widget.Button", "name": "checked", "url": "YAHOO.widget.Button.html#config_checked", "type": "config"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "checkedButton", "url": "YAHOO.widget.ButtonGroup.html#config_checkedButton", "type": "config"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "checkedButtonChange", "url": "YAHOO.widget.ButtonGroup.html#event_checkedButtonChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "checkedChange", "url": "YAHOO.widget.Button.html#event_checkedChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "CLASS_NAME_PREFIX", "url": "YAHOO.widget.ButtonGroup.html#property_CLASS_NAME_PREFIX", "type": "property"}, {"access": "", "host": "YAHOO.widget.Button", "name": "CLASS_NAME_PREFIX", "url": "YAHOO.widget.Button.html#property_CLASS_NAME_PREFIX", "type": "property"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "container", "url": "YAHOO.widget.ButtonGroup.html#config_container", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "container", "url": "YAHOO.widget.Button.html#config_container", "type": "config"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "containerChange", "url": "YAHOO.widget.ButtonGroup.html#event_containerChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "containerChange", "url": "YAHOO.widget.Button.html#event_containerChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "createButtonElement", "url": "YAHOO.widget.Button.html#method_createButtonElement", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.ButtonGroup", "name": "_createGroupElement", "url": "YAHOO.widget.ButtonGroup.html#method__createGroupElement", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "createHiddenFields", "url": "YAHOO.widget.Button.html#method_createHiddenFields", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Button", "name": "createInputElement", "url": "YAHOO.widget.Button.html#method_createInputElement", "type": "method"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "CSS_CLASS_NAME", "url": "YAHOO.widget.ButtonGroup.html#property_CSS_CLASS_NAME", "type": "property"}, {"access": "", "host": "YAHOO.widget.Button", "name": "CSS_CLASS_NAME", "url": "YAHOO.widget.Button.html#property_CSS_CLASS_NAME", "type": "property"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "destroy", "url": "YAHOO.widget.ButtonGroup.html#method_destroy", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "destroy", "url": "YAHOO.widget.Button.html#method_destroy", "type": "method"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "disabled", "url": "YAHOO.widget.ButtonGroup.html#config_disabled", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "disabled", "url": "YAHOO.widget.Button.html#config_disabled", "type": "config"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "disabledChange", "url": "YAHOO.widget.ButtonGroup.html#event_disabledChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "disabledChange", "url": "YAHOO.widget.Button.html#event_disabledChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "focus", "url": "YAHOO.widget.ButtonGroup.html#method_focus", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "focus", "url": "YAHOO.widget.Button.html#method_focus", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "focus", "url": "YAHOO.widget.Button.html#event_focus", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "focusmenu", "url": "YAHOO.widget.Button.html#config_focusmenu", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "focusmenuChange", "url": "YAHOO.widget.Button.html#event_focusmenuChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "getButton", "url": "YAHOO.widget.ButtonGroup.html#method_getButton", "type": "method"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "getButtons", "url": "YAHOO.widget.ButtonGroup.html#method_getButtons", "type": "method"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "getCount", "url": "YAHOO.widget.ButtonGroup.html#method_getCount", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "getForm", "url": "YAHOO.widget.Button.html#method_getForm", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "getHiddenFields", "url": "YAHOO.widget.Button.html#method_getHiddenFields", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "getMenu", "url": "YAHOO.widget.Button.html#method_getMenu", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "hasFocus", "url": "YAHOO.widget.Button.html#method_hasFocus", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_hasKeyEventHandlers", "url": "YAHOO.widget.Button.html#property__hasKeyEventHandlers", "type": "property"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_hasMouseEventHandlers", "url": "YAHOO.widget.Button.html#property__hasMouseEventHandlers", "type": "property"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_hiddenFields", "url": "YAHOO.widget.Button.html#property__hiddenFields", "type": "property"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_hideMenu", "url": "YAHOO.widget.Button.html#method__hideMenu", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "href", "url": "YAHOO.widget.Button.html#config_href", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "hrefChange", "url": "YAHOO.widget.Button.html#event_hrefChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "init", "url": "YAHOO.widget.ButtonGroup.html#method_init", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "init", "url": "YAHOO.widget.Button.html#method_init", "type": "method"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "initAttributes", "url": "YAHOO.widget.ButtonGroup.html#method_initAttributes", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "initAttributes", "url": "YAHOO.widget.Button.html#method_initAttributes", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Button", "name": "initConfig", "url": "YAHOO.widget.Button.html#method_initConfig", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_isActivationKey", "url": "YAHOO.widget.Button.html#method__isActivationKey", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "isActive", "url": "YAHOO.widget.Button.html#method_isActive", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_isSplitButtonOptionKey", "url": "YAHOO.widget.Button.html#method__isSplitButtonOptionKey", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "label", "url": "YAHOO.widget.Button.html#config_label", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "labelChange", "url": "YAHOO.widget.Button.html#event_labelChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "lazyloadmenu", "url": "YAHOO.widget.Button.html#config_lazyloadmenu", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "lazyloadmenuChange", "url": "YAHOO.widget.Button.html#event_lazyloadmenuChange", "type": "event"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_menu", "url": "YAHOO.widget.Button.html#property__menu", "type": "property"}, {"access": "", "host": "YAHOO.widget.Button", "name": "menu", "url": "YAHOO.widget.Button.html#config_menu", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "menualignment", "url": "YAHOO.widget.Button.html#config_menualignment", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "menualignmentChange", "url": "YAHOO.widget.Button.html#event_menualignmentChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "menuChange", "url": "YAHOO.widget.Button.html#event_menuChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "menuclassname", "url": "YAHOO.widget.Button.html#config_menuclassname", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "menuclassnameChange", "url": "YAHOO.widget.Button.html#event_menuclassnameChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "menumaxheight", "url": "YAHOO.widget.Button.html#config_menumaxheight", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "menumaxheightChange", "url": "YAHOO.widget.Button.html#event_menumaxheightChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "menuminscrollheight", "url": "YAHOO.widget.Button.html#config_menuminscrollheight", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "menuminscrollheightChange", "url": "YAHOO.widget.Button.html#event_menuminscrollheightChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "name", "url": "YAHOO.widget.ButtonGroup.html#config_name", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "name", "url": "YAHOO.widget.Button.html#config_name", "type": "config"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "nameChange", "url": "YAHOO.widget.ButtonGroup.html#event_nameChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "nameChange", "url": "YAHOO.widget.Button.html#event_nameChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "NODE_NAME", "url": "YAHOO.widget.ButtonGroup.html#property_NODE_NAME", "type": "property"}, {"access": "", "host": "YAHOO.widget.Button", "name": "NODE_NAME", "url": "YAHOO.widget.Button.html#property_NODE_NAME", "type": "property"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_nOptionRegionX", "url": "YAHOO.widget.Button.html#property__nOptionRegionX", "type": "property"}, {"access": "protected", "host": "YAHOO.widget.ButtonGroup", "name": "_onAppendTo", "url": "YAHOO.widget.ButtonGroup.html#method__onAppendTo", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onAppendTo", "url": "YAHOO.widget.Button.html#method__onAppendTo", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onBlur", "url": "YAHOO.widget.Button.html#method__onBlur", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.ButtonGroup", "name": "_onButtonCheckedChange", "url": "YAHOO.widget.ButtonGroup.html#method__onButtonCheckedChange", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onClick", "url": "YAHOO.widget.Button.html#method__onClick", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "onclick", "url": "YAHOO.widget.Button.html#config_onclick", "type": "config"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onclickAttributeValue", "url": "YAHOO.widget.Button.html#property__onclickAttributeValue", "type": "property"}, {"access": "", "host": "YAHOO.widget.Button", "name": "onclickChange", "url": "YAHOO.widget.Button.html#event_onclickChange", "type": "event"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onDblClick", "url": "YAHOO.widget.Button.html#method__onDblClick", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onDocumentKeyUp", "url": "YAHOO.widget.Button.html#method__onDocumentKeyUp", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onDocumentMouseDown", "url": "YAHOO.widget.Button.html#method__onDocumentMouseDown", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onDocumentMouseUp", "url": "YAHOO.widget.Button.html#method__onDocumentMouseUp", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onFocus", "url": "YAHOO.widget.Button.html#method__onFocus", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onFormReset", "url": "YAHOO.widget.Button.html#method__onFormReset", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onFormSubmit", "url": "YAHOO.widget.Button.html#method__onFormSubmit", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.ButtonGroup", "name": "_onKeyDown", "url": "YAHOO.widget.ButtonGroup.html#method__onKeyDown", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onKeyDown", "url": "YAHOO.widget.Button.html#method__onKeyDown", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onKeyUp", "url": "YAHOO.widget.Button.html#method__onKeyUp", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "_onLabelClick", "url": "YAHOO.widget.Button.html#method__onLabelClick", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Button", "name": "_onMenuClick", "url": "YAHOO.widget.Button.html#method__onMenuClick", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Button", "name": "_onMenuHide", "url": "YAHOO.widget.Button.html#method__onMenuHide", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Button", "name": "_onMenuKeyDown", "url": "YAHOO.widget.Button.html#method__onMenuKeyDown", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Button", "name": "_onMenuRender", "url": "YAHOO.widget.Button.html#method__onMenuRender", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Button", "name": "_onMenuShow", "url": "YAHOO.widget.Button.html#method__onMenuShow", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onMouseDown", "url": "YAHOO.widget.Button.html#method__onMouseDown", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onMouseMove", "url": "YAHOO.widget.Button.html#method__onMouseMove", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onMouseOut", "url": "YAHOO.widget.Button.html#method__onMouseOut", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onMouseOver", "url": "YAHOO.widget.Button.html#method__onMouseOver", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onMouseUp", "url": "YAHOO.widget.Button.html#method__onMouseUp", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_onOption", "url": "YAHOO.widget.Button.html#method__onOption", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "_onSelectedMenuItemChange", "url": "YAHOO.widget.Button.html#method__onSelectedMenuItemChange", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "option", "url": "YAHOO.widget.Button.html#event_option", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "OPTION_AREA_WIDTH", "url": "YAHOO.widget.Button.html#property_OPTION_AREA_WIDTH", "type": "property"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "removeButton", "url": "YAHOO.widget.ButtonGroup.html#method_removeButton", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "removeHiddenFields", "url": "YAHOO.widget.Button.html#method_removeHiddenFields", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "removeStateCSSClasses", "url": "YAHOO.widget.Button.html#method_removeStateCSSClasses", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "replaceLabel", "url": "YAHOO.widget.Button.html#config_replaceLabel", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "replaceLabelChange", "url": "YAHOO.widget.Button.html#event_replaceLabelChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "selectedMenuItem", "url": "YAHOO.widget.Button.html#config_selectedMenuItem", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "selectedMenuItemChange", "url": "YAHOO.widget.Button.html#event_selectedMenuItemChange", "type": "event"}, {"access": "private", "host": "YAHOO.widget.Button", "name": "setAttributeFromDOMAttribute", "url": "YAHOO.widget.Button.html#method_setAttributeFromDOMAttribute", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Button", "name": "setAttributesFromSrcElement", "url": "YAHOO.widget.Button.html#method_setAttributesFromSrcElement", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_setChecked", "url": "YAHOO.widget.Button.html#method__setChecked", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.ButtonGroup", "name": "_setDisabled", "url": "YAHOO.widget.ButtonGroup.html#method__setDisabled", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_setDisabled", "url": "YAHOO.widget.Button.html#method__setDisabled", "type": "method"}, {"access": "private", "host": "YAHOO.widget.Button", "name": "setFormElementProperties", "url": "YAHOO.widget.Button.html#method_setFormElementProperties", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_setHref", "url": "YAHOO.widget.Button.html#method__setHref", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_setLabel", "url": "YAHOO.widget.Button.html#method__setLabel", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_setMenu", "url": "YAHOO.widget.Button.html#method__setMenu", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_setOnClick", "url": "YAHOO.widget.Button.html#method__setOnClick", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_setTabIndex", "url": "YAHOO.widget.Button.html#method__setTabIndex", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_setTarget", "url": "YAHOO.widget.Button.html#method__setTarget", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_setTitle", "url": "YAHOO.widget.Button.html#method__setTitle", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_setType", "url": "YAHOO.widget.Button.html#method__setType", "type": "method"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "_showMenu", "url": "YAHOO.widget.Button.html#method__showMenu", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "srcelement", "url": "YAHOO.widget.Button.html#config_srcelement", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "srcelementChange", "url": "YAHOO.widget.Button.html#event_srcelementChange", "type": "event"}, {"access": "protected", "host": "YAHOO.widget.Button", "name": "submitForm", "url": "YAHOO.widget.Button.html#method_submitForm", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "tabindex", "url": "YAHOO.widget.Button.html#config_tabindex", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "tabindexChange", "url": "YAHOO.widget.Button.html#event_tabindexChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "target", "url": "YAHOO.widget.Button.html#config_target", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "targetChange", "url": "YAHOO.widget.Button.html#event_targetChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "title", "url": "YAHOO.widget.Button.html#config_title", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "titleChange", "url": "YAHOO.widget.Button.html#event_titleChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "toString", "url": "YAHOO.widget.ButtonGroup.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "toString", "url": "YAHOO.widget.Button.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "type", "url": "YAHOO.widget.Button.html#config_type", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "typeChange", "url": "YAHOO.widget.Button.html#event_typeChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "value", "url": "YAHOO.widget.ButtonGroup.html#config_value", "type": "config"}, {"access": "", "host": "YAHOO.widget.Button", "name": "value", "url": "YAHOO.widget.Button.html#config_value", "type": "config"}, {"access": "", "host": "YAHOO.widget.ButtonGroup", "name": "valueChange", "url": "YAHOO.widget.ButtonGroup.html#event_valueChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "valueChange", "url": "YAHOO.widget.Button.html#event_valueChange", "type": "event"}, {"access": "", "host": "YAHOO.widget.Button", "name": "YAHOO.widget.Button.addHiddenFieldsToForm", "url": "YAHOO.widget.Button.html#method_YAHOO.widget.Button.addHiddenFieldsToForm", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "YAHOO.widget.Button.getButton", "url": "YAHOO.widget.Button.html#method_YAHOO.widget.Button.getButton", "type": "method"}, {"access": "", "host": "YAHOO.widget.Button", "name": "YAHOO.widget.Button.onFormKeyPress", "url": "YAHOO.widget.Button.html#method_YAHOO.widget.Button.onFormKeyPress", "type": "method"}];
</script>
</body>
</html>
| 92.928319 | 28,144 | 0.582595 |
600a04ca4b1d066736a28f4c6333626848c580b4 | 355 | swift | Swift | eTrips/MVC/Models/User/User.swift | unicef/etools-etrips-ios | b03cf1e1fefa1f6e8dc88ccc74e18e25eaeaa5fc | [
"Apache-2.0"
] | 2 | 2017-04-27T05:08:20.000Z | 2017-10-02T17:54:16.000Z | eTrips/MVC/Models/User/User.swift | unicef/etools-etrips-ios | b03cf1e1fefa1f6e8dc88ccc74e18e25eaeaa5fc | [
"Apache-2.0"
] | null | null | null | eTrips/MVC/Models/User/User.swift | unicef/etools-etrips-ios | b03cf1e1fefa1f6e8dc88ccc74e18e25eaeaa5fc | [
"Apache-2.0"
] | null | null | null | import Foundation
import ObjectMapper
public class User: Mappable {
var userID: Int?
var firstName: String?
var lastName: String?
var name: String?
public required init?(map: Map) {
}
public func mapping(map: Map) {
userID <- map["id"]
firstName <- map["first_name"]
lastName <- map["last_name"]
name <- map["name"]
}
}
| 17.75 | 35 | 0.642254 |
0a995cc04b9d916ee340b02e6a5f232a28c9206e | 1,506 | go | Go | targets/gcp/memorystore/memcached/connector.go | kubemq-hub/kubemq-target-connectors | 75425ec2937d5906dca610c0ea8f598692e1e162 | [
"Apache-2.0"
] | 8 | 2020-08-05T14:27:10.000Z | 2021-09-13T18:44:36.000Z | targets/gcp/memorystore/memcached/connector.go | kubemq-hub/kubemq-target-connectors | 75425ec2937d5906dca610c0ea8f598692e1e162 | [
"Apache-2.0"
] | 2 | 2020-07-29T07:56:36.000Z | 2020-12-10T09:50:32.000Z | targets/gcp/memorystore/memcached/connector.go | kubemq-hub/kubemq-target-connectors | 75425ec2937d5906dca610c0ea8f598692e1e162 | [
"Apache-2.0"
] | 22 | 2020-07-19T08:38:37.000Z | 2020-12-10T09:19:41.000Z | package memcached
import (
"github.com/kubemq-hub/builder/connector/common"
"math"
)
func Connector() *common.Connector {
return common.NewConnector().
SetKind("gcp.cache.memcached").
SetDescription("GCP Memory Store Memcached Target").
SetName("Memcached").
SetProvider("GCP").
SetCategory("Cache").
SetTags("db","memory-store","cloud","managed").
AddProperty(
common.NewProperty().
SetKind("string").
SetName("hosts").
SetTitle("Hosts Address").
SetDescription("Set Memcached hosts").
SetMust(true).
SetDefault("localhost:11211"),
).
AddProperty(
common.NewProperty().
SetKind("int").
SetName("max_idle_connections").
SetDescription("Set Memcached max idle connections").
SetDefault("2").
SetMin(1).
SetMax(math.MaxInt32).
SetMust(false),
).
AddProperty(
common.NewProperty().
SetKind("int").
SetName("default_timeout_seconds").
SetTitle("Default Timeout (Seconds)").
SetDescription("Set Memcached default timeout seconds").
SetDefault("30").
SetMin(1).
SetMax(math.MaxInt32).
SetMust(false),
).
AddMetadata(
common.NewMetadata().
SetName("method").
SetKind("string").
SetDescription("Set Memcached execution method").
SetOptions([]string{"get", "set", "delete"}).
SetDefault("get").
SetMust(true),
).
AddMetadata(
common.NewMetadata().
SetName("key").
SetKind("string").
SetDescription("Set Memcached key").
SetMust(true),
)
}
| 23.904762 | 60 | 0.657371 |
882eb8df56a5d30cec286b05a1d54f31517804dc | 2,491 | hpp | C++ | source/LibFgBase/src/FgNc.hpp | MikhailGorobets/FaceGenBaseLibrary | 3ea688f9e3811943adb18e23e7bb2addc5f688a5 | [
"MIT"
] | null | null | null | source/LibFgBase/src/FgNc.hpp | MikhailGorobets/FaceGenBaseLibrary | 3ea688f9e3811943adb18e23e7bb2addc5f688a5 | [
"MIT"
] | null | null | null | source/LibFgBase/src/FgNc.hpp | MikhailGorobets/FaceGenBaseLibrary | 3ea688f9e3811943adb18e23e7bb2addc5f688a5 | [
"MIT"
] | 1 | 2020-05-27T17:23:50.000Z | 2020-05-27T17:23:50.000Z | //
// Coypright (c) 2020 Singular Inversions Inc. (facegen.com)
// Use, modification and distribution is subject to the MIT License,
// see accompanying file LICENSE.txt or facegen.com/base_library_license.txt
//
// Network Computation
#ifndef FGNC_HPP
#define FGNC_HPP
#include "FgStdString.hpp"
#include "FgStdVector.hpp"
#include "FgSerialize.hpp"
#include "FgBuild.hpp"
#include "FgFileSystem.hpp"
#include "FgSerial.hpp"
namespace Fg {
// Location of network computing share root location as specified on given *native* build OS:
String
getNcShare(BuildOS nativeBuildOS);
// As above for current host OS:
String
getNcShare();
// An HTML log of given commands and outputs will be appended to 'logFile' and a 32x32 image
// will be written to <logFileBaseName>.jpg, green for success of all commands, red for a fail:
struct NcScript
{
String logFile; // Directory path will be created if it doesn't exist
String title; // Title line of log file
// Each such command will be shell executed in order. In addition some builtin commands are supported:
// fgPush <dir> - push <dir> to current for this process
// fgPop - pop back to previous dir for this process
Strings cmds;
String ser() const
{
String ret;
ret.append(fgSer(logFile));
ret.append(fgSer(title));
ret.append(fgSer(cmds));
return ret;
}
void dsr(const char * & ptr,const char * end)
{
fgDsr(ptr,end,logFile);
fgDsr(ptr,end,title);
fgDsr(ptr,end,cmds);
}
String serMsg() const
{
String ret = fgSer(0xFE785A765844B8D1ULL);
ret.append(ser());
return ret;
}
void dsrMsg(String const & msg)
{
const char *ptr = &msg[0],*end = ptr+msg.size();
uint64 ver;
fgDsr(ptr,end,ver);
FGASSERT(ver == 0xFE785A765844B8D1ULL);
dsr(ptr,end);
}
};
inline
uint16
getNcServerPort()
{return 59405; }
inline
String
getCiShareBoot()
{return getNcShare() + toNativeSeparator("ci/boot/"); }
inline
String
getCiShareBoot(BuildOS os)
{return getNcShare(os) + cNsOs("ci/boot/",os); }
inline
String
getCiShareRepo()
{return getNcShare() + toNativeSeparator("ci/root/"); }
inline
String
getCiShareRepo(BuildOS os)
{return getNcShare(os) + cNsOs("ci/root/",os); }
}
#endif
// */
| 24.421569 | 107 | 0.628262 |
91a4bf738c1b189092e274d93bf30d33ec161cc5 | 4,075 | ps1 | PowerShell | Tests/Get-LFMTagTopTag.Tests.ps1 | camusicjunkie/PowerLFM | bf77f09541b6584bf34bd262460ab521c0f5693d | [
"MIT"
] | 3 | 2019-03-09T11:44:23.000Z | 2021-05-16T11:56:29.000Z | Tests/Get-LFMTagTopTag.Tests.ps1 | camusicjunkie/PowerLFM | bf77f09541b6584bf34bd262460ab521c0f5693d | [
"MIT"
] | 50 | 2018-07-28T02:48:34.000Z | 2021-08-31T00:17:25.000Z | Tests/Get-LFMTagTopTag.Tests.ps1 | camusicjunkie/PowerLFM | bf77f09541b6584bf34bd262460ab521c0f5693d | [
"MIT"
] | 2 | 2018-12-01T23:56:39.000Z | 2018-12-05T10:53:45.000Z | BeforeAll {
Remove-Module -Name PowerLFM -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\..\PowerLFM\PowerLFM.psd1
}
Describe 'Get-LFMTagTopTag: Unit' -Tag Unit {
BeforeDiscovery {
$mocks = Get-Content -Path $PSScriptRoot\..\config\mocks.json | ConvertFrom-Json
$contextMock = $mocks.'Get-LFMTagTopTag'.TagTopTag
}
BeforeAll {
$mocks = Get-Content -Path $PSScriptRoot\..\config\mocks.json | ConvertFrom-Json
$contextMock = $mocks.'Get-LFMTagTopTag'.TagTopTag
Mock Remove-CommonParameter {
[hashtable] @{ }
} -ModuleName 'PowerLFM'
Mock ConvertTo-LFMParameter -ModuleName 'PowerLFM'
Mock New-LFMApiQuery -ModuleName 'PowerLFM'
Mock Invoke-LFMApiUri { $contextMock } -ModuleName 'PowerLFM'
}
Context 'Execution' {
BeforeAll {
Get-LFMTagTopTag
}
It 'Should remove common parameters from bound parameters' {
$siParams = @{
CommandName = 'Remove-CommonParameter'
ModuleName = 'PowerLFM'
Scope = 'Context'
Exactly = $true
Times = 1
ParameterFilter = {
$PSBoundParameters
}
}
Should -Invoke @siParams
}
It 'Should convert parameters to format API expects after signing' {
$siParams = @{
CommandName = 'ConvertTo-LFMParameter'
ModuleName = 'PowerLFM'
Scope = 'Context'
Exactly = $true
Times = 1
}
Should -Invoke @siParams
}
It 'Should take hashtable and build a query for a uri' {
$siParams = @{
CommandName = 'New-LFMApiQuery'
ModuleName = 'PowerLFM'
Scope = 'Context'
Exactly = $true
Times = 1
}
Should -Invoke @siParams
}
}
Context 'Output' {
BeforeAll {
$output = Get-LFMTagTopTag
}
It "Tag first top tag should have name of $($contextMock.TopTags.Tag[0].Name)" {
$output[0].Tag | Should -Be $contextMock.TopTags.Tag[0].Name
}
It "Tag first top tag should have reach of $($contextMock.TopTags.Tag[0].Reach)" {
$output[0].Reach | Should -Be $contextMock.TopTags.Tag[0].Reach
}
It "Tag first top tag should have count with a value of $($contextMock.TopTags.Tag[0].Count)" {
$output[0].Count | Should -Be $contextMock.TopTags.Tag[0].Count
}
It "Tag second top tag should have count with a value of $($contextMock.TopTags.Tag[1].Count)" {
$output[1].Count | Should -Be $contextMock.TopTags.Tag[1].Count
}
It "Tag second top tag should have reach with a value of $($contextMock.TopTags.Tag[1].Reach)" {
$output[1].Reach | Should -Be $contextMock.TopTags.Tag[1].Reach
}
It 'Tag should have two top tags' {
$output.Tag | Should -HaveCount 2
}
It 'Tag should not have more than two top tags' {
$output.Tag | Should -Not -BeNullOrEmpty
$output.Tag | Should -Not -HaveCount 3
}
It 'Should call the correct Last.fm get method' {
$siParams = @{
CommandName = 'Invoke-LFMApiUri'
ModuleName = 'PowerLFM'
Scope = 'Context'
Exactly = $true
Times = 1
ParameterFilter = {
$Uri -like "$baseUrl*"
}
}
Should -Invoke @siParams
}
It 'Should throw when an error is returned in the response' {
Mock Invoke-LFMApiUri { throw 'Error' } -ModuleName 'PowerLFM'
{ Get-LFMTagTopTag } | Should -Throw 'Error'
}
}
}
| 32.862903 | 104 | 0.518037 |
8014f9a0a907fe6917de679dc065337bf0d7530e | 142 | java | Java | DesignPattern/app/src/main/java/com/example/shewenbiao/designpattern/creational/builder/Product.java | shewenbiao/MyArsenal | 1f1ffbe70cf1dc5374985caf9646e5183baf8f4c | [
"Apache-2.0"
] | 14 | 2019-02-15T18:36:27.000Z | 2022-03-06T12:58:13.000Z | DesignPattern/app/src/main/java/com/example/shewenbiao/designpattern/creational/builder/Product.java | shewenbiao/MyArsenal | 1f1ffbe70cf1dc5374985caf9646e5183baf8f4c | [
"Apache-2.0"
] | null | null | null | DesignPattern/app/src/main/java/com/example/shewenbiao/designpattern/creational/builder/Product.java | shewenbiao/MyArsenal | 1f1ffbe70cf1dc5374985caf9646e5183baf8f4c | [
"Apache-2.0"
] | null | null | null | package com.example.shewenbiao.designpattern.creational.builder;
/**
* Created by shewenbiao on 17/3/19.
*/
public interface Product {
}
| 14.2 | 64 | 0.739437 |
262301659c2854169754db871ecf5342bc3ee7d8 | 1,769 | java | Java | src/main/java/hu/szte/vizz/persistence/repository/product/ReviewRepository.java | berkitamas/vizz | 5d4afa82db0ffba2fbe61ae02085a6b793722e89 | [
"MIT"
] | null | null | null | src/main/java/hu/szte/vizz/persistence/repository/product/ReviewRepository.java | berkitamas/vizz | 5d4afa82db0ffba2fbe61ae02085a6b793722e89 | [
"MIT"
] | null | null | null | src/main/java/hu/szte/vizz/persistence/repository/product/ReviewRepository.java | berkitamas/vizz | 5d4afa82db0ffba2fbe61ae02085a6b793722e89 | [
"MIT"
] | null | null | null | package hu.szte.vizz.persistence.repository.product;
import hu.szte.vizz.persistence.entity.product.Product;
import hu.szte.vizz.persistence.entity.product.Review;
import hu.szte.vizz.persistence.entity.user.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.UUID;
/**
* The repository for {@link Review}.
*
* @see <a href="https://docs.spring.io/spring-data/data-commons/docs/current/reference/html/#repositories">Spring Data Repositories</a>
*
* @author <a href="mailto:h748276@stud.u-szeged.hu">Tamas Berki</a>
*/
@Repository
public interface ReviewRepository extends JpaRepository<Review, UUID> {
/**
* Finds all reviews for a product in a date interval.
*
* @param product Product of the reviews.
* @param from Lower boundary of interval.
* @param to Upper boundary of interval.
* @param pageable Paging and sorting information.
* @return Page of reviews.
*/
Page<Review> findAllByProductAndPublishDateBetween(Product product, Date from, Date to, Pageable pageable);
/**
* Finds all reviews for a product.
*
* @param product Product of the reviews.
* @param pageable Paging and sorting information.
* @return Page of reviews.
*/
Page<Review> findAllByProduct(Product product, Pageable pageable);
/**
* Finds all reviews written by a specified user.
*
* @param user Author of the reviews.
* @param pageable Paging and sorting information.
* @return Page of reviews.
*/
Page<Review> findAllByUser(User user, Pageable pageable);
}
| 34.019231 | 136 | 0.71792 |
f887d382437baf7d5a3040942960ca104d62c69c | 563 | lua | Lua | examples/blink.lua | evq/LuaLittleWire | 6e0e3b058988ab3142f8beb66fae13ed7300d99c | [
"MIT"
] | 1 | 2015-04-13T16:51:20.000Z | 2015-04-13T16:51:20.000Z | examples/blink.lua | evq/LuaLittleWire | 6e0e3b058988ab3142f8beb66fae13ed7300d99c | [
"MIT"
] | null | null | null | examples/blink.lua | evq/LuaLittleWire | 6e0e3b058988ab3142f8beb66fae13ed7300d99c | [
"MIT"
] | null | null | null | local littlewire = require "littlewire"
local LED_PIN = PIN1
local littlewire_devices = littlewire.search()
print("Found ", #littlewire_devices, " littlewire devices.\n")
local lw_dev = littlewire.connect()
print("Connected to first device.")
print("FW Version: ", littlewire.readFirmwareVersion(lw_dev), "\n")
littlewire.pinMode(lw_dev, LED_PIN, OUTPUT)
while true do
littlewire.digitalWrite(lw_dev, LED_PIN, LOW)
print("LED OFF")
littlewire.delay(500);
littlewire.digitalWrite(lw_dev, LED_PIN, HIGH)
print("LED ON")
littlewire.delay(500);
end
| 24.478261 | 67 | 0.749556 |
09f92ad43dac6d6725585c7f0474b2fb182a4d76 | 1,576 | kt | Kotlin | app/src/main/java/com/cryptape/cita_wallet/activity/changewallet/ChangeWalletActivity.kt | ruizhaoz1/Neuron-Android | 67be5dc67c3cbcdac7b33925f3338b63267d1962 | [
"MIT"
] | 22 | 2018-08-15T00:50:00.000Z | 2019-01-07T07:52:48.000Z | app/src/main/java/com/cryptape/cita_wallet/activity/changewallet/ChangeWalletActivity.kt | ruizhaoz1/Neuron-Android | 67be5dc67c3cbcdac7b33925f3338b63267d1962 | [
"MIT"
] | 12 | 2019-01-15T01:51:37.000Z | 2019-10-23T08:01:32.000Z | app/src/main/java/com/cryptape/cita_wallet/activity/changewallet/ChangeWalletActivity.kt | ruizhaoz1/Neuron-Android | 67be5dc67c3cbcdac7b33925f3338b63267d1962 | [
"MIT"
] | 10 | 2019-03-05T06:00:20.000Z | 2019-10-23T13:38:41.000Z | package com.cryptape.cita_wallet.activity.changewallet
import android.content.pm.ActivityInfo
import android.os.Build
import android.support.v7.widget.LinearLayoutManager
import kotlinx.android.synthetic.main.activity_change_wallet.*
import com.cryptape.cita_wallet.R
import com.cryptape.cita_wallet.activity.NBaseActivity
import com.cryptape.cita_wallet.item.Wallet
import com.cryptape.cita_wallet.util.db.DBWalletUtil
import com.cryptape.cita_wallet.util.db.SharePrefUtil
import java.util.*
/**
* Created by BaojunCZ on 2018/8/3.
*/
class ChangeWalletActivity : NBaseActivity() {
private var wallets: List<Wallet> = ArrayList()
override fun getContentLayout(): Int {
return R.layout.activity_change_wallet
}
override fun initView() {
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}
}
override fun initData() {
wallets = DBWalletUtil.getAllWallet(this)
for (i in wallets.indices) {
if (wallets[i].name == SharePrefUtil.getCurrentWalletName()) {
if (i != 0) {
Collections.swap(wallets, 0, i)
}
break
}
}
wallet_recycler.layoutManager = LinearLayoutManager(this)
wallet_recycler.adapter = ChangeWalletAdapter(this, wallets)
}
override fun initAction() {
}
override fun finish() {
super.finish()
overridePendingTransition(0, R.anim.wallet_activity_out)
}
}
| 29.185185 | 75 | 0.682107 |
4ac3c2146832e4dcff406dccca2d7425788c9ecf | 506 | cs | C# | src/client/Microsoft.Identity.Client/Region/LocalImdsResponse.cs | salmanmkc/microsoft-authentication-library-for-dotnet | dc2159f2d93c42bf337cb42cde935243cff0b2fd | [
"MIT"
] | null | null | null | src/client/Microsoft.Identity.Client/Region/LocalImdsResponse.cs | salmanmkc/microsoft-authentication-library-for-dotnet | dc2159f2d93c42bf337cb42cde935243cff0b2fd | [
"MIT"
] | null | null | null | src/client/Microsoft.Identity.Client/Region/LocalImdsResponse.cs | salmanmkc/microsoft-authentication-library-for-dotnet | dc2159f2d93c42bf337cb42cde935243cff0b2fd | [
"MIT"
] | null | null | null | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Identity.Json;
namespace Microsoft.Identity.Client.Region
{
[JsonObject]
[Preserve(AllMembers = true)]
internal sealed class LocalImdsResponse
{
[JsonProperty(PropertyName = "azEnvironment")]
public string azEnvironment { get; set; }
[JsonProperty(PropertyName = "location")]
public string location { get; set; }
}
}
| 22 | 54 | 0.697628 |
403ddc5886ceeac40b42c63887cdb053f70b05ed | 566 | py | Python | server.py | Aravs2000/keshs | 6c104f61199710177931691002486ef734c357c9 | [
"MIT"
] | 1 | 2019-07-02T09:43:06.000Z | 2019-07-02T09:43:06.000Z | server.py | Hardeepsingh980/DeeNotes-Notes-Share | 2272265652bd8623935f4f244b3c4ce33b8b23dd | [
"MIT"
] | null | null | null | server.py | Hardeepsingh980/DeeNotes-Notes-Share | 2272265652bd8623935f4f244b3c4ce33b8b23dd | [
"MIT"
] | null | null | null | import socket
import _thread
clients = []
s = socket.socket()
s.bind(('',5000))
s.listen(5)
def recv_msg(conn):
while True:
msg = conn.recv(10000000).decode('utf-8')
if 'post!@!' in msg:
msg = msg.split('!@!')[1]
send_to_all(msg)
def send_to_all(msg):
for client in clients:
client.send(msg.encode('utf-8'))
while True:
conn, addr = s.accept()
clients.append(conn)
print('Connection Establised With ', str(addr))
_thread.start_new_thread(recv_msg,(conn,))
| 18.866667 | 52 | 0.568905 |
17da316dfb23e737ab64e9dc6241a10926d9ae92 | 1,934 | cs | C# | Assets/Components/Wolf/WolfController.cs | cpttrvs/To-Herd | f1f095152bb211bd91975eb8e97362dae6bee8ee | [
"Unlicense"
] | 2 | 2020-04-10T22:13:34.000Z | 2020-10-21T17:59:48.000Z | Assets/Components/Wolf/WolfController.cs | cpttrvs/To-Herd | f1f095152bb211bd91975eb8e97362dae6bee8ee | [
"Unlicense"
] | null | null | null | Assets/Components/Wolf/WolfController.cs | cpttrvs/To-Herd | f1f095152bb211bd91975eb8e97362dae6bee8ee | [
"Unlicense"
] | null | null | null | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
using System;
public class WolfController : MonoBehaviour
{
[SerializeField]
private NavMeshAgent navMeshAgent = null;
[SerializeField]
private Animator animator = null;
[SerializeField]
private WolfSelector selector = null;
public Action OnSelect;
public Action OnDeselect;
public Action OnMoveOrder;
private bool isSelected = false;
private Vector3 lastPosition = Vector3.zero;
private void Start()
{
selector.OnSelection += WolfSelector_OnSelection;
selector.OnDeselection += WolfSelector_OnDeselection;
selector.OnMoveOrder += WolfSelector_OnMoveOrder;
animator.SetBool("isIdling", true);
lastPosition = transform.position;
}
private void OnDestroy()
{
selector.OnSelection -= WolfSelector_OnSelection;
selector.OnDeselection -= WolfSelector_OnDeselection;
selector.OnMoveOrder -= WolfSelector_OnMoveOrder;
}
private void Update()
{
if (lastPosition != transform.position)
{
animator.SetBool("isMoving", true);
}
else
{
animator.SetBool("isMoving", false);
}
lastPosition = transform.position;
}
void WolfSelector_OnSelection(WolfSelector s)
{
Debug.Log("[Wolf] OnSelection: " + name);
isSelected = true;
OnSelect?.Invoke();
}
void WolfSelector_OnDeselection(WolfSelector s)
{
Debug.Log("[Wolf] OnDeselection: " + name);
isSelected = false;
OnDeselect?.Invoke();
}
void WolfSelector_OnMoveOrder(Vector3 pos)
{
Debug.Log("[Wolf] OnMove: " + pos + ", " + name);
OnMoveOrder?.Invoke();
navMeshAgent.SetDestination(pos);
Debug.DrawLine(transform.position, pos, Color.red);
}
}
| 24.175 | 61 | 0.641158 |
9ef53ee91fb6ece216be20cfe135840cd391eb2c | 6,394 | rs | Rust | dlc-manager/src/contract/mod.rs | p2pderivatives/rust-dlc | 5df14bac49f7abcf9b62d9bb498783fecad49543 | [
"MIT"
] | 38 | 2020-05-11T08:42:38.000Z | 2022-03-27T15:57:47.000Z | dlc-manager/src/contract/mod.rs | p2pderivatives/rust-dlc | 5df14bac49f7abcf9b62d9bb498783fecad49543 | [
"MIT"
] | 4 | 2020-05-04T18:31:56.000Z | 2022-01-09T12:38:22.000Z | dlc-manager/src/contract/mod.rs | p2pderivatives/rust-dlc | 5df14bac49f7abcf9b62d9bb498783fecad49543 | [
"MIT"
] | 8 | 2021-04-13T17:02:01.000Z | 2022-02-16T16:58:59.000Z | //! Module containing structures and functions related to contracts.
use crate::ContractId;
use bitcoin::Address;
use dlc_messages::{oracle_msgs::OracleAttestation, AcceptDlc, FundingInput, SignDlc};
use dlc_trie::multi_oracle_trie::MultiOracleTrie;
use dlc_trie::multi_oracle_trie_with_diff::MultiOracleTrieWithDiff;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use signed_contract::SignedContract;
pub mod accepted_contract;
pub mod contract_info;
pub mod contract_input;
pub mod enum_descriptor;
pub mod numerical_descriptor;
pub mod offered_contract;
pub mod ser;
pub mod signed_contract;
pub(crate) mod utils;
#[derive(Clone)]
/// Enum representing the possible states of a DLC.
pub enum Contract {
/// Initial state where a contract is being proposed.
Offered(offered_contract::OfferedContract),
/// A contract that was accepted.
Accepted(accepted_contract::AcceptedContract),
/// A contract for which signatures have been produced.
Signed(signed_contract::SignedContract),
/// A contract whose funding transaction was included in the blockchain.
Confirmed(signed_contract::SignedContract),
/// A contract for which a CET was broadcast.
Closed(ClosedContract),
/// A contract whose refund transaction was broadcast.
Refunded(signed_contract::SignedContract),
/// A contract that failed when verifying information from an accept message.
FailedAccept(FailedAcceptContract),
/// A contract that failed when verifying information from a sign message.
FailedSign(FailedSignContract),
}
impl std::fmt::Debug for Contract {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let state = match self {
Contract::Offered(_) => "offered",
Contract::Accepted(_) => "accepted",
Contract::Signed(_) => "signed",
Contract::Confirmed(_) => "confirmed",
Contract::Closed(_) => "closed",
Contract::Refunded(_) => "refunded",
Contract::FailedAccept(_) => "failed accept",
Contract::FailedSign(_) => "failed sign",
};
f.debug_struct("Contract").field("state", &state).finish()
}
}
impl Contract {
/// Get the id of a contract. Returns the temporary contract id for offered
/// and failed accept contracts.
pub fn get_id(&self) -> ContractId {
match self {
Contract::Offered(o) => o.id,
Contract::Accepted(o) => o.get_contract_id(),
Contract::Signed(o) | Contract::Confirmed(o) | Contract::Refunded(o) => {
o.accepted_contract.get_contract_id()
}
Contract::FailedAccept(c) => c.offered_contract.id,
Contract::FailedSign(c) => c.accepted_contract.get_contract_id(),
Contract::Closed(c) => c.signed_contract.accepted_contract.get_contract_id(),
}
}
/// Returns the temporary contract id of a contract.
pub fn get_temporary_id(&self) -> ContractId {
match self {
Contract::Offered(o) => o.id,
Contract::Accepted(o) => o.offered_contract.id,
Contract::Signed(o) | Contract::Confirmed(o) | Contract::Refunded(o) => {
o.accepted_contract.offered_contract.id
}
Contract::FailedAccept(c) => c.offered_contract.id,
Contract::FailedSign(c) => c.accepted_contract.offered_contract.id,
Contract::Closed(c) => c.signed_contract.accepted_contract.offered_contract.id,
}
}
}
/// Information about a funding input.
#[derive(Clone, Debug)]
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
pub struct FundingInputInfo {
/// The funding input as used in messages.
pub funding_input: FundingInput,
/// The address corresponding to the input if it belongs to us.
pub address: Option<Address>,
}
/// Information about a contract that failed while verifying an accept message.
#[derive(Clone)]
pub struct FailedAcceptContract {
/// The offered contract that was accepted.
pub offered_contract: offered_contract::OfferedContract,
/// The received accept message.
pub accept_message: AcceptDlc,
/// The error message that was generated.
pub error_message: String,
}
/// Information about a contract that failed while verifying a sign message.
#[derive(Clone)]
pub struct FailedSignContract {
/// The accepted contract that was signed.
pub accepted_contract: accepted_contract::AcceptedContract,
/// The sign message that was received.
pub sign_message: SignDlc,
/// The error message that was generated.
pub error_message: String,
}
#[derive(Clone)]
/// Information about a contract that was closed by broadcasting a CET.
pub struct ClosedContract {
/// The signed contract that was closed.
pub signed_contract: SignedContract,
/// The attestations that were used to decrypt the broadcast CET.
pub attestations: Vec<OracleAttestation>,
/// The index of the CET that was broadcast.
pub cet_index: usize,
}
/// Information about the adaptor signatures and the CET for which they are
/// valid.
#[derive(Clone)]
pub enum AdaptorInfo {
/// For enumeration outcome DLC, no special information needs to be kept.
Enum,
/// For numerical outcome DLC, a trie is used to store the information.
Numerical(MultiOracleTrie),
/// For numerical outcome DLC where oracles are allowed to diverge to some
/// extent in the outcome value, a trie of trie is used to store the information.
NumericalWithDifference(MultiOracleTrieWithDiff),
}
/// The descriptor of a contract.
#[derive(Clone, Debug)]
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
pub enum ContractDescriptor {
/// Case for enumeration outcome DLC.
Enum(enum_descriptor::EnumDescriptor),
/// Case for numerical outcome DLC.
Numerical(numerical_descriptor::NumericalDescriptor),
}
impl ContractDescriptor {
/// Get the parameters on allowed divergence between oracle if any.
pub fn get_oracle_params(&self) -> Option<numerical_descriptor::DifferenceParams> {
match self {
ContractDescriptor::Enum(_) => None,
ContractDescriptor::Numerical(n) => n.difference_params.clone(),
}
}
}
| 36.959538 | 91 | 0.685486 |
0456f9c3e593eef32c6fb5d6f0f6fdb6e03ff920 | 1,248 | java | Java | src/main/java/theHexaghost/cards/ShieldOfDarkness.java | Rita-Bernstein/downfall-rebalance | 575c49aae2a2b6c90c74a86e797435563e8175b6 | [
"MIT"
] | null | null | null | src/main/java/theHexaghost/cards/ShieldOfDarkness.java | Rita-Bernstein/downfall-rebalance | 575c49aae2a2b6c90c74a86e797435563e8175b6 | [
"MIT"
] | null | null | null | src/main/java/theHexaghost/cards/ShieldOfDarkness.java | Rita-Bernstein/downfall-rebalance | 575c49aae2a2b6c90c74a86e797435563e8175b6 | [
"MIT"
] | null | null | null | package theHexaghost.cards;
import com.megacrit.cardcrawl.actions.common.GainEnergyAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import theHexaghost.GhostflameHelper;
import theHexaghost.HexaMod;
public class ShieldOfDarkness extends AbstractHexaCard {
public final static String ID = makeID("ShieldOfDarkness");
//stupid intellij stuff SKILL, SELF, COMMON
private static final int BLOCK = 10;
private static final int UPG_BLOCK = 4;
public ShieldOfDarkness() {
super(ID, 2, CardType.SKILL, CardRarity.COMMON, CardTarget.SELF);
baseBlock = BLOCK;
}
public void use(AbstractPlayer p, AbstractMonster m) {
if (!GhostflameHelper.activeGhostFlame.charged) {
atb(new GainEnergyAction(1));
}
blck();
}
public void triggerOnGlowCheck() {
this.glowColor = !GhostflameHelper.activeGhostFlame.charged ? AbstractCard.GOLD_BORDER_GLOW_COLOR : AbstractCard.BLUE_BORDER_GLOW_COLOR;// 65
}// 68
public void upgrade() {
if (!upgraded) {
upgradeName();
upgradeBlock(UPG_BLOCK);
}
}
} | 30.439024 | 149 | 0.705128 |
2f923c31e273ee946ffde9a430e54d4f00bffbae | 7,485 | lua | Lua | lua/mgb/sv_mgb.lua | Alexell/metrostroi_global_bans | dd5a0c142df9b51cdfe9f69a35737d132b28ed69 | [
"MIT"
] | null | null | null | lua/mgb/sv_mgb.lua | Alexell/metrostroi_global_bans | dd5a0c142df9b51cdfe9f69a35737d132b28ed69 | [
"MIT"
] | 1 | 2021-05-16T10:33:44.000Z | 2021-05-16T12:13:03.000Z | lua/mgb/sv_mgb.lua | Alexell/metrostroi_global_bans | dd5a0c142df9b51cdfe9f69a35737d132b28ed69 | [
"MIT"
] | null | null | null | ----------------- Metrostroi Global Bans -----------------
-- Автор: Alexell
-- Лицензия: MIT
-- Сайт: https://alexell.ru/
-- Steam: https://steamcommunity.com/id/alexell
-- Repo: https://github.com/Alexell/metrostroi_global_bans
----------------------------------------------------------
-- иконки GMod: http://www.famfamfam.com/lab/icons/silk/previews/index_abc.png
CreateConVar("mgb_events", 1, {FCVAR_ARCHIVE})
gameevent.Listen("player_connect")
util.AddNetworkString("MGB.MainMenu")
util.AddNetworkString("MGB.Reports")
util.AddNetworkString("MGB.AddReport")
util.AddNetworkString("MGB.AddVote")
util.AddNetworkString("MGB.Events")
util.AddNetworkString("MGB.Notice")
MGB.BadPlayers = {}
MGB.WaitPlayers = {}
MGB.BannedPlayers = {}
MGB.NeedBadNotice = false
MGB.NeedWaitNotice = false
MGB.LastEvent = {}
net.Receive("MGB.Reports",function(ln,ply)
local sid = net.ReadString()
local nick = net.ReadString()
local params = {act="getreports",host=GetHostName(),ip=game.GetIPAddress(),sid=sid}
http.Post("https://api.alexell.ru/metrostroi/mgb/",params,function(body,len,headers,code)
local tab = {}
if (code ~= 200 or body == "") then
print("[MGB] Web request failed! Please try later.")
tab = {result="MGB.Messages.WebRequestFailed"}
end
if body:find("Server blocked") then
tab = {result="MGB.Messages.Serverblocked"}
elseif body:find("Not found") then
tab = {result="MGB.Messages.NoReports"}
else
tab = util.JSONToTable(body)
end
net.Start("MGB.Reports")
net.WriteTable(tab)
net.WriteString(nick)
net.Send(ply)
end)
end)
net.Receive("MGB.AddReport",function(ln,ply)
local sid = net.ReadString()
local nick = net.ReadString()
local report = net.ReadString()
local admin = ply:SteamID()
local params = {act="addreport",host=GetHostName(),ip=game.GetIPAddress(),nick=nick,sid=sid,note=report,admin=admin}
http.Post("https://api.alexell.ru/metrostroi/mgb/",params,function(body,len,headers,code)
local result = ""
if (code ~= 200 or body == "") then
print("[MGB] Web request failed! Please try later.")
result = "MGB.Messages.WebRequestFailed"
end
if body:find("Server blocked") then
result = "MGB.Messages.Serverblocked"
elseif body:find("Report added") then
result = "MGB.Messages.ReportAdded"
elseif body:find("Report rejected") then
result = "MGB.Messages.ReportRejected"
elseif body:find("Repeat report") then
result = "MGB.Messages.ReportRepeat"
elseif body:find("Invalid SteamID") then
result = "MGB.Messages.InvalidSID"
end
net.Start("MGB.AddReport")
net.WriteString(result)
net.Send(ply)
end)
end)
net.Receive("MGB.AddVote",function(ln,ply)
local sid = net.ReadString()
local vote = net.ReadString()
local admin = ply:SteamID()
local params = {act="addvote",host=GetHostName(),ip=game.GetIPAddress(),sid=sid,vote=vote,admin=admin}
http.Post("https://api.alexell.ru/metrostroi/mgb/",params,function(body,len,headers,code)
local result = ""
if (code ~= 200 or body == "") then
print("[MGB] Web request failed! Please try later.")
result = "MGB.Messages.WebRequestFailed"
end
if body:find("Server blocked") then
result = "MGB.Messages.Serverblocked"
elseif body:find("Vote added") then
result = "MGB.Messages.VoteAdded"
elseif body:find("Repeat vote") then
result = "MGB.Messages.VoteRepeat"
end
net.Start("MGB.AddVote")
net.WriteString(result)
net.Send(ply)
end)
end)
local function GetBadPlayers()
local params = {act="getbad",host=GetHostName(),ip=game.GetIPAddress()}
http.Post("https://api.alexell.ru/metrostroi/mgb/",params,function(body,len,headers,code)
local tab = {}
if code ~= 200 then
print("[MGB] Web request failed! Code: "..code)
return
end
if (body == "" or body:find("Not found")) then return end
if (body == "" or body:find("Not found")) then return end
MGB.BadPlayers = util.JSONToTable(body) or {}
end)
end
local function GetWaitPlayers()
local params = {act="getwait",host=GetHostName(),ip=game.GetIPAddress()}
http.Post("https://api.alexell.ru/metrostroi/mgb/",params,function(body,len,headers,code)
if code ~= 200 then
print("[MGB] Web request failed! Code: "..code)
return
end
if (body == "" or body:find("Not found")) then return end
MGB.WaitPlayers = util.JSONToTable(body) or {}
end)
end
local function GetBannedPlayers()
local params = {act="getban",host=GetHostName(),ip=game.GetIPAddress()}
http.Post("https://api.alexell.ru/metrostroi/mgb/",params,function(body,len,headers,code)
if code ~= 200 then
print("[MGB] Web request failed! Code: "..code)
return
end
if (body == "" or body:find("Not found")) then return end
MGB.BannedPlayers = util.JSONToTable(body) or {}
end)
end
local function GetEvents()
if GetConVarNumber("mgb_events") == 1 then
local params = {act="getevents",host=GetHostName(),ip=game.GetIPAddress()}
http.Post("https://api.alexell.ru/metrostroi/mgb/",params,function(body,len,headers,code)
if code ~= 200 then
print("[MGB] Web request failed! Code: "..code)
return
end
if (body == "" or body:find("Not found")) then return end
if body ~= MGB.LastEvent then
MGB.LastEvent = body
net.Start("MGB.Events")
net.WriteTable(util.JSONToTable(body))
net.Broadcast()
end
end)
end
end
local function GetAPIData(updater)
-- получаем последние загруженные списки
local BadPlayers = MGB.BadPlayers
local WaitPlayers = MGB.WaitPlayers
local BannedPlayers = MGB.BannedPlayers
-- получаем списки через API
GetBadPlayers()
GetWaitPlayers()
GetBannedPlayers()
if updater then
-- проверяем необходимость оповестить админов
timer.Create("MGB.Notifier",3,1,function()
if MGB.NeedBadNotice == false then
for k,v in pairs(MGB.BadPlayers) do
local finded = false
for k2,v2 in pairs(BadPlayers) do
if v.sid == v2.sid then finded = true end
end
if finded == false then
MGB.NeedBadNotice = true
break
end
end
end
if MGB.NeedWaitNotice == false then
for k,v in pairs(MGB.WaitPlayers) do
local finded = false
for k2,v2 in pairs(WaitPlayers) do
if v.sid == v2.sid then finded = true end
end
if finded == false then
MGB.NeedWaitNotice = true
break
end
end
end
end)
end
end
local function PlayerBanned(sid)
for k,v in pairs(MGB.BannedPlayers) do
if sid == v.sid then return true end
end
return false
end
hook.Add("player_connect","MGB.Ban",function(data)
if PlayerBanned(data.networkid) then
game.KickID(data.networkid,"[MGB] You are banned on Metrostroi servers")
return
end
end)
timer.Create("MGB.Init",1,1,function() GetAPIData(false) end)
timer.Create("MGB.Updater",300,0,function() GetAPIData(true) GetEvents() end)
hook.Add("PlayerButtonDown","MGB.ShowMenu",function(ply,key)
if (key == KEY_F6 and ply:IsAdmin()) then
GetAPIData(true)
net.Start("MGB.MainMenu")
net.WriteTable(MGB.BadPlayers)
net.WriteTable(MGB.WaitPlayers)
net.WriteTable(MGB.BannedPlayers)
net.Send(ply)
end
end)
-- оповещаем админов по двум спискам
hook.Add("PlayerInitialSpawn", "MGB.AdminNotice",function(ply)
if ply:IsAdmin() then
if MGB.NeedBadNotice == true then
net.Start("MGB.Notice")
net.WriteString("MGB.Messages.NoticeBad")
net.Send(ply)
MGB.NeedBadNotice = false
end
if MGB.NeedWaitNotice == true then
net.Start("MGB.Notice")
net.WriteString("MGB.Messages.NoticeWait")
net.Send(ply)
MGB.NeedWaitNotice = false
end
end
end) | 30.55102 | 117 | 0.696326 |
32b0fceeae84f5ca545b10e0ada6a164667cd282 | 653 | dart | Dart | taste_cloud_functions/functions/lib/types/base/simple_snapshot.dart | tasteapp/taste_public | b2d884b405224dd1e74b4462fac2c1f59c1f6ca2 | [
"MIT"
] | null | null | null | taste_cloud_functions/functions/lib/types/base/simple_snapshot.dart | tasteapp/taste_public | b2d884b405224dd1e74b4462fac2c1f59c1f6ca2 | [
"MIT"
] | null | null | null | taste_cloud_functions/functions/lib/types/base/simple_snapshot.dart | tasteapp/taste_public | b2d884b405224dd1e74b4462fac2c1f59c1f6ca2 | [
"MIT"
] | 1 | 2021-02-06T07:44:39.000Z | 2021-02-06T07:44:39.000Z | import 'package:taste_cloud_functions/taste_functions.dart';
class SimpleSnapshot implements DocumentSnapshot {
@override
final DocumentData data;
@override
final DocumentReference reference;
@override
final bool exists = true;
SimpleSnapshot(this.data, this.reference);
@override
Timestamp get createTime => throw UnimplementedError();
@override
String get documentID => throw UnimplementedError();
@override
Firestore get firestore => throw UnimplementedError();
@override
JsDocumentSnapshot get nativeInstance => throw UnimplementedError();
@override
Timestamp get updateTime => throw UnimplementedError();
}
| 23.321429 | 70 | 0.76876 |
4d6d74e904022343d82d4b1e761f04ef87c12eca | 599 | dart | Dart | lib/pages/music/netease_cloud/home/action.dart | Swordce/music | 90104cb38b1c701092c43141b4cfade3049444b8 | [
"Apache-2.0"
] | null | null | null | lib/pages/music/netease_cloud/home/action.dart | Swordce/music | 90104cb38b1c701092c43141b4cfade3049444b8 | [
"Apache-2.0"
] | null | null | null | lib/pages/music/netease_cloud/home/action.dart | Swordce/music | 90104cb38b1c701092c43141b4cfade3049444b8 | [
"Apache-2.0"
] | null | null | null | import 'package:fish_redux/fish_redux.dart';
//TODO replace with your own action
enum NeteaseAction { action,jumpToPlayList,jumpToPlaylistCenter,jumpToRankPage }
class NeteaseActionCreator {
static Action onAction() {
return const Action(NeteaseAction.action);
}
static Action onJumpToPlayList(playlistInfo) {
return Action(NeteaseAction.jumpToPlayList,payload: playlistInfo);
}
static Action onJumpToPlaylistCenter() {
return Action(NeteaseAction.jumpToPlaylistCenter);
}
static Action onJumpToRankPage() {
return Action(NeteaseAction.jumpToRankPage);
}
}
| 23.96 | 80 | 0.769616 |
85be82f40de9035efe092165d428634fadc7cd97 | 2,350 | ps1 | PowerShell | Scripts/Azure Automation/Get-AutomationModuleDetails.ps1 | thejanek/DemoCode | 399abe8f55aa50f547efd5e4fd30c7c49a1b233e | [
"MIT"
] | 7 | 2018-02-23T16:56:10.000Z | 2022-01-27T13:21:33.000Z | Scripts/Azure Automation/Get-AutomationModuleDetails.ps1 | thejanek/DemoCode | 399abe8f55aa50f547efd5e4fd30c7c49a1b233e | [
"MIT"
] | 1 | 2018-05-09T02:04:02.000Z | 2018-05-09T17:02:35.000Z | Scripts/Azure Automation/Get-AutomationModuleDetails.ps1 | thejanek/DemoCode | 399abe8f55aa50f547efd5e4fd30c7c49a1b233e | [
"MIT"
] | 6 | 2017-03-31T17:30:44.000Z | 2022-02-25T20:46:19.000Z | <#
.SYNOPSIS
Get a list of modules from an Azure Automation account.
.DESCRIPTION
Get the listing of modules in a given Azure Automation account including
details such as module version number, date last modified and size.
.PARAMETER ResourceGroupName
The resource group name where the Automation account exists.
.PARAMETER AutomationAccountName
The name of the Automation account to query for the modules to list.
.EXAMPLE
.\Get-AutomationModuleDetails.ps1 -ResourceGroupName 'MyResourceGroup' -AutomationAccountName 'MyAutomationAccount'
.EXAMPLE
.\Get-AutomationModuleDetails.ps1 -ResourceGroupName 'MyResourceGroup' -AutomationAccountName 'MyAutomationAccount' | Out-File c:\temp\output.txt
.NOTES
AUTHOR : Jeffrey Fanjoy
LASTEDIT: 10/28/2016
#>
Param (
[Parameter(Mandatory=$true, Position=0)]
[string] $ResourceGroupName,
[Parameter(Mandatory=$true, Position=1)]
[string] $AutomationAccountName
)
# Make sure required modules are available
$RequiredModules = @('AzureRM.profile', 'AzureRM.automation', 'AzureRM.resources')
$ModuleMissing = $false
foreach ($Module in $RequiredModules) {
Write-Verbose ("Checking for module '{0}'." -f $Module)
if (!(Get-Module -Name $Module -ListAvailable)) {
Write-Output ("Module '{0}' was not found." -f $Module)
$ModuleMissing = $true
}
}
if ($ModuleMissing -eq $true) { throw 'At least one required module was not found. See "https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/" for details on how to install Azure modules for PowerShell.' }
# Login to Azure.
Login-AzureRmAccount
# Select subscription if more than one is available
$Subscriptions = Get-AzureRmSubscription
if (($Subscriptions | Measure-Object).Count -gt 1) {
Select-AzureRmSubscription -SubscriptionName (($Subscriptions | Out-GridView -Title 'Select Azure Subscription' -PassThru).SubscriptionName)
}
$ModuleList = Get-AzureRmAutomationModule -ResourceGroupName $ResourceGroupName -AutomationAccountName $AutomationAccountName -ErrorAction Stop
$Modules = @()
foreach ($Module in $ModuleList) {
$Modules += Get-AzureRmAutomationModule -Name $Module.Name -ResourceGroupName $ResourceGroupName -AutomationAccountName $AutomationAccountName
}
$Modules | Format-Table -AutoSize | Out-String -Width 8000
| 39.830508 | 239 | 0.756596 |
75ba4bba6be0d0c81f842dec9d7df5b783059573 | 43 | rs | Rust | src/functions/mod.rs | ystreet/titleformat-rs | cf483951a68a386df4d887021336e5982da46ab7 | [
"Apache-2.0",
"MIT"
] | 2 | 2019-08-16T16:25:04.000Z | 2021-11-19T02:04:50.000Z | src/functions/mod.rs | ystreet/titleformat-rs | cf483951a68a386df4d887021336e5982da46ab7 | [
"Apache-2.0",
"MIT"
] | null | null | null | src/functions/mod.rs | ystreet/titleformat-rs | cf483951a68a386df4d887021336e5982da46ab7 | [
"Apache-2.0",
"MIT"
] | null | null | null | pub mod control;
pub mod num;
pub mod str;
| 10.75 | 16 | 0.72093 |
cd0747ecdfc4484ad302a19bc758d9a41f14ca41 | 1,020 | rs | Rust | auth/src/repositories/sessions.rs | lewd-site/auth-rs | 9439aa789730b0a7938f24c908ba5bb6844b11da | [
"MIT"
] | null | null | null | auth/src/repositories/sessions.rs | lewd-site/auth-rs | 9439aa789730b0a7938f24c908ba5bb6844b11da | [
"MIT"
] | 1 | 2020-07-21T16:18:50.000Z | 2020-07-21T16:18:50.000Z | auth/src/repositories/sessions.rs | lewd-site/auth-rs | 9439aa789730b0a7938f24c908ba5bb6844b11da | [
"MIT"
] | null | null | null | use crate::models::sessions::{NewSession, Session};
use diesel::pg::PgConnection;
use diesel::prelude::*;
pub struct SessionRepository();
impl SessionRepository {
pub fn get_by_token(conn: &PgConnection, uid: i32, token: &str) -> Option<Session> {
use crate::schema::sessions::dsl::*;
let items: Vec<Session> = sessions
.filter(user_id.eq(uid))
.filter(refresh_token.eq(token))
.limit(1)
.load(conn)
.unwrap();
items.into_iter().next()
}
pub fn create(conn: &PgConnection, session: &NewSession) -> Session {
use crate::schema::sessions::dsl::*;
diesel::insert_into(sessions)
.values(session)
.get_result(conn)
.unwrap()
}
pub fn delete(conn: &PgConnection, session: &Session) -> Session {
use crate::schema::sessions::dsl::*;
let source = sessions.filter(id.eq(session.id));
diesel::delete(source).get_result(conn).unwrap()
}
}
| 27.567568 | 88 | 0.587255 |
cad107d1bd6a061c108901202a3cccf19d151d44 | 7,985 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_2793.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_2793.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_2793.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xfbee, %rcx
nop
nop
nop
nop
nop
sub %rax, %rax
mov $0x6162636465666768, %r12
movq %r12, %xmm5
movups %xmm5, (%rcx)
and $51181, %rax
lea addresses_normal_ht+0xbe6e, %rsi
lea addresses_normal_ht+0x13d6e, %rdi
clflush (%rsi)
nop
sub %r11, %r11
mov $49, %rcx
rep movsw
nop
nop
nop
nop
inc %r12
lea addresses_UC_ht+0x1c0a6, %rsi
lea addresses_WC_ht+0x66a, %rdi
nop
nop
nop
nop
nop
and $3828, %rbp
mov $40, %rcx
rep movsl
nop
nop
nop
xor $43366, %r12
lea addresses_UC_ht+0xdb0e, %r12
nop
nop
nop
nop
xor %rax, %rax
mov $0x6162636465666768, %rbp
movq %rbp, %xmm3
movups %xmm3, (%r12)
nop
nop
sub %rcx, %rcx
lea addresses_WT_ht+0x112ae, %rsi
lea addresses_A_ht+0x1cee, %rdi
nop
nop
nop
nop
nop
inc %rbp
mov $45, %rcx
rep movsq
nop
nop
nop
inc %rdi
lea addresses_normal_ht+0x1689e, %rcx
nop
inc %rbp
mov (%rcx), %rax
nop
nop
nop
nop
nop
xor $40059, %r12
lea addresses_WT_ht+0xa3ee, %rsi
lea addresses_normal_ht+0xbaee, %rdi
nop
nop
nop
nop
xor %r8, %r8
mov $58, %rcx
rep movsl
nop
nop
nop
xor %rcx, %rcx
lea addresses_WT_ht+0x13a60, %r8
nop
nop
nop
nop
nop
sub %rcx, %rcx
movups (%r8), %xmm3
vpextrq $1, %xmm3, %rbp
nop
inc %r11
lea addresses_WC_ht+0x1abee, %rcx
nop
nop
nop
sub %rax, %rax
vmovups (%rcx), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rdi
dec %rsi
lea addresses_WC_ht+0xabe6, %rax
nop
nop
sub %rbp, %rbp
vmovups (%rax), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %r12
nop
nop
add %rdi, %rdi
lea addresses_A_ht+0xb7ea, %rsi
lea addresses_A_ht+0x1bf6, %rdi
clflush (%rsi)
nop
nop
nop
sub $43779, %r11
mov $118, %rcx
rep movsl
dec %rcx
lea addresses_WT_ht+0x82ba, %r8
nop
nop
nop
nop
add $10063, %r12
movl $0x61626364, (%r8)
nop
nop
nop
nop
nop
xor $10626, %rdi
lea addresses_D_ht+0x103ee, %rsi
lea addresses_A_ht+0x16b4e, %rdi
nop
nop
nop
nop
nop
and %r8, %r8
mov $35, %rcx
rep movsb
nop
nop
nop
nop
nop
sub $38209, %rcx
lea addresses_A_ht+0x1e16e, %rsi
lea addresses_normal_ht+0x103ee, %rdi
nop
sub %r12, %r12
mov $50, %rcx
rep movsl
nop
nop
nop
nop
add $9171, %r11
lea addresses_WT_ht+0x7bee, %rcx
nop
nop
inc %rax
movl $0x61626364, (%rcx)
nop
nop
nop
nop
lfence
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r9
push %rcx
// Faulty Load
lea addresses_UC+0xd3ee, %r11
cmp $46801, %r12
mov (%r11), %r9
lea oracles, %r12
and $0xff, %r9
shlq $12, %r9
mov (%r12,%r9,1), %r9
pop %rcx
pop %r9
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'same': True, 'size': 8, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': True}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': True, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
| 32.591837 | 2,999 | 0.661115 |
805b810a2c5b8b0c57a737c0ee2c78cd68f40893 | 14,275 | java | Java | gtas-parent/gtas-parsers/src/main/java/gov/gtas/parsers/pnrgov/PnrUtils.java | yashpatil/GTAS | 4b74a3fe61af5e255d60c4308425e8861c2a406b | [
"BSD-3-Clause"
] | null | null | null | gtas-parent/gtas-parsers/src/main/java/gov/gtas/parsers/pnrgov/PnrUtils.java | yashpatil/GTAS | 4b74a3fe61af5e255d60c4308425e8861c2a406b | [
"BSD-3-Clause"
] | null | null | null | gtas-parent/gtas-parsers/src/main/java/gov/gtas/parsers/pnrgov/PnrUtils.java | yashpatil/GTAS | 4b74a3fe61af5e255d60c4308425e8861c2a406b | [
"BSD-3-Clause"
] | null | null | null | /*
* All GTAS code is Copyright 2016, The Department of Homeland Security (DHS), U.S. Customs and Border Protection (CBP).
*
* Please see LICENSE.txt for details.
*/
package gov.gtas.parsers.pnrgov;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import gov.gtas.parsers.exception.ParseRuntimeException;
import gov.gtas.parsers.pnrgov.segment.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import gov.gtas.parsers.edifact.EdifactLexer;
import gov.gtas.parsers.pnrgov.segment.TIF.TravelerDetails;
import gov.gtas.parsers.util.DateUtils;
import gov.gtas.parsers.util.ParseUtils;
import gov.gtas.parsers.vo.AddressVo;
import gov.gtas.parsers.vo.BagVo;
import gov.gtas.parsers.vo.DocumentVo;
import gov.gtas.parsers.vo.PassengerVo;
import gov.gtas.parsers.vo.PhoneVo;
public class PnrUtils {
private static final Logger logger = LoggerFactory.getLogger(PnrUtils.class);
public static Date parseDateTime(String dt) {
final String DATE_ONLY_FORMAT = DateUtils.DATE_FORMAT_DAY_FIRST;
final String DATE_TIME_FORMAT = DateUtils.DT_FORMAT_DAY_FIRST;
final String DATE_TIME_FORMAT_SEC = DateUtils.DT_FORMAT_DAY_FIRST_SEC;
if (dt.length() == DATE_ONLY_FORMAT.length()) {
return ParseUtils.parseDateTime(dt, DATE_ONLY_FORMAT);
} else if (dt.length() == DATE_TIME_FORMAT.length()) {
return ParseUtils.parseDateTime(dt, DATE_TIME_FORMAT);
} else if (dt.length() == DATE_TIME_FORMAT_SEC.length()) {
return ParseUtils.parseDateTime(dt, DATE_TIME_FORMAT_SEC);
}
return null;
}
/**
* date format used for passport/visa expiration, issuance date
*/
private static final String DOC_DATE_FORMAT = "ddMMMyy";
/**
* <p>
* We use the SSR (DOCS) segment to grab the majority of the information about
* the passenger -- name, document number, etc. The TIF segment is only used to
* record the traveler reference number and any suffix or title in the name.
* <p>
* Group 2 in a PNR (which begins with a TIF segment) may contain multiple SSR
* DOCS segments. This can occur for several reasons:
* <ol>
* <li>For a passenger holding a passport plus an alien card and traveling with
* an infant it will be necessary to provide multiple DOCS, all associated to
* the same passenger.
* <li>One of the lines exceeds the max character limit of 69 chars.
* </ol>
* <p>
* TODO: was not handling the 4th example below b/c of extra field. check
* whether it's an error in the message or not.
*
* <p>
* Refer to Section "3.13.1 API — Passenger Travel Document Information" in
* "Reservations Interline Message Procedures — Passenger (AIRIMP)"
*
* <pre>
* </pre>
*/
public static PassengerVo createPassenger(List<SSRDocs> ssrDocs, TIF tif, REF ref, String recordLocator) {
// Reversed ORDER to get the best SSR doc - Passport is best, followed by
// passport card, followed by everything else.
ssrDocs.sort(Comparator.comparing(SSRDocs::getSsrDocsType).reversed());
SSRDocs bestDocument = ssrDocs.get(0);
PassengerVo p = new PassengerVo();
p.setPassengerType("P");
p.setPnrRecordLocator(recordLocator);
if (ref != null && !ref.getReferenceIds().isEmpty()) {
p.setPnrReservationReferenceNumber(ref.getReferenceIds().get(0));
}
String gender = bestDocument.getGender() == null ? null : bestDocument.getGender().toString();
p.setGender(gender);
processNames(p, bestDocument.getSurname(), bestDocument.getFirstGivenName(), bestDocument.getSecondGivenName());
setPassengerDob(p, bestDocument.getDob());
p.setNationality(bestDocument.getNationality());
processEachSSRDoc(ssrDocs, p);
updateNameToTIFName(tif, p);
return p;
}
private static void updateNameToTIFName(TIF tif, PassengerVo p) {
if (!tif.getTravelerDetails().isEmpty()) {
TravelerDetails td = tif.getTravelerDetails().get(0);
p.setTravelerReferenceNumber(td.getTravelerReferenceNumber());
PassengerVo tmp = new PassengerVo();
if (tif.getTravelerSurname() != null && td.getTravelerGivenName() != null)
processNames(tmp, tif.getTravelerSurname(), td.getTravelerGivenName(), null);
if (StringUtils.isNoneBlank(tif.getTravelerSurname()) && StringUtils.isBlank(p.getLastName())) {
p.setLastName(tmp.getLastName());
}
if (StringUtils.isNoneBlank(td.getTravelerGivenName()) && StringUtils.isBlank(p.getFirstName())) {
p.setFirstName(tmp.getFirstName());
}
checkNamesForExtraChars(p);
p.setTitle(tmp.getTitle());
p.setSuffix(tmp.getSuffix());
}
}
private static void processEachSSRDoc(List<SSRDocs> ssrDocs, PassengerVo p) {
for (SSRDocs ssrDoc : ssrDocs) {
if (p.getGender() == null) {
if (ssrDoc.getGender() != null) {
p.setGender(ssrDoc.getGender().toString());
}
}
if (p.getNationality() == null) {
if (ssrDoc.getNationality() != null) {
p.setNationality(ssrDoc.getNationality());
}
}
if (p.getDob() == null) {
if (ssrDoc.getDob() != null) {
setPassengerDob(p, ssrDoc.getDob());
}
}
DocumentVo documentVo = ssrDoc.toDocumentVo();
if (StringUtils.isNotBlank(documentVo.getDocumentNumber()) && StringUtils.isBlank(p.getNationality())) {
p.setNationality(documentVo.getIssuanceCountry());
}
if (StringUtils.isNotBlank(documentVo.getDocumentNumber())) {
p.addDocument(documentVo);
}
}
}
// Handling names with a 1 #478 code fix
private static void checkNamesForExtraChars(PassengerVo p) {
if (StringUtils.isNotBlank(p.getMiddleName()) && p.getMiddleName().indexOf("-1") != -1) {
p.setMiddleName(p.getMiddleName().substring(0, p.getMiddleName().indexOf("-1")));
}
if (StringUtils.isNotBlank(p.getLastName()) && p.getLastName().indexOf("-1") != -1) {
p.setLastName(p.getLastName().substring(0, p.getLastName().indexOf("-1")));
}
if (StringUtils.isNotBlank(p.getFirstName()) && p.getFirstName().indexOf("-1") != -1) {
p.setFirstName(p.getFirstName().substring(0, p.getFirstName().indexOf("-1")));
}
}
// TODO: Potentially remove this code as was replaced by SSRDoco class creation
public static DocumentVo createVisa(SSR ssr) {
List<String> strs = splitSsrFreeText(ssr);
if (CollectionUtils.isEmpty(strs)) {
return null;
}
DocumentVo visa = new DocumentVo();
// index 1 place of birth
visa.setDocumentType(safeGet(strs, 2));
visa.setDocumentNumber(safeGet(strs, 3));
// index 4 city of issue
String d = safeGet(strs, 5);
if (StringUtils.isNotBlank(d)) {
Date issuanceDate = ParseUtils.parseDateTime(d, DOC_DATE_FORMAT);
visa.setIssuanceDate(issuanceDate);
}
visa.setIssuanceCountry(safeGet(strs, 6));
return visa;
}
public static AddressVo createAddress(ADD add) {
AddressVo rv = new AddressVo();
rv.setType(add.getAddressType());
rv.setLine1(add.getStreetNumberAndName());
rv.setCity(add.getCity());
rv.setState(add.getStateOrProvinceCode());
rv.setCountry(add.getCountryCode());
rv.setPostalCode(add.getPostalCode());
rv.setPhoneNumber(ParseUtils.prepTelephoneNumber(add.getTelephone()));
rv.setEmail(add.getEmail());
return rv;
}
/**
* SSR+DOCA:HK:1:TZ:::::/D/AUS/13 SHORE AVENUE/BROADBEACH/QLD/4215+::43577'
*/
public static AddressVo createAddress(SSR ssr) {
List<String> strs = splitSsrFreeText(ssr);
if (strs == null) {
return null;
}
AddressVo rv = new AddressVo();
rv.setCountry(safeGet(strs, 2));
rv.setLine1(safeGet(strs, 3));
rv.setCity(safeGet(strs, 4));
rv.setState(safeGet(strs, 5));
rv.setPostalCode(safeGet(strs, 6));
return rv;
}
public static PhoneVo createPhone(String number) {
PhoneVo rv = new PhoneVo();
rv.setNumber(ParseUtils.prepTelephoneNumber(number));
return rv;
}
/**
* Extract the nth PNR from the msg text.
*
* @param index
* 0-based index of the PNR
* @return text of the nth PNR; null if does not exist.
*/
public static String getSinglePnr(EdifactLexer lexer, int index) {
String regex = String.format("SRC\\s*\\%c", lexer.getUna().getSegmentTerminator());
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(lexer.getMessage());
boolean found = false;
for (int i = 0; i <= index; i++) {
found = matcher.find();
}
if (!found) {
return null;
}
int start = matcher.start();
int end = -1;
if (matcher.find()) {
end = matcher.start();
} else {
end = lexer.getStartOfSegment("UNT");
}
if (end != -1) {
return lexer.getMessage().substring(start, end);
} else {
return lexer.getMessage().substring(start);
}
}
public static List<String> getPnrs(String msg) {
if (StringUtils.isBlank(msg)) {
return null;
}
EdifactLexer lexer = new EdifactLexer(msg);
String header = getMessageHeader(msg, lexer);
String footer = getMessageFooter(msg, lexer);
List<String> rv = new ArrayList<>();
int i = 0;
for (;;) {
String pnr = getSinglePnr(lexer, i++);
if (pnr == null) {
break;
} else {
StringBuffer buff = new StringBuffer(lexer.getUna().getSegmentText());
buff.append(header).append(pnr).append(footer);
rv.add(buff.toString());
}
}
return rv;
}
private static String getMessageFooter(String msg, EdifactLexer lexer) {
int startOfFooter = lexer.getStartOfSegment("UNT");
if (startOfFooter == -1) {
throw new ParseRuntimeException("Unable to find segment UNT. Message processing failed.");
}
return msg.substring(startOfFooter);
}
private static String getMessageHeader(String msg, EdifactLexer lexer) {
int start = lexer.getStartOfSegment("UNB");
int end = lexer.getStartOfSegment("SRC");
if (start == -1 || end == -1) {
String segmentsNotFound = start == -1 ? "UNB " : "";
segmentsNotFound += end == -1 ? "SRC" : "";
throw new ParseRuntimeException(
"Unable to find segment(s) " + segmentsNotFound + " . Aborting message processing!");
}
return msg.substring(start, end);
}
public static <T> T safeGet(List<T> list, int i) {
if (i < 0 || i >= list.size()) {
return null;
}
return list.get(i);
}
private static final String[] SUFFIXES = { "JR", "SR" };
private static final String[] PREFIXES = { "MR", "MRS", "MS", "DR", "MISS", "SIR", "MADAM", "MAYOR", "PRESIDENT" };
private static void processNames(PassengerVo p, String last, String first, String middle) {
p.setFirstName(first);
p.setMiddleName(middle);
p.setLastName(last);
if (first != null) {
for (String prefix : PREFIXES) {
String firstName = null;
if (first.startsWith(prefix)) {
firstName = first.substring(prefix.length()).trim();
} else if (first.endsWith(prefix)) {
firstName = first.substring(0, first.length() - prefix.length()).trim();
}
if (firstName != null) {
p.setTitle(prefix);
p.setFirstName(firstName);
if (StringUtils.isNotEmpty(p.getGender()) && "F".equalsIgnoreCase(p.getGender())
&& "MR".equalsIgnoreCase(prefix)) {
continue;
} else {
break;
}
}
}
}
if (last != null) {
if (last.indexOf("-1") > 0) {
last = last.substring(0, last.indexOf("-1"));
}
for (String suffix : SUFFIXES) {
if (last.endsWith(suffix)) {
p.setSuffix(suffix);
String lastName = last.substring(0, last.length() - suffix.length()).trim();
p.setLastName(lastName);
break;
}
}
}
}
private static List<String> splitSsrFreeText(SSR ssr) {
if (ssr.getFreeText() != null) {
List<String> strs = new ArrayList<>();
for (String s : ssr.getFreeText().split("/")) {
strs.add(s.trim());
}
return strs;
}
return null;
}
public static String getBagTagFromElement(String tagNumber, int counter) {
if (StringUtils.isBlank(tagNumber)) {
return "0";
}
String tagId = "";
tagNumber = tagNumber.replaceAll("\\s", "").trim();
Long value;
try {
value = (Long.valueOf(tagNumber)) + counter;
tagId = value.toString();
} catch (NumberFormatException e) {
tagId = tagNumber + counter;
}
return tagId;
}
public static PassengerVo getPaxFromTIF(TIF tif, List<PassengerVo> passengers) {
if (passengers == null || passengers.size() <= 0) {
return null;
}
PassengerVo thePax = passengers.get(0);
if (tif != null) {
// try finding pax based on tif info
String surname = tif.getTravelerSurname();
List<TravelerDetails> td = tif.getTravelerDetails();
if (CollectionUtils.isNotEmpty(td)) {
String firstName = td.get(0).getTravelerGivenName();
for (PassengerVo pax : passengers) {
if (surname.equals(pax.getLastName()) && firstName.contains(pax.getFirstName())) {
thePax = pax;
break;
}
}
}
}
return thePax;
}
public static String getPhoneNumberFromLTS(String phoneText) {
try {
phoneText = phoneText.replaceAll("\\s+", "");
phoneText = phoneText.substring(phoneText.indexOf(LTS.APM) + 3);
if (phoneText.indexOf("/") > 0) {
phoneText = ParseUtils.prepTelephoneNumber(phoneText.substring(0, phoneText.indexOf("/")));
}
} catch (Exception e) {
// e.getMessage();
}
return phoneText;
}
public static String getFrequentFlyertextFromFreeText(String freeText) {
String temp = null;
String[] tokens = freeText.split("/");
for (String s : tokens) {
s.trim();
if (s.indexOf("-") > 0) {
temp = s.substring(0, s.indexOf("-"));
}
}
return temp;
}
public static String getPhoneNumberFromFreeText(String freeText) {
String temp = null;
String[] tokens = freeText.split("/");
for (String s : tokens) {
s.trim();
if (s.indexOf("-") > 0) {
temp = s.substring(0, s.indexOf("-"));
}
}
return temp;
}
private static void setPassengerDob(PassengerVo p, String d) {
if (StringUtils.isNotBlank(d)) {
try {
Date dob = ParseUtils.parseBirthday(d, DOC_DATE_FORMAT);
p.setDob(dob);
p.setAge(DateUtils.calculateAge(dob));
} catch (Exception e) {
logger.warn("Failed to process DOB");
}
}
}
public static List<DocumentVo> convertDocVoFromDoco(List<SSRDoco> ssrDocos) {
List<DocumentVo> docList = new ArrayList<DocumentVo>();
for (SSRDoco ssrDoco : ssrDocos) {
docList.add(new DocumentVo(ssrDoco));
}
return docList;
}
}
| 31.512141 | 120 | 0.682872 |
ecc82bbfe378a19cf8e8f37a74cc2d5ee4f801c3 | 589 | ps1 | PowerShell | src/tests/classes/Package.Tests.ps1 | michalporeba/dbapipes | e95f1120d1473a32ef9f60e5ae35357115f49854 | [
"MIT"
] | null | null | null | src/tests/classes/Package.Tests.ps1 | michalporeba/dbapipes | e95f1120d1473a32ef9f60e5ae35357115f49854 | [
"MIT"
] | null | null | null | src/tests/classes/Package.Tests.ps1 | michalporeba/dbapipes | e95f1120d1473a32ef9f60e5ae35357115f49854 | [
"MIT"
] | null | null | null | . $PSScriptRoot\..\..\classes\Package.ps1
Describe "Unit tests of Package class"{
$words = @{ word = "abc" },@{ word = "123" }
Context "Testing Package constructor"{
It "Constructor sets Name to <word>" -TestCases $words {
param($word)
$package = [Package]::new('path', $word);
$package.Name | Should -Be $word
}
It "Constructor sets Path to <word>" -TestCases $words {
param($word)
$package = [Package]::new($word, 'name');
$package.Path | Should -Be $word
}
}
} | 28.047619 | 64 | 0.521222 |
3936c0fee7ae4d6f637c88329a38d40a95638159 | 938 | html | HTML | blog/sprint4-technical.html | izzy-asplet/izzy-asplet.github.io | e2748060ce98ce929bcd96073db08618367debf1 | [
"MIT"
] | null | null | null | blog/sprint4-technical.html | izzy-asplet/izzy-asplet.github.io | e2748060ce98ce929bcd96073db08618367debf1 | [
"MIT"
] | null | null | null | blog/sprint4-technical.html | izzy-asplet/izzy-asplet.github.io | e2748060ce98ce929bcd96073db08618367debf1 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Amatic+SC&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Reenie+Beanie&display=swap" rel="stylesheet">
<link href="styles/main.css" rel="stylesheet" type="text/css" />
<title>Problem Solving</title>
</head>
<body>
<h1>Problem Solving</h1>
<p>
</p>
<a href="https://izzy-asplet.github.io/index.html"><span class="returnlink">
<---Return to home page</span> </a> </body> </html> | 39.083333 | 116 | 0.679104 |
3d26e384ac065e2c8862d90473d3daf7cd968591 | 32,648 | rs | Rust | sdk/sns/src/operation_ser.rs | pyjac/aws-sdk-rust | 6780fde33fd800c70deb27d0f096c0f2acc215b3 | [
"Apache-2.0"
] | null | null | null | sdk/sns/src/operation_ser.rs | pyjac/aws-sdk-rust | 6780fde33fd800c70deb27d0f096c0f2acc215b3 | [
"Apache-2.0"
] | null | null | null | sdk/sns/src/operation_ser.rs | pyjac/aws-sdk-rust | 6780fde33fd800c70deb27d0f096c0f2acc215b3 | [
"Apache-2.0"
] | null | null | null | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_operation_add_permission(
input: &crate::input::AddPermissionInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "AddPermission", "2010-03-31");
#[allow(unused_mut)]
let mut scope_1 = writer.prefix("TopicArn");
if let Some(var_2) = &input.topic_arn {
scope_1.string(var_2);
}
#[allow(unused_mut)]
let mut scope_3 = writer.prefix("Label");
if let Some(var_4) = &input.label {
scope_3.string(var_4);
}
#[allow(unused_mut)]
let mut scope_5 = writer.prefix("AWSAccountId");
if let Some(var_6) = &input.aws_account_id {
let mut list_8 = scope_5.start_list(false, None);
for item_7 in var_6 {
#[allow(unused_mut)]
let mut entry_9 = list_8.entry();
entry_9.string(item_7);
}
list_8.finish();
}
#[allow(unused_mut)]
let mut scope_10 = writer.prefix("ActionName");
if let Some(var_11) = &input.action_name {
let mut list_13 = scope_10.start_list(false, None);
for item_12 in var_11 {
#[allow(unused_mut)]
let mut entry_14 = list_13.entry();
entry_14.string(item_12);
}
list_13.finish();
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_check_if_phone_number_is_opted_out(
input: &crate::input::CheckIfPhoneNumberIsOptedOutInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "CheckIfPhoneNumberIsOptedOut", "2010-03-31");
#[allow(unused_mut)]
let mut scope_15 = writer.prefix("phoneNumber");
if let Some(var_16) = &input.phone_number {
scope_15.string(var_16);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_confirm_subscription(
input: &crate::input::ConfirmSubscriptionInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "ConfirmSubscription", "2010-03-31");
#[allow(unused_mut)]
let mut scope_17 = writer.prefix("TopicArn");
if let Some(var_18) = &input.topic_arn {
scope_17.string(var_18);
}
#[allow(unused_mut)]
let mut scope_19 = writer.prefix("Token");
if let Some(var_20) = &input.token {
scope_19.string(var_20);
}
#[allow(unused_mut)]
let mut scope_21 = writer.prefix("AuthenticateOnUnsubscribe");
if let Some(var_22) = &input.authenticate_on_unsubscribe {
scope_21.string(var_22);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_create_platform_application(
input: &crate::input::CreatePlatformApplicationInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "CreatePlatformApplication", "2010-03-31");
#[allow(unused_mut)]
let mut scope_23 = writer.prefix("Name");
if let Some(var_24) = &input.name {
scope_23.string(var_24);
}
#[allow(unused_mut)]
let mut scope_25 = writer.prefix("Platform");
if let Some(var_26) = &input.platform {
scope_25.string(var_26);
}
#[allow(unused_mut)]
let mut scope_27 = writer.prefix("Attributes");
if let Some(var_28) = &input.attributes {
let mut map_29 = scope_27.start_map(false, "key", "value");
for (key_30, value_31) in var_28 {
#[allow(unused_mut)]
let mut entry_32 = map_29.entry(key_30);
{
entry_32.string(value_31);
}
}
map_29.finish();
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_create_platform_endpoint(
input: &crate::input::CreatePlatformEndpointInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "CreatePlatformEndpoint", "2010-03-31");
#[allow(unused_mut)]
let mut scope_33 = writer.prefix("PlatformApplicationArn");
if let Some(var_34) = &input.platform_application_arn {
scope_33.string(var_34);
}
#[allow(unused_mut)]
let mut scope_35 = writer.prefix("Token");
if let Some(var_36) = &input.token {
scope_35.string(var_36);
}
#[allow(unused_mut)]
let mut scope_37 = writer.prefix("CustomUserData");
if let Some(var_38) = &input.custom_user_data {
scope_37.string(var_38);
}
#[allow(unused_mut)]
let mut scope_39 = writer.prefix("Attributes");
if let Some(var_40) = &input.attributes {
let mut map_41 = scope_39.start_map(false, "key", "value");
for (key_42, value_43) in var_40 {
#[allow(unused_mut)]
let mut entry_44 = map_41.entry(key_42);
{
entry_44.string(value_43);
}
}
map_41.finish();
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_create_sms_sandbox_phone_number(
input: &crate::input::CreateSmsSandboxPhoneNumberInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "CreateSMSSandboxPhoneNumber", "2010-03-31");
#[allow(unused_mut)]
let mut scope_45 = writer.prefix("PhoneNumber");
if let Some(var_46) = &input.phone_number {
scope_45.string(var_46);
}
#[allow(unused_mut)]
let mut scope_47 = writer.prefix("LanguageCode");
if let Some(var_48) = &input.language_code {
scope_47.string(var_48.as_str());
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_create_topic(
input: &crate::input::CreateTopicInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "CreateTopic", "2010-03-31");
#[allow(unused_mut)]
let mut scope_49 = writer.prefix("Name");
if let Some(var_50) = &input.name {
scope_49.string(var_50);
}
#[allow(unused_mut)]
let mut scope_51 = writer.prefix("Attributes");
if let Some(var_52) = &input.attributes {
let mut map_53 = scope_51.start_map(false, "key", "value");
for (key_54, value_55) in var_52 {
#[allow(unused_mut)]
let mut entry_56 = map_53.entry(key_54);
{
entry_56.string(value_55);
}
}
map_53.finish();
}
#[allow(unused_mut)]
let mut scope_57 = writer.prefix("Tags");
if let Some(var_58) = &input.tags {
let mut list_60 = scope_57.start_list(false, None);
for item_59 in var_58 {
#[allow(unused_mut)]
let mut entry_61 = list_60.entry();
crate::query_ser::serialize_structure_tag(entry_61, item_59);
}
list_60.finish();
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_delete_endpoint(
input: &crate::input::DeleteEndpointInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "DeleteEndpoint", "2010-03-31");
#[allow(unused_mut)]
let mut scope_62 = writer.prefix("EndpointArn");
if let Some(var_63) = &input.endpoint_arn {
scope_62.string(var_63);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_delete_platform_application(
input: &crate::input::DeletePlatformApplicationInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "DeletePlatformApplication", "2010-03-31");
#[allow(unused_mut)]
let mut scope_64 = writer.prefix("PlatformApplicationArn");
if let Some(var_65) = &input.platform_application_arn {
scope_64.string(var_65);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_delete_sms_sandbox_phone_number(
input: &crate::input::DeleteSmsSandboxPhoneNumberInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "DeleteSMSSandboxPhoneNumber", "2010-03-31");
#[allow(unused_mut)]
let mut scope_66 = writer.prefix("PhoneNumber");
if let Some(var_67) = &input.phone_number {
scope_66.string(var_67);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_delete_topic(
input: &crate::input::DeleteTopicInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "DeleteTopic", "2010-03-31");
#[allow(unused_mut)]
let mut scope_68 = writer.prefix("TopicArn");
if let Some(var_69) = &input.topic_arn {
scope_68.string(var_69);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_get_endpoint_attributes(
input: &crate::input::GetEndpointAttributesInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "GetEndpointAttributes", "2010-03-31");
#[allow(unused_mut)]
let mut scope_70 = writer.prefix("EndpointArn");
if let Some(var_71) = &input.endpoint_arn {
scope_70.string(var_71);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_get_platform_application_attributes(
input: &crate::input::GetPlatformApplicationAttributesInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "GetPlatformApplicationAttributes", "2010-03-31");
#[allow(unused_mut)]
let mut scope_72 = writer.prefix("PlatformApplicationArn");
if let Some(var_73) = &input.platform_application_arn {
scope_72.string(var_73);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_get_sms_attributes(
input: &crate::input::GetSmsAttributesInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "GetSMSAttributes", "2010-03-31");
#[allow(unused_mut)]
let mut scope_74 = writer.prefix("attributes");
if let Some(var_75) = &input.attributes {
let mut list_77 = scope_74.start_list(false, None);
for item_76 in var_75 {
#[allow(unused_mut)]
let mut entry_78 = list_77.entry();
entry_78.string(item_76);
}
list_77.finish();
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_get_sms_sandbox_account_status(
input: &crate::input::GetSmsSandboxAccountStatusInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let _ = input;
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "GetSMSSandboxAccountStatus", "2010-03-31");
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_get_subscription_attributes(
input: &crate::input::GetSubscriptionAttributesInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "GetSubscriptionAttributes", "2010-03-31");
#[allow(unused_mut)]
let mut scope_79 = writer.prefix("SubscriptionArn");
if let Some(var_80) = &input.subscription_arn {
scope_79.string(var_80);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_get_topic_attributes(
input: &crate::input::GetTopicAttributesInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "GetTopicAttributes", "2010-03-31");
#[allow(unused_mut)]
let mut scope_81 = writer.prefix("TopicArn");
if let Some(var_82) = &input.topic_arn {
scope_81.string(var_82);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_list_endpoints_by_platform_application(
input: &crate::input::ListEndpointsByPlatformApplicationInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(
&mut out,
"ListEndpointsByPlatformApplication",
"2010-03-31",
);
#[allow(unused_mut)]
let mut scope_83 = writer.prefix("PlatformApplicationArn");
if let Some(var_84) = &input.platform_application_arn {
scope_83.string(var_84);
}
#[allow(unused_mut)]
let mut scope_85 = writer.prefix("NextToken");
if let Some(var_86) = &input.next_token {
scope_85.string(var_86);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_list_origination_numbers(
input: &crate::input::ListOriginationNumbersInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "ListOriginationNumbers", "2010-03-31");
#[allow(unused_mut)]
let mut scope_87 = writer.prefix("NextToken");
if let Some(var_88) = &input.next_token {
scope_87.string(var_88);
}
#[allow(unused_mut)]
let mut scope_89 = writer.prefix("MaxResults");
if let Some(var_90) = &input.max_results {
scope_89.number(
#[allow(clippy::useless_conversion)]
smithy_types::Number::NegInt((*var_90).into()),
);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_list_phone_numbers_opted_out(
input: &crate::input::ListPhoneNumbersOptedOutInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "ListPhoneNumbersOptedOut", "2010-03-31");
#[allow(unused_mut)]
let mut scope_91 = writer.prefix("nextToken");
if let Some(var_92) = &input.next_token {
scope_91.string(var_92);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_list_platform_applications(
input: &crate::input::ListPlatformApplicationsInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "ListPlatformApplications", "2010-03-31");
#[allow(unused_mut)]
let mut scope_93 = writer.prefix("NextToken");
if let Some(var_94) = &input.next_token {
scope_93.string(var_94);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_list_sms_sandbox_phone_numbers(
input: &crate::input::ListSmsSandboxPhoneNumbersInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "ListSMSSandboxPhoneNumbers", "2010-03-31");
#[allow(unused_mut)]
let mut scope_95 = writer.prefix("NextToken");
if let Some(var_96) = &input.next_token {
scope_95.string(var_96);
}
#[allow(unused_mut)]
let mut scope_97 = writer.prefix("MaxResults");
if let Some(var_98) = &input.max_results {
scope_97.number(
#[allow(clippy::useless_conversion)]
smithy_types::Number::NegInt((*var_98).into()),
);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_list_subscriptions(
input: &crate::input::ListSubscriptionsInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "ListSubscriptions", "2010-03-31");
#[allow(unused_mut)]
let mut scope_99 = writer.prefix("NextToken");
if let Some(var_100) = &input.next_token {
scope_99.string(var_100);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_list_subscriptions_by_topic(
input: &crate::input::ListSubscriptionsByTopicInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "ListSubscriptionsByTopic", "2010-03-31");
#[allow(unused_mut)]
let mut scope_101 = writer.prefix("TopicArn");
if let Some(var_102) = &input.topic_arn {
scope_101.string(var_102);
}
#[allow(unused_mut)]
let mut scope_103 = writer.prefix("NextToken");
if let Some(var_104) = &input.next_token {
scope_103.string(var_104);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_list_tags_for_resource(
input: &crate::input::ListTagsForResourceInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "ListTagsForResource", "2010-03-31");
#[allow(unused_mut)]
let mut scope_105 = writer.prefix("ResourceArn");
if let Some(var_106) = &input.resource_arn {
scope_105.string(var_106);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_list_topics(
input: &crate::input::ListTopicsInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "ListTopics", "2010-03-31");
#[allow(unused_mut)]
let mut scope_107 = writer.prefix("NextToken");
if let Some(var_108) = &input.next_token {
scope_107.string(var_108);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_opt_in_phone_number(
input: &crate::input::OptInPhoneNumberInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "OptInPhoneNumber", "2010-03-31");
#[allow(unused_mut)]
let mut scope_109 = writer.prefix("phoneNumber");
if let Some(var_110) = &input.phone_number {
scope_109.string(var_110);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_publish(
input: &crate::input::PublishInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "Publish", "2010-03-31");
#[allow(unused_mut)]
let mut scope_111 = writer.prefix("TopicArn");
if let Some(var_112) = &input.topic_arn {
scope_111.string(var_112);
}
#[allow(unused_mut)]
let mut scope_113 = writer.prefix("TargetArn");
if let Some(var_114) = &input.target_arn {
scope_113.string(var_114);
}
#[allow(unused_mut)]
let mut scope_115 = writer.prefix("PhoneNumber");
if let Some(var_116) = &input.phone_number {
scope_115.string(var_116);
}
#[allow(unused_mut)]
let mut scope_117 = writer.prefix("Message");
if let Some(var_118) = &input.message {
scope_117.string(var_118);
}
#[allow(unused_mut)]
let mut scope_119 = writer.prefix("Subject");
if let Some(var_120) = &input.subject {
scope_119.string(var_120);
}
#[allow(unused_mut)]
let mut scope_121 = writer.prefix("MessageStructure");
if let Some(var_122) = &input.message_structure {
scope_121.string(var_122);
}
#[allow(unused_mut)]
let mut scope_123 = writer.prefix("MessageAttributes");
if let Some(var_124) = &input.message_attributes {
let mut map_125 = scope_123.start_map(false, "Name", "Value");
for (key_126, value_127) in var_124 {
#[allow(unused_mut)]
let mut entry_128 = map_125.entry(key_126);
{
crate::query_ser::serialize_structure_message_attribute_value(entry_128, value_127);
}
}
map_125.finish();
}
#[allow(unused_mut)]
let mut scope_129 = writer.prefix("MessageDeduplicationId");
if let Some(var_130) = &input.message_deduplication_id {
scope_129.string(var_130);
}
#[allow(unused_mut)]
let mut scope_131 = writer.prefix("MessageGroupId");
if let Some(var_132) = &input.message_group_id {
scope_131.string(var_132);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_remove_permission(
input: &crate::input::RemovePermissionInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "RemovePermission", "2010-03-31");
#[allow(unused_mut)]
let mut scope_133 = writer.prefix("TopicArn");
if let Some(var_134) = &input.topic_arn {
scope_133.string(var_134);
}
#[allow(unused_mut)]
let mut scope_135 = writer.prefix("Label");
if let Some(var_136) = &input.label {
scope_135.string(var_136);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_set_endpoint_attributes(
input: &crate::input::SetEndpointAttributesInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "SetEndpointAttributes", "2010-03-31");
#[allow(unused_mut)]
let mut scope_137 = writer.prefix("EndpointArn");
if let Some(var_138) = &input.endpoint_arn {
scope_137.string(var_138);
}
#[allow(unused_mut)]
let mut scope_139 = writer.prefix("Attributes");
if let Some(var_140) = &input.attributes {
let mut map_141 = scope_139.start_map(false, "key", "value");
for (key_142, value_143) in var_140 {
#[allow(unused_mut)]
let mut entry_144 = map_141.entry(key_142);
{
entry_144.string(value_143);
}
}
map_141.finish();
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_set_platform_application_attributes(
input: &crate::input::SetPlatformApplicationAttributesInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "SetPlatformApplicationAttributes", "2010-03-31");
#[allow(unused_mut)]
let mut scope_145 = writer.prefix("PlatformApplicationArn");
if let Some(var_146) = &input.platform_application_arn {
scope_145.string(var_146);
}
#[allow(unused_mut)]
let mut scope_147 = writer.prefix("Attributes");
if let Some(var_148) = &input.attributes {
let mut map_149 = scope_147.start_map(false, "key", "value");
for (key_150, value_151) in var_148 {
#[allow(unused_mut)]
let mut entry_152 = map_149.entry(key_150);
{
entry_152.string(value_151);
}
}
map_149.finish();
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_set_sms_attributes(
input: &crate::input::SetSmsAttributesInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "SetSMSAttributes", "2010-03-31");
#[allow(unused_mut)]
let mut scope_153 = writer.prefix("attributes");
if let Some(var_154) = &input.attributes {
let mut map_155 = scope_153.start_map(false, "key", "value");
for (key_156, value_157) in var_154 {
#[allow(unused_mut)]
let mut entry_158 = map_155.entry(key_156);
{
entry_158.string(value_157);
}
}
map_155.finish();
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_set_subscription_attributes(
input: &crate::input::SetSubscriptionAttributesInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "SetSubscriptionAttributes", "2010-03-31");
#[allow(unused_mut)]
let mut scope_159 = writer.prefix("SubscriptionArn");
if let Some(var_160) = &input.subscription_arn {
scope_159.string(var_160);
}
#[allow(unused_mut)]
let mut scope_161 = writer.prefix("AttributeName");
if let Some(var_162) = &input.attribute_name {
scope_161.string(var_162);
}
#[allow(unused_mut)]
let mut scope_163 = writer.prefix("AttributeValue");
if let Some(var_164) = &input.attribute_value {
scope_163.string(var_164);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_set_topic_attributes(
input: &crate::input::SetTopicAttributesInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "SetTopicAttributes", "2010-03-31");
#[allow(unused_mut)]
let mut scope_165 = writer.prefix("TopicArn");
if let Some(var_166) = &input.topic_arn {
scope_165.string(var_166);
}
#[allow(unused_mut)]
let mut scope_167 = writer.prefix("AttributeName");
if let Some(var_168) = &input.attribute_name {
scope_167.string(var_168);
}
#[allow(unused_mut)]
let mut scope_169 = writer.prefix("AttributeValue");
if let Some(var_170) = &input.attribute_value {
scope_169.string(var_170);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_subscribe(
input: &crate::input::SubscribeInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "Subscribe", "2010-03-31");
#[allow(unused_mut)]
let mut scope_171 = writer.prefix("TopicArn");
if let Some(var_172) = &input.topic_arn {
scope_171.string(var_172);
}
#[allow(unused_mut)]
let mut scope_173 = writer.prefix("Protocol");
if let Some(var_174) = &input.protocol {
scope_173.string(var_174);
}
#[allow(unused_mut)]
let mut scope_175 = writer.prefix("Endpoint");
if let Some(var_176) = &input.endpoint {
scope_175.string(var_176);
}
#[allow(unused_mut)]
let mut scope_177 = writer.prefix("Attributes");
if let Some(var_178) = &input.attributes {
let mut map_179 = scope_177.start_map(false, "key", "value");
for (key_180, value_181) in var_178 {
#[allow(unused_mut)]
let mut entry_182 = map_179.entry(key_180);
{
entry_182.string(value_181);
}
}
map_179.finish();
}
#[allow(unused_mut)]
let mut scope_183 = writer.prefix("ReturnSubscriptionArn");
if input.return_subscription_arn {
scope_183.boolean(input.return_subscription_arn);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_tag_resource(
input: &crate::input::TagResourceInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "TagResource", "2010-03-31");
#[allow(unused_mut)]
let mut scope_184 = writer.prefix("ResourceArn");
if let Some(var_185) = &input.resource_arn {
scope_184.string(var_185);
}
#[allow(unused_mut)]
let mut scope_186 = writer.prefix("Tags");
if let Some(var_187) = &input.tags {
let mut list_189 = scope_186.start_list(false, None);
for item_188 in var_187 {
#[allow(unused_mut)]
let mut entry_190 = list_189.entry();
crate::query_ser::serialize_structure_tag(entry_190, item_188);
}
list_189.finish();
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_unsubscribe(
input: &crate::input::UnsubscribeInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "Unsubscribe", "2010-03-31");
#[allow(unused_mut)]
let mut scope_191 = writer.prefix("SubscriptionArn");
if let Some(var_192) = &input.subscription_arn {
scope_191.string(var_192);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_untag_resource(
input: &crate::input::UntagResourceInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = smithy_query::QueryWriter::new(&mut out, "UntagResource", "2010-03-31");
#[allow(unused_mut)]
let mut scope_193 = writer.prefix("ResourceArn");
if let Some(var_194) = &input.resource_arn {
scope_193.string(var_194);
}
#[allow(unused_mut)]
let mut scope_195 = writer.prefix("TagKeys");
if let Some(var_196) = &input.tag_keys {
let mut list_198 = scope_195.start_list(false, None);
for item_197 in var_196 {
#[allow(unused_mut)]
let mut entry_199 = list_198.entry();
entry_199.string(item_197);
}
list_198.finish();
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
pub fn serialize_operation_verify_sms_sandbox_phone_number(
input: &crate::input::VerifySmsSandboxPhoneNumberInput,
) -> Result<smithy_http::body::SdkBody, std::convert::Infallible> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
smithy_query::QueryWriter::new(&mut out, "VerifySMSSandboxPhoneNumber", "2010-03-31");
#[allow(unused_mut)]
let mut scope_200 = writer.prefix("PhoneNumber");
if let Some(var_201) = &input.phone_number {
scope_200.string(var_201);
}
#[allow(unused_mut)]
let mut scope_202 = writer.prefix("OneTimePassword");
if let Some(var_203) = &input.one_time_password {
scope_202.string(var_203);
}
writer.finish();
Ok(smithy_http::body::SdkBody::from(out))
}
| 36.03532 | 100 | 0.651403 |
8e25fa6ffe399c358ea70cff10af774e79e062af | 349 | asm | Assembly | programs/oeis/106/A106250.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/106/A106250.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/106/A106250.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A106250: Expansion of (1-x+x^2+x^3)/(1-x-x^5+x^6).
; 1,0,1,2,2,3,2,3,4,4,5,4,5,6,6,7,6,7,8,8,9,8,9,10,10,11,10,11,12,12,13,12,13,14,14,15,14,15,16,16,17,16,17,18,18,19,18,19,20,20,21,20,21,22,22,23,22,23,24,24,25,24,25,26,26,27,26,27,28,28,29,28,29,30,30,31,30
add $0,2
mov $1,$0
mov $2,1
lpb $1
sub $1,$2
dif $2,3
sub $0,$2
add $2,1
lpe
| 26.846154 | 209 | 0.581662 |
69957cb49629dd67245e5244e54315914c4dd584 | 1,447 | ps1 | PowerShell | functions/fn_Settings.ps1 | Robomikel/steamer | 826be6edf8d7c01a3139ce98bfb67245626dd3ca | [
"MIT"
] | 4 | 2019-12-29T00:48:59.000Z | 2021-07-17T13:03:52.000Z | functions/fn_Settings.ps1 | Robomikel/steamer | 826be6edf8d7c01a3139ce98bfb67245626dd3ca | [
"MIT"
] | 1 | 2020-01-20T00:33:19.000Z | 2020-01-20T02:58:57.000Z | functions/fn_Settings.ps1 | Robomikel/steamer | 826be6edf8d7c01a3139ce98bfb67245626dd3ca | [
"MIT"
] | null | null | null | # Final
# .::::::.::::::::::::.,:::::: :::. . : .,:::::: :::::::..
# ;;;` `;;;;;;;;'''';;;;'''' ;;`;; ;;,. ;;; ;;;;'''' ;;;;``;;;;
# '[==/[[[[, [[ [[cccc ,[[ '[[, [[[[, ,[[[[, [[cccc [[[,/[[['
# ''' $ $$ $$"""" c$$$cc$$$c $$$$$$$$"$$$ $$"""" $$$$$$c
# 88b dP 88, 888oo,__ 888 888,888 Y88" 888o888oo,__ 888b "88bo,
# "YMmMY" MMM """"YUMMMYMM ""` MMM M' "MMM""""YUMMMMMMM "W"
#---------- Core Settings ----------------------
Function Set-SteamerSetting {
##### Steamer Settings #######
# disable backup log open 0
$global:backuplog = "1"
# disable app data backup log open 0
$global:appdatabackuplog = "1"
# disable app data backup 0
$global:appdatabackup = "1"
# disable Admin message 0
$global:admincheckmessage = "1"
# disable Auto update in check 1
$global:AutoUpdate = "0"
# disable check Task 0
$global:DisableChecktask = "1"
# max backups x
$global:backupcount = "2"
# Version 0 prompt min, 1 prompt max, 2 no prompt
$global:Version = "1"
# Disable Discord backup 0
$global:DisableDiscordBackup = "1"
# Disable Discord backup 0
$global:DisableDiscordUpdate = "1"
# Use private Ip for Gamedig, mcrcon 1
$global:Useprivate = "0"
# Disable Logging 0
$global:log = "1"
# Log count
$global:logcount = "10"
}
| 33.651163 | 76 | 0.4651 |
9c996088ad2c50286db752105f793520a58f2095 | 1,989 | cc | C++ | base/files/file_tracing.cc | blockspacer/chromium_base_conan | b4749433cf34f54d2edff52e2f0465fec8cb9bad | [
"Apache-2.0",
"BSD-3-Clause"
] | 6 | 2020-12-22T05:48:31.000Z | 2022-02-08T19:49:49.000Z | base/files/file_tracing.cc | blockspacer/chromium_base_conan | b4749433cf34f54d2edff52e2f0465fec8cb9bad | [
"Apache-2.0",
"BSD-3-Clause"
] | 4 | 2020-05-22T18:36:43.000Z | 2021-05-19T10:20:23.000Z | base/files/file_tracing.cc | blockspacer/chromium_base_conan | b4749433cf34f54d2edff52e2f0465fec8cb9bad | [
"Apache-2.0",
"BSD-3-Clause"
] | 2 | 2019-12-06T11:48:16.000Z | 2021-09-16T04:44:47.000Z | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/files/file_tracing.h"
#include "base/atomicops.h"
#include "base/files/file.h"
#include "basic/wasm_util.h"
using base::subtle::AtomicWord;
namespace base {
namespace {
AtomicWord g_provider;
}
FileTracing::Provider* GetProvider() {
AtomicWord provider = base::subtle::Acquire_Load(&g_provider);
return reinterpret_cast<FileTracing::Provider*>(provider);
}
// static
bool FileTracing::IsCategoryEnabled() {
/// \todo tracing disabled on WASM platform
#if defined(OS_EMSCRIPTEN)
return false;
#endif
FileTracing::Provider* provider = GetProvider();
return provider && provider->FileTracingCategoryIsEnabled();
}
// static
void FileTracing::SetProvider(FileTracing::Provider* provider) {
base::subtle::Release_Store(&g_provider,
reinterpret_cast<AtomicWord>(provider));
}
FileTracing::ScopedEnabler::ScopedEnabler() {
FileTracing::Provider* provider = GetProvider();
if (provider)
provider->FileTracingEnable(this);
}
FileTracing::ScopedEnabler::~ScopedEnabler() {
FileTracing::Provider* provider = GetProvider();
if (provider)
provider->FileTracingDisable(this);
}
FileTracing::ScopedTrace::~ScopedTrace() {
/// \todo tracing disabled on WASM platform
#if !defined(OS_EMSCRIPTEN)
if (id_) {
FileTracing::Provider* provider = GetProvider();
if (provider)
provider->FileTracingEventEnd(name_, id_);
}
#endif
}
void FileTracing::ScopedTrace::Initialize(const char* name,
const File* file,
int64_t size) {
/// \todo tracing disabled on WASM platform
#if !defined(OS_EMSCRIPTEN)
id_ = &file->trace_enabler_;
name_ = name;
GetProvider()->FileTracingEventBegin(name_, id_, file->tracing_path_, size);
#endif
}
} // namespace base
| 26.171053 | 78 | 0.695827 |
c21a28935c4f12d352427884f9a564e7a2f3669b | 237 | go | Go | 14_http_server/player/league.go | nikhil-thomas/go-practice_learn-go-with-tests | 47dd5275d1d779b4394c5af3119072aa7afa6510 | [
"MIT"
] | null | null | null | 14_http_server/player/league.go | nikhil-thomas/go-practice_learn-go-with-tests | 47dd5275d1d779b4394c5af3119072aa7afa6510 | [
"MIT"
] | null | null | null | 14_http_server/player/league.go | nikhil-thomas/go-practice_learn-go-with-tests | 47dd5275d1d779b4394c5af3119072aa7afa6510 | [
"MIT"
] | null | null | null | package main
import (
"encoding/json"
"io"
)
// NewLeague creates a new league
func NewLeague(rdr io.ReadSeeker) (League, error) {
rdr.Seek(0, 0)
var league League
err := json.NewDecoder(rdr).Decode(&league)
return league, err
}
| 15.8 | 51 | 0.704641 |
061adc10db53226184855b5e4c7b433a619b3849 | 17,482 | rs | Rust | src/scheduler/plugins/google_calendar.rs | cdepillabout/break-time | 6c5e7d9a9d8b2213fbdde35edd9b65423e19470c | [
"MIT"
] | 13 | 2020-07-21T10:32:27.000Z | 2021-12-12T08:43:00.000Z | src/scheduler/plugins/google_calendar.rs | cdepillabout/break-time | 6c5e7d9a9d8b2213fbdde35edd9b65423e19470c | [
"MIT"
] | 20 | 2020-07-17T01:51:55.000Z | 2022-02-07T02:28:05.000Z | src/scheduler/plugins/google_calendar.rs | cdepillabout/break-time | 6c5e7d9a9d8b2213fbdde35edd9b65423e19470c | [
"MIT"
] | 1 | 2020-10-25T04:46:34.000Z | 2020-10-25T04:46:34.000Z | use super::{CanBreak, Plugin};
use crate::config::{Config, PluginSettings};
use std::collections::HashMap;
use std::net::TcpListener;
use std::path::Path;
use google_calendar3::{CalendarHub, CalendarListEntry, Events, Scope};
use yup_oauth2::{
ApplicationSecret, Authenticator, DefaultAuthenticatorDelegate,
DiskTokenStorage,
};
fn get_available_port() -> Option<u16> {
(8080..65535).find(|port| TcpListener::bind(("127.0.0.1", *port)).is_ok())
}
type CalHub = CalendarHub<
hyper::Client,
Authenticator<
DefaultAuthenticatorDelegate,
DiskTokenStorage,
hyper::Client,
>,
>;
type Auth = Authenticator<
DefaultAuthenticatorDelegate,
DiskTokenStorage,
hyper::Client,
>;
pub struct CalFetcher {
email: String,
hub: CalHub,
calendar_ids: Vec<String>,
}
impl CalFetcher {
pub fn new(break_time_cache_dir: &Path, email: String) -> Result<Self, ()> {
let google_cal_dir_name = Path::new("google-calendar");
let google_cal_dir_path =
break_time_cache_dir.join(google_cal_dir_name);
std::fs::create_dir_all(&google_cal_dir_path).map_err(|_io_err| ())?;
let token_path = google_cal_dir_path.join(&email);
let token_path_string = token_path.to_string_lossy().into_owned();
let disk_token_storage: DiskTokenStorage = DiskTokenStorage::new(
&token_path_string,
)
.expect("Couldn't create a file to hold the google oauth token");
let hub: CalHub = create_hub(disk_token_storage)?;
let calendar_ids = get_all_calendar_ids(&hub);
Ok(Self {
email,
hub,
calendar_ids,
})
}
pub fn can_break(&self) -> Result<CanBreak, GoogleCalErr> {
let now: chrono::DateTime<chrono::Utc> = chrono::Utc::now();
let ten_minutes_ago: chrono::DateTime<chrono::Utc> =
now - chrono::Duration::minutes(10);
let in_twenty_mins: chrono::DateTime<chrono::Utc> =
now + chrono::Duration::minutes(20);
let res = has_events(
&self.email,
&self.hub,
&self.calendar_ids,
ten_minutes_ago,
in_twenty_mins,
);
match res {
Err(err) => Err(err),
Ok(HasEvent::Yes) => Ok(CanBreak::No),
Ok(HasEvent::No) => Ok(CanBreak::Yes),
}
}
}
const GOOGLE_CLIENT_ID: &str =
"728095687622-mpib9rmdtck7e8ln9egelnns6na0me08.apps.googleusercontent.com";
// It is weird embedding something called a "client_secret" directly in the source
// code, but it doesn't seem like this needs to be something that is actually kept
// secret:
// https://stackoverflow.com/questions/59416326/safely-distribute-oauth-2-0-client-secret-in-desktop-applications-in-python
const GOOGLE_CLIENT_SECRET: &str = "mI7MmEnboy8jdYEBjK9rZ2M2";
// TODO: Create a datatype to hold all the settings for the GoogleCalendar plugin.
// Don't try parsing it out manually here.
#[allow(clippy::let_and_return)]
fn get_emails(plugin_settings: &PluginSettings) -> Result<Vec<String>, ()> {
let google_cal_settings: &toml::Value =
match plugin_settings.0.get("google_calendar") {
// If the "google_calendar" key doesn't exist, then just skip.
None => return Ok(vec![]),
Some(val) => val,
};
let google_cal_settings_table: &toml::value::Table =
google_cal_settings.as_table().ok_or(
// If the "google_calendar" key exists, but it doesn't contain a table, then throw an
// error.
(),
)?;
let all_accounts: &toml::Value =
match google_cal_settings_table.get("accounts") {
// If the "google_calendar" key exists, but it doesn't have an accounts field, then
// just skip.
None => return Ok(vec![]),
Some(all_accounts) => all_accounts,
};
let all_emails = all_accounts.clone().try_into().map_err(|_err| ());
// println!("All emails: {:?}", all_emails);
all_emails
}
fn collect_first_err<T, E>(v: Vec<Result<T, E>>) -> Result<Vec<T>, E> {
let mut ok_vec = vec![];
for res in v {
match res {
Err(err) => return Err(err),
Ok(i) => ok_vec.push(i),
}
}
Ok(ok_vec)
}
pub struct GoogleCalendar {
fetchers: Vec<CalFetcher>,
}
impl GoogleCalendar {
pub fn new(config: &Config) -> Result<Self, ()> {
let break_time_cache_dir: &Path = &config.cache_dir;
let emails = get_emails(&config.settings.all_plugin_settings)?;
let fetchers_res = emails
.into_iter()
.map(|email| CalFetcher::new(break_time_cache_dir, email))
.collect();
let fetchers = collect_first_err(fetchers_res)?;
Ok(Self { fetchers })
}
fn can_break(&self) -> Result<CanBreak, GoogleCalErr> {
// println!("now: {}, after twenty: {}", now.to_rfc3339(), in_twenty_mins.to_rfc3339());
self.fetchers.iter().map(CalFetcher::can_break).fold(
Ok(CanBreak::Yes),
|accum, can_break_res| match (accum, can_break_res) {
(Err(err), _) => Err(err),
(_, Err(err)) => Err(err),
(Ok(CanBreak::No), _) => Ok(CanBreak::No),
(_, can_break) => can_break,
},
)
}
}
fn create_auth(disk_token_storage: DiskTokenStorage) -> Result<Auth, ()> {
let secret: ApplicationSecret = ApplicationSecret {
client_id: String::from(GOOGLE_CLIENT_ID),
client_secret: String::from(GOOGLE_CLIENT_SECRET),
token_uri: "https://oauth2.googleapis.com/token".to_string(),
auth_uri: "https://accounts.google.com/o/oauth2/auth".to_string(),
redirect_uris: vec![
"http://127.0.0.1".to_string(),
"urn:ietf:wg:oauth:2.0:oob".to_string(),
],
..ApplicationSecret::default()
};
let http_client_for_auth: hyper::Client = hyper::Client::with_connector(
hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()),
);
let first_available_port = get_available_port().ok_or(())?;
let auth: Auth = Authenticator::new(
&secret,
DefaultAuthenticatorDelegate,
http_client_for_auth,
disk_token_storage,
Some(yup_oauth2::FlowType::InstalledRedirect(
first_available_port.into(),
)),
);
Ok(auth)
}
fn create_hub_from_auth(auth: Auth) -> CalHub {
let http_client_for_cal: hyper::Client = hyper::Client::with_connector(
hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()),
);
CalendarHub::new(http_client_for_cal, auth)
}
fn create_hub(disk_token_storage: DiskTokenStorage) -> Result<CalHub, ()> {
let auth: Auth = create_auth(disk_token_storage)?;
let hub: CalHub = create_hub_from_auth(auth);
Ok(hub)
}
fn get_all_calendar_ids(hub: &CalHub) -> Vec<String> {
let (_, calendar_list_res) = hub
.calendar_list()
.list()
.add_scope(Scope::Readonly)
.add_scope(Scope::Event)
.doit()
.expect("couldn't get a response from calendar_list");
let calendars = calendar_list_res
.items
.expect("There should be some calendars available");
let calendar_ids: Vec<String> = calendars
.into_iter()
.map(|calendar: CalendarListEntry| {
calendar.id.expect("Calendars should always have ids")
})
.collect();
calendar_ids
}
/// Check whether or not any events occur during the `start_time` to `end_time`.
fn has_events(
email: &str,
hub: &CalHub,
calendar_ids: &[String],
start_time: chrono::DateTime<chrono::Utc>,
end_time: chrono::DateTime<chrono::Utc>,
) -> Result<HasEvent, GoogleCalErr> {
calendar_ids
.iter()
.map(|calendar_id| {
// We only check calendar_ids that are equal to the email address we are looking for.
//
// TODO: Eventually, we probably want to let the user configure what email addresses
// they want to look for events on.
if email == calendar_id {
has_event(hub, calendar_id, start_time, end_time)
} else {
Ok(HasEvent::No)
}
})
.fold(Ok(HasEvent::No), |accum, res| match (accum, res) {
(Err(err), _) => Err(err),
(_, Err(err)) => Err(err),
(Ok(HasEvent::No), new) => new,
(Ok(HasEvent::Yes), _) => Ok(HasEvent::Yes),
})
}
enum HasEvent {
No,
Yes,
}
#[derive(Debug)]
pub enum GoogleCalErr {
FetchingEvents {
calendar_id: String,
google_cal_err: google_calendar3::Error,
},
}
impl std::error::Error for GoogleCalErr {}
impl std::fmt::Display for GoogleCalErr {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::FetchingEvents {
calendar_id,
google_cal_err,
} => write!(
f,
"Google Calendard Plugin: Error fetching calendar_id {}: {}",
calendar_id, google_cal_err
),
}
}
}
fn get_event(
hub: &CalHub,
calendar_id: &str,
start_time: chrono::DateTime<chrono::Utc>,
end_time: chrono::DateTime<chrono::Utc>,
// This is super hacky...
log: bool,
) -> Result<Vec<google_calendar3::Event>, GoogleCalErr> {
let result: google_calendar3::Result<(_, Events)> = hub
.events()
.list(calendar_id)
.add_scope(Scope::Readonly)
.add_scope(Scope::Event)
// all events that occur over the next 20 minutes
.time_min(&start_time.to_rfc3339())
.time_max(&end_time.to_rfc3339())
// Expand recurring events into single events.
.single_events(true)
.doit();
// println!("\n\nevents for {}: {:?}", calendar_id, result);
match result {
Err(err) => Err(GoogleCalErr::FetchingEvents {
calendar_id: String::from(calendar_id),
google_cal_err: err,
}),
Ok((_, events)) => {
match events.items {
None => Ok(vec![]),
Some(event_items) => {
let filtered_events: Vec<google_calendar3::Event> =
filter_cal_events(event_items);
if !filtered_events.is_empty() && log {
println!("There were some event items from calendar id {}: {:?}", calendar_id, filtered_events);
}
Ok(filtered_events)
}
}
}
}
}
fn has_event(
hub: &CalHub,
calendar_id: &str,
start_time: chrono::DateTime<chrono::Utc>,
end_time: chrono::DateTime<chrono::Utc>,
) -> Result<HasEvent, GoogleCalErr> {
let event_res = get_event(hub, calendar_id, start_time, end_time, true);
event_res.map(|filtered_events| {
if filtered_events.is_empty() {
HasEvent::No
} else {
HasEvent::Yes
}
})
}
fn filter_cal_events(
events: Vec<google_calendar3::Event>,
) -> Vec<google_calendar3::Event> {
events.into_iter().filter(filter_event).collect()
}
fn filter_event(event: &google_calendar3::Event) -> bool {
if let Some(desc) = &event.description {
// Ignore events where the description contains the magic string
// "ignore break-time"
if desc.to_lowercase().contains("ignore break-time") {
return false;
}
// Ignore events where the description talks about being an out-of-office event.
// Even if we are out-of-office, we still may be on our personal computer, and
// want break-time to occassionally break.
if desc.to_lowercase().contains("out-of-office event") {
return false;
}
}
// Ignore events where the `ignore-break-time` extended property is set.
if let Some(extended_props) = &event.extended_properties {
if let Some(props) = &extended_props.private {
if let Some(ignore_break_time) = props.get("ignore-break-time") {
if ignore_break_time == "true" {
return false;
}
}
}
}
// Ignore events where the status is "cancelled".
//
// For some reason, sometimes Google Calendar will not set the event status as "cancelled" even
// though you have cancelled the event. It keeps the event status as "needsAction". Check for
// "needsAction" and ignore events with this status as well.
if let Some(status) = &event.status {
if status == "cancelled" || status == "needsAction" {
return false;
}
}
// Ignore events where there are attendees, and you are marked as not attending.
if let Some(attendees) = &event.attendees {
if let Some(me) = attendees
.iter()
.find(|attendee| attendee.self_ == Some(true))
{
if me.response_status == Some(String::from("declined")) {
return false;
}
}
}
true
}
impl Plugin for GoogleCalendar {
fn can_break_now(&self) -> Result<CanBreak, Box<dyn std::error::Error>> {
self.can_break().map_err(|google_cal_err| {
Box::new(google_cal_err) as Box<dyn std::error::Error>
})
}
fn name(&self) -> String {
String::from("google_calendar")
}
}
pub fn list_events(config: &Config) {
let google_calendar = GoogleCalendar::new(config)
.expect("Could not initialize Google Calendar.");
let event_calendar_lists: Vec<_> = google_calendar
.fetchers
.iter()
.flat_map(get_events)
.collect();
for (email, res_event_list) in event_calendar_lists {
println!("{}:", email);
match res_event_list {
Err(err) => {
println!("ERROR with Google Calendar: {}", err);
}
Ok(event_list) => {
for event in event_list {
println!(
" - id: {:?}, summary: {:?}",
event.id, event.summary
);
}
}
}
}
}
fn get_events(
cal_fetcher: &CalFetcher,
) -> Vec<(String, Result<Vec<google_calendar3::Event>, GoogleCalErr>)> {
let now: chrono::DateTime<chrono::Utc> = chrono::Utc::now();
let ten_minutes_ago: chrono::DateTime<chrono::Utc> =
now - chrono::Duration::minutes(10);
let in_twenty_mins: chrono::DateTime<chrono::Utc> =
now + chrono::Duration::minutes(20);
let start_time = ten_minutes_ago;
let end_time = in_twenty_mins;
let events_list: Vec<(
String,
Result<Vec<google_calendar3::Event>, GoogleCalErr>,
)> = cal_fetcher
.calendar_ids
.iter()
.filter_map(|calendar_id| {
// We only check calendar_ids that are equal to the email address we are looking for.
//
// TODO: Eventually, we probably want to let the user configure what email addresses
// they want to look for events on.
if &cal_fetcher.email == calendar_id {
Some((
String::from(calendar_id),
get_event(
&cal_fetcher.hub,
calendar_id,
start_time,
end_time,
false,
),
))
} else {
None
}
})
.collect();
events_list
}
pub fn ignore_event(config: &Config, event_id: &str) {
let google_calendar = GoogleCalendar::new(config)
.expect("Could not initialize Google Calendar.");
// let event_calendar_lists: Vec<_> = google_calendar.fetchers.iter().flat_map(get_events).collect();
for fetcher in google_calendar.fetchers {
for calendar_id in fetcher.calendar_ids {
// We only check calendar_ids that are equal to the email address we are looking for.
//
// TODO: Eventually, we probably want to let the user configure what email addresses
// they want to look for events on.
if calendar_id == fetcher.email {
let mut props = HashMap::new();
props.insert(
"ignore-break-time".to_string(),
"true".to_string(),
);
let extended_props =
google_calendar3::EventExtendedProperties {
private: Some(props),
..google_calendar3::EventExtendedProperties::default()
};
let req = google_calendar3::Event {
extended_properties: Some(extended_props),
..google_calendar3::Event::default()
};
let _res = fetcher
.hub
.events()
.patch(req, &calendar_id, event_id)
.add_scope(Scope::Readonly)
.add_scope(Scope::Event)
.doit();
// println!("event_id: {}, calendar_id: {}, res: {:?}", event_id, calendar_id, res);
}
}
}
}
| 32.136029 | 123 | 0.573733 |
d5ae066f3598c5812b8c11dcc27b1f4910bb4209 | 1,017 | h | C | ray_marching/RawConversion.h | PetrFlajsingr/RayMarching | 42846a4e6c87284f35d3e29d49a63494be074da3 | [
"MIT"
] | 5 | 2020-05-29T13:12:47.000Z | 2021-11-25T10:19:08.000Z | ray_marching/RawConversion.h | PetrFlajsingr/RayMarching | 42846a4e6c87284f35d3e29d49a63494be074da3 | [
"MIT"
] | null | null | null | ray_marching/RawConversion.h | PetrFlajsingr/RayMarching | 42846a4e6c87284f35d3e29d49a63494be074da3 | [
"MIT"
] | 1 | 2021-11-25T10:19:12.000Z | 2021-11-25T10:19:12.000Z | //
// Created by petr on 4/11/20.
//
#ifndef RAYMARCHING_RAWCONVERSION_H
#define RAYMARCHING_RAWCONVERSION_H
#include <array>
#include <glm/glm.hpp>
#pragma clang diagnostic push
#pragma ide diagnostic ignored "cppcoreguidelines-pro-type-member-init"
template <std::size_t DataSize, typename T> inline auto memToBytes(const T &val) -> std::array<uint8_t, DataSize> {
auto raw = reinterpret_cast<uint8_t const *>(&val);
std::array<uint8_t, DataSize> result;
for (std::size_t i = 0; i < DataSize; ++i) {
result[i] = raw[i];
}
return result;
}
inline auto vec3ToBytes(const glm::vec3 &vec) -> std::array<uint8_t, 12> { return memToBytes<12>(vec); }
inline auto vec4ToBytes(const glm::vec4 &vec) -> std::array<uint8_t, 16> { return memToBytes<16>(vec); }
inline auto floatToBytes(float val) -> std::array<uint8_t, 4> { return memToBytes<4>(val); }
inline auto intToBytes(int val) -> std::array<uint8_t, 4> { return memToBytes<4>(val); }
#pragma clang diagnostic pop
#endif // RAYMARCHING_RAWCONVERSION_H
| 37.666667 | 115 | 0.718781 |
5bca30164fc2c321a53fdb6441ed4ab58b462abf | 1,475 | cs | C# | ScriptableVariableUnity/ScriptableVariableUnity/References/Vector4Reference.cs | killermode15/scriptable_object_variable_library | 73256c43068cad0a6b2150b9921da7b9ce3aafe8 | [
"MIT"
] | null | null | null | ScriptableVariableUnity/ScriptableVariableUnity/References/Vector4Reference.cs | killermode15/scriptable_object_variable_library | 73256c43068cad0a6b2150b9921da7b9ce3aafe8 | [
"MIT"
] | null | null | null | ScriptableVariableUnity/ScriptableVariableUnity/References/Vector4Reference.cs | killermode15/scriptable_object_variable_library | 73256c43068cad0a6b2150b9921da7b9ce3aafe8 | [
"MIT"
] | null | null | null | using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class Vector4Reference
{
[SerializeField] private bool useConstant;
[SerializeField] private Vector4Variable vector4Variable;
[SerializeField] private Vector4 constantValue;
public Vector4 Value
{
get
{
return useConstant ? constantValue : vector4Variable.Value;
}
set
{
if (useConstant)
{
constantValue = value;
}
else
{
if (!vector4Variable)
throw new NullReferenceException("Float variable is missing");
vector4Variable.Value = value;
}
}
}
public static Vector3 operator +(Vector4Reference a, Vector4Reference b)
{
return a.Value + b.Value;
}
public static Vector3 operator -(Vector4Reference a, Vector4Reference b)
{
return a.Value - b.Value;
}
public static Vector3 operator /(Vector4Reference a, float b)
{
return a.Value / b;
}
public static Vector3 operator *(Vector4Reference a, float b)
{
return a.Value * b;
}
public static bool operator ==(Vector4Reference a, Vector4Reference b)
{
return a == b;
}
public static bool operator !=(Vector4Reference a, Vector4Reference b)
{
return !(a==b);
}
}
| 22.348485 | 82 | 0.585763 |
04af179883ad4122c27f1548d2daa604f3409a98 | 1,974 | java | Java | aliyun-java-sdk-resourcemanager/src/main/java/com/aliyuncs/resourcemanager/model/v20200331/CreateResourceGroupRequest.java | cctvzd7/aliyun-openapi-java-sdk | b8e4dce2a61ca968615c9b910bedebaea71781ae | [
"Apache-2.0"
] | 1 | 2020-11-03T01:40:47.000Z | 2020-11-03T01:40:47.000Z | aliyun-java-sdk-resourcemanager/src/main/java/com/aliyuncs/resourcemanager/model/v20200331/CreateResourceGroupRequest.java | cctvzd7/aliyun-openapi-java-sdk | b8e4dce2a61ca968615c9b910bedebaea71781ae | [
"Apache-2.0"
] | 27 | 2021-06-11T21:08:40.000Z | 2022-03-11T21:25:09.000Z | aliyun-java-sdk-resourcemanager/src/main/java/com/aliyuncs/resourcemanager/model/v20200331/CreateResourceGroupRequest.java | cctvzd7/aliyun-openapi-java-sdk | b8e4dce2a61ca968615c9b910bedebaea71781ae | [
"Apache-2.0"
] | 1 | 2020-03-05T07:30:16.000Z | 2020-03-05T07:30:16.000Z | /*
* 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.
*/
package com.aliyuncs.resourcemanager.model.v20200331;
import com.aliyuncs.RpcAcsRequest;
import com.aliyuncs.http.ProtocolType;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.resourcemanager.Endpoint;
/**
* @author auto create
* @version
*/
public class CreateResourceGroupRequest extends RpcAcsRequest<CreateResourceGroupResponse> {
private String displayName;
private String name;
public CreateResourceGroupRequest() {
super("ResourceManager", "2020-03-31", "CreateResourceGroup", "resourcemanager");
setProtocol(ProtocolType.HTTPS);
setMethod(MethodType.POST);
try {
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap);
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType);
} catch (Exception e) {}
}
public String getDisplayName() {
return this.displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
if(displayName != null){
putQueryParameter("DisplayName", displayName);
}
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
if(name != null){
putQueryParameter("Name", name);
}
}
@Override
public Class<CreateResourceGroupResponse> getResponseClass() {
return CreateResourceGroupResponse.class;
}
}
| 28.2 | 118 | 0.745187 |
f74537a008fc2ac4acf3046ae9ba59cde041fd16 | 3,683 | dart | Dart | docs/packages/$sdk/lib/_internal/pub/asset/dart/serialize/exception.dart | ngyewch/choropleth-map-angular-dart | e2e0a99ed0eed02a33273885f89168439ee7e599 | [
"BSD-3-Clause"
] | 1 | 2020-04-10T20:09:06.000Z | 2020-04-10T20:09:06.000Z | docs/packages/$sdk/lib/_internal/pub/asset/dart/serialize/exception.dart | ngyewch/choropleth-map-angular-dart | e2e0a99ed0eed02a33273885f89168439ee7e599 | [
"BSD-3-Clause"
] | null | null | null | docs/packages/$sdk/lib/_internal/pub/asset/dart/serialize/exception.dart | ngyewch/choropleth-map-angular-dart | e2e0a99ed0eed02a33273885f89168439ee7e599 | [
"BSD-3-Clause"
] | null | null | null | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:barback/barback.dart';
import 'package:stack_trace/stack_trace.dart';
import '../utils.dart';
/// An exception that was originally raised in another isolate.
///
/// Exception objects can't cross isolate boundaries in general, so this class
/// wraps as much information as can be consistently serialized.
class CrossIsolateException implements Exception {
/// The name of the type of exception thrown.
///
/// This is the return value of [error.runtimeType.toString()]. Keep in mind
/// that objects in different libraries may have the same type name.
final String type;
/// The exception's message, or its [toString] if it didn't expose a `message`
/// property.
String get message => _message;
final String _message;
/// The exception's stack chain, or `null` if no stack chain was available.
final Chain stackTrace;
/// Loads a [CrossIsolateException] from a serialized representation.
///
/// [error] should be the result of [CrossIsolateException.serialize].
CrossIsolateException.deserialize(Map error)
: type = error['type'],
_message = error['message'],
stackTrace = error['stack'] == null ? null :
new Chain.parse(error['stack']);
/// Serializes [error] to an object that can safely be passed across isolate
/// boundaries.
static Map serialize(error, [StackTrace stack]) {
if (stack == null && error is Error) stack = error.stackTrace;
return {
'type': error.runtimeType.toString(),
'message': getErrorMessage(error),
'stack': stack == null ? null : new Chain.forTrace(stack).toString()
};
}
String toString() => "$message\n$stackTrace";
}
/// An [AssetNotFoundException] that was originally raised in another isolate.
class _CrossIsolateAssetNotFoundException extends CrossIsolateException
implements AssetNotFoundException {
final AssetId id;
String get message => "Could not find asset $id.";
/// Loads a [_CrossIsolateAssetNotFoundException] from a serialized
/// representation.
///
/// [error] should be the result of
/// [_CrossIsolateAssetNotFoundException.serialize].
_CrossIsolateAssetNotFoundException.deserialize(Map error)
: id = new AssetId(error['package'], error['path']),
super.deserialize(error);
/// Serializes [error] to an object that can safely be passed across isolate
/// boundaries.
static Map serialize(AssetNotFoundException error, [StackTrace stack]) {
var map = CrossIsolateException.serialize(error);
map['package'] = error.id.package;
map['path'] = error.id.path;
return map;
}
}
/// Serializes [error] to an object that can safely be passed across isolate
/// boundaries.
///
/// This handles [AssetNotFoundException]s specially, ensuring that their
/// metadata is preserved.
Map serializeException(error, [StackTrace stack]) {
if (error is AssetNotFoundException) {
return _CrossIsolateAssetNotFoundException.serialize(error, stack);
} else {
return CrossIsolateException.serialize(error, stack);
}
}
/// Loads an exception from a serialized representation.
///
/// This handles [AssetNotFoundException]s specially, ensuring that their
/// metadata is preserved.
CrossIsolateException deserializeException(Map error) {
if (error['type'] == 'AssetNotFoundException') {
return new _CrossIsolateAssetNotFoundException.deserialize(error);
} else {
return new CrossIsolateException.deserialize(error);
}
}
| 36.107843 | 80 | 0.717622 |
808d31f16439f8d9bab582e52455850834a74616 | 16,823 | java | Java | client/src/generated/java/com/influxdb/client/domain/ScatterViewProperties.java | bednar/influxdb-client-java | 032293d13b69febc24b095b61c00554f261a385f | [
"MIT"
] | 1 | 2019-11-12T16:39:56.000Z | 2019-11-12T16:39:56.000Z | client/src/generated/java/com/influxdb/client/domain/ScatterViewProperties.java | bednar/influxdb-client-java | 032293d13b69febc24b095b61c00554f261a385f | [
"MIT"
] | null | null | null | client/src/generated/java/com/influxdb/client/domain/ScatterViewProperties.java | bednar/influxdb-client-java | 032293d13b69febc24b095b61c00554f261a385f | [
"MIT"
] | null | null | null | /*
* Influx API Service
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* OpenAPI spec version: 0.1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.influxdb.client.domain;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.influxdb.client.domain.DashboardQuery;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* ScatterViewProperties
*/
public class ScatterViewProperties extends ViewProperties {
/**
* Gets or Sets type
*/
@JsonAdapter(TypeEnum.Adapter.class)
public enum TypeEnum {
SCATTER("scatter");
private String value;
TypeEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static TypeEnum fromValue(String text) {
for (TypeEnum b : TypeEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<TypeEnum> {
@Override
public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public TypeEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return TypeEnum.fromValue(String.valueOf(value));
}
}
}
public static final String SERIALIZED_NAME_TYPE = "type";
@SerializedName(SERIALIZED_NAME_TYPE)
private TypeEnum type = TypeEnum.SCATTER;
public static final String SERIALIZED_NAME_QUERIES = "queries";
@SerializedName(SERIALIZED_NAME_QUERIES)
private List<DashboardQuery> queries = new ArrayList<>();
public static final String SERIALIZED_NAME_COLORS = "colors";
@SerializedName(SERIALIZED_NAME_COLORS)
private List<String> colors = new ArrayList<>();
/**
* Gets or Sets shape
*/
@JsonAdapter(ShapeEnum.Adapter.class)
public enum ShapeEnum {
CHRONOGRAF_V2("chronograf-v2");
private String value;
ShapeEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static ShapeEnum fromValue(String text) {
for (ShapeEnum b : ShapeEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<ShapeEnum> {
@Override
public void write(final JsonWriter jsonWriter, final ShapeEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public ShapeEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return ShapeEnum.fromValue(String.valueOf(value));
}
}
}
public static final String SERIALIZED_NAME_SHAPE = "shape";
@SerializedName(SERIALIZED_NAME_SHAPE)
private ShapeEnum shape = ShapeEnum.CHRONOGRAF_V2;
public static final String SERIALIZED_NAME_NOTE = "note";
@SerializedName(SERIALIZED_NAME_NOTE)
private String note;
public static final String SERIALIZED_NAME_SHOW_NOTE_WHEN_EMPTY = "showNoteWhenEmpty";
@SerializedName(SERIALIZED_NAME_SHOW_NOTE_WHEN_EMPTY)
private Boolean showNoteWhenEmpty;
public static final String SERIALIZED_NAME_X_COLUMN = "xColumn";
@SerializedName(SERIALIZED_NAME_X_COLUMN)
private String xColumn;
public static final String SERIALIZED_NAME_Y_COLUMN = "yColumn";
@SerializedName(SERIALIZED_NAME_Y_COLUMN)
private String yColumn;
public static final String SERIALIZED_NAME_FILL_COLUMNS = "fillColumns";
@SerializedName(SERIALIZED_NAME_FILL_COLUMNS)
private List<String> fillColumns = new ArrayList<>();
public static final String SERIALIZED_NAME_SYMBOL_COLUMNS = "symbolColumns";
@SerializedName(SERIALIZED_NAME_SYMBOL_COLUMNS)
private List<String> symbolColumns = new ArrayList<>();
public static final String SERIALIZED_NAME_X_DOMAIN = "xDomain";
@SerializedName(SERIALIZED_NAME_X_DOMAIN)
private List<BigDecimal> xDomain = new ArrayList<>();
public static final String SERIALIZED_NAME_Y_DOMAIN = "yDomain";
@SerializedName(SERIALIZED_NAME_Y_DOMAIN)
private List<BigDecimal> yDomain = new ArrayList<>();
public static final String SERIALIZED_NAME_X_AXIS_LABEL = "xAxisLabel";
@SerializedName(SERIALIZED_NAME_X_AXIS_LABEL)
private String xAxisLabel;
public static final String SERIALIZED_NAME_Y_AXIS_LABEL = "yAxisLabel";
@SerializedName(SERIALIZED_NAME_Y_AXIS_LABEL)
private String yAxisLabel;
public static final String SERIALIZED_NAME_X_PREFIX = "xPrefix";
@SerializedName(SERIALIZED_NAME_X_PREFIX)
private String xPrefix;
public static final String SERIALIZED_NAME_X_SUFFIX = "xSuffix";
@SerializedName(SERIALIZED_NAME_X_SUFFIX)
private String xSuffix;
public static final String SERIALIZED_NAME_Y_PREFIX = "yPrefix";
@SerializedName(SERIALIZED_NAME_Y_PREFIX)
private String yPrefix;
public static final String SERIALIZED_NAME_Y_SUFFIX = "ySuffix";
@SerializedName(SERIALIZED_NAME_Y_SUFFIX)
private String ySuffix;
/**
* Get type
* @return type
**/
@ApiModelProperty(required = true, value = "")
public TypeEnum getType() {
return type;
}
public ScatterViewProperties queries(List<DashboardQuery> queries) {
this.queries = queries;
return this;
}
public ScatterViewProperties addQueriesItem(DashboardQuery queriesItem) {
this.queries.add(queriesItem);
return this;
}
/**
* Get queries
* @return queries
**/
@ApiModelProperty(required = true, value = "")
public List<DashboardQuery> getQueries() {
return queries;
}
public void setQueries(List<DashboardQuery> queries) {
this.queries = queries;
}
public ScatterViewProperties colors(List<String> colors) {
this.colors = colors;
return this;
}
public ScatterViewProperties addColorsItem(String colorsItem) {
this.colors.add(colorsItem);
return this;
}
/**
* Colors define color encoding of data into a visualization
* @return colors
**/
@ApiModelProperty(required = true, value = "Colors define color encoding of data into a visualization")
public List<String> getColors() {
return colors;
}
public void setColors(List<String> colors) {
this.colors = colors;
}
/**
* Get shape
* @return shape
**/
@ApiModelProperty(required = true, value = "")
public ShapeEnum getShape() {
return shape;
}
public ScatterViewProperties note(String note) {
this.note = note;
return this;
}
/**
* Get note
* @return note
**/
@ApiModelProperty(required = true, value = "")
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public ScatterViewProperties showNoteWhenEmpty(Boolean showNoteWhenEmpty) {
this.showNoteWhenEmpty = showNoteWhenEmpty;
return this;
}
/**
* If true, will display note when empty
* @return showNoteWhenEmpty
**/
@ApiModelProperty(required = true, value = "If true, will display note when empty")
public Boolean getShowNoteWhenEmpty() {
return showNoteWhenEmpty;
}
public void setShowNoteWhenEmpty(Boolean showNoteWhenEmpty) {
this.showNoteWhenEmpty = showNoteWhenEmpty;
}
public ScatterViewProperties xColumn(String xColumn) {
this.xColumn = xColumn;
return this;
}
/**
* Get xColumn
* @return xColumn
**/
@ApiModelProperty(required = true, value = "")
public String getXColumn() {
return xColumn;
}
public void setXColumn(String xColumn) {
this.xColumn = xColumn;
}
public ScatterViewProperties yColumn(String yColumn) {
this.yColumn = yColumn;
return this;
}
/**
* Get yColumn
* @return yColumn
**/
@ApiModelProperty(required = true, value = "")
public String getYColumn() {
return yColumn;
}
public void setYColumn(String yColumn) {
this.yColumn = yColumn;
}
public ScatterViewProperties fillColumns(List<String> fillColumns) {
this.fillColumns = fillColumns;
return this;
}
public ScatterViewProperties addFillColumnsItem(String fillColumnsItem) {
this.fillColumns.add(fillColumnsItem);
return this;
}
/**
* Get fillColumns
* @return fillColumns
**/
@ApiModelProperty(required = true, value = "")
public List<String> getFillColumns() {
return fillColumns;
}
public void setFillColumns(List<String> fillColumns) {
this.fillColumns = fillColumns;
}
public ScatterViewProperties symbolColumns(List<String> symbolColumns) {
this.symbolColumns = symbolColumns;
return this;
}
public ScatterViewProperties addSymbolColumnsItem(String symbolColumnsItem) {
this.symbolColumns.add(symbolColumnsItem);
return this;
}
/**
* Get symbolColumns
* @return symbolColumns
**/
@ApiModelProperty(required = true, value = "")
public List<String> getSymbolColumns() {
return symbolColumns;
}
public void setSymbolColumns(List<String> symbolColumns) {
this.symbolColumns = symbolColumns;
}
public ScatterViewProperties xDomain(List<BigDecimal> xDomain) {
this.xDomain = xDomain;
return this;
}
public ScatterViewProperties addXDomainItem(BigDecimal xDomainItem) {
this.xDomain.add(xDomainItem);
return this;
}
/**
* Get xDomain
* @return xDomain
**/
@ApiModelProperty(required = true, value = "")
public List<BigDecimal> getXDomain() {
return xDomain;
}
public void setXDomain(List<BigDecimal> xDomain) {
this.xDomain = xDomain;
}
public ScatterViewProperties yDomain(List<BigDecimal> yDomain) {
this.yDomain = yDomain;
return this;
}
public ScatterViewProperties addYDomainItem(BigDecimal yDomainItem) {
this.yDomain.add(yDomainItem);
return this;
}
/**
* Get yDomain
* @return yDomain
**/
@ApiModelProperty(required = true, value = "")
public List<BigDecimal> getYDomain() {
return yDomain;
}
public void setYDomain(List<BigDecimal> yDomain) {
this.yDomain = yDomain;
}
public ScatterViewProperties xAxisLabel(String xAxisLabel) {
this.xAxisLabel = xAxisLabel;
return this;
}
/**
* Get xAxisLabel
* @return xAxisLabel
**/
@ApiModelProperty(required = true, value = "")
public String getXAxisLabel() {
return xAxisLabel;
}
public void setXAxisLabel(String xAxisLabel) {
this.xAxisLabel = xAxisLabel;
}
public ScatterViewProperties yAxisLabel(String yAxisLabel) {
this.yAxisLabel = yAxisLabel;
return this;
}
/**
* Get yAxisLabel
* @return yAxisLabel
**/
@ApiModelProperty(required = true, value = "")
public String getYAxisLabel() {
return yAxisLabel;
}
public void setYAxisLabel(String yAxisLabel) {
this.yAxisLabel = yAxisLabel;
}
public ScatterViewProperties xPrefix(String xPrefix) {
this.xPrefix = xPrefix;
return this;
}
/**
* Get xPrefix
* @return xPrefix
**/
@ApiModelProperty(required = true, value = "")
public String getXPrefix() {
return xPrefix;
}
public void setXPrefix(String xPrefix) {
this.xPrefix = xPrefix;
}
public ScatterViewProperties xSuffix(String xSuffix) {
this.xSuffix = xSuffix;
return this;
}
/**
* Get xSuffix
* @return xSuffix
**/
@ApiModelProperty(required = true, value = "")
public String getXSuffix() {
return xSuffix;
}
public void setXSuffix(String xSuffix) {
this.xSuffix = xSuffix;
}
public ScatterViewProperties yPrefix(String yPrefix) {
this.yPrefix = yPrefix;
return this;
}
/**
* Get yPrefix
* @return yPrefix
**/
@ApiModelProperty(required = true, value = "")
public String getYPrefix() {
return yPrefix;
}
public void setYPrefix(String yPrefix) {
this.yPrefix = yPrefix;
}
public ScatterViewProperties ySuffix(String ySuffix) {
this.ySuffix = ySuffix;
return this;
}
/**
* Get ySuffix
* @return ySuffix
**/
@ApiModelProperty(required = true, value = "")
public String getYSuffix() {
return ySuffix;
}
public void setYSuffix(String ySuffix) {
this.ySuffix = ySuffix;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ScatterViewProperties scatterViewProperties = (ScatterViewProperties) o;
return Objects.equals(this.type, scatterViewProperties.type) &&
Objects.equals(this.queries, scatterViewProperties.queries) &&
Objects.equals(this.colors, scatterViewProperties.colors) &&
Objects.equals(this.shape, scatterViewProperties.shape) &&
Objects.equals(this.note, scatterViewProperties.note) &&
Objects.equals(this.showNoteWhenEmpty, scatterViewProperties.showNoteWhenEmpty) &&
Objects.equals(this.xColumn, scatterViewProperties.xColumn) &&
Objects.equals(this.yColumn, scatterViewProperties.yColumn) &&
Objects.equals(this.fillColumns, scatterViewProperties.fillColumns) &&
Objects.equals(this.symbolColumns, scatterViewProperties.symbolColumns) &&
Objects.equals(this.xDomain, scatterViewProperties.xDomain) &&
Objects.equals(this.yDomain, scatterViewProperties.yDomain) &&
Objects.equals(this.xAxisLabel, scatterViewProperties.xAxisLabel) &&
Objects.equals(this.yAxisLabel, scatterViewProperties.yAxisLabel) &&
Objects.equals(this.xPrefix, scatterViewProperties.xPrefix) &&
Objects.equals(this.xSuffix, scatterViewProperties.xSuffix) &&
Objects.equals(this.yPrefix, scatterViewProperties.yPrefix) &&
Objects.equals(this.ySuffix, scatterViewProperties.ySuffix) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(type, queries, colors, shape, note, showNoteWhenEmpty, xColumn, yColumn, fillColumns, symbolColumns, xDomain, yDomain, xAxisLabel, yAxisLabel, xPrefix, xSuffix, yPrefix, ySuffix, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ScatterViewProperties {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" queries: ").append(toIndentedString(queries)).append("\n");
sb.append(" colors: ").append(toIndentedString(colors)).append("\n");
sb.append(" shape: ").append(toIndentedString(shape)).append("\n");
sb.append(" note: ").append(toIndentedString(note)).append("\n");
sb.append(" showNoteWhenEmpty: ").append(toIndentedString(showNoteWhenEmpty)).append("\n");
sb.append(" xColumn: ").append(toIndentedString(xColumn)).append("\n");
sb.append(" yColumn: ").append(toIndentedString(yColumn)).append("\n");
sb.append(" fillColumns: ").append(toIndentedString(fillColumns)).append("\n");
sb.append(" symbolColumns: ").append(toIndentedString(symbolColumns)).append("\n");
sb.append(" xDomain: ").append(toIndentedString(xDomain)).append("\n");
sb.append(" yDomain: ").append(toIndentedString(yDomain)).append("\n");
sb.append(" xAxisLabel: ").append(toIndentedString(xAxisLabel)).append("\n");
sb.append(" yAxisLabel: ").append(toIndentedString(yAxisLabel)).append("\n");
sb.append(" xPrefix: ").append(toIndentedString(xPrefix)).append("\n");
sb.append(" xSuffix: ").append(toIndentedString(xSuffix)).append("\n");
sb.append(" yPrefix: ").append(toIndentedString(yPrefix)).append("\n");
sb.append(" ySuffix: ").append(toIndentedString(ySuffix)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| 27.533552 | 221 | 0.695952 |
857e9ac5e1f357aceab87fc776c3641478c2ac04 | 773 | js | JavaScript | src/App/AdminBundle/Resources/public/wysiwyg/scripts/common/language/sv-SE/websearch.js | cloudcache/Billing-1 | 3768c3eeee71e897f8192c4733d1a8b082cad65e | [
"Apache-2.0"
] | 1 | 2016-08-26T01:35:25.000Z | 2016-08-26T01:35:25.000Z | src/App/AdminBundle/Resources/public/wysiwyg/scripts/common/language/sv-SE/websearch.js | cloudcache/Billing-1 | 3768c3eeee71e897f8192c4733d1a8b082cad65e | [
"Apache-2.0"
] | null | null | null | src/App/AdminBundle/Resources/public/wysiwyg/scripts/common/language/sv-SE/websearch.js | cloudcache/Billing-1 | 3768c3eeee71e897f8192c4733d1a8b082cad65e | [
"Apache-2.0"
] | null | null | null | function loadTxt() {
document.getElementById("lblSearch").innerHTML = "SÖK:";
document.getElementById("lblReplace").innerHTML = "ERSÄTT:";
document.getElementById("lblMatchCase").innerHTML = "Matcha gemener/versaler";
document.getElementById("lblMatchWhole").innerHTML = "Matcha hela ord";
document.getElementById("btnSearch").value = "Sök nästa"; ;
document.getElementById("btnReplace").value = "Ersätt";
document.getElementById("btnReplaceAll").value = "Ersätt alla";
}
function getTxt(s) {
switch (s) {
case "Finished searching": return "Sökning i dokumentet klar.\nVill du söka igen från början?";
default: return "";
}
}
function writeTitle() {
document.write("<title>Sök & Ersätt</title>")
} | 40.684211 | 104 | 0.675291 |
b9dd95c86e9b3072ee721a77378efb0a7a816670 | 2,137 | dart | Dart | lib/src/app_components/app_http_client.dart | IAmRealPoca/cvideo-employee-mobile | 8d6628053428499cb0b97c825604749b7a6dcbc3 | [
"MIT"
] | null | null | null | lib/src/app_components/app_http_client.dart | IAmRealPoca/cvideo-employee-mobile | 8d6628053428499cb0b97c825604749b7a6dcbc3 | [
"MIT"
] | null | null | null | lib/src/app_components/app_http_client.dart | IAmRealPoca/cvideo-employee-mobile | 8d6628053428499cb0b97c825604749b7a6dcbc3 | [
"MIT"
] | null | null | null | /*
* File: AppHttpClient.dart
* Project: CVideo
* File Created: Saturday, 13th June 2020 11:02 am
* Author: luonglv39 (luonglvse130702@fpt.edu.vn)
* -----
* Last Modified: Saturday, 13th June 2020 11:49 am
* Modified By: luonglv39 (luonglvse130702@fpt.edu.vn>)
* -----
* Copyright (c) Daxua Team
*/
import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:http/io_client.dart';
class AppHttpClient {
/// Base url for entire the app
// static final String baseUrl = "https://cvideo-api-host.azurewebsites.net/api/v1";
static final String baseUrl = "https://10.0.2.2:5001/api/v1";
/// Sends an HTTP GET request with the given headers to the given URL.
static Future<http.Response> get(String url, {Map<String, String> headers}) =>
http.get('$baseUrl$url', headers: headers);
/// Sends an HTTP POST request with the given headers and body to the given URL.
static Future<http.Response> post(url,
{Map<String, String> headers, body, Encoding encoding}) =>
http.post('$baseUrl$url',
headers: headers, body: body, encoding: encoding);
/// Sends an HTTP PUT request with the given headers and body to the given URL.
static Future<http.Response> put(url,
{Map<String, String> headers, body, Encoding encoding}) =>
http.put('$baseUrl$url',
headers: headers, body: body, encoding: encoding);
/// Sends an HTTP DELETE request with the given headers to the given URL.
static Future<http.Response> delete(url, {Map<String, String> headers}) =>
http.delete('$baseUrl$url', headers: headers);
// TO-DO
static Future<http.Response> postTest(
url, {
Map<String, String> headers,
body,
Encoding encoding,
}) {
HttpClient client = new HttpClient();
client.badCertificateCallback =
((X509Certificate cert, String host, int port) => true);
IOClient ioClient = new IOClient(client);
return ioClient.post(
"$baseUrl$url",
headers: headers,
body: body,
encoding: encoding,
);
}
}
| 34.467742 | 87 | 0.648105 |
759007a78ad8f88a9ae526383eb4194334c2bbde | 2,591 | h | C | Jx3Full/Source/Source/Server/SO3GameServer/Test/TestProject/Robot/KPlayerEyeshot.h | RivenZoo/FullSource | cfd7fd7ad422fd2dae5d657a18839c91ff9521fd | [
"MIT"
] | 2 | 2021-07-31T15:35:01.000Z | 2022-02-28T05:54:54.000Z | Jx3Full/Source/Source/Server/SO3GameServer/Test/TestProject/Robot/KPlayerEyeshot.h | RivenZoo/FullSource | cfd7fd7ad422fd2dae5d657a18839c91ff9521fd | [
"MIT"
] | null | null | null | Jx3Full/Source/Source/Server/SO3GameServer/Test/TestProject/Robot/KPlayerEyeshot.h | RivenZoo/FullSource | cfd7fd7ad422fd2dae5d657a18839c91ff9521fd | [
"MIT"
] | 5 | 2021-02-03T10:25:39.000Z | 2022-02-23T07:08:37.000Z | #ifndef _KPlayerEyeshot_H_
#define _KPlayerEyeshot_H_
#include "KBaseObjectSet.h"
#include "KMath.h"
class KPlayer;
class KNpc;
class KDoodad;
class KSceneObject;
class KMonster;
class KRegion;
class KPlayerEyeshot
{
public:
KPlayerEyeshot();
~KPlayerEyeshot();
int Init(KMonster *pOwner);
int UnInit();
int Activate();
int IsVisible(KSceneObject *pObject);
int IsVisible(KRegion *pRegion);
KPlayer *NewPlayer(DWORD dwID);
int DeletePlayer(KPlayer *pPlayer);
KPlayer *GetPlayer(DWORD dwID);
KNpc *NewNpc(DWORD dwID);
int DeleteNpc(KNpc *pNpc);
KNpc *GetNpc(DWORD dwID);
KDoodad *NewDoodad(DWORD dwID);
int DeleteDoodad(KDoodad *pDoodad);
KDoodad *GetDoodad(DWORD dwID);
KNpc *GetNearNpc();
int DeleteAllObject();
private:
KBaseObjectSet<KPlayer> m_PlayerSet;
KBaseObjectSet<KNpc> m_NpcSet;
KBaseObjectSet<KDoodad> m_DoodadSet;
KMonster *m_pOwner;
private:
template <class T>
struct KActivateObjectFunc
{
int operator ()(DWORD dwID, T *pObject)
{
pObject->Activate();
return TRUE;
}
};
template <class T>
struct KDeleteObjectFunc
{
KDeleteObjectFunc(KBaseObjectSet<T> *pObjSet) :
pObjectSet(pObjSet)
{
}
int operator ()(DWORD dwID, T *pObject)
{
int nRetCode = FALSE;
if (pObject && pObjectSet)
{
nRetCode = pObject->UnInit();
KGLOG_CHECK_ERROR(nRetCode);
pObjectSet->Delete(pObject);
}
return TRUE;
}
KBaseObjectSet<T> *pObjectSet;
};
template <class T>
struct KGetObjectFunc
{
KGetObjectFunc(KBaseObjectSet<T> *pObjSet) :
pTarget(NULL), pObjectSet(pObjSet), nIndex(0), nCurrentIndex(0)
{
if (pObjectSet)
{
nIndex = g_Random(pObjectSet->GetUsedSize());
}
}
int operator ()(DWORD dwID, T *pObject)
{
++nCurrentIndex;
if (nCurrentIndex >= nIndex && pObject)
{
pTarget = pObject;
return FALSE;
}
return TRUE;
}
T *pTarget;
KBaseObjectSet<T> *pObjectSet;
int nIndex;
int nCurrentIndex;
};
};
#endif //_KPlayerEyeshot_H_ | 22.72807 | 80 | 0.532613 |
382b9cfb256d82052e87134ee9df1b73645d24e7 | 360 | lua | Lua | examples/batman/main.lua | zelluv/turtle.lua | 500c341232846507e2be8f68c2172e3eebaaf9f8 | [
"MIT"
] | 68 | 2020-07-25T19:01:22.000Z | 2022-03-25T11:43:40.000Z | examples/batman/main.lua | zelluv/turtle.lua | 500c341232846507e2be8f68c2172e3eebaaf9f8 | [
"MIT"
] | null | null | null | examples/batman/main.lua | zelluv/turtle.lua | 500c341232846507e2be8f68c2172e3eebaaf9f8 | [
"MIT"
] | 7 | 2020-07-29T22:56:30.000Z | 2021-09-05T12:24:22.000Z | -----------------------------------------------------------
-- (c) 2020 Mustafa Erkam Badin --
-- vector.lua --
-----------------------------------------------------------
-- Source: https://github.com/arthurealike/turtle.lua --
-----------------------------------------------------------
| 51.428571 | 59 | 0.2 |
b0dedd84752d0c1d71bcdb772503e052890da7ab | 526 | asm | Assembly | oeis/082/A082575.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/082/A082575.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/082/A082575.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A082575: Nonnegative numbers in (3*A005836) union (3*A005836 - 2) [A005836 lists the numbers with base-3 representation containing no 2].
; Submitted by Jamie Morken(s1)
; 0,1,3,7,9,10,12,25,27,28,30,34,36,37,39,79,81,82,84,88,90,91,93,106,108,109,111,115,117,118,120,241,243,244,246,250,252,253,255,268,270,271,273,277,279,280,282,322,324,325,327,331,333,334,336,349,351,352
mov $2,$0
add $0,1
div $0,4
seq $0,240400 ; Numbers n having a partition into distinct parts of form 3^k-2^k.
mul $0,2
add $0,$2
mul $0,9
div $0,6
| 40.461538 | 205 | 0.709125 |
a09fbb45128222693b28f4dd8404e619b63f7813 | 239 | swift | Swift | PLUTrainer/PLUTrainer/Model/Produce+CoreDataClass.swift | MondaleFelix/PLUTrainer | 24b89c90126366d6ee0248627de9e646c5a5c3c8 | [
"MIT"
] | null | null | null | PLUTrainer/PLUTrainer/Model/Produce+CoreDataClass.swift | MondaleFelix/PLUTrainer | 24b89c90126366d6ee0248627de9e646c5a5c3c8 | [
"MIT"
] | null | null | null | PLUTrainer/PLUTrainer/Model/Produce+CoreDataClass.swift | MondaleFelix/PLUTrainer | 24b89c90126366d6ee0248627de9e646c5a5c3c8 | [
"MIT"
] | null | null | null | //
// Produce+CoreDataClass.swift
// PLUTrainer
//
// Created by Cao Mai on 6/27/20.
// Copyright © 2020 Mondale. All rights reserved.
//
//
import Foundation
import CoreData
@objc(Produce)
public class Produce: NSManagedObject {
}
| 14.058824 | 50 | 0.702929 |
7d710a8ad8a1fcee86fe4dd29dae365f3c7cde7b | 15,344 | html | HTML | b/Termite-Pest-Control-Cody-WY.html | vickyjonesh/vickyjonesh.github.io | 35748f43d2fc7f0a9477d0787807378ed1479fc5 | [
"MIT"
] | null | null | null | b/Termite-Pest-Control-Cody-WY.html | vickyjonesh/vickyjonesh.github.io | 35748f43d2fc7f0a9477d0787807378ed1479fc5 | [
"MIT"
] | null | null | null | b/Termite-Pest-Control-Cody-WY.html | vickyjonesh/vickyjonesh.github.io | 35748f43d2fc7f0a9477d0787807378ed1479fc5 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Termite Pest Control Cody WY</title>
<meta name="description" content="Professional Pest Control Company in Cody WY - Mosquito growth regulator to prevent larvae from becoming biting adult mosquitoes.">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
</head>
<main>
<header id="navbar">
<div class="container">
<div class="flexbox flexRow alignItemCenter">
<div class="logobar">
<a href="index.html">Pest Control Service</a>
</div>
<div class="flexbox alignItemCenter alignItemEnd rightPhone">
<a href="tel:833-866-6990"> <i class="fa fa-phone"></i>(833) 866-6990</a>
<span>24 Hour Emergency and Same Day Service!</span>
</div>
</div>
</div>
</header>
<section class="main-hero">
<div class="container">
<div class="hero">
<div class="left-img">
<img src="images/1.jpg" alt="">
</div>
<div class="right-text">
<div class="inner-right-text">
<p><strong>Pest Problems?</strong></p>
<span>We Have Your Pest Solution - Guaranteed</span>
<a href="tel:833-866-6990"> <i class="fa fa-phone"></i>Request Quote</a>
</div>
</div>
</div>
</div>
</section>
<section>
<div class="container">
<div id="tab1" class="opTabContent">
<div class="tab-wrapper">
<div class="accordion-wrapper">
<div class="panel">
<a href="./index.html">Home</a><br><center><h1>Termite Pest Control in Cody WY</h1></center>
<p style="text-align: center;"><span style="color: #ff0000; font-size: 22px;">Don`t let pests bug you any longer. Give us a call to schedule your pest control treatment!</span></p>
<h2 style="text-align: center;"><span style="color: ##ffffff;">We Treat For The Following Pest Problems in Cody:</span></h2>
<p><img src="https://pestimages.s3-us-west-1.amazonaws.com/pest-exterminators.jpg" alt="Pest Control & Exterminator Services Cody"><p>
<h2 style="text-align: center;"><span style="color: ##ffffff;">Why Choose Us?</span></h2>
<ul>
<li style="text-align: left; font-size: 18px;"><span style="color: #000000;">Full range of pest control and termite treatment services.</li>
<p>
<li style="text-align: left; font-size: 18px;"><span style="color: #000000;">Flexible scheduling, as well as the same and next-day pest control service.</li>
<p>
<li style="text-align: left; font-size: 18px"><span style="color: #000000;">Using the latest in pest control and inspection technology.</li>
<p>
<li style="text-align: left; font-size: 18px"><span style="color: #000000;">Highly trained and experienced representatives.</li>
<p>
<li style="text-align: left; font-size: 18px"><span style="color: #000000;">Providing 24/7 support as well as emergency services.</li>
<p>
<li style="text-align: left; font-size: 18px"><span style="color: #000000;">Green, environmentally-friendly treatments that are child and pet-friendly.</li>
</ul>
<p style="text-align: center; font-size: 26px;"><strong><span style="color: #3366ff;">Don’t delay. Call right now before pests become a problem!</span></strong></p>
<center><div class="inner-right-text">
<a href="tel:833-866-6990"> <i class="fa fa-phone"></i>(833) 866-6990</a>
</div></center>
<h2>How To Pick a Residential Pest Exterminator Company in Cody</h2>
<p><img src="https://pestimages.s3-us-west-1.amazonaws.com/pest-treatment.jpg" alt=""><p>
<p>Turner offers a specific bed bug treatment to rid your house of unwanted pests. The range of pests found in food processing plants will differ according to location, environment and food active ingredients processed, however the most common ones are beetles, moths, rodents, cockroaches, and flies. They are generally less damaging to natural opponents and the environment due to the fact that the biorationals are typically less hazardous and more selective. Picker Online is the right platform to get the information for any type to pest control, for instance pest control for termites and lots of other pest controls.</p>
<p>To check out the other companies we have actually examined, head to the best pest control services around. Discover more about our preventative treatments and how to secure your home and family against these devastating & dangerous pests. Regrettably, the most damaging pests are often the most tough to identify, so do not give silverfish, termites, carpet beetles and wood-boring beetles a chance.</p>
<h3>Spider Removal Cody Wyoming</h2>
<p>Select an efficient management technique that will have the least amount of impact on other living creatures and the environment if a pest or disease triggers undesirable damage despite preventative efforts. Examples include growing of alternate hosts (e.g., weeds), crop rotation, selection of planting sites, trap crops, and adjusting the timing of planting or harvest.</p>
<p>For instance the farmer can control expense at the point when the cost of damage by the pest is more than the expense of control. Pest control provider use some hazardous chemicals and products and the odor can be intolerable for you. This method is systematic and ensures that you are devoid of pests for a very long time. Our services can assist to rid your house or commercial establishment from bed bugs, rapidly and economically.</p>
<p>Some vegetable crop transplants can be plagued with insect pests, and growers utilizing these transplants are put at a substantial drawback. If pests are making themselves in the house in your home or business, Terminators Pest Control is ready to assist. We make sure that our highly trained exterminators are able and very well-informed to provide the best possible pest removal services in Chandigarh.</p>
<p style="text-align: center; font-size: 26px;"><strong><span style="color: #3366ff;">We are just one call away!</span></strong></p>
<center><div class="inner-right-text">
<a href="tel:833-866-6990"> <i class="fa fa-phone"></i>(833) 866-6990</a>
</div></center>
<h3>Things to Remember When Dealing With Pest Control Cody WY</h3>
<p>If you are having actually exterminators come in to spray pesticides, put away toys and other items that young kids will want to play with and put in their mouths. These useful insects typically exist in the landscape naturally, but they also can be introduced. Initially, we require to understand, promote, and optimize the efficiency of indigenous populations of natural enemies.</p>
<p>Our Integrated Pest Management (IPM) approach is based on our four principles that together we call ERDM. We comprehend that discovering pests in your house or business is upsetting. Versatility and Time- The procedure of pest control takes time and efforts. Pests are undesirable plants, animals, insects, bacteria or other organisms that interfere with human activity.</p>
<p><strong>Some of the most popular Cody pest control exterminating services:</strong><p>
<ul>
<li style="text-align: left;"><span style="color: #000000;">Emergency Pest Control in Cody, WY</span></li>
<li style="text-align: left;"><span style="color: #000000;">Cockroach Exterminator in Cody, WY</span></li>
<li style="text-align: left;"><span style="color: #000000;">Rodent controlin Cody, WY</span></li>
<li style="text-align: left;"><span style="color: #000000;">Termite Control & Treatment in Cody, WY</span></li>
<li style="text-align: left;"><span style="color: #000000;">Wasp and Bee Removal in Cody, WY</span></li>
<li style="text-align: left;"><span style="color: #000000;">Bed Bug Treatment in Cody, WY</span></li>
<li style="text-align: left;"><span style="color: #000000;">Spider Control in Cody, WY</span></li>
<li style="text-align: left;"><span style="color: #000000;">Mosquito control in Cody, WY</span></li>
<li style="text-align: left;"><span style="color: #000000;">Residential and Commercial Exterminators in Cody, WY</span></li>
<li style="text-align: left;"><span style="color: #000000;">Tick and Flea Control in Cody, WY</span></li>
<li style="text-align: left;"><span style="color: #000000;">Ant Control in Cody, WY</span></li>
<li style="text-align: left;"><span style="color: #000000;">And Much More!</span></li>
</ul>
<h3>Bed Bug Pest Control Companies Cody WY 82414</h3>
<p>Protects infested woodwork with chemicals that will not simply kill the existing termites, however also safeguard it from future termite infestation. NPMA happily serves almost 5,000 company members and their workers and works day-to-day to enhance their cumulative mission of securing public health, food and property from the illness and dangers of pests.</p>
<p>Physical controls consist of mulches for weed management, steam sanitation of the soil for illness management, or barriers such as screens to keep birds or insects out. Biological control is commonly used for greenhouse pests, but not to the very same extent in the field. You'll now have a list of 3-6 great pest control business names and you can begin to ask potential consumers or people working in the industry for feedback (your target market).</p>
<p>Numerous other definitions also concentrate on removing the dependence or reducing on chemical control alternatives, adopting a number of other alternatives with the emphasis on human and ecological health. For a list of business residential or commercial properties, we handle, take a look at our web page for pest control services. Atlas Pest and Wildlife Control is a professional, business sounding business name.</p>
<p>Chemical pesticides are classified into different groups based on their mode of action (IRAC 2018) and turning chemicals from different mode of action groups is advised to minimize the threat of resistance development (Stimulates and Nauen 2015 ). Federal government regulations limit the time and quantity of particular chemical pesticides and assist mitigate the involved risks. </p>
<p>First of all, expert know the best chemicals to be utilized that will kill bed bugs. Well, this is why pest control services are super important. Integrated Pest Management, or IPM, is an approach to solving pest issues by using our understanding about pests to avoid them from damaging crops, damaging animals, infesting structures or otherwise interfering with our livelihood or enjoyment of life.</p>
<p>
<iframe width="100%" height="250" src="https://maps.google.com/maps?width=100%&height=600&hl=en&q=Cody.WY+()&ie=UTF8&t=&z=14&iwloc=B&output=embed" frameborder="0" scrolling="no" marginheight="0" marginwidth="0">
</iframe>
</p>
<p>
<iframe width="350" height="301" src="https://www.youtube.com/embed/GWiXBPEfVcY" frameborder="0" allowfullscreen="#DEFAULT"></iframe>
</p>
<br>
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="name">Pest Control & Exterminator Services Cody Wyoming</span>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
Rated <span itemprop="ratingValue">4.4</span>/5 based on <span itemprop="reviewCount">265</span> reviews.</div></div>
<br><a href="./Mice-and-Rat-Exterminator-Salem-IN.html">Previous</a> <a href="./Flea-Fumigation-and-Removal-Services-Monticello-IN.html">Next</a>
<br>Areas Around Cody Wyoming<br><a href="./Ant-Control-Carson-City-NV.html">Ant Control Carson City NV</a><br><a href="./Bed-Bug-Treatment-Russellville-AR.html">Bed Bug Treatment Russellville AR</a><br><a href="./Rat-And-Rodent-Removal-Lindenhurst-NY.html">Rat And Rodent Removal Lindenhurst NY</a><br><a href="./Tick-Control-Woodland-Hills-CA.html">Tick Control Woodland Hills CA</a><br><a href="./Termite-Control-Inspection-Services-Hillside-NJ.html">Termite Control & Inspection Services Hillside NJ</a><br>
</div>
</div>
</div>
</div>
</div>
</section>
<footer>
<div class="main-help">
<div class="container">
<div class="need-help">
<p>WE’RE FAST, AFFORDABLE & STANDING BY READY TO HELP 24/7. CALL NOW. <span><i class="fa fa-phone"></i><a href="tel:833-866-6990">(833) 866-6990</span></a>
</p>
</div>
</div>
</div>
<div class="footer-content">
<div class="container">
<ul>
<li><a href="./index.html">Home</a></li>
<li><a href="./disclaimer.html">Disclaimer</a></li>
<li><a href="./privacy.html">Privacy Policy</a></li>
<li><a href="./terms.html">Terms of Service</a></li>
</ul>
<p>© 2020 Pest Control Services - All Rights Reserved</p>
<p>This site is a free service to assist homeowners in connecting with local service contractors. All contractors are independent and this site does not warrant or guarantee any work performed. It is the responsibility of the homeowner to verify that the hired contractor furnishes the necessary license and insurance required for the work being performed. All persons depicted in a photo or video are actors or models and not contractors listed on this site.</p>
</div>
</div>
</footer>
</main>
<!-- -->
<script type="text/javascript">
var sc_project=12339405;
var sc_invisible=1;
var sc_security="8ed27a6d";
</script>
<script type="text/javascript"
src="https://www.statcounter.com/counter/counter.js"
async></script>
<noscript><div class="statcounter"><a title="Web Analytics"
href="https://statcounter.com/" target="_blank"><img
class="statcounter"
src="https://c.statcounter.com/12339405/0/8ed27a6d/1/"
alt="Web Analytics"></a></div></noscript>
<!-- -->
<div class="tabtocall">
<a href="tel:833-866-6990"><img src="images/baseline_call_white_18dp.png" alt=""> Tap To Call</a>
</div>
<div class="modal fade" id="ouibounce-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<button type="button" class="close-btn" data-dismiss="modal">X</button>
<div class="modal-body">
<div class="popupWait">
<span class="waitText">Wait!</span>
<p class="para1">Urgent Pest Control Needs? Calls Are Answered 24/7.</p>
<p class="para2">Call now to get connected to a exterminator near you.</p>
<a href="tel:833-866-6990"><strong><i class="fa fa-phone"></i>(833) 866-6990</strong></a>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="js/exit-popup.js"></script>
<body>
</body>
</html> | 78.285714 | 627 | 0.691541 |
f5231da320cc6ecdf79803a425d550408572373f | 2,704 | hpp | C++ | src/node.hpp | lorenzoditucci/ProFAX | df0bc02e5b3e473e7b57225f4ed11f816a22c4e9 | [
"Apache-2.0"
] | null | null | null | src/node.hpp | lorenzoditucci/ProFAX | df0bc02e5b3e473e7b57225f4ed11f816a22c4e9 | [
"Apache-2.0"
] | null | null | null | src/node.hpp | lorenzoditucci/ProFAX | df0bc02e5b3e473e7b57225f4ed11f816a22c4e9 | [
"Apache-2.0"
] | null | null | null | #ifndef _NODE_H
#define _NODE_H
#include "eef1.hpp"
#include "bv.hpp"
#include <vector>
using namespace std;
class CSkiplist;
class CTerm;
class CNode
{
public:
// Construct an empty node withthe given index.
CNode(int index) : m_next(NULL), m_prev(NULL), m_up(NULL),
m_down(NULL), m_index(index), m_stamp(0),
m_level(0), m_nc(BOTH), m_pSL(NULL), m_bv(NULL)
{ Midentity(m_rotate); Videntity(m_translate); }
CNode(CNode * down, CSkiplist * pSL);
// The types of changes that a node can undergo.
enum NODE_CHANGE {NONE = 0, TRANSFORM = 1, BOX = 2, BOTH = 3};
void updateBV();
// Undo the changes to the BV casued by the last move.
void undoBV()
{ m_bv->undoBV(); }
void transformToNext();
virtual void computePairEnergy(CNode * pNode, const REAL rot[3][3],
const REAL trans[3], CTerm * term,
bool bSeparated);
virtual void computeSelfEnergy(CTerm * term);
virtual bool findPairClash(CNode * pNode, const REAL rot[3][3],
const REAL trans[3], bool bSeparated);
virtual bool findSelfClash();
virtual void undo();
// Modifiers
void setBV(CBV * bv)
{ m_bv = bv; }
void setNext(CNode * next)
{ m_next = next; }
void setPrev(CNode * prev)
{ m_prev = prev; }
void setUp(CNode * up)
{ m_up = up; }
void setDown(CNode * down)
{ m_down = down; }
void setLevel(int l)
{ m_level = l; }
void setStamp(int stamp, NODE_CHANGE nc)
{ m_stamp = stamp; m_nc = nc; }
// Accessors
CBV * getBV() const
{ return m_bv; }
CNode * getNext() const
{ return m_next; }
CNode * getPrev() const
{ return m_prev; }
CNode * goUp() const
{ return m_up; }
CNode * goDown() const
{ return m_down; }
CNode * getParent() const
{
if (goUp())
return goUp();
else if (getPrev())
return getPrev()->goUp();
else
return NULL;
}
int getLevel() const
{ return m_level; }
int getIndex() const
{ return m_index; }
int getStamp() const
{ return m_stamp; }
virtual bool isLeaf() const
{ return false; }
bool isSeparator(int time)
{ return((m_stamp >= time) && (m_nc & TRANSFORM)); }
bool isAffected(int time)
{ return ((m_stamp >= time) && (m_nc & BOX)); }
const REAL getBVVolume() const
{ assert(m_bv); return m_bv->getVolume(); }
friend ostream & operator<<(ostream & out, CNode & b);
static vector<CTerm*> m_undoPairs;
REAL m_rotate[3][3];
REAL m_translate[3];
CBV * m_bv;
CSkiplist * m_pSL;
protected:
CNode * m_next;
NODE_CHANGE m_nc;
// undo variables
REAL m_undoRotate[3][3];
REAL m_undoTranslate[3];
private:
CNode * m_prev;
CNode * m_up;
CNode * m_down;
int m_level;
int m_index;
int m_stamp;
};
#endif
| 21.460317 | 69 | 0.635355 |
7554e989ec989a976660ddc0c95b9986df6ed355 | 1,318 | cs | C# | ScriptableObjectSaveSystem/Assets/ScriptableObjectSaveSystem/Scripts/Testers/TesterWithSingleton.cs | Arefnue/ScriptableObjectSaveSystem | b575164f0b24b58efed0f503538c7a74b49e4611 | [
"MIT"
] | null | null | null | ScriptableObjectSaveSystem/Assets/ScriptableObjectSaveSystem/Scripts/Testers/TesterWithSingleton.cs | Arefnue/ScriptableObjectSaveSystem | b575164f0b24b58efed0f503538c7a74b49e4611 | [
"MIT"
] | null | null | null | ScriptableObjectSaveSystem/Assets/ScriptableObjectSaveSystem/Scripts/Testers/TesterWithSingleton.cs | Arefnue/ScriptableObjectSaveSystem | b575164f0b24b58efed0f503538c7a74b49e4611 | [
"MIT"
] | null | null | null | using System.Globalization;
using UnityEngine;
using UnityEngine.UI;
namespace ScriptableObjectSaveSystem.Scripts.Testers
{
public class TesterWithSingleton : MonoBehaviour
{
[Header("TextPlaces")]
public Text intExampleText;
public Text floatExampleText;
public Text stringExampleText;
public Text listExampleText;
public Text vectorExampleText;
public void UpdateTexts()
{
intExampleText.text = $"IntExample: {PersistentObject.Save.databaseContainer.IntExample.ToString()}";
floatExampleText.text = $"FloatExample: {PersistentObject.Save.databaseContainer.FloatExample.ToString(CultureInfo.InvariantCulture)}";
stringExampleText.text = $"StringExample: {PersistentObject.Save.databaseContainer.StringContainer}";
listExampleText.text = $"ListExample (last index): {PersistentObject.Save.databaseContainer.ListContainer[PersistentObject.Save.databaseContainer.ListContainer.Count-1].ToString()}";
vectorExampleText.text = $"VectorExample: {PersistentObject.Save.databaseContainer.VectorContainer.ToString()}";
}
public void ResetDatabase()
{
PersistentObject.Save.databaseContainer.ResetDatabase();
}
}
}
| 37.657143 | 194 | 0.698786 |
7468553c5a80bc299a7e024cad9194b0d83d75e4 | 10,803 | html | HTML | weeks/week3.html | mdgragg/power-rankings | a712f8d4b0534ead612ac7a872f8e9e2a20760c6 | [
"MIT"
] | null | null | null | weeks/week3.html | mdgragg/power-rankings | a712f8d4b0534ead612ac7a872f8e9e2a20760c6 | [
"MIT"
] | null | null | null | weeks/week3.html | mdgragg/power-rankings | a712f8d4b0534ead612ac7a872f8e9e2a20760c6 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Power Ranking</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
<link rel="stylesheet" href="../assets/css/style.css" />
</head>
<body>
<header>
<span class=""></span>
<span class=""> </span>
<span class=""></span>
<div class="row">
<div class="col-md-5 line-left"> </div>
<div class="col-md-2">
<img class="logo" alt="logo" src="../assets/images/FFL-Logo.png">
</div>
<div class="col-md-5 line-right"> </div>
</div>
</header>
<h1>2021 Power Rankings</h1>
<p class="week"><a href="../index.html">Preseason</a> | <a href="../weeks/week1.html">Week 1</a> | <a href="../weeks/week2.html">Week 2</a> | <strong>Week 3</strong> | <a href="../weeks/week4.html">Week 4</a> | <a href="../weeks/week5.html">Week 5</a></p>
<div class="container">
<div class="greyBox same"> <!-- same up down -->
<h5>Rank <strong>1</strong></h5>
<div class="team-info">
<img class="team-img" alt="logo" src="https://cdn.magzter.com/1359991142/1576069107/articles/5dfcbd4f3afcc/crp_DontHock-A-Loogie.jpg">
<p>
<span class="team-name"> Josh Gordons Bong Water</span> <span class="record">(3-0)</span> <br>
<span class="name"> Justin Cicchella</span> <br>
<h5 class="previous">Total Points: 420 | Previous rank: #1</h5>
</p>
<!-- <img class="up-down" src="../assets/images/up.png"> -->
</div>
<p class="write-up"> Big acquisition of picking up Gordon to be able to update name. Bigger move was drafting (and holding onto) Hubbard now that McCaffery is injured. </p>
</div>
<div class="greyBox up"> <!--up down same-->
<h5>Rank <strong>2</strong></h5>
<div class="team-info">
<img class="team-img" alt="logo" src="https://g.espncdn.com/lm-static/logo-packs/ffl/HelmetAlphabet-ESPN/Helmet-P.svg">
<p>
<span class="team-name"> Liquid Poo</span> <span class="record">(2-1)</span> <br>
<span class="name"> Brien Mullinger</span> <br>
<h5 class="previous">Total Points: 411 | Previous rank: #4</h5>
</p>
<img class="up-down" src="../assets/images/up.png">
</div>
<p class="write-up"> So far very consistent team after I said it wouldn’t be in the preseason rankings. Spoiler alert - I’m not good at this. </p>
</div>
<div class="greyBox up">
<h5>Rank <strong>3</strong></h5>
<div class="team-info">
<img class="team-img" alt="logo" src="https://dlisted.com/wp-content/uploads/2020/04/wenn37701353.jpg">
<p>
<span class="team-name"> Trophy Wife</span> <span class="record">(2-1)</span><br>
<span class="name"> Courtney Ressa</span> <br>
<h5 class="previous">Total Points: 388 | Previous rank: #5</h5>
</p>
<img class="up-down" src="../assets/images/up.png">
</div>
<p class="write-up"> I keep saying Brady will decline but regardless this is a solid team. Keeps the green arrow. </p>
</div>
<div class="greyBox down">
<h5>Rank <strong>4</strong></h5>
<div class="team-info">
<img class="team-img" alt="logo" src="https://g.espncdn.com/lm-static/logo-packs/core/StarsAndFlames/stars_flames-5.svg">
<p>
<span class="team-name"> Cook'n These Hoes</span> <span class="record">(2-1)</span> <br>
<span class="name"> Eric Tchen</span> <br>
<h5 class="previous">Total Points: 330 | Previous rank: #2</h5>
</p>
<img class="up-down" src="../assets/images/down.png">
</div>
<p class="write-up"> Should bounce back once Cook comes back from injury and Cooper gets fully healthy. </p>
</div>
<div class="greyBox down">
<h5>Rank <strong>5</strong></h5>
<div class="team-info">
<img class="team-img" alt="logo" src=" https://g.espncdn.com/lm-static/ffl/images/default_logos/6.svg">
<p>
<span class="team-name"> Dayton Manning</span> <span class="record">(1-2)</span> <br>
<span class="name"> Teddy Baldassarre</span> <br>
<h5 class="previous">Total Points: 422 | Previous rank: #3</h5>
</p>
<img class="up-down" src="../assets/images/down.png">
</div>
<p class="write-up"> Has yet to score under 130 points but already more losses than last year. </p>
</div>
<div class="greyBox same">
<h5>Rank <strong>6</strong></h5>
<div class="team-info">
<img class="team-img img-top" alt="logo" src=" https://g.espncdn.com/lm-static/logo-packs/ffl/Talent-ChipWass/talent-schefter_2.svg">
<p>
<span class="team-name"> Adam Shafter</span> <span class="record">(1-2)</span><br>
<span class="name"> Jonny Chernek</span> <br>
<h5 class="previous">Total Points: 370 | Previous rank: #6</h5>
</p>
<!-- <img class="up-down" src="../assets/images/up.png"> -->
</div>
<p class="write-up"> Didn't get the win but each game Barkley looks a little more like himself is a win. </p>
</div>
<div class="greyBox same">
<h5>Rank <strong>7</strong></h5>
<div class="team-info">
<img class="team-img img-top" alt="logo" src="https://i.imgur.com/ot2QfjH.jpg">
<p>
<span class="team-name"> Gib-me-Son More Don Julio</span> <span class="record"> (1-2)</span> <br>
<span class="name"> Aaron Lam</span> <br>
<h5 class="previous">Total Points: 361 | Previous rank: #7 </h5>
</p>
<!-- <img class="up-down" src="../assets/images/up.png"> -->
</div>
<p class="write-up"> Only one point from Tonyan hurts. Again, white people are the worst. </p>
</div>
<div class="greyBox up">
<h5>Rank <strong>8</strong></h5>
<div class="team-info">
<img class="team-img" alt="logo" src="https://g.espncdn.com/lm-static/logo-packs/core/Solo/ESPN_Star_Wars_Chebacca-01.svg">
<p>
<span class="team-name"> Pour One For Mahomies</span> <span class="record">(2-1)</span> <br>
<span class="name"> Josh Dasch</span> <br>
<h5 class="previous">Total Points: 285 | Previous rank: #10</h5>
</p>
<img class="up-down" src="../assets/images/up.png">
</div>
<p class="write-up"> Only the first time over 100 points this year. However, that doesn’t matter the two wins do. </p>
</div>
<div class="greyBox up">
<h5>Rank <strong>9</strong></h5>
<div class="team-info">
<img class="team-img img-top" alt="logo" src=" https://media.customon.com/unsafe/600x600/img.customon.com//art/2/600/600/0a0909/90786/31da3b92cc70068762dde6bef261ecef.png.jpg">
<p>
<span class="team-name"> CeeDeez Nuts </span> <span class="record">(1-2)</span><br>
<span class="name"> Michael Gragg</span> <br>
<h5 class="previous">Total Points: 342 | Previous rank: #11</h5>
</p>
<img class="up-down" src="../assets/images/up.png">
</div>
<p class="write-up"> First Davante Adams type game. First Win. </p>
</div>
<div class="greyBox down">
<h5>Rank <strong>10</strong></h5>
<div class="team-info">
<img class="team-img" alt="logo" src="https://i2-prod.mirror.co.uk/incoming/article8454421.ece/ALTERNATES/s615b/Team-America-World-Police-1.jpg">
<p>
<span class="team-name"> Pound My Hole</span> <span class="record">(1-2)</span> <br>
<span class="name"> Bryan Opaskar</span> <br>
<h5 class="previous">Total Points: 337 | Previous rank: #9</h5>
</p>
<img class="up-down" src="../assets/images/down.png">
<img class="up-down2" src="../assets/images/down.png">
</div>
<p class="write-up"> 135 points in week 1, 115 points in week 2, and 87 points in week 3. If I could give you two red arrow images I would... Oh wait I can. </p>
</div>
<div class="greyBox down">
<h5>Rank <strong>11</strong></h5>
<div class="team-info">
<img class="team-img" alt="logo" src=" https://g.espncdn.com/lm-static/logo-packs/core/RalphBreaksTheInternet/ralph-13.svg">
<p>
<span class="team-name"> Blue Balls</span> <span class="record">(1-2)</span> <br>
<span class="name"> Kevin Mullinger</span> <br>
<h5 class="previous">Total Points: 333 | Previous rank: #8</h5>
</p>
<img class="up-down" src="../assets/images/down.png">
</div>
<p class="write-up"> 4 points is the only thing keeping you from last place. </p>
</div>
<div class="greyBox same">
<h5>Rank <strong>12</strong></h5>
<div class="team-info">
<img class="team-img" alt="logo" src="https://i.imgur.com/DWgU4Qx.png">
<p>
<span class="team-name"> Solid Poo </span> <span class="record">(1-2)</span> <br>
<span class="name"> Brian Havrilla</span> <br>
<h5 class="previous">Total Points: 329 | Previous rank: #12</h5>
</p>
<img class="up-down" src="../assets/images/same.png">
</div>
<p class="write-up"> All of sudden has two of the best RBs in Payton Barber and Sermon. Joking, but only partly because the two of them put up 34 total points last week. </p>
</div>
</div>
<footer> <center><a target="new" href="https://fantasy.espn.com/football/league?leagueId=496193">League Home page</a></center></footer>
</body>
</html>
| 35.536184 | 259 | 0.538832 |
2a5f7cb885e3832d06924e66fd7b2abf1b979930 | 21,464 | dart | Dart | lib/src/generated/core_data/NSSQLEntity.dart | rodydavis/cupertino_ffi_generated | 4d59f68921a5ae1ba58831c9de83ea0d7979148f | [
"MIT"
] | 2 | 2021-05-10T01:24:08.000Z | 2021-12-13T10:24:41.000Z | lib/src/generated/core_data/NSSQLEntity.dart | rodydavis/cupertino_ffi_generated | 4d59f68921a5ae1ba58831c9de83ea0d7979148f | [
"MIT"
] | null | null | null | lib/src/generated/core_data/NSSQLEntity.dart | rodydavis/cupertino_ffi_generated | 4d59f68921a5ae1ba58831c9de83ea0d7979148f | [
"MIT"
] | null | null | null | // AUTOMATICALLY GENERATED. DO NOT EDIT.
part of cupertino_ffi.core_data;
/// Static methods for Objective-C class `NSSQLEntity`.
/// See also instance methods in [NSSQLEntityPointer].
///
/// Find detailed documentation at: [developer.apple.com/documentation/coredata?language=objc](https://developer.apple.com/documentation/coredata?language=objc)
class NSSQLEntity extends Struct {
/// Allocates a new instance of NSSQLEntity.
static Pointer<NSSQLEntity> allocate() {
_ensureDynamicLibraryHasBeenOpened();
return _objc.allocateByClassName<NSSQLEntity>('NSSQLEntity');
}
}
/// Instance methods for [NSSQLEntity] (Objective-C class `NSSQLEntity`).
///
/// Find detailed documentation at: [developer.apple.com/documentation/coredata?language=objc](https://developer.apple.com/documentation/coredata?language=objc)
extension NSSQLEntityPointer on Pointer<NSSQLEntity> {
/// Objective-C method `addPropertiesForReadOnlyFetch:keys:context:`.
@ObjcMethodInfo(
selector: 'addPropertiesForReadOnlyFetch:keys:context:',
returnType: 'c',
parameterTypes: ['@', ':', '@', '@', '@'],
)
int addPropertiesForReadOnlyFetch(
Pointer arg, {
@required Pointer keys,
@required Pointer context,
}) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_ptr_ptr_returns_int8(
this,
_objc.getSelector(
'addPropertiesForReadOnlyFetch:keys:context:',
),
arg,
keys,
context,
);
}
/// Objective-C method `addUniqueAttribute:`.
@ObjcMethodInfo(
selector: 'addUniqueAttribute:',
returnType: 'v',
parameterTypes: ['@', ':', '@'],
)
Pointer addUniqueAttribute(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'addUniqueAttribute:',
),
arg,
);
}
/// Objective-C method `attributeColumns`.
@ObjcMethodInfo(
selector: 'attributeColumns',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer attributeColumns() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'attributeColumns',
),
);
}
/// Objective-C method `attributeNamed:`.
@ObjcMethodInfo(
selector: 'attributeNamed:',
returnType: '@',
parameterTypes: ['@', ':', '@'],
)
Pointer attributeNamed(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'attributeNamed:',
),
arg,
);
}
/// Objective-C method `attributes`.
@ObjcMethodInfo(
selector: 'attributes',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer attributes() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'attributes',
),
);
}
/// Objective-C method `binaryIndexForIndexDescription:`.
@ObjcMethodInfo(
selector: 'binaryIndexForIndexDescription:',
returnType: '@',
parameterTypes: ['@', ':', '@'],
)
Pointer binaryIndexForIndexDescription(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'binaryIndexForIndexDescription:',
),
arg,
);
}
/// Objective-C method `columnsToCreate`.
@ObjcMethodInfo(
selector: 'columnsToCreate',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer columnsToCreate() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'columnsToCreate',
),
);
}
/// Objective-C method `columnsToFetch`.
@ObjcMethodInfo(
selector: 'columnsToFetch',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer columnsToFetch() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'columnsToFetch',
),
);
}
/// Objective-C method `copyValuesForReadOnlyFetch:`.
@ObjcMethodInfo(
selector: 'copyValuesForReadOnlyFetch:',
returnType: 'v',
parameterTypes: ['@', ':', '@'],
)
Pointer copyValuesForReadOnlyFetch(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'copyValuesForReadOnlyFetch:',
),
arg,
);
}
/// Objective-C method `description`.
@ObjcMethodInfo(
selector: 'description',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer description() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'description',
),
);
}
/// Objective-C method `entityDescription`.
@ObjcMethodInfo(
selector: 'entityDescription',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer entityDescription() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'entityDescription',
),
);
}
/// Objective-C method `entityID`.
@ObjcMethodInfo(
selector: 'entityID',
returnType: 'I',
parameterTypes: ['@', ':'],
)
int entityID() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_uint32(
this,
_objc.getSelector(
'entityID',
),
);
}
/// Objective-C method `externalName`.
@ObjcMethodInfo(
selector: 'externalName',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer externalName() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'externalName',
),
);
}
/// Objective-C method `fetchIndexForKey:`.
@ObjcMethodInfo(
selector: 'fetchIndexForKey:',
returnType: 'I',
parameterTypes: ['@', ':', '@'],
)
int fetchIndexForKey(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_uint32(
this,
_objc.getSelector(
'fetchIndexForKey:',
),
arg,
);
}
/// Objective-C method `finalize`.
@ObjcMethodInfo(
selector: 'finalize',
returnType: 'v',
parameterTypes: ['@', ':'],
)
Pointer finalize() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'finalize',
),
);
}
/// Objective-C method `foreignEntityKeyColumns`.
@ObjcMethodInfo(
selector: 'foreignEntityKeyColumns',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer foreignEntityKeyColumns() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'foreignEntityKeyColumns',
),
);
}
/// Objective-C method `foreignKeyColumns`.
@ObjcMethodInfo(
selector: 'foreignKeyColumns',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer foreignKeyColumns() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'foreignKeyColumns',
),
);
}
/// Objective-C method `foreignOrderKeyColumns`.
@ObjcMethodInfo(
selector: 'foreignOrderKeyColumns',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer foreignOrderKeyColumns() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'foreignOrderKeyColumns',
),
);
}
/// Objective-C method `hasAttributesWithExternalDataReferences`.
@ObjcMethodInfo(
selector: 'hasAttributesWithExternalDataReferences',
returnType: 'c',
parameterTypes: ['@', ':'],
)
int hasAttributesWithExternalDataReferences() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_int8(
this,
_objc.getSelector(
'hasAttributesWithExternalDataReferences',
),
);
}
/// Objective-C method `hasAttributesWithFileBackedFutures`.
@ObjcMethodInfo(
selector: 'hasAttributesWithFileBackedFutures',
returnType: 'c',
parameterTypes: ['@', ':'],
)
int hasAttributesWithFileBackedFutures() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_int8(
this,
_objc.getSelector(
'hasAttributesWithFileBackedFutures',
),
);
}
/// Objective-C method `hasInheritance`.
@ObjcMethodInfo(
selector: 'hasInheritance',
returnType: 'c',
parameterTypes: ['@', ':'],
)
int hasInheritance() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_int8(
this,
_objc.getSelector(
'hasInheritance',
),
);
}
/// Objective-C method `hasSubentities`.
@ObjcMethodInfo(
selector: 'hasSubentities',
returnType: 'c',
parameterTypes: ['@', ':'],
)
int hasSubentities() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_int8(
this,
_objc.getSelector(
'hasSubentities',
),
);
}
/// Objective-C method `indexForIndexDescription:`.
@ObjcMethodInfo(
selector: 'indexForIndexDescription:',
returnType: '@',
parameterTypes: ['@', ':', '@'],
)
Pointer indexForIndexDescription(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'indexForIndexDescription:',
),
arg,
);
}
/// Objective-C method `initWithModel:entityDescription:`.
@ObjcMethodInfo(
selector: 'initWithModel:entityDescription:',
returnType: '@',
parameterTypes: ['@', ':', '@', '@'],
)
Pointer initWithModel(
Pointer arg, {
@required Pointer entityDescription,
}) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'initWithModel:entityDescription:',
),
arg,
entityDescription,
);
}
/// Objective-C method `isKindOfSQLEntity:`.
@ObjcMethodInfo(
selector: 'isKindOfSQLEntity:',
returnType: 'c',
parameterTypes: ['@', ':', '@'],
)
int isKindOfSQLEntity(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_int8(
this,
_objc.getSelector(
'isKindOfSQLEntity:',
),
arg,
);
}
/// Objective-C method `isRootEntity`.
@ObjcMethodInfo(
selector: 'isRootEntity',
returnType: 'c',
parameterTypes: ['@', ':'],
)
int isRootEntity() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_int8(
this,
_objc.getSelector(
'isRootEntity',
),
);
}
/// Objective-C method `manyToManyRelationships`.
@ObjcMethodInfo(
selector: 'manyToManyRelationships',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer manyToManyRelationships() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'manyToManyRelationships',
),
);
}
/// Objective-C method `mappingGenerator`.
@ObjcMethodInfo(
selector: 'mappingGenerator',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer mappingGenerator() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'mappingGenerator',
),
);
}
/// Objective-C method `model`.
@ObjcMethodInfo(
selector: 'model',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer model() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'model',
),
);
}
/// Objective-C method `multicolumnUniquenessConstraints`.
@ObjcMethodInfo(
selector: 'multicolumnUniquenessConstraints',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer multicolumnUniquenessConstraints() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'multicolumnUniquenessConstraints',
),
);
}
/// Objective-C method `name`.
@ObjcMethodInfo(
selector: 'name',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer name() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'name',
),
);
}
/// Objective-C method `optLockKey`.
@ObjcMethodInfo(
selector: 'optLockKey',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer optLockKey() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'optLockKey',
),
);
}
/// Objective-C method `primaryKey`.
@ObjcMethodInfo(
selector: 'primaryKey',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer primaryKey() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'primaryKey',
),
);
}
/// Objective-C method `properties`.
@ObjcMethodInfo(
selector: 'properties',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer properties() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'properties',
),
);
}
/// Objective-C method `propertiesByName`.
@ObjcMethodInfo(
selector: 'propertiesByName',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer propertiesByName() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'propertiesByName',
),
);
}
/// Objective-C method `propertyMapping`.
@ObjcMethodInfo(
selector: 'propertyMapping',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer propertyMapping() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'propertyMapping',
),
);
}
/// Objective-C method `propertyNamed:`.
@ObjcMethodInfo(
selector: 'propertyNamed:',
returnType: '@',
parameterTypes: ['@', ':', '@'],
)
Pointer propertyNamed(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'propertyNamed:',
),
arg,
);
}
/// Objective-C method `relationshipNamed:`.
@ObjcMethodInfo(
selector: 'relationshipNamed:',
returnType: '@',
parameterTypes: ['@', ':', '@'],
)
Pointer relationshipNamed(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'relationshipNamed:',
),
arg,
);
}
/// Objective-C method `rootEntity`.
@ObjcMethodInfo(
selector: 'rootEntity',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer rootEntity() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'rootEntity',
),
);
}
/// Objective-C method `rtreeIndexForIndexDescription:`.
@ObjcMethodInfo(
selector: 'rtreeIndexForIndexDescription:',
returnType: '@',
parameterTypes: ['@', ':', '@'],
)
Pointer rtreeIndexForIndexDescription(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'rtreeIndexForIndexDescription:',
),
arg,
);
}
/// Objective-C method `rtreeIndexForIndexNamed:`.
@ObjcMethodInfo(
selector: 'rtreeIndexForIndexNamed:',
returnType: '@',
parameterTypes: ['@', ':', '@'],
)
Pointer rtreeIndexForIndexNamed(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'rtreeIndexForIndexNamed:',
),
arg,
);
}
/// Objective-C method `rtreeIndexes`.
@ObjcMethodInfo(
selector: 'rtreeIndexes',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer rtreeIndexes() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'rtreeIndexes',
),
);
}
/// Objective-C method `setEntityID:`.
@ObjcMethodInfo(
selector: 'setEntityID:',
returnType: 'v',
parameterTypes: ['@', ':', 'I'],
)
Pointer setEntityID(
int arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_uint32_returns_ptr(
this,
_objc.getSelector(
'setEntityID:',
),
arg,
);
}
/// Objective-C method `setSubentities:`.
@ObjcMethodInfo(
selector: 'setSubentities:',
returnType: 'v',
parameterTypes: ['@', ':', '@'],
)
Pointer setSubentities(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'setSubentities:',
),
arg,
);
}
/// Objective-C method `setSuperentity:`.
@ObjcMethodInfo(
selector: 'setSuperentity:',
returnType: 'v',
parameterTypes: ['@', ':', '@'],
)
Pointer setSuperentity(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'setSuperentity:',
),
arg,
);
}
/// Objective-C method `subentities`.
@ObjcMethodInfo(
selector: 'subentities',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer subentities() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'subentities',
),
);
}
/// Objective-C method `subentityKey`.
@ObjcMethodInfo(
selector: 'subentityKey',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer subentityKey() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'subentityKey',
),
);
}
/// Objective-C method `subentityMaxID`.
@ObjcMethodInfo(
selector: 'subentityMaxID',
returnType: 'I',
parameterTypes: ['@', ':'],
)
int subentityMaxID() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_uint32(
this,
_objc.getSelector(
'subentityMaxID',
),
);
}
/// Objective-C method `superentity`.
@ObjcMethodInfo(
selector: 'superentity',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer superentity() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'superentity',
),
);
}
/// Objective-C method `tableName`.
@ObjcMethodInfo(
selector: 'tableName',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer tableName() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'tableName',
),
);
}
/// Objective-C method `tempTableName`.
@ObjcMethodInfo(
selector: 'tempTableName',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer tempTableName() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'tempTableName',
),
);
}
/// Objective-C method `toManyRelationships`.
@ObjcMethodInfo(
selector: 'toManyRelationships',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer toManyRelationships() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'toManyRelationships',
),
);
}
/// Objective-C method `uniqueAttributes`.
@ObjcMethodInfo(
selector: 'uniqueAttributes',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer uniqueAttributes() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'uniqueAttributes',
),
);
}
/// Objective-C method `virtualForeignKeyColumns`.
@ObjcMethodInfo(
selector: 'virtualForeignKeyColumns',
returnType: '@',
parameterTypes: ['@', ':'],
)
Pointer virtualForeignKeyColumns() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'virtualForeignKeyColumns',
),
);
}
}
| 22.85836 | 160 | 0.62882 |
c51d759665b923e2647d69ca37940a1288f28e54 | 110,572 | cxx | C++ | main/sw/source/filter/html/css1atr.cxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 679 | 2015-01-06T06:34:58.000Z | 2022-03-30T01:06:03.000Z | main/sw/source/filter/html/css1atr.cxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 102 | 2017-11-07T08:51:31.000Z | 2022-03-17T12:13:49.000Z | main/sw/source/filter/html/css1atr.cxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 331 | 2015-01-06T11:40:55.000Z | 2022-03-14T04:07:51.000Z | /**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*
*************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
#include "hintids.hxx"
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
#include <svl/whiter.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/ulspitem.hxx>
#include <editeng/udlnitem.hxx>
#include <editeng/crsditem.hxx>
#include <editeng/blnkitem.hxx>
#include <editeng/cmapitem.hxx>
#include <editeng/colritem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/postitem.hxx>
#include <editeng/kernitem.hxx>
#include <editeng/wghtitem.hxx>
#include <editeng/lspcitem.hxx>
#include <editeng/adjitem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/ulspitem.hxx>
#include <editeng/brshitem.hxx>
#include <editeng/brkitem.hxx>
#include <editeng/keepitem.hxx>
#include <editeng/widwitem.hxx>
#include <editeng/spltitem.hxx>
#include <editeng/orphitem.hxx>
#include <svx/xoutbmp.hxx>
#include <svx/svdobj.hxx>
#include <editeng/langitem.hxx>
#include <editeng/frmdiritem.hxx>
#include <svtools/htmlout.hxx>
#include <svtools/htmlkywd.hxx>
#include <svx/htmlmode.hxx>
#include <svl/urihelper.hxx>
#include <tools/urlobj.hxx>
#include <tools/bigint.hxx>
#include <unotools/charclass.hxx>
#include <i18npool/mslangid.hxx>
#include <charfmt.hxx>
#include <fmtcol.hxx>
#include <fmtfsize.hxx>
#include <fmtornt.hxx>
#include <fmtpdsc.hxx>
#include <fmtlsplt.hxx>
#include <pagedesc.hxx>
#include <fmtanchr.hxx>
#include <docary.hxx>
#include <pam.hxx>
#include <viewsh.hxx>
#include <viewopt.hxx>
#include <swtable.hxx>
// OTES
#include <ftninfo.hxx>
#include <ftnidx.hxx>
#include <txtftn.hxx>
#include <fmtftn.hxx>
// FOOTNOTES
#include "doc.hxx"
#include "swerror.h"
#include "charatr.hxx"
#include "paratr.hxx"
#include "frmatr.hxx"
#include "poolfmt.hxx"
#include "fltini.hxx"
#include "css1kywd.hxx"
#include "wrthtml.hxx"
#include "htmlnum.hxx"
#include <IDocumentStylePoolAccess.hxx>
#include <numrule.hxx>
/*
* um nicht immer wieder nach einem Update festzustellen, das irgendwelche
* Hint-Ids dazugekommen sind, wird hier definiert, die Groesse der Tabelle
* definiert und mit der akt. verglichen. Bei unterschieden wird der
* Compiler schon meckern.
*
* diese Section und die dazugeherigen Tabellen muessen in folgenden Files
* gepflegt werden: rtf\rtfatr.cxx, sw6\sw6atr.cxx, w4w\w4watr.cxx
*/
#if !defined(UNX) && !defined(MSC) && !defined(PPC) && !defined(CSET) && !defined(__MWERKS__) && !defined(WTC) && !defined(__MINGW32__) && !defined(OS2)
#define ATTRFNTAB_SIZE 130
#if ATTRFNTAB_SIZE != POOLATTR_END - POOLATTR_BEGIN
#error Attribut-Tabelle ist ungueltigt. Wurden neue Hint-IDs zugefuegt ??
#endif
#endif
#define HTML_HEADSPACE (12*20)
#define CSS1_BACKGROUND_ATTR 1
#define CSS1_BACKGROUND_PAGE 2
#define CSS1_BACKGROUND_TABLE 3
#define CSS1_BACKGROUND_FLY 4
#define CSS1_BACKGROUND_SECTION 5
#define CSS1_FRMSIZE_WIDTH 0x01
#define CSS1_FRMSIZE_VARHEIGHT 0x02
#define CSS1_FRMSIZE_MINHEIGHT 0x04
#define CSS1_FRMSIZE_FIXHEIGHT 0x08
#define CSS1_FRMSIZE_ANYHEIGHT 0x0e
#define CSS1_FRMSIZE_PIXEL 0x10
using namespace ::com::sun::star;
//-----------------------------------------------------------------------
sal_Char __FAR_DATA CSS1_CONSTASCII_DEF( sCSS1_rule_end, " }" );
sal_Char __FAR_DATA CSS1_CONSTASCII_DEF( sCSS1_span_tag_end, "\">" );
const sal_Char cCSS1_style_opt_end = '\"';
sal_Char __FAR_DATA CSS1_CONSTASCII_DEF( sHTML_FTN_fontheight, "57%" );
extern SwAttrFnTab aCSS1AttrFnTab;
static Writer& OutCSS1_SwFmt( Writer& rWrt, const SwFmt& rFmt,
IDocumentStylePoolAccess /*SwDoc*/ *pDoc, SwDoc *pTemplate );
static Writer& OutCSS1_SwPageDesc( Writer& rWrt, const SwPageDesc& rFmt,
IDocumentStylePoolAccess /*SwDoc*/ *pDoc, SwDoc *pTemplate,
sal_uInt16 nRefPoolId, sal_Bool bExtRef,
sal_Bool bPseudo=sal_True );
static Writer& OutCSS1_SwFtnInfo( Writer& rWrt, const SwEndNoteInfo& rInfo,
SwDoc *pDoc, sal_uInt16 nNotes, sal_Bool bEndNote );
static void OutCSS1_SwFmtDropAttrs( SwHTMLWriter& rHWrt,
const SwFmtDrop& rDrop,
const SfxItemSet *pCharFmtItemSet=0 );
static Writer& OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink( Writer& rWrt,
const SvxUnderlineItem *pUItem,
const SvxOverlineItem *pOItem,
const SvxCrossedOutItem *pCOItem,
const SvxBlinkItem *pBItem );
static Writer& OutCSS1_SvxFontWeight( Writer& rWrt, const SfxPoolItem& rHt );
static Writer& OutCSS1_SvxPosture( Writer& rWrt, const SfxPoolItem& rHt );
static Writer& OutCSS1_SvxULSpace( Writer& rWrt, const SfxPoolItem& rHt );
static Writer& OutCSS1_SvxLRSpace( Writer& rWrt, const SfxPoolItem& rHt );
static Writer& OutCSS1_SvxULSpace_SvxLRSpace( Writer& rWrt,
const SvxULSpaceItem *pULSpace,
const SvxLRSpaceItem *pLRSpace );
static Writer& OutCSS1_SvxULSpace_SvxLRSpace( Writer& rWrt,
const SfxItemSet& rItemSet,
sal_Bool bDeep );
static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt,
sal_uInt16 nMode, const String *pGrfName );
static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt );
static Writer& OutCSS1_SvxBox( Writer& rWrt, const SfxPoolItem& rHt );
static Writer& OutCSS1_SwFmtFrmSize( Writer& rWrt, const SfxPoolItem& rHt,
sal_uInt16 nMode );
static Writer& OutCSS1_SvxFmtBreak_SwFmtPDesc_SvxFmtKeep( Writer& rWrt,
const SfxItemSet& rItemSet,
sal_Bool bDeep );
static Writer& OutCSS1_SwFmtLayoutSplit( Writer& rWrt, const SfxPoolItem& rHt );
static void ConvToHex( sal_uInt16 nHex, ByteString& rStr )
{
sal_Char aNToABuf[] = "00";
// Pointer an das Bufferende setzen
sal_Char *pStr = aNToABuf + (sizeof(aNToABuf)-1);
for( sal_uInt8 n = 0; n < 2; ++n )
{
*(--pStr) = (sal_Char)(nHex & 0xf ) + 48;
if( *pStr > '9' )
*pStr += 39;
nHex >>= 4;
}
rStr.Append( aNToABuf );
}
static void GetCSS1Color( const Color& rColor, ByteString& rStr )
{
rStr += '#';
ConvToHex( rColor.GetRed(), rStr );
ConvToHex( rColor.GetGreen(), rStr );
ConvToHex( rColor.GetBlue(), rStr );
}
class SwCSS1OutMode
{
SwHTMLWriter& rWrt;
sal_uInt16 nOldMode;
public:
SwCSS1OutMode( SwHTMLWriter& rHWrt, sal_uInt16 nMode, sal_Bool bStartFirst=sal_True,
const String *pSelector=0 ) :
rWrt( rHWrt ),
nOldMode( rHWrt.nCSS1OutMode )
{
rWrt.nCSS1OutMode = nMode;
if( bStartFirst )
rWrt.bFirstCSS1Property = sal_True;
if( pSelector )
rWrt.aCSS1Selector = *pSelector;
}
~SwCSS1OutMode()
{
rWrt.nCSS1OutMode = nOldMode;
}
};
void SwHTMLWriter::OutCSS1_Property( const sal_Char *pProp,
const sal_Char *pVal,
const String *pSVal )
{
ByteString sOut;
if( bFirstCSS1Rule && (nCSS1OutMode & CSS1_OUTMODE_RULE_ON)!=0 )
{
bFirstCSS1Rule = sal_False;
OutNewLine();
((((sOut += '<') += OOO_STRING_SVTOOLS_HTML_style) += ' ') += OOO_STRING_SVTOOLS_HTML_O_type) += "=\"text/css\">";
Strm() << sOut.GetBuffer();
sOut.Erase();
OutNewLine();
Strm() << '<' << OOO_STRING_SVTOOLS_HTML_comment;
IncIndentLevel();
}
if( bFirstCSS1Property )
{
switch( nCSS1OutMode & CSS1_OUTMODE_ANY_ON )
{
case CSS1_OUTMODE_SPAN_TAG_ON:
case CSS1_OUTMODE_SPAN_TAG1_ON:
if( bTagOn )
{
((((sOut += '<') += OOO_STRING_SVTOOLS_HTML_span) += ' ') += OOO_STRING_SVTOOLS_HTML_O_style) += "=\"";
}
else
{
HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_span, sal_False );
return;
}
break;
case CSS1_OUTMODE_RULE_ON:
{
ByteString sTmp( aCSS1Selector, eDestEnc );
OutNewLine();
(sOut = sTmp) += " { ";
}
break;
case CSS1_OUTMODE_STYLE_OPT_ON:
((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_style) += "=\"";
break;
}
bFirstCSS1Property = sal_False;
}
else
{
sOut += "; ";
}
(sOut += pProp) += ": ";
if( nCSS1OutMode & CSS1_OUTMODE_ENCODE )
{
// In STYLE-Optionen den String codieren
Strm() << sOut.GetBuffer();
sOut.Erase();
if( pVal )
HTMLOutFuncs::Out_String( Strm(), String::CreateFromAscii(pVal),
eDestEnc, &aNonConvertableCharacters );
else if( pSVal )
HTMLOutFuncs::Out_String( Strm(), *pSVal, eDestEnc, &aNonConvertableCharacters );
}
else
{
// Im STYLE-Tag des String direct ausgeben
if( pVal )
sOut += pVal;
else if( pSVal )
{
ByteString sTmp( *pSVal, eDestEnc );
sOut += sTmp;
}
}
if( sOut.Len() )
Strm() << sOut.GetBuffer();
}
static void AddUnitPropertyValue( long nVal, FieldUnit eUnit, ByteString& rOut )
{
if( nVal < 0 )
{
// Vorzeichen extra behandeln
nVal = -nVal;
rOut += '-';
}
// Die umgerechnete Einheit ergibt sich aus (x * nMul)/(nDiv*nFac*10)
long nMul = 1000;
long nDiv = 1;
long nFac = 100;
const sal_Char *pUnit;
switch( eUnit )
{
case FUNIT_100TH_MM:
ASSERT( FUNIT_MM == eUnit, "Masseinheit wird nicht unterstuetzt" );
case FUNIT_MM:
// 0.01mm = 0.57twip
nMul = 25400; // 25.4 * 1000
nDiv = 1440; // 72 * 20;
nFac = 100;
pUnit = sCSS1_UNIT_mm;
break;
case FUNIT_M:
case FUNIT_KM:
ASSERT( FUNIT_CM == eUnit, "Masseinheit wird nicht unterstuetzt" );
case FUNIT_CM:
#ifdef EXACT_VALUES
// 0.001cm = 0.57twip
nMul = 25400; // 2.54 * 10000
nDiv = 1440; // 72 * 20;
nFac = 1000;
#else
// 0.01cm = 5.7twip (ist zwar ungenau, aber die UI ist auch ungenau)
nMul = 2540; // 2.54 * 1000
nDiv = 1440; // 72 * 20;
nFac = 100;
#endif
pUnit = sCSS1_UNIT_cm;
break;
case FUNIT_TWIP:
ASSERT( FUNIT_POINT == eUnit, "Masseinheit wird nicht unterstuetzt" );
case FUNIT_POINT:
#ifdef EXACT_VALUES
// 0.01pt = 0.2twip
nMul = 1000;
nDiv = 20;
nFac = 100;
#else
// 0.1pt = 2.0twip (ist zwar ungenau, aber die UI ist auch ungenau)
nMul = 100;
nDiv = 20;
nFac = 10;
#endif
pUnit = sCSS1_UNIT_pt;
break;
case FUNIT_PICA:
#ifdef EXACT_VALUES
// 0.001pc = 0.24twip
nMul = 10000;
nDiv = 12 * 20;
nFac = 1000;
#else
// 0.01pc = 2.40twip (ist zwar ungenau, aber die UI ist auch ungenau)
nMul = 1000;
nDiv = 240; // 12 * 20;
nFac = 100;
#endif
pUnit = sCSS1_UNIT_pc;
break;
case FUNIT_NONE:
case FUNIT_FOOT:
case FUNIT_MILE:
case FUNIT_CUSTOM:
case FUNIT_PERCENT:
case FUNIT_INCH:
default:
ASSERT( FUNIT_INCH == eUnit, "Masseinheit wird nicht unterstuetzt" );
#ifdef EXACT_VALUES
// 0.0001in = 0.144twip
nMul = 100000;
nDiv = 1440; // 72 * 20;
nFac = 10000;
#else
// 0.01in = 14.4twip (ist zwar ungenau, aber die UI ist auch ungenau)
nMul = 1000;
nDiv = 1440; // 72 * 20;
nFac = 100;
#endif
pUnit = sCSS1_UNIT_inch;
break;
}
long nLongVal = 0;
sal_Bool bOutLongVal = sal_True;
if( nVal > LONG_MAX / nMul )
{
// Zum Unrechnen der Einheit wird ein BigInt benoetigt
#ifdef SAL_INT64_IS_STRUCT
BigInt nBigVal( nVal );
nBigVal *= nMul;
nBigVal /= nDiv;
nBigVal += 5;
nBigVal /= 10;
if( nBigVal.IsLong() )
{
// Zum Ausgeben des Wertes reicht ein long.
nLongVal = (long)nBigVal;
}
else
{
BigInt nBigFac( nFac );
BigInt nBig10( 10 );
rOut += (long)(nBigVal / nBigFac);
if( !(nBigVal % nBigFac).IsZero() )
{
rOut += '.';
while( nFac > 1 && !(nBigVal % nBigFac).IsZero() )
{
nFac /= 10;
nBigFac = nFac;
rOut += (int)((nBigVal / nBigFac) % nBig10 );
}
}
bOutLongVal = sal_False;
}
#else
sal_Int64 nBigVal( nVal );
nBigVal *= nMul;
nBigVal /= nDiv;
nBigVal += 5;
nBigVal /= 10;
if( nBigVal <= LONG_MAX )
{
// Zum Ausgeben des Wertes reicht ein long.
nLongVal = (long)nBigVal;
}
else
{
rOut += ByteString::CreateFromInt64( nBigVal / (sal_Int64)nFac );
if( (nBigVal % (sal_Int64)nFac) != 0 )
{
rOut += '.';
while( nFac > 1 && (nBigVal % (sal_Int64)nFac) != 0 )
{
nFac /= 10;
rOut += ByteString::CreateFromInt64(
(nBigVal / (sal_Int64)nFac) % (sal_Int64)10 );
}
}
bOutLongVal = sal_False;
}
#endif
}
else
{
nLongVal = nVal * nMul;
nLongVal /= nDiv;
nLongVal += 5;
nLongVal /= 10;
}
if( bOutLongVal )
{
rOut += ByteString::CreateFromInt32( nLongVal/nFac );
if( (nLongVal % nFac) != 0 )
{
rOut += '.';
while( nFac > 1 && (nLongVal % nFac) != 0 )
{
nFac /= 10;
rOut += ByteString::CreateFromInt32( (nLongVal / nFac) % 10 );
}
}
}
rOut.Append( pUnit );
}
void SwHTMLWriter::OutCSS1_UnitProperty( const sal_Char *pProp, long nVal )
{
ByteString sOut;
AddUnitPropertyValue( nVal, eCSS1Unit, sOut );
OutCSS1_PropertyAscii( pProp, sOut );
}
void SwHTMLWriter::OutCSS1_PixelProperty( const sal_Char *pProp, long nVal,
sal_Bool bVert )
{
if( nVal && Application::GetDefaultDevice() )
{
Size aSz( bVert ? 0 : nVal, bVert ? nVal : 0 );
aSz = Application::GetDefaultDevice()->LogicToPixel( aSz, MapMode( MAP_TWIP) );
nVal = bVert ? aSz.Height() : aSz.Width();
if( !nVal )
nVal = 1;
}
ByteString sOut( ByteString::CreateFromInt32( nVal ) );
sOut.Append( sCSS1_UNIT_px );
OutCSS1_PropertyAscii( pProp, sOut );
}
void SwHTMLWriter::OutCSS1_SfxItemSet( const SfxItemSet& rItemSet,
sal_Bool bDeep )
{
// den ItemSet ausgeben, und zwar inklusive aller Attribute
Out_SfxItemSet( aCSS1AttrFnTab, *this, rItemSet, bDeep );
// ein par Attribute benoetigen eine Spezial-Behandlung
const SfxPoolItem *pItem = 0;
// Underline, Overline, CrossedOut und Blink bilden zusammen eine CSS1-Property
// (geht natuerlich nicht bei Hints)
if( !IsCSS1Source(CSS1_OUTMODE_HINT) )
{
const SvxUnderlineItem *pUnderlineItem = 0;
if( SFX_ITEM_SET==rItemSet.GetItemState( RES_CHRATR_UNDERLINE, bDeep, &pItem ))
pUnderlineItem = (const SvxUnderlineItem *)pItem;
const SvxOverlineItem *pOverlineItem = 0;
if( SFX_ITEM_SET==rItemSet.GetItemState( RES_CHRATR_OVERLINE, bDeep, &pItem ))
pOverlineItem = (const SvxOverlineItem *)pItem;
const SvxCrossedOutItem *pCrossedOutItem = 0;
if( SFX_ITEM_SET==rItemSet.GetItemState( RES_CHRATR_CROSSEDOUT, bDeep, &pItem ))
pCrossedOutItem = (const SvxCrossedOutItem *)pItem;
const SvxBlinkItem *pBlinkItem = 0;
if( SFX_ITEM_SET==rItemSet.GetItemState( RES_CHRATR_BLINK, bDeep, &pItem ))
pBlinkItem = (const SvxBlinkItem *)pItem;
if( pUnderlineItem || pOverlineItem || pCrossedOutItem || pBlinkItem )
OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink( *this, pUnderlineItem,
pOverlineItem,
pCrossedOutItem,
pBlinkItem );
OutCSS1_SvxFmtBreak_SwFmtPDesc_SvxFmtKeep( *this, rItemSet, bDeep );
}
if( !bFirstCSS1Property )
{
// wenn eine Property als Bestandteil einer Style-Option
// ausgegeben wurde, muss die Optiomn noch beendet werden
ByteString sOut;
switch( nCSS1OutMode & CSS1_OUTMODE_ANY_OFF )
{
case CSS1_OUTMODE_SPAN_TAG_OFF:
sOut = sCSS1_span_tag_end;
break;
case CSS1_OUTMODE_STYLE_OPT_OFF:
sOut = cCSS1_style_opt_end;
break;
case CSS1_OUTMODE_RULE_OFF:
sOut = sCSS1_rule_end;
break;
}
if( sOut.Len() )
Strm() << sOut.GetBuffer();
}
}
void SwHTMLWriter::OutStyleSheet( const SwPageDesc& rPageDesc, sal_Bool bUsed )
{
bFirstCSS1Rule = sal_True;
// Feature: PrintExt
if( IsHTMLMode(HTMLMODE_PRINT_EXT) )
{
const SwPageDesc *pFirstPageDesc = 0;
sal_uInt16 nFirstRefPoolId = RES_POOLPAGE_HTML;
bCSS1IgnoreFirstPageDesc = sal_True;
// Erstmal versuchen wir zu erraten, wie das Dokument so augebaut ist.
// Erlaubt sind nur die Vorlagen HTML, erste Seite, linke Seite und
// rechte Seite.
// Eine erste Seite wird nur exportiert, wenn die erste Seite auch
// wirklich die Vorlage "erste Seite" ist.
// Linke und rechte Seiten werden nur exportiert, wenn diese beiden
// Vorlagen untereinander verkettet werden.
// Wenn andere Vorlagen verwendet werden, wird nur in sehr einfachen
// Faellen etwas exportiert.
const SwPageDesc *pPageDesc = &rPageDesc;
const SwPageDesc *pFollow = rPageDesc.GetFollow();
if( RES_POOLPAGE_FIRST == pPageDesc->GetPoolFmtId() &&
pFollow != pPageDesc &&
!IsPoolUserFmt( pFollow->GetPoolFmtId() ) )
{
// Das Dokument hat eine erste Seite
pFirstPageDesc = pPageDesc;
pPageDesc = pFollow;
pFollow = pPageDesc->GetFollow();
}
IDocumentStylePoolAccess* pStylePoolAccess = getIDocumentStylePoolAccess();
if( pPageDesc == pFollow )
{
// Das Dokument ist einseitig. Egal welche Seite verwendet wird,
// es wird kein zweiseitiges Dokument daraus gemacht.
// Die Attributierung wird relativ zur HTML-Seitenvorlage
// aus der HTML-Vorlage exportiert.
OutCSS1_SwPageDesc( *this, *pPageDesc, pStylePoolAccess, pTemplate,
RES_POOLPAGE_HTML, sal_True, sal_False );
nFirstRefPoolId = pFollow->GetPoolFmtId();
}
else if( (RES_POOLPAGE_LEFT == pPageDesc->GetPoolFmtId() &&
RES_POOLPAGE_RIGHT == pFollow->GetPoolFmtId()) ||
(RES_POOLPAGE_RIGHT == pPageDesc->GetPoolFmtId() &&
RES_POOLPAGE_LEFT == pFollow->GetPoolFmtId()) )
{
// Das Dokument ist zweiseitig
OutCSS1_SwPageDesc( *this, *pPageDesc, pStylePoolAccess, pTemplate,
RES_POOLPAGE_HTML, sal_True );
OutCSS1_SwPageDesc( *this, *pFollow, pStylePoolAccess, pTemplate,
RES_POOLPAGE_HTML, sal_True );
nFirstRefPoolId = RES_POOLPAGE_RIGHT;
bCSS1IgnoreFirstPageDesc = sal_False;
}
// Alles andere bekommen wir nicht hin.
if( pFirstPageDesc )
OutCSS1_SwPageDesc( *this, *pFirstPageDesc, pStylePoolAccess, pTemplate,
nFirstRefPoolId, sal_False );
}
// /Feature: PrintExt
// The text body style has to be exported always (if it is changed compared
// to the template), because it is used as reference for any style
// that maps to <P>, and that's especially the standard style
getIDocumentStylePoolAccess()->GetTxtCollFromPool( RES_POOLCOLL_TEXT, false );
// das Default-TextStyle wir nicht mit ausgegeben !!
// das 0-Style ist das Default, wird nie ausgegeben !!
sal_uInt16 nArrLen = pDoc->GetTxtFmtColls()->Count();
sal_uInt16 i;
for( i = 1; i < nArrLen; i++ )
{
const SwTxtFmtColl* pColl = (*pDoc->GetTxtFmtColls())[i];
sal_uInt16 nPoolId = pColl->GetPoolFmtId();
if( !bUsed || nPoolId == RES_POOLCOLL_TEXT ||
pDoc->IsUsed( *pColl ) )
OutCSS1_SwFmt( *this, *pColl, pDoc, pTemplate );
}
// das Default-TextStyle wir nicht mit ausgegeben !!
nArrLen = pDoc->GetCharFmts()->Count();
for( i=1; i<nArrLen; i++ )
{
const SwCharFmt *pCFmt = (*pDoc->GetCharFmts())[i];
sal_uInt16 nPoolId = pCFmt->GetPoolFmtId();
if( !bUsed || nPoolId == RES_POOLCHR_INET_NORMAL ||
nPoolId == RES_POOLCHR_INET_VISIT ||
pDoc->IsUsed( *pCFmt ) )
OutCSS1_SwFmt( *this, *pCFmt, pDoc, pTemplate );
}
const SwFtnIdxs& rIdxs = pDoc->GetFtnIdxs();
nArrLen = rIdxs.Count();
sal_uInt16 nEnd = 0, nFtn = 0;
for( i=0; i < nArrLen; i++ )
{
if( rIdxs[i]->GetFtn().IsEndNote() )
nEnd++;
else
nFtn++;
}
OutCSS1_SwFtnInfo( *this, pDoc->GetFtnInfo(), pDoc, nFtn, sal_False );
OutCSS1_SwFtnInfo( *this, pDoc->GetEndNoteInfo(), pDoc, nEnd, sal_True );
if( !bFirstCSS1Rule )
{
DecIndentLevel();
OutNewLine();
Strm() << "-->";
OutNewLine();
HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_style, sal_False );
}
else
{
bFirstCSS1Rule = sal_False;
}
nDfltTopMargin = 0;
nDfltBottomMargin = 0;
}
//-----------------------------------------------------------------------
// wenn pPseudo gesetzt ist werden Styles-Sheets ausgegeben,
// sonst wird nur nach Token und Class fuer ein Format gesucht
sal_uInt16 SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, ByteString& rToken,
String& rClass, sal_uInt16& rRefPoolId,
String *pPseudo )
{
sal_uInt16 nDeep = 0;
rToken.Erase(); rClass.Erase();
rRefPoolId = 0;
if( pPseudo )
pPseudo->Erase();
sal_Bool bChrFmt = RES_CHRFMT==pFmt->Which();
// Nach oben die Formate abklappern, bis man auf eine Standard-
// oder eine HTML-Tag-Vorlage trifft
const SwFmt *pPFmt = pFmt;
while( pPFmt && !pPFmt->IsDefault() )
{
sal_Bool bStop = sal_False;
sal_uInt16 nPoolId = pPFmt->GetPoolFmtId();
if( USER_FMT & nPoolId )
{
// Benutzer-Vorlagen
const String& rNm = pPFmt->GetName();
switch( rNm.GetChar(0) )
{
// nicht mehr unterstuetzt:
// OOO_STRING_SVTOOLS_HTML_author
// OOO_STRING_SVTOOLS_HTML_acronym
// OOO_STRING_SVTOOLS_HTML_abbreviation
// OOO_STRING_SVTOOLS_HTML_deletedtext
// OOO_STRING_SVTOOLS_HTML_insertedtext
// OOO_STRING_SVTOOLS_HTML_language
// OOO_STRING_SVTOOLS_HTML_person
case 'B': if( !bChrFmt && rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_blockquote) )
{
rRefPoolId = RES_POOLCOLL_HTML_BLOCKQUOTE;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_blockquote );
}
break;
case 'C': if( bChrFmt )
{
if( rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_citiation) )
{
rRefPoolId = RES_POOLCHR_HTML_CITIATION;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_citiation );
}
else if( rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_code) )
{
rRefPoolId = RES_POOLCHR_HTML_CODE;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_code );
}
}
break;
case 'D': if( bChrFmt && rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_definstance) )
{
rRefPoolId = RES_POOLCHR_HTML_DEFINSTANCE;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_definstance);
}
else if( !bChrFmt )
{
sal_uInt16 nDefListLvl = GetDefListLvl( rNm, nPoolId );
// Die Vorlagen DD 1/DT 1 werden ausgegeben,
// aber keine von ihnen abgeleiteten Vorlagen,
// auch nicht DD 2/DT 2 etc.
if( nDefListLvl )
{
if( pPseudo &&
(nDeep || (nDefListLvl & 0x0fff) > 1) )
{
bStop = sal_True;
}
else if( nDefListLvl & HTML_DLCOLL_DD )
{
rRefPoolId = RES_POOLCOLL_HTML_DD;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_dd );
}
else
{
rRefPoolId = RES_POOLCOLL_HTML_DT;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_dt );
}
}
}
break;
case 'E': if( bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_emphasis ) )
{
rRefPoolId = RES_POOLCHR_HTML_EMPHASIS;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_emphasis );
}
break;
case 'H': if( !bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_horzrule ) )
// HR nicht ausgeben!
bStop = (nDeep==0);
break;
case 'K': if( bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_keyboard ) )
{
rRefPoolId = RES_POOLCHR_HTML_KEYBOARD;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_keyboard );
}
break;
case 'L': if( !bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_listing ) )
{
// Listing als PRE exportieren bzw. von
// PRE abgeleitete Vorlage exportieren
rToken.Assign( OOO_STRING_SVTOOLS_HTML_preformtxt );
rRefPoolId = RES_POOLCOLL_HTML_PRE;
nDeep = CSS1_FMT_CMPREF;
}
break;
case 'P': if( !bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_preformtxt ) )
{
rRefPoolId = RES_POOLCOLL_HTML_PRE;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_preformtxt );
}
break;
case 'S': if( bChrFmt )
{
if( rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_sample ) )
{
rRefPoolId = RES_POOLCHR_HTML_SAMPLE;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_sample );
}
else if( rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_strong ) )
{
rRefPoolId = RES_POOLCHR_HTML_STRONG;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_strong );
}
}
break;
case 'T': if( bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_teletype ) )
{
rRefPoolId = RES_POOLCHR_HTML_TELETYPE;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_teletype );
}
break;
case 'V': if( bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_variable ) )
{
rRefPoolId = RES_POOLCHR_HTML_VARIABLE;
rToken.Assign( OOO_STRING_SVTOOLS_HTML_variable );
}
break;
case 'X': if( !bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_xmp ) )
{
// XMP als PRE exportieren (aber nicht die
// Vorlage als Style)
rToken.Assign( OOO_STRING_SVTOOLS_HTML_preformtxt );
rRefPoolId = RES_POOLCOLL_HTML_PRE;
nDeep = CSS1_FMT_CMPREF;
}
break;
}
// Wenn eine PoolId gesetzt ist, entspricht der Name der
// Vorlage dem szugehoerigen Token
ASSERT( rRefPoolId != 0 == rToken.Len() > 0,
"Token missing" );
}
else
{
// Pool-Vorlagen
switch( nPoolId )
{
// Absatz-Vorlagen
case RES_POOLCOLL_HEADLINE_BASE:
case RES_POOLCOLL_STANDARD:
// diese Vorlagen nicht ausgeben
bStop = (nDeep==0);
break;
case RES_POOLCOLL_TEXT:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_parabreak );
break;
case RES_POOLCOLL_HEADLINE1:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_head1 );
break;
case RES_POOLCOLL_HEADLINE2:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_head2 );
break;
case RES_POOLCOLL_HEADLINE3:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_head3 );
break;
case RES_POOLCOLL_HEADLINE4:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_head4 );
break;
case RES_POOLCOLL_HEADLINE5:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_head5 );
break;
case RES_POOLCOLL_HEADLINE6:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_head6 );
break;
case RES_POOLCOLL_SENDADRESS:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_address );
break;
case RES_POOLCOLL_HTML_BLOCKQUOTE:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_blockquote );
break;
case RES_POOLCOLL_HTML_PRE:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_preformtxt );
break;
case RES_POOLCOLL_HTML_DD:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_dd );
break;
case RES_POOLCOLL_HTML_DT:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_dt );
break;
case RES_POOLCOLL_TABLE:
if( pPseudo )
{
rToken.Assign( OOO_STRING_SVTOOLS_HTML_tabledata );
rToken.Append( ' ' );
rToken.Append( OOO_STRING_SVTOOLS_HTML_parabreak );
}
else
rToken.Assign( OOO_STRING_SVTOOLS_HTML_parabreak );
break;
case RES_POOLCOLL_TABLE_HDLN:
if( pPseudo )
{
rToken.Assign( OOO_STRING_SVTOOLS_HTML_tableheader );
rToken.Append( ' ' );
rToken.Append( OOO_STRING_SVTOOLS_HTML_parabreak );
}
else
rToken.Assign( OOO_STRING_SVTOOLS_HTML_parabreak );
break;
case RES_POOLCOLL_HTML_HR:
// HR nicht ausgeben!
bStop = (nDeep==0);
break;
case RES_POOLCOLL_FOOTNOTE:
if( !nDeep )
{
rToken.Assign( OOO_STRING_SVTOOLS_HTML_parabreak );
rClass.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdfootnote );
rRefPoolId = RES_POOLCOLL_TEXT;
nDeep = CSS1_FMT_CMPREF;
}
break;
case RES_POOLCOLL_ENDNOTE:
if( !nDeep )
{
rToken.Assign( OOO_STRING_SVTOOLS_HTML_parabreak );
rClass.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdendnote );
rRefPoolId = RES_POOLCOLL_TEXT;
nDeep = CSS1_FMT_CMPREF;
}
break;
// Zeichen-Vorlagen
case RES_POOLCHR_HTML_EMPHASIS:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_emphasis );
break;
case RES_POOLCHR_HTML_CITIATION:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_citiation );
break;
case RES_POOLCHR_HTML_STRONG:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_strong );
break;
case RES_POOLCHR_HTML_CODE:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_code );
break;
case RES_POOLCHR_HTML_SAMPLE:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_sample );
break;
case RES_POOLCHR_HTML_KEYBOARD:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_keyboard );
break;
case RES_POOLCHR_HTML_VARIABLE:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_variable );
break;
case RES_POOLCHR_HTML_DEFINSTANCE:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_definstance );
break;
case RES_POOLCHR_HTML_TELETYPE:
rToken.Assign( OOO_STRING_SVTOOLS_HTML_teletype );
break;
case RES_POOLCHR_INET_NORMAL:
if( pPseudo )
{
rToken.Assign( OOO_STRING_SVTOOLS_HTML_anchor );
pPseudo->AssignAscii( sCSS1_link );
}
break;
case RES_POOLCHR_INET_VISIT:
if( pPseudo )
{
rToken.Assign( OOO_STRING_SVTOOLS_HTML_anchor );
pPseudo->AssignAscii( sCSS1_visited );
}
break;
}
// Wenn ein Token gesetzt ist, enthaelt nPoolId die dazugehoerige
// Vorlage
if( rToken.Len() && !rRefPoolId )
rRefPoolId = nPoolId;
}
if( rToken.Len() || bStop )
{
// Anhalten wenn eine HTML-Tag-Vorlage gefunden wurde
break;
}
else
{
// sonst weitersuchen
nDeep++;
pPFmt = pPFmt->DerivedFrom();
}
}
if( rToken.Len() )
{
// Es ist eine HTML-Tag-Vorlage
if( !nDeep )
nDeep = CSS1_FMT_ISTAG;
}
else
{
// Es ist keine HTML-Tag-Vorlage und auch keine davon abgeleitete
nDeep = 0;
}
if( nDeep > 0 && nDeep < CSS1_FMT_SPECIAL )
{
// Wenn die Vorlage von einer HTML-Vorlage abgeleitet ist,
// wird sie als <TOKEN>.<CLASS> exportiert, sonst als .<CLASS>.
// <CLASS> ergibt sich aus dem Namen der Vorlage durch entfernen
// aller Zeichen vor und inklusive dem ersten '.'
rClass = pFmt->GetName();
xub_StrLen nPos = rClass.Search( '.' );
if( nPos != STRING_NOTFOUND && rClass.Len() > nPos+1 )
{
rClass.Erase( 0, nPos+1 );
}
GetAppCharClass().toLower( rClass );
while( STRING_NOTFOUND != rClass.SearchAndReplace( '.', '-' ) )
;
while( STRING_NOTFOUND != rClass.SearchAndReplace( ' ', '-' ) )
;
while( STRING_NOTFOUND != rClass.SearchAndReplace( '_', '-' ) )
;
}
return nDeep;
}
static sal_uInt16 GetCSS1Selector( const SwFmt *pFmt, String& rSelector,
sal_uInt16& rRefPoolId )
{
ByteString aToken;
String aClass;
String aPseudo;
sal_uInt16 nDeep = SwHTMLWriter::GetCSS1Selector( pFmt, aToken, aClass,
rRefPoolId, &aPseudo );
if( nDeep )
{
if( aToken.Len() )
rSelector = String( aToken, RTL_TEXTENCODING_ASCII_US );
else
rSelector.Erase();
if( aClass.Len() )
(rSelector += '.') += aClass;
if( aPseudo.Len() )
(rSelector += ':') += aPseudo;
}
return nDeep;
}
const SwFmt *SwHTMLWriter::GetTemplateFmt( sal_uInt16 nPoolFmtId,
IDocumentStylePoolAccess* pTemplate /*SwDoc *pTemplate*/)
{
const SwFmt *pRefFmt = 0;
if( pTemplate )
{
ASSERT( !(USER_FMT & nPoolFmtId),
"In der Dok-Vorlage gibt es keine Benutzer-Vorlagen" );
if( POOLGRP_NOCOLLID & nPoolFmtId )
pRefFmt = pTemplate->GetCharFmtFromPool( nPoolFmtId );
else
pRefFmt = pTemplate->GetTxtCollFromPool( nPoolFmtId, false );
}
return pRefFmt;
}
const SwFmt *SwHTMLWriter::GetParentFmt( const SwFmt& rFmt, sal_uInt16 nDeep )
{
ASSERT( nDeep != USHRT_MAX, "GetParent fuer HTML-Vorlage aufgerufen!" );
const SwFmt *pRefFmt = 0;
if( nDeep > 0 )
{
// hier wird die HTML-Tag-Vorlage, von der die Vorlage abgeleitet
// ist als Referenz geholt
pRefFmt = &rFmt;
for( sal_uInt16 i=nDeep; i>0; i-- )
pRefFmt = pRefFmt->DerivedFrom();
if( pRefFmt && pRefFmt->IsDefault() )
pRefFmt = 0;
}
return pRefFmt;
}
sal_Bool lcl_css1atr_equalFontItems( const SfxPoolItem& r1, const SfxPoolItem& r2 )
{
return ((const SvxFontItem &)r1).GetFamilyName() ==
((const SvxFontItem &)r2).GetFamilyName() &&
((const SvxFontItem &)r1).GetFamily() ==
((const SvxFontItem &)r2).GetFamily();
}
void SwHTMLWriter::SubtractItemSet( SfxItemSet& rItemSet,
const SfxItemSet& rRefItemSet,
sal_Bool bSetDefaults,
sal_Bool bClearSame,
const SfxItemSet *pRefScriptItemSet )
{
ASSERT( bSetDefaults || bClearSame,
"SwHTMLWriter::SubtractItemSet: Bei diesen Flags passiert nix" );
SfxItemSet aRefItemSet( *rRefItemSet.GetPool(), rRefItemSet.GetRanges() );
aRefItemSet.Set( rRefItemSet );
// und mit dem Attr-Set der Vorlage vergleichen
SfxWhichIter aIter( rItemSet );
sal_uInt16 nWhich = aIter.FirstWhich();
while( nWhich )
{
const SfxPoolItem *pRefItem, *pItem;
sal_Bool bItemSet = ( SFX_ITEM_SET ==
rItemSet.GetItemState( nWhich, sal_False, &pItem) );
sal_Bool bRefItemSet;
if( pRefScriptItemSet )
{
switch( nWhich )
{
case RES_CHRATR_FONT:
case RES_CHRATR_FONTSIZE:
case RES_CHRATR_LANGUAGE:
case RES_CHRATR_POSTURE:
case RES_CHRATR_WEIGHT:
case RES_CHRATR_CJK_FONT:
case RES_CHRATR_CJK_FONTSIZE:
case RES_CHRATR_CJK_LANGUAGE:
case RES_CHRATR_CJK_POSTURE:
case RES_CHRATR_CJK_WEIGHT:
case RES_CHRATR_CTL_FONT:
case RES_CHRATR_CTL_FONTSIZE:
case RES_CHRATR_CTL_LANGUAGE:
case RES_CHRATR_CTL_POSTURE:
case RES_CHRATR_CTL_WEIGHT:
bRefItemSet = ( SFX_ITEM_SET ==
pRefScriptItemSet->GetItemState( nWhich, sal_True, &pRefItem) );
break;
default:
bRefItemSet = ( SFX_ITEM_SET ==
aRefItemSet.GetItemState( nWhich, sal_False, &pRefItem) );
break;
}
}
else
{
bRefItemSet = ( SFX_ITEM_SET ==
aRefItemSet.GetItemState( nWhich, sal_False, &pRefItem) );
}
if( bItemSet )
{
if( (bClearSame || pRefScriptItemSet) && bRefItemSet &&
( *pItem == *pRefItem ||
((RES_CHRATR_FONT == nWhich ||
RES_CHRATR_CJK_FONT == nWhich ||
RES_CHRATR_CTL_FONT == nWhich) &&
lcl_css1atr_equalFontItems( *pItem, *pRefItem )) ) )
{
// das Attribut ist mit dem gleichen Wert in beiden
// Vorlagen vorhanden und muss nicht ausgegeben werden
rItemSet.ClearItem( nWhich );
}
}
else
{
if( (bSetDefaults || pRefScriptItemSet) && bRefItemSet )
{
// das Attribut ist nur in der Referenz vorhanden. Das
// Default muss ggf. ausgegeben werden
rItemSet.Put( rItemSet.GetPool()->GetDefaultItem(nWhich) );
}
}
nWhich = aIter.NextWhich();
}
}
void SwHTMLWriter::PrepareFontList( const SvxFontItem& rFontItem,
String& rNames,
sal_Unicode cQuote, sal_Bool bGeneric )
{
rNames = aEmptyStr;
const String& rName = rFontItem.GetFamilyName();
sal_Bool bContainsKeyword = sal_False;
if( rName.Len() )
{
xub_StrLen nStrPos = 0;
while( nStrPos != STRING_NOTFOUND )
{
String aName = rName.GetToken( 0, ';', nStrPos );
aName.EraseTrailingChars().EraseLeadingChars();
if( !aName.Len() )
continue;
sal_Bool bIsKeyword = sal_False;
switch( aName.GetChar( 0 ) )
{
case 'c':
case 'C':
bIsKeyword = aName.EqualsIgnoreCaseAscii( sCSS1_PV_cursive );
break;
case 'f':
case 'F':
bIsKeyword = aName.EqualsIgnoreCaseAscii( sCSS1_PV_fantasy );
break;
case 'm':
case 'M':
bIsKeyword = aName.EqualsIgnoreCaseAscii( sCSS1_PV_monospace );
break;
case 's':
case 'S':
bIsKeyword =
aName.EqualsIgnoreCaseAscii( sCSS1_PV_serif ) ||
aName.EqualsIgnoreCaseAscii( sCSS1_PV_sans_serif );
break;
}
bContainsKeyword |= bIsKeyword;
if( rNames.Len() )
rNames.AppendAscii( ", " );
if( cQuote && !bIsKeyword )
rNames += cQuote;
rNames += aName;
if( cQuote && !bIsKeyword )
rNames += cQuote;
}
}
if( !bContainsKeyword && bGeneric )
{
const sal_Char *pStr = 0;
switch( rFontItem.GetFamily() )
{
case FAMILY_ROMAN: pStr = sCSS1_PV_serif; break;
case FAMILY_SWISS: pStr = sCSS1_PV_sans_serif; break;
case FAMILY_SCRIPT: pStr = sCSS1_PV_cursive; break;
case FAMILY_DECORATIVE: pStr = sCSS1_PV_fantasy; break;
case FAMILY_MODERN: pStr = sCSS1_PV_monospace; break;
default:
;
}
if( pStr )
{
if( rNames.Len() )
rNames.AppendAscii( ", " );
rNames.AppendAscii( pStr );
}
}
}
sal_Bool SwHTMLWriter::HasScriptDependentItems( const SfxItemSet& rItemSet,
sal_Bool bCheckDropCap )
{
static sal_uInt16 aWhichIds[] =
{
RES_CHRATR_FONT, RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_FONT,
RES_CHRATR_FONTSIZE, RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CTL_FONTSIZE,
RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
RES_CHRATR_POSTURE, RES_CHRATR_CJK_POSTURE, RES_CHRATR_CTL_POSTURE,
RES_CHRATR_WEIGHT, RES_CHRATR_CJK_WEIGHT, RES_CHRATR_CTL_WEIGHT,
0, 0, 0
};
for( sal_uInt16 i=0; aWhichIds[i]; i += 3 )
{
const SfxPoolItem *pItem = 0, *pItemCJK = 0, *pItemCTL = 0, *pTmp;
sal_uInt16 nItemCount = 0;
if( SFX_ITEM_SET == rItemSet.GetItemState( aWhichIds[i], sal_False,
&pTmp ) )
{
pItem = pTmp;
nItemCount++;
}
if( SFX_ITEM_SET == rItemSet.GetItemState( aWhichIds[i+1], sal_False,
&pTmp ) )
{
pItemCJK = pTmp;
nItemCount++;
}
if( SFX_ITEM_SET == rItemSet.GetItemState( aWhichIds[i+2], sal_False,
&pTmp ) )
{
pItemCTL = pTmp;
nItemCount++;
}
// If some of the items are set, but not all, we need script dependent
// styles
if( nItemCount > 0 && nItemCount < 3 )
return sal_True;
if( 3 == nItemCount )
{
// If all items are set, but some of them have different values,
// we need script dependent styles, too. For font items, we have
// to take care about their special HTML/CSS1 representation.
if( RES_CHRATR_FONT == aWhichIds[i] )
{
if( !lcl_css1atr_equalFontItems( *pItem, *pItemCJK ) ||
!lcl_css1atr_equalFontItems( *pItem, *pItemCTL ) ||
!lcl_css1atr_equalFontItems( *pItemCJK, *pItemCTL ) )
return sal_True;
}
else
{
if( !( *pItem == *pItemCJK ) ||
!( *pItem == *pItemCTL ) ||
!( *pItemCJK == *pItemCTL ) )
return sal_True;
}
}
}
const SfxPoolItem *pItem;
if( bCheckDropCap &&
SFX_ITEM_SET == rItemSet.GetItemState( RES_PARATR_DROP, sal_True,
&pItem ) )
{
const SwFmtDrop *pDrop = (const SwFmtDrop *)pItem;
const SwCharFmt *pDCCharFmt = pDrop->GetCharFmt();
if( pDCCharFmt )
{
SfxItemSet aTstItemSet( *pDCCharFmt->GetAttrSet().GetPool(),
RES_CHRATR_FONT, RES_CHRATR_FONT,
RES_CHRATR_POSTURE, RES_CHRATR_POSTURE,
RES_CHRATR_WEIGHT, RES_CHRATR_WEIGHT,
RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
RES_CHRATR_CJK_POSTURE, RES_CHRATR_CJK_WEIGHT,
RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT,
RES_CHRATR_CTL_POSTURE, RES_CHRATR_CTL_WEIGHT,
0 );
aTstItemSet.Set( pDCCharFmt->GetAttrSet(), sal_True );
return HasScriptDependentItems( aTstItemSet, sal_False );
}
}
return sal_False;
}
static sal_Bool OutCSS1Rule( SwHTMLWriter& rHTMLWrt, const String& rSelector,
const SfxItemSet& rItemSet, sal_Bool bHasClass,
sal_Bool bCheckForPseudo )
{
sal_Bool bScriptDependent = sal_False;
if( SwHTMLWriter::HasScriptDependentItems( rItemSet,
rHTMLWrt.IsHTMLMode(HTMLMODE_DROPCAPS) && bHasClass ) )
{
bScriptDependent = sal_True;
String aSelector( rSelector );
String aPseudo;
if( bCheckForPseudo )
{
xub_StrLen nPos = aSelector.SearchBackward( ':' );
if( STRING_NOTFOUND != nPos )
{
aPseudo = aSelector.Copy( nPos );
aSelector.Erase( nPos );
}
}
if( !bHasClass )
{
// If we are exporting styles for a tag we have to export a tag
// rule for all properties that aren't style dependent and
// some class rule for the additional style dependen properties
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_NO_SCRIPT|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
sal_True, &rSelector );
rHTMLWrt.OutCSS1_SfxItemSet( rItemSet, sal_False );
}
SfxItemSet aScriptItemSet( *rItemSet.GetPool(),
RES_CHRATR_FONT, RES_CHRATR_FONTSIZE,
RES_CHRATR_LANGUAGE, RES_CHRATR_POSTURE,
RES_CHRATR_WEIGHT, RES_CHRATR_WEIGHT,
RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_WEIGHT,
0 );
aScriptItemSet.Put( rItemSet );
String aNewSelector( aSelector );
aNewSelector.AppendAscii( RTL_CONSTASCII_STRINGPARAM(".western") );
aNewSelector.Append( aPseudo );
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_WESTERN|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
sal_True, &aNewSelector );
rHTMLWrt.OutCSS1_SfxItemSet( aScriptItemSet, sal_False );
}
aNewSelector = aSelector;
aNewSelector.AppendAscii( RTL_CONSTASCII_STRINGPARAM(".cjk") );
aNewSelector.Append( aPseudo );
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CJK|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
sal_True, &aNewSelector );
rHTMLWrt.OutCSS1_SfxItemSet( aScriptItemSet, sal_False );
}
aNewSelector = aSelector;
aNewSelector.AppendAscii( RTL_CONSTASCII_STRINGPARAM(".ctl") );
aNewSelector.Append( aPseudo );
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CTL|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
sal_True, &aNewSelector );
rHTMLWrt.OutCSS1_SfxItemSet( aScriptItemSet, sal_False );
}
}
else
{
// If ther are script dependencies and we are derived from a tag,
// when we have to export a style dependent class for all
// scripts
String aNewSelector( aSelector );
aNewSelector.AppendAscii( RTL_CONSTASCII_STRINGPARAM("-western") );
aNewSelector.Append( aPseudo );
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_WESTERN|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
sal_True, &aNewSelector );
rHTMLWrt.OutCSS1_SfxItemSet( rItemSet, sal_False );
}
aNewSelector = aSelector;
aNewSelector.AppendAscii( RTL_CONSTASCII_STRINGPARAM("-cjk") );
aNewSelector.Append( aPseudo );
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CJK|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
sal_True, &aNewSelector );
rHTMLWrt.OutCSS1_SfxItemSet( rItemSet, sal_False );
}
aNewSelector = aSelector;
aNewSelector.AppendAscii( RTL_CONSTASCII_STRINGPARAM("-ctl") );
aNewSelector.Append( aPseudo );
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CTL|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
sal_True, &aNewSelector );
rHTMLWrt.OutCSS1_SfxItemSet( rItemSet, sal_False );
}
}
}
else
{
// If there are no script dependencies, when all items are
// exported in one step. For hyperlinks only, a script information
// must be there, because these two chr formats don't support
// script dependencies by now.
SwCSS1OutMode aMode( rHTMLWrt,
rHTMLWrt.nCSS1Script|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
sal_True, &rSelector );
rHTMLWrt.OutCSS1_SfxItemSet( rItemSet, sal_False );
}
return bScriptDependent;
}
static void OutCSS1DropCapRule(
SwHTMLWriter& rHTMLWrt, const String& rSelector,
const SwFmtDrop& rDrop, sal_Bool bHasClass,
sal_Bool bHasScriptDependencies )
{
const SwCharFmt *pDCCharFmt = rDrop.GetCharFmt();
if( (bHasScriptDependencies && bHasClass) ||
(pDCCharFmt && SwHTMLWriter::HasScriptDependentItems( pDCCharFmt->GetAttrSet(), sal_False ) ) )
{
String aSelector( rSelector );
String aPseudo;
xub_StrLen nPos = aSelector.SearchBackward( ':' );
if( STRING_NOTFOUND != nPos )
{
aPseudo = aSelector.Copy( nPos );
aSelector.Erase( nPos );
}
if( !bHasClass )
{
// If we are exporting styles for a tag we have to export a tag
// rule for all properties that aren't style dependent and
// some class rule for the additional style dependen properties
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_NO_SCRIPT|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
sal_True, &rSelector );
OutCSS1_SwFmtDropAttrs( rHTMLWrt, rDrop );
}
SfxItemSet aScriptItemSet( rHTMLWrt.pDoc->GetAttrPool(),
RES_CHRATR_FONT, RES_CHRATR_FONTSIZE,
RES_CHRATR_LANGUAGE, RES_CHRATR_POSTURE,
RES_CHRATR_WEIGHT, RES_CHRATR_WEIGHT,
RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_WEIGHT,
0 );
if( pDCCharFmt )
aScriptItemSet.Set( pDCCharFmt->GetAttrSet(), sal_True );
String aNewSelector( aSelector );
aNewSelector.AppendAscii( RTL_CONSTASCII_STRINGPARAM(".western") );
aNewSelector.Append( aPseudo );
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_WESTERN|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
sal_True, &aNewSelector );
OutCSS1_SwFmtDropAttrs( rHTMLWrt, rDrop, &aScriptItemSet );
}
aNewSelector = aSelector;
aNewSelector.AppendAscii( RTL_CONSTASCII_STRINGPARAM(".cjk") );
aNewSelector.Append( aPseudo );
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CJK|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
sal_True, &aNewSelector );
OutCSS1_SwFmtDropAttrs( rHTMLWrt, rDrop, &aScriptItemSet );
}
aNewSelector = aSelector;
aNewSelector.AppendAscii( RTL_CONSTASCII_STRINGPARAM(".ctl") );
aNewSelector.Append( aPseudo );
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CTL|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
sal_True, &aNewSelector );
OutCSS1_SwFmtDropAttrs( rHTMLWrt, rDrop, &aScriptItemSet );
}
}
else
{
// If ther are script dependencies and we are derived from a tag,
// when we have to export a style dependent class for all
// scripts
String aNewSelector( aSelector );
aNewSelector.AppendAscii( RTL_CONSTASCII_STRINGPARAM("-western") );
aNewSelector.Append( aPseudo );
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_WESTERN|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
sal_True, &aNewSelector );
OutCSS1_SwFmtDropAttrs( rHTMLWrt, rDrop );
}
aNewSelector = aSelector;
aNewSelector.AppendAscii( RTL_CONSTASCII_STRINGPARAM("-cjk") );
aNewSelector.Append( aPseudo );
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CJK|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
sal_True, &aNewSelector );
OutCSS1_SwFmtDropAttrs( rHTMLWrt, rDrop );
}
aNewSelector = aSelector;
aNewSelector.AppendAscii( RTL_CONSTASCII_STRINGPARAM("-ctl") );
aNewSelector.Append( aPseudo );
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CTL|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
sal_True, &aNewSelector );
OutCSS1_SwFmtDropAttrs( rHTMLWrt, rDrop );
}
}
}
else
{
// If there are no script dependencies, when all items are
// exported in one step. For hyperlinks only, a script information
// must be there, because these two chr formats don't support
// script dependencies by now.
SwCSS1OutMode aMode( rHTMLWrt,
rHTMLWrt.nCSS1Script|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
sal_True, &rSelector );
OutCSS1_SwFmtDropAttrs( rHTMLWrt, rDrop );
}
}
static Writer& OutCSS1_SwFmt( Writer& rWrt, const SwFmt& rFmt,
IDocumentStylePoolAccess/*SwDoc*/ *pDoc, SwDoc *pTemplate )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
sal_Bool bCharFmt = sal_False;
switch( rFmt.Which() )
{
case RES_CHRFMT:
bCharFmt = sal_True;
break;
case RES_TXTFMTCOLL:
case RES_CONDTXTFMTCOLL:
// diese Vorlagen-Typen koennen exportiert werden
break;
default:
// und diese nicht
return rWrt;
}
// den Selector und die auszugebende Attr-Set-Tiefe ermitteln
String aSelector;
sal_uInt16 nRefPoolId = 0;
sal_uInt16 nDeep = GetCSS1Selector( &rFmt, aSelector, nRefPoolId );
if( !nDeep )
return rWrt; // von keiner HTML-Vorlage abgeleitet
sal_uInt16 nPoolFmtId = rFmt.GetPoolFmtId();
// Den auszugebenden Attr-Set bestimmen. Hier muessen 3 Faelle
// unterschieden werden:
// - HTML-Tag-Vorlagen (nDeep==USHRT_MAX):
// Es werden die Attrs ausgegeben
// - die in der Vorlage gesetzt sind, aber nicht im Original aus
// der HTML-Vorlage
// - die Default-Attrs fuer die Attrs, die im Original aus der
// HTML-Vorlage gesetzt sind, aber nicht in der vorliegeden Vorlage.
// - direkt von HTML-Vorlagen abgeleitete Vorlagen (nDeep==1):
// Es weren nur die Attribute des Vorlagen-Item-Set ohne seine
// Parents ausgegeben.
// - indirekt von HTML-Tag-Vorlagen abgeleitete Vorlagen (nDeep>1)
// Es werden die Attribute des Vorlagen-Item-Sets inkl. seiner Parents,
// aber ohne die Attribute, die in der HTML-Tag-Vorlage gesetzt sind,
// ausgegeben.
// einen Item-Set mit allen Attributen aus der Vorlage anlegen
// (ausser fuer nDeep==1)
const SfxItemSet& rFmtItemSet = rFmt.GetAttrSet();
SfxItemSet aItemSet( *rFmtItemSet.GetPool(), rFmtItemSet.GetRanges() );
aItemSet.Set( rFmtItemSet, sal_True ); // Was nDeep!=1 that is not working
// for script dependent items buts should
// not make a deifference for any other
sal_Bool bSetDefaults = sal_True, bClearSame = sal_True;
const SwFmt *pRefFmt = 0;
const SwFmt *pRefFmtScript = 0;
switch( nDeep )
{
case CSS1_FMT_ISTAG:
pRefFmt = SwHTMLWriter::GetTemplateFmt( nRefPoolId, pTemplate );
break;
case CSS1_FMT_CMPREF:
pRefFmt = SwHTMLWriter::GetTemplateFmt( nRefPoolId, pDoc );
pRefFmtScript = SwHTMLWriter::GetTemplateFmt( nRefPoolId, pTemplate );
bClearSame = sal_False;
break;
default:
pRefFmt = SwHTMLWriter::GetParentFmt( rFmt, nDeep );
pRefFmtScript = SwHTMLWriter::GetTemplateFmt( nRefPoolId, pTemplate );
bSetDefaults = sal_False;
break;
}
if( pRefFmt )
{
// Den Item-Set der Referenz-Vorlage (inkl. seiner Parents) vom
// ItemSet abziehen
SwHTMLWriter::SubtractItemSet( aItemSet, pRefFmt->GetAttrSet(),
bSetDefaults, bClearSame,
pRefFmtScript
? &pRefFmtScript->GetAttrSet()
: 0 );
if( !bCharFmt )
{
const SvxULSpaceItem& rULItem = pRefFmt->GetULSpace();
rHTMLWrt.nDfltTopMargin = rULItem.GetUpper();
rHTMLWrt.nDfltBottomMargin = rULItem.GetLower();
}
}
else if( CSS1_FMT_ISTAG==nDeep && !bCharFmt )
{
// die Default-Abstaende nach oben und unten setzen (fuer den
// Fall, dass es keine Vorlage als Referenz gibt)
rHTMLWrt.nDfltTopMargin = 0;
rHTMLWrt.nDfltBottomMargin = HTML_PARSPACE;
if( USER_FMT & nPoolFmtId )
{
// Benutzer-Vorlagen
const String& rNm = rFmt.GetName();
switch( rNm.GetChar(0) )
{
case 'D': if( rNm.EqualsAscii("DD 1") || rNm.EqualsAscii("DT 1") )
rHTMLWrt.nDfltBottomMargin = 0;
break;
case 'L': if(rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_listing) )
rHTMLWrt.nDfltBottomMargin = 0;
break;
case 'P': if( rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_preformtxt) )
rHTMLWrt.nDfltBottomMargin = 0;
break;
case 'X': if( rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_xmp) )
rHTMLWrt.nDfltBottomMargin = 0;
break;
}
}
else
{
// Pool-Vorlagen
switch( nPoolFmtId )
{
case RES_POOLCOLL_HEADLINE1:
case RES_POOLCOLL_HEADLINE2:
case RES_POOLCOLL_HEADLINE3:
case RES_POOLCOLL_HEADLINE4:
case RES_POOLCOLL_HEADLINE5:
case RES_POOLCOLL_HEADLINE6:
rHTMLWrt.nDfltTopMargin = HTML_HEADSPACE;
break;
case RES_POOLCOLL_SENDADRESS:
case RES_POOLCOLL_HTML_DT:
case RES_POOLCOLL_HTML_DD:
case RES_POOLCOLL_HTML_PRE:
rHTMLWrt.nDfltBottomMargin = 0;
break;
}
}
}
// wo nicht auszugeben ist ...
if( !aItemSet.Count() )
return rWrt;
// There is no support for script dependent hyperlinks by now.
sal_Bool bCheckForPseudo = sal_False;
if( bCharFmt &&
(RES_POOLCHR_INET_NORMAL==nRefPoolId ||
RES_POOLCHR_INET_VISIT==nRefPoolId) )
bCheckForPseudo = sal_True;
// jetzt die Attribute (inkl. Selektor) ausgeben
sal_Bool bHasScriptDependencies = sal_False;
if( OutCSS1Rule( rHTMLWrt, aSelector, aItemSet, CSS1_FMT_ISTAG != nDeep,
bCheckForPseudo ) )
{
if( bCharFmt )
rHTMLWrt.aScriptTextStyles.Insert( new String( rFmt.GetName() ) );
else
{
if( nPoolFmtId==RES_POOLCOLL_TEXT )
rHTMLWrt.aScriptParaStyles.Insert
(new String( pDoc->GetTxtCollFromPool
( RES_POOLCOLL_STANDARD, false )->GetName()
) );
rHTMLWrt.aScriptParaStyles.Insert( new String( rFmt.GetName() ) );
}
bHasScriptDependencies = sal_True;
}
if( nPoolFmtId==RES_POOLCOLL_TEXT && !rHTMLWrt.bFirstCSS1Property )
rHTMLWrt.bPoolCollTextModified = sal_True;
// Drop-Caps ausgeben
const SfxPoolItem *pItem;
if( rHTMLWrt.IsHTMLMode(HTMLMODE_DROPCAPS) &&
SFX_ITEM_SET==aItemSet.GetItemState( RES_PARATR_DROP, sal_False, &pItem ))
{
String sOut( aSelector );
sOut.Append( ':');
sOut.AppendAscii( sCSS1_first_letter );
const SwFmtDrop *pDrop = (const SwFmtDrop *)pItem;
OutCSS1DropCapRule( rHTMLWrt, sOut, *pDrop, CSS1_FMT_ISTAG != nDeep, bHasScriptDependencies );
}
return rWrt;
}
static Writer& OutCSS1_SwPageDesc( Writer& rWrt, const SwPageDesc& rPageDesc,
IDocumentStylePoolAccess/*SwDoc*/ *pDoc, SwDoc *pTemplate,
sal_uInt16 nRefPoolId, sal_Bool bExtRef,
sal_Bool bPseudo )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
const SwPageDesc* pRefPageDesc = 0;
if( !bExtRef )
pRefPageDesc = pDoc->GetPageDescFromPool( nRefPoolId, false );
else if( pTemplate )
pRefPageDesc = pTemplate->GetPageDescFromPool( nRefPoolId, false );
String aSelector( '@' );
aSelector.AppendAscii( sCSS1_page );
if( bPseudo )
{
const sal_Char *pPseudo = 0;
switch( rPageDesc.GetPoolFmtId() )
{
case RES_POOLPAGE_FIRST: pPseudo = sCSS1_first; break;
case RES_POOLPAGE_LEFT: pPseudo = sCSS1_left; break;
case RES_POOLPAGE_RIGHT: pPseudo = sCSS1_right; break;
}
if( pPseudo )
{
aSelector.Append( ':' );
aSelector.AppendAscii( pPseudo );
}
}
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_RULE_ON|CSS1_OUTMODE_TEMPLATE,
sal_True, &aSelector );
// Die Groesse: Wenn sie sich nur durch das Landscape-Flag unterscheidet,
// wird nur Portrait oder Landscape exportiert. Sonst wird die Groesse
// exportiert.
sal_Bool bRefLandscape = pRefPageDesc ? pRefPageDesc->GetLandscape() : sal_False;
Size aRefSz;
const Size& rSz = rPageDesc.GetMaster().GetFrmSize().GetSize();
if( pRefPageDesc )
{
aRefSz = pRefPageDesc->GetMaster().GetFrmSize().GetSize();
if( bRefLandscape != rPageDesc.GetLandscape() )
{
long nTmp = aRefSz.Height();
aRefSz.Height() = aRefSz.Width();
aRefSz.Width() = nTmp;
}
}
// Boeser uebler Hack: Auf der Seiten-Tabpage gibt es leichte
// Rundungsfehler bei der Seitengroesse. Unter anderem wegen bug
// 25535 wird dummerweise auch noch immer Size-Item vom Dialog geputtet,
// auch wenn man gar nichts geaendert hat. Folge: Sobald man einmal im
// Seiten-Dialog war und ihn mit OK verlassen hat, bekommt man eine
// neue Seitengroesse, die dann hier exportiert wuerde. Um das
// vermeiden erlauben wir hier kleine Abweichungen.
if( Abs( rSz.Width() - aRefSz.Width() ) <= 2 &&
Abs( rSz.Height() - aRefSz.Height() ) <= 2 )
{
if( bRefLandscape != rPageDesc.GetLandscape() )
{
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_size,
rPageDesc.GetLandscape() ? sCSS1_PV_landscape
: sCSS1_PV_portrait );
}
}
else
{
ByteString sVal;
AddUnitPropertyValue( rSz.Width(), rHTMLWrt.GetCSS1Unit(), sVal );
sVal += ' ';
AddUnitPropertyValue( rSz.Height(), rHTMLWrt.GetCSS1Unit(), sVal );
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_size, sVal );
}
// Die Abstand-Attribute koennen auf gwohnte Weise exportiert werden
const SwFrmFmt &rMaster = rPageDesc.GetMaster();
SfxItemSet aItemSet( *rMaster.GetAttrSet().GetPool(),
RES_LR_SPACE, RES_UL_SPACE );
aItemSet.Set( rMaster.GetAttrSet(), sal_True );
if( pRefPageDesc )
{
SwHTMLWriter::SubtractItemSet( aItemSet,
pRefPageDesc->GetMaster().GetAttrSet(),
sal_True );
}
OutCSS1_SvxULSpace_SvxLRSpace( rWrt, aItemSet, sal_False );
// Wenn fuer einen Pseudo-Selektor keine Property ausgegeben wurde, muessen
// wir trotzdem etwas ausgeben, damit beim Import die entsprechende
// Vorlage angelegt wird.
if( rHTMLWrt.bFirstCSS1Property && bPseudo )
{
rHTMLWrt.OutNewLine();
ByteString sTmp( aSelector, rHTMLWrt.eDestEnc );
rWrt.Strm() << sTmp.GetBuffer() << " {";
rHTMLWrt.bFirstCSS1Property = sal_False;
}
if( !rHTMLWrt.bFirstCSS1Property )
rWrt.Strm() << sCSS1_rule_end;
return rWrt;
}
static Writer& OutCSS1_SwFtnInfo( Writer& rWrt, const SwEndNoteInfo& rInfo,
SwDoc *pDoc, sal_uInt16 nNotes, sal_Bool bEndNote )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
String aSelector;
if( nNotes > 0 )
{
aSelector.AssignAscii( OOO_STRING_SVTOOLS_HTML_anchor );
aSelector.Append( '.');
aSelector.AppendAscii( bEndNote ? OOO_STRING_SVTOOLS_HTML_sdendnote_anc
: OOO_STRING_SVTOOLS_HTML_sdfootnote_anc );
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
sal_True, &aSelector );
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_font_size,
sHTML_FTN_fontheight );
rHTMLWrt.Strm() << sCSS1_rule_end;
}
const SwCharFmt *pSymCharFmt = rInfo.GetCharFmt( *pDoc );
if( pSymCharFmt )
{
const SfxItemSet& rFmtItemSet = pSymCharFmt->GetAttrSet();
SfxItemSet aItemSet( *rFmtItemSet.GetPool(), rFmtItemSet.GetRanges() );
aItemSet.Set( rFmtItemSet, sal_True );
// Wenn es Fuss- bzw. Endnoten gibt, dann muessen alles Attribute
// ausgegeben werden, damit Netscape das Dokument richtig anzeigt.
// Anderenfalls genuegt es, die Unterschiede zur Fuss-/Endnoten
// Vorlage rauszuschreiben.
if( nNotes == 0 && rHTMLWrt.pTemplate )
{
SwFmt *pRefFmt = rHTMLWrt.pTemplate->GetCharFmtFromPool(
static_cast< sal_uInt16 >(bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE) );
if( pRefFmt )
SwHTMLWriter::SubtractItemSet( aItemSet, pRefFmt->GetAttrSet(),
sal_True );
}
if( aItemSet.Count() )
{
aSelector.AssignAscii( OOO_STRING_SVTOOLS_HTML_anchor );
aSelector.Append( '.');
aSelector.AppendAscii( bEndNote ? OOO_STRING_SVTOOLS_HTML_sdendnote_sym
: OOO_STRING_SVTOOLS_HTML_sdfootnote_sym );
if( OutCSS1Rule( rHTMLWrt, aSelector, aItemSet, sal_True, sal_False ))
rHTMLWrt.aScriptTextStyles.Insert( new String( pSymCharFmt->GetName() ) );
}
}
return rWrt;
}
Writer& OutCSS1_BodyTagStyleOpt( Writer& rWrt, const SfxItemSet& rItemSet,
String aEmbBGGrfName )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_STYLE_OPT_ON |
CSS1_OUTMODE_ENCODE|CSS1_OUTMODE_BODY );
// Es werden nur die Attribute der Seiten-Vorlage ausgegeben.
// Die Attribute der Standard-Absatz-Vorlage werden schon beim
// Export der Absatz-Vorlagen beruecksichtigt.
const SfxPoolItem *pItem;
if( SFX_ITEM_SET == rItemSet.GetItemState( RES_BACKGROUND, sal_False,
&pItem ) )
{
OutCSS1_SvxBrush( rWrt, *pItem, CSS1_BACKGROUND_PAGE,
&aEmbBGGrfName );
}
if( SFX_ITEM_SET == rItemSet.GetItemState( RES_BOX, sal_False,
&pItem ))
{
OutCSS1_SvxBox( rWrt, *pItem );
}
if( !rHTMLWrt.bFirstCSS1Property )
{
// wenn eine Property als Bestandteil einer Style-Option
// ausgegeben wurde, muss die Optiomn noch beendet werden
rWrt.Strm() << '\"';
}
return rWrt;
}
Writer& OutCSS1_ParaTagStyleOpt( Writer& rWrt, const SfxItemSet& rItemSet )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
SwCSS1OutMode aMode( rHTMLWrt, rHTMLWrt.nCSS1Script|CSS1_OUTMODE_STYLE_OPT |
CSS1_OUTMODE_ENCODE|CSS1_OUTMODE_PARA );
rHTMLWrt.OutCSS1_SfxItemSet( rItemSet, sal_False );
return rWrt;
}
Writer& OutCSS1_HintSpanTag( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_SPAN_TAG |
CSS1_OUTMODE_ENCODE|CSS1_OUTMODE_HINT );
Out( aCSS1AttrFnTab, rHt, rWrt );
if( !rHTMLWrt.bFirstCSS1Property && rHTMLWrt.bTagOn )
rWrt.Strm() << sCSS1_span_tag_end;
return rWrt;
}
Writer& OutCSS1_HintStyleOpt( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_STYLE_OPT_ON |
CSS1_OUTMODE_ENCODE|
CSS1_OUTMODE_HINT );
Out( aCSS1AttrFnTab, rHt, rWrt );
if( !rHTMLWrt.bFirstCSS1Property )
rWrt.Strm() << '\"';
return rWrt;
}
// Wrapper fuer die Ausgabe von Tabellen-Hintergruenden
Writer& OutCSS1_TableBGStyleOpt( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_STYLE_OPT_ON |
CSS1_OUTMODE_ENCODE|
CSS1_OUTMODE_TABLEBOX );
OutCSS1_SvxBrush( rWrt, rHt, CSS1_BACKGROUND_TABLE, 0 );
if( !rHTMLWrt.bFirstCSS1Property )
rWrt.Strm() << '\"';
return rWrt;
}
Writer& OutCSS1_NumBulListStyleOpt( Writer& rWrt, const SwNumRule& rNumRule,
sal_uInt8 nLevel )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_STYLE_OPT |
CSS1_OUTMODE_ENCODE|CSS1_OUTMODE_PARA );
const SwNumFmt& rNumFmt = rNumRule.Get( nLevel );
long nLSpace = rNumFmt.GetAbsLSpace();
long nFirstLineOffset = rNumFmt.GetFirstLineOffset();
long nDfltFirstLineOffset = HTML_NUMBUL_INDENT;
if( nLevel > 0 )
{
const SwNumFmt& rPrevNumFmt = rNumRule.Get( nLevel-1 );
nLSpace -= rPrevNumFmt.GetAbsLSpace();
nDfltFirstLineOffset = rPrevNumFmt.GetFirstLineOffset();
}
if( rHTMLWrt.IsHTMLMode(HTMLMODE_LSPACE_IN_NUMBUL) &&
nLSpace != HTML_NUMBUL_MARGINLEFT )
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_margin_left, nLSpace );
if( rHTMLWrt.IsHTMLMode(HTMLMODE_FRSTLINE_IN_NUMBUL) &&
nFirstLineOffset != nDfltFirstLineOffset )
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_text_indent, nFirstLineOffset );
if( !rHTMLWrt.bFirstCSS1Property )
rWrt.Strm() << '\"';
return rWrt;
}
//-----------------------------------------------------------------------
void SwHTMLWriter::OutCSS1_FrmFmtOptions( const SwFrmFmt& rFrmFmt,
sal_uInt32 nFrmOpts,
const SdrObject *pSdrObj,
const SfxItemSet *pItemSet )
{
SwCSS1OutMode aMode( *this, CSS1_OUTMODE_STYLE_OPT_ON |
CSS1_OUTMODE_ENCODE|
CSS1_OUTMODE_FRAME );
const SwFmtHoriOrient& rHoriOri = rFrmFmt.GetHoriOrient();
SvxLRSpaceItem aLRItem( rFrmFmt.GetLRSpace() );
SvxULSpaceItem aULItem( rFrmFmt.GetULSpace() );
if( nFrmOpts & HTML_FRMOPT_S_ALIGN )
{
const SwFmtAnchor& rAnchor = rFrmFmt.GetAnchor();
switch( rAnchor.GetAnchorId() )
{
case FLY_AT_PARA:
case FLY_AT_CHAR:
if( text::RelOrientation::FRAME == rHoriOri.GetRelationOrient() ||
text::RelOrientation::PRINT_AREA == rHoriOri.GetRelationOrient() )
{
if( !(nFrmOpts & HTML_FRMOPT_ALIGN) )
{
// float
const sal_Char *pStr = text::HoriOrientation::RIGHT==rHoriOri.GetHoriOrient()
? sCSS1_PV_right
: sCSS1_PV_left;
OutCSS1_PropertyAscii( sCSS1_P_float, pStr );
}
break;
}
case FLY_AT_PAGE:
case FLY_AT_FLY:
{
// position
OutCSS1_PropertyAscii( sCSS1_P_position, sCSS1_PV_absolute );
// Fuer top/left muessen die Abstaende des Rahmens von
// der Position abgezogen werden, da sie in CSS1 noch
// zur Position addiert werden.
// Das funktioniert auch fuer automatisch ausgerichtete
// Rahmen, obwohl der Abstand da ja auch im Writer noch
// addiert wird. Denn auch in diesem Fall enthalten
// die Orient-Attribute die korrekte Position
// top
long nXPos=0, nYPos=0;
sal_Bool bOutXPos = sal_False, bOutYPos = sal_False;
if( RES_DRAWFRMFMT == rFrmFmt.Which() )
{
ASSERT( pSdrObj, "Kein SdrObject uebergeben. Ineffizient" );
if( !pSdrObj )
pSdrObj = rFrmFmt.FindSdrObject();
ASSERT( pSdrObj, "Wo ist das SdrObject" );
if( pSdrObj )
{
Point aPos( pSdrObj->GetRelativePos() );
nXPos = aPos.A();
nYPos = aPos.B();
}
bOutXPos = bOutYPos = sal_True;
}
else
{
bOutXPos = text::RelOrientation::CHAR != rHoriOri.GetRelationOrient();
nXPos = text::HoriOrientation::NONE == rHoriOri.GetHoriOrient()
? rHoriOri.GetPos() : 0;
const SwFmtVertOrient& rVertOri = rFrmFmt.GetVertOrient();
bOutYPos = text::RelOrientation::CHAR != rVertOri.GetRelationOrient();
nYPos = text::VertOrientation::NONE == rVertOri.GetVertOrient()
? rVertOri.GetPos() : 0;
}
if( bOutYPos )
{
if( IsHTMLMode( HTMLMODE_FLY_MARGINS) )
{
nYPos -= aULItem.GetUpper();
if( nYPos < 0 )
{
aULItem.SetUpper( (sal_uInt16)(aULItem.GetUpper() + nYPos) );
nYPos = 0;
}
}
OutCSS1_UnitProperty( sCSS1_P_top, nYPos );
}
if( bOutXPos )
{
// left
if( IsHTMLMode( HTMLMODE_FLY_MARGINS) )
{
nXPos -= aLRItem.GetLeft();
if( nXPos < 0 )
{
aLRItem.SetLeft( (sal_uInt16)(aLRItem.GetLeft() + nXPos) );
nXPos = 0;
}
}
OutCSS1_UnitProperty( sCSS1_P_left, nXPos );
}
}
break;
default:
;
}
}
// width/height
if( nFrmOpts & HTML_FRMOPT_S_SIZE )
{
if( RES_DRAWFRMFMT == rFrmFmt.Which() )
{
ASSERT( pSdrObj, "Kein SdrObject uebergeben. Ineffizient" );
if( !pSdrObj )
pSdrObj = rFrmFmt.FindSdrObject();
ASSERT( pSdrObj, "Wo ist das SdrObject" );
if( pSdrObj )
{
Size aTwipSz( pSdrObj->GetLogicRect().GetSize() );
if( nFrmOpts & HTML_FRMOPT_S_WIDTH )
{
if( nFrmOpts & HTML_FRMOPT_S_PIXSIZE )
OutCSS1_PixelProperty( sCSS1_P_width, aTwipSz.Width(),
sal_False );
else
OutCSS1_UnitProperty( sCSS1_P_width, aTwipSz.Width() );
}
if( nFrmOpts & HTML_FRMOPT_S_HEIGHT )
{
if( nFrmOpts & HTML_FRMOPT_S_PIXSIZE )
OutCSS1_PixelProperty( sCSS1_P_height, aTwipSz.Height(),
sal_True );
else
OutCSS1_UnitProperty( sCSS1_P_height, aTwipSz.Height() );
}
}
}
else
{
ASSERT( HTML_FRMOPT_ABSSIZE & nFrmOpts,
"Absolute Groesse wird exportiert" );
ASSERT( HTML_FRMOPT_ANYSIZE & nFrmOpts,
"Jede Groesse wird exportiert" );
sal_uInt16 nMode = 0;
if( nFrmOpts & HTML_FRMOPT_S_WIDTH )
nMode |= CSS1_FRMSIZE_WIDTH;
if( nFrmOpts & HTML_FRMOPT_S_HEIGHT )
nMode |= (CSS1_FRMSIZE_MINHEIGHT|CSS1_FRMSIZE_FIXHEIGHT);
if( nFrmOpts & HTML_FRMOPT_S_PIXSIZE )
nMode |= CSS1_FRMSIZE_PIXEL;
OutCSS1_SwFmtFrmSize( *this, rFrmFmt.GetFrmSize(), nMode );
}
}
const SfxItemSet& rItemSet = rFrmFmt.GetAttrSet();
// margin-*
if( (nFrmOpts & HTML_FRMOPT_S_SPACE) &&
IsHTMLMode( HTMLMODE_FLY_MARGINS) )
{
const SvxLRSpaceItem *pLRItem = 0;
const SvxULSpaceItem *pULItem = 0;
if( SFX_ITEM_SET == rItemSet.GetItemState( RES_LR_SPACE, sal_True ) )
pLRItem = &aLRItem;
if( SFX_ITEM_SET == rItemSet.GetItemState( RES_UL_SPACE, sal_True ) )
pULItem = &aULItem;
if( pLRItem || pULItem )
OutCSS1_SvxULSpace_SvxLRSpace( *this, pULItem, pLRItem );
}
// border
if( nFrmOpts & HTML_FRMOPT_S_BORDER )
{
const SfxPoolItem* pItem;
if( nFrmOpts & HTML_FRMOPT_S_NOBORDER )
OutCSS1_SvxBox( *this, rFrmFmt.GetBox() );
else if( SFX_ITEM_SET==rItemSet.GetItemState( RES_BOX, sal_True, &pItem ) )
OutCSS1_SvxBox( *this, *pItem );
}
// background (wenn, dann muss auch eine Farbe ausgegeben werden)
if( nFrmOpts & HTML_FRMOPT_S_BACKGROUND )
OutCSS1_FrmFmtBackground( rFrmFmt );
if( pItemSet )
OutCSS1_SfxItemSet( *pItemSet, sal_False );
if( !bFirstCSS1Property )
Strm() << '\"';
}
void SwHTMLWriter::OutCSS1_TableFrmFmtOptions( const SwFrmFmt& rFrmFmt )
{
SwCSS1OutMode aMode( *this, CSS1_OUTMODE_STYLE_OPT_ON |
CSS1_OUTMODE_ENCODE|
CSS1_OUTMODE_TABLE );
const SfxPoolItem *pItem;
const SfxItemSet& rItemSet = rFrmFmt.GetAttrSet();
if( SFX_ITEM_SET==rItemSet.GetItemState( RES_BACKGROUND, sal_False, &pItem ) )
OutCSS1_SvxBrush( *this, *pItem, CSS1_BACKGROUND_TABLE, 0 );
if( IsHTMLMode( HTMLMODE_PRINT_EXT ) )
OutCSS1_SvxFmtBreak_SwFmtPDesc_SvxFmtKeep( *this, rItemSet, sal_False );
if( SFX_ITEM_SET==rItemSet.GetItemState( RES_LAYOUT_SPLIT, sal_False, &pItem ) )
OutCSS1_SwFmtLayoutSplit( *this, *pItem );
if( !bFirstCSS1Property )
Strm() << '\"';
}
void SwHTMLWriter::OutCSS1_SectionFmtOptions( const SwFrmFmt& rFrmFmt )
{
SwCSS1OutMode aMode( *this, CSS1_OUTMODE_STYLE_OPT_ON |
CSS1_OUTMODE_ENCODE|
CSS1_OUTMODE_SECTION );
const SfxPoolItem *pItem;
const SfxItemSet& rItemSet = rFrmFmt.GetAttrSet();
if( SFX_ITEM_SET==rItemSet.GetItemState( RES_BACKGROUND, sal_False, &pItem ) )
OutCSS1_SvxBrush( *this, *pItem, CSS1_BACKGROUND_SECTION, 0 );
if( !bFirstCSS1Property )
Strm() << '\"';
}
static sal_Bool OutCSS1_FrmFmtBrush( SwHTMLWriter& rWrt,
const SvxBrushItem& rBrushItem )
{
sal_Bool bWritten = sal_False;
/// OD 02.09.2002 #99657#
/// output brush of frame format, if its background color is not "no fill"/"auto fill"
/// or it has a background graphic.
if( rBrushItem.GetColor() != COL_TRANSPARENT ||
0 != rBrushItem.GetGraphicLink() ||
0 != rBrushItem.GetGraphicPos() )
{
OutCSS1_SvxBrush( rWrt, rBrushItem, CSS1_BACKGROUND_FLY, 0 );
bWritten = sal_True;
}
return bWritten;
}
void SwHTMLWriter::OutCSS1_FrmFmtBackground( const SwFrmFmt& rFrmFmt )
{
// Wenn der Rahmen selbst einen Hintergrund hat, wird der ausgegeben.
if( OutCSS1_FrmFmtBrush( *this, rFrmFmt.GetBackground() ) )
return;
// Wenn der Rahmen nicht seitengebunden ist, wird sonst muss der
// Hintergrund vom Anker betrachtet
const SwFmtAnchor& rAnchor = rFrmFmt.GetAnchor();
RndStdIds eAnchorId = rAnchor.GetAnchorId();
const SwPosition *pAnchorPos = rAnchor.GetCntntAnchor();
if (FLY_AT_PAGE != eAnchorId && pAnchorPos)
{
const SwNode& rNode = pAnchorPos->nNode.GetNode();
if( rNode.IsCntntNode() )
{
// Wenn der Rahmen in einem Content-Node verankert ist,
// wird der Hintergrund von Content-Node ausgegeben, wenn
// der einen hat.
if( OutCSS1_FrmFmtBrush( *this,
rNode.GetCntntNode()->GetSwAttrSet().GetBackground()) )
return;
// Sonst koennen wir evtl. auch in einer Tabelle stehen
const SwTableNode *pTableNd = rNode.FindTableNode();
if( pTableNd )
{
const SwStartNode *pBoxSttNd = rNode.FindTableBoxStartNode();
const SwTableBox *pBox =
pTableNd->GetTable().GetTblBox( pBoxSttNd->GetIndex() );
// Wenn die Box einen Hintergrund hat, nehmen wir den.
if( OutCSS1_FrmFmtBrush( *this,
pBox->GetFrmFmt()->GetBackground() ) )
return;
// Sonst betrachten wir den der Lines
const SwTableLine *pLine = pBox->GetUpper();
while( pLine )
{
if( OutCSS1_FrmFmtBrush( *this,
pLine->GetFrmFmt()->GetBackground() ) )
return;
pBox = pLine->GetUpper();
pLine = pBox ? pBox->GetUpper() : 0;
}
// Wenn da auch nichts war den der Tabelle.
if( OutCSS1_FrmFmtBrush( *this,
pTableNd->GetTable().GetFrmFmt()->GetBackground() ) )
return;
}
}
// Wenn der Anker wieder in einem Fly-Frame steht, dann
// wird der Hintergrund des Fly-Frames ausgegeben.
const SwFrmFmt *pFrmFmt = rNode.GetFlyFmt();
if( pFrmFmt )
{
OutCSS1_FrmFmtBackground( *pFrmFmt );
return;
}
}
// Schliesslich bleibt noch der Hintergrund der Seite uebrig und als
// letzte Rettung das Item der Config.
ASSERT( pCurrPageDesc, "Keine Seiten-Vorlage gemerkt" );
if( !OutCSS1_FrmFmtBrush( *this,
pCurrPageDesc->GetMaster().GetBackground() ) )
{
Color aColor( COL_WHITE );
// Die Hintergrund-Farbe wird normalerweise nur in Browse-Mode
// benutzt. Wir benutzen si bei einem HTML-Dokument immer und
// bei einem Text-Dokument nur, wenn es im Browse-Mode angezeigt
// wird.
if( pDoc->get(IDocumentSettingAccess::HTML_MODE) ||
pDoc->get(IDocumentSettingAccess::BROWSE_MODE))
{
ViewShell *pVSh = 0;
pDoc->GetEditShell( &pVSh );
if ( pVSh &&
COL_TRANSPARENT != pVSh->GetViewOptions()->GetRetoucheColor().GetColor())
aColor = pVSh->GetViewOptions()->GetRetoucheColor().GetColor();
}
ByteString sOut;
GetCSS1Color( aColor, sOut );
OutCSS1_PropertyAscii( sCSS1_P_background, sOut );
}
}
//-----------------------------------------------------------------------
static Writer& OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink( Writer& rWrt,
const SvxUnderlineItem *pUItem,
const SvxOverlineItem *pOItem,
const SvxCrossedOutItem *pCOItem,
const SvxBlinkItem *pBItem )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
sal_Bool bNone = sal_False;
const sal_Char *pUStr = 0;
if( pUItem )
{
switch( pUItem->GetLineStyle() )
{
case UNDERLINE_NONE:
bNone = sal_True;
break;
case UNDERLINE_DONTKNOW:
break;
default:
if( !rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) )
{
// das geht auch in HTML und muss nicht als STYLE-Option
// und darf nicht als Hint geschrieben werden
ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT),
"Underline als Hint schreiben?" );
pUStr = sCSS1_PV_underline;
}
break;
}
}
const sal_Char *pOStr = 0;
if( pOItem )
{
switch( pOItem->GetLineStyle() )
{
case UNDERLINE_NONE:
bNone = sal_True;
break;
case UNDERLINE_DONTKNOW:
break;
default:
if( !rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) )
{
// das geht auch in HTML und muss nicht als STYLE-Option
// und darf nicht als Hint geschrieben werden
ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT),
"Overline als Hint schreiben?" );
pOStr = sCSS1_PV_overline;
}
break;
}
}
const sal_Char *pCOStr = 0;
if( pCOItem )
{
switch( pCOItem->GetStrikeout() )
{
case STRIKEOUT_NONE:
bNone = sal_True;
break;
case STRIKEOUT_DONTKNOW:
break;
default:
if( !rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) )
{
// das geht auch in HTML und muss nicht als STYLE-Option
// und darf nicht als Hint geschrieben werden
ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT),
"CrossedOut als Hint schreiben?" );
pCOStr = sCSS1_PV_line_through;
}
break;
}
}
const sal_Char *pBStr = 0;
if( pBItem && rHTMLWrt.IsHTMLMode(HTMLMODE_BLINK) )
{
if( !pBItem->GetValue() )
{
bNone = sal_True;
}
else if( !rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) )
{
// das geht auch in HTML und muss nicht als STYLE-Option
// und darf nicht als Hint geschrieben werden
ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT),
"Blink als Hint schreiben?" );
pBStr = sCSS1_PV_blink;
}
}
ByteString sOut;
if( pUStr )
sOut.Append( pUStr );
if( pOStr )
{
if( sOut.Len() )
sOut += ' ';
sOut.Append( pOStr );
}
if( pCOStr )
{
if( sOut.Len() )
sOut += ' ';
sOut.Append( pCOStr );
}
if( pBStr )
{
if( sOut.Len() )
sOut += ' ';
sOut.Append( pBStr );
}
if( sOut.Len() )
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_text_decoration, sOut );
else if( bNone )
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_text_decoration, sCSS1_PV_none );
return rWrt;
}
static Writer& OutCSS1_SvxCaseMap( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
if( !rHTMLWrt.IsHTMLMode(HTMLMODE_SMALL_CAPS) )
return rWrt;
const sal_Char *pStr = 0;
switch( ((const SvxCaseMapItem&)rHt).GetCaseMap() )
{
case SVX_CASEMAP_NOT_MAPPED: pStr = sCSS1_PV_normal; break;
case SVX_CASEMAP_KAPITAELCHEN: pStr = sCSS1_PV_small_caps; break;
default:
;
}
if( pStr )
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_font_variant, pStr );
return rWrt;
}
static Writer& OutCSS1_SvxColor( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
// Farben muessen nicht in der Style-Option ausgegeben werden.
if( rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) &&
!rHTMLWrt.bCfgPreferStyles )
return rWrt;
ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT),
"Farbe wirklich als Hint ausgeben?" );
Color aColor( ((const SvxColorItem&)rHt).GetValue() );
if( COL_AUTO == aColor.GetColor() )
aColor.SetColor( COL_BLACK );
ByteString sOut;
GetCSS1Color( aColor, sOut );
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_color, sOut );
return rWrt;
}
static Writer& OutCSS1_SvxCrossedOut( Writer& rWrt, const SfxPoolItem& rHt )
{
// Mit dieser Methode werden nur Hints ausgegeben!
// Sonst wird OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink() direkt aufgerufen.
if( ((SwHTMLWriter&)rWrt).IsCSS1Source(CSS1_OUTMODE_HINT) )
OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink( rWrt,
0, 0, (const SvxCrossedOutItem *)&rHt, 0 );
return rWrt;
}
static Writer& OutCSS1_SvxFont( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
// Fonts muessen nicht in der Style-Option ausgegeben werden.
if( rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) )
return rWrt;
sal_uInt16 nScript = CSS1_OUTMODE_WESTERN;
switch( rHt.Which() )
{
case RES_CHRATR_CJK_FONT: nScript = CSS1_OUTMODE_CJK; break;
case RES_CHRATR_CTL_FONT: nScript = CSS1_OUTMODE_CTL; break;
}
if( !rHTMLWrt.IsCSS1Script( nScript ) )
return rWrt;
ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT),
"Font wirklich als Hint ausgeben?" );
String sOut;
// MS IE3b1 hat mit einfachen Haekchen Probleme
sal_uInt16 nMode = rHTMLWrt.nCSS1OutMode & CSS1_OUTMODE_ANY_ON;
sal_Unicode cQuote = nMode == CSS1_OUTMODE_RULE_ON ? '\"' : '\'';
SwHTMLWriter::PrepareFontList( ((const SvxFontItem&)rHt), sOut, cQuote,
sal_True );
rHTMLWrt.OutCSS1_Property( sCSS1_P_font_family, sOut );
return rWrt;
}
static Writer& OutCSS1_SvxFontHeight( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
// Font-Hoehen muessen nicht in der Style-Option ausgegeben werden.
// Fuer Drop-Caps wird ein andewres font-size ausgegeben
if( rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) ||
rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_DROPCAP ) )
return rWrt;
sal_uInt16 nScript = CSS1_OUTMODE_WESTERN;
switch( rHt.Which() )
{
case RES_CHRATR_CJK_FONTSIZE: nScript = CSS1_OUTMODE_CJK; break;
case RES_CHRATR_CTL_FONTSIZE: nScript = CSS1_OUTMODE_CTL; break;
}
if( !rHTMLWrt.IsCSS1Script( nScript ) )
return rWrt;
sal_uInt32 nHeight = ((const SvxFontHeightItem&)rHt).GetHeight();
if( rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT) )
{
// einen Hint nur dann ausgeben wenn es auch was bringt
sal_uInt16 nSize = rHTMLWrt.GetHTMLFontSize( nHeight );
if( rHTMLWrt.aFontHeights[nSize-1] == nHeight )
return rWrt;
}
ByteString sHeight( ByteString::CreateFromInt32(
(sal_Int32)(nHeight/20) ) );
sHeight.Append( sCSS1_UNIT_pt );
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_font_size, sHeight );
return rWrt;
}
static Writer& OutCSS1_SvxPosture( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
sal_uInt16 nScript = CSS1_OUTMODE_WESTERN;
switch( rHt.Which() )
{
case RES_CHRATR_CJK_POSTURE: nScript = CSS1_OUTMODE_CJK; break;
case RES_CHRATR_CTL_POSTURE: nScript = CSS1_OUTMODE_CTL; break;
}
if( !rHTMLWrt.IsCSS1Script( nScript ) )
return rWrt;
const sal_Char *pStr = 0;
switch( ((const SvxPostureItem&)rHt).GetPosture() )
{
case ITALIC_NONE: pStr = sCSS1_PV_normal; break;
case ITALIC_OBLIQUE: pStr = sCSS1_PV_oblique; break;
case ITALIC_NORMAL:
if( !rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) )
{
// das geht auch in HTML und muss nicht als STYLE-Option
// und darf nicht als Hint geschrieben werden
ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT),
"Italic als Hint schreiben?" );
pStr = sCSS1_PV_italic;
}
break;
default:
;
}
if( pStr )
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_font_style, pStr );
return rWrt;
}
static Writer& OutCSS1_SvxKerning( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
// Kerning-Item nur ausgeben, wenn volle Style-Unterst?tzung da ist
if( !rHTMLWrt.IsHTMLMode(HTMLMODE_FULL_STYLES) )
return rWrt;
sal_Int16 nValue = ((const SvxKerningItem&)rHt).GetValue();
if( nValue )
{
ByteString sOut;
if( nValue < 0 )
{
sOut = '-';
nValue = -nValue;
}
// Breite als n.n pt
nValue = (nValue + 1) / 2; // 1/10pt
sOut.Append( ByteString::CreateFromInt32( (sal_Int32)(nValue / 10) ) );
sOut.Append( '.' );
sOut.Append( ByteString::CreateFromInt32( (sal_Int32)(nValue % 10) ) );
sOut.Append( sCSS1_UNIT_pt );
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_letter_spacing, sOut );
}
else
{
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_letter_spacing,
sCSS1_PV_normal );
}
return rWrt;
}
static Writer& OutCSS1_SvxLanguage( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
// Language will be exported rules only
if( rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) )
return rWrt;
sal_uInt16 nScript = CSS1_OUTMODE_WESTERN;
switch( rHt.Which() )
{
case RES_CHRATR_CJK_LANGUAGE: nScript = CSS1_OUTMODE_CJK; break;
case RES_CHRATR_CTL_LANGUAGE: nScript = CSS1_OUTMODE_CTL; break;
}
if( !rHTMLWrt.IsCSS1Script( nScript ) )
return rWrt;
ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT),
"Language wirklich als Hint ausgeben?" );
LanguageType eLang = ((const SvxLanguageItem &)rHt).GetLanguage();
if( LANGUAGE_DONTKNOW == eLang )
return rWrt;
String sOut = MsLangId::convertLanguageToIsoString( eLang );
rHTMLWrt.OutCSS1_Property( sCSS1_P_so_language, sOut );
return rWrt;
}
static Writer& OutCSS1_SvxUnderline( Writer& rWrt, const SfxPoolItem& rHt )
{
// Mit dieser Methode werden nur Hints ausgegeben!
// Sonst wird OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink() direkt aufgerufen.
if( ((SwHTMLWriter&)rWrt).IsCSS1Source(CSS1_OUTMODE_HINT) )
OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink( rWrt,
(const SvxUnderlineItem *)&rHt, 0, 0, 0 );
return rWrt;
}
static Writer& OutCSS1_SvxOverline( Writer& rWrt, const SfxPoolItem& rHt )
{
// Mit dieser Methode werden nur Hints ausgegeben!
// Sonst wird OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink() direkt aufgerufen.
if( ((SwHTMLWriter&)rWrt).IsCSS1Source(CSS1_OUTMODE_HINT) )
OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink( rWrt,
0, (const SvxOverlineItem *)&rHt, 0, 0 );
return rWrt;
}
static Writer& OutCSS1_SvxFontWeight( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
sal_uInt16 nScript = CSS1_OUTMODE_WESTERN;
switch( rHt.Which() )
{
case RES_CHRATR_CJK_WEIGHT: nScript = CSS1_OUTMODE_CJK; break;
case RES_CHRATR_CTL_WEIGHT: nScript = CSS1_OUTMODE_CTL; break;
}
if( !rHTMLWrt.IsCSS1Script( nScript ) )
return rWrt;
const sal_Char *pStr = 0;
switch( ((const SvxWeightItem&)rHt).GetWeight() )
{
case WEIGHT_ULTRALIGHT: pStr = sCSS1_PV_extra_light; break;
case WEIGHT_LIGHT: pStr = sCSS1_PV_light; break;
case WEIGHT_SEMILIGHT: pStr = sCSS1_PV_demi_light; break;
case WEIGHT_NORMAL: pStr = sCSS1_PV_normal; break;
case WEIGHT_SEMIBOLD: pStr = sCSS1_PV_demi_bold; break;
case WEIGHT_BOLD:
if( !rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) )
{
// das geht auch in HTML und muss nicht als STYLE-Option
// und darf nicht als Hint geschrieben werden
ASSERT( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT),
"Fett als Hint schreiben?" );
pStr = sCSS1_PV_bold;
}
break;
case WEIGHT_ULTRABOLD: pStr = sCSS1_PV_extra_bold; break;
default:
pStr = sCSS1_PV_normal;;
}
if( pStr )
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_font_weight, pStr );
return rWrt;
}
static Writer& OutCSS1_SvxBlink( Writer& rWrt, const SfxPoolItem& rHt )
{
// Mit dieser Methode werden nur Hints ausgegeben!
// Sonst wird OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink() direkt aufgerufen.
if( ((SwHTMLWriter&)rWrt).IsCSS1Source(CSS1_OUTMODE_HINT) )
OutCSS1_SvxTxtLn_SvxCrOut_SvxBlink( rWrt,
0, 0, 0, (const SvxBlinkItem *)&rHt );
return rWrt;
}
static Writer& OutCSS1_SvxLineSpacing( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
// #60393#: Netscape4 hat massive Probleme mit den Zellenhoehen
// wenn der Zeilenabstand innerhalb einer Tabelle geaendert wird
// und die Breite der Tabelle nicht automatisch berechnet wird
// (also wenn eine WIDTH-Option vorhanden ist).
if( rHTMLWrt.bOutTable && rHTMLWrt.bCfgNetscape4 )
return rWrt;
const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&)rHt;
sal_uInt16 nHeight = 0;
sal_uInt16 nPrcHeight = 0;
SvxLineSpace eLineSpace = rLSItem.GetLineSpaceRule();
switch( rLSItem.GetInterLineSpaceRule() )
{
case SVX_INTER_LINE_SPACE_OFF:
case SVX_INTER_LINE_SPACE_FIX:
{
switch( eLineSpace )
{
case SVX_LINE_SPACE_MIN:
case SVX_LINE_SPACE_FIX:
nHeight = rLSItem.GetLineHeight();
break;
case SVX_LINE_SPACE_AUTO:
nPrcHeight = 100;
break;
default:
;
}
}
break;
case SVX_INTER_LINE_SPACE_PROP:
nPrcHeight = rLSItem.GetPropLineSpace();
break;
default:
;
}
if( nHeight )
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_line_height, (long)nHeight );
else if( nPrcHeight )
{
ByteString sHeight(
ByteString::CreateFromInt32( (sal_Int32)nPrcHeight ) );
sHeight += '%';
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_line_height, sHeight );
}
return rWrt;
}
static Writer& OutCSS1_SvxAdjust( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
// Alignment in Style-Option nur ausgeben, wenn das Tag kein
// ALIGN=xxx zulaesst
if( rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) &&
!rHTMLWrt.bNoAlign)
return rWrt;
const sal_Char* pStr = 0;
switch( ((const SvxAdjustItem&)rHt).GetAdjust() )
{
case SVX_ADJUST_LEFT: pStr = sCSS1_PV_left; break;
case SVX_ADJUST_RIGHT: pStr = sCSS1_PV_right; break;
case SVX_ADJUST_BLOCK: pStr = sCSS1_PV_justify; break;
case SVX_ADJUST_CENTER: pStr = sCSS1_PV_center; break;
default:
;
}
if( pStr )
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_text_align, pStr );
return rWrt;
}
static Writer& OutCSS1_SvxFmtSplit( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
const sal_Char *pStr = ((const SvxFmtSplitItem&)rHt).GetValue()
? sCSS1_PV_auto
: sCSS1_PV_avoid;
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_page_break_inside, pStr );
return rWrt;
}
static Writer& OutCSS1_SwFmtLayoutSplit( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
const sal_Char *pStr = ((const SwFmtLayoutSplit&)rHt).GetValue()
? sCSS1_PV_auto
: sCSS1_PV_avoid;
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_page_break_inside, pStr );
return rWrt;
}
static Writer& OutCSS1_SvxWidows( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
ByteString aStr(
ByteString::CreateFromInt32( ((const SvxWidowsItem&)rHt).GetValue() ) );
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_widows, aStr );
return rWrt;
}
static Writer& OutCSS1_SvxOrphans( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
ByteString aStr(
ByteString::CreateFromInt32( ((const SvxOrphansItem&)rHt).GetValue() ) );
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_orphans, aStr );
return rWrt;
}
static void OutCSS1_SwFmtDropAttrs( SwHTMLWriter& rHWrt,
const SwFmtDrop& rDrop,
const SfxItemSet *pCharFmtItemSet )
{
// Text fliesst rechts drumrum
rHWrt.OutCSS1_PropertyAscii( sCSS1_P_float, sCSS1_PV_left );
// Anzahl der Zeilen -> %-Angabe fuer Font-Hoehe!
ByteString sOut( ByteString::CreateFromInt32( rDrop.GetLines()*100 ) );
sOut += '%';
rHWrt.OutCSS1_PropertyAscii( sCSS1_P_font_size, sOut );
// Abstand zum Text = rechter Rand
sal_uInt16 nDistance = rDrop.GetDistance();
if( nDistance > 0 )
rHWrt.OutCSS1_UnitProperty( sCSS1_P_margin_right, nDistance );
const SwCharFmt *pDCCharFmt = rDrop.GetCharFmt();
if( pCharFmtItemSet )
rHWrt.OutCSS1_SfxItemSet( *pCharFmtItemSet );
else if( pDCCharFmt )
rHWrt.OutCSS1_SfxItemSet( pDCCharFmt->GetAttrSet() );
else if( (rHWrt.nCSS1OutMode & CSS1_OUTMODE_ANY_OFF) == CSS1_OUTMODE_RULE_OFF )
rHWrt.Strm() << sCSS1_rule_end;
}
static Writer& OutCSS1_SwFmtDrop( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
// nie als Option eines Absatzes ausgeben, sondern nur als Hints
if( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT) )
return rWrt;
if( rHTMLWrt.bTagOn )
{
SwCSS1OutMode aMode( rHTMLWrt,
rHTMLWrt.nCSS1Script|CSS1_OUTMODE_SPAN_TAG1_ON|CSS1_OUTMODE_ENCODE|
CSS1_OUTMODE_DROPCAP );
OutCSS1_SwFmtDropAttrs( rHTMLWrt, (const SwFmtDrop&)rHt );
// Ein "> wird schon vom aufrufenden OutCSS1_HintAsSpanTag geschrieben.
}
else
{
HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_span, sal_False );
}
return rWrt;
}
static Writer& OutCSS1_SwFmtFrmSize( Writer& rWrt, const SfxPoolItem& rHt,
sal_uInt16 nMode )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
ByteString sOut;
const SwFmtFrmSize& rFSItem = (const SwFmtFrmSize&)rHt;
if( nMode & CSS1_FRMSIZE_WIDTH )
{
sal_uInt8 nPrcWidth = rFSItem.GetWidthPercent();
if( nPrcWidth )
{
(sOut = ByteString::CreateFromInt32( nPrcWidth) ) += '%';
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_width, sOut );
}
else if( nMode & CSS1_FRMSIZE_PIXEL )
{
rHTMLWrt.OutCSS1_PixelProperty( sCSS1_P_width,
rFSItem.GetSize().Width(), sal_False );
}
else
{
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_width,
rFSItem.GetSize().Width() );
}
}
if( nMode & CSS1_FRMSIZE_ANYHEIGHT )
{
sal_Bool bOutHeight = sal_False;
switch( rFSItem.GetHeightSizeType() )
{
case ATT_FIX_SIZE:
bOutHeight = (nMode & CSS1_FRMSIZE_FIXHEIGHT) != 0;
break;
case ATT_MIN_SIZE:
bOutHeight = (nMode & CSS1_FRMSIZE_MINHEIGHT) != 0;
break;
case ATT_VAR_SIZE:
bOutHeight = (nMode & CSS1_FRMSIZE_VARHEIGHT) != 0;
break;
default:
ASSERT( bOutHeight, "Hoehe wird nicht exportiert" );
break;
}
if( bOutHeight )
{
sal_uInt8 nPrcHeight = rFSItem.GetHeightPercent();
if( nPrcHeight )
{
(sOut = ByteString::CreateFromInt32( nPrcHeight ) ) += '%';
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_height, sOut );
}
else if( nMode & CSS1_FRMSIZE_PIXEL )
{
rHTMLWrt.OutCSS1_PixelProperty( sCSS1_P_height,
rFSItem.GetSize().Width(),
sal_True );
}
else
{
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_height,
rFSItem.GetSize().Height() );
}
}
}
return rWrt;
}
static Writer& OutCSS1_SvxLRSpace( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
const SvxLRSpaceItem& rLRItem = (const SvxLRSpaceItem&)rHt;
// Der Export der harten Attributierung ist unnoetig, wenn die
// neuen Werte denen der aktuellen Vorlage entsprechen
// Einen linken Rand kann es durch eine Liste bereits in der
// Umgebung geben
long nLeftMargin = (long)rLRItem.GetTxtLeft() - rHTMLWrt.nLeftMargin;
if( rHTMLWrt.nDfltLeftMargin != nLeftMargin )
{
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_margin_left, nLeftMargin );
}
if( rHTMLWrt.nDfltRightMargin != rLRItem.GetRight() )
{
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_margin_right,
(long)rLRItem.GetRight() );
}
// Der Erstzeilen-Einzug kann den Platz fuer eine Numerierung
// enthalten
long nFirstLineIndent = (long)rLRItem.GetTxtFirstLineOfst() -
rHTMLWrt.nFirstLineIndent;
if( rHTMLWrt.nDfltFirstLineIndent != nFirstLineIndent )
{
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_text_indent,
nFirstLineIndent );
}
return rWrt;
}
static Writer& OutCSS1_SvxULSpace( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
const SvxULSpaceItem& rULItem = (const SvxULSpaceItem&)rHt;
if( rHTMLWrt.nDfltTopMargin != rULItem.GetUpper() )
{
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_margin_top,
(long)rULItem.GetUpper() );
}
if( rHTMLWrt.nDfltBottomMargin != rULItem.GetLower() )
{
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_margin_bottom,
(long)rULItem.GetLower() );
}
return rWrt;
}
static Writer& OutCSS1_SvxULSpace_SvxLRSpace( Writer& rWrt,
const SvxULSpaceItem *pULItem,
const SvxLRSpaceItem *pLRItem )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
if( pLRItem && pULItem &&
pLRItem->GetLeft() == pLRItem->GetRight() &&
pLRItem->GetLeft() == pULItem->GetUpper() &&
pLRItem->GetLeft() == pULItem->GetLower() &&
pLRItem->GetLeft() != rHTMLWrt.nDfltLeftMargin &&
pLRItem->GetRight() != rHTMLWrt.nDfltRightMargin &&
pULItem->GetUpper() != rHTMLWrt.nDfltTopMargin &&
pULItem->GetLower() != rHTMLWrt.nDfltBottomMargin )
{
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_margin, (long)pLRItem->GetLeft() );
}
else
{
if( pLRItem )
OutCSS1_SvxLRSpace( rWrt, *pLRItem );
if( pULItem )
OutCSS1_SvxULSpace( rWrt, *pULItem );
}
return rWrt;
}
static Writer& OutCSS1_SvxULSpace_SvxLRSpace( Writer& rWrt,
const SfxItemSet& rItemSet,
sal_Bool bDeep )
{
const SvxULSpaceItem *pULSpace = 0;
const SvxLRSpaceItem *pLRSpace = 0;
const SfxPoolItem *pItem;
if( SFX_ITEM_SET == rItemSet.GetItemState( RES_LR_SPACE, bDeep, &pItem ) )
pLRSpace = (const SvxLRSpaceItem *)pItem;
if( SFX_ITEM_SET == rItemSet.GetItemState( RES_UL_SPACE, bDeep, &pItem ) )
pULSpace = (const SvxULSpaceItem *)pItem;
if( pLRSpace || pULSpace )
OutCSS1_SvxULSpace_SvxLRSpace( rWrt, pULSpace, pLRSpace );
return rWrt;
}
static Writer& OutCSS1_SvxFmtBreak_SwFmtPDesc_SvxFmtKeep( Writer& rWrt,
const SvxFmtBreakItem *pBreakItem,
const SwFmtPageDesc *pPDescItem,
const SvxFmtKeepItem *pKeepItem )
{
SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
if( !rHTMLWrt.IsHTMLMode(HTMLMODE_PRINT_EXT) )
return rWrt;
const sal_Char *pBreakBefore = 0;
const sal_Char *pBreakAfter = 0;
if( pKeepItem )
{
pBreakAfter = pKeepItem->GetValue() ? sCSS1_PV_avoid : sCSS1_PV_auto;
}
if( pBreakItem )
{
switch( pBreakItem->GetBreak() )
{
case SVX_BREAK_NONE:
pBreakBefore = sCSS1_PV_auto;
if( !pBreakAfter )
pBreakAfter = sCSS1_PV_auto;
break;
case SVX_BREAK_PAGE_BEFORE:
pBreakBefore = sCSS1_PV_always;
break;
case SVX_BREAK_PAGE_AFTER:
pBreakAfter= sCSS1_PV_always;
break;
default:
;
}
}
if( pPDescItem )
{
const SwPageDesc *pPDesc = pPDescItem->GetPageDesc();
if( pPDesc )
{
switch( pPDesc->GetPoolFmtId() )
{
case RES_POOLPAGE_LEFT: pBreakBefore = sCSS1_PV_left; break;
case RES_POOLPAGE_RIGHT: pBreakBefore = sCSS1_PV_right; break;
default: pBreakBefore = sCSS1_PV_always; break;
}
}
else if( !pBreakBefore )
{
pBreakBefore = sCSS1_PV_auto;
}
}
if( pBreakBefore )
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_page_break_before,
pBreakBefore );
if( pBreakAfter )
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_page_break_after,
pBreakAfter );
return rWrt;
}
static Writer& OutCSS1_SvxFmtBreak_SwFmtPDesc_SvxFmtKeep( Writer& rWrt,
const SfxItemSet& rItemSet,
sal_Bool bDeep )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
const SfxPoolItem *pItem;
const SvxFmtBreakItem *pBreakItem = 0;
if( SFX_ITEM_SET==rItemSet.GetItemState( RES_BREAK, bDeep, &pItem ))
pBreakItem = (const SvxFmtBreakItem *)pItem;
const SwFmtPageDesc *pPDescItem = 0;
if( ( !rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) ||
!rHTMLWrt.bCSS1IgnoreFirstPageDesc ||
rHTMLWrt.pStartNdIdx->GetIndex() !=
rHTMLWrt.pCurPam->GetPoint()->nNode.GetIndex() ) &&
SFX_ITEM_SET==rItemSet.GetItemState( RES_PAGEDESC, bDeep, &pItem ))
pPDescItem = (const SwFmtPageDesc*)pItem;
const SvxFmtKeepItem *pKeepItem = 0;
if( SFX_ITEM_SET==rItemSet.GetItemState( RES_KEEP, bDeep, &pItem ))
pKeepItem = (const SvxFmtKeepItem *)pItem;
if( pBreakItem || pPDescItem || pKeepItem )
OutCSS1_SvxFmtBreak_SwFmtPDesc_SvxFmtKeep( rWrt, pBreakItem,
pPDescItem, pKeepItem );
return rWrt;
}
// Wrapper fuer OutCSS1_SfxItemSet etc.
static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt )
{
OutCSS1_SvxBrush( rWrt, rHt, CSS1_BACKGROUND_ATTR, 0 );
return rWrt;
}
static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt,
sal_uInt16 nMode, const String *pGrfName )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
// Das Zeichen-Attribut wird nicht ausgegeben, wenn gerade
// Optionen ausgegeben werden
if( rHt.Which() < RES_CHRATR_END &&
rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_PARA ) )
return rWrt;
// Erstmal ein par Werte holen
// const Brush &rBrush = ((const SvxBrushItem &)rHt).GetBrush();
const Color & rColor = ((const SvxBrushItem &)rHt).GetColor();
const String *pLink = pGrfName ? pGrfName
: ((const SvxBrushItem &)rHt).GetGraphicLink();
SvxGraphicPosition ePos = ((const SvxBrushItem &)rHt).GetGraphicPos();
if( CSS1_BACKGROUND_PAGE==nMode )
{
// Fuer Seitenvorlagen wurde der Grafik-Name uebergeben. Es wird
// nur ein Attribut ausgegeben, wenn die Grafik nicht gekachelt ist.
ASSERT( pLink, "Wo ist der Grafik-Name der Seitenvorlage?" );
if( !pLink || !pLink->Len() || GPOS_TILED==ePos )
return rWrt;
}
// Erstmal die Farbe holen
sal_Bool bColor = sal_False;
/// OD 02.09.2002 #99657#
/// set <bTransparent> to sal_True, if color is "no fill"/"auto fill"
sal_Bool bTransparent = (rColor.GetColor() == COL_TRANSPARENT);
Color aColor;
if( !bTransparent )
{
aColor = rColor;
bColor = sal_True;
}
// und jetzt eine Grafik
String sGrfNm;
if( !pLink )
{
// embeddete Grafik -> WriteEmbedded schreiben
const Graphic* pGrf = ((const SvxBrushItem &)rHt).GetGraphic();
if( pGrf )
{
// Grafik als (JPG-)File speichern
const String* pTempFileName = rHTMLWrt.GetOrigFileName();
if( pTempFileName )
sGrfNm = *pTempFileName;
sal_uInt16 nErr = XOutBitmap::WriteGraphic( *pGrf, sGrfNm,
String::CreateFromAscii("JPG"),
XOUTBMP_USE_NATIVE_IF_POSSIBLE );
if( !nErr ) // fehlerhaft, da ist nichts auszugeben
{
sGrfNm = URIHelper::SmartRel2Abs(
INetURLObject(rWrt.GetBaseURL()), sGrfNm,
URIHelper::GetMaybeFileHdl() );
pLink = &sGrfNm;
}
else
{
rHTMLWrt.nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE;
}
}
}
else if( !pGrfName && rHTMLWrt.bCfgCpyLinkedGrfs )
{
sGrfNm = *pLink;
rWrt.CopyLocalFileToINet( sGrfNm );
pLink = &sGrfNm;
}
// In Tabellen wird nur dann etwas exportiert, wenn eine Grafik
// existiert.
if( CSS1_BACKGROUND_TABLE==nMode && !pLink )
return rWrt;
// ggf. noch die Ausrichtung der Grafik
const sal_Char *pRepeat = 0, *pHori = 0, *pVert = 0;
if( pLink )
{
if( GPOS_TILED==ePos )
{
pRepeat = sCSS1_PV_repeat;
}
else
{
switch( ePos )
{
case GPOS_LT:
case GPOS_MT:
case GPOS_RT:
pHori = sCSS1_PV_top;
break;
case GPOS_LM:
case GPOS_MM:
case GPOS_RM:
pHori = sCSS1_PV_middle;
break;
case GPOS_LB:
case GPOS_MB:
case GPOS_RB:
pHori = sCSS1_PV_bottom;
break;
default:
;
}
switch( ePos )
{
case GPOS_LT:
case GPOS_LM:
case GPOS_LB:
pVert = sCSS1_PV_left;
break;
case GPOS_MT:
case GPOS_MM:
case GPOS_MB:
pVert = sCSS1_PV_center;
break;
case GPOS_RT:
case GPOS_RM:
case GPOS_RB:
pVert = sCSS1_PV_right;
break;
default:
;
}
if( pHori || pVert )
pRepeat = sCSS1_PV_no_repeat;
}
}
// jetzt den String zusammen bauen
String sOut;
if( !pLink && !bColor )
{
// keine Farbe und kein Link, aber ein transparenter Brush
if( bTransparent && CSS1_BACKGROUND_FLY != nMode )
sOut.AssignAscii( sCSS1_PV_transparent );
}
else
{
if( bColor )
{
ByteString sTmp;
GetCSS1Color( aColor, sTmp );
sOut += String( sTmp, RTL_TEXTENCODING_ASCII_US );
}
if( pLink )
{
if( bColor )
sOut += ' ';
sOut.AppendAscii( sCSS1_url );
sOut.Append( '(' );
sOut.Append( String(URIHelper::simpleNormalizedMakeRelative(rWrt.GetBaseURL(),
*pLink)));
sOut.Append( ')' );
if( pRepeat )
{
sOut.Append( ' ' );
sOut.AppendAscii( pRepeat );
}
if( pHori )
{
sOut.Append( ' ' );
sOut.AppendAscii( pHori );
}
if( pVert )
{
sOut.Append( ' ' );
sOut.AppendAscii( pVert );
}
sOut.Append( ' ' );
sOut.AppendAscii( sCSS1_PV_scroll );
}
}
if( sOut.Len() )
rHTMLWrt.OutCSS1_Property( sCSS1_P_background, sOut );
return rWrt;
}
static void OutCSS1_SvxBorderLine( SwHTMLWriter& rHTMLWrt,
const sal_Char *pProperty,
const SvxBorderLine *pLine )
{
if( !pLine )
{
rHTMLWrt.OutCSS1_PropertyAscii( pProperty, sCSS1_PV_none );
return;
}
sal_Bool bDouble = sal_False;
sal_Int32 nWidth = pLine->GetOutWidth();
if( pLine->GetInWidth() )
{
nWidth += pLine->GetDistance();
nWidth += pLine->GetInWidth();
bDouble = sal_True;
}
ByteString sOut;
if( Application::GetDefaultDevice() &&
nWidth <= Application::GetDefaultDevice()->PixelToLogic(
Size( 1, 1 ), MapMode( MAP_TWIP) ).Width() )
{
// Wenn die Breite kleiner ist als ein Pixel, dann als 1px
// ausgeben, damit Netscape und IE die Linie auch darstellen.
sOut += "1px";
}
else
{
nWidth *= 5; // 1/100pt
// Breite als n.nn pt
sOut += ByteString::CreateFromInt32( nWidth / 100 );
(((sOut += '.')
+= ByteString::CreateFromInt32((nWidth/10) % 10))
+= ByteString::CreateFromInt32(nWidth % 10)) += sCSS1_UNIT_pt;
}
// Linien-Stil: solid oder double
((sOut += ' ')
+= (bDouble ? sCSS1_PV_double : sCSS1_PV_solid)) += ' ';
// und noch die Farbe
GetCSS1Color( pLine->GetColor(), sOut );
rHTMLWrt.OutCSS1_PropertyAscii( pProperty, sOut );
}
static Writer& OutCSS1_SvxBox( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
// Das Zeichen-Attribut wird nicht ausgegeben, wenn gerade
// Optionen ausgegeben werden
if( !rHTMLWrt.IsHTMLMode(HTMLMODE_PARA_BORDER))
return rWrt;
const SvxBoxItem& rBoxItem = (const SvxBoxItem&)rHt;
const SvxBorderLine *pTop = rBoxItem.GetTop();
const SvxBorderLine *pBottom = rBoxItem.GetBottom();
const SvxBorderLine *pLeft = rBoxItem.GetLeft();
const SvxBorderLine *pRight = rBoxItem.GetRight();
if( (pTop && pBottom && pLeft && pRight &&
*pTop == *pBottom && *pTop == *pLeft && *pTop == *pRight) ||
(!pTop && !pBottom && !pLeft && !pRight) )
{
// alle Linien gesetzt und gleich oder alle Linien nicht gesetzt
// => border : ...
OutCSS1_SvxBorderLine( rHTMLWrt, sCSS1_P_border, pTop );
}
else
{
// sonst alle Linien individuell ausgeben
OutCSS1_SvxBorderLine( rHTMLWrt, sCSS1_P_border_top, pTop );
OutCSS1_SvxBorderLine( rHTMLWrt, sCSS1_P_border_bottom, pBottom );
OutCSS1_SvxBorderLine( rHTMLWrt, sCSS1_P_border_left, pLeft );
OutCSS1_SvxBorderLine( rHTMLWrt, sCSS1_P_border_right, pRight );
}
long nTopDist = pTop ? rBoxItem.GetDistance( BOX_LINE_TOP ) : 0;
long nBottomDist = pBottom ? rBoxItem.GetDistance( BOX_LINE_BOTTOM ) : 0;
long nLeftDist = pLeft ? rBoxItem.GetDistance( BOX_LINE_LEFT ) : 0;
long nRightDist = pRight ? rBoxItem.GetDistance( BOX_LINE_RIGHT ) : 0;
if( nTopDist == nBottomDist && nLeftDist == nRightDist )
{
ByteString sVal;
AddUnitPropertyValue( nTopDist, rHTMLWrt.GetCSS1Unit(), sVal );
if( nTopDist != nLeftDist )
{
sVal += ' ';
AddUnitPropertyValue( nLeftDist, rHTMLWrt.GetCSS1Unit(), sVal );
}
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_padding, sVal );
}
else
{
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_padding_top, nTopDist );
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_padding_bottom, nBottomDist );
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_padding_left, nLeftDist );
rHTMLWrt.OutCSS1_UnitProperty( sCSS1_P_padding_right, nRightDist );
}
return rWrt;
}
static Writer& OutCSS1_SvxFrameDirection( Writer& rWrt, const SfxPoolItem& rHt )
{
SwHTMLWriter& rHTMLWrt = static_cast< SwHTMLWriter& >( rWrt );
// Language will be exported rules only
if( !rHTMLWrt.IsCSS1Source( CSS1_OUTMODE_TEMPLATE ) )
return rWrt;
sal_uInt16 nDir =
static_cast< const SvxFrameDirectionItem& >( rHt ).GetValue();
sal_Char *pStr = 0;
switch( nDir )
{
case FRMDIR_HORI_LEFT_TOP:
case FRMDIR_VERT_TOP_LEFT:
pStr = sCSS1_PV_ltr;
break;
case FRMDIR_HORI_RIGHT_TOP:
case FRMDIR_VERT_TOP_RIGHT:
pStr = sCSS1_PV_rtl;
break;
case FRMDIR_ENVIRONMENT:
pStr = sCSS1_PV_inherit;
break;
}
if( pStr )
rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_direction, pStr );
return rWrt;
}
/*
* lege hier die Tabellen fuer die HTML-Funktions-Pointer auf
* die Ausgabe-Funktionen an.
* Es sind lokale Strukturen, die nur innerhalb der HTML-DLL
* bekannt sein muessen.
*/
SwAttrFnTab aCSS1AttrFnTab = {
/* RES_CHRATR_CASEMAP */ OutCSS1_SvxCaseMap,
/* RES_CHRATR_CHARSETCOLOR */ 0,
/* RES_CHRATR_COLOR */ OutCSS1_SvxColor,
/* RES_CHRATR_CONTOUR */ 0,
/* RES_CHRATR_CROSSEDOUT */ OutCSS1_SvxCrossedOut,
/* RES_CHRATR_ESCAPEMENT */ 0,
/* RES_CHRATR_FONT */ OutCSS1_SvxFont,
/* RES_CHRATR_FONTSIZE */ OutCSS1_SvxFontHeight,
/* RES_CHRATR_KERNING */ OutCSS1_SvxKerning,
/* RES_CHRATR_LANGUAGE */ OutCSS1_SvxLanguage,
/* RES_CHRATR_POSTURE */ OutCSS1_SvxPosture,
/* RES_CHRATR_PROPORTIONALFONTSIZE*/0,
/* RES_CHRATR_SHADOWED */ 0,
/* RES_CHRATR_UNDERLINE */ OutCSS1_SvxUnderline,
/* RES_CHRATR_WEIGHT */ OutCSS1_SvxFontWeight,
/* RES_CHRATR_WORDLINEMODE */ 0,
/* RES_CHRATR_AUTOKERN */ 0,
/* RES_CHRATR_BLINK */ OutCSS1_SvxBlink,
/* RES_CHRATR_NOHYPHEN */ 0, // Neu: nicht trennen
/* RES_CHRATR_NOLINEBREAK */ 0, // Neu: nicht umbrechen
/* RES_CHRATR_BACKGROUND */ OutCSS1_SvxBrush, // Neu: Zeichenhintergrund
/* RES_CHRATR_CJK_FONT */ OutCSS1_SvxFont,
/* RES_CHRATR_CJK_FONTSIZE */ OutCSS1_SvxFontHeight,
/* RES_CHRATR_CJK_LANGUAGE */ OutCSS1_SvxLanguage,
/* RES_CHRATR_CJK_POSTURE */ OutCSS1_SvxPosture,
/* RES_CHRATR_CJK_WEIGHT */ OutCSS1_SvxFontWeight,
/* RES_CHRATR_CTL_FONT */ OutCSS1_SvxFont,
/* RES_CHRATR_CTL_FONTSIZE */ OutCSS1_SvxFontHeight,
/* RES_CHRATR_CTL_LANGUAGE */ OutCSS1_SvxLanguage,
/* RES_CHRATR_CTL_POSTURE */ OutCSS1_SvxPosture,
/* RES_CHRATR_CTL_WEIGHT */ OutCSS1_SvxFontWeight,
/* RES_CHRATR_ROTATE */ 0,
/* RES_CHRATR_EMPHASIS_MARK */ 0,
/* RES_CHRATR_TWO_LINES */ 0,
/* RES_CHRATR_SCALEW */ 0,
/* RES_CHRATR_RELIEF */ 0,
/* RES_CHRATR_HIDDEN */ 0,
/* RES_CHRATR_OVERLINE */ OutCSS1_SvxOverline,
/* RES_CHRATR_DUMMY1 */ 0,
/* RES_CHRATR_DUMMY2 */ 0,
/* RES_CHRATR_BIDIRTL */ 0,
/* RES_CHRATR_IDCTHINT */ 0,
/* RES_TXTATR_REFMARK */ 0,
/* RES_TXTATR_TOXMARK */ 0,
/* RES_TXTATR_META */ 0,
/* RES_TXTATR_METAFIELD */ 0,
/* RES_TXTATR_AUTOFMT */ 0,
/* RES_TXTATR_INETFMT */ 0,
/* RES_TXTATR_CHARFMT */ 0,
/* RES_TXTATR_CJK_RUBY */ 0,
/* RES_TXTATR_UNKNOWN_CONTAINER */ 0,
/* RES_TXTATR_INPUTFIELD */ 0,
/* RES_TXTATR_FIELD */ 0,
/* RES_TXTATR_FLYCNT */ 0,
/* RES_TXTATR_FTN */ 0,
/* RES_TXTATR_ANNOTATION */ 0,
/* RES_TXTATR_DUMMY3 */ 0,
/* RES_TXTATR_DUMMY1 */ 0, // Dummy:
/* RES_TXTATR_DUMMY2 */ 0, // Dummy:
/* RES_PARATR_LINESPACING */ OutCSS1_SvxLineSpacing,
/* RES_PARATR_ADJUST */ OutCSS1_SvxAdjust,
/* RES_PARATR_SPLIT */ OutCSS1_SvxFmtSplit,
/* RES_PARATR_WIDOWS */ OutCSS1_SvxWidows,
/* RES_PARATR_ORPHANS */ OutCSS1_SvxOrphans,
/* RES_PARATR_TABSTOP */ 0,
/* RES_PARATR_HYPHENZONE*/ 0,
/* RES_PARATR_DROP */ OutCSS1_SwFmtDrop,
/* RES_PARATR_REGISTER */ 0, // neu: Registerhaltigkeit
/* RES_PARATR_NUMRULE */ 0,
/* RES_PARATR_SCRIPTSPACE */ 0,
/* RES_PARATR_HANGINGPUNCTUATION */ 0,
/* RES_PARATR_FORBIDDEN_RULES */ 0, // new
/* RES_PARATR_VERTALIGN */ 0, // new
/* RES_PARATR_SNAPTOGRID*/ 0, // new
/* RES_PARATR_CONNECT_TO_BORDER */ 0, // new
/* RES_PARATR_OUTLINELEVEL */ 0, // new since cws outlinelevel
/* RES_PARATR_LIST_ID */ 0, // new
/* RES_PARATR_LIST_LEVEL */ 0, // new
/* RES_PARATR_LIST_ISRESTART */ 0, // new
/* RES_PARATR_LIST_RESTARTVALUE */ 0, // new
/* RES_PARATR_LIST_ISCOUNTED */ 0, // new
/* RES_FILL_ORDER */ 0,
/* RES_FRM_SIZE */ 0,
/* RES_PAPER_BIN */ 0,
/* RES_LR_SPACE */ OutCSS1_SvxLRSpace,
/* RES_UL_SPACE */ OutCSS1_SvxULSpace,
/* RES_PAGEDESC */ 0,
/* RES_BREAK */ 0,
/* RES_CNTNT */ 0,
/* RES_HEADER */ 0,
/* RES_FOOTER */ 0,
/* RES_PRINT */ 0,
/* RES_OPAQUE */ 0,
/* RES_PROTECT */ 0,
/* RES_SURROUND */ 0,
/* RES_VERT_ORIENT */ 0,
/* RES_HORI_ORIENT */ 0,
/* RES_ANCHOR */ 0,
/* RES_BACKGROUND */ OutCSS1_SvxBrush,
/* RES_BOX */ OutCSS1_SvxBox,
/* RES_SHADOW */ 0,
/* RES_FRMMACRO */ 0,
/* RES_COL */ 0,
/* RES_KEEP */ 0,
/* RES_URL */ 0,
/* RES_EDIT_IN_READONLY */ 0,
/* RES_LAYOUT_SPLIT */ 0,
/* RES_CHAIN */ 0,
/* RES_TEXTGRID */ 0,
/* RES_LINENUMBER */ 0,
/* RES_FTN_AT_TXTEND */ 0,
/* RES_END_AT_TXTEND */ 0,
/* RES_COLUMNBALANCE */ 0,
/* RES_FRAMEDIR */ OutCSS1_SvxFrameDirection,
/* RES_HEADER_FOOTER_EAT_SPACING */ 0,
/* RES_ROW_SPLIT */ 0,
/* RES_FOLLOW_TEXT_FLOW */ 0,
/* RES_COLLAPSING_BORDERS */ 0,
/* RES_WRAP_INFLUENCE_ON_OBJPOS */ 0,
/* RES_AUTO_STYLE */ 0,
/* RES_FRMATR_STYLE_NAME */ 0,
/* RES_FRMATR_CONDITIONAL_STYLE_NAME */ 0,
/* RES_GRFATR_MIRRORGRF */ 0,
/* RES_GRFATR_CROPGRF */ 0,
/* RES_GRFATR_ROTATION */ 0,
/* RES_GRFATR_LUMINANCE */ 0,
/* RES_GRFATR_CONTRAST */ 0,
/* RES_GRFATR_CHANNELR */ 0,
/* RES_GRFATR_CHANNELG */ 0,
/* RES_GRFATR_CHANNELB */ 0,
/* RES_GRFATR_GAMMA */ 0,
/* RES_GRFATR_INVERT */ 0,
/* RES_GRFATR_TRANSPARENCY */ 0,
/* RES_GRFATR_DRWAMODE */ 0,
/* RES_GRFATR_DUMMY1 */ 0,
/* RES_GRFATR_DUMMY2 */ 0,
/* RES_GRFATR_DUMMY3 */ 0,
/* RES_GRFATR_DUMMY4 */ 0,
/* RES_GRFATR_DUMMY5 */ 0,
/* RES_BOXATR_FORMAT */ 0,
/* RES_BOXATR_FORMULA */ 0,
/* RES_BOXATR_VALUE */ 0
};
| 28.667877 | 152 | 0.688266 |
2f32a19bcab7ef2307407504b00508170f6f8d56 | 1,198 | cs | C# | ClinicManagement/Migrations/201808301448049_AddPatientAttandenceRelationship.cs | satyaCsgithub/ClinicManagement | 968a24bd612acf743b16ab26f67a7bae4cfab390 | [
"MIT"
] | 1 | 2021-03-10T22:38:50.000Z | 2021-03-10T22:38:50.000Z | ClinicManagement/Migrations/201808301448049_AddPatientAttandenceRelationship.cs | XFSDev/ClinicManagement | 5235482fc4c4b88681fca831efa5799cacfe7604 | [
"MIT"
] | null | null | null | ClinicManagement/Migrations/201808301448049_AddPatientAttandenceRelationship.cs | XFSDev/ClinicManagement | 5235482fc4c4b88681fca831efa5799cacfe7604 | [
"MIT"
] | 1 | 2020-08-20T18:37:05.000Z | 2020-08-20T18:37:05.000Z | namespace ClinicManagement.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AddPatientAttandenceRelationship : DbMigration
{
public override void Up()
{
DropForeignKey("dbo.Appointments", "PatientId", "dbo.Patients");
AddColumn("dbo.Attendances", "PatientId", c => c.Int(nullable: false));
CreateIndex("dbo.Attendances", "PatientId");
AddForeignKey("dbo.Attendances", "PatientId", "dbo.Patients", "Id", cascadeDelete: true);
AddForeignKey("dbo.Appointments", "PatientId", "dbo.Patients", "Id");
}
public override void Down()
{
DropForeignKey("dbo.Appointments", "PatientId", "dbo.Patients");
DropForeignKey("dbo.Attendances", "PatientId", "dbo.Patients");
DropIndex("dbo.Attendances", new[] { "PatientId" });
DropColumn("dbo.Attendances", "PatientId");
AddForeignKey("dbo.Appointments", "PatientId", "dbo.Patients", "Id", cascadeDelete: true);
AddForeignKey("dbo.Attendances", "AppointmentId", "dbo.Appointments", "Id", cascadeDelete: true);
}
}
}
| 42.785714 | 109 | 0.613523 |
68211d50b0c91f7dc8470bacffad331f95f3d3be | 2,454 | cpp | C++ | HuffmanTree.cpp | xixingya/DataStructure | 881e9f89b8c3656b3db58ca5542e7f61fc811c66 | [
"MIT"
] | 1 | 2019-01-08T05:15:16.000Z | 2019-01-08T05:15:16.000Z | HuffmanTree.cpp | xixingya/DataStructure | 881e9f89b8c3656b3db58ca5542e7f61fc811c66 | [
"MIT"
] | null | null | null | HuffmanTree.cpp | xixingya/DataStructure | 881e9f89b8c3656b3db58ca5542e7f61fc811c66 | [
"MIT"
] | null | null | null | //
// Created by 26794 on 2018/12/13.
//
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 10 // 带编码字符的个数,即树中叶结点的最大个数
#define M (2*N-1) // 树中总的结点数目
class HTNode{ // 树中结点的结构
public:
unsigned int weight;
unsigned int parent,lchild,rchild;
};
class HTCode{
public:
char data; // 待编码的字符
int weight; // 字符的权值
char code[N]; // 字符的编码
};
void Init(HTCode hc[], int *n){
// 初始化,读入待编码字符的个数n,从键盘输入n个字符和n个权值
int i;
printf("input n = ");
scanf("%d",&(*n));
printf("\ninput %d character\n",*n);
fflush(stdin);
for(i=1; i<=*n; ++i)
scanf("%c",&hc[i].data);
printf("\ninput %d weight\n",*n);
for(i=1; i<=*n; ++i)
scanf("%d",&(hc[i].weight) );
fflush(stdin);
}//
void Select(HTNode ht[], int k, int *s1, int *s2){
// ht[1...k]中选择parent为0,并且weight最小的两个结点,其序号由指针变量s1,s2指示
int i;
for(i=1; i<=k && ht[i].parent != 0; ++i){
; ;
}
*s1 = i;
for(i=1; i<=k; ++i){
if(ht[i].parent==0 && ht[i].weight<ht[*s1].weight)
*s1 = i;
}
for(i=1; i<=k; ++i){
if(ht[i].parent==0 && i!=*s1)
break;
}
*s2 = i;
for(i=1; i<=k; ++i){
if(ht[i].parent==0 && i!=*s1 && ht[i].weight<ht[*s2].weight)
*s2 = i;
}
}
void HuffmanCoding(HTNode ht[],HTCode hc[],int n){
// 构造Huffman树ht,并求出n个字符的编码
char cd[N];
int i,j,m,c,f,s1,s2,start;
m = 2*n-1;
for(i=1; i<=m; ++i){
if(i <= n)
ht[i].weight = hc[i].weight;
else
ht[i].parent = 0;
ht[i].parent = ht[i].lchild = ht[i].rchild = 0;
}
for(i=n+1; i<=m; ++i){
Select(ht, i-1, &s1, &s2);
ht[s1].parent = i;
ht[s2].parent = i;
ht[i].lchild = s1;
ht[i].rchild = s2;
ht[i].weight = ht[s1].weight+ht[s2].weight;
}
cd[n-1] = '\0';
for(i=1; i<=n; ++i){
start = n-1;
for(c=i,f=ht[i].parent; f; c=f,f=ht[f].parent){
if(ht[f].lchild == c)
cd[--start] = '0';
else
cd[--start] = '1';
}
strcpy(hc[i].code, &cd[start]);
}
}
int main()
{
int i,m,n,w[N+1];
HTNode ht[M+1];
HTCode hc[N+1];
Init(hc, &n); // 初始化
HuffmanCoding(ht,hc,n); // 构造Huffman树,并形成字符的编码
for(i=1; i<=n; ++i)
printf("\n%c---%s",hc[i].data,hc[i].code);
printf("\n");
return 0;
}
| 20.280992 | 68 | 0.464955 |
444586fadd880d4081c00d0e239994b1d76f4f46 | 287 | lua | Lua | MMOCoreORB/bin/scripts/object/custom_content/tangible/holiday/empire_day/decorative_rebel_candy.lua | V-Fib/FlurryClone | 40e0ca7245ec31b3815eb6459329fd9e70f88936 | [
"Zlib",
"OpenSSL"
] | 18 | 2017-02-09T15:36:05.000Z | 2021-12-21T04:22:15.000Z | MMOCoreORB/bin/scripts/object/custom_content/tangible/holiday/empire_day/decorative_rebel_candy.lua | V-Fib/FlurryClone | 40e0ca7245ec31b3815eb6459329fd9e70f88936 | [
"Zlib",
"OpenSSL"
] | 61 | 2016-12-30T21:51:10.000Z | 2021-12-10T20:25:56.000Z | MMOCoreORB/bin/scripts/object/custom_content/tangible/holiday/empire_day/decorative_rebel_candy.lua | V-Fib/FlurryClone | 40e0ca7245ec31b3815eb6459329fd9e70f88936 | [
"Zlib",
"OpenSSL"
] | 71 | 2017-01-01T05:34:38.000Z | 2022-03-29T01:04:00.000Z | object_tangible_holiday_empire_day_decorative_rebel_candy = object_tangible_holiday_empire_day_shared_decorative_rebel_candy:new {
}
ObjectTemplates:addTemplate(object_tangible_holiday_empire_day_decorative_rebel_candy, "object/tangible/holiday/empire_day/decorative_rebel_candy.iff")
| 47.833333 | 151 | 0.916376 |
a1d0e66e0b0065bf6f2b4c93b5ed7c272289facd | 3,693 | h | C | include/kern/vm-if.h | takeharukato/risc-v-workshop | f317b87077bf308c67097d25fb71561394d0ebfa | [
"BSD-2-Clause"
] | null | null | null | include/kern/vm-if.h | takeharukato/risc-v-workshop | f317b87077bf308c67097d25fb71561394d0ebfa | [
"BSD-2-Clause"
] | null | null | null | include/kern/vm-if.h | takeharukato/risc-v-workshop | f317b87077bf308c67097d25fb71561394d0ebfa | [
"BSD-2-Clause"
] | null | null | null | /* -*- mode: C; coding:utf-8 -*- */
/**********************************************************************/
/* OS kernel sample */
/* Copyright 2019 Takeharu KATO */
/* */
/* Virtual memory */
/* */
/**********************************************************************/
#if !defined(_KERN_VM_IF_H)
#define _KERN_VM_IF_H
#define VM_PROT_ACS_SHIFT (0) /*< アクセス属性へのシフト値 */
#define VM_PROT_ACS_MASK \
( (0xff) << VM_PROT_ACS_SHIFT ) /*< アクセス属性のマスク値 */
#define VM_PROT_NONE \
( (0x0) << VM_PROT_ACS_SHIFT ) /*< アクセス不可 */
#define VM_PROT_READ \
( (0x1) << VM_PROT_ACS_SHIFT ) /*< 読み込み */
#define VM_PROT_WRITE \
( (0x2) << VM_PROT_ACS_SHIFT ) /*< 書き込み */
#define VM_PROT_EXECUTE \
( (0x4) << VM_PROT_ACS_SHIFT ) /*< 実行 */
#define VM_FLAGS_ATTR_SHIFT (8) /*< ページマップ属性へのシフト値 */
#define VM_FLAGS_ATTR_MASK \
( (0xffff) << VM_FLAGS_ATTR_SHIFT ) /*< ページマップ属性のマスク値 */
#define VM_FLAGS_WIRED \
( (0x1) << VM_FLAGS_ATTR_SHIFT ) /*< ページアウトしない */
#define VM_FLAGS_UNMANAGED \
( (0x2) << VM_FLAGS_ATTR_SHIFT ) /*< ページフレームDBの管理外の領域(I/Oなど)を
* マップしている
*/
#define VM_FLAGS_SUPERVISOR \
( (0x8) << VM_FLAGS_ATTR_SHIFT ) /*< スーパバイザページ */
#define VM_FLAGS_USER \
( (0x0) << VM_FLAGS_ATTR_SHIFT ) /*< ユーザページ */
#define VM_FLAGS_LARGE_PAGE \
( (0x10) << VM_FLAGS_ATTR_SHIFT ) /*< ラージページ利用可能な領域の場合は利用する */
#define VM_FLAGS_DIRTY \
( (0x100) << VM_FLAGS_ATTR_SHIFT ) /*< ページ書き込み済み */
#define VM_FLAGS_ACCESSED \
( (0x200) << VM_FLAGS_ATTR_SHIFT ) /*< アクセス済み */
#define VM_FLAGS_NONE (0) /*< マップ属性なし
- ページアウト可能
- ページフレームDB管理ページ
- ユーザマップ
*/
#if !defined(ASM_FILE)
#include <klib/freestanding.h>
#include <kern/kern-types.h>
#include <kern/kern-cpuinfo.h>
#include <kern/spinlock.h>
#include <kern/mutex.h>
#include <klib/statcnt.h>
#include <hal/hal-pgtbl.h>
struct _proc;
typedef struct _vm_pgtbl_type{
spinlock lock; /*< ビットマップ操作用lock */
cpu_bitmap active; /*< アクティブCPUビットマップ */
struct _mutex mtx; /*< ページテーブル操作用mutex */
hal_pte *pgtbl_base; /*< ページテーブルベース(カーネル仮想アドレス) */
vm_paddr tblbase_paddr; /*< ページテーブルベース(物理アドレス) */
struct _proc *p; /*< procへの逆リンク */
stat_cnt nr_pages; /*< ページテーブルを構成するページ数 */
struct _hal_pgtbl_md md; /*< アーキテクチャ依存部 */
}vm_pgtbl_type;
typedef struct _vm_pgtbl_type *vm_pgtbl; /*< ページテーブル型 */
void vm_pgtbl_cache_init(void);
int pgtbl_alloc_pgtbl_page(vm_pgtbl _pgt, hal_pte **_tblp, vm_paddr *_paddrp);
int pgtbl_alloc_pgtbl(vm_pgtbl *_pgtp);
int pgtbl_alloc_user_pgtbl(vm_pgtbl *_pgtp);
void pgtbl_free_user_pgtbl(vm_pgtbl _pgt);
void vm_copy_kmap_page(void *_dest, void *_src);
size_t vm_strlen(vm_pgtbl _pgt, char const *_s);
size_t vm_memmove(vm_pgtbl _dest_pgt, void *_dest, vm_pgtbl _src_pgt, void *_src,
size_t _len);
int vm_copy_range(vm_pgtbl _dest, vm_pgtbl _src, vm_vaddr _vaddr, vm_flags _flags, vm_size _size);
int vm_unmap(vm_pgtbl _pgt, vm_vaddr _vaddr, vm_flags _flags, vm_size _size);
int vm_map_userpage(vm_pgtbl _pgt, vm_vaddr _vaddr, vm_prot _prot, vm_flags _flags,
vm_size _pgsize, vm_size _size);
#endif /* !ASM_FILE */
#endif /* _KERN_VM_IF_H */
| 39.287234 | 98 | 0.555104 |
e1b52b1ed1b2c6dfdbc27549c63ee67e15793051 | 7,807 | swift | Swift | CGVProject/CGVProject/PigFactory/View & Controller/Booking/BookingViewController.swift | U-Know-Yunho/iOS | 33620429a6b562dc01b5b8dde9c8e1cdc0ce8e27 | [
"MIT"
] | 2 | 2018-11-27T06:20:15.000Z | 2018-12-02T05:18:09.000Z | CGVProject/CGVProject/PigFactory/View & Controller/Booking/BookingViewController.swift | U-Know-Yunho/iOS | 33620429a6b562dc01b5b8dde9c8e1cdc0ce8e27 | [
"MIT"
] | 24 | 2018-12-10T05:13:20.000Z | 2018-12-17T06:36:35.000Z | CGVProject/CGVProject/PigFactory/View & Controller/Booking/BookingViewController.swift | U-Know-Yunho/iOS | 33620429a6b562dc01b5b8dde9c8e1cdc0ce8e27 | [
"MIT"
] | null | null | null |
import UIKit
class BookingViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
var firstScrollEnable = true
//예매창 - 영화 타이틀 셀 - 데이터
var movieTitle = "보헤미안랩소디"
var movieInfo = "12세이상관람가 = 2시간 14분"
//예매창 - 포스터 콜렉션 셀 - 데이터
let images = ["001", "002", "003", "004", "005", "006"]
//예매창 - 날짜 콜렉션 셀 - 데이터
var movieDay = "월"
var movieDate = "10"
var movieDateDetails = "2018년 12월 10일 월요일-오늘"
//예매창 - 영화관 콜렉션 셀 - 데이터
var theaterTimeTable = ["13:00 ~ 15:00", "00:00 ~ 1:00"]
var theaterName = "CGV 서울"
var theaterSeat = "112/255"
var theaterSection = "12관"
//데이터처리 #3 - 영화 정보를 담을 공간을 생성
var movies: [Movie]?
@IBAction func unwindToBooking(_ unwindSegue: UIStoryboardSegue) {
}
override func viewDidLoad() {
super.viewDidLoad()
MovieManager.singleton.loadMovieList { movie in
self.movies = movie
self.tableView.reloadData()
}
}
override func viewDidAppear(_ animated: Bool) {
}
}
extension BookingViewController: UITableViewDelegate, UITableViewDataSource {
//첫번째 섹션(0) = title, poster, date
//두번째 섹션(1) = theater
func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return 3
} else {
return 3
}
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 10
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return nil
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
switch indexPath.row {
case 0:
let cell = tableView.dequeueReusableCell(withIdentifier: "BookingTableMovieTitleCell", for: indexPath) as! BookingTableMovieTitleCell
cell.movieTitle.text = movieTitle
cell.movieInfo.text = movieInfo
return cell
case 1:
let cell = tableView.dequeueReusableCell(withIdentifier: "BookingTableViewCell", for: indexPath) as! BookingTableViewCell
return cell
case 2:
let cell = tableView.dequeueReusableCell(withIdentifier: "BookingDateTableViewCell", for: indexPath) as! BookingDateTableViewCell
cell.movieDateDetails.text = movieDateDetails
return cell
default :
let table = UITableViewCell()
return table
}
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "BookingTheaterTableViewCell", for: indexPath) as! BookingTheaterTableViewCell
cell.theaterName.text = theaterName
cell.theaterSection.text = theaterSection
return cell
}
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
// if indexPath.section == 0 {
// switch indexPath.row {
// case 1:
// (cell as? BookingTableViewCell)?.posterCollectionView.reloadData()
//// (cell as? BookingTableViewCell)?.posterCollectionView.scrollToItem(at: [0 ,4], at: UICollectionView.ScrollPosition.centeredHorizontally, animated: true)
// default:
// break
// }
// }
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 0 {
switch indexPath.row {
case 0:
return 45
case 1:
return 190
case 2:
return 85
default:
return 10
}
} else {
return 110
}
}
}
extension BookingViewController: UICollectionViewDataSource, UICollectionViewDelegate {
// func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool {
// return true
// }
//tag = 0 > 포스터 콜렉션 셀
//tag = 1 > 날짜 콜렉션 셀
//tag = 2 > 극장 콜렉션 셀
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
switch collectionView.tag {
case 0:
guard let movies = self.movies else { return 1 }
return movies.count
case 1:
return 7
case 2:
return 5
default:
return 1
}
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
switch collectionView.tag {
case 0:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "BookingPosterCollectionViewCell", for: indexPath) as! BookingPosterCollectionViewCell
//데이터 처리 #5 - guard문을 통해 서버통신을 확인하고, movies에 저장된 영화포스터정보를 차례대로 cell.model에 넣어준다.
guard let movies = movies else { print("movieList nil"); return cell }
cell.model = MoviePosterCollectionViewCellModel.init(movies[indexPath.row])
//scroll ON/OFF 스위치
if firstScrollEnable == true {
collectionView.scrollToItem(at: [0, 8], at: UICollectionView.ScrollPosition.centeredHorizontally, animated: true)
collectionView.selectItem(at: [0, 8], animated: true, scrollPosition: UICollectionView.ScrollPosition.centeredHorizontally)
firstScrollEnable = false
}
return cell
case 1:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "BookingDateCollectionViewCell", for: indexPath) as! BookingDateCollectionViewCell
cell.movieDate.text = movieDate
cell.movieDay.text = movieDay
return cell
case 2:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "BookingTheaterCollectionViewCell", for: indexPath) as! BookingTheaterCollectionViewCell
cell.theaterTimeTable.setTitle(theaterTimeTable[0], for: .normal)
cell.theaterSeat.text = theaterSeat
return cell
default:
let a = UICollectionViewCell()
return a
}
}
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
}
func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
// switch collectionView.tag {
// case 0:
// collectionView.scrollToItem(at: [0, 8], at: UICollectionView.ScrollPosition.centeredHorizontally, animated: true)
// collectionView.selectItem(at: [0, 8], animated: true, scrollPosition: UICollectionView.ScrollPosition.centeredHorizontally)
// default:
// print(0)
// }
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
switch collectionView.tag {
case 0:
collectionView.scrollToItem(at: indexPath, at: UICollectionView.ScrollPosition.centeredHorizontally, animated: true)
theaterTimeTable.reverse()
// tableView.reloadData()
tableView.reloadSections([1, 1], with: UITableView.RowAnimation.fade)
default:
print(0)
}
}
}
| 35.486364 | 172 | 0.608685 |
4accd91c3f18d40f9425816021e6eb6b19f3378c | 1,195 | cs | C# | src/CoreWCF.Primitives/src/CoreWCF/ServiceKnownTypeAttribute.cs | ekinbarut/CoreWCF | 4a421e402952383491f8394172945567c97a8d88 | [
"MIT"
] | 1,110 | 2019-06-07T17:27:05.000Z | 2022-03-31T10:13:56.000Z | src/CoreWCF.Primitives/src/CoreWCF/ServiceKnownTypeAttribute.cs | ekinbarut/CoreWCF | 4a421e402952383491f8394172945567c97a8d88 | [
"MIT"
] | 403 | 2019-06-07T19:02:20.000Z | 2022-03-31T10:29:50.000Z | src/CoreWCF.Primitives/src/CoreWCF/ServiceKnownTypeAttribute.cs | ekinbarut/CoreWCF | 4a421e402952383491f8394172945567c97a8d88 | [
"MIT"
] | 204 | 2019-06-07T18:11:43.000Z | 2022-03-31T06:35:25.000Z | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace CoreWCF
{
[AttributeUsage(CoreWCFAttributeTargets.ServiceContract | CoreWCFAttributeTargets.OperationContract, Inherited = true, AllowMultiple = true)]
public sealed class ServiceKnownTypeAttribute : Attribute
{
private ServiceKnownTypeAttribute()
{
// Disallow default constructor
}
public ServiceKnownTypeAttribute(Type type)
{
Type = type;
}
// The named method must take a parameter of ICustomAttributeProvider which isn't available so this overload can't be used
//public ServiceKnownTypeAttribute(string methodName)
//{
// _methodName = methodName;
//}
//public ServiceKnownTypeAttribute(string methodName, Type declaringType)
//{
// _methodName = methodName;
// _declaringType = declaringType;
//}
//public Type DeclaringType => _declaringType;
//public string MethodName => _methodName;
public Type Type { get; }
}
} | 30.641026 | 145 | 0.650209 |
abef6eb5eb9f4a0595b874439261312f0299cab2 | 12,780 | hpp | C++ | libs/core/timed_execution/include/hpx/timed_execution/timed_execution_fwd.hpp | severinstrobl/hpx | ac279175a93de83198e2dccac338bf064e891ab2 | [
"BSL-1.0"
] | null | null | null | libs/core/timed_execution/include/hpx/timed_execution/timed_execution_fwd.hpp | severinstrobl/hpx | ac279175a93de83198e2dccac338bf064e891ab2 | [
"BSL-1.0"
] | 5 | 2018-10-08T15:46:11.000Z | 2021-12-08T10:29:16.000Z | libs/core/timed_execution/include/hpx/timed_execution/timed_execution_fwd.hpp | msimberg/hpx | 70ef8024c7e5a7f7de018eb88bfe446ba83d48e5 | [
"BSL-1.0"
] | 1 | 2020-06-22T13:45:56.000Z | 2020-06-22T13:45:56.000Z | // Copyright (c) 2017-2021 Hartmut Kaiser
// Copyright (c) 2017 Google
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include <hpx/config.hpp>
#include <hpx/concepts/concepts.hpp>
#include <hpx/execution/traits/executor_traits.hpp>
#include <hpx/execution_base/execution.hpp>
#include <hpx/execution_base/traits/is_executor.hpp>
#include <hpx/functional/detail/tag_fallback_invoke.hpp>
#include <hpx/modules/timing.hpp>
#include <hpx/timed_execution/timed_executors.hpp>
#include <type_traits>
#include <utility>
namespace hpx { namespace parallel { namespace execution {
///////////////////////////////////////////////////////////////////////////
// Executor customization points
namespace detail {
/// \cond NOINTERNAL
template <typename Executor, typename Enable = void>
struct timed_post_fn_helper;
template <typename Executor, typename Enable = void>
struct timed_async_execute_fn_helper;
template <typename Executor, typename Enable = void>
struct timed_sync_execute_fn_helper;
/// \endcond
} // namespace detail
///////////////////////////////////////////////////////////////////////
// extensions
// define customization points
// NonBlockingOneWayExecutor customization points: execution::post_at
// and execution::post_after
/// Customization point of asynchronous fire & forget execution agent
/// creation supporting timed execution.
///
/// This asynchronously (fire & forget) creates a single function
/// invocation f() using the associated executor at the given point in
/// time.
///
/// \param exec [in] The executor object to use for scheduling of the
/// function \a f.
/// \param abs_time [in] The point in time the given function should be
/// scheduled at to run.
/// \param f [in] The function which will be scheduled using the
/// given executor.
/// \param ts... [in] Additional arguments to use to invoke \a f.
///
/// \note This calls exec.post_at(abs_time, f, ts...), if
/// available, otherwise it emulates timed scheduling by delaying
/// calling execution::post() on the underlying non-time-scheduled
/// execution agent.
///
HPX_INLINE_CONSTEXPR_VARIABLE struct post_at_t final
: hpx::functional::detail::tag_fallback<post_at_t>
{
private:
// clang-format off
template <typename Executor, typename F, typename... Ts,
HPX_CONCEPT_REQUIRES_(
hpx::traits::is_executor_any<Executor>::value
)>
// clang-format on
friend HPX_FORCEINLINE decltype(auto) tag_fallback_invoke(post_at_t,
Executor&& exec, hpx::chrono::steady_time_point const& abs_time,
F&& f, Ts&&... ts)
{
return detail::
timed_post_fn_helper<typename std::decay<Executor>::type>::call(
std::forward<Executor>(exec), abs_time, std::forward<F>(f),
std::forward<Ts>(ts)...);
}
} post_at{};
/// Customization point of asynchronous fire & forget execution agent
/// creation supporting timed execution.
///
/// This asynchronously (fire & forget) creates a single function
/// invocation f() using the associated executor at the given point in
/// time.
///
/// \param exec [in] The executor object to use for scheduling of the
/// function \a f.
/// \param rel_time [in] The duration of time after which the given
/// function should be scheduled to run.
/// \param f [in] The function which will be scheduled using the
/// given executor.
/// \param ts... [in] Additional arguments to use to invoke \a f.
///
/// \note This calls exec.post_after(rel_time, f, ts...), if
/// available, otherwise it emulates timed scheduling by delaying
/// calling execution::post() on the underlying non-time-scheduled
/// execution agent.
///
HPX_INLINE_CONSTEXPR_VARIABLE struct post_after_t final
: hpx::functional::detail::tag_fallback<post_after_t>
{
private:
// clang-format off
template <typename Executor, typename F, typename... Ts,
HPX_CONCEPT_REQUIRES_(
hpx::traits::is_executor_any<Executor>::value
)>
// clang-format on
friend HPX_FORCEINLINE decltype(auto) tag_fallback_invoke(post_after_t,
Executor&& exec, hpx::chrono::steady_duration const& rel_time,
F&& f, Ts&&... ts)
{
return detail::
timed_post_fn_helper<typename std::decay<Executor>::type>::call(
std::forward<Executor>(exec), rel_time, std::forward<F>(f),
std::forward<Ts>(ts)...);
}
} post_after{};
///////////////////////////////////////////////////////////////////////
// TwoWayExecutor customization points: execution::async_execute_at,
// execution::async_execute_after, execution::sync_execute_at, and
// execution::sync_execute_after
/// Customization point of asynchronous execution agent creation
/// supporting timed execution.
///
/// This asynchronously creates a single function invocation f() using
/// the associated executor at the given point in time.
///
/// \param exec [in] The executor object to use for scheduling of the
/// function \a f.
/// \param abs_time [in] The point in time the given function should be
/// scheduled at to run.
/// \param f [in] The function which will be scheduled using the
/// given executor.
/// \param ts... [in] Additional arguments to use to invoke \a f.
///
/// \returns f(ts...)'s result through a future
///
/// \note This calls exec.async_execute_at(abs_time, f, ts...), if
/// available, otherwise it emulates timed scheduling by delaying
/// calling execution::async_execute() on the underlying
/// non-time-scheduled execution agent.
///
HPX_INLINE_CONSTEXPR_VARIABLE struct async_execute_at_t final
: hpx::functional::detail::tag_fallback<async_execute_at_t>
{
private:
// clang-format off
template <typename Executor, typename F, typename... Ts,
HPX_CONCEPT_REQUIRES_(
hpx::traits::is_executor_any<Executor>::value
)>
// clang-format on
friend HPX_FORCEINLINE decltype(auto) tag_fallback_invoke(
async_execute_at_t, Executor&& exec,
hpx::chrono::steady_time_point const& abs_time, F&& f, Ts&&... ts)
{
return detail::timed_async_execute_fn_helper<typename std::decay<
Executor>::type>::call(std::forward<Executor>(exec), abs_time,
std::forward<F>(f), std::forward<Ts>(ts)...);
}
} async_execute_at{};
/// Customization point of asynchronous execution agent creation
/// supporting timed execution.
///
/// This asynchronously creates a single function invocation f() using
/// the associated executor at the given point in time.
///
/// \param exec [in] The executor object to use for scheduling of the
/// function \a f.
/// \param rel_time [in] The duration of time after which the given
/// function should be scheduled to run.
/// \param f [in] The function which will be scheduled using the
/// given executor.
/// \param ts... [in] Additional arguments to use to invoke \a f.
///
/// \returns f(ts...)'s result through a future
///
/// \note This calls exec.async_execute_after(rel_time, f, ts...), if
/// available, otherwise it emulates timed scheduling by delaying
/// calling execution::async_execute() on the underlying
/// non-time-scheduled execution agent.
///
HPX_INLINE_CONSTEXPR_VARIABLE struct async_execute_after_t final
: hpx::functional::detail::tag_fallback<async_execute_after_t>
{
private:
// clang-format off
template <typename Executor, typename F, typename... Ts,
HPX_CONCEPT_REQUIRES_(
hpx::traits::is_executor_any<Executor>::value
)>
// clang-format on
friend HPX_FORCEINLINE decltype(auto) tag_fallback_invoke(
async_execute_after_t, Executor&& exec,
hpx::chrono::steady_duration const& rel_time, F&& f, Ts&&... ts)
{
return detail::timed_async_execute_fn_helper<typename std::decay<
Executor>::type>::call(std::forward<Executor>(exec), rel_time,
std::forward<F>(f), std::forward<Ts>(ts)...);
}
} async_execute_after{};
/// Customization point of synchronous execution agent creation
/// supporting timed execution.
///
/// This synchronously creates a single function invocation f() using
/// the associated executor at the given point in time.
///
/// \param exec [in] The executor object to use for scheduling of the
/// function \a f.
/// \param abs_time [in] The point in time the given function should be
/// scheduled at to run.
/// \param f [in] The function which will be scheduled using the
/// given executor.
/// \param ts... [in] Additional arguments to use to invoke \a f.
///
/// \returns f(ts...)'s result
///
/// \note This calls exec.sync_execute_at(abs_time, f, ts...), if
/// available, otherwise it emulates timed scheduling by delaying
/// calling execution::sync_execute() on the underlying
/// non-time-scheduled execution agent.
///
HPX_INLINE_CONSTEXPR_VARIABLE struct sync_execute_at_t final
: hpx::functional::detail::tag_fallback<sync_execute_at_t>
{
private:
// clang-format off
template <typename Executor, typename F, typename... Ts,
HPX_CONCEPT_REQUIRES_(
hpx::traits::is_executor_any<Executor>::value
)>
// clang-format on
friend HPX_FORCEINLINE decltype(auto) tag_fallback_invoke(
sync_execute_at_t, Executor&& exec,
hpx::chrono::steady_time_point const& abs_time, F&& f, Ts&&... ts)
{
return detail::timed_sync_execute_fn_helper<typename std::decay<
Executor>::type>::call(std::forward<Executor>(exec), abs_time,
std::forward<F>(f), std::forward<Ts>(ts)...);
}
} sync_execute_at{};
/// Customization point of synchronous execution agent creation
/// supporting timed execution.
///
/// This synchronously creates a single function invocation f() using
/// the associated executor at the given point in time.
///
/// \param exec [in] The executor object to use for scheduling of the
/// function \a f.
/// \param rel_time [in] The duration of time after which the given
/// function should be scheduled to run.
/// \param f [in] The function which will be scheduled using the
/// given executor.
/// \param ts... [in] Additional arguments to use to invoke \a f.
///
/// \returns f(ts...)'s result
///
/// \note This calls exec.sync_execute_after(rel_time, f, ts...), if
/// available, otherwise it emulates timed scheduling by delaying
/// calling execution::sync_execute() on the underlying
/// non-time-scheduled execution agent.
///
HPX_INLINE_CONSTEXPR_VARIABLE struct sync_execute_after_t final
: hpx::functional::detail::tag_fallback<sync_execute_after_t>
{
private:
// clang-format off
template <typename Executor, typename F, typename... Ts,
HPX_CONCEPT_REQUIRES_(
hpx::traits::is_executor_any<Executor>::value
)>
// clang-format on
friend HPX_FORCEINLINE decltype(auto) tag_fallback_invoke(
sync_execute_after_t, Executor&& exec,
hpx::chrono::steady_duration const& rel_time, F&& f, Ts&&... ts)
{
return detail::timed_sync_execute_fn_helper<typename std::decay<
Executor>::type>::call(std::forward<Executor>(exec), rel_time,
std::forward<F>(f), std::forward<Ts>(ts)...);
}
} sync_execute_after{};
}}} // namespace hpx::parallel::execution
| 42.885906 | 80 | 0.610094 |
fb6dc1003cea60071ca817fc5b61dc0eb4ad6f4d | 1,495 | h | C | HMSAnalyticsKit/Pods/AGConnectCore/AGConnectCore.framework/Headers/AGCLogger.h | aydin-emre/HMS-AnalyticsKit-iOS-Swift | f777e8db6f94b245e92bc94a57ecc2431149d899 | [
"MIT"
] | null | null | null | HMSAnalyticsKit/Pods/AGConnectCore/AGConnectCore.framework/Headers/AGCLogger.h | aydin-emre/HMS-AnalyticsKit-iOS-Swift | f777e8db6f94b245e92bc94a57ecc2431149d899 | [
"MIT"
] | null | null | null | HMSAnalyticsKit/Pods/AGConnectCore/AGConnectCore.framework/Headers/AGCLogger.h | aydin-emre/HMS-AnalyticsKit-iOS-Swift | f777e8db6f94b245e92bc94a57ecc2431149d899 | [
"MIT"
] | null | null | null | //
// Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
///AGC日志级别
typedef NS_ENUM(NSInteger, AGCLoggerLevel) {
AGCLOG_Debug = 0, //调试级别
AGCLOG_Info = 1, //提示级别
AGCLOG_Warning = 2,//告警级别
AGCLOG_Error = 3 //错误级别
};
typedef NSString *const AGCLogTag;
///AGC日志回调
typedef void (^AGCLoggerCallback)(AGCLoggerLevel level, NSString *message);
/// 打印Error级别日志
/// @param tag 日志模块
/// @param formate 日志内容
extern void AGCLogError(AGCLogTag tag, NSString *formate, ...) NS_FORMAT_FUNCTION(2, 3);
/// 打印Warning级别日志
/// @param tag 日志模块
/// @param formate 日志内容
extern void AGCLogWarning(AGCLogTag tag, NSString *formate, ...) NS_FORMAT_FUNCTION(2, 3);
/// 打印Info级别日志
/// @param tag 日志模块
/// @param formate 日志内容
extern void AGCLogInfo(AGCLogTag tag, NSString *formate, ...) NS_FORMAT_FUNCTION(2, 3);
/// 打印Debug级别日志
/// @param tag 日志模块
/// @param formate 日志内容
extern void AGCLogDebug(AGCLogTag tag, NSString *formate, ...) NS_FORMAT_FUNCTION(2, 3);
/**
* AGConnect Framework日志工具类
*/
@interface AGCLogger : NSObject
/// 设置是否打印AGConnect Framework日志
/// 默认不打印
/// @param enable 是否打印
+ (void)enableLog:(BOOL)enable;
/// 设置打印日志级别
/// 默认打印Error级别
/// @param level 日志级别
+ (void)resetLogLevel:(AGCLoggerLevel)level;
/// 设置日志回调
/// 可以通过实现此回调把AGC日志打印到用户的日志模块
/// 默认情况打印到NSLog
/// @param logCallback AGC日志回调
+ (void)resetLogCallback:(nullable AGCLoggerCallback)logCallback;
@end
NS_ASSUME_NONNULL_END
| 22.651515 | 90 | 0.72107 |
803b6c1244ae57dd4688c71dc5361240d91b3d4d | 7,361 | java | Java | sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java | Vlatombe/mina-sshd | 89d014af66d471ae539615f6ad55a58e958632ee | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2022-02-09T16:45:10.000Z | 2022-02-09T16:45:10.000Z | sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java | Vlatombe/mina-sshd | 89d014af66d471ae539615f6ad55a58e958632ee | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java | Vlatombe/mina-sshd | 89d014af66d471ae539615f6ad55a58e958632ee | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
package org.apache.sshd.server.channel;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.sshd.client.SshClient;
import org.apache.sshd.client.channel.ClientChannel;
import org.apache.sshd.client.channel.ClientChannelEvent;
import org.apache.sshd.client.session.ClientSession;
import org.apache.sshd.common.PropertyResolverUtils;
import org.apache.sshd.common.channel.Channel;
import org.apache.sshd.common.channel.ChannelAsyncOutputStream;
import org.apache.sshd.common.channel.Window;
import org.apache.sshd.common.util.buffer.Buffer;
import org.apache.sshd.common.util.buffer.BufferUtils;
import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
import org.apache.sshd.core.CoreModuleProperties;
import org.apache.sshd.server.SshServer;
import org.apache.sshd.util.test.BaseTestSupport;
import org.apache.sshd.util.test.BogusChannel;
import org.apache.sshd.util.test.CommandExecutionHelper;
import org.apache.sshd.util.test.NoIoTestCase;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Category({ NoIoTestCase.class })
public class ChannelSessionTest extends BaseTestSupport {
public ChannelSessionTest() {
super();
}
@Test
public void testNoFlush() throws Exception {
try (SshServer server = setupTestServer();
SshClient client = setupTestClient()) {
server.setShellFactory(session -> new CommandExecutionHelper(null) {
@Override
protected boolean handleCommandLine(String command) throws Exception {
OutputStream out = getOutputStream();
out.write((command + "\n").getBytes(StandardCharsets.UTF_8));
return !"exit".equals(command);
}
});
server.start();
client.start();
try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, server.getPort())
.verify(CONNECT_TIMEOUT).getSession()) {
session.addPasswordIdentity(getCurrentTestName());
session.auth().verify(AUTH_TIMEOUT);
try (ClientChannel channel = session.createChannel(Channel.CHANNEL_SHELL)) {
channel.open().verify(OPEN_TIMEOUT);
OutputStream invertedIn = channel.getInvertedIn();
String cmdSent = "echo foo\nexit\n";
invertedIn.write(cmdSent.getBytes());
invertedIn.flush();
long waitStart = System.currentTimeMillis();
Collection<ClientChannelEvent> result
= channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED), TimeUnit.SECONDS.toMillis(11L));
long waitEnd = System.currentTimeMillis();
assertTrue("Wrong channel state after " + (waitEnd - waitStart) + " ms.: " + result,
result.containsAll(EnumSet.of(ClientChannelEvent.CLOSED)));
byte[] b = new byte[1024];
InputStream invertedOut = channel.getInvertedOut();
int l = invertedOut.read(b);
String cmdReceived = (l > 0) ? new String(b, 0, l) : "";
assertEquals("Mismatched echoed command", cmdSent, cmdReceived);
}
}
}
}
/*
* Test whether onWindowExpanded is called from server session
*/
@Test
public void testHandleWindowAdjust() throws Exception {
Buffer buffer = new ByteArrayBuffer();
buffer.putUInt(1234L);
try (ChannelSession channelSession = new ChannelSession() {
{
Window wRemote = getRemoteWindow();
wRemote.init(PropertyResolverUtils.toPropertyResolver(Collections.emptyMap()));
}
}) {
AtomicBoolean expanded = new AtomicBoolean(false);
channelSession.asyncOut = new ChannelAsyncOutputStream(new BogusChannel(), (byte) 0) {
@Override
public void onWindowExpanded() throws IOException {
expanded.set(true);
super.onWindowExpanded();
}
};
channelSession.handleWindowAdjust(buffer);
assertTrue("Expanded ?", expanded.get());
}
}
@Test // see SSHD-652
public void testCloseFutureListenerRegistration() throws Exception {
AtomicInteger closeCount = new AtomicInteger();
try (ChannelSession session = new ChannelSession() {
{
Window wRemote = getRemoteWindow();
wRemote.init(PropertyResolverUtils.toPropertyResolver(Collections.emptyMap()));
}
}) {
session.addCloseFutureListener(future -> {
assertTrue("Future not marted as closed", future.isClosed());
assertEquals("Unexpected multiple call to callback", 1, closeCount.incrementAndGet());
});
session.close();
}
assertEquals("Close listener not called", 1, closeCount.get());
}
@Test // SSHD-1244
public void testLargeWindowSizeAdjust() throws Exception {
try (ChannelSession session = new ChannelSession() {
{
Window wRemote = getRemoteWindow();
wRemote.init(PropertyResolverUtils.toPropertyResolver(Collections.emptyMap()));
}
}) {
Window wRemote = session.getRemoteWindow();
long initialSize = wRemote.getSize();
assertTrue("Bad initial window size: " + initialSize,
(initialSize >= CoreModuleProperties.DEFAULT_WINDOW_SIZE)
&& (initialSize < BufferUtils.MAX_UINT32_VALUE));
Buffer buffer = new ByteArrayBuffer();
buffer.putUInt(BufferUtils.MAX_UINT32_VALUE);
session.handleWindowAdjust(buffer);
long updatedSize = wRemote.getSize();
assertEquals("Mismatched updated window size", BufferUtils.MAX_UINT32_VALUE, updatedSize);
}
}
}
| 41.587571 | 117 | 0.645157 |
3fbb91d49296ced024f8348addc3a39c2b5490af | 21,093 | h | C | lib/core/hash/cne_hash.h | CloudNativeDataPlane/cndp | cc83410b525bd3aacaf72ad12f8d4f4af5b28727 | [
"BSD-3-Clause"
] | null | null | null | lib/core/hash/cne_hash.h | CloudNativeDataPlane/cndp | cc83410b525bd3aacaf72ad12f8d4f4af5b28727 | [
"BSD-3-Clause"
] | null | null | null | lib/core/hash/cne_hash.h | CloudNativeDataPlane/cndp | cc83410b525bd3aacaf72ad12f8d4f4af5b28727 | [
"BSD-3-Clause"
] | null | null | null | /* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2010-2022 Intel Corporation
*/
#ifndef _CNE_HASH_H_
#define _CNE_HASH_H_
/**
* @file
* A hashmap set of routines for string keywords.
*/
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/** Maximum size of hash table that can be created. */
#define CNE_HASH_ENTRIES_MAX (1 << 30)
/** Maximum number of characters in hash name.*/
#define CNE_HASH_NAMESIZE 32
/** Maximum number of keys that can be searched for using cne_hash_lookup_bulk. */
#define CNE_HASH_LOOKUP_BULK_MAX 64
#define CNE_HASH_LOOKUP_MULTI_MAX CNE_HASH_LOOKUP_BULK_MAX
/** Enable Hardware transactional memory support. */
#define CNE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT 0x01
/** Default behavior of insertion, single writer/multi writer */
#define CNE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD 0x02
/** Flag to support reader writer concurrency */
#define CNE_HASH_EXTRA_FLAGS_RW_CONCURRENCY 0x04
/** Flag to indicate the extendable bucket table feature should be used */
#define CNE_HASH_EXTRA_FLAGS_EXT_TABLE 0x08
/** Flag to disable freeing of key index on hash delete.
* Refer to cne_hash_del_xxx APIs for more details.
* This is enabled by default when CNE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF
* is enabled.
*/
#define CNE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL 0x10
/** Flag to support lock free reader writer concurrency. Both single writer
* and multi writer use cases are supported.
*/
#define CNE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF 0x20
/**
* The type of hash value of a key.
* It should be a value of at least 32bit with fully random pattern.
*/
typedef uint32_t hash_sig_t;
/** Type of function that can be used for calculating the hash value. */
typedef uint32_t (*cne_hash_function)(const void *key, uint32_t key_len, uint32_t init_val);
/** Type of function used to compare the hash key. */
typedef int (*cne_hash_cmp_eq_t)(const void *key1, const void *key2, size_t key_len);
/**
* Parameters used when creating the hash table.
*/
struct cne_hash_parameters {
const char *name; /**< Name of the hash. */
uint32_t entries; /**< Total hash table entries. */
uint32_t reserved; /**< Unused field. Should be set to 0 */
uint32_t key_len; /**< Length of hash key. */
cne_hash_function hash_func; /**< Primary Hash function used to calculate hash. */
uint32_t hash_func_init_val; /**< Init value used by hash_func. */
int socket_id; /**< NUMA Socket ID for memory. */
uint8_t extra_flag; /**< Indicate if additional parameters are present. */
};
/** @internal A hash table structure. */
struct cne_hash;
/**
* Create a new hash table.
*
* @param params
* Parameters used to create and initialise the hash table.
* @return
* Pointer to hash table structure that is used in future hash table
* operations, or NULL on error, with error code set in errno.
* Possible errno errors include:
* - E_CNE_NO_CONFIG - function could not get pointer to cne_config structure
* - E_CNE_SECONDARY - function was called from a secondary process instance
* - ENOENT - missing entry
* - EINVAL - invalid parameter passed to function
* - ENOSPC - the maximum number of memzones has already been allocated
* - EEXIST - a memzone with the same name already exists
* - ENOMEM - no appropriate memory area found in which to create memzone
*/
struct cne_hash *cne_hash_create(const struct cne_hash_parameters *params);
/**
* Set a new hash compare function other than the default one.
*
* @note Function pointer does not work with multi-process, so do not use it
* in multi-process mode.
*
* @param h
* Hash table for which the function is to be changed
* @param func
* New compare function
*/
void cne_hash_set_cmp_func(struct cne_hash *h, cne_hash_cmp_eq_t func);
/**
* Find an existing hash table object and return a pointer to it.
*
* @param name
* Name of the hash table as passed to cne_hash_create()
* @return
* Pointer to hash table or NULL if object not found
* with errno set appropriately. Possible errno values include:
* - ENOENT - value not available for return
*/
struct cne_hash *cne_hash_find_existing(const char *name);
/**
* De-allocate all memory used by hash table.
* @param h
* Hash table to free
*/
void cne_hash_free(struct cne_hash *h);
/**
* Reset all hash structure, by zeroing all entries.
* When CNE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF is enabled,
* it is application's responsibility to make sure that
* none of the readers are referencing the hash table
* while calling this API.
*
* @param h
* Hash table to reset
*/
void cne_hash_reset(struct cne_hash *h);
/**
* Return the number of keys in the hash table
* @param h
* Hash table to query from
* @return
* - -EINVAL if parameters are invalid
* - A value indicating how many keys were inserted in the table.
*/
int32_t cne_hash_count(const struct cne_hash *h);
/**
* Return the maximum key value ID that could possibly be returned by
* cne_hash_add_key function.
*
* @param h
* Hash table to query from
* @return
* - -EINVAL if parameters are invalid
* - A value indicating the max key ID of key slots present in the table.
*/
int32_t cne_hash_max_key_id(const struct cne_hash *h);
/**
* Add a key-value pair to an existing hash table.
* This operation is not multi-thread safe
* and should only be called from one thread by default.
* Thread safety can be enabled by setting flag during
* table creation.
* If the key exists already in the table, this API updates its value
* with 'data' passed in this API. It is the responsibility of
* the application to manage any memory associated with the old value.
* The readers might still be using the old value even after this API
* has returned.
*
* @param h
* Hash table to add the key to.
* @param key
* Key to add to the hash table.
* @param data
* Data to add to the hash table.
* @return
* - 0 if added successfully
* - -EINVAL if the parameters are invalid.
* - -ENOSPC if there is no space in the hash for this key.
*/
int cne_hash_add_key_data(const struct cne_hash *h, const void *key, void *data);
/**
* Add a key-value pair with a pre-computed hash value
* to an existing hash table.
* This operation is not multi-thread safe
* and should only be called from one thread by default.
* Thread safety can be enabled by setting flag during
* table creation.
* If the key exists already in the table, this API updates its value
* with 'data' passed in this API. It is the responsibility of
* the application to manage any memory associated with the old value.
* The readers might still be using the old value even after this API
* has returned.
*
* @param h
* Hash table to add the key to.
* @param key
* Key to add to the hash table.
* @param sig
* Precomputed hash value for 'key'
* @param data
* Data to add to the hash table.
* @return
* - 0 if added successfully
* - -EINVAL if the parameters are invalid.
* - -ENOSPC if there is no space in the hash for this key.
*/
int32_t cne_hash_add_key_with_hash_data(const struct cne_hash *h, const void *key, hash_sig_t sig,
void *data);
/**
* Add a key to an existing hash table. This operation is not multi-thread safe
* and should only be called from one thread by default.
* Thread safety can be enabled by setting flag during
* table creation.
*
* @param h
* Hash table to add the key to.
* @param key
* Key to add to the hash table.
* @return
* - -EINVAL if the parameters are invalid.
* - -ENOSPC if there is no space in the hash for this key.
* - A positive value that can be used by the caller as an offset into an
* array of user data. This value is unique for this key. This
* unique key id may be larger than the user specified entry count
* when CNE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD flag is set.
*/
int32_t cne_hash_add_key(const struct cne_hash *h, const void *key);
/**
* Add a key to an existing hash table.
* This operation is not multi-thread safe
* and should only be called from one thread by default.
* Thread safety can be enabled by setting flag during
* table creation.
*
* @param h
* Hash table to add the key to.
* @param key
* Key to add to the hash table.
* @param sig
* Precomputed hash value for 'key'.
* @return
* - -EINVAL if the parameters are invalid.
* - -ENOSPC if there is no space in the hash for this key.
* - A positive value that can be used by the caller as an offset into an
* array of user data. This value is unique for this key. This
* unique key ID may be larger than the user specified entry count
* when CNE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD flag is set.
*/
int32_t cne_hash_add_key_with_hash(const struct cne_hash *h, const void *key, hash_sig_t sig);
/**
* Remove a key from an existing hash table.
* This operation is not multi-thread safe
* and should only be called from one thread by default.
* Thread safety can be enabled by setting flag during
* table creation.
* If CNE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL or
* CNE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF is enabled,
* the key index returned by cne_hash_add_key_xxx APIs will not be
* freed by this API. cne_hash_free_key_with_position API must be called
* additionally to free the index associated with the key.
* cne_hash_free_key_with_position API should be called after all
* the readers have stopped referencing the entry corresponding to
* this key. RCU mechanisms could be used to determine such a state.
*
* @param h
* Hash table to remove the key from.
* @param key
* Key to remove from the hash table.
* @return
* - -EINVAL if the parameters are invalid.
* - -ENOENT if the key is not found.
* - A positive value that can be used by the caller as an offset into an
* array of user data. This value is unique for this key, and is the same
* value that was returned when the key was added.
*/
int32_t cne_hash_del_key(const struct cne_hash *h, const void *key);
/**
* Remove a key from an existing hash table.
* This operation is not multi-thread safe
* and should only be called from one thread by default.
* Thread safety can be enabled by setting flag during
* table creation.
* If CNE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL or
* CNE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF is enabled,
* the key index returned by cne_hash_add_key_xxx APIs will not be
* freed by this API. cne_hash_free_key_with_position API must be called
* additionally to free the index associated with the key.
* cne_hash_free_key_with_position API should be called after all
* the readers have stopped referencing the entry corresponding to
* this key. RCU mechanisms could be used to determine such a state.
*
* @param h
* Hash table to remove the key from.
* @param key
* Key to remove from the hash table.
* @param sig
* Precomputed hash value for 'key'.
* @return
* - -EINVAL if the parameters are invalid.
* - -ENOENT if the key is not found.
* - A positive value that can be used by the caller as an offset into an
* array of user data. This value is unique for this key, and is the same
* value that was returned when the key was added.
*/
int32_t cne_hash_del_key_with_hash(const struct cne_hash *h, const void *key, hash_sig_t sig);
/**
* Find a key in the hash table given the position.
* This operation is multi-thread safe with regarding to other lookup threads.
* Read-write concurrency can be enabled by setting flag during
* table creation.
*
* @param h
* Hash table to get the key from.
* @param position
* Position returned when the key was inserted.
* @param key
* Output containing a pointer to the key
* @return
* - 0 if retrieved successfully
* - -EINVAL if the parameters are invalid.
* - -ENOENT if no valid key is found in the given position.
*/
int cne_hash_get_key_with_position(const struct cne_hash *h, const int32_t position, void **key);
/**
* Free a hash key in the hash table given the position
* of the key. This operation is not multi-thread safe and should
* only be called from one thread by default. Thread safety
* can be enabled by setting flag during table creation.
* If CNE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL or
* CNE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF is enabled,
* the key index returned by cne_hash_del_key_xxx APIs must be freed
* using this API. This API should be called after all the readers
* have stopped referencing the entry corresponding to this key.
* RCU mechanisms could be used to determine such a state.
* This API does not validate if the key is already freed.
*
* @param h
* Hash table to free the key from.
* @param position
* Position returned when the key was deleted.
* @return
* - 0 if freed successfully
* - -EINVAL if the parameters are invalid.
*/
int cne_hash_free_key_with_position(const struct cne_hash *h, const int32_t position);
/**
* Find a key-value pair in the hash table.
* This operation is multi-thread safe with regarding to other lookup threads.
* Read-write concurrency can be enabled by setting flag during
* table creation.
*
* @param h
* Hash table to look in.
* @param key
* Key to find.
* @param data
* Output with pointer to data returned from the hash table.
* @return
* - A positive value that can be used by the caller as an offset into an
* array of user data. This value is unique for this key, and is the same
* value that was returned when the key was added.
* - -EINVAL if the parameters are invalid.
* - -ENOENT if the key is not found.
*/
int cne_hash_lookup_data(const struct cne_hash *h, const void *key, void **data);
/**
* Find a key-value pair with a pre-computed hash value
* to an existing hash table.
* This operation is multi-thread safe with regarding to other lookup threads.
* Read-write concurrency can be enabled by setting flag during
* table creation.
*
* @param h
* Hash table to look in.
* @param key
* Key to find.
* @param sig
* Precomputed hash value for 'key'
* @param data
* Output with pointer to data returned from the hash table.
* @return
* - A positive value that can be used by the caller as an offset into an
* array of user data. This value is unique for this key, and is the same
* value that was returned when the key was added.
* - -EINVAL if the parameters are invalid.
* - -ENOENT if the key is not found.
*/
int cne_hash_lookup_with_hash_data(const struct cne_hash *h, const void *key, hash_sig_t sig,
void **data);
/**
* Find a key in the hash table.
* This operation is multi-thread safe with regarding to other lookup threads.
* Read-write concurrency can be enabled by setting flag during
* table creation.
*
* @param h
* Hash table to look in.
* @param key
* Key to find.
* @return
* - -EINVAL if the parameters are invalid.
* - -ENOENT if the key is not found.
* - A positive value that can be used by the caller as an offset into an
* array of user data. This value is unique for this key, and is the same
* value that was returned when the key was added.
*/
int32_t cne_hash_lookup(const struct cne_hash *h, const void *key);
/**
* Find a key in the hash table.
* This operation is multi-thread safe with regarding to other lookup threads.
* Read-write concurrency can be enabled by setting flag during
* table creation.
*
* @param h
* Hash table to look in.
* @param key
* Key to find.
* @param sig
* Precomputed hash value for 'key'.
* @return
* - -EINVAL if the parameters are invalid.
* - -ENOENT if the key is not found.
* - A positive value that can be used by the caller as an offset into an
* array of user data. This value is unique for this key, and is the same
* value that was returned when the key was added.
*/
int32_t cne_hash_lookup_with_hash(const struct cne_hash *h, const void *key, hash_sig_t sig);
/**
* Calc a hash value by key.
* This operation is not multi-process safe.
*
* @param h
* Hash table to look in.
* @param key
* Key to find.
* @return
* - hash value
*/
hash_sig_t cne_hash_hash(const struct cne_hash *h, const void *key);
/**
* Find multiple keys in the hash table.
* This operation is multi-thread safe with regarding to other lookup threads.
* Read-write concurrency can be enabled by setting flag during
* table creation.
*
* @param h
* Hash table to look in.
* @param keys
* A pointer to a list of keys to look for.
* @param num_keys
* How many keys are in the keys list (less than CNE_HASH_LOOKUP_BULK_MAX).
* @param hit_mask
* Output containing a bitmask with all successful lookups.
* @param data
* Output containing array of data returned from all the successful lookups.
* @return
* -EINVAL if there's an error, otherwise number of successful lookups.
*/
int cne_hash_lookup_bulk_data(const struct cne_hash *h, const void **keys, uint32_t num_keys,
uint64_t *hit_mask, void *data[]);
/**
* Find multiple keys in the hash table with precomputed hash value array.
* This operation is multi-thread safe with regarding to other lookup threads.
* Read-write concurrency can be enabled by setting flag during
* table creation.
*
* @param h
* Hash table to look in.
* @param keys
* A pointer to a list of keys to look for.
* @param sig
* A pointer to a list of precomputed hash values for keys.
* @param num_keys
* How many keys are in the keys list (less than CNE_HASH_LOOKUP_BULK_MAX).
* @param positions
* Output containing a list of values, corresponding to the list of keys that
* can be used by the caller as an offset into an array of user data. These
* values are unique for each key, and are the same values that were returned
* when each key was added. If a key in the list was not found, then -ENOENT
* will be the value.
* @return
* -EINVAL if there's an error, otherwise 0.
*/
int cne_hash_lookup_with_hash_bulk(const struct cne_hash *h, const void **keys, hash_sig_t *sig,
uint32_t num_keys, int32_t *positions);
/**
* Find multiple keys in the hash table with precomputed hash value array.
* This operation is multi-thread safe with regarding to other lookup threads.
* Read-write concurrency can be enabled by setting flag during
* table creation.
*
* @param h
* Hash table to look in.
* @param keys
* A pointer to a list of keys to look for.
* @param sig
* A pointer to a list of precomputed hash values for keys.
* @param num_keys
* How many keys are in the keys list (less than CNE_HASH_LOOKUP_BULK_MAX).
* @param hit_mask
* Output containing a bitmask with all successful lookups.
* @param data
* Output containing array of data returned from all the successful lookups.
* @return
* -EINVAL if there's an error, otherwise number of successful lookups.
*/
int cne_hash_lookup_with_hash_bulk_data(const struct cne_hash *h, const void **keys,
hash_sig_t *sig, uint32_t num_keys, uint64_t *hit_mask,
void *data[]);
/**
* Find multiple keys in the hash table.
* This operation is multi-thread safe with regarding to other lookup threads.
* Read-write concurrency can be enabled by setting flag during
* table creation.
*
* @param h
* Hash table to look in.
* @param keys
* A pointer to a list of keys to look for.
* @param num_keys
* How many keys are in the keys list (less than CNE_HASH_LOOKUP_BULK_MAX).
* @param positions
* Output containing a list of values, corresponding to the list of keys that
* can be used by the caller as an offset into an array of user data. These
* values are unique for each key, and are the same values that were returned
* when each key was added. If a key in the list was not found, then -ENOENT
* will be the value.
* @return
* -EINVAL if there's an error, otherwise 0.
*/
int cne_hash_lookup_bulk(const struct cne_hash *h, const void **keys, uint32_t num_keys,
int32_t *positions);
/**
* Iterate through the hash table, returning key-value pairs.
*
* @param h
* Hash table to iterate
* @param key
* Output containing the key where current iterator
* was pointing at
* @param data
* Output containing the data associated with key.
* Returns NULL if data was not stored.
* @param next
* Pointer to iterator. Should be 0 to start iterating the hash table.
* Iterator is incremented after each call of this function.
* @return
* Position where key was stored, if successful.
* - -EINVAL if the parameters are invalid.
* - -ENOENT if end of the hash table.
*/
int32_t cne_hash_iterate(const struct cne_hash *h, const void **key, void **data, uint32_t *next);
#ifdef __cplusplus
}
#endif
#endif /* _CNE_HASH_H_ */
| 35.93356 | 98 | 0.710141 |
2ef76b0c48adc18815f8dc2a2f532010e3ccd0b9 | 674 | asm | Assembly | oeis/125/A125820.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/125/A125820.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/125/A125820.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A125820: a(n) = ((1 + 7*sqrt(2))^n + (1 - 7*sqrt(2))^n)/2.
; Submitted by Christian Krause
; 1,1,99,295,10193,49001,1086723,6926543,119265217,910405105,13389536259,115088367703,1528961752529,14221495172249,176752280339811,1732989592387775,20610950377737217,209321891217088609,2417905969074687267,25140035386206969607,284816949772658604113,3008217332007393260105,33643678791962671119171,359084438788642488468527,3981605720397664075496641,42794402003293649532440401,471804558885160714388054979,5094666112089805433422828855,55954374436040200162486990673,606091361744791527366988380281
mov $1,1
lpb $0
sub $0,1
mov $2,$1
add $1,$3
mul $2,98
add $3,$2
lpe
mov $0,$1
| 48.142857 | 490 | 0.821958 |
4ac9cb261d58711830c0b49f3f011b5457d7f612 | 28,581 | cs | C# | client/framework/UnityCsReference-master/Editor/Mono/GUI/ObjectField.cs | HelloWindows/AccountBook- | c71af0fefb5650fe85a7830b7ed04d7224d3ce54 | [
"Unlicense"
] | 1 | 2020-10-19T08:37:31.000Z | 2020-10-19T08:37:31.000Z | client/framework/UnityCsReference-master/Editor/Mono/GUI/ObjectField.cs | HelloWindows/AccountBook- | c71af0fefb5650fe85a7830b7ed04d7224d3ce54 | [
"Unlicense"
] | null | null | null | client/framework/UnityCsReference-master/Editor/Mono/GUI/ObjectField.cs | HelloWindows/AccountBook- | c71af0fefb5650fe85a7830b7ed04d7224d3ce54 | [
"Unlicense"
] | 1 | 2020-10-19T08:37:33.000Z | 2020-10-19T08:37:33.000Z | // Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
using UnityEditor.SceneManagement;
using UnityEngine;
using Object = UnityEngine.Object;
namespace UnityEditor
{
public sealed partial class EditorGUI
{
static private GUIContent s_SceneMismatch = EditorGUIUtility.TrTextContent("Scene mismatch (cross scene references not supported)");
static private GUIContent s_TypeMismatch = EditorGUIUtility.TrTextContent("Type mismatch");
static private GUIContent s_Select = EditorGUIUtility.TrTextContent("Select");
[Flags]
internal enum ObjectFieldValidatorOptions
{
None = 0,
ExactObjectTypeValidation = (1 << 0)
}
internal delegate Object ObjectFieldValidator(Object[] references, System.Type objType, SerializedProperty property, ObjectFieldValidatorOptions options);
// Takes object directly, no SerializedProperty.
internal static Object DoObjectField(Rect position, Rect dropRect, int id, Object obj, Object objBeingEdited, System.Type objType, ObjectFieldValidator validator, bool allowSceneObjects, GUIStyle style = null)
{
return DoObjectField(position, dropRect, id, obj, objBeingEdited, objType, null, validator, allowSceneObjects, style != null ? style : EditorStyles.objectField);
}
// Takes SerializedProperty, no direct reference to object.
internal static Object DoObjectField(Rect position, Rect dropRect, int id, System.Type objType, SerializedProperty property, ObjectFieldValidator validator, bool allowSceneObjects, GUIStyle style = null)
{
return DoObjectField(position, dropRect, id, null, null, objType, property, validator, allowSceneObjects, style != null ? style : EditorStyles.objectField);
}
internal enum ObjectFieldVisualType { IconAndText, LargePreview, MiniPreview }
// when current event is mouse click, this function pings the object, or
// if shift/control is pressed and object is a texture, pops up a large texture
// preview window
internal static void PingObjectOrShowPreviewOnClick(Object targetObject, Rect position)
{
if (targetObject == null)
return;
Event evt = Event.current;
// ping object
bool anyModifiersPressed = evt.shift || evt.control;
if (!anyModifiersPressed)
{
EditorGUIUtility.PingObject(targetObject);
return;
}
// show large object preview popup; right now only for textures
if (targetObject is Texture)
{
PopupWindowWithoutFocus.Show(
new RectOffset(6, 3, 0, 3).Add(position),
new ObjectPreviewPopup(targetObject),
new[] { PopupLocation.Left, PopupLocation.Below, PopupLocation.Right });
}
}
static Object AssignSelectedObject(SerializedProperty property, ObjectFieldValidator validator, System.Type objectType, Event evt)
{
Object[] references = { ObjectSelector.GetCurrentObject() };
Object assigned = validator(references, objectType, property, ObjectFieldValidatorOptions.None);
// Assign the value
if (property != null)
property.objectReferenceValue = assigned;
GUI.changed = true;
evt.Use();
return assigned;
}
static private Rect GetButtonRect(ObjectFieldVisualType visualType, Rect position)
{
switch (visualType)
{
case ObjectFieldVisualType.IconAndText:
case ObjectFieldVisualType.MiniPreview:
return new Rect(position.xMax - 19, position.y, 19, position.height);
case ObjectFieldVisualType.LargePreview:
return new Rect(position.xMax - 36, position.yMax - 14, 36, 14);
default:
throw new ArgumentOutOfRangeException();
}
}
static bool HasValidScript(UnityEngine.Object obj)
{
MonoScript script = MonoScript.FromScriptedObject(obj);
if (script == null)
{
return false;
}
Type type = script.GetClass();
if (type == null)
{
return false;
}
return true;
}
static bool ValidDroppedObject(Object[] references, System.Type objType, out string errorString)
{
errorString = "";
if (references == null || references.Length == 0)
{
return true;
}
var reference = references[0];
Object obj = EditorUtility.InstanceIDToObject(reference.GetInstanceID());
if (obj is MonoBehaviour || obj is ScriptableObject)
{
if (!HasValidScript(obj))
{
errorString = $"Type cannot be found: {reference.GetType()}. Containing file and class name must match.";
return false;
}
}
return true;
}
// Timeline package is using this internal overload so can't remove until that's fixed.
internal static Object DoObjectField(Rect position, Rect dropRect, int id, Object obj, System.Type objType, SerializedProperty property, ObjectFieldValidator validator, bool allowSceneObjects, GUIStyle style)
{
return DoObjectField(position, dropRect, id, objType, property, validator, allowSceneObjects);
}
// This method takes either object reference directly, or via SerializedObject.
// Since it's not easy to know which parameters are mutually exclusively used, this method is
// private and internal/public methods instead EITHER take SerializedObject OR direct reference.
static Object DoObjectField(Rect position, Rect dropRect, int id, Object obj, Object objBeingEdited, System.Type objType, SerializedProperty property, ObjectFieldValidator validator, bool allowSceneObjects, GUIStyle style)
{
if (validator == null)
validator = ValidateObjectFieldAssignment;
if (property != null)
obj = property.objectReferenceValue;
Event evt = Event.current;
EventType eventType = evt.type;
// special case test, so we continue to ping/select objects with the object field disabled
if (!GUI.enabled && GUIClip.enabled && (Event.current.rawType == EventType.MouseDown))
eventType = Event.current.rawType;
bool hasThumbnail = EditorGUIUtility.HasObjectThumbnail(objType);
// Determine visual type
ObjectFieldVisualType visualType = ObjectFieldVisualType.IconAndText;
if (hasThumbnail && position.height <= kObjectFieldMiniThumbnailHeight && position.width <= kObjectFieldMiniThumbnailWidth)
visualType = ObjectFieldVisualType.MiniPreview;
else if (hasThumbnail && position.height > kSingleLineHeight)
visualType = ObjectFieldVisualType.LargePreview;
Vector2 oldIconSize = EditorGUIUtility.GetIconSize();
if (visualType == ObjectFieldVisualType.IconAndText)
EditorGUIUtility.SetIconSize(new Vector2(12, 12)); // Have to be this small to fit inside a single line height ObjectField
else if (visualType == ObjectFieldVisualType.LargePreview)
EditorGUIUtility.SetIconSize(new Vector2(64, 64));
switch (eventType)
{
case EventType.DragExited:
if (GUI.enabled)
HandleUtility.Repaint();
break;
case EventType.DragUpdated:
case EventType.DragPerform:
if (eventType == EventType.DragPerform)
{
string errorString;
if (!ValidDroppedObject(DragAndDrop.objectReferences, objType, out errorString))
{
Object reference = DragAndDrop.objectReferences[0];
EditorUtility.DisplayDialog("Can't assign script", errorString, "OK");
break;
}
}
if (dropRect.Contains(Event.current.mousePosition) && GUI.enabled)
{
Object[] references = DragAndDrop.objectReferences;
Object validatedObject = validator(references, objType, property, ObjectFieldValidatorOptions.None);
if (validatedObject != null)
{
// If scene objects are not allowed and object is a scene object then clear
if (!allowSceneObjects && !EditorUtility.IsPersistent(validatedObject))
validatedObject = null;
}
if (validatedObject != null)
{
DragAndDrop.visualMode = DragAndDropVisualMode.Generic;
if (eventType == EventType.DragPerform)
{
if (property != null)
property.objectReferenceValue = validatedObject;
else
obj = validatedObject;
GUI.changed = true;
DragAndDrop.AcceptDrag();
DragAndDrop.activeControlID = 0;
}
else
{
DragAndDrop.activeControlID = id;
}
Event.current.Use();
}
}
break;
case EventType.MouseDown:
if (position.Contains(Event.current.mousePosition))
{
if (Event.current.button == 1)
{
var actualObject = property != null ? property.objectReferenceValue : obj;
var contextMenu = new GenericMenu();
contextMenu.AddItem(GUIContent.Temp("Properties..."), false, () => PropertyEditor.OpenPropertyEditor(actualObject));
contextMenu.DropDown(position);
}
if (Event.current.button != 0)
break;
// Get button rect for Object Selector
Rect buttonRect = GetButtonRect(visualType, position);
EditorGUIUtility.editingTextField = false;
if (buttonRect.Contains(Event.current.mousePosition))
{
if (GUI.enabled)
{
GUIUtility.keyboardControl = id;
if (property != null)
ObjectSelector.get.Show(objType, property, allowSceneObjects);
else
ObjectSelector.get.Show(obj, objType, objBeingEdited, allowSceneObjects);
ObjectSelector.get.objectSelectorID = id;
evt.Use();
GUIUtility.ExitGUI();
}
}
else
{
Object actualTargetObject = property != null ? property.objectReferenceValue : obj;
Component com = actualTargetObject as Component;
if (com)
actualTargetObject = com.gameObject;
if (showMixedValue)
actualTargetObject = null;
// One click shows where the referenced object is, or pops up a preview
if (Event.current.clickCount == 1)
{
GUIUtility.keyboardControl = id;
PingObjectOrShowPreviewOnClick(actualTargetObject, position);
evt.Use();
}
// Double click opens the asset in external app or changes selection to referenced object
else if (Event.current.clickCount == 2)
{
if (actualTargetObject)
{
AssetDatabase.OpenAsset(actualTargetObject);
GUIUtility.ExitGUI();
}
evt.Use();
}
}
}
break;
case EventType.ExecuteCommand:
string commandName = evt.commandName;
if (commandName == ObjectSelector.ObjectSelectorUpdatedCommand && ObjectSelector.get.objectSelectorID == id && GUIUtility.keyboardControl == id && (property == null || !property.isScript))
return AssignSelectedObject(property, validator, objType, evt);
else if (commandName == ObjectSelector.ObjectSelectorClosedCommand && ObjectSelector.get.objectSelectorID == id && GUIUtility.keyboardControl == id && property != null && property.isScript)
{
if (ObjectSelector.get.GetInstanceID() == 0)
{
// User canceled object selection; don't apply
evt.Use();
break;
}
return AssignSelectedObject(property, validator, objType, evt);
}
break;
case EventType.KeyDown:
if (GUIUtility.keyboardControl == id)
{
if (evt.keyCode == KeyCode.Backspace || (evt.keyCode == KeyCode.Delete && (evt.modifiers & EventModifiers.Shift) == 0))
{
if (property != null)
property.objectReferenceValue = null;
else
obj = null;
GUI.changed = true;
evt.Use();
}
// Apparently we have to check for the character being space instead of the keyCode,
// otherwise the Inspector will maximize upon pressing space.
if (evt.MainActionKeyForControl(id))
{
if (property != null)
ObjectSelector.get.Show(objType, property, allowSceneObjects);
else
ObjectSelector.get.Show(obj, objType, objBeingEdited, allowSceneObjects);
ObjectSelector.get.objectSelectorID = id;
evt.Use();
GUIUtility.ExitGUI();
}
}
break;
case EventType.Repaint:
GUIContent temp;
if (showMixedValue)
{
temp = s_MixedValueContent;
}
else
{
// If obj or objType are both null, we have to rely on
// property.objectReferenceStringValue to display None/Missing and the
// correct type. But if not, EditorGUIUtility.ObjectContent is more reliable.
// It can take a more specific object type specified as argument into account,
// and it gets the icon at the same time.
if (obj == null && objType == null && property != null)
{
temp = EditorGUIUtility.TempContent(property.objectReferenceStringValue);
}
else
{
// In order for ObjectContext to be able to distinguish between None/Missing,
// we need to supply an instanceID. For some reason, getting the instanceID
// from property.objectReferenceValue is not reliable, so we have to
// explicitly check property.objectReferenceInstanceIDValue if a property exists.
if (property != null)
temp = EditorGUIUtility.ObjectContent(obj, objType, property.objectReferenceInstanceIDValue);
else
temp = EditorGUIUtility.ObjectContent(obj, objType);
}
if (property != null)
{
if (obj != null)
{
Object[] references = { obj };
if (EditorSceneManager.preventCrossSceneReferences && CheckForCrossSceneReferencing(obj, property.serializedObject.targetObject))
{
if (!EditorApplication.isPlaying)
temp = s_SceneMismatch;
else
temp.text = temp.text + string.Format(" ({0})", GetGameObjectFromObject(obj).scene.name);
}
else if (validator(references, objType, property, ObjectFieldValidatorOptions.ExactObjectTypeValidation) == null)
temp = s_TypeMismatch;
}
}
}
switch (visualType)
{
case ObjectFieldVisualType.IconAndText:
BeginHandleMixedValueContentColor();
style.Draw(position, temp, id, DragAndDrop.activeControlID == id, position.Contains(Event.current.mousePosition));
Rect buttonRect = EditorStyles.objectFieldButton.margin.Remove(GetButtonRect(visualType, position));
EditorStyles.objectFieldButton.Draw(buttonRect, GUIContent.none, id, DragAndDrop.activeControlID == id, buttonRect.Contains(Event.current.mousePosition));
EndHandleMixedValueContentColor();
break;
case ObjectFieldVisualType.LargePreview:
DrawObjectFieldLargeThumb(position, id, obj, temp);
break;
case ObjectFieldVisualType.MiniPreview:
DrawObjectFieldMiniThumb(position, id, obj, temp);
break;
default:
throw new ArgumentOutOfRangeException();
}
break;
}
EditorGUIUtility.SetIconSize(oldIconSize);
return obj;
}
private static void DrawObjectFieldLargeThumb(Rect position, int id, Object obj, GUIContent content)
{
GUIStyle thumbStyle = EditorStyles.objectFieldThumb;
thumbStyle.Draw(position, GUIContent.none, id, DragAndDrop.activeControlID == id, position.Contains(Event.current.mousePosition));
if (obj != null && !showMixedValue)
{
bool isCubemap = obj is Cubemap;
bool isSprite = obj is Sprite;
Rect thumbRect = thumbStyle.padding.Remove(position);
if (isCubemap || isSprite)
{
Texture2D t2d = AssetPreview.GetAssetPreview(obj);
if (t2d != null)
{
if (isSprite || t2d.alphaIsTransparency)
DrawTextureTransparent(thumbRect, t2d);
else
DrawPreviewTexture(thumbRect, t2d);
}
else
{
// Preview not loaded -> Draw icon
thumbRect.x += (thumbRect.width - content.image.width) / 2f;
thumbRect.y += (thumbRect.height - content.image.width) / 2f;
GUIStyle.none.Draw(thumbRect, content.image, false, false, false, false);
// Keep repaint until the object field has a proper preview
HandleUtility.Repaint();
}
}
else
{
// Draw texture
Texture2D t2d = content.image as Texture2D;
if (t2d != null && t2d.alphaIsTransparency)
DrawTextureTransparent(thumbRect, t2d);
else
DrawPreviewTexture(thumbRect, content.image);
}
}
else
{
GUIStyle s2 = thumbStyle.name + "Overlay";
BeginHandleMixedValueContentColor();
s2.Draw(position, content, id);
EndHandleMixedValueContentColor();
}
GUIStyle s3 = thumbStyle.name + "Overlay2";
s3.Draw(position, s_Select, id);
}
private static void DrawObjectFieldMiniThumb(Rect position, int id, Object obj, GUIContent content)
{
GUIStyle thumbStyle = EditorStyles.objectFieldMiniThumb;
position.width = EditorGUI.kObjectFieldMiniThumbnailWidth;
BeginHandleMixedValueContentColor();
bool hover = obj != null; // we use hover texture for enhancing the border if we have a reference
bool on = DragAndDrop.activeControlID == id;
bool keyFocus = GUIUtility.keyboardControl == id;
thumbStyle.Draw(position, hover, false, on, keyFocus);
EndHandleMixedValueContentColor();
if (obj != null && !showMixedValue)
{
Rect thumbRect = new Rect(position.x + 1, position.y + 1, position.height - 2, position.height - 2); // subtract 1 px border
Texture2D t2d = content.image as Texture2D;
if (t2d != null && t2d.alphaIsTransparency)
DrawTextureTransparent(thumbRect, t2d);
else
DrawPreviewTexture(thumbRect, content.image);
// Tooltip
if (thumbRect.Contains(Event.current.mousePosition))
GUI.Label(thumbRect, GUIContent.Temp(string.Empty, "Ctrl + Click to show preview"));
}
}
internal static Object DoDropField(Rect position, int id, System.Type objType, ObjectFieldValidator validator, bool allowSceneObjects, GUIStyle style)
{
if (validator == null)
validator = ValidateObjectFieldAssignment;
Event evt = Event.current;
EventType eventType = evt.type;
// special case test, so we continue to ping/select objects with the object field disabled
if (!GUI.enabled && GUIClip.enabled && (Event.current.rawType == EventType.MouseDown))
eventType = Event.current.rawType;
switch (eventType)
{
case EventType.DragExited:
if (GUI.enabled)
HandleUtility.Repaint();
break;
case EventType.DragUpdated:
case EventType.DragPerform:
if (position.Contains(Event.current.mousePosition) && GUI.enabled)
{
Object[] references = DragAndDrop.objectReferences;
Object validatedObject = validator(references, objType, null, ObjectFieldValidatorOptions.None);
if (validatedObject != null)
{
// If scene objects are not allowed and object is a scene object then clear
if (!allowSceneObjects && !EditorUtility.IsPersistent(validatedObject))
validatedObject = null;
}
if (validatedObject != null)
{
DragAndDrop.visualMode = DragAndDropVisualMode.Generic;
if (eventType == EventType.DragPerform)
{
GUI.changed = true;
DragAndDrop.AcceptDrag();
DragAndDrop.activeControlID = 0;
Event.current.Use();
return validatedObject;
}
else
{
DragAndDrop.activeControlID = id;
Event.current.Use();
}
}
}
break;
case EventType.Repaint:
style.Draw(position, GUIContent.none, id, DragAndDrop.activeControlID == id);
break;
}
return null;
}
}
internal class ObjectPreviewPopup : PopupWindowContent
{
readonly Editor m_Editor;
readonly GUIContent m_ObjectName;
const float kToolbarHeight = 22f;
internal class Styles
{
public readonly GUIStyle toolbar = "preToolbar";
public readonly GUIStyle toolbarText = "ToolbarBoldLabel";
public GUIStyle background = "preBackground";
}
Styles s_Styles;
public ObjectPreviewPopup(Object previewObject)
{
if (previewObject == null)
{
Debug.LogError("ObjectPreviewPopup: Check object is not null, before trying to show it!");
return;
}
m_ObjectName = new GUIContent(previewObject.name, AssetDatabase.GetAssetPath(previewObject)); // Show path as tooltip on label
m_Editor = Editor.CreateEditor(previewObject);
}
public override void OnClose()
{
if (m_Editor != null)
Editor.DestroyImmediate(m_Editor);
}
public override void OnGUI(Rect rect)
{
if (m_Editor == null)
{
editorWindow.Close();
return;
}
if (s_Styles == null)
s_Styles = new Styles();
// Toolbar
GUILayout.BeginArea(new Rect(rect.x, rect.y, rect.width, kToolbarHeight), s_Styles.toolbar);
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
m_Editor.OnPreviewSettings();
EditorGUILayout.EndHorizontal();
GUILayout.EndArea();
const float kMaxSettingsWidth = 240f;
GUI.Label(new Rect(rect.x + 5f, rect.y, rect.width - kMaxSettingsWidth, kToolbarHeight), m_ObjectName, s_Styles.toolbarText);
// Object preview
Rect previewRect = new Rect(rect.x, rect.y + kToolbarHeight, rect.width, rect.height - kToolbarHeight);
m_Editor.OnPreviewGUI(previewRect, s_Styles.background);
}
public override Vector2 GetWindowSize()
{
return new Vector2(400f, 300f + kToolbarHeight);
}
}
}
| 47.008224 | 230 | 0.509639 |
4c1fb541e2f3a5ce5c8578c492b4174b99282dcc | 5,013 | php | PHP | app/Http/Controllers/PersonController.php | Jalquin/infosystem | 99ef6c921b27a49535771d6b4f021987fcc55f5f | [
"MIT"
] | null | null | null | app/Http/Controllers/PersonController.php | Jalquin/infosystem | 99ef6c921b27a49535771d6b4f021987fcc55f5f | [
"MIT"
] | null | null | null | app/Http/Controllers/PersonController.php | Jalquin/infosystem | 99ef6c921b27a49535771d6b4f021987fcc55f5f | [
"MIT"
] | null | null | null | <?php
namespace App\Http\Controllers;
use App\Models\Address;
use App\Models\AddressType;
use App\Models\Company;
use App\Models\Job;
use App\Models\Person;
use App\Models\Role;
use Exception;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class PersonController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
/**
* Display a listing of the resource.
*
* @return Application|Factory|View|Response
*/
public function index()
{
$people = Person::all();
return view('people.index', compact('people'));
}
/**
* Show the form for creating a new resource.
*
* @return Application|Factory|View|Response
*/
public function create()
{
$addresses = Address::all();
$companies = Company::all();
$roles = Role::all();
$addressTypes = AddressType::all();
return view('people.create', compact('addresses', 'companies', 'roles', 'addressTypes'));
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return RedirectResponse
*/
public function store(Request $request): RedirectResponse
{
$request->validate([
'name' => 'required',
'email',
'phone',
'note'
]);
if ($request->new_address == 'on') {
$request->validate([
'street' => 'required',
'number',
'zip',
'city' => 'required'
]);
}
$person = Person::create($request->all());
$person->role()->associate($request->role_id);
$person->save();
$person->companies()->attach($request->companies);
$person->addresses()->attach($request->addresses);
if ($request->new_address == 'on') {
$address = Address::create($request->all());
$address->addressType()->associate($request->address_type_id);
$address->save();
$address->people()->attach($person);
}
return redirect()->route('people.index')
->with('success', 'Úspěšně přidána osoba ' . $request->name);
}
/**
* Display the specified resource.
*
* @param Person $person
* @return Application|Factory|View|Response
*/
public function show(Person $person)
{
$jobs = Job::with('people')->get();
$address = Address::with('people')->get();
$companies = Company::with('people')->get();
$role = Role::with('people')->get();
return view('people.show', compact('person', 'jobs', 'address', 'companies', 'role'));
}
/**
* Show the form for editing the specified resource.
*
* @param Person $person
* @return Application|Factory|View|Response
*/
public function edit(Person $person)
{
$addresses = Address::all();
$companies = Company::all();
$roles = Role::all();
$addressTypes = AddressType::all();
return view('people.edit', compact('person', 'addresses', 'companies', 'roles', 'addressTypes'));
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param Person $person
* @return RedirectResponse
*/
public function update(Request $request, Person $person): RedirectResponse
{
$request->validate([
'name' => 'required',
'email',
'phone',
'note'
]);
if ($request->new_address == 'on') {
$request->validate([
'street' => 'required',
'number',
'zip',
'city' => 'required'
]);
}
$person->update($request->all());
$person->role()->associate($request->role_id);
$person->save();
$person->companies()->sync($request->companies);
$person->addresses()->sync($request->addresses);
if ($request->new_address == 'on') {
$address = Address::create($request->all());
$address->addressType()->associate($request->address_type_id);
$address->save();
$address->people()->attach($person);
}
return redirect()->route('people.index')
->with('success', 'Úspěšně upravena osoba ' . $person->name);
}
/**
* Remove the specified resource from storage.
*
* @param Person $person
* @return RedirectResponse
* @throws Exception
*/
public function destroy(Person $person): RedirectResponse
{
$person->delete();
return redirect()->route('people.index')
->with('success', 'Úspěšně smazána osoba ' . $person->name);
}
}
| 26.246073 | 105 | 0.546379 |
28402a8ab859ad9203dbd8840098ab6d0ff7c8e6 | 1,817 | hpp | C++ | libs/core/concurrency/include/hpx/concurrency/detail/freelist.hpp | bhumitattarde/hpx | 5b34d8d77b1664fa552445d44cd98e51dc69a74a | [
"BSL-1.0"
] | 1 | 2022-02-08T05:55:09.000Z | 2022-02-08T05:55:09.000Z | libs/core/concurrency/include/hpx/concurrency/detail/freelist.hpp | deepaksuresh1411/hpx | aa18024d35fe9884a977d4b6076c764dbb8b26d1 | [
"BSL-1.0"
] | null | null | null | libs/core/concurrency/include/hpx/concurrency/detail/freelist.hpp | deepaksuresh1411/hpx | aa18024d35fe9884a977d4b6076c764dbb8b26d1 | [
"BSL-1.0"
] | null | null | null | // Copyright (c) 2007-2012 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include <boost/version.hpp>
#include <boost/lockfree/policies.hpp>
#include <boost/lockfree/queue.hpp>
#include <cstddef>
namespace boost { namespace lockfree {
///////////////////////////////////////////////////////////////////////////
template <typename T, typename Alloc = std::allocator<T>>
class caching_freelist : public lockfree::detail::freelist_stack<T, Alloc>
{
typedef lockfree::detail::freelist_stack<T, Alloc> base_type;
public:
caching_freelist(std::size_t n = 0)
: lockfree::detail::freelist_stack<T, Alloc>(Alloc(), n)
{
}
T* allocate()
{
return this->base_type::template allocate<true, false>();
}
void deallocate(T* n) noexcept
{
this->base_type::template deallocate<true>(n);
}
};
template <typename T, typename Alloc = std::allocator<T>>
class static_freelist : public lockfree::detail::freelist_stack<T, Alloc>
{
typedef lockfree::detail::freelist_stack<T, Alloc> base_type;
public:
static_freelist(std::size_t n = 0)
: lockfree::detail::freelist_stack<T, Alloc>(Alloc(), n)
{
}
T* allocate()
{
return this->base_type::template allocate<true, true>();
}
void deallocate(T* n) noexcept
{
this->base_type::template deallocate<true>(n);
}
};
struct caching_freelist_t
{
};
struct static_freelist_t
{
};
}} // namespace boost::lockfree
| 26.333333 | 80 | 0.581728 |
1bf174f4faf18738cf64e19b43ab8ba3e02c5e1d | 1,491 | py | Python | simple_cache/apps.py | phuongtai/django-simple-cache | 5512b01db4a6048d5e32b2b5b86bc12679333155 | [
"Apache-2.0"
] | null | null | null | simple_cache/apps.py | phuongtai/django-simple-cache | 5512b01db4a6048d5e32b2b5b86bc12679333155 | [
"Apache-2.0"
] | null | null | null | simple_cache/apps.py | phuongtai/django-simple-cache | 5512b01db4a6048d5e32b2b5b86bc12679333155 | [
"Apache-2.0"
] | null | null | null | from django.apps import AppConfig
from common.swagger_schema import EndpointEnumerator
from .portable import Resource
from .utils import HazelcastClient
def sync_endpoint():
# Connect client Hazelcast and initial a map and a list
client = HazelcastClient()
client.portable_factories(Resource.FACTORY_ID, Resource.CLASS_ID, Resource)
client = client.get_client()
resource_map = client.get_map('resource_map')
scope_list = client.get_list('scope_list')
# Get all endpoints.
EndpointEnumeratorInstance = EndpointEnumerator()
apis = EndpointEnumeratorInstance.get_api_endpoints(only_regex=True)
for api in apis:
url_regex, method, class_view = api[0], api[1], api[2]
code_name = ''
if not class_view.cls.authentication_classes:
continue
if hasattr(class_view, 'view_class'):
view = class_view.view_class
action = method.lower()
else:
view = class_view.cls
action = class_view.actions[method.lower()]
view_name = view().get_view_name()
code_name = '{}.{}'.format(view_name, action)
# Put them into Hazelcast
if not scope_list.contains(view_name):
scope_list.add(view_name)
resource_map.put(code_name, Resource(action, view_name, url_regex, method))
client.shutdown()
class HazelcastCacheConfig(AppConfig):
name = 'common.hazelcast_cache'
# def ready(self):
# sync_endpoint()
| 32.413043 | 83 | 0.68008 |
90fa406792b7654cd7bf39f0a6e4aa26f6bbc5e5 | 9,384 | py | Python | utils.py | Data-to-Knowledge/WaterDataConsents | 596c357437fe3cc004f3da8be3c1e7e83d9effe5 | [
"Apache-2.0"
] | null | null | null | utils.py | Data-to-Knowledge/WaterDataConsents | 596c357437fe3cc004f3da8be3c1e7e83d9effe5 | [
"Apache-2.0"
] | null | null | null | utils.py | Data-to-Knowledge/WaterDataConsents | 596c357437fe3cc004f3da8be3c1e7e83d9effe5 | [
"Apache-2.0"
] | 3 | 2020-03-31T22:49:56.000Z | 2020-11-01T23:05:28.000Z | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 15 15:59:37 2019
@author: MichaelEK
"""
import pandas as pd
import numpy as np
#from pyproj import Proj, CRS, Transformer
# import geopandas as gpd
#from gistools import vector
# from shapely import wkt
#import json
import requests
pd.options.display.max_columns = 10
##########################################
### Parameters
today1 = pd.Timestamp.today()
month_map = {1: 'Jul', 2: 'Aug', 3: 'Sep', 4: 'Oct', 5: 'Nov', 6: 'Dec', 7: 'Jan', 8: 'Feb', 9: 'Mar', 10: 'Apr', 11: 'May', 12: 'Jun'}
##########################################
### Functions
def get_json_from_api(api_url, api_headers):
"""
"""
r = requests.get(api_url, headers=api_headers)
return r.json()
def json_filters(json_lst, only_operative=True, only_gw=False):
"""
"""
json_lst1 = []
for j in json_lst.copy():
if j['spatialUnit']:
j['managementUnit'] = [m for m in j['managementUnit'] if (m['parameterType'] == 'Allocation Block')]
json_lst1.append(j)
if only_operative:
t1 = []
for j in json_lst1:
for s in j['groupStatus']:
if (s['status'] == 'Operative') and (pd.Timestamp(s['fromDate']).tz_localize(None) <= today1):
t1.append(j)
json_lst1 = t1
# json_lst1 = [j for j in json_lst1 if (j['groupStatus']['status'] == 'Operative') and (pd.Timestamp(j['status']['fromDate']) <= today1)]
## Select only GW limits and combined GW/SW limits
if only_gw:
json_lst1 = [j for j in json_lst1 if j['hydroUnit'] != ['Surface Water']]
return json_lst1
# def geojson_convert(json_lst):
# """
# """
# gjson1 = []
# hydro_units = {'Groundwater': {'value': [], 'label': []}, 'Surface Water': {'value': [], 'label': []}}
# sg = []
# for j in json_lst.copy():
# if isinstance(j['spatialUnit'], list):
# for g in j['spatialUnit']:
# gjson1.append(g)
# for h in j['hydroUnit']:
# sg.append([j['id'], g['id'], h])
# hydro_units[h]['value'].extend([g['id']])
# hydro_units[h]['label'].extend([g['name']])
# if isinstance(j['spatialUnit'], dict):
# gjson1.append(j['spatialUnit'])
# for h in j['hydroUnit']:
# sg.append([j['id'], g['id'], h])
# hydro_units[h]['value'].extend([g['id']])
# hydro_units[h]['label'].extend([g['name']])
# # for gj in gjson1:
# # if gj['id'] == 'GWAZ0037':
# # gj['color'] = 'rgb(204, 204, 204)'
# # else:
# # gj['color'] = plotly.colors.qualitative.Vivid[np.random.randint(0, 11)]
# gpd1 = pd.DataFrame(gjson1).dropna()
# gpd1['geometry'] = gpd1['wkt'].apply(wkt.loads)
# gpd2 = gpd.GeoDataFrame(gpd1, geometry='geometry', crs=2193).drop('wkt', axis=1).to_crs(4326).set_index('id')
# gpd2['geometry'] = gpd2.simplify(0.001)
# sg_df = pd.DataFrame(sg)
# sg_df.columns = ['id', 'spatialId', 'HydroGroup']
# sg_df = sg_df[sg_df.spatialId.isin(gpd1.id)].copy()
# gjson2 = gpd2.__geo_interface__
# return gjson2, hydro_units, pd.DataFrame(gpd2.drop('geometry', axis=1)).reset_index(), sg_df
def extract_spatial_units(json_lst):
"""
"""
hydro_units = {'Groundwater': {'value': [], 'label': []}, 'Surface Water': {'value': [], 'label': []}}
sg = []
for j in json_lst.copy():
if isinstance(j['spatialUnit'], list):
for g in j['spatialUnit']:
for h in j['hydroUnit']:
sg.append([j['id'], g['id'], h])
hydro_units[h]['value'].extend([g['id']])
hydro_units[h]['label'].extend([g['name']])
if isinstance(j['spatialUnit'], dict):
for h in j['hydroUnit']:
sg.append([j['id'], g['id'], h])
hydro_units[h]['value'].extend([g['id']])
hydro_units[h]['label'].extend([g['name']])
sg_df = pd.DataFrame(sg)
sg_df.columns = ['id', 'spatialId', 'HydroGroup']
return hydro_units, sg_df
def process_limit_data(json_lst):
"""
"""
l_lst1 = []
for j in json_lst.copy():
for m in j['managementUnit']:
if m['parameterType'] == 'Allocation Block':
for l in m['limit']:
l['id'] = j['id']
l['Allocation Block'] = m['parameterName']
l['units'] = m['units']
l_lst1.append(l)
l_data = pd.DataFrame(l_lst1)
units = l_data[['id', 'units']].drop_duplicates()
index1 = ['id', 'units', 'Allocation Block', 'fromMonth']
ldata0 = l_data.set_index(index1).limit.unstack(3)
col1 = set(ldata0.columns)
col2 = col1.copy()
col2.update(range(1, 13))
new_cols = list(col2.difference(col1))
ldata0 = ldata0.reindex(columns=ldata0.columns.tolist() + new_cols)
ldata0.sort_index(axis=1, inplace=True)
l_data1 = ldata0.ffill(axis=1).stack()
l_data1.name = 'Limit'
l_data1 = l_data1.reset_index()
l_data1.rename(columns={'fromMonth': 'Month'}, inplace=True)
### Summary table
include_cols = ['id', 'name', 'planName', 'planSection', 'planTable']
t_lst = []
for d in json_lst.copy():
dict1 = {key: val for key, val in d.items() if key in include_cols}
t_lst.append(dict1)
t_data = pd.DataFrame(t_lst)
t_data1 = pd.merge(t_data, l_data, on='id')
# t_data1.rename(columns={'SpatialUnitName': 'Allocation Zone'}, inplace=True)
t_data1.replace({'fromMonth': month_map, 'toMonth': month_map}, inplace=True)
### Return
return l_data1, t_data1, units
def assign_notes(sg_df):
"""
"""
### Label joint s units
sp2c = sg_df.drop_duplicates(subset=['id', 'spatialId']).copy()
sp2c['joint_units'] = sp2c.groupby('id').spatialId.transform(lambda x: ', '.join(x))
sp2c['unit_count'] = sp2c.groupby('id').spatialId.transform('count')
sp2c.loc[sp2c['unit_count'] == 1, 'joint_units'] = ''
sp2d = sp2c.set_index(['id', 'spatialId', 'HydroGroup'])['joint_units']
### Label joint hydro groups
sp2e = sg_df.drop_duplicates(subset=['HydroGroup', 'id']).copy()
sp2e['hydro_count'] = sp2e.groupby('id').spatialId.transform('count')
sp2f = sp2e.set_index(['id', 'spatialId', 'HydroGroup'])['hydro_count']
# sp2c.loc[sp2c['hydro_count'] == 1, 'joint_hydro'] = ''
## Join joint_hydro to main table
sp3 = sg_df.set_index(['id', 'spatialId', 'HydroGroup'])
sp4 = pd.concat([sp3, sp2d, sp2f], axis=1).reset_index()
sp4.loc[sp4.hydro_count.isnull(), 'hydro_count'] = 1
sp4.loc[sp4.joint_units.isnull(), 'joint_units'] = ''
## Create notes
# front_note = '**Notes:** '
joint_hydro_notes = 'Allocation limits for this allocation zone are combined between surface water and groundwater.'
joint_units_notes = 'The allocation limits are shared jointly across these zones: '
# note_template = """{begin}
# {hydro}
# {unit_notes}{units}
# """
note_template = """{hydro} {unit_notes}{units}"""
sp4['notes'] = ''
cond1 = sp4.hydro_count > 1
sp4.loc[cond1, 'notes'] = note_template.format(hydro=joint_hydro_notes, unit_notes='', units='')
cond2 = (sp4.joint_units != '')
sp4.loc[cond2, 'notes'] = sp4.loc[cond2, 'joint_units'].apply(lambda x: note_template.format(hydro='', unit_notes=joint_units_notes, units=x))
cond3 = (sp4.hydro_count > 1) & (sp4.joint_units != '')
sp4.loc[cond3, 'notes'] = sp4.loc[cond3, 'joint_units'].apply(lambda x: note_template.format(hydro=joint_hydro_notes, unit_notes=joint_units_notes, units=x))
return sp4.drop(['hydro_count', 'joint_units'], axis=1)
def split_months(df, index, calc_col):
"""
"""
index1 = index.copy()
if not 'Month' in index1:
index1.extend(['Month'])
if df.empty:
cols = ['SpatialUnitId', 'AllocationBlock', 'Month']
cols.extend([calc_col])
empty_df = pd.DataFrame(columns=cols)
return empty_df
# sum1 = df.groupby(index1)[calc_col].sum()
grp1 = df.groupby(['RecordNumber', 'HydroGroup', 'AllocationBlock', 'Wap'])
lst1 = []
for index, g in grp1:
# print(index)
mons = range(g.FromMonth.min(), g.ToMonth.max() + 1)
val = g[calc_col].max()
index_list = list(index)
temp1 = [(index_list[0], index_list[1], index_list[2], index_list[3], m, val) for m in mons]
lst1.extend(temp1)
df1 = pd.DataFrame.from_records(lst1, columns=['RecordNumber', 'HydroGroup', 'AllocationBlock', 'Wap', 'Month', calc_col])
df2 = pd.merge(df1, df[['RecordNumber', 'HydroGroup', 'AllocationBlock', 'Wap', 'SpatialUnitId']], on=['RecordNumber', 'HydroGroup', 'AllocationBlock', 'Wap'])
sum1 = df2.groupby(['SpatialUnitId', 'AllocationBlock', 'Month'])[calc_col].sum()
ldata0 = sum1.unstack(len(index1) - 1)
col1 = set(ldata0.columns)
col2 = col1.copy()
col2.update(range(1, 13))
new_cols = list(col2.difference(col1))
ldata0 = ldata0.reindex(columns=ldata0.columns.tolist() + new_cols)
ldata0.sort_index(axis=1, inplace=True)
l_data1 = ldata0.ffill(axis=1).stack()
l_data1.name = calc_col
l_data1 = l_data1.reset_index()
return l_data1
| 32.926316 | 165 | 0.580989 |
965f0ff7fadb1fc9ca858a5501a7a9df6552b5c3 | 182 | php | PHP | views/View.php | deigmaranderson/duosystem | a8591e99310e5a8e019c864ca2859e6fd794aa93 | [
"Apache-2.0"
] | null | null | null | views/View.php | deigmaranderson/duosystem | a8591e99310e5a8e019c864ca2859e6fd794aa93 | [
"Apache-2.0"
] | null | null | null | views/View.php | deigmaranderson/duosystem | a8591e99310e5a8e019c864ca2859e6fd794aa93 | [
"Apache-2.0"
] | 1 | 2018-11-22T21:55:58.000Z | 2018-11-22T21:55:58.000Z | <?php
class View {
function __construct() {
//echo 'view';
}
public function render($name)
{
require 'views/' . $name . '.php';
}
} | 14 | 42 | 0.450549 |
de5ec89670b20483dc581071f4a9d90e0b7188d5 | 819 | sql | SQL | db/db/3table/upright/FM_PROFIT_CENTRE.sql | ligana/Ensemble-om-SpringBoot | cd3605479f2d734f772319a57f0afc634e5c61c3 | [
"MIT"
] | 3 | 2018-08-22T08:59:15.000Z | 2019-04-09T01:48:37.000Z | db/db/3table/upright/FM_PROFIT_CENTRE.sql | ligana/Ensemble-om-SpringBoot | cd3605479f2d734f772319a57f0afc634e5c61c3 | [
"MIT"
] | 1 | 2022-02-09T22:06:59.000Z | 2022-02-09T22:06:59.000Z | db/db/3table/upright/FM_PROFIT_CENTRE.sql | ligana/Ensemble-om-SpringBoot | cd3605479f2d734f772319a57f0afc634e5c61c3 | [
"MIT"
] | 3 | 2018-08-14T09:15:16.000Z | 2019-04-09T01:48:40.000Z | drop table if exists FM_PROFIT_CENTRE;
/*==============================================================*/
/* Table: FM_PROFIT_CENTRE */
/*==============================================================*/
create table FM_PROFIT_CENTRE
(
PROFIT_CENTRE varchar(12) not null comment '利润中心',
PROFIT_CENTRE_DESC varchar(30) not null comment '中文说明',
PROFIT_CENTRE_DESC_EN varchar(30) comment '英文说明',
PROFIT_CENTRE_TYPE varchar(1) not null default 'S' comment '利润中心类型 S-Sub 记账类 C-Control 控制类',
PROFIT_CENTRE_LEVEL varchar(50) comment '利润中心级别',
COMPANY varchar(20) comment '法人',
TRAN_TIMESTAMP varchar(17) comment '交易时间戳',
TRAN_TIME Decimal(11,0) comment '交易时间',
primary key (PROFIT_CENTRE)
);
alter table FM_PROFIT_CENTRE comment '利润中心 undefined'; | 48.176471 | 98 | 0.58486 |
62b922e735264e24496510b66477df2dbc6bc8b7 | 42,023 | sql | SQL | kitchen2(4).sql | mtoto6469/buokler | 71725c3e6e6a64a625900af300646546d02cbafe | [
"BSD-3-Clause"
] | null | null | null | kitchen2(4).sql | mtoto6469/buokler | 71725c3e6e6a64a625900af300646546d02cbafe | [
"BSD-3-Clause"
] | null | null | null | kitchen2(4).sql | mtoto6469/buokler | 71725c3e6e6a64a625900af300646546d02cbafe | [
"BSD-3-Clause"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 08, 2018 at 01:20 PM
-- Server version: 10.1.30-MariaDB
-- PHP Version: 5.6.33
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `kitchen2`
--
-- --------------------------------------------------------
--
-- Table structure for table `auth_assignment`
--
CREATE TABLE `auth_assignment` (
`item_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`user_id` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`created_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `auth_assignment`
--
INSERT INTO `auth_assignment` (`item_name`, `user_id`, `created_at`) VALUES
('admin', '380', 1520510670);
-- --------------------------------------------------------
--
-- Table structure for table `auth_item`
--
CREATE TABLE `auth_item` (
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`type` smallint(6) NOT NULL,
`description` text COLLATE utf8_unicode_ci,
`rule_name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
`data` blob,
`created_at` int(11) DEFAULT NULL,
`updated_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `auth_item`
--
INSERT INTO `auth_item` (`name`, `type`, `description`, `rule_name`, `data`, `created_at`, `updated_at`) VALUES
('admin', 1, NULL, NULL, NULL, 1507986116, 1507986116),
('collsge', 1, NULL, NULL, NULL, 1507986117, 1507986117),
('costumer', 1, NULL, NULL, NULL, 1507986117, 1507986117),
('student', 1, NULL, NULL, NULL, 1507986117, 1507986117),
('teacher', 1, NULL, NULL, NULL, 1507986117, 1507986117),
('user', 1, NULL, NULL, NULL, 1507986117, 1507986117);
-- --------------------------------------------------------
--
-- Table structure for table `auth_item_child`
--
CREATE TABLE `auth_item_child` (
`parent` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`child` varchar(64) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `auth_rule`
--
CREATE TABLE `auth_rule` (
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`data` blob,
`created_at` int(11) DEFAULT NULL,
`updated_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `cat_pro`
--
CREATE TABLE `cat_pro` (
`id` int(11) NOT NULL,
`id_cat` int(11) NOT NULL,
`id_pro` varchar(300) COLLATE utf8_persian_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `cat_pro`
--
INSERT INTO `cat_pro` (`id`, `id_cat`, `id_pro`) VALUES
(1, 2, '41,41,41,41');
-- --------------------------------------------------------
--
-- Table structure for table `code_off`
--
CREATE TABLE `code_off` (
`id` int(11) NOT NULL,
`code` int(11) NOT NULL,
`price` varchar(300) COLLATE utf8mb4_persian_ci DEFAULT '0',
`enabel_view` int(11) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci;
--
-- Dumping data for table `code_off`
--
INSERT INTO `code_off` (`id`, `code`, `price`, `enabel_view`) VALUES
(15, 2, '0', 1),
(16, 3, '0', 1);
-- --------------------------------------------------------
--
-- Table structure for table `faceexist`
--
CREATE TABLE `faceexist` (
`id` int(11) NOT NULL,
`id_pro` int(11) DEFAULT NULL,
`exist` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `faceexist`
--
INSERT INTO `faceexist` (`id`, `id_pro`, `exist`) VALUES
(90, 41, 0),
(91, 42, 0),
(92, 43, 27);
-- --------------------------------------------------------
--
-- Table structure for table `facesize`
--
CREATE TABLE `facesize` (
`id` int(11) NOT NULL,
`id_size` int(11) DEFAULT NULL,
`size` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `facesize`
--
INSERT INTO `facesize` (`id`, `id_size`, `size`) VALUES
(43, 21, 'gh'),
(44, 22, 'swq'),
(45, 23, 'sad'),
(46, 24, 'ندارد');
-- --------------------------------------------------------
--
-- Table structure for table `gallery_app`
--
CREATE TABLE `gallery_app` (
`id` int(11) NOT NULL,
`img` varchar(300) COLLATE utf8mb4_persian_ci NOT NULL,
`alt` varchar(300) COLLATE utf8mb4_persian_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci;
--
-- Dumping data for table `gallery_app`
--
INSERT INTO `gallery_app` (`id`, `img`, `alt`) VALUES
(1, '57fe55c1cd7e51.jpg', 'vcxvczx');
-- --------------------------------------------------------
--
-- Table structure for table `main_app`
--
CREATE TABLE `main_app` (
`id` int(11) NOT NULL,
`type` varchar(300) COLLATE utf8mb4_polish_ci NOT NULL,
`m_d_f` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`id_m_d_f` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`urlimg` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`img1` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`img2` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`img3` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`img4` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`id1` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`id2` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`id3` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`id4` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`headrtype` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`footertype` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`text1` text COLLATE utf8mb4_polish_ci,
`text2` text COLLATE utf8mb4_polish_ci,
`text3` text COLLATE utf8mb4_polish_ci,
`position` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_polish_ci;
--
-- Dumping data for table `main_app`
--
INSERT INTO `main_app` (`id`, `type`, `m_d_f`, `id_m_d_f`, `urlimg`, `img1`, `img2`, `img3`, `img4`, `id1`, `id2`, `id3`, `id4`, `headrtype`, `footertype`, `text1`, `text2`, `text3`, `position`) VALUES
(22, 'oneImage', 'd', '3', 'http://localhost/upload/15.png', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1),
(23, 'fourImage', NULL, NULL, NULL, 'http://localhost/upload/57fe55c1cd7e51.jpg', 'http://localhost/upload/268903_515528685151134_963719900_n.jpg', 'http://localhost/upload/15.png', 'http://localhost/upload/7.jpg', 'd-1', 'd-3', 'm-36', 'm-40', 'ffs', 'sfsafaffa', NULL, NULL, NULL, 2),
(24, 'oneText', 'd', '3', 'http://localhost/upload/57fe55c1cd7e51.jpg', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'sfdsf', NULL, NULL, NULL, NULL, 3),
(25, 'towText', 'm', '36', 'http://localhost/upload/15.png', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'dfsasf', 'fdf fdafdaf', NULL, NULL, NULL, 4),
(26, 'oneText', 'm', '37', 'http://localhost/upload/57fe55c1cd7e51.jpg', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'sfsfs', NULL, NULL, NULL, NULL, 5),
(27, 'treeImage', NULL, NULL, NULL, 'http://localhost/upload/2017-summer-new-sexy-slash-neck-fashion-women.jpg', 'http://localhost/upload/268903_515528685151134_963719900_n.jpg', 'http://localhost/upload/15.png', NULL, 'm-40', 'm-38', 'd-2', NULL, 'fsd ', 'ffdfadf', 'afdasf', 'fdsafd', 'fadsfa', 6),
(36, 'sllider', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 7),
(37, 'towText', 'm', '38', 'http://localhost/upload/2017-summer-new-sexy-slash-neck-fashion-women.jpg', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'hfghh', 'hg uhgjh', NULL, NULL, NULL, 8);
-- --------------------------------------------------------
--
-- Table structure for table `migration`
--
CREATE TABLE `migration` (
`version` varchar(180) NOT NULL,
`apply_time` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `migration`
--
INSERT INTO `migration` (`version`, `apply_time`) VALUES
('m000000_000000_base', 1505819197),
('m130524_201442_init', 1505819203),
('m140506_102106_rbac_init', 1506338470),
('m160622_085710_create_ImageManager_table', 1506247435),
('m170223_113221_addBlameableBehavior', 1506247436);
-- --------------------------------------------------------
--
-- Table structure for table `slider`
--
CREATE TABLE `slider` (
`id` int(11) NOT NULL,
`img` varchar(300) COLLATE utf8mb4_polish_ci NOT NULL,
`alt` varchar(20) COLLATE utf8mb4_polish_ci NOT NULL,
`description` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`enabel` int(11) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_polish_ci;
--
-- Dumping data for table `slider`
--
INSERT INTO `slider` (`id`, `img`, `alt`, `description`, `enabel`) VALUES
(6, '1.jpeg', 'یل', 'یبل', 1),
(7, 'ash.jpg', 'لیلی', 'یلبی', 1),
(8, 'Lucas-Allen-tatler-10feb14_pr_b_639x426.jpg', 'یبل', 'یبل', 1),
(9, 'landscape-1466708405-beach-dream-7.jpg', 'بیلیب', 'لیبل', 1);
-- --------------------------------------------------------
--
-- Table structure for table `sliderapp`
--
CREATE TABLE `sliderapp` (
`id` int(11) NOT NULL,
`id_main` int(11) NOT NULL,
`img` varchar(300) COLLATE utf8mb4_polish_ci NOT NULL,
`text` text COLLATE utf8mb4_polish_ci NOT NULL,
`id_m_d_f` varchar(300) COLLATE utf8mb4_polish_ci DEFAULT NULL,
`id_cat` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_polish_ci;
--
-- Dumping data for table `sliderapp`
--
INSERT INTO `sliderapp` (`id`, `id_main`, `img`, `text`, `id_m_d_f`, `id_cat`) VALUES
(4, 36, 'http://localhost/upload/188.jpg', 'hhfdsffgv', 'm-40', 0),
(6, 36, 'http://localhost/upload/2017-new-women-europe-and-the-united-states.jpg', 'cgfgfhgfgh uhuu', 'd-3', 5),
(7, 36, 'http://localhost/upload/2017-summer-new-sexy-slash-neck-fashion-women.jpg', 'bnvbnvnbvbfaff', 'd-1', 4);
-- --------------------------------------------------------
--
-- Table structure for table `tbladdres_phon`
--
CREATE TABLE `tbladdres_phon` (
`id` int(11) NOT NULL,
`address` text COLLATE utf8_persian_ci NOT NULL,
`tel` varchar(300) COLLATE utf8_persian_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tbladdres_phon`
--
INSERT INTO `tbladdres_phon` (`id`, `address`, `tel`) VALUES
(1, 'tehran--', '34556788');
-- --------------------------------------------------------
--
-- Table structure for table `tblallpost`
--
CREATE TABLE `tblallpost` (
`id` int(11) NOT NULL,
`address` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL,
`price_post` int(11) DEFAULT NULL,
`category` int(11) DEFAULT NULL,
`name_post` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL,
`costomer` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL,
`tel` int(12) DEFAULT NULL,
`price` int(11) DEFAULT NULL,
`id_user` int(11) NOT NULL,
`down_buy` int(11) DEFAULT '0',
`id_fac` int(11) DEFAULT NULL,
`id_fader` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tblallpost`
--
INSERT INTO `tblallpost` (`id`, `address`, `price_post`, `category`, `name_post`, `costomer`, `tel`, `price`, `id_user`, `down_buy`, `id_fac`, `id_fader`) VALUES
(4, 'wrewrwe', 12000, 1, 'post', 'sfd', 3123, 12045, 372, 1, 1, 0),
(5, 'ukjh', NULL, 1, NULL, '', NULL, NULL, 374, 0, NULL, 0);
-- --------------------------------------------------------
--
-- Table structure for table `tblbag`
--
CREATE TABLE `tblbag` (
`id` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
`id_pro` int(11) NOT NULL,
`count` int(11) NOT NULL DEFAULT '1',
`date` date NOT NULL,
`date_ir` varchar(300) CHARACTER SET latin1 NOT NULL,
`id_fac` int(11) DEFAULT '0',
`enabel` int(11) DEFAULT '1',
`enable_view` int(11) DEFAULT '1',
`down_buy` int(11) DEFAULT '0',
`size` int(11) DEFAULT NULL,
`color` varchar(300) CHARACTER SET utf8 COLLATE utf8_persian_ci DEFAULT NULL,
`id_all_post` varchar(300) COLLATE utf8mb4_persian_ci DEFAULT NULL,
`price` int(30) NOT NULL,
`id_discount` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci;
--
-- Dumping data for table `tblbag`
--
INSERT INTO `tblbag` (`id`, `id_user`, `id_pro`, `count`, `date`, `date_ir`, `id_fac`, `enabel`, `enable_view`, `down_buy`, `size`, `color`, `id_all_post`, `price`, `id_discount`) VALUES
(23, 375, 43, 1, '2018-02-17', '??/??/??', 0, 1, 1, 0, NULL, NULL, NULL, 22187878, NULL),
(27, 375, 43, 1, '2018-02-18', '??/??/??', 0, 1, 1, 0, NULL, NULL, NULL, 22187878, NULL),
(29, 375, 42, 1, '2018-02-18', '??/??/??', 0, 1, 1, 0, NULL, NULL, NULL, 10, NULL),
(30, 375, 42, 1, '2018-03-08', '??/??/??', 0, 1, 1, 0, NULL, NULL, NULL, 10, NULL),
(31, 375, 44, 1, '2018-03-08', '??/??/??', 0, 1, 1, 0, NULL, NULL, NULL, 15000, NULL),
(32, 375, 44, 6, '2018-03-08', '??/??/??', 0, 1, 1, 0, NULL, NULL, NULL, 90000, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `tblbag_replace`
--
CREATE TABLE `tblbag_replace` (
`id` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
`id_pro` int(11) NOT NULL,
`count` int(11) NOT NULL DEFAULT '1',
`id_fac` int(11) DEFAULT '0',
`enabel` int(11) DEFAULT '1',
`enabel_view` int(11) DEFAULT '1',
`down_buy` int(11) DEFAULT '0',
`size` int(11) NOT NULL,
`color` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`id_all_post` int(11) DEFAULT NULL,
`price` int(30) NOT NULL,
`id_replace` int(11) NOT NULL,
`id_bag` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tblbrand`
--
CREATE TABLE `tblbrand` (
`id` int(11) NOT NULL,
`brand` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL,
`description` text COLLATE utf8_persian_ci,
`enabel` int(11) DEFAULT '1',
`enabel_view` int(11) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tblbrand`
--
INSERT INTO `tblbrand` (`id`, `brand`, `description`, `enabel`, `enabel_view`) VALUES
(1, 'fff', 'ds', 1, 1);
-- --------------------------------------------------------
--
-- Table structure for table `tblcategory`
--
CREATE TABLE `tblcategory` (
`id_category` int(11) NOT NULL,
`title_category` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`description_category` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL,
`enable_category` int(11) NOT NULL,
`enabel_view_category` int(11) DEFAULT '1',
`id_parent` int(11) DEFAULT NULL,
`group_category` int(11) NOT NULL DEFAULT '1',
`menu_foter` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tblcategory_product`
--
CREATE TABLE `tblcategory_product` (
`id` int(11) NOT NULL,
`name` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`description` text COLLATE utf8_persian_ci,
`id_parent` int(11) DEFAULT NULL,
`enabel` int(11) DEFAULT '1',
`enabel_view` int(11) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tblcategory_product`
--
INSERT INTO `tblcategory_product` (`id`, `name`, `description`, `id_parent`, `enabel`, `enabel_view`) VALUES
(1, 'دسته 1', '', 0, 1, 1),
(2, 'دسته 2', '', 0, 1, 1),
(3, 'دسته 3', '', 0, 1, 1),
(4, 'دسته 4', '', 0, 1, 1);
-- --------------------------------------------------------
--
-- Table structure for table `tblcolor`
--
CREATE TABLE `tblcolor` (
`id` int(11) NOT NULL,
`id_pro` int(11) NOT NULL,
`enabel` int(11) DEFAULT '1',
`enabel_view` int(11) DEFAULT '1',
`color` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`img` varchar(300) COLLATE utf8_persian_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tblcolor`
--
INSERT INTO `tblcolor` (`id`, `id_pro`, `enabel`, `enabel_view`, `color`, `img`) VALUES
(7, 30, 1, 1, 'fhgf', '57fe55c1cd7e51.jpg'),
(8, 34, 1, 1, 'hgjh', '16077.png'),
(9, 35, 1, 1, 'sa', '188.jpg'),
(10, 36, 1, 1, 'h', '16077.png'),
(11, 36, 1, 1, 'jmj', '16077.png'),
(12, 37, 1, 1, 'xsa', '7b3a351c5f846f184dc969c729e9ec29.jpeg'),
(13, 37, 1, 1, 'sdsd', 'AAEAAQAAAAAAAAe1AAAAJDMwZGQ0ZjJkLTVjMDMtNDM0ZS1iOTQwLWZmMzA5YjUyNGQ1Nw.jpg'),
(14, 38, 1, 1, 'h', 'hhh.jpg'),
(15, 40, 1, 1, 'g', 'bigstock-Delicious-birthday-cake-on-tab-78718583.jpg'),
(16, 39, 1, 1, 'نتنا', '7b3a351c5f846f184dc969c729e9ec29.jpeg');
-- --------------------------------------------------------
--
-- Table structure for table `tbldeliverprice`
--
CREATE TABLE `tbldeliverprice` (
`id` int(11) NOT NULL,
`name` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`price` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tbldeliverprice`
--
INSERT INTO `tbldeliverprice` (`id`, `name`, `price`) VALUES
(1, 'تیپاکس', 15000),
(2, 'پست', 12000),
(3, 'پیک موتوری', 15000);
-- --------------------------------------------------------
--
-- Table structure for table `tbldiscount`
--
CREATE TABLE `tbldiscount` (
`id` int(11) NOT NULL,
`name` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`description` text COLLATE utf8_persian_ci NOT NULL,
`all_pro` int(11) NOT NULL,
`price` int(11) NOT NULL,
`enabel` int(11) DEFAULT '1',
`enabel_view` int(11) DEFAULT '1',
`price_namayande` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tbldiscount`
--
INSERT INTO `tbldiscount` (`id`, `name`, `description`, `all_pro`, `price`, `enabel`, `enabel_view`, `price_namayande`) VALUES
(1, 'jjj', 'dsf', 0, 10, 1, 1, NULL),
(2, 'g', 'gh', 0, 10, 1, 1, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `tbldis_pro`
--
CREATE TABLE `tbldis_pro` (
`id` int(11) NOT NULL,
`id_cat_pro` int(11) NOT NULL,
`id_dis` int(11) NOT NULL,
`enabel_view` int(11) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbldis_pro`
--
INSERT INTO `tbldis_pro` (`id`, `id_cat_pro`, `id_dis`, `enabel_view`) VALUES
(1, 36, 1, 1),
(2, 38, 1, 1),
(3, 37, 2, 1);
-- --------------------------------------------------------
--
-- Table structure for table `tblexist`
--
CREATE TABLE `tblexist` (
`id` int(11) NOT NULL,
`id_pro` int(11) NOT NULL,
`size` int(11) NOT NULL,
`color` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`enabel_view` int(11) NOT NULL DEFAULT '1',
`exist` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tblexist`
--
INSERT INTO `tblexist` (`id`, `id_pro`, `size`, `color`, `enabel_view`, `exist`) VALUES
(3, 36, 21, 'h', 1, 56),
(4, 37, 23, 'sdsd', 1, 33);
-- --------------------------------------------------------
--
-- Table structure for table `tblgallery`
--
CREATE TABLE `tblgallery` (
`id` int(11) NOT NULL,
`title` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`address` text COLLATE utf8_persian_ci NOT NULL,
`alert` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`and_web` int(11) NOT NULL,
`description` text COLLATE utf8_persian_ci NOT NULL,
`enable` int(11) NOT NULL,
`enable_view` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tblgallery`
--
INSERT INTO `tblgallery` (`id`, `title`, `address`, `alert`, `and_web`, `description`, `enable`, `enable_view`) VALUES
(1, 'dfds', '15.png', 'dafda', 1, 'afafdfa', 1, 1),
(2, 'dfds', '57fe55c1cd7e51.jpg', 'dafda', 1, 'afafdfa', 1, 1),
(3, 'dfds', '185.jpg', 'dafda', 1, 'afafdfa', 1, 1),
(4, 'dfds', '2017-summer-new-sexy-slash-neck-fashion-women.jpg', 'dafda', 1, 'afafdfa', 1, 1),
(5, 'dfds', '268903_515528685151134_963719900_n.jpg', 'dafda', 1, 'afafdfa', 1, 1);
-- --------------------------------------------------------
--
-- Table structure for table `tblmenu`
--
CREATE TABLE `tblmenu` (
`id_menu` int(11) NOT NULL,
`id_category` int(11) NOT NULL,
`position` int(11) NOT NULL,
`enable` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tblmessage`
--
CREATE TABLE `tblmessage` (
`id` int(11) NOT NULL,
`id_user` int(11) DEFAULT NULL,
`title` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`text` text COLLATE utf8_persian_ci NOT NULL,
`tell` int(11) DEFAULT NULL,
`id_post` int(11) DEFAULT NULL,
`email` varchar(250) COLLATE utf8_persian_ci DEFAULT NULL,
`date` varchar(250) COLLATE utf8_persian_ci DEFAULT NULL,
`date_ir` varchar(300) COLLATE utf8_persian_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tblmessage`
--
INSERT INTO `tblmessage` (`id`, `id_user`, `title`, `text`, `tell`, `id_post`, `email`, `date`, `date_ir`) VALUES
(1, NULL, 'hhghgh', 'ghgvhgf345445', 8888, NULL, 'ghcgcg', NULL, '۹۶/۰۸/۲۶');
-- --------------------------------------------------------
--
-- Table structure for table `tblpardakht`
--
CREATE TABLE `tblpardakht` (
`id` int(11) NOT NULL,
`id_fac` int(11) NOT NULL,
`end_number` int(4) NOT NULL,
`price` int(20) NOT NULL,
`date` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`peygiri` int(11) NOT NULL,
`admin_description` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL,
`enabel_view` int(11) DEFAULT '1',
`approve` int(11) DEFAULT '0',
`date_u` varchar(100) COLLATE utf8_persian_ci DEFAULT NULL,
`id_user` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tblpost`
--
CREATE TABLE `tblpost` (
`id` int(11) NOT NULL,
`id_group` int(11) DEFAULT NULL,
`title` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`text_web` text COLLATE utf8_persian_ci,
`id_img_mob` int(11) DEFAULT NULL,
`id_img_web` int(11) DEFAULT NULL,
`id_category_post` int(11) DEFAULT NULL,
`enable` int(11) NOT NULL,
`enable_view` int(11) DEFAULT '1',
`tag` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL,
`keyword` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`link` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL,
`type` int(11) NOT NULL,
`time` date NOT NULL,
`time_ir` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`user_id` int(11) NOT NULL,
`id_position` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL,
`description` text COLLATE utf8_persian_ci,
`status` varchar(300) COLLATE utf8_persian_ci DEFAULT 'publish'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tblpost`
--
INSERT INTO `tblpost` (`id`, `id_group`, `title`, `text_web`, `id_img_mob`, `id_img_web`, `id_category_post`, `enable`, `enable_view`, `tag`, `keyword`, `link`, `type`, `time`, `time_ir`, `user_id`, `id_position`, `description`, `status`) VALUES
(1, NULL, 'jhjkhjk', 'jjkhk', NULL, 2, NULL, 1, 1, NULL, 'jgj', 'jhgjh', 1, '2018-03-08', '۹۶/۱۲/۱۷', 375, NULL, 'jkhjk', 'publish'),
(2, NULL, 'درباره ما', 'درباره فروشگاه لوازم خانگی', NULL, NULL, NULL, 1, 1, NULL, 'یشسب', 'یشسب', 1, '2018-03-08', '۹۶/۱۲/۱۷', 375, NULL, 'یبشسیب', 'publish');
-- --------------------------------------------------------
--
-- Table structure for table `tblpostproduct`
--
CREATE TABLE `tblpostproduct` (
`id` int(11) NOT NULL,
`city` varchar(250) COLLATE utf8_persian_ci NOT NULL,
`price` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tblpost_page`
--
CREATE TABLE `tblpost_page` (
`id` int(11) NOT NULL,
`id_post` int(11) NOT NULL,
`id_psge` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tblproduct`
--
CREATE TABLE `tblproduct` (
`id` int(11) NOT NULL,
`id_category` int(11) NOT NULL,
`id_type` int(11) DEFAULT NULL,
`id_brand` int(11) DEFAULT NULL,
`img` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`description` text COLLATE utf8_persian_ci,
`enabel` int(11) DEFAULT '1',
`enabel_view` int(11) DEFAULT '1',
`time` date NOT NULL,
`name` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`time_ir` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`pak` int(11) DEFAULT NULL,
`tag_meta` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`title_meta` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`text_meta` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`key_meta` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`price` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`exist` int(11) NOT NULL,
`prposal` int(11) DEFAULT '0',
`takhfif` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tblproduct`
--
INSERT INTO `tblproduct` (`id`, `id_category`, `id_type`, `id_brand`, `img`, `description`, `enabel`, `enabel_view`, `time`, `name`, `time_ir`, `pak`, `tag_meta`, `title_meta`, `text_meta`, `key_meta`, `price`, `exist`, `prposal`, `takhfif`) VALUES
(41, 2, 2, 1, '188.jpg', 'fadsfs', 1, 1, '0000-00-00', 'dsafda', '11/11/1396', NULL, 'adsads', 'dasd', 'fasdfasd', 'dadsa', '3342', 0, 0, NULL),
(42, 3, 2, 1, '7.jpg', 'vsdfvds', 1, 1, '2018-02-05', 'ggg', '1396/11/16', NULL, 'sdfsfs', 'efd', 'efwfrefw', 'dsf,dsfds', '222222', 0, 1, 10),
(43, 1, 1, NULL, '16077.png', 'dsdsdsa', 1, 1, '2018-01-31', 'dsfdf', '1396/11/11', NULL, 'jkhjhjhg', 'hjh', 'eerere eww', 'jhhjjh', '22187878', 27, 1, NULL),
(44, 2, 2, 1, '16077.png', 'gf', 1, 1, '0000-00-00', 'hh', '14/12/1396', NULL, 'df', 'fg', 'fg', 'dg', '20000', 209, 1, 15000);
-- --------------------------------------------------------
--
-- Table structure for table `tblprofile`
--
CREATE TABLE `tblprofile` (
`id` int(11) NOT NULL,
`name` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`lastname` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`user_id` int(11) NOT NULL,
`role` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL,
`tel` int(12) NOT NULL,
`address` text COLLATE utf8_persian_ci,
`enable_view` int(11) DEFAULT '1',
`credit` int(11) DEFAULT NULL,
`date_credit` date DEFAULT NULL,
`mande` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tblprofile`
--
INSERT INTO `tblprofile` (`id`, `name`, `lastname`, `user_id`, `role`, `tel`, `address`, `enable_view`, `credit`, `date_credit`, `mande`) VALUES
(100, 'sdasa', 'ds', 380, 'user', 4324, '24324', 1, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `tblproposal`
--
CREATE TABLE `tblproposal` (
`id` int(11) NOT NULL,
`id_pro` int(11) NOT NULL,
`color` int(11) DEFAULT NULL,
`size` int(11) DEFAULT NULL,
`enabel_view` int(11) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tblproposal`
--
INSERT INTO `tblproposal` (`id`, `id_pro`, `color`, `size`, `enabel_view`) VALUES
(1, 36, 11, 21, 1),
(2, 37, 12, 22, 1),
(3, 38, 14, 24, 1),
(4, 36, 10, 21, 1),
(5, 37, 13, 23, 1),
(6, 37, 12, 22, 1),
(7, 36, 11, 21, 1);
-- --------------------------------------------------------
--
-- Table structure for table `tblreplace`
--
CREATE TABLE `tblreplace` (
`id` int(11) NOT NULL,
`id_user` int(11) DEFAULT NULL,
`id_pro` int(11) DEFAULT NULL,
`id_fac` int(11) DEFAULT NULL,
`text_user` text COLLATE utf8_persian_ci,
`category` int(11) DEFAULT NULL,
`confirm` int(11) DEFAULT '0',
`text_admin` text COLLATE utf8_persian_ci,
`post_price` int(11) NOT NULL DEFAULT '0',
`enabel_view` int(11) NOT NULL DEFAULT '1',
`id_bag` int(11) DEFAULT NULL,
`new_size` int(11) DEFAULT NULL,
`new_count` int(11) DEFAULT NULL,
`price_cr` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tblsize`
--
CREATE TABLE `tblsize` (
`id` int(11) NOT NULL,
`id_pro` int(11) DEFAULT NULL,
`size` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL,
`price` int(11) NOT NULL,
`price_namayande` int(11) DEFAULT NULL,
`enabel` int(11) DEFAULT '1',
`enabel_view` int(11) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tblsize`
--
INSERT INTO `tblsize` (`id`, `id_pro`, `size`, `price`, `price_namayande`, `enabel`, `enabel_view`) VALUES
(21, 36, 'gh', 54, 45, 1, 1),
(22, 37, 'swq', 32, 322, 1, 1),
(23, 37, 'sad', 3123, 3131, 1, 1),
(24, 38, 'ندارد', 15600, 5646, 1, 1),
(25, 39, 'ندارد', 2424, 42432, 1, 1),
(26, 40, 'sad', 4546, 7678, 1, 1);
-- --------------------------------------------------------
--
-- Table structure for table `tbltype_product`
--
CREATE TABLE `tbltype_product` (
`id` int(11) NOT NULL,
`type` varchar(300) COLLATE utf8_persian_ci NOT NULL,
`description` text COLLATE utf8_persian_ci,
`id_parent` int(11) DEFAULT NULL,
`enabel` int(11) DEFAULT '1',
`enabel_view` int(11) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tbltype_product`
--
INSERT INTO `tbltype_product` (`id`, `type`, `description`, `id_parent`, `enabel`, `enabel_view`) VALUES
(1, 'جنس 1', '', 0, 1, 1),
(2, 'جنس 2', '', 0, 1, 1),
(3, 'جنس 3', '', 0, 1, 1);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_sodor_factor`
--
CREATE TABLE `tbl_sodor_factor` (
`id` int(11) NOT NULL,
`id_ref` int(20) DEFAULT NULL,
`price` int(30) DEFAULT NULL,
`description` varchar(500) COLLATE utf8_persian_ci DEFAULT NULL,
`id_user` int(11) NOT NULL,
`data` date DEFAULT NULL,
`data_ir` varchar(300) COLLATE utf8_persian_ci DEFAULT NULL,
`resive` int(11) DEFAULT '0',
`visibel` int(11) DEFAULT '0',
`adress` text COLLATE utf8_persian_ci,
`print` int(11) DEFAULT '0',
`code_off` int(11) DEFAULT NULL,
`date_deliver` date DEFAULT NULL,
`confirm` int(11) DEFAULT '0',
`id_type_post` int(11) NOT NULL,
`user_tel` int(12) NOT NULL,
`user_name` varchar(300) COLLATE utf8_persian_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci;
--
-- Dumping data for table `tbl_sodor_factor`
--
INSERT INTO `tbl_sodor_factor` (`id`, `id_ref`, `price`, `description`, `id_user`, `data`, `data_ir`, `resive`, `visibel`, `adress`, `print`, `code_off`, `date_deliver`, `confirm`, `id_type_post`, `user_tel`, `user_name`) VALUES
(12, NULL, 22202878, NULL, 375, '2018-02-17', '۱۳۹۶/۱۱/۲۸', 0, 0, 'wfewrew', 0, 0, NULL, 0, 3, 2434, '32'),
(13, NULL, 22202878, NULL, 375, '2018-02-17', '۱۳۹۶/۱۱/۲۸', 0, 0, 'gsfdg', 0, 0, NULL, 0, 1, 232321, '234'),
(14, NULL, 22202878, NULL, 375, '2018-02-17', '۱۳۹۶/۱۱/۲۸', 0, 0, '432', 0, 0, NULL, 0, 3, 44, '34'),
(15, NULL, 22202878, NULL, 375, '2018-02-17', '۱۳۹۶/۱۱/۲۸', 0, 0, '24342', 0, 0, NULL, 0, 1, 424, 'wrw'),
(16, NULL, 22199878, NULL, 375, '2018-02-17', '۱۳۹۶/۱۱/۲۸', 0, 0, '345354', 0, 0, NULL, 0, 2, 54, '453'),
(17, NULL, 22202878, NULL, 375, '2018-02-17', '۱۳۹۶/۱۱/۲۸', 0, 0, 'vvxcbcv', 0, 0, NULL, 0, 1, 435, 'vbc'),
(18, NULL, 22199878, NULL, 375, '2018-02-17', '۱۳۹۶/۱۱/۲۸', 0, 0, '42342', 0, 0, NULL, 0, 2, 24, '4234'),
(19, NULL, 22199878, NULL, 375, '2018-02-17', '۱۳۹۶/۱۱/۲۸', 0, 0, '42342', 0, 0, NULL, 0, 2, 423, '4234'),
(20, NULL, 22212904, NULL, 375, '2018-02-18', '۱۳۹۶/۱۱/۲۹', 0, 0, 'hhjjjkhj', 0, 0, NULL, 0, 3, 665, 'jhj'),
(21, NULL, 44390756, NULL, 375, '2018-02-18', '۱۳۹۶/۱۱/۲۹', 0, 0, 'hhjkkl', 0, 0, NULL, 0, 3, 767, 'jhjh');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`auth_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`status` smallint(6) NOT NULL DEFAULT '10',
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `username`, `auth_key`, `password_hash`, `password_reset_token`, `status`, `created_at`, `updated_at`) VALUES
(380, 'hale23', 'LTGFlIjqZjtZzJGKRD4uZBiav1P4pbQU', '$2y$13$J8Vh.RM343h4pn1K6IDYj.p0Ytl8MQDPXM6gAG4ytFNRN5CshPq0K', NULL, 10, 1520510670, 1520510670);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `auth_assignment`
--
ALTER TABLE `auth_assignment`
ADD PRIMARY KEY (`item_name`,`user_id`);
--
-- Indexes for table `auth_item`
--
ALTER TABLE `auth_item`
ADD PRIMARY KEY (`name`),
ADD KEY `rule_name` (`rule_name`),
ADD KEY `idx-auth_item-type` (`type`);
--
-- Indexes for table `auth_item_child`
--
ALTER TABLE `auth_item_child`
ADD PRIMARY KEY (`parent`,`child`),
ADD KEY `child` (`child`);
--
-- Indexes for table `auth_rule`
--
ALTER TABLE `auth_rule`
ADD PRIMARY KEY (`name`);
--
-- Indexes for table `cat_pro`
--
ALTER TABLE `cat_pro`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `code_off`
--
ALTER TABLE `code_off`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `faceexist`
--
ALTER TABLE `faceexist`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `facesize`
--
ALTER TABLE `facesize`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `gallery_app`
--
ALTER TABLE `gallery_app`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `main_app`
--
ALTER TABLE `main_app`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migration`
--
ALTER TABLE `migration`
ADD PRIMARY KEY (`version`);
--
-- Indexes for table `slider`
--
ALTER TABLE `slider`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `sliderapp`
--
ALTER TABLE `sliderapp`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbladdres_phon`
--
ALTER TABLE `tbladdres_phon`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblallpost`
--
ALTER TABLE `tblallpost`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblbag`
--
ALTER TABLE `tblbag`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblbag_replace`
--
ALTER TABLE `tblbag_replace`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblbrand`
--
ALTER TABLE `tblbrand`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblcategory`
--
ALTER TABLE `tblcategory`
ADD PRIMARY KEY (`id_category`);
--
-- Indexes for table `tblcategory_product`
--
ALTER TABLE `tblcategory_product`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblcolor`
--
ALTER TABLE `tblcolor`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbldeliverprice`
--
ALTER TABLE `tbldeliverprice`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbldiscount`
--
ALTER TABLE `tbldiscount`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbldis_pro`
--
ALTER TABLE `tbldis_pro`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblexist`
--
ALTER TABLE `tblexist`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblgallery`
--
ALTER TABLE `tblgallery`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblmenu`
--
ALTER TABLE `tblmenu`
ADD PRIMARY KEY (`id_menu`);
--
-- Indexes for table `tblmessage`
--
ALTER TABLE `tblmessage`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblpardakht`
--
ALTER TABLE `tblpardakht`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblpost`
--
ALTER TABLE `tblpost`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblpostproduct`
--
ALTER TABLE `tblpostproduct`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblpost_page`
--
ALTER TABLE `tblpost_page`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblproduct`
--
ALTER TABLE `tblproduct`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblprofile`
--
ALTER TABLE `tblprofile`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblproposal`
--
ALTER TABLE `tblproposal`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblreplace`
--
ALTER TABLE `tblreplace`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tblsize`
--
ALTER TABLE `tblsize`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbltype_product`
--
ALTER TABLE `tbltype_product`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbl_sodor_factor`
--
ALTER TABLE `tbl_sodor_factor`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`),
ADD UNIQUE KEY `password_reset_token` (`password_reset_token`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `cat_pro`
--
ALTER TABLE `cat_pro`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `code_off`
--
ALTER TABLE `code_off`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `faceexist`
--
ALTER TABLE `faceexist`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=93;
--
-- AUTO_INCREMENT for table `facesize`
--
ALTER TABLE `facesize`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=47;
--
-- AUTO_INCREMENT for table `gallery_app`
--
ALTER TABLE `gallery_app`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `main_app`
--
ALTER TABLE `main_app`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38;
--
-- AUTO_INCREMENT for table `slider`
--
ALTER TABLE `slider`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `sliderapp`
--
ALTER TABLE `sliderapp`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `tblallpost`
--
ALTER TABLE `tblallpost`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `tblbag`
--
ALTER TABLE `tblbag`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33;
--
-- AUTO_INCREMENT for table `tblbag_replace`
--
ALTER TABLE `tblbag_replace`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tblbrand`
--
ALTER TABLE `tblbrand`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tblcategory`
--
ALTER TABLE `tblcategory`
MODIFY `id_category` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tblcategory_product`
--
ALTER TABLE `tblcategory_product`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tblcolor`
--
ALTER TABLE `tblcolor`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `tbldeliverprice`
--
ALTER TABLE `tbldeliverprice`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tbldiscount`
--
ALTER TABLE `tbldiscount`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tbldis_pro`
--
ALTER TABLE `tbldis_pro`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tblexist`
--
ALTER TABLE `tblexist`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tblgallery`
--
ALTER TABLE `tblgallery`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `tblmenu`
--
ALTER TABLE `tblmenu`
MODIFY `id_menu` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tblmessage`
--
ALTER TABLE `tblmessage`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tblpardakht`
--
ALTER TABLE `tblpardakht`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tblpost`
--
ALTER TABLE `tblpost`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tblpostproduct`
--
ALTER TABLE `tblpostproduct`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tblpost_page`
--
ALTER TABLE `tblpost_page`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tblproduct`
--
ALTER TABLE `tblproduct`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=45;
--
-- AUTO_INCREMENT for table `tblprofile`
--
ALTER TABLE `tblprofile`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=101;
--
-- AUTO_INCREMENT for table `tblproposal`
--
ALTER TABLE `tblproposal`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `tblreplace`
--
ALTER TABLE `tblreplace`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tblsize`
--
ALTER TABLE `tblsize`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
--
-- AUTO_INCREMENT for table `tbltype_product`
--
ALTER TABLE `tbltype_product`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tbl_sodor_factor`
--
ALTER TABLE `tbl_sodor_factor`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=381;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 29.121968 | 300 | 0.643885 |
74de770102491d372b351632d665aa8d77daef78 | 615 | js | JavaScript | api/index.js | pschfr/fav-artists | a54bf9edad6829857675838c2b215ed736181e36 | [
"MIT"
] | 1 | 2019-02-28T21:50:40.000Z | 2019-02-28T21:50:40.000Z | api/index.js | pschfr/fav-artists | a54bf9edad6829857675838c2b215ed736181e36 | [
"MIT"
] | 6 | 2019-02-28T22:57:33.000Z | 2022-01-22T03:51:26.000Z | api/index.js | pschfr/fav-artists | a54bf9edad6829857675838c2b215ed736181e36 | [
"MIT"
] | null | null | null | // Require dependencies
const dotenv = require('dotenv').config();
const LastFM_API = require('lastfmapi');
const LastFM = new LastFM_API({
'api_key': process.env.LAST_FM_KEY,
'secret': process.env.LAST_FM_SECRET
});
// Wrapper function to get top artists from LastFM
function LastFM_top_artists(username = 'paul_r_schaefer') {
LastFM.user.getTopArtists({ user: username }, (err, data) => {
if (err) console.error(err)
else {
// console.log(data['artist']);
return data;
}
});
}
// Exports to Zero
module.exports = (request, response) => {
response.send({
response: LastFM_top_artists()
});
}
| 23.653846 | 63 | 0.692683 |
70fa043215cc3fd5ecabf1ed03db49d38384d80e | 764 | cs | C# | Hedgehog.Core/Application/Commands/DeserializeAddressRequestHandler.cs | lambda-snail/HedgehogWebServices | c48ce77b2c3e152f797ada948119cefb7b7838d7 | [
"MIT"
] | null | null | null | Hedgehog.Core/Application/Commands/DeserializeAddressRequestHandler.cs | lambda-snail/HedgehogWebServices | c48ce77b2c3e152f797ada948119cefb7b7838d7 | [
"MIT"
] | null | null | null | Hedgehog.Core/Application/Commands/DeserializeAddressRequestHandler.cs | lambda-snail/HedgehogWebServices | c48ce77b2c3e152f797ada948119cefb7b7838d7 | [
"MIT"
] | null | null | null | using Hedgehog.Core.Application.Requests;
using Hedgehog.Core.Contracts.InfrastructureContracts;
using Hedgehog.Core.Domain;
using MediatR;
using System.Threading;
using System.Threading.Tasks;
namespace Hedgehog.Core.Application.Commands
{
public class DeserializeAddressRequestHandler : IRequestHandler<DeserializeAddressRequest, Address>
{
private readonly ISerializer<Address> _serializer;
public DeserializeAddressRequestHandler(ISerializer<Address> serializer)
{
_serializer = serializer;
}
public async Task<Address> Handle(DeserializeAddressRequest request, CancellationToken cancellationToken)
{
return await _serializer.DeserializeAsync(request.Json);
}
}
}
| 30.56 | 113 | 0.744764 |
1745c4dc3fcf2cc1dbe3ec3746395479c70a2cfa | 14,213 | html | HTML | index.html | edukait/windigo | 8b441ad56f61ae80a19d89a13c6f4fe3449c6fa2 | [
"MIT"
] | null | null | null | index.html | edukait/windigo | 8b441ad56f61ae80a19d89a13c6f4fe3449c6fa2 | [
"MIT"
] | null | null | null | index.html | edukait/windigo | 8b441ad56f61ae80a19d89a13c6f4fe3449c6fa2 | [
"MIT"
] | null | null | null | <!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Public Philosophy Project</title>
<link rel="stylesheet" href="styles.css"/>
<link href='http://fonts.googleapis.com/css?family=Arvo:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
<script>
</script>
</head>
<body>
<!-----slides start-->
<div id="slide1">
<div class="content">
<h1>The Windigo</h1>
<h2>Kaitlin Lim</h2>
<p>
<br>Within a few indigenous cultures lurks the infamous Windigo. A large, human-like beast, “has been called an evil spirit that devours mankind”—the more it eats, the more it hungers (Kimmerer 306). It was often told as a tale to children so they would behave, but the Windigo is more than just a bedtime story. If anything, it is representative of a problem that is becoming increasingly urgent and a discourse that needs to occur.
<br><br>The cautionary tale of the Windigo emphasizes selflessness. It stresses the importance of being generous and giving to other members of the community and “to build resistance against the insidious germ of taking too much” (Kimmerer 305). In fact, there is a little bit of Windigo inside every one of us, and it is incumbent on all of us to keep those Windigo-like, selfish tendencies in check.
<br><br>But not all of us have, and it’s become especially prevalent with today’s current environmental climate—pun not intended. The money-fueled desires of people and powerful private corporations has resulted in the deforestation of the Amazon rainforest, oil spills in oceans and gulfs, and natural disasters that have disproportionately affected poor communities, just to name a few. Our capitalistic, profit-driven culture has become one where “indulgent self-interest that [indigenous] people once held to be monstrous is now celebrated as success” (Kimmerer 308).
<br><br>In the context of environmental ethics, the Windigo illustrates two key terms: partiality and anthropocentric ethics. Simply put, the Windigo itself represents our partiality to ourselves and our self-interests as opposed to a community or collective, whereas anthropocentric ethics facilitates a continued emphasis on the self. I will first be defining partiality and anthropocentric ethics, then illustrating how harmful they have been in an environmental context with a few case studies, and finishing with suggestions that we can do as individuals to abolish these Windigo tendencies.
</p>
<h3>Photo taken by Michael Nichols.</h3>
</div>
</div>
<div id="slide2">
<div class="content">
<h1>Partiality and Anthropocentrism</h1>
<p>
<br>Philosopher Simon Keller defines partiality as the situation where “your special relationships make a difference to the standards of assessment to which your acts are answerable” (Keller 3) If you are partial to someone, you are more likely to give them “special” treatment—whether that be bending the rules, adding extra effort, or making more sacrifices. The trolley problem is a good example of partiality at work: let’s say there’s a trolley barreling down the tracks, but there are five strangers tied on the tracks. You have the option to redirect the trolley’s route, but a loved one or a close family member is tied to the other set of tracks. Which route do you choose?
<br><br>Partiality is what might make us choose the tracks that would kill five people over our loved one. Of course, it’s obviously very difficult for us to remove partiality from all aspects of our lives, and we shouldn’t hold everyone to the expectation that we’ll get rid of any partiality we might have in order to make the most ethically sound decisions. Despite this, though, it’s still important that we assess partiality in the greater scheme of corporate profit motivated by individual greed. That is, we must be aware of the partiality present in the decisions of corporations that prioritize individual profit over their workers’ wellbeing.
<br><br>With this definition of partiality, we can then state that anthropocentric ethics—human-centered ethics—as a form of ethics partial towards humans. That is, “human beings and only human beings have moral standing,” so only humans can be morally wronged (Desjardins 105). In this case, “our duties, such as not to pollute, are duties regarding the environment, but they are not duties to the environment” (Desjardins 105). Because the environment itself cannot be morally wronged in anthropocentric ethics, people would only be morally obligated to carry out tasks that, in addition to helping the environment, will ultimately help the human. We would be making decisions not out of a greater concern for the environment, but a concern for our self-interests.
<br><br>Anthropocentric ethics is extremely prevalent. Our societal emphasis on individualism and the self is a reflection of that. And because of the dominant anthropocentric mode of thought, we have become accustomed to putting ourselves at the top of the moral hierarchy, and we can do anything we want to our surroundings without fear of repercussions. This anthropocentrism—this partiality to ourselves—has, indeed, led to us devastating the environment without so much a second thought. Classic Windigo thinking!
</p>
<h3>Photo taken by Daniel Beltrá.</h3>
</div>
</div>
<div id="slide3">
<div class="content">
<h1>Harm to Animals</h1>
<p>
<br>This partial, anthropocentric way of thinking has had clear consequences in the natural world. One prominent example are the coral reefs across the globe, many of which have died out because of fluctuations in ocean temperatures and acidity levels. Corals, which are a conglomeration of skeletons made by tiny organisms called polyps, are admittedly very prone to harm. However, coral reefs serve as important components of the ocean’s ecosystem. Author Elizabeth Kolbert writes that “thousands—perhaps millions—of species have evolved to rely on coral reefs, either directly for protection or food, or indirectly, to prey on those species that come seeking protection or food” (Kolbert 130). Truly, coral reefs are the rainforests of the ocean, and they are a crucial component of many different aquatic ecosystems.
<br><br>Coral reefs are currently dying at rapid rates because of two main factors: ocean acidification and warmer temperatures—both of which are a results of environmentally harmful human activity. The latter has especially caused a lot of damage to coral reefs around the world, causing a phenomenon called “coral bleaching” where corals lose vital microorganisms that help keep it alive, lose their colors, and eventually die. Coral bleaching is happening more rapidly and in a shorter timeframe, as there were “major bleaching events in 1998, 2005, and 2010, and the frequency and intensity of such events are expected to increase as global temperatures climb” (Kolbert 142).
<br><br>In focusing on profit and individual gain, we have acted in ways that have facilitated the rise of oceanic acidity levels and global temperatures. Our anthropocentric Windigo thinking is to blame for the death of coral reefs and all of the unsavory consequences that come as a result.
</p>
<h3>Photo taken by Brett Monroe Garner.</h3>
</div>
</div>
<div id="slide4">
<div class="content">
<h1>Harm to Humans</h1>
<p>
<br>But our anthropocentrism has harmed more than just animals. Climate change has also caused an influx of natural disasters around the world, wreaking havoc and destroying households. These natural disasters have also disproportionately affected poor communities and women of color.
<br><br>For instance, let us consider hurricanes Katrina and Rita, which devastated the US Gulf Coast region in the early 2000s. A lot of people’s homes were destroyed in the aftermath, and many were left without jobs. The Gulf Coast area also has a high concentration of female-headed households. Thus, women were burdened with the weight of taking care of the family and securing a stable source of income, which left most “poorer, less able to find jobs and, therefore, less able to move back to their previous homes following the storm” (Harris 157). This is just one instance, but there have been similar narratives in many communities around the world. These struggles all highlight the way that our anthropocentric, Windigo way of thinking about the environment has affected communities (and some far more than others).
</p>
<h3>Photo taken by Kristin Callahan.</h3>
</div>
</div>
<div id="slide5">
<div class="content">
<h1>What Now?</h1>
<p>
<br>Given the devastating ramifications of our anthropocentric ways of thinking, what can we do to address it? And at the same time, how can we reverse the environmental damage that we have done and are currently doing?
<br><br>First, we must recognize the power of groups. As individuals, it might seem difficult to go about and try inciting change in the name of environmental justice. However, there are countless grassroots organizations, especially in indigenous communities, that have been able to generate movements and call for change. Author and environmentalist Winona LaDuke has participated in different grassroots organizations in her indigenous community, “winning many hard-fought victories on the local level. [They] have faced down huge waste dumps and multinational mining, lumber, and oil companies … [including] a moratorium on mining in the sacred hills of Northern Cheyenne, Blackfeet, and Crow territory; an international campaign that stopped the building of mega-dams in northern Canada; the restoration of thousands of acres of White Earth land in Minnesota; and the rebuilding of a nation in Hawai’i” (LaDuke 4). We can take these movements as examples for our own individual pursuits of environmental justice, and we can also contribute to organizations that already exist for these purposes. There is power in numbers, after all.
<br><br>Additionally, we can change the way that we think about the environment in relation to ourselves. Our current anthropocentric way of thinking has led us to believe that humans are on top of the moral hierarchy, and we thus have the ability to manipulate the world around us without constraint. As we have seen, that is not and should not be the case. But changing the way we think about the environment requires rejecting our anthropocentric mode of thought. So how else can we think about the environment in a way that is more conducive to environmental conservation and environmental justice?
<br><br>In his work “The Land Ethic,” author and environmentalist Aldo Leopold recommends that we do not view ourselves as a separate entity from the environment, but actually a part of it. Leopold describes the earth as a “sustained circuit, like a slowly augmented revolving fund of life” (Leopold 662). Energy flows through the circuit in the same way that it flows through a biological food web: predation, decomposition, and the like. In viewing the earth and its organisms as a large, complex web of energy, we then are not able to separate ourselves from the environment, but rather contribute to its complex entanglements. We no longer view the environment as something to be conquered or tamed, but rather something we are a part of and something that we respect. This relationship of respect then enables us to make decisions for the environment’s wellbeing instead of our own.
<br><br>Granted, it’s not easy to deconstruct our anthropocentric way of thinking, but it is work that is necessary and required (and, I argue, even the first step) for environmental justice. We must no longer let the Windigo dominate our way of life. It has been at the expense of not only countless habitats and animals, but also people. We all have a direct stake in the environment, and we must all make sure to tame our inner Windigos.
</p>
<h3>Photo taken by Robyn Beck.</h3>
</div>
</div>
<div id="slide6">
<div class="content">
<h1>Works Cited</h1>
<p>
<br>Beck, Robyn. <i>US-Environment-Protest.</i> 2016. North Dakota, https://www.gettyimages.com/detail/news-photo/native-americans-march-to-the-site-of-a-sacred-burial-news-photo/599236808.
<br><br>Beltrá, Daniel. <i>Oil Spill #12.</i> 2010. Digital chromogenic print. 40” x 60”. Catherine Edelman Gallery, Chicago, https://www.artworksforchange.org/portfolio/daniel-beltra/.
<br><br>Callahan, Kristin. “19 Stunning Pictures of Hurricane Katrina’s Aftermath.” Photograph. <i>The Daily Signal</i>, August 27, 2015. https://www.dailysignal.com/2015/08/27/19-stunning-pictures-of-hurricane-katrinas-aftermath/.
<br><br>DesJardins, Joseph R. “Responsibilities to the Natural World.” In Environmental Ethics: An Introduction to Environmental Philosophy, fifth ed, 105-110. United Kingdom: Wadsworth Cengage Learning, 1993.
<br><br>Garner, Brett Monroe. <i>Coral Bleaching on the Great Barrier Reef in Australia.</i> Cairns, Queensland, Australia, https://www.gettyimages.com/detail/photo/coral-bleaching-on-the-great-barrier-reef-in-royalty-free-image/1214651247?adppopup=true.
<br><br>Harris, Rachel. “Case Study 5.7: Gender Aspects of Climate Change in the U.S. Gulf Coast Region.” In <i>Gender and Climate Change: An Introduction</i>, 152-158. United Kingdom: Earthscan, 2010.
<br><br>Keller, Simon. “Special Relationships and Special Reasons.” In Partiality, 1-7. Princeton, NJ: Princeton University Press, 2013.
<br><br>Kimmerer, Robin Wall. “Windigo Footprints.” In <i>Braiding Sweetgrass</i>, 303-309. Canada: Milkweed Editions, 2013.
<br><br>Kolbert, Elizabeth. “Dropping Acid.” In <i>The Sixth Extinction: An Unnatural History</i>, 125-147. New York, NY: Picador, 2014.
<br><br>LaDuke, Winona. “Introduction.” In <i>All Our Relations: Native Struggles for Land and Life</i>, 1-6. Chicago, IL: Haymarket Books, 2016.
<br><br>Leopold, Aldo. “The Land Ethic.” 660-668.
<br><br>Nichols, Michael. “Giant Redwoods May Dry Out; Warming to Blame?” Photograph. <i>National Geographic</i>, February 15, 2010. https://www.nationalgeographic.com/news/2010/2/100215-redwoods-california-global-warming/.
</p>
</div>
</div>
| 143.565657 | 1,140 | 0.785337 |
812f90166080238420790b247fb80908610fa42f | 3,356 | go | Go | pkg/gwp/udp.go | borud/gwp | c18480ae86e73d5fc34f1eb7be95a0cc44bc7670 | [
"Apache-2.0"
] | null | null | null | pkg/gwp/udp.go | borud/gwp | c18480ae86e73d5fc34f1eb7be95a0cc44bc7670 | [
"Apache-2.0"
] | null | null | null | pkg/gwp/udp.go | borud/gwp | c18480ae86e73d5fc34f1eb7be95a0cc44bc7670 | [
"Apache-2.0"
] | null | null | null | package gwp
import (
"context"
"log"
"net"
"sync"
"time"
"github.com/borud/gwp/pkg/gwpb"
"google.golang.org/protobuf/proto"
)
type udpConnection struct {
addr string
conn *net.UDPConn
requestChannel chan Request
stopped sync.WaitGroup
ctx context.Context
cancel context.CancelFunc
}
const (
// readBufferSize is the size of the readbuffer. Note that this will always be
// larger than the maximum packet size we want
readBufferSize = 1024
// udpReadTimeout is how long to wait during read. The practical value of this timeout
// right now is to provide a means for checking if the listener should be shut down.
udpReadTimeout = 500 * time.Millisecond
)
// NewUDPListener creates a new UDP listener.
func NewUDPListener(addr string, requestChanLen int) (Listener, error) {
localAddr, err := net.ResolveUDPAddr("udp", addr)
if err != nil {
return nil, err
}
conn, err := net.ListenUDP("udp", localAddr)
if err != nil {
return nil, err
}
ctx, cancel := context.WithCancel(context.Background())
listener := &udpConnection{
addr: addr,
conn: conn,
requestChannel: make(chan Request, requestChanLen),
ctx: ctx,
cancel: cancel,
}
listener.stopped.Add(1)
go listener.readLoop()
return listener, nil
}
// NewUDPConnection creates a connection to a remote server.
func NewUDPConnection(addr string, requestChanLen int) (Connection, error) {
remoteAddr, err := net.ResolveUDPAddr("udp", addr)
if err != nil {
return nil, err
}
conn, err := net.DialUDP("udp", nil, remoteAddr)
if err != nil {
return nil, err
}
ctx, cancel := context.WithCancel(context.Background())
connection := &udpConnection{
addr: addr,
conn: conn,
requestChannel: make(chan Request, requestChanLen),
ctx: ctx,
cancel: cancel,
}
connection.stopped.Add(1)
go connection.readLoop()
return connection, nil
}
func (u *udpConnection) Send(packet *gwpb.Packet) error {
buffer, err := proto.Marshal(packet)
if err != nil {
return err
}
_, err = u.conn.Write(buffer)
return err
}
func (u *udpConnection) Requests() <-chan Request {
return u.requestChannel
}
func (u *udpConnection) Close() error {
u.cancel()
u.stopped.Wait()
return nil
}
func (u *udpConnection) readLoop() {
defer u.stopped.Done()
defer close(u.requestChannel)
defer u.conn.Close()
buffer := make([]byte, readBufferSize)
for {
select {
case <-u.ctx.Done():
return
default:
// do nothing
}
u.conn.SetReadDeadline(time.Now().Add(udpReadTimeout))
n, remoteAddr, err := u.conn.ReadFrom(buffer)
if err, ok := err.(net.Error); ok && err.Timeout() {
continue
}
if err != nil {
log.Printf("UDP Listener, ReadFrom error: %v", err)
continue
}
if n > MaxPacketSize {
log.Printf("UDP listener, oversize packet: remoteAddr=%s, size=%d maxPacketSize=%d", remoteAddr, n, MaxPacketSize)
}
packet := gwpb.Packet{}
err = proto.Unmarshal(buffer[:n], &packet)
if err != nil {
log.Printf("UDP listener, error unmarshalling protobuffer: remoteAddr=%s: %v", remoteAddr.String(), err)
continue
}
// no timeouts for now
u.requestChannel <- Request{
Peer: u,
RemoteAddr: remoteAddr,
Packet: &packet,
Timestamp: time.Now(),
}
}
}
| 20.975 | 117 | 0.660608 |
13dada8f72083fc3d69225ef2c44cc7b45c3f1d3 | 1,792 | asm | Assembly | src/geekos/lspawn.asm | potados99/geekos | 086be616a3cd02f23c23dd980d5a86cd5d33afc7 | [
"BSD-4-Clause-UC"
] | 4 | 2021-03-08T05:25:56.000Z | 2021-06-03T05:07:55.000Z | src/geekos/lspawn.asm | EEDK/actableGeekOs | 86ae9741a6bb0261406e6b37a0cfa1e8c1596481 | [
"BSD-4-Clause-UC"
] | null | null | null | src/geekos/lspawn.asm | EEDK/actableGeekOs | 86ae9741a6bb0261406e6b37a0cfa1e8c1596481 | [
"BSD-4-Clause-UC"
] | 9 | 2018-03-07T02:16:05.000Z | 2021-06-01T14:15:11.000Z |
; Low level interrupt/thread handling code for GeekOS.
; Copyright (c) 2004 David H. Hovemeyer <daveho@cs.umd.edu>
; Copyright (c) 2004 Iulian Neamtiu <neamtiu@cs.umd.edu>
; $Revision: 1.1 $
; This is free software. You are permitted to use,
; redistribute, and modify it as specified in the file "COPYING".
; Dirty code to run an executable in kernel mode.
; You shouldn't normally change this file !
; Trampoline gets called with two selectors (code/data)
; and the entry address. We push the CS,DS,IP and do a 'retf'
; to force an inter-selector jump to the new program.
; When the new program is done, the leave/lret in entry.c
; will bring us back here.
;
; ----------------------------------------------------------------------
; low-level spawn stuff
; ----------------------------------------------------------------------
%include "symbol.asm"
%include "defs.asm"
[BITS 32]
; ----------------------------------------------------------------------
; Definitions
; ----------------------------------------------------------------------
;
EXPORT Trampoline
; ----------------------------------------------------------------------
; Code
; ----------------------------------------------------------------------
[SECTION .text]
align 8
Trampoline:
;; first we fetch the code selector off the stack
mov ebx, [esp+4]
;; then we fetch the data selector off the stack
mov eax, [esp+8]
;; and finally the entry address
mov ecx, [esp+0xc]
push ds
push es
mov ds, ax
mov es, ax
;; push KERNEL_CS/EIP so that we return here
;; after running the program
push dword KERNEL_CS
push dword .backhere
;; now make the inter-selector jump
;; we land in different cs/ds descriptors
push ebx
push ecx
retf
.backhere:
pop es
pop ds
ret
| 23.893333 | 72 | 0.52846 |
bfc3bcf8f7472498631151e2c5c8f31d96a39bbe | 793 | asm | Assembly | programs/oeis/189/A189996.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/189/A189996.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/189/A189996.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A189996: Bott periodicity: the homotopy groups of the stable orthogonal group are periodic with period 8 and repeat like [2, 2, 1, 0, 1, 1, 1, 0].
; 2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2,1,0,1,1,1,0,2,2
mov $3,$0
div $0,2
gcd $0,4
mov $1,5
gcd $3,2
add $1,$3
add $1,1
mov $2,$0
add $2,1
add $1,$2
div $1,2
add $1,14
mul $1,2
sub $1,36
div $1,2
| 41.736842 | 501 | 0.54855 |
74bfb8f290eabf8ffdb18533f4cf866a32d989a7 | 189 | sql | SQL | flyway/sql/V1.30__Create_Procedure_User_DemoteById.sql | fedepujol/Clarkson | 79f2dd7da4b1607afe53d1b6d45412c8fce8688b | [
"MIT"
] | 121 | 2018-04-04T21:24:34.000Z | 2022-01-24T19:04:39.000Z | flyway/sql/V1.30__Create_Procedure_User_DemoteById.sql | fedepujol/Clarkson | 79f2dd7da4b1607afe53d1b6d45412c8fce8688b | [
"MIT"
] | 32 | 2018-02-28T17:26:10.000Z | 2021-08-07T15:25:08.000Z | flyway/sql/V1.30__Create_Procedure_User_DemoteById.sql | Max-Z80/Clarkson | 66e06877c09a5125a79b085643c49e2ed65f30be | [
"MIT"
] | 21 | 2018-04-02T13:58:36.000Z | 2021-12-05T11:49:23.000Z | DELIMITER $$
CREATE PROCEDURE `User_DemoteById`
(
in_userId VARCHAR(36)
)
BEGIN
UPDATE
`Users`
SET
`admin` = 0
WHERE
`id` = in_userId;
END$$
| 11.117647 | 34 | 0.534392 |
a22ed0d95e76ae92ab55b0bb42c485283cbb4a98 | 558 | asm | Assembly | libsrc/stdio_new/file/snprintf.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | 8 | 2017-01-18T12:02:17.000Z | 2021-06-12T09:40:28.000Z | libsrc/stdio_new/file/snprintf.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | 1 | 2017-03-06T07:41:56.000Z | 2017-03-06T07:41:56.000Z | libsrc/stdio_new/file/snprintf.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | 3 | 2017-03-07T03:19:40.000Z | 2021-09-15T17:59:19.000Z | ; int snprintf(char *s, unsigned int size, const char *fmt,...)
; 05.2008 aralbrec
PUBLIC snprintf
EXTERN vsnprintf_callee, stdio_varg, stdio_nextarg
EXTERN ASMDISP_VSNPRINTF_CALLEE
.snprintf
call stdio_varg
push de ; stack = char *s
call stdio_nextarg
push de ; stack = int size
exx
pop de
pop hl
exx
call stdio_nextarg ; de = char *fmt
ld c,l
ld b,h ; bc = top of parameter list
jp vsnprintf_callee + ASMDISP_VSNPRINTF_CALLEE
| 19.928571 | 63 | 0.59319 |
963eed5cf5998ebf56ee7a40ab9a14f23a1c556e | 984 | php | PHP | cgi-bin/__moduleUnitTestsList.php | campagna91/trender | 82fe35cfa3c7f3da422577885ed3db903349f572 | [
"MIT"
] | 13 | 2015-09-02T12:32:53.000Z | 2019-01-10T16:08:24.000Z | cgi-bin/__moduleUnitTestsList.php | campagna91/trender | 82fe35cfa3c7f3da422577885ed3db903349f572 | [
"MIT"
] | 1 | 2019-03-10T12:25:23.000Z | 2019-03-10T12:25:23.000Z | cgi-bin/__moduleUnitTestsList.php | campagna91/trender | 82fe35cfa3c7f3da422577885ed3db903349f572 | [
"MIT"
] | 7 | 2016-03-07T09:51:19.000Z | 2018-01-25T10:35:55.000Z | <? require_once '__system.php'; ?>
<div class="col s10 offset-s1" id="mainList">
<table class="striped">
<thead>
<tr>
<th>Test</th>
<th>Description</th>
<th>Methods</th>
</tr>
</thead>
<tbody>
<?
$k = "select test, description from UnitTests order by test";
$q = mysqli_query(connect(), $k) or die("ERRORE: " . $k);
while($v = $q->fetch_array()) {
$qMethods = mysqli_query(connect(), "select returnType, package, class, signature from UnitTestClassesMethods where test = '$v[0]'"); ?>
<tr class="<? echo $v[0] ?>">
<td><? echo $v[0] ?></td>
<td><? echo $v[1] ?></td>
<td>
<ul class="collection">
<?
while($vMethods = $qMethods->fetch_array()) { ?>
<li class="collection-item"><? echo $vMethods[0] . " " . $vMethods[1] . ":" . $vMethods[2] . "." . $vMethods[3] ?></li>
<? }
?>
</ul>
</td>
</tr>
<? }
?>
</tbody>
</table>
</div>
| 26.594595 | 141 | 0.496951 |
0acb9f3c9ffc6ded61c8300b90ca8f822de8e2ea | 1,997 | go | Go | cmd/src/orgs_list.go | mohdjuwaiser/src-cli | 8b7f74bd6e7b98b77ca5ccdbfbab8e2a43f55518 | [
"Apache-2.0"
] | null | null | null | cmd/src/orgs_list.go | mohdjuwaiser/src-cli | 8b7f74bd6e7b98b77ca5ccdbfbab8e2a43f55518 | [
"Apache-2.0"
] | 1 | 2020-10-12T12:44:47.000Z | 2021-08-03T15:53:06.000Z | cmd/src/orgs_list.go | Jankyboy/src-cli | f6f9c7582cef3f9b9dcbd720276d649614d7bb89 | [
"Apache-2.0"
] | 1 | 2020-02-09T13:25:31.000Z | 2020-02-09T13:25:31.000Z | package main
import (
"context"
"flag"
"fmt"
"github.com/sourcegraph/src-cli/internal/api"
)
func init() {
usage := `
Examples:
List organizations:
$ src orgs list
List *all* organizations (may be slow!):
$ src orgs list -first='-1'
List organizations whose names match the query:
$ src orgs list -query='myquery'
`
flagSet := flag.NewFlagSet("list", flag.ExitOnError)
usageFunc := func() {
fmt.Fprintf(flag.CommandLine.Output(), "Usage of 'src orgs %s':\n", flagSet.Name())
flagSet.PrintDefaults()
fmt.Println(usage)
}
var (
firstFlag = flagSet.Int("first", 1000, "Returns the first n organizations from the list. (use -1 for unlimited)")
queryFlag = flagSet.String("query", "", `Returns organizations whose names match the query. (e.g. "alice")`)
formatFlag = flagSet.String("f", "{{.Name}}", `Format for the output, using the syntax of Go package text/template. (e.g. "{{.ID}}: {{.Name}} ({{.DisplayName}})" or "{{.|json}}")`)
apiFlags = api.NewFlags(flagSet)
)
handler := func(args []string) error {
flagSet.Parse(args)
client := cfg.apiClient(apiFlags, flagSet.Output())
tmpl, err := parseTemplate(*formatFlag)
if err != nil {
return err
}
query := `query Organizations(
$first: Int,
$query: String,
) {
organizations(
first: $first,
query: $query,
) {
nodes {
...OrgFields
}
}
}` + orgFragment
var result struct {
Organizations struct {
Nodes []Org
}
}
if ok, err := client.NewRequest(query, map[string]interface{}{
"first": api.NullInt(*firstFlag),
"query": api.NullString(*queryFlag),
}).Do(context.Background(), &result); err != nil || !ok {
return err
}
for _, org := range result.Organizations.Nodes {
if err := execTemplate(tmpl, org); err != nil {
return err
}
}
return nil
}
// Register the command.
orgsCommands = append(orgsCommands, &command{
flagSet: flagSet,
handler: handler,
usageFunc: usageFunc,
})
}
| 21.473118 | 182 | 0.632949 |
0fd6e050b9775af424f8d80cb4dfe9596fd84163 | 17,197 | go | Go | x/campaign/simulation/simulation.go | barriebyron/spn | 92566247ddf2cc415bcff14fa8603449b125071f | [
"Apache-2.0"
] | null | null | null | x/campaign/simulation/simulation.go | barriebyron/spn | 92566247ddf2cc415bcff14fa8603449b125071f | [
"Apache-2.0"
] | null | null | null | x/campaign/simulation/simulation.go | barriebyron/spn | 92566247ddf2cc415bcff14fa8603449b125071f | [
"Apache-2.0"
] | null | null | null | package simulation
import (
"math/rand"
"time"
"github.com/cosmos/cosmos-sdk/baseapp"
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
sdk "github.com/cosmos/cosmos-sdk/types"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/simulation"
"github.com/tendermint/spn/testutil/sample"
"github.com/tendermint/spn/x/campaign/keeper"
"github.com/tendermint/spn/x/campaign/types"
)
// TypedMsg extends sdk.Msg with Type method
type TypedMsg interface {
sdk.Msg
Type() string
}
var (
// ShareDenoms are the denom used for the shares in the simulation
ShareDenoms = []string{"s/foo", "s/bar", "s/toto"}
)
// deliverSimTx delivers the tx for simulation from the provided message
func deliverSimTx(
r *rand.Rand,
app *baseapp.BaseApp,
ctx sdk.Context,
ak types.AccountKeeper,
bk types.BankKeeper,
simAccount simtypes.Account,
msg TypedMsg,
coinsSpent sdk.Coins,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
txCtx := simulation.OperationInput{
R: r,
App: app,
TxGen: simappparams.MakeTestEncodingConfig().TxConfig,
Cdc: nil,
Msg: msg,
MsgType: msg.Type(),
Context: ctx,
SimAccount: simAccount,
AccountKeeper: ak,
Bankkeeper: bk,
ModuleName: types.ModuleName,
CoinsSpentInMsg: coinsSpent,
}
return simulation.GenAndDeliverTxWithRandFees(txCtx)
}
// GetCoordSimAccount finds an account associated with a coordinator profile from simulation accounts
func GetCoordSimAccount(
r *rand.Rand,
ctx sdk.Context,
pk types.ProfileKeeper,
accs []simtypes.Account,
) (simtypes.Account, uint64, bool) {
// Choose a random coordinator
coords := pk.GetAllCoordinator(ctx)
coordNb := len(coords)
if coordNb == 0 {
return simtypes.Account{}, 0, false
}
coord := coords[r.Intn(coordNb)]
// Find the account linked to this address
for _, acc := range accs {
if acc.Address.String() == coord.Address {
return acc, coord.CoordinatorID, true
}
}
return simtypes.Account{}, 0, false
}
// GetCoordSimAccountWithCampaignID finds an account associated with a coordinator profile from simulation accounts and a campaign created by this coordinator
func GetCoordSimAccountWithCampaignID(
r *rand.Rand,
ctx sdk.Context,
pk types.ProfileKeeper,
k keeper.Keeper,
accs []simtypes.Account,
requireDynamicShares,
requireNoMainnetInitialized bool,
) (simtypes.Account, uint64, bool) {
campaigns := k.GetAllCampaign(ctx)
campNb := len(campaigns)
if campNb == 0 {
return simtypes.Account{}, 0, false
}
var camp types.Campaign
if requireDynamicShares || requireNoMainnetInitialized {
// If a criteria is required for the campaign, we simply fetch the first on that satisfies the criteria
var campFound bool
for _, campaign := range campaigns {
if (!requireDynamicShares || campaign.DynamicShares) &&
(!requireNoMainnetInitialized || !campaign.MainnetInitialized) {
camp = campaign
campFound = true
break
}
}
if !campFound {
return simtypes.Account{}, 0, false
}
} else {
// No criteria, choose a random campaign
camp = campaigns[r.Intn(campNb)]
}
// Find the sim account of the campaign coordinator
coordAddr, found := pk.GetCoordinatorAddressFromID(ctx, camp.CoordinatorID)
if !found {
return simtypes.Account{}, 0, false
}
for _, acc := range accs {
if acc.Address.String() == coordAddr {
return acc, camp.CampaignID, true
}
}
return simtypes.Account{}, 0, false
}
// GetSharesFromCampaign returns a small portion of shares that can be minted as vouchers or added to an accounts
func GetSharesFromCampaign(r *rand.Rand, ctx sdk.Context, k keeper.Keeper, campID uint64) (types.Shares, bool) {
camp, found := k.GetCampaign(ctx, campID)
if !found {
return types.EmptyShares(), false
}
var shares sdk.Coins
for _, share := range ShareDenoms {
total := camp.TotalShares.AmountOf(share)
if total == 0 {
total = types.DefaultTotalShareNumber
}
remaining := total - camp.AllocatedShares.AmountOf(share)
if remaining == 0 {
continue
}
shareNb := r.Int63n(5000) + 10
if shareNb > remaining {
shareNb = remaining
}
shares = append(shares, sdk.NewCoin(share, sdk.NewInt(shareNb)))
}
// No shares can be distributed
if shares.Empty() {
return types.EmptyShares(), false
}
shares = shares.Sort()
return types.Shares(shares), true
}
// GetAccountWithVouchers returns an account that has vouchers for a campaign
func GetAccountWithVouchers(
ctx sdk.Context,
bk types.BankKeeper,
accs []simtypes.Account,
) (campID uint64, account simtypes.Account, coins sdk.Coins, found bool) {
var err error
var accountAddr sdk.AccAddress
// Parse all account balances and find one with vouchers
bk.IterateAllBalances(ctx, func(addr sdk.AccAddress, coin sdk.Coin) bool {
campID, err = types.VoucherCampaign(coin.Denom)
if err != nil {
return false
}
// Look for accounts with at least 10 vouchers
if coin.Amount.Int64() < 10 {
return false
}
found = true
accountAddr = addr
return true
})
// No account has vouchers
if !found {
return 0, account, coins, false
}
// Fetch all the vouchers of the campaign owned by the account
bk.IterateAccountBalances(ctx, accountAddr, func(coin sdk.Coin) bool {
coinCampID, err := types.VoucherCampaign(coin.Denom)
if err == nil && coinCampID == campID {
// Get a portion of the balance
// If the balance is 1, we don't include it in the vouchers
// There is a issue: insufficient fees that can occur when the whole balance for a voucher is sent
// TODO: Investigate this issue
if coin.Amount.Int64() > 1 {
coin.Amount = coin.Amount.Quo(sdk.NewInt(2))
coins = append(coins, coin)
}
}
return false
})
if coins.Empty() {
return 0, account, coins, false
}
coins = coins.Sort()
// Find the sim account
for _, acc := range accs {
if found = acc.Address.Equals(accountAddr); found {
return campID, acc, coins, true
}
}
return 0, account, coins, false
}
// GetAccountWithShares returns an account that contains allocated shares with its associated campaign
func GetAccountWithShares(
r *rand.Rand,
ctx sdk.Context,
k keeper.Keeper,
accs []simtypes.Account,
) (uint64, simtypes.Account, types.Shares, bool) {
mainnetAccounts := k.GetAllMainnetAccount(ctx)
nb := len(mainnetAccounts)
// No account have been created yet
if nb == 0 {
return 0, simtypes.Account{}, nil, false
}
mainnetAccount := mainnetAccounts[r.Intn(nb)]
// Find the associated sim acocunt
for _, acc := range accs {
if acc.Address.String() == mainnetAccount.Address {
return mainnetAccount.CampaignID, acc, mainnetAccount.Shares, true
}
}
return 0, simtypes.Account{}, nil, false
}
// SimulateMsgCreateCampaign simulates a MsgCreateCampaign message
func SimulateMsgCreateCampaign(ak types.AccountKeeper, bk types.BankKeeper, pk types.ProfileKeeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
simAccount, _, found := GetCoordSimAccount(r, ctx, pk, accs)
if !found {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgCreateCampaign, "skip campaign creation"), nil, nil
}
msg := types.NewMsgCreateCampaign(
simAccount.Address.String(),
sample.CampaignName(),
sample.Coins(),
)
return deliverSimTx(r, app, ctx, ak, bk, simAccount, msg, sdk.NewCoins())
}
}
// SimulateMsgUpdateTotalSupply simulates a MsgUpdateTotalSupply message
func SimulateMsgUpdateTotalSupply(ak types.AccountKeeper, bk types.BankKeeper, pk types.ProfileKeeper, k keeper.Keeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
simAccount, campID, found := GetCoordSimAccountWithCampaignID(r, ctx, pk, k, accs, false, true)
if !found {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgUpdateTotalSupply, "skip update total supply"), nil, nil
}
msg := types.NewMsgUpdateTotalSupply(
simAccount.Address.String(),
campID,
sample.Coins(),
)
return deliverSimTx(r, app, ctx, ak, bk, simAccount, msg, sdk.NewCoins())
}
}
// SimulateMsgUpdateTotalShares simulates a MsgUpdateTotalShares message
func SimulateMsgUpdateTotalShares(ak types.AccountKeeper, bk types.BankKeeper, pk types.ProfileKeeper, k keeper.Keeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
simAccount, campID, found := GetCoordSimAccountWithCampaignID(r, ctx, pk, k, accs, true, true)
if !found {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgUpdateTotalShares, "skip update total shares"), nil, nil
}
camp, _ := k.GetCampaign(ctx, campID)
// Defined the value to update
var newTotalShares sdk.Coins
for _, share := range ShareDenoms {
currentTotal := camp.TotalShares.AmountOf(share)
if currentTotal == 0 {
currentTotal = types.DefaultTotalShareNumber
}
allocatedShare := camp.AllocatedShares.AmountOf(share)
newTotal := r.Int63n(currentTotal+types.DefaultTotalShareNumber) + allocatedShare
newTotalShares = append(newTotalShares, sdk.NewCoin(share, sdk.NewInt(newTotal)))
}
newTotalShares = newTotalShares.Sort()
msg := types.NewMsgUpdateTotalShares(
simAccount.Address.String(),
campID,
types.Shares(newTotalShares),
)
return deliverSimTx(r, app, ctx, ak, bk, simAccount, msg, sdk.NewCoins())
}
}
// SimulateMsgInitializeMainnet simulates a MsgInitializeMainnet message
func SimulateMsgInitializeMainnet(ak types.AccountKeeper, bk types.BankKeeper, pk types.ProfileKeeper, k keeper.Keeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
simAccount, campID, found := GetCoordSimAccountWithCampaignID(r, ctx, pk, k, accs, false, true)
if !found {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgInitializeMainnet, "skip initliaze mainnet"), nil, nil
}
msg := types.NewMsgInitializeMainnet(
simAccount.Address.String(),
campID,
sample.String(50),
sample.String(32),
sample.GenesisChainID(),
)
return deliverSimTx(r, app, ctx, ak, bk, simAccount, msg, sdk.NewCoins())
}
}
// SimulateMsgAddShares simulates a MsgAddShares message
func SimulateMsgAddShares(ak types.AccountKeeper, bk types.BankKeeper, pk types.ProfileKeeper, k keeper.Keeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
simAccount, campID, found := GetCoordSimAccountWithCampaignID(r, ctx, pk, k, accs, false, false)
if !found {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAddShares, "skip add shares"), nil, nil
}
shares, getShares := GetSharesFromCampaign(r, ctx, k, campID)
if !getShares {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAddShares, "skip add shares"), nil, nil
}
// Select a random account to give shares
accountNb := r.Intn(len(accs))
msg := types.NewMsgAddShares(
campID,
simAccount.Address.String(),
accs[accountNb].Address.String(),
shares,
)
return deliverSimTx(r, app, ctx, ak, bk, simAccount, msg, sdk.NewCoins())
}
}
// SimulateMsgAddVestingOptions simulates a MsgAddVestingOptions message
func SimulateMsgAddVestingOptions(ak types.AccountKeeper, bk types.BankKeeper, pk types.ProfileKeeper, k keeper.Keeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
simAccount, campID, found := GetCoordSimAccountWithCampaignID(r, ctx, pk, k, accs, false, false)
if !found {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAddVestingOptions, "skip add vesting options"), nil, nil
}
shares, getShares := GetSharesFromCampaign(r, ctx, k, campID)
if !getShares {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAddVestingOptions, "skip add vesting options"), nil, nil
}
// Select a random account to give vesting options
accountNb := r.Intn(len(accs))
msg := types.NewMsgAddVestingOptions(
campID,
simAccount.Address.String(),
accs[accountNb].Address.String(),
*types.NewShareDelayedVesting(shares, shares, time.Now().Unix()),
)
return deliverSimTx(r, app, ctx, ak, bk, simAccount, msg, sdk.NewCoins())
}
}
// SimulateMsgMintVouchers simulates a MsgMintVouchers message
func SimulateMsgMintVouchers(ak types.AccountKeeper, bk types.BankKeeper, pk types.ProfileKeeper, k keeper.Keeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
simAccount, campID, found := GetCoordSimAccountWithCampaignID(r, ctx, pk, k, accs, false, false)
if !found {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgMintVouchers, "skip mint vouchers"), nil, nil
}
shares, getShares := GetSharesFromCampaign(r, ctx, k, campID)
if !getShares {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgMintVouchers, "skip mint vouchers"), nil, nil
}
msg := types.NewMsgMintVouchers(
simAccount.Address.String(),
campID,
shares,
)
return deliverSimTx(r, app, ctx, ak, bk, simAccount, msg, sdk.NewCoins())
}
}
// SimulateMsgBurnVouchers simulates a MsgBurnVouchers message
func SimulateMsgBurnVouchers(ak types.AccountKeeper, bk types.BankKeeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
campID, simAccount, vouchers, found := GetAccountWithVouchers(ctx, bk, accs)
if !found {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgBurnVouchers, "skip burn vouchers"), nil, nil
}
msg := types.NewMsgBurnVouchers(
simAccount.Address.String(),
campID,
vouchers,
)
return deliverSimTx(r, app, ctx, ak, bk, simAccount, msg, vouchers)
}
}
// SimulateMsgRedeemVouchers simulates a MsgRedeemVouchers message
func SimulateMsgRedeemVouchers(ak types.AccountKeeper, bk types.BankKeeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
campID, simAccount, vouchers, found := GetAccountWithVouchers(ctx, bk, accs)
if !found {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgRedeemVouchers, "skip redeem vouchers"), nil, nil
}
// Select a random account to redeem vouchers into
accountNb := r.Intn(len(accs))
msg := types.NewMsgRedeemVouchers(
simAccount.Address.String(),
accs[accountNb].Address.String(),
campID,
vouchers,
)
return deliverSimTx(r, app, ctx, ak, bk, simAccount, msg, vouchers)
}
}
// SimulateMsgUnredeemVouchers simulates a MsgUnredeemVouchers message
func SimulateMsgUnredeemVouchers(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
// Find a random account from a random campaign that contains shares
campID, simAccount, shares, found := GetAccountWithShares(r, ctx, k, accs)
if !found {
return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgUnredeemVouchers, "skip unredeem vouchers"), nil, nil
}
msg := types.NewMsgUnredeemVouchers(
simAccount.Address.String(),
campID,
shares,
)
return deliverSimTx(r, app, ctx, ak, bk, simAccount, msg, sdk.NewCoins())
}
}
// SimulateMsgSendVouchers simulates a Msg message from the bank module with vouchers
// TODO: This message constantly fails in simulation log, investigate why
func SimulateMsgSendVouchers(ak types.AccountKeeper, bk types.BankKeeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
_, simAccount, vouchers, found := GetAccountWithVouchers(ctx, bk, accs)
if !found {
return simtypes.NoOpMsg(types.ModuleName, banktypes.TypeMsgSend, "skip send vouchers"), nil, nil
}
// Select a random receiver account
accountNb := r.Intn(len(accs))
if accs[accountNb].Address.Equals(simAccount.Address) {
if accountNb == 0 {
accountNb++
} else {
accountNb--
}
}
msg := banktypes.NewMsgSend(
simAccount.Address,
accs[accountNb].Address,
vouchers,
)
return deliverSimTx(r, app, ctx, ak, bk, simAccount, msg, vouchers)
}
}
| 33.327519 | 158 | 0.731814 |
4a62b12a22af0d8235ccbd0399bb834ee521ec4d | 10,011 | html | HTML | lib/peach/doc/ref/html/peach.optm-module.html | serddmitry/goog_challenge | 3d81460e815d8adfea1e43c59906adbd402ee3c2 | [
"Apache-1.1"
] | 1 | 2016-08-09T21:34:05.000Z | 2016-08-09T21:34:05.000Z | lib/peach/doc/ref/html/peach.optm-module.html | serddmitry/goog_challenge | 3d81460e815d8adfea1e43c59906adbd402ee3c2 | [
"Apache-1.1"
] | null | null | null | lib/peach/doc/ref/html/peach.optm-module.html | serddmitry/goog_challenge | 3d81460e815d8adfea1e43c59906adbd402ee3c2 | [
"Apache-1.1"
] | null | null | null | <?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>peach.optm</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="peach-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
><a href="http://code.google.com/p/peach">Peach - Computational Intelligence for Python</a></th>
</tr></table></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
<a href="peach-module.html">Package peach</a> ::
Package optm
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
onclick="toggle_private();">hide private</a>]</span></td></tr>
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>] | <a href="peach.optm-module.html"
target="_top">no frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<!-- ==================== PACKAGE DESCRIPTION ==================== -->
<h1 class="epydoc">Package optm</h1><span class="codelink"><a href="peach.optm-pysrc.html">source code</a></span><br /><br />
<p>This package implements deterministic optimization methods. Consult:</p>
<blockquote>
<dl class="rst-docutils">
<dt>optm</dt>
<dd>Basic definitions and interface with the optimization methods;</dd>
<dt>linear</dt>
<dd>Basic methods for one variable optimization;</dd>
<dt>multivar</dt>
<dd>Gradient, Newton and othe multivariable optimization methods;</dd>
<dt>quasinewton</dt>
<dd>Quasi-Newton methods;</dd>
<dt>stochastic</dt>
<dd>General stochastic methods;</dd>
<dt>sa</dt>
<dd>Simulated Annealing methods;</dd>
<dt>pso</dt>
<dd>Particle Swarm Optimization</dd>
</dl>
</blockquote>
<p>Every optimizer works in pretty much the same way. Instantiate the respective
class, using as parameter the cost function to be optimized and some other
parameters. Use <tt class="rst-docutils literal"><span class="pre">step()</span></tt> to perform one iteration of the method, use the
<tt class="rst-docutils literal"><span class="pre">__call__()</span></tt> method to perform the search until the stop conditions are met.
See each method for details.</p><br /><br />
<!-- ==================== SUBMODULES ==================== -->
<a name="section-Submodules"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Submodules</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Submodules"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr><td class="summary">
<ul class="nomargin">
<li> <strong class="uidlink"><a href="peach.optm.linear-module.html">peach.optm.linear</a></strong>: <em class="summary">This package implements basic one variable only optimizers.</em> </li>
<li> <strong class="uidlink"><a href="peach.optm.multivar-module.html">peach.optm.multivar</a></strong>: <em class="summary">This package implements basic multivariable optimizers, including gradient and
Newton searches.</em> </li>
<li> <strong class="uidlink"><a href="peach.optm.optm-module.html">peach.optm.optm</a></strong>: <em class="summary">Basic definitons and base class for optimizers</em> </li>
<li> <strong class="uidlink"><a href="peach.optm.pso-module.html">peach.optm.pso</a></strong>: <em class="summary">Basic Particle Swarm Optimization (PSO)</em> </li>
<li> <strong class="uidlink"><a href="peach.optm.quasinewton-module.html">peach.optm.quasinewton</a></strong>: <em class="summary">This package implements basic quasi-Newton optimizers.</em> </li>
<li> <strong class="uidlink"><a href="peach.optm.sa-module.html">peach.optm.sa</a></strong>: <em class="summary">This package implements two versions of simulated annealing optimization.</em> </li>
<li> <strong class="uidlink"><a href="peach.optm.stochastic-module.html">peach.optm.stochastic</a></strong>: <em class="summary">General methods of stochastic optimization.</em> </li>
</ul></td></tr>
</table>
<br />
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Variables</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Variables"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="peach.optm-module.html#__doc__" class="summary-name">__doc__</a> = <code title=""""
This package implements deterministic optimization methods. Consult:
optm
Basic definitions and interface with the optimization methods;
linear
Basic methods for one variable optimization;
multivar
..."><code class="variable-ellipsis">...</code></code>
</td>
</tr>
</table>
<!-- ==================== VARIABLES DETAILS ==================== -->
<a name="section-VariablesDetails"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Variables Details</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-VariablesDetails"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="__doc__"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<h3 class="epydoc">__doc__</h3>
<dl class="fields">
</dl>
<dl class="fields">
<dt>Value:</dt>
<dd><table><tr><td><pre class="variable">
"""
This package implements deterministic optimization methods. Consult:
optm
Basic definitions and interface with the optimization methods;
linear
Basic methods for one variable optimization;
multivar
<code class="variable-ellipsis">...</code>
</pre></td></tr></table>
</dd>
</dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="peach-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
><a href="http://code.google.com/p/peach">Peach - Computational Intelligence for Python</a></th>
</tr></table></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0beta1 on Wed Mar 10 02:16:26 2010
</td>
<td align="right" class="footer">
<a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie()
// -->
</script>
</body>
</html>
| 40.204819 | 207 | 0.613825 |
6b3abdcab038355f4c7b3e902a9af7d03554f9f0 | 15,412 | html | HTML | b/Flea-Control-Treatment-Farmington-MI.html | vickyjonesh/vickyjonesh.github.io | 35748f43d2fc7f0a9477d0787807378ed1479fc5 | [
"MIT"
] | null | null | null | b/Flea-Control-Treatment-Farmington-MI.html | vickyjonesh/vickyjonesh.github.io | 35748f43d2fc7f0a9477d0787807378ed1479fc5 | [
"MIT"
] | null | null | null | b/Flea-Control-Treatment-Farmington-MI.html | vickyjonesh/vickyjonesh.github.io | 35748f43d2fc7f0a9477d0787807378ed1479fc5 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flea Control & Treatment Farmington MI</title>
<meta name="description" content="Safe Pest Control in Farmington MI - Not only does web removal eliminate the unsightly web itself, many spiders are removed in the process.">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
</head>
<main>
<header id="navbar">
<div class="container">
<div class="flexbox flexRow alignItemCenter">
<div class="logobar">
<a href="index.html">Pest Control Service</a>
</div>
<div class="flexbox alignItemCenter alignItemEnd rightPhone">
<a href="tel:833-866-6990"> <i class="fa fa-phone"></i>(833) 866-6990</a>
<span>24 Hour Emergency and Same Day Service!</span>
</div>
</div>
</div>
</header>
<section class="main-hero">
<div class="container">
<div class="hero">
<div class="left-img">
<img src="images/1.jpg" alt="">
</div>
<div class="right-text">
<div class="inner-right-text">
<p><strong>Pest Problems?</strong></p>
<span>We Have Your Pest Solution - Guaranteed</span>
<a href="tel:833-866-6990"> <i class="fa fa-phone"></i>Request Quote</a>
</div>
</div>
</div>
</div>
</section>
<section>
<div class="container">
<div id="tab1" class="opTabContent">
<div class="tab-wrapper">
<div class="accordion-wrapper">
<div class="panel">
<a href="./index.html">Home</a><br><center><h1>Flea Control & Treatment in Farmington MI</h1></center>
<p style="text-align: center;"><span style="color: #ff0000; font-size: 22px;">Don`t let pests bug you any longer. Give us a call to schedule your pest control treatment!</span></p>
<h2 style="text-align: center;"><span style="color: ##ffffff;">We Treat For The Following Pest Problems in Farmington:</span></h2>
<p><img src="https://pestimages.s3-us-west-1.amazonaws.com/pest-exterminators.jpg" alt="Local Pest Control Services Farmington"><p>
<h2 style="text-align: center;"><span style="color: ##ffffff;">Why Choose Us?</span></h2>
<ul>
<li style="text-align: left; font-size: 18px;"><span style="color: #000000;">Full range of pest control and termite treatment services.</li>
<p>
<li style="text-align: left; font-size: 18px;"><span style="color: #000000;">Flexible scheduling, as well as the same and next-day pest control service.</li>
<p>
<li style="text-align: left; font-size: 18px"><span style="color: #000000;">Using the latest in pest control and inspection technology.</li>
<p>
<li style="text-align: left; font-size: 18px"><span style="color: #000000;">Highly trained and experienced representatives.</li>
<p>
<li style="text-align: left; font-size: 18px"><span style="color: #000000;">Providing 24/7 support as well as emergency services.</li>
<p>
<li style="text-align: left; font-size: 18px"><span style="color: #000000;">Green, environmentally-friendly treatments that are child and pet-friendly.</li>
</ul>
<p style="text-align: center; font-size: 26px;"><strong><span style="color: #3366ff;">Don’t delay. Call right now before pests become a problem!</span></strong></p>
<center><div class="inner-right-text">
<a href="tel:833-866-6990"> <i class="fa fa-phone"></i>(833) 866-6990</a>
</div></center>
<h2>How To Select the Local Pest Control Company in Farmington</h2>
<p><img src="https://pestimages.s3-us-west-1.amazonaws.com/pest-treatment.jpg" alt=""><p>
<p>Arrow Termite & Pest Control offers totally free termite examinations for new clients and termite control services for your home. A technique that includes making use of pest-resistant and pest-tolerant cultivars developed through conventional breeding or genetic engineering (Douglas 2018, Kennedy 2008, Nelson et al. 2018 ). These cultivars have physical, morphological, or biochemical characters that lower the plant's beauty or suitability for the pest to feed, establish, or recreate successfully.</p>
<p>We provide these General disinfestations services to both residential (home hold) and industrial setups like production and ware- homes, locations like FMCG, pharma, electronics, food processing, Corporate homes, Rice mills, sophisticated server spaces and work stations and so on In time, population trends will supply and emerge instructions for your pest management program.</p>
<h3>Pest Fumigation Farmington Michigan</h2>
<p>Bed bugs: While bed bugs do not cause serious illness like mosquitoes, termites, and cockroaches, they can cause extreme allergic reactions. You can send an online query An alternative is to employ a certified pest control operator trained in the identification and management of pests. You can purchase either heavyweight or light-weight types-- you'll want to use the lighter one for managing pests in summer, since it will stay out bugs without preparing your plants.</p>
<p>We have actually been with you since the past 5 years and the recent Termite Control Service contract has helpded remove termites from our house. Utilizing the current innovation, tools and treatments, our extremely trained, licensed and state-certified pest specialists live in the neighborhoods they service and recognize with the pests that plague these lovely west coast locations.</p>
<p>Interstate Pest Management provides a range of highly-effective pest control solutions to our neighbors throughout the Pacific Northwest. At a much deeper level though, this company offers an innovative bed bug removal service that is environmentally-friendly. One or several measures may be coordinated into a management program for a target pest, or for the entire pest complex of insects, termites, weeds and illness impacting a specific crop.</p>
<p style="text-align: center; font-size: 26px;"><strong><span style="color: #3366ff;">We are just one call away!</span></strong></p>
<center><div class="inner-right-text">
<a href="tel:833-866-6990"> <i class="fa fa-phone"></i>(833) 866-6990</a>
</div></center>
<h3>Organic Garden Pest Control Farmington MI</h3>
<p>Safe, eco-friendly rodent control services for commercial facilities and typical locations of homes. If pests return between treatments, your Orkin Tech will return for a touch up at no additional charge. A mix of insect killer and pest control techniques might be necessary to efficiently do the job and stop insects, rodents and animals from becoming a serious annoyance.</p>
<p>You can utilize a verb in your pest control business name to create business names like 'Crush Pest Control' or 'Battle Pest Control Company'. The term Integrated Preventive Pest Management (IPPM) much better reflects this understanding. Prior to implementing any pest management method, select and tag (or flag) the leaves or stems of 1-5 infested plants per 1,000 ft2.</p>
<p><strong>Some of the most popular Farmington pest control exterminating services:</strong><p>
<ul>
<li style="text-align: left;"><span style="color: #000000;">Emergency Pest Control in Farmington, MI</span></li>
<li style="text-align: left;"><span style="color: #000000;">Cockroach Exterminator in Farmington, MI</span></li>
<li style="text-align: left;"><span style="color: #000000;">Rodent controlin Farmington, MI</span></li>
<li style="text-align: left;"><span style="color: #000000;">Termite Control & Treatment in Farmington, MI</span></li>
<li style="text-align: left;"><span style="color: #000000;">Wasp and Bee Removal in Farmington, MI</span></li>
<li style="text-align: left;"><span style="color: #000000;">Bed Bug Treatment in Farmington, MI</span></li>
<li style="text-align: left;"><span style="color: #000000;">Spider Control in Farmington, MI</span></li>
<li style="text-align: left;"><span style="color: #000000;">Mosquito control in Farmington, MI</span></li>
<li style="text-align: left;"><span style="color: #000000;">Residential and Commercial Exterminators in Farmington, MI</span></li>
<li style="text-align: left;"><span style="color: #000000;">Tick and Flea Control in Farmington, MI</span></li>
<li style="text-align: left;"><span style="color: #000000;">Ant Control in Farmington, MI</span></li>
<li style="text-align: left;"><span style="color: #000000;">And Much More!</span></li>
</ul>
<h3>Commercial Bug Exterminator Farmington MI 48336</h3>
<p>We offer our customers with requirements sheets, routine reports, hygienic suggestions and services in integrated pest control. Action Pest Control takes a proactive pest management approach that keeps companies pest totally free. The EPA controls this type of general-use pesticide within the United States permitting it to only be offered and installed by certified pest management professionals as part of an integrated pest management program.</p>
<p>This offers one of the most expense reliable, socially appropriate and ecologically sound method of managing illness, insects, weeds and other pests in farming. Pest Investigator is an enjoyable business name that communicates their competence in finding and getting rid of pests. Knowing the crop cycle and crop management is essential for finest combination of the IPM program and the crop.</p>
<p>Presently, IPM is a robust paradigm of pest control around the globe. We ensure the defense of your house and your enjoyed ones, so when you book with Economy Exterminators, you are booking with the assurance that our pest control exterminators are putting your security initially. Evaluation previous pest problems and current pesticide application techniques and take down crops growing in adjacent greenhouses or outdoors.</p>
<p>The upside-down pyramid to the left reflects the unsteady conditions under heavy reliance on pesticides, and the upright pyramid to the right reflects sustainable qualities of a total system method. These specialists use an integrated technique to pest management. However, I highly suggest assessing the intent of exterminators" being included as a necessary service" as you determine what is right for you and your company. </p>
<p>These specialists provide services to organisations, homes, and any other structures where undesirable pests might be located. . So, the pest control companies choose which technique works finest in your case and after that they accordingly carry out the treatment. With certified and trained pest control service technicians that specialize in business environments, business owners and managers can rely on Action to get rid of and avoid flies, roaches, rodents and other pests that target facilities.</p>
<p>
<iframe width="100%" height="250" src="https://maps.google.com/maps?width=100%&height=600&hl=en&q=Farmington.MI+()&ie=UTF8&t=&z=14&iwloc=B&output=embed" frameborder="0" scrolling="no" marginheight="0" marginwidth="0">
</iframe>
</p>
<p>
</p>
<br>
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="name">Local Pest Control Service Farmington Michigan</span>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
Rated <span itemprop="ratingValue">4.9</span>/5 based on <span itemprop="reviewCount">617</span> reviews.</div></div>
<br><a href="./Ant-Control-Extermination-Plant-City-FL.html">Previous</a> <a href="./Mosquito-Exterminator-Long-Island-City-NY.html">Next</a>
<br>Related Posts Farmington Michigan<br><a href="./Tick-Control-Normal-IL.html">Tick Control Normal IL</a><br><a href="./Roach-Extermination-Services-Austin-TX.html">Roach Extermination Services Austin TX</a><br><a href="./Roach-Removal-Crawfordville-FL.html">Roach Removal Crawfordville FL</a><br><a href="./Termite-Pest-Control-Newton-NJ.html">Termite Pest Control Newton NJ</a><br><a href="./Cockroach-Exterminator-Kaysville-UT.html">Cockroach Exterminator Kaysville UT</a><br>
</div>
</div>
</div>
</div>
</div>
</section>
<footer>
<div class="main-help">
<div class="container">
<div class="need-help">
<p>WE’RE FAST, AFFORDABLE & STANDING BY READY TO HELP 24/7. CALL NOW. <span><i class="fa fa-phone"></i><a href="tel:833-866-6990">(833) 866-6990</span></a>
</p>
</div>
</div>
</div>
<div class="footer-content">
<div class="container">
<ul>
<li><a href="./index.html">Home</a></li>
<li><a href="./disclaimer.html">Disclaimer</a></li>
<li><a href="./privacy.html">Privacy Policy</a></li>
<li><a href="./terms.html">Terms of Service</a></li>
</ul>
<p>© 2020 Pest Control Services - All Rights Reserved</p>
<p>This site is a free service to assist homeowners in connecting with local service contractors. All contractors are independent and this site does not warrant or guarantee any work performed. It is the responsibility of the homeowner to verify that the hired contractor furnishes the necessary license and insurance required for the work being performed. All persons depicted in a photo or video are actors or models and not contractors listed on this site.</p>
</div>
</div>
</footer>
</main>
<!-- -->
<script type="text/javascript">
var sc_project=12339405;
var sc_invisible=1;
var sc_security="8ed27a6d";
</script>
<script type="text/javascript"
src="https://www.statcounter.com/counter/counter.js"
async></script>
<noscript><div class="statcounter"><a title="Web Analytics"
href="https://statcounter.com/" target="_blank"><img
class="statcounter"
src="https://c.statcounter.com/12339405/0/8ed27a6d/1/"
alt="Web Analytics"></a></div></noscript>
<!-- -->
<div class="tabtocall">
<a href="tel:833-866-6990"><img src="images/baseline_call_white_18dp.png" alt=""> Tap To Call</a>
</div>
<div class="modal fade" id="ouibounce-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<button type="button" class="close-btn" data-dismiss="modal">X</button>
<div class="modal-body">
<div class="popupWait">
<span class="waitText">Wait!</span>
<p class="para1">Urgent Pest Control Needs? Calls Are Answered 24/7.</p>
<p class="para2">Call now to get connected to a exterminator near you.</p>
<a href="tel:833-866-6990"><strong><i class="fa fa-phone"></i>(833) 866-6990</strong></a>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="js/exit-popup.js"></script>
<body>
</body>
</html> | 78.632653 | 510 | 0.695886 |
08d0192f341c14aef768a7cd6684f072f5d04dd4 | 724 | sql | SQL | db/versions/005_add_import_table_and_tracking_postgresql_upgrade.sql | thmsndk/Screeps-LoAN | 3ca244c2d1ef34116eac8d6160dbaafab2aa3eab | [
"MIT"
] | 12 | 2016-10-02T03:33:01.000Z | 2022-02-23T03:58:03.000Z | db/versions/005_add_import_table_and_tracking_postgresql_upgrade.sql | thmsndk/Screeps-LoAN | 3ca244c2d1ef34116eac8d6160dbaafab2aa3eab | [
"MIT"
] | 29 | 2016-10-05T08:55:03.000Z | 2021-03-22T17:14:40.000Z | db/versions/005_add_import_table_and_tracking_postgresql_upgrade.sql | thmsndk/Screeps-LoAN | 3ca244c2d1ef34116eac8d6160dbaafab2aa3eab | [
"MIT"
] | 16 | 2016-10-05T02:28:54.000Z | 2021-07-28T14:42:14.000Z |
CREATE TABLE room_imports (
id integer NOT NULL,
started_at timestamp without time zone default current_timestamp,
status character varying(50) NOT NULL
);
CREATE SEQUENCE room_imports_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE room_imports_id_seq OWNED BY room_imports.id;
ALTER TABLE ONLY room_imports ALTER COLUMN id SET DEFAULT nextval('room_imports_id_seq'::regclass);
ALTER TABLE ONLY room_imports ADD CONSTRAINT room_imports_pkey PRIMARY KEY (id);
DROP TABLE rooms;
CREATE TABLE rooms (
name character varying(8) NOT NULL,
import integer NOT NULL,
level integer NOT NULL,
owner integer
);
ALTER TABLE ONLY rooms ADD CONSTRAINT rooms_pkey PRIMARY KEY (name, import);
| 21.294118 | 99 | 0.80663 |
131ed5146521cd609488c2dc2d65620fdd96386f | 626 | h | C | linux/include/linux/keyboard.h | bradchesney79/illacceptanything | 4594ae4634fdb5e39263a6423dc255ed46c25208 | [
"MIT"
] | 55 | 2019-12-20T03:25:14.000Z | 2022-01-16T07:19:47.000Z | linux/include/linux/keyboard.h | bradchesney79/illacceptanything | 4594ae4634fdb5e39263a6423dc255ed46c25208 | [
"MIT"
] | 32 | 2017-01-26T10:20:39.000Z | 2018-10-01T23:06:07.000Z | linux/include/linux/keyboard.h | bradchesney79/illacceptanything | 4594ae4634fdb5e39263a6423dc255ed46c25208 | [
"MIT"
] | 30 | 2018-05-02T08:43:27.000Z | 2022-01-23T03:25:54.000Z | #ifndef __LINUX_KEYBOARD_H
#define __LINUX_KEYBOARD_H
#include <uapi/linux/keyboard.h>
struct notifier_block;
extern unsigned short *key_maps[MAX_NR_KEYMAPS];
extern unsigned short plain_map[NR_KEYS];
struct keyboard_notifier_param {
struct vc_data *vc; /* VC on which the keyboard press was done */
int down; /* Pressure of the key? */
int shift; /* Current shift mask */
int ledstate; /* Current led state */
unsigned int value; /* keycode, unicode value or keysym */
};
extern int register_keyboard_notifier(struct notifier_block *nb);
extern int unregister_keyboard_notifier(struct notifier_block *nb);
#endif
| 29.809524 | 67 | 0.769968 |
018227f75817f6ea196e31249c2434dfd596dd25 | 546 | swift | Swift | Macro/Models/HotKey/Glyph.swift | IgorMuzyka/Macro | 28ae0603fe122836aa00232b827be629ddc10d51 | [
"MIT"
] | 8 | 2019-01-28T19:32:32.000Z | 2021-07-17T15:52:13.000Z | Macro/Models/HotKey/Glyph.swift | IgorMuzyka/Macro | 28ae0603fe122836aa00232b827be629ddc10d51 | [
"MIT"
] | null | null | null | Macro/Models/HotKey/Glyph.swift | IgorMuzyka/Macro | 28ae0603fe122836aa00232b827be629ddc10d51 | [
"MIT"
] | 1 | 2021-04-20T10:15:38.000Z | 2021-04-20T10:15:38.000Z |
public enum Glyph: UInt16, Codable {
case eject = 0x23CF
case clear = 0x2715
case deleteLeft = 0x232B
case deleteRight = 0x2326
case leftArrow = 0x2190
case rightArrow = 0x2192
case upArrow = 0x2191
case downArrow = 0x2193
case escape = 0x238B
case help = 0x003F
case pageDown = 0x21DF
case pageUp = 0x21DE
case tabRight = 0x21E5
case `return` = 0x2305
case returnR2L = 0x21A9
case padClear = 0x2327
case northwestArrow = 0x2196
case southeastArrow = 0x2198
public var string: String {
return keyCodeString(rawValue)
}
}
| 20.222222 | 36 | 0.741758 |
60d88752bec89725243dd1a32f1172468c2445a9 | 5,155 | cpp | C++ | src/arch/Dialog/Dialog.cpp | lunixbochs/stepmania-3.9 | fe330c1b1857a9747f53571588ed3b2d4374c148 | [
"Info-ZIP"
] | null | null | null | src/arch/Dialog/Dialog.cpp | lunixbochs/stepmania-3.9 | fe330c1b1857a9747f53571588ed3b2d4374c148 | [
"Info-ZIP"
] | null | null | null | src/arch/Dialog/Dialog.cpp | lunixbochs/stepmania-3.9 | fe330c1b1857a9747f53571588ed3b2d4374c148 | [
"Info-ZIP"
] | null | null | null | #include "global.h"
#include "Dialog.h"
#include "DialogDriver.h"
#include "PrefsManager.h"
#include "RageUtil.h"
#include "RageLog.h"
/* Hmm. I don't want this to depend on other arch drivers--we should be able to test
* this without linking to them. We probably don't actually have to do that just by
* #including the headers in arch_Win32.h, etc., but it's still messy ... */
#if defined(_WINDOWS)
#include "DialogDriver_Win32.h"
#endif
static DialogDriver *g_pImpl = NULL;
static DialogDriver_Null g_NullDriver;
static bool g_bWindowed = false;
static bool g_bIsShowingDialog = false;
void Dialog::Init()
{
if( g_pImpl != NULL )
return;
CString drivers = "win32,cocoa,null";
CStringArray DriversToTry;
split(drivers, ",", DriversToTry, true);
ASSERT( DriversToTry.size() != 0 );
CString Driver;
for( unsigned i = 0; g_pImpl == NULL && i < DriversToTry.size(); ++i )
{
try {
Driver = DriversToTry[i];
#if defined(HAVE_DIALOG_WIN32)
if( !DriversToTry[i].CompareNoCase("Win32") ) g_pImpl = new DialogDriver_Win32;
#endif
if( !DriversToTry[i].CompareNoCase("Null") ) g_pImpl = new DialogDriver_Null;
}
catch( const RageException &e )
{
if( LOG )
LOG->Info("Couldn't load driver %s: %s", DriversToTry[i].c_str(), e.what());
}
}
/* DialogDriver_Null should have worked, at least. */
ASSERT( g_pImpl != NULL );
}
void Dialog::Shutdown()
{
delete g_pImpl;
g_pImpl = NULL;
}
bool Dialog::IsShowingDialog()
{
return g_bIsShowingDialog;
}
static bool MessageIsIgnored( CString ID )
{
vector<CString> list;
split( PREFSMAN->m_sIgnoredMessageWindows, ",", list );
for( unsigned i = 0; i < list.size(); ++i )
if( !ID.CompareNoCase(list[i]) )
return true;
return false;
}
void Dialog::IgnoreMessage( CString ID )
{
/* We can't ignore messages before PREFSMAN is around. */
if( PREFSMAN == NULL )
{
if( ID != "" && LOG )
LOG->Warn( "Dialog: message \"%s\" set ID too early for ignorable messages", ID.c_str() );
return;
}
if( ID == "" )
return;
if( MessageIsIgnored(ID) )
return;
vector<CString> list;
split( PREFSMAN->m_sIgnoredMessageWindows, ",", list );
list.push_back( ID );
PREFSMAN->m_sIgnoredMessageWindows = join( ",", list );
PREFSMAN->SaveGlobalPrefsToDisk();
}
void Dialog::Error( CString sMessage, CString ID )
{
Dialog::Init();
if( ID != "" && MessageIsIgnored( ID ) )
return;
g_bIsShowingDialog = true;
g_pImpl->Error( sMessage, ID );
g_bIsShowingDialog = false;
}
void Dialog::SetWindowed( bool bWindowed )
{
g_bWindowed = bWindowed;
}
void Dialog::OK( CString sMessage, CString ID )
{
Dialog::Init();
if( ID != "" && MessageIsIgnored( ID ) )
return;
g_bIsShowingDialog = true;
// only show Dialog if windowed
if( !g_bWindowed )
g_NullDriver.OK( sMessage, ID );
else
g_pImpl->OK( sMessage, ID ); // call derived version
g_bIsShowingDialog = false;
}
Dialog::Result Dialog::AbortRetryIgnore( CString sMessage, CString ID )
{
Dialog::Init();
if( ID != "" && MessageIsIgnored( ID ) )
return g_NullDriver.AbortRetryIgnore( sMessage, ID );
g_bIsShowingDialog = true;
// only show Dialog if windowed
Dialog::Result ret;
if( !g_bWindowed )
ret = g_NullDriver.AbortRetryIgnore( sMessage, ID );
else
ret = g_pImpl->AbortRetryIgnore( sMessage, ID ); // call derived version
g_bIsShowingDialog = false;
return ret;
}
Dialog::Result Dialog::RetryCancel( CString sMessage, CString ID )
{
Dialog::Init();
if( ID != "" && MessageIsIgnored( ID ) )
return g_NullDriver.RetryCancel( sMessage, ID );
g_bIsShowingDialog = true;
// only show Dialog if windowed
Dialog::Result ret;
if( !g_bWindowed )
ret = g_NullDriver.RetryCancel( sMessage, ID );
else
ret = g_pImpl->RetryCancel( sMessage, ID ); // call derived version
g_bIsShowingDialog = false;
return ret;
}
/*
* (c) 2003-2004 Glenn Maynard, Chris Danford
* All rights reserved.
*
* 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, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* 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 OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
| 25.646766 | 93 | 0.704365 |
71fc7267c4181355916f0c1ffb129c2c4eb77271 | 1,466 | ts | TypeScript | src/app/components/profile/profile.component.ts | abruneau/Cmp2 | 4075b2410bfdee0e47f92b01dbf5ffa4a04a3a4d | [
"Apache-2.0"
] | null | null | null | src/app/components/profile/profile.component.ts | abruneau/Cmp2 | 4075b2410bfdee0e47f92b01dbf5ffa4a04a3a4d | [
"Apache-2.0"
] | 2 | 2017-02-01T14:57:22.000Z | 2017-02-13T15:55:30.000Z | src/app/components/profile/profile.component.ts | abruneau/Cmp2 | 4075b2410bfdee0e47f92b01dbf5ffa4a04a3a4d | [
"Apache-2.0"
] | null | null | null | import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core';
import { TabsetComponent } from 'ngx-bootstrap';
import { Setting } from '../../models';
import { Identity } from '../../models';
import { SalesforceService, SharedDataService } from '../../providers';
declare const $: any;
@Component({
selector: 'app-profile',
templateUrl: './profile.component.html',
styleUrls: ['./profile.component.scss']
})
export class ProfileComponent implements OnInit, AfterViewInit {
@ViewChild('staticTabs') staticTabs: TabsetComponent;
public settings = new Setting();
public identity: Identity;
public connected = false;
constructor(private _sharedData: SharedDataService,
private _sf: SalesforceService,
) {
_sharedData.settings.subscribe((set) => {
this.settings = set
})
_sf.connected.subscribe((connected: boolean) => {
this.connected = connected;
})
_sharedData.identity.subscribe((id) => {
this.identity = id
})
}
ngOnInit() {
}
ngAfterViewInit() {
$('.nav-tabs').addClass('nav-tabs-v5');
$('.tab-content').addClass('tab-content-v5');
}
public update() {
this.settings.update().then(() => {
this._sharedData.settingsChanges()
});
}
public updateIdentity() {
this._sf.getIdentity().then((res) => {
this.identity = res
return this.identity.update()
}).then(() => {
this._sharedData.identityChanges()
})
}
}
| 22.90625 | 76 | 0.643929 |
abd1a622baf7919d912fb09947bb7c1f32422aac | 4,541 | go | Go | src/app/libp2p_helper/src/libp2p_helper/peer_msg.go | AbstrLabs/mina | af76cb7980d5e81e704120290a850ea9c6f8522e | [
"Apache-2.0"
] | 929 | 2020-10-02T07:23:16.000Z | 2022-03-31T15:02:09.000Z | src/app/libp2p_helper/src/libp2p_helper/peer_msg.go | Shiba-Chain/mina | 44ed883ff44a2a75b091e0e5d55a39cf39f820cf | [
"Apache-2.0"
] | 3,154 | 2020-09-29T15:47:44.000Z | 2022-03-31T16:22:28.000Z | src/app/libp2p_helper/src/libp2p_helper/peer_msg.go | Shiba-Chain/mina | 44ed883ff44a2a75b091e0e5d55a39cf39f820cf | [
"Apache-2.0"
] | 216 | 2020-09-29T19:47:41.000Z | 2022-03-27T08:44:29.000Z | package main
import (
"context"
"fmt"
"io"
"codanet"
ipc "libp2p_ipc"
capnp "capnproto.org/go/capnp/v3"
"github.com/go-errors/errors"
peerstore "github.com/libp2p/go-libp2p-core/peerstore"
)
type AddPeerReqT = ipc.Libp2pHelperInterface_AddPeer_Request
type AddPeerReq AddPeerReqT
func fromAddPeerReq(req ipcRpcRequest) (rpcRequest, error) {
i, err := req.AddPeer()
return AddPeerReq(i), err
}
func (m AddPeerReq) handle(app *app, seqno uint64) *capnp.Message {
if app.P2p == nil {
return mkRpcRespError(seqno, needsConfigure())
}
maddr, err := AddPeerReqT(m).Multiaddr()
if err != nil {
return mkRpcRespError(seqno, badRPC(err))
}
maRepr, err := maddr.Representation()
if err != nil {
return mkRpcRespError(seqno, badRPC(err))
}
info, err := addrInfoOfString(maRepr)
if err != nil {
return mkRpcRespError(seqno, badRPC(err))
}
app.AddedPeers = append(app.AddedPeers, *info)
app.P2p.GatingState.TrustedPeers.Add(info.ID)
if app.Bootstrapper != nil {
app.Bootstrapper.Close()
}
app.P2p.Logger.Info("addPeer Trying to connect to: ", info)
if AddPeerReqT(m).IsSeed() {
app.P2p.Seeds = append(app.P2p.Seeds, *info)
}
err = app.P2p.Host.Connect(app.Ctx, *info)
if err != nil {
return mkRpcRespError(seqno, badp2p(err))
}
return mkRpcRespSuccess(seqno, func(m *ipc.Libp2pHelperInterface_RpcResponseSuccess) {
_, err := m.NewAddPeer()
panicOnErr(err)
})
}
type GetPeerNodeStatusReqT = ipc.Libp2pHelperInterface_GetPeerNodeStatus_Request
type GetPeerNodeStatusReq GetPeerNodeStatusReqT
func fromGetPeerNodeStatusReq(req ipcRpcRequest) (rpcRequest, error) {
i, err := req.GetPeerNodeStatus()
return GetPeerNodeStatusReq(i), err
}
func (m GetPeerNodeStatusReq) handle(app *app, seqno uint64) *capnp.Message {
ctx, cancel := context.WithTimeout(app.Ctx, codanet.NodeStatusTimeout)
defer cancel()
pma, err := GetPeerNodeStatusReqT(m).Peer()
if err != nil {
return mkRpcRespError(seqno, badRPC(err))
}
pmaRepr, err := pma.Representation()
if err != nil {
return mkRpcRespError(seqno, badRPC(err))
}
addrInfo, err := addrInfoOfString(pmaRepr)
if err != nil {
return mkRpcRespError(seqno, err)
}
app.P2p.Host.Peerstore().AddAddrs(addrInfo.ID, addrInfo.Addrs, peerstore.ConnectedAddrTTL)
// Open a "get node status" stream on m.PeerID,
// block until you can read the response, return that.
s, err := app.P2p.Host.NewStream(ctx, addrInfo.ID, codanet.NodeStatusProtocolID)
if err != nil {
return mkRpcRespError(seqno, err)
}
defer func() {
_ = s.Close()
}()
errCh := make(chan error)
responseCh := make(chan []byte)
go func() {
// 1 megabyte
size := 1048576
data := make([]byte, size)
n, err := s.Read(data)
// TODO will the whole status be read or we can "accidentally" read only
// part of it?
if err != nil && err != io.EOF {
app.P2p.Logger.Errorf("failed to decode node status data: err=%s", err)
errCh <- err
return
}
if n == size && err == nil {
errCh <- fmt.Errorf("node status data was greater than %d bytes", size)
return
}
responseCh <- data[:n]
}()
select {
case <-ctx.Done():
s.Reset()
err := errors.New("timed out requesting node status data from peer")
return mkRpcRespError(seqno, err)
case err := <-errCh:
return mkRpcRespError(seqno, err)
case response := <-responseCh:
return mkRpcRespSuccess(seqno, func(m *ipc.Libp2pHelperInterface_RpcResponseSuccess) {
r, err := m.NewGetPeerNodeStatus()
panicOnErr(err)
r.SetResult(response)
})
}
}
type ListPeersReqT = ipc.Libp2pHelperInterface_ListPeers_Request
type ListPeersReq ListPeersReqT
func fromListPeersReq(req ipcRpcRequest) (rpcRequest, error) {
i, err := req.ListPeers()
return ListPeersReq(i), err
}
func (msg ListPeersReq) handle(app *app, seqno uint64) *capnp.Message {
if app.P2p == nil {
return mkRpcRespError(seqno, needsConfigure())
}
connsHere := app.P2p.Host.Network().Conns()
peerInfos := make([]codaPeerInfo, 0, len(connsHere))
for _, conn := range connsHere {
maybePeer, err := parseMultiaddrWithID(conn.RemoteMultiaddr(), conn.RemotePeer())
if err != nil {
app.P2p.Logger.Warning("skipping maddr ", conn.RemoteMultiaddr().String(), " because it failed to parse: ", err.Error())
continue
}
peerInfos = append(peerInfos, *maybePeer)
}
return mkRpcRespSuccess(seqno, func(m *ipc.Libp2pHelperInterface_RpcResponseSuccess) {
r, err := m.NewListPeers()
panicOnErr(err)
lst, err := r.NewResult(int32(len(peerInfos)))
panicOnErr(err)
setPeerInfoList(lst, peerInfos)
})
}
| 25.948571 | 123 | 0.707994 |
5fcdb40858c8a24984b69e99e5fc35eb8fd5448e | 3,597 | css | CSS | public/css/layouts/main.css | Sbusiso23/The-Outcasts | 371aefefcb05199f1f4afc16e457964c1814e73d | [
"MIT"
] | null | null | null | public/css/layouts/main.css | Sbusiso23/The-Outcasts | 371aefefcb05199f1f4afc16e457964c1814e73d | [
"MIT"
] | null | null | null | public/css/layouts/main.css | Sbusiso23/The-Outcasts | 371aefefcb05199f1f4afc16e457964c1814e73d | [
"MIT"
] | null | null | null | /* main app UI */
html{
font-size: 15px !important;
}
a{
text-decoration: none;
}
a:hover{
text-decoration: none !important;
}
body{
width: 100%;
}
::selection{
background: #9B29A5;
color: #FFF;
}
.color-overlay {
display: none;
position: absolute;
z-index: 2;
opacity: 0;
width: 100%;
height: 100%;
background: #000;
opacity: .5;
}
.nav-bar{
display: flex;
justify-content: space-between;
width: 100%;
height: 4.1rem;
padding: 1rem;
position: relative;
z-index: 3;
}
.logo a{
font-family: 'Give You Glory';
color: #000 !important;
font-size: 2.4rem;
margin-left: 3rem;
}
.outcast-logo{
color: #9B29A5 !important;
transform: translateX(.5rem);
}
.outcast-logo:hover{
color: #000 !important;
}
.logo a:hover{
color: #000 !important;
}
.right-nav{
display: flex;
flex-direction: row;
margin-right: 0rem;
}
.links{
display: flex;
flex-direction: row;
margin: .3rem 2.5rem 0 0;
}
.links li, .dropdown-links li{
font-size: 1.4rem;
font-weight: 550;
list-style: none;
margin-right: 2.3rem;
transition: ease-in .2s;
}
.links li:hover, .links li a:hover, .dropdown-links li:hover{
color: #9B29A5;
}
.links a, .dropdown-links a{
color: #000;
}
#active-link{
color: #9B29A5;
transition: ease-in .2s;
}
#active-link:hover{
color: #000;
}
.nav-login-a{
margin-top: .4rem;
}
.nav-login-btn{
margin-top: 1rem;
border-radius: 2rem;
border: 1px solid #9B29A5;
color: #9B29A5;
width: 5rem;
font-size: 1.2rem;
padding: .4rem 1.5rem;
transition: ease .5s;
}
.nav-login-btn:hover{
border: 1px solid #9B29A5;
color: #FFF;
background-color: #9B29A5;
}
.hamburger-icon{
border: 1px solid #000;
width: 2.7rem; height: 2.7rem;
display: flex;
justify-content: center;
align-items: center;
display: none;
}
.hamburger-icon i{
font-size: 2rem;
color: #000;
cursor: pointer;
}
.dropdown-nav{
display: none;
flex-direction: column;
border: 1px solid #C8C8C8;
height: 100%;
}
.dropdown-links{
padding-left: 0;
margin-bottom: 0;
}
.dropdown-links li{
padding: .6rem 0 .6rem 1rem;
margin-right: 0;
font-size: 1.2rem;
border-bottom: 1px solid #C8C8C8;
border-left: .3rem solid #292929;
}
#active-link-dropdown{
color: #9B29A5;
border-left: .3rem solid #9B29A5;
}
#active-link-dropdown:hover{
color: #000;
border-left: .3rem solid#292929;
}
.dropdown-links li:hover{
border-left: .3rem solid #9B29A5;
}
.footer{
display: flex;
flex-flow: row;
justify-content: center;
align-items: center;
height: 2.0rem;
}
.copyright {
display: flex;
flex-flow: row;
height: 35px;
padding-top: 0px;
margin-top: 30px;
align-self: center;
}
.copyright p {
display: flex;
align-items: center;
flex-direction: row;
color: #111;
font-size: 0.9rem;
}
.copyright-dot {
margin: 0 0.3rem 0 0.5rem;
}
.copyright i {
color: #f0f;
font-size: 1rem;
}
#ht {
color: #5ca7f7 !important;
}
@media only screen and (max-width: 992px){
.logo a{
font-size: 2.1rem;
margin-left: 1rem;
}
.links{
display: flex;
flex-direction: row;
margin: .3rem 2rem 0 0;
}
.links li{
margin-right: 1rem;
}
}
@media only screen and (max-width: 768px){
.hamburger-icon{
display: flex;
}
.links{
display: none;
}
.nav-login-a{
display: none;
}
}
@media only screen and (max-width: 576px){
.logo a{
font-size: 2rem;
margin-left: 1rem;
}
.footer {
padding-bottom: 1.3rem;
}
.copyright p {
flex-direction: column;
}
.copyright-dot {
display: none;
}
} | 14.217391 | 61 | 0.628579 |
bb3fef5ade198373b2e7405a160bb1327c674b05 | 67,716 | html | HTML | documentation/components/TiledLightTableComponent.html | musicEnfanthen/inseri | 5e963aff639888539fd7b930ba007f5af7d10dff | [
"MIT"
] | null | null | null | documentation/components/TiledLightTableComponent.html | musicEnfanthen/inseri | 5e963aff639888539fd7b930ba007f5af7d10dff | [
"MIT"
] | null | null | null | documentation/components/TiledLightTableComponent.html | musicEnfanthen/inseri | 5e963aff639888539fd7b930ba007f5af7d10dff | [
"MIT"
] | null | null | null | <!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>nie-frontend documentation</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
<link rel="stylesheet" href="../styles/style.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top visible-xs">
<a href="../" class="navbar-brand">nie-frontend documentation</a>
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
</div>
<div class="xs-menu menu" id="mobile-menu">
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
</div>
<div class="container-fluid main">
<div class="row main">
<div class="hidden-xs menu">
<compodoc-menu mode="normal"></compodoc-menu>
</div>
<!-- START CONTENT -->
<div class="content component">
<div class="content-data">
<ol class="breadcrumb">
<li>Components</li>
<li>TiledLightTableComponent</li>
</ol>
<ul class="nav nav-tabs" role="tablist">
<li class="active">
<a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
</li>
<li >
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
</li>
<li >
<a href="#templateData" role="tab" id="templateData-tab" data-toggle="tab" data-link="template">Template</a>
</li>
<li >
<a href="#styleData" role="tab" id="styleData-tab" data-toggle="tab" data-link="style">Styles</a>
</li>
<li >
<a href="#tree" role="tab" id="tree-tab" data-toggle="tab" data-link="dom-tree">DOM Tree</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="c-info"><p class="comment">
<h3>File</h3>
</p>
<p class="comment">
<code>src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts</code>
</p>
<p class="comment">
<h3>Implements</h3>
</p>
<p class="comment">
<code><a href="https://angular.io/api/core/OnInit" target="_blank" >OnInit</a></code>
<code><a href="https://angular.io/api/core/OnDestroy" target="_blank" >OnDestroy</a></code>
</p>
<section>
<h3>Metadata</h3>
<table class="table table-sm table-hover">
<tbody>
<tr>
<td class="col-md-3">selector</td>
<td class="col-md-9"><code>app-tiled-light-table</code></td>
</tr>
<tr>
<td class="col-md-3">styleUrls</td>
<td class="col-md-9"><code>./tiled-light-table.component.scss</code></td>
</tr>
<tr>
<td class="col-md-3">templateUrl</td>
<td class="col-md-9"><code>./tiled-light-table.component.html</code></td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="index">Index</h3>
<table class="table table-sm table-bordered index-table">
<tbody>
<tr>
<td class="col-md-4">
<h6><b>Properties</b></h6>
</td>
</tr>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<span class="modifier">Private</span>
<a href="#closeObjectsByIdSubscriber">closeObjectsByIdSubscriber</a>
</li>
<li>
<span class="modifier">Private</span>
<a href="#closeObjectSubscriber">closeObjectSubscriber</a>
</li>
<li>
<a href="#columns">columns</a>
</li>
<li>
<a href="#dragging">dragging</a>
</li>
<li>
<span class="modifier">Private</span>
<a href="#invertColorsSubscriber">invertColorsSubscriber</a>
</li>
<li>
<span class="modifier">Private</span>
<a href="#loadLightTableSnapshotSubscriber">loadLightTableSnapshotSubscriber</a>
</li>
<li>
<span class="modifier">Private</span>
<a href="#makeLightTableSnapshotSubscriber">makeLightTableSnapshotSubscriber</a>
</li>
<li>
<a href="#synopsisObjects">synopsisObjects</a>
</li>
<li>
<a href="#synopsisObjectTypes">synopsisObjectTypes</a>
</li>
</ul>
</td>
</tr>
<tr>
<td class="col-md-4">
<h6><b>Methods</b></h6>
</td>
</tr>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<span class="modifier">Private</span>
<a href="#closeObject">closeObject</a>
</li>
<li>
<span class="modifier">Private</span>
<a href="#closeObjectsById">closeObjectsById</a>
</li>
<li>
<span class="modifier">Private</span>
<a href="#load">load</a>
</li>
<li>
<span class="modifier">Private</span>
<a href="#makeSnapshot">makeSnapshot</a>
</li>
<li>
<a href="#ngOnDestroy">ngOnDestroy</a>
</li>
<li>
<a href="#ngOnInit">ngOnInit</a>
</li>
<li>
<a href="#onDrop">onDrop</a>
</li>
<li>
<a href="#setColumns">setColumns</a>
</li>
<li>
<span class="modifier">Private</span>
<a href="#updateInversion">updateInversion</a>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="constructor">Constructor</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<code>constructor(lightTableLayoutService: <a href="../injectables/LightTableLayoutService.html">LightTableLayoutService</a>, lightTableStashService: <a href="../injectables/LightTableStashService.html">LightTableStashService</a>, synopsisObjectModifierService: <a href="../injectables/SynopsisObjectModifierService.html">SynopsisObjectModifierService</a>, synopsisObjectSerializerService: <a href="../injectables/SynopsisObjectSerializerService.html">SynopsisObjectSerializerService</a>, dragService: <a href="../injectables/DragService.html">DragService</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="24" class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:24</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div>
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
</tr>
</thead>
<tbody>
<tr>
<td>lightTableLayoutService</td>
<td>
<code><a href="../injectables/LightTableLayoutService.html" target="_self" >LightTableLayoutService</a></code>
</td>
<td>
No
</td>
</tr>
<tr>
<td>lightTableStashService</td>
<td>
<code><a href="../injectables/LightTableStashService.html" target="_self" >LightTableStashService</a></code>
</td>
<td>
No
</td>
</tr>
<tr>
<td>synopsisObjectModifierService</td>
<td>
<code><a href="../injectables/SynopsisObjectModifierService.html" target="_self" >SynopsisObjectModifierService</a></code>
</td>
<td>
No
</td>
</tr>
<tr>
<td>synopsisObjectSerializerService</td>
<td>
<code><a href="../injectables/SynopsisObjectSerializerService.html" target="_self" >SynopsisObjectSerializerService</a></code>
</td>
<td>
No
</td>
</tr>
<tr>
<td>dragService</td>
<td>
<code><a href="../injectables/DragService.html" target="_self" >DragService</a></code>
</td>
<td>
No
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="methods">
Methods
</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="closeObject"></a>
<span class="name">
<b>
<span class="modifier">Private</span>
closeObject
</b>
<a href="#closeObject"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>closeObject(uid: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="92"
class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:92</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
</tr>
</thead>
<tbody>
<tr>
<td>uid</td>
<td>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</td>
<td>
No
</td>
</tr>
</tbody>
</table>
</div>
<div>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
</div>
<div class="io-description">
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="closeObjectsById"></a>
<span class="name">
<b>
<span class="modifier">Private</span>
closeObjectsById
</b>
<a href="#closeObjectsById"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>closeObjectsById(id: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="109"
class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:109</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
</td>
<td>
No
</td>
</tr>
</tbody>
</table>
</div>
<div>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
</div>
<div class="io-description">
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="load"></a>
<span class="name">
<b>
<span class="modifier">Private</span>
load
</b>
<a href="#load"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>load(snapshot: SynopsisObjectData[])</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="100"
class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:100</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
</tr>
</thead>
<tbody>
<tr>
<td>snapshot</td>
<td>
<code>SynopsisObjectData[]</code>
</td>
<td>
No
</td>
</tr>
</tbody>
</table>
</div>
<div>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
</div>
<div class="io-description">
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="makeSnapshot"></a>
<span class="name">
<b>
<span class="modifier">Private</span>
makeSnapshot
</b>
<a href="#makeSnapshot"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>makeSnapshot()</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="96"
class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:96</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="ngOnDestroy"></a>
<span class="name">
<b>
ngOnDestroy
</b>
<a href="#ngOnDestroy"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>ngOnDestroy()</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="51"
class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:51</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="ngOnInit"></a>
<span class="name">
<b>
ngOnInit
</b>
<a href="#ngOnInit"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>ngOnInit()</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="43"
class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:43</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="onDrop"></a>
<span class="name">
<b>
onDrop
</b>
<a href="#onDrop"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>onDrop(data: <a href="../interfaces/SynopsisObjectData.html">SynopsisObjectData</a>, index?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="60"
class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:60</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
</tr>
</thead>
<tbody>
<tr>
<td>data</td>
<td>
<code><a href="../interfaces/SynopsisObjectData.html" target="_self" >SynopsisObjectData</a></code>
</td>
<td>
No
</td>
</tr>
<tr>
<td>index</td>
<td>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</td>
<td>
Yes
</td>
</tr>
</tbody>
</table>
</div>
<div>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
</div>
<div class="io-description">
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="setColumns"></a>
<span class="name">
<b>
setColumns
</b>
<a href="#setColumns"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>setColumns(cols: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="77"
class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:77</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
</tr>
</thead>
<tbody>
<tr>
<td>cols</td>
<td>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</td>
<td>
No
</td>
</tr>
</tbody>
</table>
</div>
<div>
</div>
<div class="io-description">
<b>Returns : </b> <code>"col-1" | "col-2" | "col-3" | "col-4" | "col-5"</code>
</div>
<div class="io-description">
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="updateInversion"></a>
<span class="name">
<b>
<span class="modifier">Private</span>
updateInversion
</b>
<a href="#updateInversion"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>updateInversion(uid: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="104"
class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:104</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
</tr>
</thead>
<tbody>
<tr>
<td>uid</td>
<td>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</td>
<td>
No
</td>
</tr>
</tbody>
</table>
</div>
<div>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
</div>
<div class="io-description">
</div>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="inputs">
Properties
</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="closeObjectsByIdSubscriber"></a>
<span class="name">
<b>
<span class="modifier">Private</span>
closeObjectsByIdSubscriber</b>
<a href="#closeObjectsByIdSubscriber"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code>Subscription</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="22" class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:22</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="closeObjectSubscriber"></a>
<span class="name">
<b>
<span class="modifier">Private</span>
closeObjectSubscriber</b>
<a href="#closeObjectSubscriber"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code>Subscription</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="21" class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:21</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="columns"></a>
<span class="name">
<b>
columns</b>
<a href="#columns"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Default value : </i><code>2</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="17" class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:17</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="dragging"></a>
<span class="name">
<b>
dragging</b>
<a href="#dragging"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Default value : </i><code>false</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="24" class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:24</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="invertColorsSubscriber"></a>
<span class="name">
<b>
<span class="modifier">Private</span>
invertColorsSubscriber</b>
<a href="#invertColorsSubscriber"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code>Subscription</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="23" class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:23</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="loadLightTableSnapshotSubscriber"></a>
<span class="name">
<b>
<span class="modifier">Private</span>
loadLightTableSnapshotSubscriber</b>
<a href="#loadLightTableSnapshotSubscriber"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code>Subscription</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="19" class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:19</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="makeLightTableSnapshotSubscriber"></a>
<span class="name">
<b>
<span class="modifier">Private</span>
makeLightTableSnapshotSubscriber</b>
<a href="#makeLightTableSnapshotSubscriber"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code>Subscription</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="20" class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:20</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="synopsisObjects"></a>
<span class="name">
<b>
synopsisObjects</b>
<a href="#synopsisObjects"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code>SynopsisObjectData[]</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Default value : </i><code>[]</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="16" class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:16</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="synopsisObjectTypes"></a>
<span class="name">
<b>
synopsisObjectTypes</b>
<a href="#synopsisObjectTypes"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Default value : </i><code>SynopsisObjectType</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="18" class="link-to-prism">src/app/app-engine/apps/synopsis/tiled-light-table/tiled-light-table.component.ts:18</a></div>
</td>
</tr>
</tbody>
</table>
</section>
</div>
<div class="tab-pane fade tab-source-code" id="c-source">
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {Component, OnDestroy, OnInit} from '@angular/core';
import {LightTableLayoutService} from '../light-table-layout.service';
import {SynopsisObjectData, SynopsisObjectType} from '../synopsis-object-data';
import {LightTableStashService} from '../light-table-stash.service';
import {SynopsisObjectModifierService} from '../synopsis-object-modifier.service';
import {SynopsisObjectSerializerService} from '../synopsis-object-serializer.service';
import {Subscription} from 'rxjs/Subscription';
import {DragService} from '../drag.service';
@Component({
selector: 'app-tiled-light-table',
templateUrl: './tiled-light-table.component.html',
styleUrls: ['./tiled-light-table.component.scss']
})
export class TiledLightTableComponent implements OnInit, OnDestroy {
synopsisObjects: SynopsisObjectData[] = [];
columns = 2;
synopsisObjectTypes = SynopsisObjectType;
private loadLightTableSnapshotSubscriber: Subscription;
private makeLightTableSnapshotSubscriber: Subscription;
private closeObjectSubscriber: Subscription;
private closeObjectsByIdSubscriber: Subscription;
private invertColorsSubscriber: Subscription;
dragging = false;
constructor(private lightTableLayoutService: LightTableLayoutService,
private lightTableStashService: LightTableStashService,
private synopsisObjectModifierService: SynopsisObjectModifierService,
private synopsisObjectSerializerService: SynopsisObjectSerializerService,
private dragService: DragService) {
lightTableLayoutService.numberOfColumns$.subscribe(cols => this.columns = cols);
this.closeObjectSubscriber =
synopsisObjectModifierService.closeObject$.subscribe(uid => this.closeObject(uid));
this.closeObjectsByIdSubscriber =
synopsisObjectModifierService.closeObjectsById$.subscribe(id => this.closeObjectsById(id));
this.makeLightTableSnapshotSubscriber =
synopsisObjectSerializerService.makeLightTableSnapshot$.subscribe(() => this.makeSnapshot());
this.invertColorsSubscriber =
synopsisObjectModifierService.invertColors$.subscribe(uid => this.updateInversion(uid));
dragService.dragging$.subscribe(dragging => this.dragging = dragging);
}
ngOnInit() {
if (this.lightTableStashService.fetch()) {
this.load(this.lightTableStashService.fetch());
}
this.loadLightTableSnapshotSubscriber =
this.synopsisObjectSerializerService.loadLightTableSnapshot$.subscribe(snapshot => this.load(snapshot));
}
ngOnDestroy() {
this.lightTableStashService.stash(this.synopsisObjects);
this.closeObjectSubscriber.unsubscribe();
this.closeObjectsByIdSubscriber.unsubscribe();
this.makeLightTableSnapshotSubscriber.unsubscribe();
this.loadLightTableSnapshotSubscriber.unsubscribe();
this.invertColorsSubscriber.unsubscribe();
}
onDrop(data: SynopsisObjectData, index?: number) {
if (!data.uid) {
data.uid = +(Math.random().toString().substr(2));
} else {
this.synopsisObjects = this.synopsisObjects.filter(x => x.uid !== data.uid);
}
if (index === 0) {
this.synopsisObjects.unshift(data);
} else if (index) {
this.synopsisObjects.splice(index, 0, data);
} else {
this.synopsisObjects.push(data);
}
this.dragging = false;
}
// noinspection JSMethodCanBeStatic
setColumns(cols: number) {
switch (cols) {
case 1:
return 'col-1';
case 2:
return 'col-2';
case 3:
return 'col-3';
case 4:
return 'col-4';
case 5:
return 'col-5';
}
}
private closeObject(uid: number) {
this.synopsisObjects = this.synopsisObjects.filter(x => x.uid !== uid);
}
private makeSnapshot() {
this.synopsisObjectSerializerService.sendLightTableSnapshot(this.synopsisObjects);
}
private load(snapshot: SynopsisObjectData[]) {
this.synopsisObjects = snapshot;
}
private updateInversion(uid: number) {
const index = this.synopsisObjects.findIndex(x => x.uid === uid);
this.synopsisObjects[index].invertedColors = !this.synopsisObjects[index].invertedColors;
}
private closeObjectsById(id: string) {
this.synopsisObjects = this.synopsisObjects.filter(x => x.id !== id);
}
}
</code></pre>
</div>
<div class="tab-pane fade " id="c-templateData">
<pre class="line-numbers"><code class="language-html"><div class="drop-target">
<div id="container" [ngClass]="setColumns(columns)">
<div class="tile" appTileDropTarget (appDrop)="onDrop($event, i)"
*ngFor="let obj of synopsisObjects; let i = index;">
<ng-container [ngSwitch]="obj.dataType">
<app-tiled-text-object *ngSwitchCase="synopsisObjectTypes.Text" [data]="obj"
class="object-container"></app-tiled-text-object>
<app-tiled-image-object *ngSwitchCase="synopsisObjectTypes.Image" [data]="obj" class="object-container">
</app-tiled-image-object>
</ng-container>
</div>
<div class="tile" appTileDropTarget (appDrop)="onDrop($event)" id="new-drop-zone"
*ngIf="dragging">
<div class="object-container" style="height:50vh"></div>
</div>
</div>
</div>
</code></pre>
</div>
<div class="tab-pane fade " id="c-styleData">
<p class="comment">
<code>./tiled-light-table.component.scss</code>
</p>
<pre class="line-numbers"><code class="language-scss">.drop-target {
margin: 2px;
padding: 0;
width: 100%;
height: 100vh;
}
.tile {
position: relative;
border: 1px solid lightgrey;
}
#new-drop-zone {
background-color: #f5f5f5;
border: 3px dashed lightgray;
resize: none;
}
#container {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr;
grid-column-gap: 5px;
grid-row-gap: 5px;
}
.col-1 {
grid-template-columns: 1fr !important;
}
.col-2 {
grid-template-columns: 1fr 1fr !important;
}
.col-3 {
grid-template-columns: 1fr 1fr 1fr !important;
}
.col-4 {
grid-template-columns: 1fr 1fr 1fr 1fr !important;
}
.col-5 {
grid-template-columns: 1fr 1fr 1fr 1fr 1fr !important;
}
.overlay {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 130px;
height: 50px;
min-width: 130px;
min-height: 50px;
z-index: 10;
background-color: lightgray;
border: 2px solid gray;
border-radius: 3px;
text-align: center;
font-family: sans-serif;
color: darkgray;
font-weight: 900;
font-size: 120%;
opacity: 1;
pointer-events: none;
}
.overlay p {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.object-container {
height: 100%;
min-height: 100%;
width: 100%;
min-width: 100%;
}
</code></pre>
</div>
<div class="tab-pane fade " id="c-tree">
<div id="tree-container"></div>
<div class="tree-legend">
<div class="title">
<b>Legend</b>
</div>
<div>
<div class="color htmlelement"></div><span>Html element</span>
</div>
<div>
<div class="color component"></div><span>Component</span>
</div>
<div>
<div class="color directive"></div><span>Html element with directive</span>
</div>
</div>
</div>
</div>
<script src="../js/libs/vis.min.js"></script>
<script src="../js/libs/htmlparser.js"></script>
<script src="../js/libs/deep-iterator.js"></script>
<script>
var COMPONENT_TEMPLATE = '<div><div class="drop-target"> <div id="container" [ngClass]="setColumns(columns)"> <div class="tile" appTileDropTarget (appDrop)="onDrop($event, i)" *ngFor="let obj of synopsisObjects; let i = index;"> <ng-container [ngSwitch]="obj.dataType"> <app-tiled-text-object *ngSwitchCase="synopsisObjectTypes.Text" [data]="obj" class="object-container"></app-tiled-text-object> <app-tiled-image-object *ngSwitchCase="synopsisObjectTypes.Image" [data]="obj" class="object-container"> </app-tiled-image-object> </ng-container> </div> <div class="tile" appTileDropTarget (appDrop)="onDrop($event)" id="new-drop-zone" *ngIf="dragging"> <div class="object-container" style="height:50vh"></div> </div> </div></div></div>'
var COMPONENTS = [{'name': 'AddAppGroupDialogComponent', 'selector': 'app-add-app-group-dialog'},{'name': 'AllAppSelectorsComponent', 'selector': 'app-all-app-selectors'},{'name': 'AngularHandsometableComponent', 'selector': 'app-angular-handsometable'},{'name': 'AppComponent', 'selector': 'app-root'},{'name': 'AppInputComponentComponent', 'selector': 'app-app-input-component'},{'name': 'AudioPlayerComponent', 'selector': 'app-audio-player'},{'name': 'BarChartComponent', 'selector': 'app-bar-chart'},{'name': 'BrowserlingComponent', 'selector': 'app-browserling'},{'name': 'BrushAndZoomComponent', 'selector': 'app-brush-and-zoom'},{'name': 'CalendarComponent', 'selector': 'app-calendar'},{'name': 'CanvasWhiteboardComponent', 'selector': 'app-canvas-whiteboard'},{'name': 'ChordDiagramComponent', 'selector': 'app-chord-diagram'},{'name': 'CommentOnIndicesComponent', 'selector': 'app-comment-on-indices'},{'name': 'CrisprComponent', 'selector': 'app-crispr'},{'name': 'D3tutorialComponent', 'selector': 'app-d3tutorial'},{'name': 'DashboardComponent', 'selector': 'app-dashboard'},{'name': 'DataAssignmentComponent', 'selector': 'app-data-assignment'},{'name': 'DataChooserComponent', 'selector': 'app-data-chooser'},{'name': 'DataListViewComponent', 'selector': 'data-list-view'},{'name': 'DataListViewSettingsComponent', 'selector': 'data-list-view-settings'},{'name': 'DataListViewTableComponent', 'selector': 'data-list-view-table'},{'name': 'DataManagementComponent', 'selector': 'app-data-management'},{'name': 'DeactivateNewsletterComponent', 'selector': 'app-deactivate-newsletter'},{'name': 'DeleteActionComponent', 'selector': 'app-delete-action'},{'name': 'DeletePageComponent', 'selector': 'app-delete-page'},{'name': 'DialogCreateNewPageComponent', 'selector': 'dialog-create-new-page'},{'name': 'DialogOverviewExampleDialog', 'selector': 'dialog-overview-example-dialog'},{'name': 'DialogUserSettingsDialog', 'selector': 'dialog-user-settings-dialog'},{'name': 'DictionaryComponent', 'selector': 'app-dictionary'},{'name': 'DuplicatePageComponent', 'selector': 'app-duplicate-page'},{'name': 'EditActionComponent', 'selector': 'app-edit-action'},{'name': 'EditPageComponent', 'selector': 'app-edit-page'},{'name': 'EditPageSetComponent', 'selector': 'app-update-page-set'},{'name': 'ExtendSessionComponent', 'selector': 'session-component'},{'name': 'FileListDialogComponent', 'selector': 'app-file-list-dialog'},{'name': 'FloatingImageObjectComponent', 'selector': 'app-floating-image-object'},{'name': 'FloatingTextObjectComponent', 'selector': 'app-floating-text-object'},{'name': 'FloatLightTableComponent', 'selector': 'app-float-light-table'},{'name': 'Frame', 'selector': 'popup'},{'name': 'FrameSettingsComponent', 'selector': 'app-frame-settings'},{'name': 'GndLobidComponent', 'selector': 'app-gnd-lobid'},{'name': 'GrapesjsComponent', 'selector': 'app-grapesjs'},{'name': 'GroupedBarChartV2Component', 'selector': 'app-grouped-bar-chart-v2'},{'name': 'HeaderComponent', 'selector': 'app-header'},{'name': 'HierarchicalNavigationNodeComponent', 'selector': 'app-hierarchical-navigation-node'},{'name': 'HierarchicalNavigationRootComponent', 'selector': 'app-hierarchical-navigation-root'},{'name': 'HierarchicalNavigationViewComponent', 'selector': 'app-hierarchical-navigation-view'},{'name': 'HomeComponent', 'selector': 'app-home'},{'name': 'HtmlViewerComponent', 'selector': 'app-html-viewer'},{'name': 'HtmlViewerInnerhtmlComponent', 'selector': 'app-html-viewer-innerhtml'},{'name': 'IframeComponent', 'selector': 'app-iframe'},{'name': 'ImageWithOverlayComponent', 'selector': 'app-image-with-overlay'},{'name': 'ImpressumComponent', 'selector': 'app-impressum'},{'name': 'InitPopupComponent', 'selector': 'app-init-popup'},{'name': 'JoinedTextBlockComponent', 'selector': 'app-joined-text-block'},{'name': 'JoinedTextInnerhtmlComponent', 'selector': 'app-joined-text-innerhtml'},{'name': 'JoinedTextLineComponent', 'selector': 'app-joined-text-line'},{'name': 'JoinedTextLinepartComponent', 'selector': 'app-joined-text-linepart'},{'name': 'JoinedTextMarginComponent', 'selector': 'app-joined-text-margin'},{'name': 'JoinedTextTextwrapperComponent', 'selector': 'app-joined-text-textwrapper'},{'name': 'JoinedTextViewComponent', 'selector': 'app-joined-text-view'},{'name': 'KeyValueComponent', 'selector': 'app-key-value'},{'name': 'KeyValueFormComponent', 'selector': 'app-key-value-form'},{'name': 'KnoraV2ViewerComponent', 'selector': 'app-knora-v2-viewer'},{'name': 'KnoraV2ViewerInnerhtmlComponent', 'selector': 'app-knora-v2-viewer-innerhtml'},{'name': 'LeafletExampleComponent', 'selector': 'app-leaflet-example'},{'name': 'LightTableComponent', 'selector': 'app-light-table'},{'name': 'LightTableMenuComponent', 'selector': 'app-light-table-menu'},{'name': 'LoadLightTableComponent', 'selector': 'app-load-light-table'},{'name': 'LoadVariablesComponent', 'selector': 'app-load-variables'},{'name': 'MachineReasoningComponent', 'selector': 'app-machine-reasoning'},{'name': 'MainComponent', 'selector': 'app-main'},{'name': 'MatCardComponent', 'selector': 'app-mat-card'},{'name': 'MinimizePasswordDialog', 'selector': 'minimize-password-dialog'},{'name': 'MultiLineChartComponent', 'selector': 'app-multi-line-chart'},{'name': 'MyFilesComponent', 'selector': 'app-my-files'},{'name': 'MyMainComponentComponent', 'selector': 'app-my-main-component'},{'name': 'MyPractiseComponentComponent', 'selector': 'app-my-practise-component'},{'name': 'NavigationComponent', 'selector': 'app-navigation'},{'name': 'NavigationComponent', 'selector': 'app-navigation'},{'name': 'NavigationComponent', 'selector': 'app-navigation'},{'name': 'NestedMenu', 'selector': 'app-nested-menu'},{'name': 'NewGjsBoxDialogComponent', 'selector': 'app-new-gjs-box-dialog'},{'name': 'OpenbisLoginComponent', 'selector': 'app-openbis-login'},{'name': 'OurDemoAppComponent', 'selector': 'app-our-demo-app'},{'name': 'OurNewComponentComponent', 'selector': 'app-our-new-component'},{'name': 'PageComponent', 'selector': 'nie-os'},{'name': 'PageListDialogComponent', 'selector': 'app-page-list-dialog'},{'name': 'PageNotFoundComponent', 'selector': 'app-page-not-found'},{'name': 'PageSetLandingPageComponent', 'selector': 'app-page-set-landing-page'},{'name': 'ParzivalFassungComponent', 'selector': 'app-parzival-fassung'},{'name': 'PdfViewerComponent', 'selector': 'app-pdf-viewer'},{'name': 'PieChartComponent', 'selector': 'app-pie-chart'},{'name': 'PieChartV2Component', 'selector': 'app-pie-chart-v2'},{'name': 'PizzaPartyComponent', 'selector': 'snack-bar-component-example-snack'},{'name': 'PrimeEditorComponent', 'selector': 'app-prime-editor'},{'name': 'PythonEnvironmentComponent', 'selector': 'app-python-environment'},{'name': 'QueryAppInputMapComponent', 'selector': 'app-query-app-input-map'},{'name': 'QueryEntryComponent', 'selector': 'app-query-entry'},{'name': 'QueryInformationDialogComponent', 'selector': 'app-query-information-dialog'},{'name': 'QueryListComponent', 'selector': 'app-query-list'},{'name': 'RadialBarchartComponent', 'selector': 'app-radial-barchart'},{'name': 'RaeberNavigationComponent', 'selector': 'app-raeber-navigation'},{'name': 'ReactivateAccountComponent', 'selector': 'app-reactivate-account'},{'name': 'RegisterComponent', 'selector': 'app-register'},{'name': 'RemoveObjectsByIdComponent', 'selector': 'app-remove-objects-by-id'},{'name': 'ResetPasswordComponent', 'selector': 'app-reset-password'},{'name': 'ResponseTreeAppComponent', 'selector': 'response-tree'},{'name': 'ResponseTreeComponent', 'selector': 'app-response-tree'},{'name': 'SankeyComponent', 'selector': 'app-sankey'},{'name': 'SaveLightTableComponent', 'selector': 'app-save-light-table'},{'name': 'ShareLightTableComponent', 'selector': 'app-share-light-table'},{'name': 'SimpleImageAppComponent', 'selector': 'app-simple-image-app'},{'name': 'SpiralBarChartComponent', 'selector': 'app-spiral-bar-chart'},{'name': 'StackedBarChartComponent', 'selector': 'app-stacked-bar-chart'},{'name': 'SubPageListComponent', 'selector': 'app-sub-page-list'},{'name': 'SynopsisComponent', 'selector': 'app-synopsis'},{'name': 'SynopsisObjectManagerComponent', 'selector': 'app-synopsis-object-manager'},{'name': 'SynopsisObjectToolboxComponent', 'selector': 'app-synopsis-object-toolbox'},{'name': 'TextDisplayComponent', 'selector': 'app-text-display'},{'name': 'TextDisplayComponent', 'selector': 'app-text-display'},{'name': 'TextLineComponent', 'selector': 'app-text-line'},{'name': 'TextLineMarginComponent', 'selector': 'app-text-line-margin'},{'name': 'TextlistViewerComponent', 'selector': 'app-textlist-viewer'},{'name': 'TextPageOfWordsComponent', 'selector': 'app-text-page-of-words'},{'name': 'TextRichInnerhtmlComponent', 'selector': 'app-text-rich-innerhtml'},{'name': 'TextSvgViewComponent', 'selector': 'app-text-svg-view'},{'name': 'TextSvgViewWrapperComponent', 'selector': 'app-text-svg-view-wrapper'},{'name': 'TextViewCanvasComponent', 'selector': 'app-text-view-canvas'},{'name': 'TextViewComponent', 'selector': 'app-text-view'},{'name': 'TextViewMetadataComponent', 'selector': 'app-text-view-metadata'},{'name': 'TextViewStructureComponent', 'selector': 'app-text-view-structure'},{'name': 'TextViewToolsComponent', 'selector': 'app-text-view-tools'},{'name': 'ThumbnailbarComponent', 'selector': 'app-thumbnailbar'},{'name': 'TiledImageObjectComponent', 'selector': 'app-tiled-image-object'},{'name': 'TiledLightTableComponent', 'selector': 'app-tiled-light-table'},{'name': 'TiledTextObjectComponent', 'selector': 'app-tiled-text-object'},{'name': 'TreeNavigationComponent', 'selector': 'app-tree-navigation'},{'name': 'UrlParamUpdaterComponent', 'selector': 'app-url-param-updater'},{'name': 'UserGroupComponent', 'selector': 'app-user-group'},{'name': 'YoutubeVideoComponent', 'selector': 'app-youtube-video'}];
var DIRECTIVES = [{'name': 'DraggableDirective', 'selector': '[appDraggable]'},{'name': 'DraggableStubDirective', 'selector': '[appDraggable]'},{'name': 'FloatDropTargetDirective', 'selector': '[appDropTarget]'},{'name': 'ModifiableDirective', 'selector': '[appModifiable]'},{'name': 'ModifiableStubDirective', 'selector': '[appModifiable]'},{'name': 'SelectableDirective', 'selector': '[appSelectable]'},{'name': 'SelectableStubDirective', 'selector': '[appSelectable]'},{'name': 'SynopsisObjectAnchorDirective', 'selector': '[appSynopsisObjectAnchor]'},{'name': 'TileDropTargetDirective', 'selector': '[appTileDropTarget]'}];
var ACTUAL_COMPONENT = {'name': 'TiledLightTableComponent'};
</script>
<script src="../js/tree.js"></script>
</div><div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> result-matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
<!-- END CONTENT -->
</div>
</div>
<script>
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
var COMPODOC_CURRENT_PAGE_CONTEXT = 'component';
var COMPODOC_CURRENT_PAGE_URL = 'TiledLightTableComponent.html';
var MAX_SEARCH_RESULTS = 15;
</script>
<script src="../js/libs/custom-elements.min.js"></script>
<script src="../js/libs/lit-html.js"></script>
<!-- Required to polyfill modern browsers as code is ES5 for IE... -->
<script src="../js/libs/custom-elements-es5-adapter.js" charset="utf-8" defer></script>
<script src="../js/menu-wc.js" defer></script>
<script src="../js/libs/bootstrap-native.js"></script>
<script src="../js/libs/es6-shim.min.js"></script>
<script src="../js/libs/EventDispatcher.js"></script>
<script src="../js/libs/promise.min.js"></script>
<script src="../js/libs/zepto.min.js"></script>
<script src="../js/compodoc.js"></script>
<script src="../js/tabs.js"></script>
<script src="../js/menu.js"></script>
<script src="../js/libs/clipboard.min.js"></script>
<script src="../js/libs/prism.js"></script>
<script src="../js/sourceCode.js"></script>
<script src="../js/search/search.js"></script>
<script src="../js/search/lunr.min.js"></script>
<script src="../js/search/search-lunr.js"></script>
<script src="../js/search/search_index.js"></script>
<script src="../js/lazy-load-graphs.js"></script>
</body>
</html>
| 45.940299 | 9,869 | 0.445449 |
1f0197ae01ca743df9b41c82f45779857fa6a0e5 | 3,196 | asm | Assembly | programs/oeis/016/A016972.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/016/A016972.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/016/A016972.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A016972: a(n) = (6*n + 5)^4.
; 625,14641,83521,279841,707281,1500625,2825761,4879681,7890481,12117361,17850625,25411681,35153041,47458321,62742241,81450625,104060401,131079601,163047361,200533921,244140625,294499921,352275361,418161601,492884401,577200625,671898241,777796321,895745041,1026625681,1171350625,1330863361,1506138481,1698181681,1908029761,2136750625,2385443281,2655237841,2947295521,3262808641,3603000625,3969126001,4362470401,4784350561,5236114321,5719140625,6234839521,6784652161,7370050801,7992538801,8653650625,9354951841,10098039121,10884540241,11716114081,12594450625,13521270961,14498327281,15527402881,16610312161,17748900625,18945044881,20200652641,21517662721,22898045041,24343800625,25856961601,27439591201,29093783761,30821664721,32625390625,34507149121,36469158961,38513670001,40642963201,42859350625,45165175441,47562811921,50054665441,52643172481,55330800625,58120048561,61013446081,64013554081,67122964561,70344300625,73680216481,77133397441,80706559921,84402451441,88223850625,92173567201,96254442001,100469346961,104821185121,109312890625,113947428721,118727795761,123657019201,128738157601,133974300625,139368569041,144924114721,150644120641,156531800881,162590400625,168823196161,175233494881,181824635281,188599986961,195562950625,202716958081,210065472241,217611987121,225360027841,233313150625,241474942801,249849022801,258439040161,267248675521,276281640625,285541678321,295032562561,304758098401,314722122001,324928500625,335381132641,346083947521,357040905841,368255999281,379733250625,391476713761,403490473681,415778646481,428345379361,441194850625,454331269681,467758877041,481481944321,495504774241,509831700625,524467088401,539415333601,554680863361,570268135921,586181640625,602425897921,619005459361,635924907601,653188856401,670801950625,688768866241,707094310321,725783021041,744839767681,764269350625,784076601361,804266382481,824843587681,845813141761,867180000625,888949151281,911125611841,933714431521,956720690641,980149500625,1004006004001,1028295374401,1053022816561,1078193566321,1103812890625,1129886087521,1156418486161,1183415446801,1210882360801,1238824650625,1267247769841,1296157203121,1325558466241,1355457106081,1385858700625,1416768858961,1448193221281,1480137458881,1512607274161,1545608400625,1579146602881,1613227676641,1647857448721,1683041777041,1718786550625,1755097689601,1791981145201,1829442899761,1867488966721,1906125390625,1945358247121,1985193642961,2025637716001,2066696635201,2108376600625,2150683843441,2193624625921,2237205241441,2281432014481,2326311300625,2371849486561,2418052990081,2464928260081,2512481776561,2560720050625,2609649624481,2659277071441,2709608995921,2760652033441,2812412850625,2864898145201,2918114646001,2972069112961,3026768337121,3082219140625,3138428376721,3195402929761,3253149715201,3311675679601,3370987800625,3431093087041,3491998578721,3553711346641,3616238492881,3679587150625,3743764484161,3808777688881,3874633991281,3941340648961,4008904950625,4077334216081,4146635796241,4216817073121,4287885459841,4359848400625,4432713370801,4506487876801,4581179456161,4656795677521,4733344140625,4810832476321,4889268346561,4968659444401,5049013494001
mul $0,6
add $0,5
pow $0,4
mov $1,$0
| 399.5 | 3,126 | 0.909887 |
1a0123c6569437133ba3d8f84e7957da4ee2c7a9 | 5,347 | asm | Assembly | graphics.asm | andwj/2048-2600 | da8fabc050525ae66e8f5fbe1799e52deb057206 | [
"MIT"
] | 34 | 2015-01-08T19:25:06.000Z | 2022-01-26T21:34:55.000Z | graphics.asm | andwj/2048-2600 | da8fabc050525ae66e8f5fbe1799e52deb057206 | [
"MIT"
] | null | null | null | graphics.asm | andwj/2048-2600 | da8fabc050525ae66e8f5fbe1799e52deb057206 | [
"MIT"
] | 3 | 2018-04-15T09:07:17.000Z | 2021-05-12T18:12:26.000Z |
;;;;;;;;;;;;;;
;; GRAPHICS ;;
;;;;;;;;;;;;;;
; Tiles are 8 x 11 to partially compensate for
; Atari's pixel ratio (approx. 1.66:1)
;
; Actually, the value-colored kernel can't really
; update the rightmost pixel on the first tile, so
; if you want to roll your own tiles...
;
; ┌─── ...don't set THIS bit
; ↓;
Tiles:
.BYTE %11111111
.BYTE %11111111
.BYTE %11111111
.BYTE %11111111
.BYTE %11111111
.BYTE %11111111
.BYTE %11111111
.BYTE %11111111
.BYTE %11111111
.BYTE %11111111
.BYTE %11111111
.BYTE %11111111
.BYTE %10000001
.BYTE %10000001
.BYTE %10011111
.BYTE %10011111
.BYTE %10000001
.BYTE %10000001
.BYTE %11111001
.BYTE %10000001
.BYTE %10000001
.BYTE %11111111
.BYTE %11111111
.BYTE %11111001
.BYTE %11111001
.BYTE %11111001
.BYTE %11111001
.BYTE %10000001
.BYTE %10000001
.BYTE %10011001
.BYTE %10011001
.BYTE %10011001
.BYTE %11111111
.BYTE %11111111
.BYTE %11000011
.BYTE %10011001
.BYTE %10011001
.BYTE %10011001
.BYTE %11000011
.BYTE %11000011
.BYTE %10011001
.BYTE %10011001
.BYTE %11000011
.BYTE %11111111
.BYTE %11111111
.BYTE %11010001
.BYTE %11010101
.BYTE %11010101
.BYTE %11010101
.BYTE %11010001
.BYTE %11010111
.BYTE %11010111
.BYTE %11010111
.BYTE %11010111
.BYTE %11111111
.BYTE %11111111
.BYTE %11001001
.BYTE %11101011
.BYTE %11101011
.BYTE %11101011
.BYTE %11001001
.BYTE %11101101
.BYTE %11101101
.BYTE %11101101
.BYTE %11001001
.BYTE %11111111
.BYTE %11111111
.BYTE %10001101
.BYTE %10101101
.BYTE %10101101
.BYTE %10101101
.BYTE %10001101
.BYTE %10110001
.BYTE %10110101
.BYTE %10110101
.BYTE %10110101
.BYTE %11111111
.BYTE %00010001
.BYTE %01110101
.BYTE %00010001
.BYTE %11010101
.BYTE %00010001
.BYTE %11111111
.BYTE %11111101
.BYTE %11111101
.BYTE %11111101
.BYTE %11111101
.BYTE %11111101
.BYTE %00010001
.BYTE %11010101
.BYTE %00010001
.BYTE %01110111
.BYTE %00010111
.BYTE %11111111
.BYTE %11110001
.BYTE %11110111
.BYTE %11110001
.BYTE %11111101
.BYTE %11110001
.BYTE %11010001
.BYTE %11010111
.BYTE %11010001
.BYTE %11011101
.BYTE %11010001
.BYTE %11111111
.BYTE %11110001
.BYTE %11111101
.BYTE %11110001
.BYTE %11110111
.BYTE %11110001
.BYTE %00011101
.BYTE %01111101
.BYTE %00010001
.BYTE %11010101
.BYTE %00010101
.BYTE %11111111
.BYTE %11010001
.BYTE %11010101
.BYTE %11010101
.BYTE %11010101
.BYTE %11010001
.BYTE %11010001
.BYTE %11010101
.BYTE %00010001
.BYTE %01010101
.BYTE %01010001
.BYTE %11111111
.BYTE %00010001
.BYTE %01110101
.BYTE %00010101
.BYTE %11010101
.BYTE %00010001
.BYTE %11010001
.BYTE %11010101
.BYTE %00010001
.BYTE %01010111
.BYTE %00010111
.BYTE %11111111
.BYTE %11010001
.BYTE %11010101
.BYTE %00010101
.BYTE %01010101
.BYTE %01010001
.BYTE %11010001
.BYTE %11010111
.BYTE %00010001
.BYTE %01011101
.BYTE %00010001
.BYTE %11111111
.BYTE %10001011
.BYTE %10101011
.BYTE %10001011
.BYTE %10101011
.BYTE %10001011
TitleScreenTiles:
.BYTE %11111111
.BYTE %11000011
.BYTE %10011001
.BYTE %10011001
.BYTE %10011001
.BYTE %10011001
.BYTE %10011001
.BYTE %10011001
.BYTE %10011001
.BYTE %11000011
.BYTE %11111111
.BYTE %11111111
.BYTE %11000011
.BYTE %10011001
.BYTE %10011001
.BYTE %10011001
.BYTE %10000001
.BYTE %10000011
.BYTE %10011111
.BYTE %10011001
.BYTE %11000011
.BYTE %11111111
.BYTE %01101010
.BYTE %01001010
.BYTE %01101100
.BYTE %01001010
.BYTE %01101110
.BYTE %00000000
.BYTE %11010101
.BYTE %10010101
.BYTE %10011101
.BYTE %10010101
.BYTE %11010101
.BYTE %11101010
.BYTE %10101010
.BYTE %11001100
.BYTE %10101010
.BYTE %11101110
.BYTE %00000000
.BYTE %10110010
.BYTE %00010010
.BYTE %10110010
.BYTE %00100010
.BYTE %10110111
Digits:
.BYTE %01111110
.BYTE %01100110
.BYTE %01100110
.BYTE %01100110
.BYTE %01111110
.BYTE %01111110
.BYTE %00011000
.BYTE %00011000
.BYTE %01111000
.BYTE %00011000
.BYTE %01111110
.BYTE %01100000
.BYTE %01111110
.BYTE %00000110
.BYTE %01111110
.BYTE %01111110
.BYTE %00000110
.BYTE %00011110
.BYTE %00000110
.BYTE %01111110
.BYTE %00000110
.BYTE %00000110
.BYTE %01111110
.BYTE %01100110
.BYTE %01100110
.BYTE %01111110
.BYTE %00000110
.BYTE %01111110
.BYTE %01100000
.BYTE %01111110
.BYTE %01111110
.BYTE %01100110
.BYTE %01111110
.BYTE %01100000
.BYTE %01111110
.BYTE %00000110
.BYTE %00000110
.BYTE %00000110
.BYTE %00000110
.BYTE %01111110
.BYTE %01111110
.BYTE %01100110
.BYTE %01111110
.BYTE %01100110
.BYTE %01111110
.BYTE %01111110
.BYTE %00000110
.BYTE %01111110
.BYTE %01100110
.BYTE %01111110
| 18.064189 | 50 | 0.59697 |
afb99bdf8147c414082e22c8fe8f9f7ed3425943 | 13,998 | html | HTML | news/index.html | ropensci-docs/tiler | 1700fc45710aed122dab74ee79f41378293dba8e | [
"MIT"
] | null | null | null | news/index.html | ropensci-docs/tiler | 1700fc45710aed122dab74ee79f41378293dba8e | [
"MIT"
] | 1 | 2019-11-20T01:39:16.000Z | 2019-11-20T01:39:16.000Z | news/index.html | ropensci-docs/tiler | 1700fc45710aed122dab74ee79f41378293dba8e | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Changelog • rOpenSci: tiler</title><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="/apple-touch-icon.png"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.1.0/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.1.0/bootstrap.bundle.min.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- bootstrap-toc --><script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.js"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Changelog"><meta property="og:image" content="https://docs.ropensci.org/tiler/logo.png"><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--><!-- Matomo --><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.css"><script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script><script src="https://ropensci.org/scripts/matomo.js"></script><noscript><p><img src="https://ropensci.matomo.cloud/matomo.php?idsite=1&rec=1" style="border:0;" alt=""></p></noscript><!-- End Matomo Code --></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar fixed-top navbar-light navbar-expand-lg bg-light"><div class="container">
<a href="https://ropensci.org" class="external-link"><img src="https://ropensci.org/img/icon_short_white.svg" id="hexlogo" alt="rOpenSci"></a>
<a class="navbar-brand me-2" href="../index.html">rOpenSci: tiler</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Released version">0.2.5</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-2">
<ul class="navbar-nav me-auto"></ul><form class="form-inline my-2 my-lg-0" role="search">
<input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../search.json" id="search-input" placeholder="Search for" autocomplete="off"></form>
<ul class="navbar-nav"><li class="nav-item">
<a class="external-link nav-link" href="https://github.com/leonawicz/tiler">
<span class="fa fa-github fa-lg"></span>
</a>
</li>
</ul></div>
</div>
</nav><div class="container template-news">
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.png" class="logo" alt=""><h1>Changelog</h1>
<small>Source: <a href="https://github.com/ropensci/tiler/blob/HEAD/NEWS.md" class="external-link"><code>NEWS.md</code></a></small>
</div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.2.5" id="tiler-025">tiler 0.2.5<a class="anchor" aria-label="anchor" href="#tiler-025"></a></h2><p class="text-muted">CRAN release: 2021-02-20</p>
<ul><li>Documentation updates.</li>
</ul></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.2.4" id="tiler-024">tiler 0.2.4<a class="anchor" aria-label="anchor" href="#tiler-024"></a></h2><p class="text-muted">CRAN release: 2019-11-26</p>
<ul><li>Precompiling of vignette depending on external data.</li>
</ul></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.2.3" id="tiler-023">tiler 0.2.3<a class="anchor" aria-label="anchor" href="#tiler-023"></a></h2><p class="text-muted">CRAN release: 2019-11-22</p>
<ul><li>Minor fixes for CRAN release.</li>
</ul></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.2.2" id="tiler-022">tiler 0.2.2<a class="anchor" aria-label="anchor" href="#tiler-022"></a></h2>
<ul><li>Breaking change: no longer using a <code>format</code> argument. All tiles are TMS.</li>
<li>Updated <code>gdal2tiles</code> to version 2.4 release.</li>
<li>Bug fix.</li>
<li>Updated documentation.</li>
</ul></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.2.1" id="tiler-021">tiler 0.2.1<a class="anchor" aria-label="anchor" href="#tiler-021"></a></h2><p class="text-muted">CRAN release: 2018-11-18</p>
<ul><li>Improved and simplified instructions and expectations for Windows use. Windows users must add <code>OSGeo4W.bat</code> path to system path.</li>
<li>Added <code>leaflet</code> examples of remotely hosted tiles generated by <code>tiler</code> to vignette.</li>
<li>Bug fix related to system path to <code>OSGeo4W.bat</code> being ignored on Windows.</li>
</ul></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.2.0" id="tiler-020">tiler 0.2.0<a class="anchor" aria-label="anchor" href="#tiler-020"></a></h2><p class="text-muted">CRAN release: 2018-06-09</p>
<ul><li>All three <code>gdal2tiles*</code> scripts have been updated to accept a command line argument when called by R that provides a path for any temporary files, i.e., <code>tmp.*.vrt</code> files created by the <code>gdal2tiles*</code> scripts. These were previously accumulating in the system temp folder. The new temporary directory is a sub-directory inside <code><a href="https://rdrr.io/r/base/tempfile.html" class="external-link">tempdir()</a></code>. Therefore, it is cleaned up when exiting R. Nevertheless, <code>tile</code> also force deletes this subdirectory immediately after its internal system call to one of the <code>gdal2tiles*</code> scripts returns, so the temporary sub-directory does not even exist for the full duration of the <code>tile</code> call.</li>
<li>Added functions <code>tile_viewer</code> and <code>view_tiles</code> and other supporting functions for generating HTML Leaflet tile preview web page.</li>
<li>Added arguments to <code>tile</code>. <code>tile</code> now generates previewer by default.</li>
<li>Added unit tests.</li>
<li>Updated vignette.</li>
</ul></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.1.6" id="tiler-016">tiler 0.1.6<a class="anchor" aria-label="anchor" href="#tiler-016"></a></h2><p class="text-muted">CRAN release: 2018-06-06</p>
<ul><li>Made minor formatting changes per CRAN request for resubmission.</li>
</ul></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.1.5" id="tiler-015">tiler 0.1.5<a class="anchor" aria-label="anchor" href="#tiler-015"></a></h2>
<ul><li>Refactored <code>tile</code>, added arguments including <code>resume</code> and <code>format</code>, changed some argument names.</li>
<li>Added default support for XYZ format tiles in addition to TMS. This brings in another version of <code>gdal2tiles</code>.</li>
<li>Updated documentation.</li>
<li>Added unit tests.</li>
</ul></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.1.0" id="tiler-010">tiler 0.1.0<a class="anchor" aria-label="anchor" href="#tiler-010"></a></h2>
<ul><li>Created <code>tile</code> function for generating map tiles from geographic or non-geographic maps/images.</li>
<li>Created readme with basic example.</li>
<li>Added initial introduction vignette.</li>
<li>Added robust unit tests and other external examples and spot testing of edge cases.</li>
</ul></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.0.0.9000" id="tiler-0009000">tiler 0.0.0.9000<a class="anchor" aria-label="anchor" href="#tiler-0009000"></a></h2>
<ul><li>Added initial package scaffolding.</li>
</ul></div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>
</nav></aside></div>
<footer><!-- begin footer --><div class="footer">
<div class="container">
<div class="row start top-4 bottom-8">
<div class="col-2"> <img id="footerlogo" src="https://ropensci.org/img/icon_short_white.svg"></div>
<div class="col-10">
<div class="row">
<div class="col-md-4 col-xs-6">
<a href="https://github.com/ropensci" target="_blank" class="external-link"><div class="icon fab fa-github"></div></a>
<a href="https://github.com/ropenscilabs" target="_blank" class="external-link"><div class="icon fa fa-flask"></div></a>
<a href="https://twitter.com/ropensci" target="_blank" class="external-link"><div class="icon fab fa-twitter"></div></a>
<a href="https://vimeo.com/ropensci" target="_blank" class="external-link"><div class="icon fab fa-vimeo"></div></a>
</div>
</div>
<div class="row top-4">
<div class="col-md-2 col-sm-4">
<ul><h5 class="bottom-2">About</h5>
<li><a href="https://ropensci.org/about" class="external-link">About rOpenSci</a></li>
<li><a href="https://ropensci.org/software-review" class="external-link">Software Review</a></li>
<li><a href="https://ropensci.org/about#team" class="external-link">Our Team</a></li>
<li><a href="https://ropensci.org/careers" class="external-link">Jobs</a></li>
<li><a href="https://ropensci.org/donate" class="external-link">Donate</a></li>
<li><a href="https://ropensci.org/contact" class="external-link">Contact Us</a></li>
</ul></div>
<div class="col-md-3 col-sm-4">
<ul><h5 class="bottom-2">Community</h5>
<li><a href="https://ropensci.org/community/" class="external-link">Our Community</a></li>
<li><a href="https://ropensci.org/commcalls/" class="external-link">Community calls</a></li>
<li><a href="https://ropensci.org/events/" class="external-link">Events</a></li>
<li><a href="https://discuss.ropensci.org/" class="external-link">Join the Discussion</a></li>
<li><a href="https://ropensci.org/code-of-conduct" class="external-link">Code of conduct</a></li>
</ul></div>
<div class="col-md-2 col-sm-4">
<ul><h5 class="bottom-2">Resources</h5>
<li><a href="https://ropensci.org/packages/" class="external-link">Packages</a></li>
<li><a href="https://ropensci.org/usecases/" class="external-link">Use Cases</a></li>
<li><a href="https://ropensci.org/talks-papers/" class="external-link">Talks & Publications</a></li>
<li><a href="https://docs.ropensci.org/" class="external-link">Documentation</a></li>
<li><a href="https://ropensci.org/news/" class="external-link">Newsletter</a></li>
<li><a href="https://ropensci.org/how-to-cite-ropensci/" class="external-link">Cite rOpenSci</a></li>
</ul></div>
<div class="col-md-4 col-xs-12">
<h5 class="bottom-2"></h5>
<p>rOpenSci is a fiscally sponsored project of <a href="http://numfocus.org" class="external-link">NumFOCUS</a>.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- / end footer -->
</footer></div>
</body></html>
| 86.407407 | 2,900 | 0.654594 |
4f64fd15ecee0e57e88518dc2d0c42cd61190bcb | 1,115 | swift | Swift | Tests/OpenCombineTests/AnyPublisherTests.swift | FranzBusch/OpenCombine | 03fe398395a1d8487de5edc365ef733cf0992447 | [
"MIT"
] | null | null | null | Tests/OpenCombineTests/AnyPublisherTests.swift | FranzBusch/OpenCombine | 03fe398395a1d8487de5edc365ef733cf0992447 | [
"MIT"
] | null | null | null | Tests/OpenCombineTests/AnyPublisherTests.swift | FranzBusch/OpenCombine | 03fe398395a1d8487de5edc365ef733cf0992447 | [
"MIT"
] | null | null | null | //
// AnyPublisherTests.swift
//
//
// Created by Sergej Jaskiewicz on 16.06.2019.
//
import XCTest
#if OPENCOMBINE_COMPATIBILITY_TEST
import Combine
#else
import OpenCombine
#endif
@available(macOS 10.15, iOS 13.0, *)
final class AnyPublisherTests: XCTestCase {
static let allTests = [
("testErasePublisher", testErasePublisher),
("testDescription", testDescription),
]
private typealias Sut = AnyPublisher<Int, TestingError>
func testErasePublisher() {
let subscriber = TrackingSubscriber()
let publisher = TrackingSubject<Int>(
receiveSubscriber: {
XCTAssertEqual($0.combineIdentifier, subscriber.combineIdentifier)
}
)
let erased = AnyPublisher(publisher)
erased.subscribe(subscriber)
XCTAssertEqual(publisher.history, [.subscriber])
}
func testDescription() {
let erased = AnyPublisher(TrackingSubject<Int>())
XCTAssertEqual(erased.description, "AnyPublisher")
XCTAssertEqual(erased.description, erased.playgroundDescription as? String)
}
}
| 24.23913 | 83 | 0.673543 |
fb7a992458a8366037159c329a9289b019deab15 | 592 | java | Java | LinkedList/MyLinkedList_1.java | Krishna-debug/Data-Structure-and-Algo | 6b7adcd3b40f365cc208c0b3cba492e97ff8f4e5 | [
"Apache-2.0"
] | null | null | null | LinkedList/MyLinkedList_1.java | Krishna-debug/Data-Structure-and-Algo | 6b7adcd3b40f365cc208c0b3cba492e97ff8f4e5 | [
"Apache-2.0"
] | null | null | null | LinkedList/MyLinkedList_1.java | Krishna-debug/Data-Structure-and-Algo | 6b7adcd3b40f365cc208c0b3cba492e97ff8f4e5 | [
"Apache-2.0"
] | null | null | null | package data_Structure;
public class MyLinkedList_1 {
Node head;
static class Node {
int data;
Node next;
// Constructor
Node(int d) {
data = d;
next = null;
}
}
public void display() {
Node n = head;
while (n != null) {
System.out.print(n.data + " ");
n = n.next;
}
}
public static void main(String[] args) {
MyLinkedList_1 obj = new MyLinkedList_1();
obj.head = new Node(1);
Node second = new Node(2);
Node third = new Node(3);
obj.head.next = second;
second.next = third;
obj.display();
}
}
| 14.8 | 45 | 0.5625 |
c55c37eae6307b8ed03de9620690937f49daa52a | 12,935 | cpp | C++ | 17/water_simulation.t.cpp | ComicSansMS/AdventOfCode2018 | 936ebf5dad7a0317ed3db0f58a16d88c4a00eabb | [
"Unlicense"
] | null | null | null | 17/water_simulation.t.cpp | ComicSansMS/AdventOfCode2018 | 936ebf5dad7a0317ed3db0f58a16d88c4a00eabb | [
"Unlicense"
] | null | null | null | 17/water_simulation.t.cpp | ComicSansMS/AdventOfCode2018 | 936ebf5dad7a0317ed3db0f58a16d88c4a00eabb | [
"Unlicense"
] | null | null | null | #include <water_simulation.hpp>
#include <catch.hpp>
#include <sstream>
TEST_CASE("Water Simulation")
{
SECTION("Vec 2")
{
Vec2 v(22, 33);
CHECK(v.x == 22);
CHECK(v.y == 33);
CHECK(v == Vec2(22, 33));
CHECK_FALSE(v == Vec2(22, 44));
CHECK_FALSE(v == Vec2(11, 33));
CHECK_FALSE(v == Vec2(44, 11));
CHECK(std::hash<Vec2>{}(v) == 0x160021);
}
char const sample_input[] = "x=495, y=2..7" "\n"
"y=7, x=495..501" "\n"
"x=501, y=3..7" "\n"
"x=498, y=2..4" "\n"
"x=506, y=1..2" "\n"
"x=498, y=10..13" "\n"
"x=504, y=10..13" "\n"
"y=13, x=498..504" "\n";
SECTION("Parse Input")
{
auto const sim = parseInput(sample_input);
auto const [limits, source, field] = sim;
// 44444455555555
// 99999900000000
// 45678901234567
// 0 ......+.......
// 1 ............#.
// 2 .#..#.......#.
// 3 .#..#..#......
// 4 .#..#..#......
// 5 .#.....#......
// 6 .#.....#......
// 7 .#######......
// 8 ..............
// 9 ..............
// 10 ....#.....#...
// 11 ....#.....#...
// 12 ....#.....#...
// 13 ....#######...
CHECK(limits.min.x == 493);
CHECK(limits.max.x == 508);
CHECK(limits.min.y == 0);
CHECK(limits.max.y == 13);
CHECK(source == Vec2(500, 0));
CHECK(field.size() == 16 * 14);
CHECK(sim.getField(Vec2(498, 1)) == Field::Empty);
CHECK(sim.getField(Vec2(498, 2)) == Field::Clay);
CHECK(sim.getField(Vec2(498, 3)) == Field::Clay);
CHECK(sim.getField(Vec2(498, 4)) == Field::Clay);
CHECK(sim.getField(Vec2(498, 5)) == Field::Empty);
}
SECTION("Printing")
{
auto const sim = parseInput(sample_input);
std::stringstream sstr;
sstr << sim;
INFO(sim);
CHECK(sstr.str() == ".......+........" "\n"
".............#.." "\n"
"..#..#.......#.." "\n"
"..#..#..#......." "\n"
"..#..#..#......." "\n"
"..#.....#......." "\n"
"..#.....#......." "\n"
"..#######......." "\n"
"................" "\n"
"................" "\n"
".....#.....#...." "\n"
".....#.....#...." "\n"
".....#.....#...." "\n"
".....#######...." "\n");
}
SECTION("Spawn Water")
{
// ......+.......
// ......|.....#.
// .#..#.|.....#.
// .#..#.|#......
// .#..#.|#......
// .#....|#......
// .#~~~~~#......
// .#######......
// ..............
// ..............
// ....#.....#...
// ....#.....#...
// ....#.....#...
// ....#######...
auto sim = parseInput(sample_input);
std::stringstream sstr;
CHECK(spawnWater(sim));
INFO(sim);
sstr << sim;
CHECK(sstr.str() == ".......+........" "\n"
".......|.....#.." "\n"
"..#..#.|.....#.." "\n"
"..#..#.|#......." "\n"
"..#..#.|#......." "\n"
"..#....|#......." "\n"
"..#~||||#......." "\n"
"..#######......." "\n"
"................" "\n"
"................" "\n"
".....#.....#...." "\n"
".....#.....#...." "\n"
".....#.....#...." "\n"
".....#######...." "\n");
sstr.str(std::string());
CHECK(spawnWater(sim));
INFO(sim);
sstr << sim;
CHECK(sstr.str() == ".......+........" "\n"
".......|.....#.." "\n"
"..#..#.|.....#.." "\n"
"..#..#.|#......." "\n"
"..#..#.|#......." "\n"
"..#....|#......." "\n"
"..#~~|||#......." "\n"
"..#######......." "\n"
"................" "\n"
"................" "\n"
".....#.....#...." "\n"
".....#.....#...." "\n"
".....#.....#...." "\n"
".....#######...." "\n");
sstr.str(std::string());
CHECK(spawnWater(sim));
CHECK(spawnWater(sim));
CHECK(spawnWater(sim));
INFO(sim);
sstr << sim;
CHECK(sstr.str() == ".......+........" "\n"
".......|.....#.." "\n"
"..#..#.|.....#.." "\n"
"..#..#.|#......." "\n"
"..#..#.|#......." "\n"
"..#....|#......." "\n"
"..#~~~~~#......." "\n"
"..#######......." "\n"
"................" "\n"
"................" "\n"
".....#.....#...." "\n"
".....#.....#...." "\n"
".....#.....#...." "\n"
".....#######...." "\n");
sstr.str(std::string());
CHECK(spawnWater(sim));
INFO(sim);
sstr << sim;
CHECK(sstr.str() == ".......+........" "\n"
".......|.....#.." "\n"
"..#..#.|.....#.." "\n"
"..#..#.|#......." "\n"
"..#..#.|#......." "\n"
"..#~||||#......." "\n"
"..#~~~~~#......." "\n"
"..#######......." "\n"
"................" "\n"
"................" "\n"
".....#.....#...." "\n"
".....#.....#...." "\n"
".....#.....#...." "\n"
".....#######...." "\n");
sstr.str(std::string());
for(int i=0; i<8; ++i) {
CHECK(spawnWater(sim));
}
INFO(sim);
sstr << sim;
CHECK(sstr.str() == ".......+........" "\n"
".......|.....#.." "\n"
"..#..#.|.....#.." "\n"
"..#..#~~#......." "\n"
"..#..#~~#......." "\n"
"..#~~~~~#......." "\n"
"..#~~~~~#......." "\n"
"..#######......." "\n"
"................" "\n"
"................" "\n"
".....#.....#...." "\n"
".....#.....#...." "\n"
".....#.....#...." "\n"
".....#######...." "\n");
sstr.str(std::string());
CHECK(spawnWater(sim));
INFO(sim);
sstr << sim;
CHECK(sstr.str() == ".......+........" "\n"
".......|.....#.." "\n"
"..#..#||||...#.." "\n"
"..#..#~~#|......" "\n"
"..#..#~~#|......" "\n"
"..#~~~~~#|......" "\n"
"..#~~~~~#|......" "\n"
"..#######|......" "\n"
".........|......" "\n"
".........|......" "\n"
".....#...|.#...." "\n"
".....#...|.#...." "\n"
".....#~||||#...." "\n"
".....#######...." "\n");
sstr.str(std::string());
for(int i=0; i<3; ++i) {
CHECK(spawnWater(sim));
}
INFO(sim);
sstr << sim;
CHECK(sstr.str() == ".......+........" "\n"
".......|.....#.." "\n"
"..#..#||||...#.." "\n"
"..#..#~~#|......" "\n"
"..#..#~~#|......" "\n"
"..#~~~~~#|......" "\n"
"..#~~~~~#|......" "\n"
"..#######|......" "\n"
".........|......" "\n"
".........|......" "\n"
".....#...|.#...." "\n"
".....#...|.#...." "\n"
".....#~~~|~#...." "\n"
".....#######...." "\n");
sstr.str(std::string());
CHECK(spawnWater(sim));
INFO(sim);
sstr << sim;
CHECK(sstr.str() == ".......+........" "\n"
".......|.....#.." "\n"
"..#..#||||...#.." "\n"
"..#..#~~#|......" "\n"
"..#..#~~#|......" "\n"
"..#~~~~~#|......" "\n"
"..#~~~~~#|......" "\n"
"..#######|......" "\n"
".........|......" "\n"
".........|......" "\n"
".....#...|.#...." "\n"
".....#...|.#...." "\n"
".....#~~~~~#...." "\n"
".....#######...." "\n");
sstr.str(std::string());
for(int i=0; i<10; ++i) {
CHECK(spawnWater(sim));
}
INFO(sim);
sstr << sim;
CHECK(sstr.str() == ".......+........" "\n"
".......|.....#.." "\n"
"..#..#||||...#.." "\n"
"..#..#~~#|......" "\n"
"..#..#~~#|......" "\n"
"..#~~~~~#|......" "\n"
"..#~~~~~#|......" "\n"
"..#######|......" "\n"
".........|......" "\n"
".........|......" "\n"
".....#~~~~~#...." "\n"
".....#~~~~~#...." "\n"
".....#~~~~~#...." "\n"
".....#######...." "\n");
sstr.str(std::string());
CHECK(!spawnWater(sim));
INFO(sim);
sstr << sim;
CHECK(sstr.str() == ".......+........" "\n"
".......|.....#.." "\n"
"..#..#||||...#.." "\n"
"..#..#~~#|......" "\n"
"..#..#~~#|......" "\n"
"..#~~~~~#|......" "\n"
"..#~~~~~#|......" "\n"
"..#######|......" "\n"
".........|......" "\n"
"....|||||||||..." "\n"
"....|#~~~~~#|..." "\n"
"....|#~~~~~#|..." "\n"
"....|#~~~~~#|..." "\n"
"....|#######|..." "\n");
sstr.str(std::string());
}
SECTION("Simulate Flow")
{
auto sim = parseInput(sample_input);
std::stringstream sstr;
auto const [count1, count2] = simulateFlow(sim);
INFO(sim);
CHECK(count1 == 57);
CHECK(count2 == 29);
sstr << sim;
CHECK(sstr.str() == ".......+........" "\n"
".......|.....#.." "\n"
"..#..#||||...#.." "\n"
"..#..#~~#|......" "\n"
"..#..#~~#|......" "\n"
"..#~~~~~#|......" "\n"
"..#~~~~~#|......" "\n"
"..#######|......" "\n"
".........|......" "\n"
"....|||||||||..." "\n"
"....|#~~~~~#|..." "\n"
"....|#~~~~~#|..." "\n"
"....|#~~~~~#|..." "\n"
"....|#######|..." "\n");
}
}
| 38.843844 | 58 | 0.144956 |
e406efb44d1fdaecbb17f21150f4996d625ee5d9 | 11,226 | go | Go | internal/sql/parser/expr_test.go | KudinovKV/genji | cfdb78487fe124ed804c9627168ed22d26888a92 | [
"MIT"
] | null | null | null | internal/sql/parser/expr_test.go | KudinovKV/genji | cfdb78487fe124ed804c9627168ed22d26888a92 | [
"MIT"
] | null | null | null | internal/sql/parser/expr_test.go | KudinovKV/genji | cfdb78487fe124ed804c9627168ed22d26888a92 | [
"MIT"
] | null | null | null | package parser_test
import (
"strings"
"testing"
"github.com/genjidb/genji/document"
"github.com/genjidb/genji/internal/expr"
"github.com/genjidb/genji/internal/expr/functions"
"github.com/genjidb/genji/internal/sql/parser"
"github.com/genjidb/genji/internal/testutil"
"github.com/genjidb/genji/internal/testutil/assert"
"github.com/genjidb/genji/types"
"github.com/stretchr/testify/require"
)
func TestParserExpr(t *testing.T) {
tests := []struct {
name string
s string
expected expr.Expr
fails bool
}{
// integers
{"int", "10", testutil.IntegerValue(10), false},
{"-int", "-10", testutil.IntegerValue(-10), false},
{"+int", "+10", testutil.IntegerValue(10), false},
{"> max int64 -> float64", "10000000000000000000", testutil.DoubleValue(10000000000000000000), false},
{"< min int64 -> float64", "-10000000000000000000", testutil.DoubleValue(-10000000000000000000), false},
{"very large int", "100000000000000000000000000000000000000000000000", testutil.DoubleValue(100000000000000000000000000000000000000000000000), false},
// floats
{"+float64", "10.0", testutil.DoubleValue(10), false},
{"-float64", "-10.0", testutil.DoubleValue(-10), false},
// strings
{"double quoted string", `"10.0"`, testutil.TextValue("10.0"), false},
{"single quoted string", "'-10.0'", testutil.TextValue("-10.0"), false},
// blobs
{"blob as hex string", `'\xff'`, testutil.BlobValue([]byte{255}), false},
{"invalid blob hex string", `'\xzz'`, nil, true},
// documents
{"empty document", `{}`, &expr.KVPairs{SelfReferenced: true}, false},
{"document values", `{a: 1, b: 1.0, c: true, d: 'string', e: "string", f: {foo: 'bar'}, g: h.i.j, k: [1, 2, 3]}`,
&expr.KVPairs{SelfReferenced: true, Pairs: []expr.KVPair{
{K: "a", V: testutil.IntegerValue(1)},
{K: "b", V: testutil.DoubleValue(1)},
{K: "c", V: testutil.BoolValue(true)},
{K: "d", V: testutil.TextValue("string")},
{K: "e", V: testutil.TextValue("string")},
{K: "f", V: &expr.KVPairs{SelfReferenced: true, Pairs: []expr.KVPair{
{K: "foo", V: testutil.TextValue("bar")},
}}},
{K: "g", V: testutil.ParsePath(t, "h.i.j")},
{K: "k", V: expr.LiteralExprList{testutil.IntegerValue(1), testutil.IntegerValue(2), testutil.IntegerValue(3)}},
}},
false},
{"document keys", `{a: 1, "foo bar __&&))": 1, 'ola ': 1}`,
&expr.KVPairs{SelfReferenced: true, Pairs: []expr.KVPair{
{K: "a", V: testutil.IntegerValue(1)},
{K: "foo bar __&&))", V: testutil.IntegerValue(1)},
{K: "ola ", V: testutil.IntegerValue(1)},
}},
false},
{"bad document keys: same key", `{a: 1, a: 2, "a": 3}`, nil, true},
{"bad document keys: param", `{?: 1}`, nil, true},
{"bad document keys: dot", `{a.b: 1}`, nil, true},
{"bad document keys: space", `{a b: 1}`, nil, true},
{"bad document: missing right bracket", `{a: 1`, nil, true},
{"bad document: missing colon", `{a: 1, 'b'}`, nil, true},
// parentheses
{"parentheses: empty", "()", nil, true},
{"parentheses: values", `(1)`,
expr.Parentheses{
E: testutil.IntegerValue(1),
}, false},
{"parentheses: expr", `(1 + true * (4 + 3))`,
expr.Parentheses{
E: expr.Add(
testutil.IntegerValue(1),
expr.Mul(
testutil.BoolValue(true),
expr.Parentheses{
E: expr.Add(
testutil.IntegerValue(4),
testutil.IntegerValue(3),
),
},
),
),
}, false},
{"list with brackets: empty", "[]", expr.LiteralExprList(nil), false},
{"list with brackets: values", `[1, true, {a: 1}, a.b.c, (-1), [-1]]`,
expr.LiteralExprList{
testutil.IntegerValue(1),
testutil.BoolValue(true),
&expr.KVPairs{SelfReferenced: true, Pairs: []expr.KVPair{{K: "a", V: testutil.IntegerValue(1)}}},
testutil.ParsePath(t, "a.b.c"),
expr.Parentheses{E: testutil.IntegerValue(-1)},
expr.LiteralExprList{testutil.IntegerValue(-1)},
}, false},
{"list with brackets: missing bracket", `[1, true, {a: 1}, a.b.c, (-1), [-1]`, nil, true},
// operators
{"=", "age = 10", expr.Eq(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)), false},
{"!=", "age != 10", expr.Neq(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)), false},
{">", "age > 10", expr.Gt(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)), false},
{">=", "age >= 10", expr.Gte(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)), false},
{"<", "age < 10", expr.Lt(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)), false},
{"<=", "age <= 10", expr.Lte(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)), false},
{"BETWEEN", "1 BETWEEN 10 AND 11", expr.Between(testutil.IntegerValue(10))(testutil.IntegerValue(1), testutil.IntegerValue(11)), false},
{"+", "age + 10", expr.Add(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)), false},
{"-", "age - 10", expr.Sub(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)), false},
{"*", "age * 10", expr.Mul(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)), false},
{"/", "age / 10", expr.Div(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)), false},
{"%", "age % 10", expr.Mod(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)), false},
{"&", "age & 10", expr.BitwiseAnd(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)), false},
{"||", "name || 'foo'", expr.Concat(testutil.ParsePath(t, "name"), testutil.TextValue("foo")), false},
{"IN", "age IN ages", expr.In(testutil.ParsePath(t, "age"), testutil.ParsePath(t, "ages")), false},
{"NOT IN", "age NOT IN ages", expr.NotIn(testutil.ParsePath(t, "age"), testutil.ParsePath(t, "ages")), false},
{"IS", "age IS NULL", expr.Is(testutil.ParsePath(t, "age"), testutil.NullValue()), false},
{"IS NOT", "age IS NOT NULL", expr.IsNot(testutil.ParsePath(t, "age"), testutil.NullValue()), false},
{"LIKE", "name LIKE 'foo'", expr.Like(testutil.ParsePath(t, "name"), testutil.TextValue("foo")), false},
{"NOT LIKE", "name NOT LIKE 'foo'", expr.NotLike(testutil.ParsePath(t, "name"), testutil.TextValue("foo")), false},
{"NOT =", "name NOT = 'foo'", nil, true},
{"precedence", "4 > 1 + 2", expr.Gt(
testutil.IntegerValue(4),
expr.Add(
testutil.IntegerValue(1),
testutil.IntegerValue(2),
),
), false},
{"AND", "age = 10 AND age <= 11",
expr.And(
expr.Eq(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)),
expr.Lte(testutil.ParsePath(t, "age"), testutil.IntegerValue(11)),
), false},
{"OR", "age = 10 OR age = 11",
expr.Or(
expr.Eq(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)),
expr.Eq(testutil.ParsePath(t, "age"), testutil.IntegerValue(11)),
), false},
{"AND then OR", "age >= 10 AND age > $age OR age < 10.4",
expr.Or(
expr.And(
expr.Gte(testutil.ParsePath(t, "age"), testutil.IntegerValue(10)),
expr.Gt(testutil.ParsePath(t, "age"), expr.NamedParam("age")),
),
expr.Lt(testutil.ParsePath(t, "age"), testutil.DoubleValue(10.4)),
), false},
{"with NULL", "age > NULL", expr.Gt(testutil.ParsePath(t, "age"), testutil.NullValue()), false},
// unary operators
{"CAST", "CAST(a.b[1][0] AS TEXT)", expr.Cast{Expr: testutil.ParsePath(t, "a.b[1][0]"), CastAs: types.TextValue}, false},
{"NOT", "NOT 10", expr.Not(testutil.IntegerValue(10)), false},
{"NOT", "NOT NOT", nil, true},
{"NOT", "NOT NOT 10", expr.Not(expr.Not(testutil.IntegerValue(10))), false},
{"NEXT VALUE FOR", "NEXT VALUE FOR hello", expr.NextValueFor{SeqName: "hello"}, false},
{"NEXT VALUE FOR", "NEXT VALUE FOR `good morning`", expr.NextValueFor{SeqName: "good morning"}, false},
{"NEXT VALUE FOR", "NEXT VALUE FOR 10", nil, true},
// functions
{"pk() function", "pk()", &functions.PK{}, false},
{"count(expr) function", "count(a)", &functions.Count{Expr: testutil.ParsePath(t, "a")}, false},
{"count(*) function", "count(*)", &functions.Count{Wildcard: true}, false},
{"packaged function", "math.floor(1.2)", testutil.FunctionExpr(t, "math.floor", testutil.DoubleValue(1.2)), false},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
ex, err := parser.NewParser(strings.NewReader(test.s)).ParseExpr()
if test.fails {
assert.Error(t, err)
} else {
assert.NoError(t, err)
if !expr.Equal(test.expected, ex) {
require.EqualValues(t, test.expected, ex)
}
}
})
}
}
func TestParsePath(t *testing.T) {
tests := []struct {
name string
s string
expected document.Path
fails bool
}{
{"one fragment", `a`, document.Path{
document.PathFragment{FieldName: "a"},
}, false},
{"one fragment with quotes", "` \"a\"`", document.Path{
document.PathFragment{FieldName: " \"a\""},
}, false},
{"multiple fragments", `a.b[100].c[1][2]`, document.Path{
document.PathFragment{FieldName: "a"},
document.PathFragment{FieldName: "b"},
document.PathFragment{ArrayIndex: 100},
document.PathFragment{FieldName: "c"},
document.PathFragment{ArrayIndex: 1},
document.PathFragment{ArrayIndex: 2},
}, false},
{"multiple fragments with brackets", `a["b"][100].c[1][2]`, document.Path{
document.PathFragment{FieldName: "a"},
document.PathFragment{FieldName: "b"},
document.PathFragment{ArrayIndex: 100},
document.PathFragment{FieldName: "c"},
document.PathFragment{ArrayIndex: 1},
document.PathFragment{ArrayIndex: 2},
}, false},
{"with quotes", "`some ident`.` with`[5].` \"quotes`", document.Path{
document.PathFragment{FieldName: "some ident"},
document.PathFragment{FieldName: " with"},
document.PathFragment{ArrayIndex: 5},
document.PathFragment{FieldName: " \"quotes"},
}, false},
{"negative index", `a.b[-100].c`, nil, true},
{"with spaces", `a. b[100]. c`, nil, true},
{"starting with array", `[10].a`, nil, true},
{"starting with brackets", `['a']`, nil, true},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
vp, err := parser.ParsePath(test.s)
if test.fails {
assert.Error(t, err)
} else {
assert.NoError(t, err)
require.EqualValues(t, test.expected, vp)
}
})
}
}
func TestParserParams(t *testing.T) {
tests := []struct {
name string
s string
expected expr.Expr
errored bool
}{
{"one positional", "age = ?", expr.Eq(testutil.ParsePath(t, "age"), expr.PositionalParam(1)), false},
{"multiple positional", "age = ? AND age <= ?",
expr.And(
expr.Eq(testutil.ParsePath(t, "age"), expr.PositionalParam(1)),
expr.Lte(testutil.ParsePath(t, "age"), expr.PositionalParam(2)),
), false},
{"one named", "age = $age", expr.Eq(testutil.ParsePath(t, "age"), expr.NamedParam("age")), false},
{"multiple named", "age = $foo OR age = $bar",
expr.Or(
expr.Eq(testutil.ParsePath(t, "age"), expr.NamedParam("foo")),
expr.Eq(testutil.ParsePath(t, "age"), expr.NamedParam("bar")),
), false},
{"mixed", "age >= ? AND age > $foo OR age < ?", nil, true},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
ex, err := parser.NewParser(strings.NewReader(test.s)).ParseExpr()
if test.errored {
assert.Error(t, err)
} else {
assert.NoError(t, err)
require.EqualValues(t, test.expected, ex)
}
})
}
}
| 40.673913 | 152 | 0.6248 |
fbd8604d72e9e57457ee68cd4b635386c82993af | 97 | java | Java | library/src/main/java/org/lembed/exeception/RxPermissionExeception.java | Lembed/RxAndroidUsb | cf040a64abbad6e0a825cf41a59f9e6fd3f631e8 | [
"MIT"
] | 4 | 2016-12-23T10:03:43.000Z | 2018-02-09T21:40:05.000Z | library/src/main/java/org/lembed/exeception/RxPermissionExeception.java | Lembed/RxAndroidUsb | cf040a64abbad6e0a825cf41a59f9e6fd3f631e8 | [
"MIT"
] | null | null | null | library/src/main/java/org/lembed/exeception/RxPermissionExeception.java | Lembed/RxAndroidUsb | cf040a64abbad6e0a825cf41a59f9e6fd3f631e8 | [
"MIT"
] | 4 | 2016-08-22T11:44:13.000Z | 2018-09-07T08:02:02.000Z | package org.lembed.exeception;
public class RxPermissionExeception extends RuntimeException{
}
| 16.166667 | 61 | 0.845361 |
9888b2793d914af5bf980efe9c48281d630a4ec0 | 8,643 | html | HTML | docs/Others-Spain-Page.html | StarTrekFan/covid19ReportsAndCharts | 40cbeeb8beaeef1eefd130e53ebb20f0b32ffaf6 | [
"MIT"
] | null | null | null | docs/Others-Spain-Page.html | StarTrekFan/covid19ReportsAndCharts | 40cbeeb8beaeef1eefd130e53ebb20f0b32ffaf6 | [
"MIT"
] | null | null | null | docs/Others-Spain-Page.html | StarTrekFan/covid19ReportsAndCharts | 40cbeeb8beaeef1eefd130e53ebb20f0b32ffaf6 | [
"MIT"
] | null | null | null | <!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Compare Others Infections, Deaths & Recovery</title>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawInfectionsChart);
google.charts.setOnLoadCallback(drawDeathsChart);
google.charts.setOnLoadCallback(drawRecoveryChart);
function drawInfectionsChart() {
var data = google.visualization.arrayToDataTable([
['Date', 'Others Infections','Spain Infections'],['02/07',61,1],['02/08',61,1],['02/09',64,2],['02/10',135,2],['02/11',135,2],['02/12',175,2],['02/13',175,2],['02/14',218,2],['02/15',285,2],['02/16',355,2],['02/17',454,2],['02/18',542,2],['02/19',621,2],['02/20',634,2],['02/21',634,2],['02/22',634,2],['02/23',691,2],['02/24',691,2],['02/25',691,6],['02/26',705,13],['02/28',705,32],['02/29',705,45],['03/01',705,84],['03/02',705,120],['03/03',706,165],['03/04',706,222],['03/05',706,259],['03/06',696,400],['03/07',696,500],['03/08',696,673],['03/09',696,1073],['03/10',696,1695]
]);
var options = {
title: 'COVID-19 Infections - Others & Spain',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('infections_chart'));
chart.draw(data, options);
}
function drawDeathsChart() {
var data = google.visualization.arrayToDataTable([
['Date', 'Others Deaths','Spain Deaths'],['02/07',0,0],['02/08',0,0],['02/09',0,0],['02/10',0,0],['02/11',0,0],['02/12',0,0],['02/13',0,0],['02/14',0,0],['02/15',0,0],['02/16',0,0],['02/17',0,0],['02/18',0,0],['02/19',0,0],['02/20',2,0],['02/21',2,0],['02/22',2,0],['02/23',3,0],['02/24',3,0],['02/25',3,0],['02/26',4,0],['02/28',6,0],['02/29',6,0],['03/01',6,0],['03/02',6,0],['03/03',6,1],['03/04',6,2],['03/05',6,3],['03/06',6,5],['03/07',6,10],['03/08',6,17],['03/09',6,28],['03/10',6,35]
]);
var options = {
title: 'COVID-19 Deaths - Others & Spain',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('deaths_chart'));
chart.draw(data, options);
}
function drawRecoveryChart() {
var data = google.visualization.arrayToDataTable([
['Date', 'Others Recovery','Spain Recovery'],['02/07',0,0],['02/08',0,0],['02/09',0,0],['02/10',0,0],['02/11',0,0],['02/12',0,0],['02/13',0,0],['02/14',0,0],['02/15',0,2],['02/16',0,2],['02/17',0,2],['02/18',0,2],['02/19',1,2],['02/20',1,2],['02/21',1,2],['02/22',1,2],['02/23',0,2],['02/24',0,2],['02/25',0,2],['02/26',10,2],['02/28',10,2],['02/29',10,2],['03/01',10,2],['03/02',10,2],['03/03',10,2],['03/04',10,2],['03/05',10,2],['03/06',40,2],['03/07',40,30],['03/08',40,30],['03/09',40,32],['03/10',40,32]
]);
var options = {
title: 'COVID-19 Recovery - Others & Spain',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('recovery_chart'));
chart.draw(data, options);
}
</script>
<style>
main > .container {
padding: 60px 15px 0;
}
.footer {
background-color: #f5f5f5;
}
.footer > .container {
padding-right: 15px;
padding-left: 15px;
}
code {
font-size: 80%;
}
</style>
</head>
<body >
<header>
<!-- Fixed navbar -->
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<a class="navbar-brand" href="Index.html">COVID-19</a>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="Index.html">Home <span class="sr-only">(current)</span></a>
</li>
</ul>
</div>
</nav>
</header>
<main role="main">
<div class="container">
<div class="row justify-content-md-center">
<H3><b>COVID-19 Others - Spain REPORT</b></H3>
</div>
<div class="row justify-content-md-center">
<h8><a href="https://github.com/CSSEGISandData/COVID-19">Novel Coronavirus (COVID-19) cases data provided by JHU CSSE </h8></a>
</div>
<div class="row">
<div class="col-md-6 offset-md-3">
<div class="progress" style="height:25px; margin: 5PX 5PX 0PX;">
<div class="progress-bar" role="progressbar" style="width: 244%;" aria-valuenow="244" aria-valuemin="0" aria-valuemax="100"><b>Spain - 1695</b></div>
<div class="progress-bar bg-info" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"><b>Infections - Others - 696</b></div>
</div>
<div class="progress" style="height:25px; margin: 5PX 5PX 0PX;">
<div class="progress-bar bg-danger" role="progressbar" style="width: 583%;" aria-valuenow="583" aria-valuemin="0" aria-valuemax="100"><b>Spain - 35</b></div>
<div class="progress-bar bg-info" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"><b>Deaths - Others - 6</b></div>
</div>
<div class="progress" style="height:25px; margin: 5PX 5PX 0PX;">
<div class="progress-bar bg-success" role="progressbar" style="width: 80%;" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100"><b>Spain - 32 </b></div>
<div class="progress-bar bg-info" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"><b>Recovery - Others - 40</b></div>
</div>
</div>
</div>
<div class="row justify-content-md-center">
<ul class="nav justify-content-center">
<li class="nav-item">
<a class="nav-link active" href="Others-Page.html" role="button">Back to Others</a>
</li>
<li class="nav-item">
<a class="nav-link active" href='Others-China-Page.html' role="button" >Compare To China</a>
</li>
<li class="nav-item">
<a class="nav-link active" href='Others-Italy-Page.html' role="button" >Compare to Italy</a>
</li>
<li class="nav-item">
<a class="nav-link active" href='Others-Spain-Page.html' role="button" >Compare to Spain</a>
</li>
</ul>
</div>
<div class="row justify-content-md-center">
<div class="col-md-10 offset-md-1">
<div id="infections_chart" style="height: 500px"></div>
</div>
</div>
<div class="row justify-content-md-center">
<div class="col-md-10 offset-md-1">
<div id="deaths_chart" style="height: 500px"></div>
</div>
</div>
<div class="row justify-content-md-center">
<div class="col-md-10 offset-md-1">
<div id="recovery_chart" style="height: 500px"></div>
</div>
</div>
</div>
</div>
</main>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html> | 50.54386 | 591 | 0.562883 |
c0733dcf3cac2482bd0b81882ae490323a2e19e7 | 1,459 | asm | Assembly | programs/oeis/248/A248619.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/248/A248619.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/248/A248619.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A248619: a(n) = (n*(n+1))^4.
; 0,16,1296,20736,160000,810000,3111696,9834496,26873856,65610000,146410000,303595776,592240896,1097199376,1944810000,3317760000,5473632256,8767700496,13680577296,20851360000,31116960000,45558341136,65554433296,92844527616,129600000000,178506250000,242855782416,326653399296,434734510336,572897610000,748052010000,968381956096,1243528298496,1584788925456,2005339210000,2520473760000,3147870802176,3907880570896,4823839112976,5922408960000,7233948160000,8792909200656,10638269396496,12813994352896,15369536160000,18360368010000,21848556971536,25903376695296,30601961865216,36030006250000,42282506250000,49464551874816,57692167127296,67093201809936,77808276810000,89991784960000,103812949610496,119456943092496,137126067287056,157040998560000,179442099360000,204590798818576,232771044730896,264290829336576,299483791360000,338710896810000,382362201079056,430858694922496,484654236938496,544237575210000,610134460810000,682909855911936,763170239287296,851566012012816,948794006250000,1055600100000000,1172781940777216,1301191781185296,1441739429419536,1595395317760000,1763193692160000,1946235926074896,2145693961716496,2362813881958656,2598919616160000,2855416783210000,3133796675144976,3435640384720896,3762623080370176,4116518432010000,4499203191210000,4912661929267456,5358991936778496,5840408288334096,6359249076010000,6917980815360000,7519204027662336,8165659002209296,8860231742470416
mov $1,$0
pow $0,2
add $1,$0
pow $1,4
| 182.375 | 1,388 | 0.905415 |
d0b6bb2dce9608b8794cab0b1a5bdac094c7ad82 | 330 | swift | Swift | Sources/Domain/Model/Text.swift | edmw/wishlist | f4664156eb0fb1e681ebed0373d8459637f8c238 | [
"MIT"
] | 3 | 2019-10-29T23:37:02.000Z | 2020-02-09T22:24:08.000Z | Sources/Domain/Model/Text.swift | edmw/wishlist | f4664156eb0fb1e681ebed0373d8459637f8c238 | [
"MIT"
] | null | null | null | Sources/Domain/Model/Text.swift | edmw/wishlist | f4664156eb0fb1e681ebed0373d8459637f8c238 | [
"MIT"
] | null | null | null | // MARK: Text
/// This type represents a text.
public struct Text: DomainStringValue {
/// Let me introduce to you: The text itself.
let rawValue: String
/// Creates a text using the specified string. No checks are made on the given string.
public init(string: String) {
self.rawValue = string
}
}
| 22 | 90 | 0.663636 |