text
stringlengths
2
1.04M
meta
dict
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "3880536097e24ef07d72872332a2515a", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "2ffbd4133f72c2dfd7846a094147fd3bf15d26ff", "size": "186", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Rosales/Cannabaceae/Celtis/Celtis cordifolia/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
Aruba.platform.require_matching_files("../command/**/*.rb", __FILE__)
{ "content_hash": "84428e400988319e2eb919f1e7039e20", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 69, "avg_line_length": 70, "alnum_prop": 0.6571428571428571, "repo_name": "cucumber/aruba", "id": "c7d017afcd4511532964cceefa8c5041a46c1eaf", "size": "70", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "lib/aruba/matchers/command.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "1053" }, { "name": "Gherkin", "bytes": "259314" }, { "name": "Ruby", "bytes": "302974" } ], "symlink_target": "" }
namespace boost { namespace mpl { template< typename Tag > struct has_push_front_impl; // agurt 05/feb/04: no default implementation; the stub definition is needed // to enable the default 'has_push_front' implementation below template< typename Tag > struct push_front_impl { template< typename Sequence, typename T > struct apply { // should be instantiated only in the context of 'has_push_front_impl'; // if you've got an assert here, you are requesting a 'push_front' // specialization that doesn't exist. BOOST_MPL_ASSERT_MSG( ( boost::is_same< T, has_push_front_impl<T> >::value ) , REQUESTED_PUSH_FRONT_SPECIALIZATION_FOR_SEQUENCE_DOES_NOT_EXIST , ( Sequence ) ); }; }; template< typename Tag > struct has_push_front_impl { template< typename Seq > struct apply #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) : aux::has_type< push_front< Seq, has_push_front_impl<Tag> > > { #else { typedef aux::has_type< push_front< Seq, has_push_front_impl<Tag> > > type; BOOST_STATIC_CONSTANT(bool, value = (aux::has_type< push_front< Seq, has_push_front_impl<Tag> > >::value) ); #endif }; }; BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(2, push_front_impl) BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1, has_push_front_impl) }} #endif // BOOST_MPL_AUX_PUSH_FRONT_IMPL_HPP_INCLUDED
{ "content_hash": "eaf3907eb44de12126e43ea28aceb379", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 83, "avg_line_length": 30.53191489361702, "alnum_prop": 0.643205574912892, "repo_name": "BinSigma/BinClone", "id": "3db897bf078172136da2ecdbec00ba89a9d4d89d", "size": "2227", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "lshkit/trunk/3rd-party/boost/boost/mpl/aux_/push_front_impl.hpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "61990" }, { "name": "C++", "bytes": "879998" }, { "name": "CMake", "bytes": "12199" }, { "name": "HTML", "bytes": "461" }, { "name": "Matlab", "bytes": "2924" }, { "name": "Objective-C", "bytes": "6763" }, { "name": "Shell", "bytes": "846" } ], "symlink_target": "" }
<!doctype html> <html lang="en-US"> <head> <meta charset="utf-8" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>Smarty Admin</title> <meta name="description" content="" /> <meta name="Author" content="Dorin Grigoras [www.stepofweb.com]" /> <!-- mobile settings --> <meta name="viewport" content="width=device-width, maximum-scale=1, initial-scale=1, user-scalable=0" /> <!-- WEB FONTS --> <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700,800&amp;subset=latin,latin-ext,cyrillic,cyrillic-ext" rel="stylesheet" type="text/css" /> <!-- CORE CSS --> <link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <!-- THEME CSS --> <link href="assets/css/essentials.css" rel="stylesheet" type="text/css" /> <link href="assets/css/layout.css" rel="stylesheet" type="text/css" /> <link href="assets/css/color_scheme/green.css" rel="stylesheet" type="text/css" id="color_scheme" /> </head> <!-- .boxed = boxed version --> <body> <!-- WRAPPER --> <div id="wrapper"> <!-- ASIDE Keep it outside of #wrapper (responsive purpose) --> <aside id="aside"> <!-- Always open: <li class="active alays-open"> LABELS: <span class="label label-danger pull-right">1</span> <span class="label label-default pull-right">1</span> <span class="label label-warning pull-right">1</span> <span class="label label-success pull-right">1</span> <span class="label label-info pull-right">1</span> --> <nav id="sideNav"><!-- MAIN MENU --> <ul class="nav nav-list"> <li><!-- dashboard --> <a class="dashboard" href="index.html"><!-- warning - url used by default by ajax (if eneabled) --> <i class="main-icon fa fa-dashboard"></i> <span>Dashboard</span> </a> </li> <li> <a href="#"> <i class="fa fa-menu-arrow pull-right"></i> <i class="main-icon fa fa-bar-chart-o"></i> <span>Graphs</span> </a> <ul><!-- submenus --> <li><a href="graphs-flot.html">Flot Charts</a></li> <li><a href="graphs-morris.html">Morris Charts</a></li> <li><a href="graphs-inline.html">Inline Charts</a></li> <li><a href="graphs-chartjs.html">Chart.js</a></li> </ul> </li> <li> <a href="#"> <i class="fa fa-menu-arrow pull-right"></i> <i class="main-icon fa fa-table"></i> <span>Tables</span> </a> <ul><!-- submenus --> <li><a href="tables-bootstrap.html">Bootstrap Tables</a></li> <li><a href="tables-jqgrid.html">jQuery Grid</a></li> <li><a href="tables-footable.html">jQuery Footable</a></li> <li> <a href="#"> <i class="fa fa-menu-arrow pull-right"></i> Datatables </a> <ul> <li><a href="tables-datatable-managed.html">Managed Datatables</a></li> <li><a href="tables-datatable-editable.html">Editable Datatables</a></li> <li><a href="tables-datatable-advanced.html">Advanced Datatables</a></li> </ul> </li> </ul> </li> <li> <a href="#"> <i class="fa fa-menu-arrow pull-right"></i> <i class="main-icon fa fa-pencil-square-o"></i> <span>Forms</span> </a> <ul><!-- submenus --> <li><a href="form-elements.html">Smarty Elements</a></li> <li><a href="form-masked-inputs.html">Masked Inputs</a></li> <li><a href="form-pickers.html">Pickers</a></li> <li><a href="form-ui-sliders.html">UI Sliders</a></li> <li><a href="form-validation.html">Validation Form</a></li> <li><a href="form-html-editors.html">Html Editors</a></li> <li><a href="form-autosuggest.html">Autosuggest</a></li> <li><a href="form-x-editable.html">Form X-Editable</a></li> <li><a href="form-dropzone.html">Dropzone File Upload</a></li> </ul> </li> <li class="active"> <a href="#"> <i class="fa fa-menu-arrow pull-right"></i> <i class="main-icon fa fa-gears"></i> <span>UI Features</span> </a> <ul><!-- submenus --> <li><a href="ui-portlets.html">Portlets</a></li> <li><a href="ui-buttons.html">Buttons</a></li> <li class="active"> <a href="#"> <i class="fa fa-menu-arrow pull-right"></i> Icons </a> <ul> <li><a href="ui-icons-fontawsome.html">Fontawsome</a></li> <li><a href="ui-icons-etline.html">Et-Line Icons</a></li> <li><a href="ui-icons-glyphicons.html">Glyph Icons</a></li> <li class="active"><a href="ui-icons-flags.html">Flags</a></li> </ul> </li> <li><a href="ui-alerts-dialogs.html">Alerts &amp; Dialogs</a></li> <li><a href="ui-tabs-acordion-navs.html">Tabs, Acordion &amp; Navs</a></li> <li><a href="ui-knob.html">Knob Circles</a></li> <li><a href="ui-nestable.html">Nestable List</a></li> <li><a href="ui-toastr.html">Toastr Notifications</a></li> <li><a href="ui-modals.html">Modals</a></li> <li><a href="ui-grid.html">Grid</a></li> <li><a href="ui-google-maps.html">Google Maps</a></li> <li><a href="ui-vector-maps.html">Vector Maps</a></li> <li><a href="ui-essentials.html">Essentials</a></li> <li> <a href="#"> <i class="fa fa-menu-arrow pull-right"></i> <i class="fa fa-folder-open"></i> Deep Navigation </a> <!-- 3rd Level --> <ul> <li> <a href="#"> 3rd Level </a> </li> <li> <a href="#"> <i class="fa fa-menu-arrow pull-right"></i> <i class="fa fa-folder-open"></i> 4rd Level </a> <!-- 4th Level --> <ul> <li> <a href="#"> 4th Level </a> </li> <li> <a href="#"> <i class="fa fa-menu-arrow pull-right"></i> <i class="fa fa-folder-open"></i> 5th Level </a> <!-- 5th Level --> <ul> <li> <a href="#"> 5th level </a> </li> <li> <a href="#"> <i class="fa fa-menu-arrow pull-right"></i> <i class="fa fa-folder-open"></i> 6th level </a> <!-- 6th Level --> <ul> <li> <a href="#"> 6th level </a> </li> <li> <a href="#"> 6th level </a> </li> </ul><!-- /6th Level --> </li> </ul><!-- /5th Level --> </li> </ul><!-- /4th Level --> </li> </ul><!-- /3rd Level --> </li> </ul> </li> <li> <a href="#"> <i class="fa fa-menu-arrow pull-right"></i> <i class="main-icon fa fa-book"></i> <span>Pages</span> </a> <ul><!-- submenus --> <li><a href="page-invoice.html">Invoice</a></li> <li><a href="page-login.html">Login</a></li> <li><a href="page-register.html">Register</a></li> <li><a href="page-lock.html">Lock Screen</a></li> <li><a href="page-forum.html">Forum</a></li> <li><a href="page-404.html">Error 404</a></li> <li><a href="page-500.html">Error 500</a></li> <li><a href="page-pricing.html">Pricing Table</a></li> <li><a href="page-search.html">Search Result</a></li> <li><a href="page-sidebar.html">Sidebar Page</a></li> <li><a href="page-user-profile.html">User Profile</a></li> <li><a href="page-blank-1.html">Blank Page</a></li> </ul> </li> <li> <a href="calendar.html"> <i class="main-icon fa fa-calendar"></i> <span class="label label-warning pull-right">2</span> <span>Calendar</span> </a> </li> </ul> <!-- SECOND MAIN LIST --> <h3>MORE</h3> <ul class="nav nav-list"> <li> <a href="calendar.html"> <i class="main-icon fa fa-calendar"></i> <span class="label label-warning pull-right">2</span> <span>Calendar</span> </a> </li> <li> <a href="../../HTML/start.html"> <i class="main-icon fa fa-link"></i> <span class="label label-danger pull-right">PRO</span> <span>Frontend</span> </a> </li> </ul> </nav> <span id="asidebg"><!-- aside fixed background --></span> </aside> <!-- /ASIDE --> <!-- HEADER --> <header id="header"> <!-- Mobile Button --> <button id="mobileMenuBtn"></button> <!-- Logo --> <span class="logo pull-left"> <img src="assets/images/logo_light.png" alt="admin panel" height="35" /> </span> <form method="get" action="page-search.html" class="search pull-left hidden-xs"> <input type="text" class="form-control" name="k" placeholder="Search for something..." /> </form> <nav> <!-- OPTIONS LIST --> <ul class="nav pull-right"> <!-- USER OPTIONS --> <li class="dropdown pull-left"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true"> <img class="user-avatar" alt="" src="assets/images/noavatar.jpg" height="34" /> <span class="user-name"> <span class="hidden-xs"> John Doe <i class="fa fa-angle-down"></i> </span> </span> </a> <ul class="dropdown-menu hold-on-click"> <li><!-- my calendar --> <a href="calendar.html"><i class="fa fa-calendar"></i> Calendar</a> </li> <li><!-- my inbox --> <a href="#"><i class="fa fa-envelope"></i> Inbox <span class="pull-right label label-default">0</span> </a> </li> <li><!-- settings --> <a href="page-user-profile.html"><i class="fa fa-cogs"></i> Settings</a> </li> <li class="divider"></li> <li><!-- lockscreen --> <a href="page-lock.html"><i class="fa fa-lock"></i> Lock Screen</a> </li> <li><!-- logout --> <a href="page-login.html"><i class="fa fa-power-off"></i> Log Out</a> </li> </ul> </li> <!-- /USER OPTIONS --> </ul> <!-- /OPTIONS LIST --> </nav> </header> <!-- /HEADER --> <!-- MIDDLE --> <section id="middle"> <!-- page title --> <header id="page-header"> <h1>Flags</h1> <ol class="breadcrumb"> <li><a href="#">UI</a></li> <li><a href="#">Icons</a></li> <li class="active">Flags</li> </ol> </header> <!-- /page title --> <div id="content" class="padding-20"> <!-- Panel Default --> <div id="panel-1" class="panel panel-default"> <div class="panel-heading"> <span class="elipsis"><!-- panel title --> <strong>FLAGS</strong> </span> <!-- right options --> <ul class="options pull-right list-inline"> <li><a href="#" class="opt panel_colapse" data-toggle="tooltip" title="Colapse" data-placement="bottom"></a></li> <li><a href="#" class="opt panel_fullscreen hidden-xs" data-toggle="tooltip" title="Fullscreen" data-placement="bottom"><i class="fa fa-expand"></i></a></li> <li><a href="#" class="opt panel_close" data-confirm-title="Confirm" data-confirm-message="Are you sure you want to remove this panel?" data-toggle="tooltip" title="Close" data-placement="bottom"><i class="fa fa-times"></i></a></li> </ul> <!-- /right options --> </div> <!-- panel content --> <div class="panel-body"> <div class="iconFlags"> <!-- inline search --> <div class="well well-sm"> <div class="input-group fullwidth"> <input class="form-control input-lg" type="text" id="inline-search" placeholder="Icon search..."> <span class="input-group-addon"><i class="fa fa-lg fa-search"></i></span> </div> </div> <!-- /inline search --> <hr /> <h4 class="page-header">America</h4> <div class="row"> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ai.png" alt="Anguilla"> Anguilla </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ag.png" alt="Antigua and Barbuda"> Antigua and Barbuda </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ar.png" alt="Argentina"> Argentina </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/aw.png" alt="Aruba"> Aruba </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bs.png" alt="Bahamas"> Bahamas </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bb.png" alt="Barbados"> Barbados </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bz.png" alt="Belize"> Belize </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bm.png" alt="Bermuda"> Bermuda </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bo.png" alt="Bolivia, Plurinational State of"> Bolivia, Plurinational State of </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/br.png" alt="Brazil"> Brazil </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ca.png" alt="Canada"> Canada </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ky.png" alt="Cayman Islands"> Cayman Islands </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/cl.png" alt="Chile"> Chile </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/co.png" alt="Colombia"> Colombia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/cr.png" alt="Costa Rica"> Costa Rica </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/cu.png" alt="Cuba"> Cuba </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/dm.png" alt="Dominica"> Dominica </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/do.png" alt="Dominican Republic"> Dominican Republic </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ec.png" alt="Ecuador"> Ecuador </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sv.png" alt="El Salvador"> El Salvador </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/fk.png" alt="Falkland Islands (Malvinas)"> Falkland Islands (Malvinas) </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gf.png" alt="French Guiana"> French Guiana </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gl.png" alt="Greenland"> Greenland </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gd.png" alt="Grenada"> Grenada </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gp.png" alt="Guadeloupe"> Guadeloupe </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gt.png" alt="Guatemala"> Guatemala </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gy.png" alt="Guyana"> Guyana </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ht.png" alt="Haiti"> Haiti </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/hn.png" alt="Honduras"> Honduras </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/jm.png" alt="Jamaica"> Jamaica </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mq.png" alt="Martinique"> Martinique </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mx.png" alt="Mexico"> Mexico </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ms.png" alt="Montserrat"> Montserrat </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/an.png" alt="Netherlands Antilles"> Netherlands Antilles </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ni.png" alt="Nicaragua"> Nicaragua </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/pa.png" alt="Panama"> Panama </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/py.png" alt="Paraguay"> Paraguay </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/pe.png" alt="Peru"> Peru </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/pr.png" alt="Puerto Rico"> Puerto Rico </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/kn.png" alt="Saint Kitts and Nevis"> Saint Kitts and Nevis </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/lc.png" alt="Saint Lucia"> Saint Lucia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/pm.png" alt="Saint Pierre and Miquelon"> Saint Pierre and Miquelon </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/vc.png" alt="Saint Vincent and the Grenadines"> Saint Vincent and the Grenadines </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sr.png" alt="Suriname"> Suriname </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tt.png" alt="Trinidad and Tobago"> Trinidad and Tobago </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tc.png" alt="Turks and Caicos Islands"> Turks and Caicos Islands </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/us.png" alt="United States"> United States </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/uy.png" alt="Uruguay"> Uruguay </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ve.png" alt="Venezuela, Bolivarian Republic of"> Venezuela, Bolivarian Republic of </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/vg.png" alt="Virgin Islands, British"> Virgin Islands, British </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/vi.png" alt="Virgin Islands, U.S."> Virgin Islands, U.S. </div> </div> <h4 class="page-header">Europe</h4> <div class="row"> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/al.png" alt="Albania"> Albania </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ad.png" alt="Andorra"> Andorra </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/at.png" alt="Austria"> Austria </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/by.png" alt="Belarus"> Belarus </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/be.png" alt="Belgium"> Belgium </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ba.png" alt="Bosnia and Herzegovina"> Bosnia and Herzegovina </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bg.png" alt="Bulgaria"> Bulgaria </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/hr.png" alt="Croatia"> Croatia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/cz.png" alt="Czech Republic"> Czech Republic </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/dk.png" alt="Denmark"> Denmark </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ee.png" alt="Estonia"> Estonia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/fo.png" alt="Faroe Islands"> Faroe Islands </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/fi.png" alt="Finland"> Finland </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/fr.png" alt="France"> France </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/de.png" alt="Germany"> Germany </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gi.png" alt="Gibraltar"> Gibraltar </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gr.png" alt="Greece"> Greece </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/va.png" alt="Holy See (Vatican City State)"> Holy See (Vatican City State) </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/hu.png" alt="Hungary"> Hungary </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/is.png" alt="Iceland"> Iceland </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ie.png" alt="Ireland"> Ireland </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/it.png" alt="Italy"> Italy </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/lv.png" alt="Latvia"> Latvia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/li.png" alt="Liechtenstein"> Liechtenstein </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/lt.png" alt="Lithuania"> Lithuania </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/lu.png" alt="Luxembourg"> Luxembourg </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mk.png" alt="Macedonia, The Former Yugoslav Republic of"> Macedonia, The Former Yugoslav Republic of </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mt.png" alt="Malta"> Malta </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/md.png" alt="Moldova, Republic of"> Moldova, Republic of </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mc.png" alt="Monaco"> Monaco </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/me.png" alt="Montenegro"> Montenegro </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/nl.png" alt="Netherlands"> Netherlands </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/no.png" alt="Norway"> Norway </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/pl.png" alt="Poland"> Poland </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/pt.png" alt="Portugal"> Portugal </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ro.png" alt="Romania"> Romania </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ru.png" alt="Russian Federation"> Russian Federation </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sm.png" alt="San Marino"> San Marino </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/rs.png" alt="Serbia"> Serbia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sk.png" alt="Slovakia"> Slovakia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/si.png" alt="Slovenia"> Slovenia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/es.png" alt="Spain"> Spain </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/se.png" alt="Sweden"> Sweden </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ch.png" alt="Switzerland"> Switzerland </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ua.png" alt="Ukraine"> Ukraine </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gb.png" alt="United Kingdom"> United Kingdom </div> </div> <h4 class="page-header">Asia</h4> <div class="row"> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/af.png" alt="Afghanistan"> Afghanistan </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/am.png" alt="Armenia"> Armenia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/az.png" alt="Azerbaijan"> Azerbaijan </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bh.png" alt="Bahrain"> Bahrain </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bd.png" alt="Bangladesh"> Bangladesh </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bt.png" alt="Bhutan"> Bhutan </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bn.png" alt="Brunei Darussalam"> Brunei Darussalam </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/kh.png" alt="Cambodia"> Cambodia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/cn.png" alt="China"> China </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/cy.png" alt="Cyprus"> Cyprus </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ge.png" alt="Georgia"> Georgia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/hk.png" alt="Hong Kong"> Hong Kong </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/in.png" alt="India"> India </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/id.png" alt="Indonesia"> Indonesia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ir.png" alt="Iran, Islamic Republic of"> Iran, Islamic Republic of </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/iq.png" alt="Iraq"> Iraq </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/il.png" alt="Israel"> Israel </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/jp.png" alt="Japan"> Japan </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/jo.png" alt="Jordan"> Jordan </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/kz.png" alt="Kazakhstan"> Kazakhstan </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/kp.png" alt="Korea, Democratic People's Republic of"> Korea, Democratic People's Republic of </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/kr.png" alt="Korea, Republic of"> Korea, Republic of </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/kw.png" alt="Kuwait"> Kuwait </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/kg.png" alt="Kyrgyzstan"> Kyrgyzstan </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/la.png" alt="Lao People's Democratic Republic"> Lao People's Democratic Republic </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/lb.png" alt="Lebanon"> Lebanon </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mo.png" alt="Macao"> Macao </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/my.png" alt="Malaysia"> Malaysia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mv.png" alt="Maldives"> Maldives </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mn.png" alt="Mongolia"> Mongolia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mm.png" alt="Myanmar"> Myanmar </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/np.png" alt="Nepal"> Nepal </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/om.png" alt="Oman"> Oman </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/pk.png" alt="Pakistan"> Pakistan </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ps.png" alt="Palestinian Territory, Occupied"> Palestinian Territory, Occupied </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ph.png" alt="Philippines"> Philippines </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/qa.png" alt="Qatar"> Qatar </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sa.png" alt="Saudi Arabia"> Saudi Arabia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sg.png" alt="Singapore"> Singapore </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/lk.png" alt="Sri Lanka"> Sri Lanka </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sy.png" alt="Syrian Arab Republic"> Syrian Arab Republic </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tw.png" alt="Taiwan, Province of China"> Taiwan, Province of China </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tj.png" alt="Tajikistan"> Tajikistan </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/th.png" alt="Thailand"> Thailand </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tl.png" alt="Timor-Leste"> Timor-Leste </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tr.png" alt="Turkey"> Turkey </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tm.png" alt="Turkmenistan"> Turkmenistan </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ae.png" alt="United Arab Emirates"> United Arab Emirates </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/uz.png" alt="Uzbekistan"> Uzbekistan </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/vn.png" alt="Viet Nam"> Viet Nam </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ye.png" alt="Yemen"> Yemen </div> </div> <h4 class="page-header">Australia and Oceania</h4> <div class="row"> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/as.png" alt="American Samoa"> American Samoa </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/au.png" alt="Australia"> Australia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ck.png" alt="Cook Islands"> Cook Islands </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/fj.png" alt="Fiji"> Fiji </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/pf.png" alt="French Polynesia"> French Polynesia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gu.png" alt="Guam"> Guam </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ki.png" alt="Kiribati"> Kiribati </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mh.png" alt="Marshall Islands"> Marshall Islands </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/fm.png" alt="Micronesia, Federated States of"> Micronesia, Federated States of </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/nr.png" alt="Nauru"> Nauru </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/nc.png" alt="New Caledonia"> New Caledonia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/nz.png" alt="New Zealand"> New Zealand </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/nu.png" alt="Niue"> Niue </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/nf.png" alt="Norfolk Island"> Norfolk Island </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mp.png" alt="Northern Mariana Islands"> Northern Mariana Islands </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/pw.png" alt="Palau"> Palau </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/pg.png" alt="Papua New Guinea"> Papua New Guinea </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/pn.png" alt="Pitcairn"> Pitcairn </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ws.png" alt="Samoa"> Samoa </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sb.png" alt="Solomon Islands"> Solomon Islands </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tk.png" alt="Tokelau"> Tokelau </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/to.png" alt="Tonga"> Tonga </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tv.png" alt="Tuvalu"> Tuvalu </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/vu.png" alt="Vanuatu"> Vanuatu </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/wf.png" alt="Wallis and Futuna"> Wallis and Futuna </div> </div> <h4 class="page-header">Africa</h4> <div class="row"> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/dz.png" alt="Algeria"> Algeria </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ao.png" alt="Angola"> Angola </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bj.png" alt="Benin"> Benin </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bw.png" alt="Botswana"> Botswana </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bf.png" alt="Burkina Faso"> Burkina Faso </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bi.png" alt="Burundi"> Burundi </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/cm.png" alt="Cameroon"> Cameroon </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/cv.png" alt="Cape Verde"> Cape Verde </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/cf.png" alt="Central African Republic"> Central African Republic </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/td.png" alt="Chad"> Chad </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/km.png" alt="Comoros"> Comoros </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/cg.png" alt="Congo"> Congo </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/cd.png" alt="Congo, The Democratic Republic of the"> Congo, The Democratic Republic of the </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ci.png" alt="Côte d'Ivoire"> Côte d'Ivoire </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/dj.png" alt="Djibouti"> Djibouti </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/eg.png" alt="Egypt"> Egypt </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gq.png" alt="Equatorial Guinea"> Equatorial Guinea </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/er.png" alt="Eritrea"> Eritrea </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/et.png" alt="Ethiopia"> Ethiopia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ga.png" alt="Gabon"> Gabon </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gm.png" alt="Gambia"> Gambia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gh.png" alt="Ghana"> Ghana </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gn.png" alt="Guinea"> Guinea </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gw.png" alt="Guinea-Bissau"> Guinea-Bissau </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ke.png" alt="Kenya"> Kenya </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ls.png" alt="Lesotho"> Lesotho </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/lr.png" alt="Liberia"> Liberia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ly.png" alt="Libya"> Libya </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mg.png" alt="Madagascar"> Madagascar </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mw.png" alt="Malawi"> Malawi </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ml.png" alt="Mali"> Mali </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mr.png" alt="Mauritania"> Mauritania </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mu.png" alt="Mauritius"> Mauritius </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/yt.png" alt="Mayotte"> Mayotte </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ma.png" alt="Morocco"> Morocco </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/mz.png" alt="Mozambique"> Mozambique </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/na.png" alt="Namibia"> Namibia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ne.png" alt="Niger"> Niger </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ng.png" alt="Nigeria"> Nigeria </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/rw.png" alt="Rwanda"> Rwanda </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/re.png" alt="Réunion"> Réunion </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sh.png" alt="Saint Helena"> Saint Helena </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/st.png" alt="Sao Tome and Principe"> Sao Tome and Principe </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sn.png" alt="Senegal"> Senegal </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sc.png" alt="Seychelles"> Seychelles </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sl.png" alt="Sierra Leone"> Sierra Leone </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/so.png" alt="Somalia"> Somalia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/za.png" alt="South Africa"> South Africa </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sd.png" alt="Sudan"> Sudan </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/sz.png" alt="Swaziland"> Swaziland </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tz.png" alt="Tanzania"> Tanzania </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tg.png" alt="Togo"> Togo </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tn.png" alt="Tunisia"> Tunisia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/ug.png" alt="Uganda"> Uganda </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/eh.png" alt="Western Sahara"> Western Sahara </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/zm.png" alt="Zambia"> Zambia </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/zw.png" alt="Zimbabwe"> Zimbabwe </div> </div> <h4 class="page-header">Other areas</h4> <div class="row"> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/bv.png" alt="Bouvet Island"> Bouvet Island </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/io.png" alt="British Indian Ocean Territory"> British Indian Ocean Territory </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/england.png" alt="England"> England </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/europeanunion.png" alt="European Union"> European Union </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/tf.png" alt="French Southern Territories"> French Southern Territories </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/hm.png" alt="Heard Island and McDonald Islands"> Heard Island and McDonald Islands </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/scotland.png" alt="Scotland"> Scotland </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/gs.png" alt="South Georgia and the South Sandwich Islands"> South Georgia and the South Sandwich Islands </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/um.png" alt="United States Minor Outlying Islands"> United States Minor Outlying Islands </div> <div class="col-xs-6 col-md-3 col-sm-4 flag-icon"> <img src="assets/images/flags/wales.png" alt="Wales"> Wales </div> </div> <hr /> <pre> Usage: &#60;img src="assets/images/flags/us.png" alt="United States" /&#62; Output: <img src="assets/images/flags/us.png" alt="United States" /> Note: Click the icon to copy the image name </pre> </div> </div> </div> </div> </section> <!-- /MIDDLE --> </div> <!-- JAVASCRIPT FILES --> <script type="text/javascript">var plugin_path = 'assets/plugins/';</script> <script type="text/javascript" src="assets/plugins/jquery/jquery-2.1.4.min.js"></script> <script type="text/javascript" src="assets/js/app.js"></script> <!-- PAGE LEVEL SCRIPTS --> <script type="text/javascript">/* <![CDATA[ */ /* Icon prompt */ jQuery(".iconFlags div.flag-icon").bind("click", function(e) { if(!jQuery(this).hasClass('external')) { window.prompt ("Copy to clipboard: Ctrl+C, Enter/Esc", jQuery("img", this).attr('src')/*.replace('assets/images/flags/', '')*/); e.preventDefault(); } }); /* Inline Search */ jQuery("#inline-search").keyup(function() { var keywords = jQuery.trim(this.value); if (keywords == "") { _unfilter(); } else { _filter(keywords); } }); function _filter(keywords) { jQuery("div.flag-icon, h4.page-header").hide(); jQuery('div.flag-icon>img[alt*="'+capitaliseFirstLetter(keywords)+'"]').parent().show(); } function _unfilter() { jQuery("div.flag-icon, h4.page-header").show() } function capitaliseFirstLetter(string) { var string = string.toLowerCase(); return string.charAt(0).toUpperCase() + string.slice(1); } /* ]]> */</script> </body> </html>
{ "content_hash": "ae8950d457ebef57b64287672507b500", "timestamp": "", "source": "github", "line_count": 1201, "max_line_length": 240, "avg_line_length": 43.25811823480433, "alnum_prop": 0.5527688487671549, "repo_name": "Emkrypted/premiereimports", "id": "3bac881c89db8b22e380c0b09c19ed24c8134a7f", "size": "51957", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Admin/HTML/ui-icons-flags.html", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "536" }, { "name": "CSS", "bytes": "3314662" }, { "name": "Go", "bytes": "7075" }, { "name": "HTML", "bytes": "44242431" }, { "name": "JavaScript", "bytes": "10627060" }, { "name": "PHP", "bytes": "2579516" }, { "name": "Python", "bytes": "5844" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "137a367f483151a582d9590cd99d2542", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "23c447f42a80aa241596ab633738dc2f57a1a170", "size": "184", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Juncaceae/Juncus/Juncus oxycarpus/ Syn. Juncus quartinianus/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
* [Swift 学习指引](http://www.swiftguide.cn/) * [Swift 文档](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/AccessControl.html#//apple_ref/doc/uid/TP40014097-CH41-ID3) * [stack overflow](http://stackoverflow.com/questions/24002369/how-to-call-objective-c-code-from-swift) | | Import into Swift | Import into Objective-C |--------|---------|--------|----------- | Swift code | No import statement | #import "ProductModuleName-Swift.h" | Objective-C code | No import statement; Objective-C bridging header required | #import "Header.h"
{ "content_hash": "1d3c8ca225db9858e26e66f5fdc54f5e", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 174, "avg_line_length": 65.33333333333333, "alnum_prop": 0.7125850340136054, "repo_name": "zjsrose/zjsheng_blog", "id": "ed552da0e531afb06385713572926ffb73465811", "size": "645", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "swift/MixAndMatchOverview.md", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "27877" }, { "name": "C++", "bytes": "2287" }, { "name": "CMake", "bytes": "10003" }, { "name": "Ruby", "bytes": "2642" }, { "name": "Shell", "bytes": "30031" }, { "name": "TSQL", "bytes": "2477" } ], "symlink_target": "" }
'use strict'; describe('Controller: InventoryItemCtrl', function () { // load the controller's module beforeEach(module('tdpharmaClientApp')); var InventoryItemCtrl, scope; // Initialize the controller and a mock scope beforeEach(inject(function ($controller, $rootScope) { scope = $rootScope.$new(); InventoryItemCtrl = $controller('InventoryItemCtrl', { $scope: scope }); })); it('should ...', function () { expect(1).toEqual(1); }); });
{ "content_hash": "b5671236fd80bf612908b38fd00dfb11", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 58, "avg_line_length": 23, "alnum_prop": 0.6521739130434783, "repo_name": "tdang2/tdpharma-client", "id": "adb610dd4f179f5990d04a260869456d702237cb", "size": "483", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "client/app/inventory/item/inventoryItem.controller.spec.js", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "24139" }, { "name": "CSS", "bytes": "5303" }, { "name": "HTML", "bytes": "58874" }, { "name": "JavaScript", "bytes": "129675" } ], "symlink_target": "" }
"""Wraps the body of a converted function with auxiliary constructs.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import gast from tensorflow.python.autograph.core import converter from tensorflow.python.autograph.pyct import anno from tensorflow.python.autograph.pyct import templates from tensorflow.python.autograph.pyct.static_analysis import annos class _Function(object): def __init__(self): self.context_name = None class FunctionBodyTransformer(converter.Base): """Wraps function bodies around autograph-specific boilerplate.""" def visit_Return(self, node): if node.value is None: return node return templates.replace( 'return function_context_name.mark_return_value(value)', function_context_name=self.state[_Function].context_name, value=node.value) def _function_scope_options(self): """Returns the options with which to create function scopes.""" # Top-level function receive the options that were directly requested. # All others receive the options corresponding to a recursive conversion. # Note: this mainly controls the user_requested flag, which is important # primarily because the FunctionScope context also creates a # ControlStatusCtx(autograph=ENABLED) when user_requested is True. See # function_wrappers.py. if self.state[_Function].level == 2: return self.ctx.program.options return self.ctx.program.options.call_options() def visit_Lambda(self, node): self.state[_Function].enter() node = self.generic_visit(node) # Only wrap the top-level function. Theoretically, we can and should wrap # everything, but that can lead to excessive boilerplate when lambdas are # nested. # TODO(mdan): Looks more closely for use cases that actually require this. if self.state[_Function].level > 2: self.state[_Function].exit() return node scope = anno.getanno(node, anno.Static.SCOPE) function_context_name = self.ctx.namer.new_symbol('lscope', scope.referenced) self.state[_Function].context_name = function_context_name anno.setanno(node, 'function_context_name', function_context_name) template = """ ag__.with_function_scope( lambda function_context: body, function_context_name, options) """ node.body = templates.replace_as_expression( template, options=self._function_scope_options().to_ast(), function_context=function_context_name, function_context_name=gast.Constant(function_context_name, kind=None), body=node.body) self.state[_Function].exit() return node def visit_FunctionDef(self, node): self.state[_Function].enter() scope = anno.getanno(node, annos.NodeAnno.BODY_SCOPE) function_context_name = self.ctx.namer.new_symbol('fscope', scope.referenced) self.state[_Function].context_name = function_context_name anno.setanno(node, 'function_context_name', function_context_name) node = self.generic_visit(node) docstring_node = None if node.body: first_statement = node.body[0] if (isinstance(first_statement, gast.Expr) and isinstance(first_statement.value, gast.Constant)): docstring_node = first_statement node.body = node.body[1:] template = """ with ag__.FunctionScope( function_name, context_name, options) as function_context: body """ wrapped_body = templates.replace( template, function_name=gast.Constant(node.name, kind=None), context_name=gast.Constant(function_context_name, kind=None), options=self._function_scope_options().to_ast(), function_context=function_context_name, body=node.body) if docstring_node is not None: wrapped_body = [docstring_node] + wrapped_body node.body = wrapped_body self.state[_Function].exit() return node def transform(node, ctx): return FunctionBodyTransformer(ctx).visit(node)
{ "content_hash": "8e92cc87db138a3ff5265ef6557f4b2e", "timestamp": "", "source": "github", "line_count": 118, "max_line_length": 78, "avg_line_length": 35.21186440677966, "alnum_prop": 0.6813477737665463, "repo_name": "renyi533/tensorflow", "id": "100a14e44949aa9df614e7dd7dce9fe85b98ec1e", "size": "4844", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "tensorflow/python/autograph/converters/function_scopes.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "31572" }, { "name": "Batchfile", "bytes": "55269" }, { "name": "C", "bytes": "903309" }, { "name": "C#", "bytes": "8562" }, { "name": "C++", "bytes": "82507951" }, { "name": "CMake", "bytes": "6967" }, { "name": "Dockerfile", "bytes": "113964" }, { "name": "Go", "bytes": "1871425" }, { "name": "HTML", "bytes": "4686483" }, { "name": "Java", "bytes": "988219" }, { "name": "Jupyter Notebook", "bytes": "550861" }, { "name": "LLVM", "bytes": "6536" }, { "name": "MLIR", "bytes": "2073744" }, { "name": "Makefile", "bytes": "66796" }, { "name": "Objective-C", "bytes": "116558" }, { "name": "Objective-C++", "bytes": "319021" }, { "name": "PHP", "bytes": "4236" }, { "name": "Pascal", "bytes": "318" }, { "name": "Pawn", "bytes": "20422" }, { "name": "Perl", "bytes": "7536" }, { "name": "Python", "bytes": "37811412" }, { "name": "RobotFramework", "bytes": "1779" }, { "name": "Roff", "bytes": "2705" }, { "name": "Ruby", "bytes": "7464" }, { "name": "SWIG", "bytes": "6846" }, { "name": "Shell", "bytes": "696058" }, { "name": "Smarty", "bytes": "35725" }, { "name": "Starlark", "bytes": "3655758" }, { "name": "Swift", "bytes": "62814" }, { "name": "Vim Snippet", "bytes": "58" } ], "symlink_target": "" }
require "concurrent/map" module ActiveRecord module ConnectionAdapters # :nodoc: module QueryCache class << self def included(base) #:nodoc: dirties_query_cache base, :create, :insert, :update, :delete, :truncate, :truncate_tables, :rollback_to_savepoint, :rollback_db_transaction, :exec_insert_all base.set_callback :checkout, :after, :configure_query_cache! base.set_callback :checkin, :after, :disable_query_cache! end def dirties_query_cache(base, *method_names) method_names.each do |method_name| base.class_eval <<-end_code, __FILE__, __LINE__ + 1 def #{method_name}(*) ActiveRecord::Base.clear_query_caches_for_current_thread super end end_code end end end module ConnectionPoolConfiguration def initialize(*) super @query_cache_enabled = Concurrent::Map.new { false } end def enable_query_cache! @query_cache_enabled[connection_cache_key(current_thread)] = true connection.enable_query_cache! if active_connection? end def disable_query_cache! @query_cache_enabled.delete connection_cache_key(current_thread) connection.disable_query_cache! if active_connection? end def query_cache_enabled @query_cache_enabled[connection_cache_key(current_thread)] end end attr_reader :query_cache, :query_cache_enabled def initialize(*) super @query_cache = Hash.new { |h, sql| h[sql] = {} } @query_cache_enabled = false end # Enable the query cache within the block. def cache old, @query_cache_enabled = @query_cache_enabled, true yield ensure @query_cache_enabled = old clear_query_cache unless @query_cache_enabled end def enable_query_cache! @query_cache_enabled = true end def disable_query_cache! @query_cache_enabled = false clear_query_cache end # Disable the query cache within the block. def uncached old, @query_cache_enabled = @query_cache_enabled, false yield ensure @query_cache_enabled = old end # Clears the query cache. # # One reason you may wish to call this method explicitly is between queries # that ask the database to randomize results. Otherwise the cache would see # the same SQL query and repeatedly return the same result each time, silently # undermining the randomness you were expecting. def clear_query_cache @lock.synchronize do @query_cache.clear end end def select_all(arel, name = nil, binds = [], preparable: nil, async: false) arel = arel_from_relation(arel) # If arel is locked this is a SELECT ... FOR UPDATE or somesuch. # Such queries should not be cached. if @query_cache_enabled && !(arel.respond_to?(:locked) && arel.locked) sql, binds, preparable = to_sql_and_binds(arel, binds, preparable) if async lookup_sql_cache(sql, name, binds) || super(sql, name, binds, preparable: preparable, async: async) else cache_sql(sql, name, binds) { super(sql, name, binds, preparable: preparable, async: async) } end else super end end private def lookup_sql_cache(sql, name, binds) @lock.synchronize do if @query_cache[sql].key?(binds) ActiveSupport::Notifications.instrument( "sql.active_record", cache_notification_info(sql, name, binds) ) @query_cache[sql][binds] end end end def cache_sql(sql, name, binds) @lock.synchronize do result = if @query_cache[sql].key?(binds) ActiveSupport::Notifications.instrument( "sql.active_record", cache_notification_info(sql, name, binds) ) @query_cache[sql][binds] else @query_cache[sql][binds] = yield end result.dup end end # Database adapters can override this method to # provide custom cache information. def cache_notification_info(sql, name, binds) { sql: sql, binds: binds, type_casted_binds: -> { type_casted_binds(binds) }, name: name, connection: self, cached: true } end def configure_query_cache! enable_query_cache! if pool.query_cache_enabled end end end end
{ "content_hash": "c1da9bc881b4a0de35e607705389f554", "timestamp": "", "source": "github", "line_count": 159, "max_line_length": 111, "avg_line_length": 30.89937106918239, "alnum_prop": 0.5644209240789742, "repo_name": "joonyou/rails", "id": "1f45664b771e1e44801c2d2cce8d36aac940e4e7", "size": "4944", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "31966" }, { "name": "CoffeeScript", "bytes": "41831" }, { "name": "HTML", "bytes": "475077" }, { "name": "JavaScript", "bytes": "128640" }, { "name": "Ruby", "bytes": "12088752" }, { "name": "Shell", "bytes": "4532" }, { "name": "Yacc", "bytes": "983" } ], "symlink_target": "" }
/** * Connections * Pokemon Showdown - http://pokemonshowdown.com/ * * Abstraction layer for multi-process SockJS connections. * * This file handles all the communications between the users' * browsers, the networking processes, and users.js in the * main process. * * @license MIT license */ var cluster = require('cluster'); global.Config = require('./config/config'); if (cluster.isMaster) { cluster.setupMaster({ exec: 'sockets.js' }); var workers = exports.workers = {}; var spawnWorker = exports.spawnWorker = function () { var worker = cluster.fork({PSPORT: Config.port}); var id = worker.id; workers[id] = worker; worker.on('message', function (data) { // console.log('master received: ' + data); switch (data.charAt(0)) { case '*': // *socketid, ip // connect var nlPos = data.indexOf('\n'); Users.socketConnect(worker, id, data.substr(1, nlPos - 1), data.substr(nlPos + 1)); break; case '!': // !socketid // disconnect Users.socketDisconnect(worker, id, data.substr(1)); break; case '<': // <socketid, message // message var nlPos = data.indexOf('\n'); Users.socketReceive(worker, id, data.substr(1, nlPos - 1), data.substr(nlPos + 1)); break; } }); }; var workerCount = Config.workers || 1; for (var i = 0; i < workerCount; i++) { spawnWorker(); } var killWorker = exports.killWorker = function (worker) { var idd = worker.id + '-'; var count = 0; for (var connectionid in Users.connections) { if (connectionid.substr(idd.length) === idd) { var connection = Users.connections[connectionid]; Users.socketDisconnect(worker, worker.id, connection.socketid); count++; } } try { worker.kill(); } catch (e) {} delete workers[worker.id]; return count; }; var killPid = exports.killPid = function (pid) { pid = '' + pid; for (var id in workers) { var worker = workers[id]; if (pid === '' + worker.process.pid) { return killWorker(worker); } } return false; }; exports.socketSend = function (worker, socketid, message) { worker.send('>' + socketid + '\n' + message); }; exports.socketDisconnect = function (worker, socketid) { worker.send('!' + socketid); }; exports.channelBroadcast = function (channelid, message) { for (var workerid in workers) { workers[workerid].send('#' + channelid + '\n' + message); } }; exports.channelSend = function (worker, channelid, message) { worker.send('#' + channelid + '\n' + message); }; exports.channelAdd = function (worker, channelid, socketid) { worker.send('+' + channelid + '\n' + socketid); }; exports.channelRemove = function (worker, channelid, socketid) { worker.send('-' + channelid + '\n' + socketid); }; exports.subchannelBroadcast = function (channelid, message) { for (var workerid in workers) { workers[workerid].send(':' + channelid + '\n' + message); } }; exports.subchannelMove = function (worker, channelid, subchannelid, socketid) { worker.send('.' + channelid + '\n' + subchannelid + '\n' + socketid); }; } else { // is worker if (process.env.PSPORT) Config.port = +process.env.PSPORT; // ofe is optional // if installed, it will heap dump if the process runs out of memory try { require('ofe').call(); } catch (e) {} // Static HTTP server // This handles the custom CSS and custom avatar features, and also // redirects yourserver:8001 to yourserver-8001.psim.us // It's optional if you don't need these features. global.Cidr = require('./cidr'); if (Config.crashguard) { // graceful crash process.on('uncaughtException', function (err) { require('./crashlogger.js')(err, 'Socket process ' + cluster.worker.id + ' (' + process.pid + ')'); }); } var app = require('http').createServer(); var appssl; if (Config.ssl) { appssl = require('https').createServer(Config.ssl.options); } try { (function () { var nodestatic = require('node-static'); var cssserver = new nodestatic.Server('./config'); var avatarserver = new nodestatic.Server('./config/avatars'); var staticserver = new nodestatic.Server('./static'); var staticRequestHandler = function (request, response) { request.resume(); request.addListener('end', function () { if (Config.customhttpresponse && Config.customhttpresponse(request, response)) { return; } var server; if (request.url === '/custom.css') { server = cssserver; } else if (request.url.substr(0, 9) === '/avatars/') { request.url = request.url.substr(8); server = avatarserver; } else { if (/^\/([A-Za-z0-9][A-Za-z0-9-]*)\/?$/.test(request.url)) { request.url = '/'; } server = staticserver; } server.serve(request, response, function (e, res) { if (e && (e.status === 404)) { staticserver.serveFile('404.html', 404, {}, request, response); } }); }); }; app.on('request', staticRequestHandler); if (appssl) { appssl.on('request', staticRequestHandler); } })(); } catch (e) { console.log('Could not start node-static - try `npm install` if you want to use it'); } // SockJS server // This is the main server that handles users connecting to our server // and doing things on our server. var sockjs = require('sockjs'); var server = sockjs.createServer({ sockjs_url: "//play.pokemonshowdown.com/js/lib/sockjs-0.3.min.js", log: function (severity, message) { if (severity === 'error') console.log('ERROR: ' + message); }, prefix: '/showdown', websocket: !Config.disablewebsocket }); var sockets = {}; var channels = {}; var subchannels = {}; // Deal with phantom connections. var sweepClosedSockets = function () { for (var s in sockets) { if (sockets[s].protocol === 'xhr-streaming' && sockets[s]._session && sockets[s]._session.recv) { sockets[s]._session.recv.didClose(); } // A ghost connection's `_session.to_tref._idlePrev` (and `_idleNext`) property is `null` while // it is an object for normal users. Under normal circumstances, those properties should only be // `null` when the timeout has already been called, but somehow it's not happening for some connections. // Simply calling `_session.timeout_cb` (the function bound to the aformentioned timeout) manually // on those connections kills those connections. For a bit of background, this timeout is the timeout // that sockjs sets to wait for users to reconnect within that time to continue their session. if (sockets[s]._session && sockets[s]._session.to_tref && !sockets[s]._session.to_tref._idlePrev) { sockets[s]._session.timeout_cb(); } } }; var interval; if (!Config.herokuhack) { interval = setInterval(sweepClosedSockets, 1000 * 60 * 10); } process.on('message', function (data) { // console.log('worker received: ' + data); var socket = null; var channel = null; var socketid = null; var channelid = null; switch (data.charAt(0)) { case '!': // !socketid // destroy socketid = data.substr(1); socket = sockets[socketid]; if (!socket) return; socket.end(); // After sending the FIN packet, we make sure the I/O is totally blocked for this socket socket.destroy(); delete sockets[socketid]; for (channelid in channels) { delete channels[channelid][socketid]; } break; case '>': // >socketid, message // message var nlLoc = data.indexOf('\n'); socket = sockets[data.substr(1, nlLoc - 1)]; if (!socket) return; socket.write(data.substr(nlLoc + 1)); break; case '#': // #channelid, message // message to channel var nlLoc = data.indexOf('\n'); channel = channels[data.substr(1, nlLoc - 1)]; var message = data.substr(nlLoc + 1); for (socketid in channel) { channel[socketid].write(message); } break; case '+': // +channelid, socketid // add to channel var nlLoc = data.indexOf('\n'); socketid = data.substr(nlLoc + 1); socket = sockets[socketid]; if (!socket) return; channelid = data.substr(1, nlLoc - 1); channel = channels[channelid]; if (!channel) channel = channels[channelid] = Object.create(null); channel[socketid] = socket; break; case '-': // -channelid, socketid // remove from channel var nlLoc = data.indexOf('\n'); var channelid = data.slice(1, nlLoc); channel = channels[channelid]; if (!channel) return; var socketid = data.slice(nlLoc + 1); delete channel[socketid]; if (subchannels[channelid]) delete subchannels[channelid][socketid]; var isEmpty = true; for (var socketid in channel) { isEmpty = false; break; } if (isEmpty) { delete channels[channelid]; delete subchannels[channelid]; } break; case '.': // .channelid, subchannelid, socketid // move subchannel var nlLoc = data.indexOf('\n'); var channelid = data.slice(1, nlLoc); var nlLoc2 = data.indexOf('\n', nlLoc + 1); var subchannelid = data.slice(nlLoc + 1, nlLoc2); var socketid = data.slice(nlLoc2 + 1); var subchannel = subchannels[channelid]; if (!subchannel) subchannel = subchannels[channelid] = Object.create(null); if (subchannelid === '0') { delete subchannel[socketid]; } else { subchannel[socketid] = subchannelid; } break; case ':': // :channelid, message // message to subchannel var nlLoc = data.indexOf('\n'); var channelid = data.slice(1, nlLoc); var channel = channels[channelid]; var subchannel = subchannels[channelid]; var message = data.substr(nlLoc + 1); var messages = [null, null, null]; for (socketid in channel) { switch (subchannel ? subchannel[socketid] : '0') { case '1': if (!messages[1]) { messages[1] = message.replace(/\n\|split\n[^\n]*\n([^\n]*)\n[^\n]*\n[^\n]*/g, '\n$1\n'); } channel[socketid].write(messages[1]); break; case '2': if (!messages[2]) { messages[2] = message.replace(/\n\|split\n[^\n]*\n[^\n]*\n([^\n]*)\n[^\n]*/g, '\n$1\n'); } channel[socketid].write(messages[2]); break; default: if (!messages[0]) { messages[0] = message.replace(/\n\|split\n([^\n]*)\n[^\n]*\n[^\n]*\n[^\n]*/g, '\n$1\n'); } channel[socketid].write(messages[0]); break; } } break; } }); // this is global so it can be hotpatched if necessary var isTrustedProxyIp = Cidr.checker(Config.proxyip); var socketCounter = 0; server.on('connection', function (socket) { if (!socket) { // For reasons that are not entirely clear, SockJS sometimes triggers // this event with a null `socket` argument. return; } else if (!socket.remoteAddress) { // This condition occurs several times per day. It may be a SockJS bug. try { socket.end(); } catch (e) {} return; } var socketid = socket.id = (++socketCounter); sockets[socket.id] = socket; if (isTrustedProxyIp(socket.remoteAddress)) { var ips = (socket.headers['x-forwarded-for'] || '').split(','); var ip; while ((ip = ips.pop())) { ip = ip.trim(); if (!isTrustedProxyIp(ip)) { socket.remoteAddress = ip; break; } } } process.send('*' + socketid + '\n' + socket.remoteAddress); // console.log('CONNECT: ' + socket.remoteAddress + ' [' + socket.id + ']'); var interval; if (Config.herokuhack) { // see https://github.com/sockjs/sockjs-node/issues/57#issuecomment-5242187 interval = setInterval(function () { try { socket._session.recv.didClose(); } catch (e) {} }, 15000); } socket.on('data', function (message) { // drop empty messages (DDoS?) if (!message) return; // drop blank messages (DDoS?) var pipeIndex = message.indexOf('|'); if (pipeIndex < 0 || pipeIndex === message.length - 1) return; // drop legacy JSON messages if (message.charAt(0) === '{') return; process.send('<' + socketid + '\n' + message); }); socket.on('close', function () { if (interval) { clearInterval(interval); } process.send('!' + socketid); delete sockets[socketid]; for (var channelid in channels) { delete channels[channelid][socketid]; } }); }); server.installHandlers(app, {}); app.listen(Config.port); console.log('Worker ' + cluster.worker.id + ' now listening on port ' + Config.port); if (appssl) { server.installHandlers(appssl, {}); appssl.listen(Config.ssl.port); console.log('Worker ' + cluster.worker.id + ' now listening for SSL on port ' + Config.ssl.port); } console.log('Test your server at http://localhost:' + Config.port); }
{ "content_hash": "8c592d5e324caa9cbceeba0615819334", "timestamp": "", "source": "github", "line_count": 437, "max_line_length": 107, "avg_line_length": 28.83295194508009, "alnum_prop": 0.6285714285714286, "repo_name": "SkyllRaven/hot-choco", "id": "2b48547192bdd95b745e57c49c4c1b55dee5bf45", "size": "12600", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "sockets.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "351" }, { "name": "JavaScript", "bytes": "2457945" } ], "symlink_target": "" }
package org.apache.rat.analysis.util; import org.apache.rat.analysis.IHeaderMatcher; import org.apache.rat.analysis.MockLicenseMatcher; import org.apache.rat.api.Document; import org.apache.rat.document.MockLocation; import org.apache.rat.report.claim.impl.xml.MockClaimReporter; import org.junit.Before; import org.junit.Test; import java.util.Arrays; import static org.junit.Assert.assertEquals; public class MatcherMultiplexerTest { private static final String LINE_ONE = "Line One"; private static final String LINE_TWO = "Line Two"; private MockClaimReporter reporter; private MockLicenseMatcher matcherOne; private MockLicenseMatcher matcherTwo; private HeaderMatcherMultiplexer multiplexer; @Before public void setUp() { matcherOne = new MockLicenseMatcher(); matcherTwo = new MockLicenseMatcher(); multiplexer = new HeaderMatcherMultiplexer(Arrays.<IHeaderMatcher>asList(matcherOne, matcherTwo)); reporter = new MockClaimReporter(); } @Test public void testMatcherLine() throws Exception { matcherOne.result = false; matcherTwo.result = false; final Document subject = new MockLocation("subject"); multiplexer.match(subject, LINE_ONE); assertEquals("One line", 1, matcherOne.lines.size()); assertEquals("Same as line passed", LINE_ONE, matcherOne.lines.get(0)); assertEquals("One line", 1, matcherTwo.lines.size()); assertEquals("Same as line passed", LINE_ONE, matcherTwo.lines.get(0)); multiplexer.match(subject, LINE_TWO); assertEquals("One line", 2, matcherOne.lines.size()); assertEquals("Same as line passed", LINE_TWO, matcherOne.lines.get(1)); assertEquals("One line", 2, matcherTwo.lines.size()); assertEquals("Same as line passed", LINE_TWO, matcherTwo.lines.get(1)); } @Test public void testReset() { multiplexer.reset(); assertEquals("Reset once", 1, matcherOne.resets); assertEquals("Reset once", 1, matcherTwo.resets); multiplexer.reset(); assertEquals("Reset twice", 2, matcherOne.resets); assertEquals("Reset twice", 2, matcherTwo.resets); } }
{ "content_hash": "0f7620d685377e35ba14bab7847a4a04", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 106, "avg_line_length": 36.459016393442624, "alnum_prop": 0.6960431654676259, "repo_name": "apache/creadur-rat", "id": "68d89105c5c96b2d5513f689ae61aeeb4a069510", "size": "3286", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "apache-rat-core/src/test/java/org/apache/rat/analysis/util/MatcherMultiplexerTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "3005" }, { "name": "CSS", "bytes": "5095" }, { "name": "Groovy", "bytes": "1985" }, { "name": "HTML", "bytes": "19030" }, { "name": "Java", "bytes": "673394" }, { "name": "Python", "bytes": "8362" }, { "name": "Ruby", "bytes": "1616" }, { "name": "Shell", "bytes": "1019" }, { "name": "XSLT", "bytes": "5567" } ], "symlink_target": "" }
/** * @implements {SDK.TargetManager.Observer} */ SDK.ConsoleModel = class extends Common.Object { constructor() { super(); /** @type {!Array.<!SDK.ConsoleMessage>} */ this._messages = []; /** @type {!Map<!SDK.RuntimeModel, !Map<number, !SDK.ConsoleMessage>>} */ this._messageByExceptionId = new Map(); this._warnings = 0; this._errors = 0; this._pageLoadSequenceNumber = 0; SDK.targetManager.observeTargets(this); } /** * @override * @param {!SDK.Target} target */ targetAdded(target) { const resourceTreeModel = target.model(SDK.ResourceTreeModel); if (!resourceTreeModel || resourceTreeModel.cachedResourcesLoaded()) { this._initTarget(target); return; } const eventListener = resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.CachedResourcesLoaded, () => { Common.EventTarget.removeEventListeners([eventListener]); this._initTarget(target); }); } /** * @param {!SDK.Target} target */ _initTarget(target) { const eventListeners = []; const cpuProfilerModel = target.model(SDK.CPUProfilerModel); if (cpuProfilerModel) { eventListeners.push(cpuProfilerModel.addEventListener( SDK.CPUProfilerModel.Events.ConsoleProfileStarted, this._consoleProfileStarted.bind(this, cpuProfilerModel))); eventListeners.push(cpuProfilerModel.addEventListener( SDK.CPUProfilerModel.Events.ConsoleProfileFinished, this._consoleProfileFinished.bind(this, cpuProfilerModel))); } const resourceTreeModel = target.model(SDK.ResourceTreeModel); if (resourceTreeModel && !target.parentTarget()) { eventListeners.push(resourceTreeModel.addEventListener( SDK.ResourceTreeModel.Events.MainFrameNavigated, this._mainFrameNavigated, this)); } const runtimeModel = target.model(SDK.RuntimeModel); if (runtimeModel) { eventListeners.push(runtimeModel.addEventListener( SDK.RuntimeModel.Events.ExceptionThrown, this._exceptionThrown.bind(this, runtimeModel))); eventListeners.push(runtimeModel.addEventListener( SDK.RuntimeModel.Events.ExceptionRevoked, this._exceptionRevoked.bind(this, runtimeModel))); eventListeners.push(runtimeModel.addEventListener( SDK.RuntimeModel.Events.ConsoleAPICalled, this._consoleAPICalled.bind(this, runtimeModel))); if (!target.parentTarget()) { eventListeners.push(runtimeModel.debuggerModel().addEventListener( SDK.DebuggerModel.Events.GlobalObjectCleared, this._clearIfNecessary, this)); } eventListeners.push(runtimeModel.addEventListener( SDK.RuntimeModel.Events.QueryObjectRequested, this._queryObjectRequested.bind(this, runtimeModel))); } target[SDK.ConsoleModel._events] = eventListeners; } /** * @override * @param {!SDK.Target} target */ targetRemoved(target) { const runtimeModel = target.model(SDK.RuntimeModel); if (runtimeModel) this._messageByExceptionId.delete(runtimeModel); Common.EventTarget.removeEventListeners(target[SDK.ConsoleModel._events] || []); } /** * @param {!SDK.ExecutionContext} executionContext * @param {!SDK.ConsoleMessage} originatingMessage * @param {string} expression * @param {boolean} useCommandLineAPI * @param {boolean} awaitPromise */ async evaluateCommandInConsole(executionContext, originatingMessage, expression, useCommandLineAPI, awaitPromise) { const result = await executionContext.evaluate( { expression: expression, objectGroup: 'console', includeCommandLineAPI: useCommandLineAPI, silent: false, returnByValue: false, generatePreview: true }, /* userGesture */ true, awaitPromise); Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConsoleEvaluated); if (result.error) return; await Common.console.showPromise(); this.dispatchEventToListeners( SDK.ConsoleModel.Events.CommandEvaluated, {result: result.object, commandMessage: originatingMessage, exceptionDetails: result.exceptionDetails}); } /** * @param {!SDK.ExecutionContext} executionContext * @param {string} text * @return {!SDK.ConsoleMessage} */ addCommandMessage(executionContext, text) { const commandMessage = new SDK.ConsoleMessage( executionContext.runtimeModel, SDK.ConsoleMessage.MessageSource.JS, null, text, SDK.ConsoleMessage.MessageType.Command); commandMessage.setExecutionContextId(executionContext.id); this.addMessage(commandMessage); return commandMessage; } /** * @param {!SDK.ConsoleMessage} msg */ addMessage(msg) { if (msg.source === SDK.ConsoleMessage.MessageSource.Worker && SDK.targetManager.targetById(msg.workerId)) return; msg._pageLoadSequenceNumber = this._pageLoadSequenceNumber; if (msg.source === SDK.ConsoleMessage.MessageSource.ConsoleAPI && msg.type === SDK.ConsoleMessage.MessageType.Clear) this._clearIfNecessary(); this._messages.push(msg); const runtimeModel = msg.runtimeModel(); if (msg._exceptionId && runtimeModel) { let modelMap = this._messageByExceptionId.get(runtimeModel); if (!modelMap) { modelMap = new Map(); this._messageByExceptionId.set(runtimeModel, modelMap); } modelMap.set(msg._exceptionId, msg); } this._incrementErrorWarningCount(msg); this.dispatchEventToListeners(SDK.ConsoleModel.Events.MessageAdded, msg); } /** * @param {!SDK.RuntimeModel} runtimeModel * @param {!Common.Event} event */ _exceptionThrown(runtimeModel, event) { const exceptionWithTimestamp = /** @type {!SDK.RuntimeModel.ExceptionWithTimestamp} */ (event.data); const consoleMessage = SDK.ConsoleMessage.fromException( runtimeModel, exceptionWithTimestamp.details, undefined, exceptionWithTimestamp.timestamp, undefined); consoleMessage.setExceptionId(exceptionWithTimestamp.details.exceptionId); this.addMessage(consoleMessage); } /** * @param {!SDK.RuntimeModel} runtimeModel * @param {!Common.Event} event */ _exceptionRevoked(runtimeModel, event) { const exceptionId = /** @type {number} */ (event.data); const modelMap = this._messageByExceptionId.get(runtimeModel); const exceptionMessage = modelMap ? modelMap.get(exceptionId) : null; if (!exceptionMessage) return; this._errors--; exceptionMessage.level = SDK.ConsoleMessage.MessageLevel.Info; this.dispatchEventToListeners(SDK.ConsoleModel.Events.MessageUpdated, exceptionMessage); } /** * @param {!SDK.RuntimeModel} runtimeModel * @param {!Common.Event} event */ _consoleAPICalled(runtimeModel, event) { const call = /** @type {!SDK.RuntimeModel.ConsoleAPICall} */ (event.data); let level = SDK.ConsoleMessage.MessageLevel.Info; if (call.type === SDK.ConsoleMessage.MessageType.Debug) level = SDK.ConsoleMessage.MessageLevel.Verbose; else if (call.type === SDK.ConsoleMessage.MessageType.Error || call.type === SDK.ConsoleMessage.MessageType.Assert) level = SDK.ConsoleMessage.MessageLevel.Error; else if (call.type === SDK.ConsoleMessage.MessageType.Warning) level = SDK.ConsoleMessage.MessageLevel.Warning; else if (call.type === SDK.ConsoleMessage.MessageType.Info || call.type === SDK.ConsoleMessage.MessageType.Log) level = SDK.ConsoleMessage.MessageLevel.Info; let message = ''; if (call.args.length && call.args[0].unserializableValue) message = call.args[0].unserializableValue; else if (call.args.length && (typeof call.args[0].value !== 'object' || call.args[0].value === null)) message = call.args[0].value + ''; else if (call.args.length && call.args[0].description) message = call.args[0].description; const callFrame = call.stackTrace && call.stackTrace.callFrames.length ? call.stackTrace.callFrames[0] : null; const consoleMessage = new SDK.ConsoleMessage( runtimeModel, SDK.ConsoleMessage.MessageSource.ConsoleAPI, level, /** @type {string} */ (message), call.type, callFrame ? callFrame.url : undefined, callFrame ? callFrame.lineNumber : undefined, callFrame ? callFrame.columnNumber : undefined, call.args, call.stackTrace, call.timestamp, call.executionContextId, undefined, undefined, call.context); this.addMessage(consoleMessage); } /** * @param {!SDK.RuntimeModel} runtimeModel * @param {!Common.Event} event */ _queryObjectRequested(runtimeModel, event) { const consoleMessage = new SDK.ConsoleMessage( runtimeModel, SDK.ConsoleMessage.MessageSource.ConsoleAPI, SDK.ConsoleMessage.MessageLevel.Info, '', SDK.ConsoleMessage.MessageType.QueryObjectResult, undefined, undefined, undefined, [event.data.objects]); this.addMessage(consoleMessage); } _clearIfNecessary() { if (!Common.moduleSetting('preserveConsoleLog').get()) this._clear(); ++this._pageLoadSequenceNumber; } /** * @param {!Common.Event} event */ _mainFrameNavigated(event) { if (Common.moduleSetting('preserveConsoleLog').get()) Common.console.log(Common.UIString('Navigated to %s', event.data.url)); } /** * @param {!SDK.CPUProfilerModel} cpuProfilerModel * @param {!Common.Event} event */ _consoleProfileStarted(cpuProfilerModel, event) { const data = /** @type {!SDK.CPUProfilerModel.EventData} */ (event.data); this._addConsoleProfileMessage( cpuProfilerModel, SDK.ConsoleMessage.MessageType.Profile, data.scriptLocation, Common.UIString('Profile \'%s\' started.', data.title)); } /** * @param {!SDK.CPUProfilerModel} cpuProfilerModel * @param {!Common.Event} event */ _consoleProfileFinished(cpuProfilerModel, event) { const data = /** @type {!SDK.CPUProfilerModel.EventData} */ (event.data); this._addConsoleProfileMessage( cpuProfilerModel, SDK.ConsoleMessage.MessageType.ProfileEnd, data.scriptLocation, Common.UIString('Profile \'%s\' finished.', data.title)); } /** * @param {!SDK.CPUProfilerModel} cpuProfilerModel * @param {string} type * @param {!SDK.DebuggerModel.Location} scriptLocation * @param {string} messageText */ _addConsoleProfileMessage(cpuProfilerModel, type, scriptLocation, messageText) { const stackTrace = [{ functionName: '', scriptId: scriptLocation.scriptId, url: scriptLocation.script() ? scriptLocation.script().contentURL() : '', lineNumber: scriptLocation.lineNumber, columnNumber: scriptLocation.columnNumber || 0 }]; this.addMessage(new SDK.ConsoleMessage( cpuProfilerModel.runtimeModel(), SDK.ConsoleMessage.MessageSource.ConsoleAPI, SDK.ConsoleMessage.MessageLevel.Info, messageText, type, undefined, undefined, undefined, stackTrace)); } /** * @param {!SDK.ConsoleMessage} msg */ _incrementErrorWarningCount(msg) { if (msg.source === SDK.ConsoleMessage.MessageSource.Violation) return; switch (msg.level) { case SDK.ConsoleMessage.MessageLevel.Warning: this._warnings++; break; case SDK.ConsoleMessage.MessageLevel.Error: this._errors++; break; } } /** * @return {!Array.<!SDK.ConsoleMessage>} */ messages() { return this._messages; } requestClearMessages() { for (const logModel of SDK.targetManager.models(SDK.LogModel)) logModel.requestClear(); for (const runtimeModel of SDK.targetManager.models(SDK.RuntimeModel)) runtimeModel.discardConsoleEntries(); this._clear(); } _clear() { this._messages = []; this._messageByExceptionId.clear(); this._errors = 0; this._warnings = 0; this.dispatchEventToListeners(SDK.ConsoleModel.Events.ConsoleCleared); } /** * @return {number} */ errors() { return this._errors; } /** * @return {number} */ warnings() { return this._warnings; } }; /** @enum {symbol} */ SDK.ConsoleModel.Events = { ConsoleCleared: Symbol('ConsoleCleared'), MessageAdded: Symbol('MessageAdded'), MessageUpdated: Symbol('MessageUpdated'), CommandEvaluated: Symbol('CommandEvaluated') }; /** * @unrestricted */ SDK.ConsoleMessage = class { /** * @param {?SDK.RuntimeModel} runtimeModel * @param {string} source * @param {?string} level * @param {string} messageText * @param {string=} type * @param {?string=} url * @param {number=} line * @param {number=} column * @param {!Array.<!Protocol.Runtime.RemoteObject>=} parameters * @param {!Protocol.Runtime.StackTrace=} stackTrace * @param {number=} timestamp * @param {!Protocol.Runtime.ExecutionContextId=} executionContextId * @param {?string=} scriptId * @param {?string=} workerId * @param {string=} context */ constructor( runtimeModel, source, level, messageText, type, url, line, column, parameters, stackTrace, timestamp, executionContextId, scriptId, workerId, context) { this._runtimeModel = runtimeModel; this.source = source; this.level = /** @type {?SDK.ConsoleMessage.MessageLevel} */ (level); this.messageText = messageText; this.type = type || SDK.ConsoleMessage.MessageType.Log; /** @type {string|undefined} */ this.url = url || undefined; /** @type {number} */ this.line = line || 0; /** @type {number} */ this.column = column || 0; this.parameters = parameters; /** @type {!Protocol.Runtime.StackTrace|undefined} */ this.stackTrace = stackTrace; this.timestamp = timestamp || Date.now(); this.executionContextId = executionContextId || 0; this.scriptId = scriptId || null; this.workerId = workerId || null; if (!this.executionContextId && this._runtimeModel) { if (this.scriptId) this.executionContextId = this._runtimeModel.executionContextIdForScriptId(this.scriptId); else if (this.stackTrace) this.executionContextId = this._runtimeModel.executionContextForStackTrace(this.stackTrace); } if (context) this.context = context.match(/[^#]*/)[0]; } /** * @param {!SDK.RuntimeModel} runtimeModel * @param {!Protocol.Runtime.ExceptionDetails} exceptionDetails * @param {string=} messageType * @param {number=} timestamp * @param {string=} forceUrl * @return {!SDK.ConsoleMessage} */ static fromException(runtimeModel, exceptionDetails, messageType, timestamp, forceUrl) { return new SDK.ConsoleMessage( runtimeModel, SDK.ConsoleMessage.MessageSource.JS, SDK.ConsoleMessage.MessageLevel.Error, SDK.RuntimeModel.simpleTextFromException(exceptionDetails), messageType, forceUrl || exceptionDetails.url, exceptionDetails.lineNumber, exceptionDetails.columnNumber, exceptionDetails.exception ? [SDK.RemoteObject.fromLocalObject(exceptionDetails.text), exceptionDetails.exception] : undefined, exceptionDetails.stackTrace, timestamp, exceptionDetails.executionContextId, exceptionDetails.scriptId); } /** * @return {?SDK.RuntimeModel} */ runtimeModel() { return this._runtimeModel; } /** * @return {?SDK.Target} */ target() { return this._runtimeModel ? this._runtimeModel.target() : null; } /** * @param {!SDK.ConsoleMessage} originatingMessage */ setOriginatingMessage(originatingMessage) { this._originatingConsoleMessage = originatingMessage; this.executionContextId = originatingMessage.executionContextId; } /** * @param {!Protocol.Runtime.ExecutionContextId} executionContextId */ setExecutionContextId(executionContextId) { this.executionContextId = executionContextId; } /** * @param {number} exceptionId */ setExceptionId(exceptionId) { this._exceptionId = exceptionId; } /** * @return {?SDK.ConsoleMessage} */ originatingMessage() { return this._originatingConsoleMessage; } /** * @return {boolean} */ isGroupMessage() { return this.type === SDK.ConsoleMessage.MessageType.StartGroup || this.type === SDK.ConsoleMessage.MessageType.StartGroupCollapsed || this.type === SDK.ConsoleMessage.MessageType.EndGroup; } /** * @return {boolean} */ isGroupStartMessage() { return this.type === SDK.ConsoleMessage.MessageType.StartGroup || this.type === SDK.ConsoleMessage.MessageType.StartGroupCollapsed; } /** * @return {boolean} */ isErrorOrWarning() { return ( this.level === SDK.ConsoleMessage.MessageLevel.Warning || this.level === SDK.ConsoleMessage.MessageLevel.Error); } /** * @return {boolean} */ isGroupable() { const isUngroupableError = this.level === SDK.ConsoleMessage.MessageLevel.Error && (this.source === SDK.ConsoleMessage.MessageSource.JS || this.source === SDK.ConsoleMessage.MessageSource.Network); return ( this.source !== SDK.ConsoleMessage.MessageSource.ConsoleAPI && this.type !== SDK.ConsoleMessage.MessageType.Command && this.type !== SDK.ConsoleMessage.MessageType.Result && this.type !== SDK.ConsoleMessage.MessageType.System && !isUngroupableError); } /** * @return {string} */ groupCategoryKey() { return [this.source, this.level, this.type, this._pageLoadSequenceNumber].join(':'); } /** * @param {?SDK.ConsoleMessage} msg * @return {boolean} */ isEqual(msg) { if (!msg) return false; if (!this._isEqualStackTraces(this.stackTrace, msg.stackTrace)) return false; if (this.parameters) { if (!msg.parameters || this.parameters.length !== msg.parameters.length) return false; for (let i = 0; i < msg.parameters.length; ++i) { // Never treat objects as equal - their properties might change over time. Errors can be treated as equal // since they are always formatted as strings. if (msg.parameters[i].type === 'object' && msg.parameters[i].subtype !== 'error') return false; if (this.parameters[i].type !== msg.parameters[i].type || this.parameters[i].value !== msg.parameters[i].value || this.parameters[i].description !== msg.parameters[i].description) return false; } } return (this.runtimeModel() === msg.runtimeModel()) && (this.source === msg.source) && (this.type === msg.type) && (this.level === msg.level) && (this.line === msg.line) && (this.url === msg.url) && (this.messageText === msg.messageText) && (this.request === msg.request) && (this.executionContextId === msg.executionContextId); } /** * @param {!Protocol.Runtime.StackTrace|undefined} stackTrace1 * @param {!Protocol.Runtime.StackTrace|undefined} stackTrace2 * @return {boolean} */ _isEqualStackTraces(stackTrace1, stackTrace2) { if (!stackTrace1 !== !stackTrace2) return false; if (!stackTrace1) return true; const callFrames1 = stackTrace1.callFrames; const callFrames2 = stackTrace2.callFrames; if (callFrames1.length !== callFrames2.length) return false; for (let i = 0, n = callFrames1.length; i < n; ++i) { if (callFrames1[i].url !== callFrames2[i].url || callFrames1[i].functionName !== callFrames2[i].functionName || callFrames1[i].lineNumber !== callFrames2[i].lineNumber || callFrames1[i].columnNumber !== callFrames2[i].columnNumber) return false; } return this._isEqualStackTraces(stackTrace1.parent, stackTrace2.parent); } }; // Note: Keep these constants in sync with the ones in ConsoleTypes.h /** * @enum {string} */ SDK.ConsoleMessage.MessageSource = { XML: 'xml', JS: 'javascript', Network: 'network', ConsoleAPI: 'console-api', Storage: 'storage', AppCache: 'appcache', Rendering: 'rendering', CSS: 'css', Security: 'security', Deprecation: 'deprecation', Worker: 'worker', Violation: 'violation', Intervention: 'intervention', Recommendation: 'recommendation', Other: 'other' }; /** * @enum {string} */ SDK.ConsoleMessage.MessageType = { Log: 'log', Debug: 'debug', Info: 'info', Error: 'error', Warning: 'warning', Dir: 'dir', DirXML: 'dirxml', Table: 'table', Trace: 'trace', Clear: 'clear', StartGroup: 'startGroup', StartGroupCollapsed: 'startGroupCollapsed', EndGroup: 'endGroup', Assert: 'assert', Result: 'result', Profile: 'profile', ProfileEnd: 'profileEnd', Command: 'command', System: 'system', QueryObjectResult: 'queryObjectResult' }; /** * @enum {string} */ SDK.ConsoleMessage.MessageLevel = { Verbose: 'verbose', Info: 'info', Warning: 'warning', Error: 'error' }; /** @type {!Map<!SDK.ConsoleMessage.MessageSource, string>} */ SDK.ConsoleMessage.MessageSourceDisplayName = new Map([ [SDK.ConsoleMessage.MessageSource.XML, 'xml'], [SDK.ConsoleMessage.MessageSource.JS, 'javascript'], [SDK.ConsoleMessage.MessageSource.Network, 'network'], [SDK.ConsoleMessage.MessageSource.ConsoleAPI, 'console-api'], [SDK.ConsoleMessage.MessageSource.Storage, 'storage'], [SDK.ConsoleMessage.MessageSource.AppCache, 'appcache'], [SDK.ConsoleMessage.MessageSource.Rendering, 'rendering'], [SDK.ConsoleMessage.MessageSource.CSS, 'css'], [SDK.ConsoleMessage.MessageSource.Security, 'security'], [SDK.ConsoleMessage.MessageSource.Deprecation, 'deprecation'], [SDK.ConsoleMessage.MessageSource.Worker, 'worker'], [SDK.ConsoleMessage.MessageSource.Violation, 'violation'], [SDK.ConsoleMessage.MessageSource.Intervention, 'intervention'], [SDK.ConsoleMessage.MessageSource.Recommendation, 'recommendation'], [SDK.ConsoleMessage.MessageSource.Other, 'other'] ]); SDK.ConsoleModel._events = Symbol('SDK.ConsoleModel.events'); /** * @type {!SDK.ConsoleModel} */ SDK.consoleModel;
{ "content_hash": "4df6edf623e27da1b9c3577f62d25b54", "timestamp": "", "source": "github", "line_count": 637, "max_line_length": 120, "avg_line_length": 34.361067503924644, "alnum_prop": 0.6826114766081871, "repo_name": "weexteam/weex-toolkit", "id": "0edbf4303ce35b5a12ea3532bf2ddbdb5e8eb710", "size": "23450", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "packages/@weex/plugins/debug/frontend/src/assets/inspector/sdk/ConsoleModel.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "510216" }, { "name": "HTML", "bytes": "60414" }, { "name": "JavaScript", "bytes": "10092059" }, { "name": "Python", "bytes": "3359" }, { "name": "Shell", "bytes": "230" }, { "name": "TypeScript", "bytes": "584132" } ], "symlink_target": "" }
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Hook = require('../src/').Hook; var MyHookClass = function (_Hook) { _inherits(MyHookClass, _Hook); function MyHookClass() { _classCallCheck(this, MyHookClass); return _possibleConstructorReturn(this, (MyHookClass.__proto__ || Object.getPrototypeOf(MyHookClass)).apply(this, arguments)); } return MyHookClass; }(Hook); exports.default = MyHookClass; module.exports = exports['default'];
{ "content_hash": "406b2f7e10330144757fb9513c024a8d", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 494, "avg_line_length": 49.464285714285715, "alnum_prop": 0.7184115523465704, "repo_name": "StevenBlack/hooks-and-anchors", "id": "1bf8a82d94cc7589603b53b6cb64a8c87ec44095", "size": "1385", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "libtest/myhookclass.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "51165" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <meta charset='utf-8'> <head> <script src="../dialog-polyfill.js"></script> <meta name="viewport" content="width=device-width, user-scalable=no"> <link rel="stylesheet" type="text/css" href="../dialog-polyfill.css"> <style> dialog { width: 100px; } </style> </head> <body> <p>Test for modal dialog. The test passes if you can click on "Click me" button, but can't click or tab to the "Can't click me!" button</p> <div id="console"></div> <input type="text" placeholder="Test 1" tabindex="1" /> <input type="text" placeholder="Test 2" tabindex="2" /> <input type="text" placeholder="Test 2.1" tabindex="2" /> <input type="text" placeholder="Test 3" tabindex="3" /> <input type="text" placeholder="Before dialog" /> <dialog> <button id="dialog-button">Click me</button> <input type="text" placeholder="Focus me" /> <input type="text" placeholder="Focus me again" /> </dialog> <button id="inert-button">Can't click me</button> <input type="text" placeholder="Can't focus me" /> <script> function writeToConsole(s) { var console = document.getElementById('console'); var span = document.createElement('span'); span.textContent = s; console.appendChild(span); console.appendChild(document.createElement('br')); } var dialog = document.querySelector('dialog'); dialogPolyfill.registerDialog(dialog); dialog.showModal(); var dialogButton = document.getElementById('dialog-button'); dialogButton.addEventListener('click', function(e) { writeToConsole("SUCCESS: dialog's button was clicked"); }); var inertButton = document.getElementById('inert-button'); inertButton.addEventListener('click', function(e) { writeToConsole('FAIL: inert button was clicked'); }); </script> </body> </html>
{ "content_hash": "7141da24895629c737c0e00bac101318", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 80, "avg_line_length": 30.875, "alnum_prop": 0.7102371312897628, "repo_name": "AlpenDesignStudio/twex", "id": "20a656248f995de28bf9ab872a86a301eb10ca76", "size": "1729", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "assets/dialog-polyfill/tests/modal-dialog.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "868093" }, { "name": "HTML", "bytes": "1343073" }, { "name": "JavaScript", "bytes": "781497" }, { "name": "PHP", "bytes": "2925470" }, { "name": "Python", "bytes": "32324" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using Foundation; using UIKit; namespace Screenmedia.JazzHands.TouchDemo { // The UIApplicationDelegate for the application. This class is responsible for launching the // User Interface of the application, as well as listening (and optionally responding) to // application events from iOS. [Register ("AppDelegate")] public partial class AppDelegate : UIApplicationDelegate { // class-level declarations UIWindow window; // // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching (UIApplication app, NSDictionary options) { // create a new window instance based on the screen size window = new UIWindow (UIScreen.MainScreen.Bounds); // If you have defined a root view controller, set it here: window.RootViewController = new JHViewController(); window.BackgroundColor = UIColor.White; // make the window visible window.MakeKeyAndVisible (); return true; } } }
{ "content_hash": "34f9520d9c91bde04e407d54d2b80442", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 94, "avg_line_length": 30, "alnum_prop": 0.7452380952380953, "repo_name": "webmonger/Screenmedia.JazzHands", "id": "271f40add5bdde0b40bda8a7d6111dba1088dcc3", "size": "1262", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "demo/Screenmedia.JazzHands.Touch.Demo/AppDelegate.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "53922" }, { "name": "Makefile", "bytes": "879" } ], "symlink_target": "" }
 using UnityEngine; using System.Collections; using System.Collections.Generic; using SLua; // The params of class YwLuaMonoBehaviour. [System.Serializable] public class YwLuaMonoBehaviourParams { // The mono method types. public enum EMonoMethod { Start, Update, LateUpdate, FixedUpdate, LiteUpdate, OnEnable, OnDisable, OnDestroy, OnTriggerEnter, OnTriggerEnter2D, OnTriggerExit, OnTriggerExit2D, OnCollisionEnter, OnCollisionEnter2D, OnCollisionExit, OnCollisionExit2D, // Add more if your need. } // The lua class name. public string m_strLuaClassName = string.Empty; // All mono method we have. public List<EMonoMethod> m_cMonoMethods = new List<EMonoMethod>(); // The parameters used to pass to lua. public GameObject[] m_aParameters = null; } // The lua mono behaviour class. public class YwLuaMonoBehaviour : YwLuaMonoBehaviourBase { // The mono behaviour params to lua. [DoNotToLua] public YwLuaMonoBehaviourParams m_luaParameters = new YwLuaMonoBehaviourParams(); // The static method array. private bool[] m_aMonoMethodFlags = new bool[System.Enum.GetValues(typeof(YwLuaMonoBehaviourParams.EMonoMethod)).Length]; // Name of enable base lua function. private static readonly string LUA_FUNC_NAME_ON_ENABLE_BASE = "OnEnableBase"; // Name of disable base lua function. private static readonly string LUA_FUNC_NAME_ON_DISENABLE_BASE = "OnDisableBase"; // The On enable base function. private LuaFunction m_cOnEnableBase = null; // The On disable base function. private LuaFunction m_cOnDisableBase = null; // Use this for initialization. void Awake() { if (!YwLuaScriptMng.Instance.Initialized) { return; } // Get lua class name. string strLuaClassName = m_luaParameters.m_strLuaClassName; // If no class name is specified, use name of game object instead. if (string.IsNullOrEmpty(strLuaClassName)) { strLuaClassName = gameObject.name; Debug.LogWarning("You do not set lua class name, use GameObject's name \'" + gameObject.name + "\' instead!"); } // Directly create a lua class instance to associate with this monobehavior. if (string.IsNullOrEmpty(strLuaClassName) || !CreateClassInstance(strLuaClassName)) { return; } // Initialize parameters need to be passed to lua. if ((null != m_luaParameters.m_aParameters) && (m_luaParameters.m_aParameters.Length > 0)) { m_cBehavior.SetData("m_aParameters", m_luaParameters.m_aParameters); } // Init all method flags. for (int i = 0; i < m_aMonoMethodFlags.Length; i++) { m_aMonoMethodFlags[i] = m_luaParameters.m_cMonoMethods.Contains((YwLuaMonoBehaviourParams.EMonoMethod)i); } // Init update flags. m_cBehavior.SetData("m_bUpdate", m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.Update]); m_cBehavior.SetData("m_bLateUpdate", m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.LateUpdate]); m_cBehavior.SetData("m_bFixedUpdate", m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.FixedUpdate]); m_cBehavior.SetData("m_bLiteUpdate", m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.LiteUpdate]); // To set custom parameters need to be passed to lua. OnSetCustomParameters(); // Call awake base. LuaFunction cAwakeBase = null; m_cBehavior.CallMethod(ref cAwakeBase, "AwakeBase", m_cBehavior.GetChunk()); // Call awake. m_cBehavior.Awake(); } // Use this for initialization. void Start() { if (!m_bReady || !m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.Start]) { return; } m_cBehavior.Start(); } // This function is called when the behaviour becomes disabled or inactive. void OnEnable() { if (!m_bReady) { return; } // Call on enable base anyway. m_cBehavior.CallMethod(ref m_cOnEnableBase, LUA_FUNC_NAME_ON_ENABLE_BASE, m_cBehavior.GetChunk()); // Call enable. if (m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.OnEnable]) { m_cBehavior.OnEnable(); } } // This function is called when the object becomes enabled and active. void OnDisable() { if (!m_bReady) { return; } // Call on disable base anyway. m_cBehavior.CallMethod(ref m_cOnDisableBase, LUA_FUNC_NAME_ON_DISENABLE_BASE, m_cBehavior.GetChunk()); // Call disable. if (m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.OnDisable]) { m_cBehavior.OnDisable(); } } // On destroy method. void OnDestroy() { if (!m_bReady) { return; } // Call on destroy base anyway. LuaFunction cOnDestroyBase = null; m_cBehavior.CallMethod(ref cOnDestroyBase, "OnDestroyBase", m_cBehavior.GetChunk()); // Call on destroy. if (m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.OnDestroy]) { m_cBehavior.OnDestroy(); } } // OnTriggerEnter is called when the Collider other enters the trigger. void OnTriggerEnter(Collider cOther) { if (!m_bReady || !m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.OnTriggerEnter]) { return; } m_cBehavior.OnTriggerEnter(cOther); } // Sent when another object enters a trigger collider attached to this object (2D physics only). void OnTriggerEnter2D(Collider2D cOther) { if (!m_bReady || !m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.OnTriggerEnter2D]) { return; } m_cBehavior.OnTriggerEnter2D(cOther); } // OnTriggerExit is called when the Collider other has stopped touching the trigger. void OnTriggerExit(Collider cOther) { if (!m_bReady || !m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.OnTriggerExit]) { return; } m_cBehavior.OnTriggerExit(cOther); } // Sent when another object leaves a trigger collider attached to this object (2D physics only). void OnTriggerExit2D(Collider2D cOther) { if (!m_bReady || !m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.OnTriggerExit2D]) { return; } m_cBehavior.OnTriggerExit2D(cOther); } // OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider. void OnCollisionEnter(Collision cCollision) { if (!m_bReady || !m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.OnCollisionEnter]) { return; } m_cBehavior.OnCollisionEnter(cCollision); } // Sent when an incoming collider makes contact with this object's collider (2D physics only). void OnCollisionEnter2D(Collision2D cCollision) { if (!m_bReady || !m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.OnCollisionEnter2D]) { return; } m_cBehavior.OnCollisionEnter2D(cCollision); } // OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider. void OnCollisionExit(Collision cCollision) { if (!m_bReady || !m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.OnCollisionExit]) { return; } m_cBehavior.OnCollisionExit(cCollision); } // Sent when a collider on another object stops touching this object's collider (2D physics only). void OnCollisionExit2D(Collision2D cCollision) { if (!m_bReady || !m_aMonoMethodFlags[(int)YwLuaMonoBehaviourParams.EMonoMethod.OnCollisionExit2D]) { return; } m_cBehavior.OnCollisionExit2D(cCollision); } /** * Get lua class name. * * @param void. * @return string - The name of the associated lua class. */ public string GetLuaClassName() { return m_luaParameters.m_strLuaClassName; } /** * To set custom parameters need to be passed to lua. * * @param void. * @return void. */ protected virtual void OnSetCustomParameters() { } }
{ "content_hash": "5f7cf67708f9294a87d5a513abf9cd44", "timestamp": "", "source": "github", "line_count": 293, "max_line_length": 125, "avg_line_length": 29.98976109215017, "alnum_prop": 0.634573802207807, "repo_name": "yaukeywang/2DPlatformer-SLua", "id": "24b67e2cf9604c8198020d4db7d1629d59631b37", "size": "9054", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "Assets/Game/Scripts/Base/YwLuaMonoBehaviour.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "3087975" }, { "name": "Lua", "bytes": "162772" } ], "symlink_target": "" }
package com.blazeloader.util.version.type; import com.blazeloader.util.version.BuildType; import com.blazeloader.util.version.SaveableVersion; /** * Specialised implementation of a version. Supports saving and loading from a config file and can have only three components. */ public class TripleVersion extends SaveableVersion<TripleVersion> { public TripleVersion(String id, String name, BuildType buildType, int version1, int version2, int version3) { super(id, name, buildType, version1, version2, version3); } /** * Gets the first component. */ public int getFirst() { return getNthComponent(0); } /** * Gets the second component. */ public int getSecond() { return getNthComponent(1); } /** * Gets the third component. */ public int getThird() { return getNthComponent(2); } protected TripleVersion createVersion(String id, String name, BuildType buildType, int... parts) { return new TripleVersion(id, name, buildType, parts[0], parts[1], parts[2]); } }
{ "content_hash": "9633cd693b9616b278308f0515648f0b", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 126, "avg_line_length": 28.333333333333332, "alnum_prop": 0.6624434389140271, "repo_name": "Sollace/BlazeLoader", "id": "da07084d5f65a69cdb9cd3c8b9dfde8d8f4aae0b", "size": "1105", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/main/com/blazeloader/util/version/type/TripleVersion.java", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Batchfile", "bytes": "9181" }, { "name": "Java", "bytes": "617455" }, { "name": "Python", "bytes": "2819" } ], "symlink_target": "" }
package org.zalando.riptide; import org.apiguardian.api.API; import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus.Series; import org.springframework.http.MediaType; import static org.apiguardian.api.API.Status.STABLE; /** * Static factory method for built-in {@link Navigator navigators}. * * @see Navigator */ @API(status = STABLE) public final class Navigators { private Navigators() { } /** * A {@link Navigator} that selects a binding based on the response's status code series * * @return an HTTP status code series selector * @see Series */ public static Navigator<Series> series() { return SeriesNavigator.INSTANCE; } /** * A {@link Navigator} that selects a binding based on the response's status. * * @return an HTTP status selector * @see HttpStatus * @see #statusCode() */ public static Navigator<HttpStatus> status() { return StatusNavigator.INSTANCE; } /** * A {@link Navigator} that selects a binding based on the response's status code. * * @return an HTTP status code selector * @see HttpStatus * @see #status() */ public static Navigator<Integer> statusCode() { return StatusCodeNavigator.INSTANCE; } /** * A {@link Navigator} that selects a binding based on the response's reason phrase. * * Be aware that this, even though it's standardized, could be changed by servers. * * @return an HTTP reason phrase selector * @see HttpStatus#getReasonPhrase() * @see #status() * @see #statusCode() */ public static Navigator<String> reasonPhrase() { return ReasonPhraseNavigator.INSTANCE; } /** * A {@link Navigator} that selects the best binding based on the response's content type. * * @return a Content-Type selector * @see MediaType */ public static Navigator<MediaType> contentType() { return ContentTypeNavigator.INSTANCE; } }
{ "content_hash": "47f034e4226123403d2070803a5888a4", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 94, "avg_line_length": 26.346153846153847, "alnum_prop": 0.6501216545012165, "repo_name": "zalando/riptide", "id": "8ea18188b407de5a94dec2532d933a4a226df436", "size": "2055", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "riptide-core/src/main/java/org/zalando/riptide/Navigators.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "993134" }, { "name": "Shell", "bytes": "1050" } ], "symlink_target": "" }
package config_test import ( "os" "path/filepath" "reflect" "strings" "testing" "v.io/x/ref/services/device/internal/config" "v.io/v23/services/application" ) // TestState checks that encoding/decoding State to child/from parent works // as expected. func TestState(t *testing.T) { var err error currScript := filepath.Join(os.TempDir(), "fido/was/here") if err := os.MkdirAll(currScript, 0700); err != nil { t.Fatalf("MkdirAll(%v) failed: %v", currScript, err) } defer os.RemoveAll(currScript) // On some operating systems (e.g. darwin) os.TempDir() can // return a symlink. To avoid having to account for this // eventuality later, evaluate the symlink. currScript, err = filepath.EvalSymlinks(currScript) if err != nil { t.Fatalf("EvalSymlinks() failed: %v", err) } currLink := filepath.Join(os.TempDir(), "familydog") if err := os.Symlink(currScript, currLink); err != nil { t.Fatalf("Symlink(%v, %v) failed: %v", currScript, currLink, err) } defer os.Remove(currLink) // For the same reasons mentioned above, evaluate the symlink. currLink, err = filepath.EvalSymlinks(currLink) if err != nil { t.Fatalf("EvalSymlinks() failed: %v", err) } state := &config.State{ Name: "fido", Previous: "doesn't matter", Root: "fidos/doghouse", Origin: "pet/store", CurrentLink: currLink, Helper: "santas/little/helper", } if err := state.Validate(); err != nil { t.Errorf("Config state %v failed to validate: %v", state, err) } encoded, err := state.Save(&application.Envelope{ Title: "dog", Args: []string{"roll-over", "play-dead"}, }) if err != nil { t.Errorf("Config state %v Save failed: %v", state, err) } for _, e := range encoded { pair := strings.SplitN(e, "=", 2) os.Setenv(pair[0], pair[1]) } decodedState, err := config.Load() if err != nil { t.Errorf("Config state Load failed: %v", err) } expectedState := state expectedState.Envelope = &application.Envelope{ Title: "dog", Args: []string{"roll-over", "play-dead"}, } expectedState.Name = "" expectedState.Previous = currScript if !reflect.DeepEqual(decodedState, expectedState) { t.Errorf("Decode state: want %#v, got %#v", expectedState, decodedState) } } // TestValidate checks the Validate method of State. func TestValidate(t *testing.T) { state := &config.State{ Name: "schweinsteiger", Previous: "a", Root: "b", Origin: "c", CurrentLink: "d", Helper: "e", } if err := state.Validate(); err != nil { t.Errorf("Config state %v failed to validate: %v", state, err) } state.Root = "" if err := state.Validate(); err == nil { t.Errorf("Config state %v should have failed to validate.", state) } state.Root, state.CurrentLink = "a", "" if err := state.Validate(); err == nil { t.Errorf("Confi stateg %v should have failed to validate.", state) } state.CurrentLink, state.Name = "d", "" if err := state.Validate(); err == nil { t.Errorf("Config state %v should have failed to validate.", state) } state.Name, state.Helper = "anything", "" if err := state.Validate(); err == nil { t.Errorf("Config state %v should have failed to validate.", state) } } // TestQuoteEnv checks the QuoteEnv method. func TestQuoteEnv(t *testing.T) { cases := []struct { before, after string }{ {`a=b`, `a="b"`}, {`a=`, `a=""`}, {`a`, `a`}, {`a=x y`, `a="x y"`}, {`a="x y"`, `a="\"x y\""`}, {`a='x y'`, `a="'x y'"`}, } var input []string var want []string for _, c := range cases { input = append(input, c.before) want = append(want, c.after) } if got := config.QuoteEnv(input); !reflect.DeepEqual(want, got) { t.Errorf("QuoteEnv(%v) wanted %v, got %v instead", input, want, got) } }
{ "content_hash": "11110210fdb1fc5e60bf2d10922d2c82", "timestamp": "", "source": "github", "line_count": 131, "max_line_length": 75, "avg_line_length": 28.480916030534353, "alnum_prop": 0.6349504154382203, "repo_name": "vanadium/go.ref", "id": "968bda88cf6f365182c81ac56fe767b22aa8c6c2", "size": "3897", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "services/device/internal/config/config_test.go", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "17702" }, { "name": "C++", "bytes": "3125" }, { "name": "CSS", "bytes": "4675" }, { "name": "Go", "bytes": "7972745" }, { "name": "Groff", "bytes": "573" }, { "name": "HTML", "bytes": "52709" }, { "name": "JavaScript", "bytes": "7441" }, { "name": "Makefile", "bytes": "552" }, { "name": "Objective-C", "bytes": "65653" }, { "name": "Protocol Buffer", "bytes": "2081" }, { "name": "Shell", "bytes": "19001" }, { "name": "Yacc", "bytes": "18544" } ], "symlink_target": "" }
package io.cattle.platform.simple.allocator.dao; import io.cattle.platform.allocator.service.AllocationCandidate; import java.util.Iterator; import java.util.List; public interface SimpleAllocatorDao { Iterator<AllocationCandidate> iteratorHosts(List<String> hostUUIDs, List<Long> volumeIds, QueryOptions options); }
{ "content_hash": "6b9d3b56a046a19bbbfe874d0e2697e6", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 116, "avg_line_length": 29.545454545454547, "alnum_prop": 0.8184615384615385, "repo_name": "wlan0/cattle", "id": "ac300fc8e96f95aa510fd64b89891ac2eea3797d", "size": "325", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "code/iaas/simple-allocator/src/main/java/io/cattle/platform/simple/allocator/dao/SimpleAllocatorDao.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "FreeMarker", "bytes": "71" }, { "name": "Java", "bytes": "6216905" }, { "name": "Makefile", "bytes": "308" }, { "name": "Python", "bytes": "1535973" }, { "name": "Shell", "bytes": "33788" } ], "symlink_target": "" }
package org.xutils.image; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Movie; import android.graphics.PixelFormat; import android.graphics.drawable.Animatable; import android.graphics.drawable.Drawable; import android.os.SystemClock; import org.xutils.common.util.LogUtil; public class GifDrawable extends Drawable implements Runnable, Animatable { private int byteCount; private int rate = 300; private volatile boolean running; private final Movie movie; private final int duration; private final long begin = SystemClock.uptimeMillis(); public GifDrawable(Movie movie, int byteCount) { this.movie = movie; this.byteCount = byteCount; this.duration = movie.duration(); } public int getDuration() { return duration; } public Movie getMovie() { return movie; } public int getByteCount() { if (byteCount == 0) { byteCount = (movie.width() * movie.height() * 3) * (5/*fake frame count*/); } return byteCount; } public int getRate() { return rate; } public void setRate(int rate) { this.rate = rate; } @Override public void draw(Canvas canvas) { try { int time = duration > 0 ? (int) (SystemClock.uptimeMillis() - begin) % duration : 0; movie.setTime(time); movie.draw(canvas, 0, 0); start(); } catch (Throwable ex) { LogUtil.e(ex.getMessage(), ex); } } @Override public void start() { if (!isRunning()) { running = true; run(); } } @Override public void stop() { if (isRunning()) { this.unscheduleSelf(this); } } @Override public boolean isRunning() { return running && duration > 0; } @Override public void run() { if (duration > 0) { this.invalidateSelf(); this.scheduleSelf(this, SystemClock.uptimeMillis() + rate); } } @Override public void setAlpha(int alpha) { } @Override public int getIntrinsicWidth() { return movie.width(); } @Override public int getIntrinsicHeight() { return movie.height(); } @Override public void setColorFilter(ColorFilter cf) { } @Override public int getOpacity() { return movie.isOpaque() ? PixelFormat.OPAQUE : PixelFormat.TRANSLUCENT; } }
{ "content_hash": "b976e107281e3fd0e94fe39717144dd2", "timestamp": "", "source": "github", "line_count": 116, "max_line_length": 96, "avg_line_length": 21.99137931034483, "alnum_prop": 0.5872206977655822, "repo_name": "LinKermit/BeijingNews", "id": "d53e4d26083962e339825ab46701924875bb54e8", "size": "2551", "binary": false, "copies": "12", "ref": "refs/heads/master", "path": "xutils/src/main/java/org/xutils/image/GifDrawable.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "873432" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "15bfe3772edd15fe6dfe6bd8bb9234e5", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "75ee5e51ee51fe99dbc2994107599f9e39d67a19", "size": "204", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Caesalpinia/Caesalpinia pannosa/ Syn. Poincianella pannosa/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package com.corejsf; import java.io.Serializable; public class CreditCard implements Serializable { public CreditCard(String number) { this.number = number; } public String toString() { return number; } private String number; }
{ "content_hash": "62311769ee60392028e263a93167cec3", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 61, "avg_line_length": 26.444444444444443, "alnum_prop": 0.7521008403361344, "repo_name": "thescouser89/snippets", "id": "a573cd9bac6ec1ae2ae1297cb406ef3cdff92a3e", "size": "238", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "jsf/javaee/ch13/clientside-validator/src/java/com/corejsf/CreditCard.java", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "426" }, { "name": "CSS", "bytes": "6738" }, { "name": "Java", "bytes": "240783" }, { "name": "JavaScript", "bytes": "12295" }, { "name": "Python", "bytes": "596" }, { "name": "Ruby", "bytes": "2346" }, { "name": "Shell", "bytes": "5499" } ], "symlink_target": "" }
package com.jroossien.boxx.aliases; import com.jroossien.boxx.aliases.internal.AliasMap; import org.bukkit.DyeColor; import java.io.File; import java.util.List; import java.util.Map; public class DyeColors extends AliasMap<DyeColor> { private DyeColors() { super("DyeColors", new File(ALIASES_FOLDER, "DyeColors.yml"), "colors", "dyecolor"); } @Override public void onLoad() { add(DyeColor.WHITE, "White", "0", "WH"); add(DyeColor.ORANGE, "Orange", "1", "OR", "DY", "Dark Yellow", "DYellow"); add(DyeColor.MAGENTA, "Magenta", "2", "LP", "MA", "Light Purple", "LPurple"); add(DyeColor.LIGHT_BLUE, "Light Blue", "LB", "3", "LBlue"); add(DyeColor.YELLOW, "Yellow", "4", "YE", "Light Yellow", "LYellow"); add(DyeColor.LIME, "Lime", "5", "LI", "LG", "Light Green", "LGreen"); add(DyeColor.PINK, "Pink", "6", "PI"); add(DyeColor.GRAY, "Gray", "7", "GR", "Dark Gray", "DGray"); add(DyeColor.SILVER, "Silver", "8", "SI", "Light Gray", "LGray"); add(DyeColor.CYAN, "Cyan", "9", "DA", "CY", "Dark Aqua", "DAqua"); add(DyeColor.PURPLE, "Purple", "10", "DP", "Dark Purple", "DPurple"); add(DyeColor.BLUE, "Blue", "11", "DB", "Dark Blue", "DBlue"); add(DyeColor.BROWN, "Brown", "BR", "12"); add(DyeColor.GREEN, "Green", "13", "DG", "Dark Green", "DGreen"); add(DyeColor.RED, "Red", "14", "DR", "RE", "Dark Red", "DRed"); add(DyeColor.BLACK, "Black", "15", "BL"); } public static DyeColor get(String string) { return instance()._get(string); } public static String getName(DyeColor key) { return instance()._getName(key); } public static String getDisplayName(DyeColor key) { return instance()._getDisplayName(key); } public static List<String> getAliases(DyeColor key) { return instance()._getAliases(key); } public static Map<String, List<String>> getAliasMap() { return instance()._getAliasMap(); } public static DyeColors instance() { if (getMap(DyeColors.class) == null) { aliasMaps.put(DyeColors.class, new DyeColors()); } return (DyeColors)getMap(DyeColors.class); } }
{ "content_hash": "21f26c1b903d5b5e6fe24fc3b5f70abb", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 92, "avg_line_length": 35.234375, "alnum_prop": 0.5875831485587583, "repo_name": "Rojoss/Boxx", "id": "57a5f5112e21382fab8ed46fea185ad57bf5347a", "size": "3451", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/jroossien/boxx/aliases/DyeColors.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "1200065" } ], "symlink_target": "" }
use inline as imported_inline; mod builtin { pub use inline as imported_inline; } // Tool module use rustfmt as imported_rustfmt; mod tool_mod { pub use rustfmt as imported_rustfmt; } #[imported_inline] //~ ERROR cannot use a built-in attribute through an import #[builtin::imported_inline] //~ ERROR cannot use a built-in attribute through an import #[imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import //~| ERROR cannot use a tool module through an import #[tool_mod::imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import //~| ERROR cannot use a tool module through an import fn main() {}
{ "content_hash": "f52161be311e9dde55b2095618cb79b8", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 89, "avg_line_length": 39.55555555555556, "alnum_prop": 0.6713483146067416, "repo_name": "aidancully/rust", "id": "44da71de085be0d480dcab4591df10ab58230da6", "size": "751", "binary": false, "copies": "20", "ref": "refs/heads/master", "path": "src/test/ui/rust-2018/uniform-paths/prelude-fail-2.rs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "26968" }, { "name": "Assembly", "bytes": "20050" }, { "name": "Awk", "bytes": "159" }, { "name": "C", "bytes": "726643" }, { "name": "C++", "bytes": "54397" }, { "name": "CSS", "bytes": "22328" }, { "name": "JavaScript", "bytes": "38337" }, { "name": "LLVM", "bytes": "5040" }, { "name": "Lex", "bytes": "9238" }, { "name": "Makefile", "bytes": "238787" }, { "name": "Pascal", "bytes": "13073" }, { "name": "Puppet", "bytes": "3193" }, { "name": "Python", "bytes": "149063" }, { "name": "RenderScript", "bytes": "26426" }, { "name": "Rust", "bytes": "18504256" }, { "name": "Shell", "bytes": "270708" }, { "name": "TeX", "bytes": "57" }, { "name": "Yacc", "bytes": "80496" } ], "symlink_target": "" }
package com.salama.android.support; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import MetoXML.Util.ClassFinder; import android.app.Application; import android.content.Intent; import android.content.pm.PackageInfo; import android.os.Build; import android.support.v4.content.LocalBroadcastManager; import android.util.Log; import com.salama.android.util.SSLog; import com.salama.android.util.http.HttpClientUtil; import dalvik.system.DexFile; public class ServiceSupportApplication extends Application implements ClassFinder { private static ServiceSupportApplication _singleton = null; private ExecutorService _defaultThreadPool; private LocalBroadcastManager _localBroadcastManager = null; private ConcurrentHashMap<String, Object> _sessionValueMap = new ConcurrentHashMap<String, Object>(); private ConcurrentLinkedQueue<SessionKeyObj> _sessionKeyObjQueue = new ConcurrentLinkedQueue<ServiceSupportApplication.SessionKeyObj>(); private volatile long _lastClearSessionTime = System.currentTimeMillis(); private List<ExecutorService> _threadPoolList = new ArrayList<ExecutorService>(); private static final String SESSION_KEY_PREFIX_BROADCAST_DATA = "broadcastData."; private long _sessionKeySeq = Long.MIN_VALUE; private Object _sessionKeySeqLocker = new Object(); private HashMap<String, Class<?>> _classSimpleNameClassMapping = new HashMap<String, Class<?>>(); private HashMap<String, Class<?>> _classNameClassMapping = new HashMap<String, Class<?>>(); private static final int VIEW_ID_MIN = 100; private static final int VIEW_ID_MAX = 300; private int _viewIdSeed = VIEW_ID_MIN; private Object _viewIdSeedLocker = new Object(); public static ServiceSupportApplication singleton() { return _singleton; } @Override public void onCreate() { super.onCreate(); SSLog.d("ServiceSupportApplication", "onCreate()"); _singleton = this; _defaultThreadPool = Executors.newCachedThreadPool(); _localBroadcastManager = LocalBroadcastManager.getInstance(this); scanClassesOfApplication(); initHttpUserAgent(); } @Override public void onTerminate() { super.onTerminate(); _defaultThreadPool.shutdown(); for(int i = 0; i < _threadPoolList.size(); i++) { _threadPoolList.get(i).shutdown(); } _threadPoolList.clear(); _singleton = null; SSLog.d("ServiceCommonApp", "onTerminate()"); } /** * 创建线程池(单线程模式) * @return 线程池对象(ExecutorService) */ public ExecutorService createSingleThreadPool() { ExecutorService threadPool = Executors.newSingleThreadExecutor(); _threadPoolList.add(threadPool); return threadPool; } /** * 创建线程池(缓冲模式) * @return 线程池对象(ExecutorService) */ public ExecutorService createCachedThreadPool() { ExecutorService threadPool = Executors.newCachedThreadPool(); _threadPoolList.add(threadPool); return threadPool; } /** * 创建线程池(固定数量模式) * @param threadMaxCount 最大线程数 * @return 线程池对象(ExecutorService) */ public ExecutorService createFixedThreadPool(int threadMaxCount) { ExecutorService threadPool = Executors.newFixedThreadPool(threadMaxCount); _threadPoolList.add(threadPool); return threadPool; } /** * 异步执行线程任务(使用cachedThreadPool执行) * @param task 线程任务 */ public void asyncExecute(Runnable task) { _defaultThreadPool.execute(task); } /** * 发送本地通知 * @param intent */ public void sendLocalBroadcast(Intent intent) { _localBroadcastManager.sendBroadcast(intent); } /** * 发送本地通知(数据通过某种方式封装传递给接收方) * @param broadcastName 通知名 * @param data 参数对象 * @param extraName 参数名(接收时用) */ public void sendWrappedLocalBroadcast(String broadcastName, Object data, String extraName) { Intent intent = new Intent(broadcastName); if(data != null) { String dataSessionKey = SESSION_KEY_PREFIX_BROADCAST_DATA + getNewSessionKey(); setSessionValue(dataSessionKey, data); intent.putExtra(extraName, dataSessionKey); _sessionKeyObjQueue.add(new SessionKeyObj(dataSessionKey)); } _localBroadcastManager.sendBroadcast(intent); } /** * 本地通知的接收方获取参数值 * @param intent 本地通知接收时获得的intent * @param extraName 参数名 * @return */ public Object getWrappedDataFromLocalBroadcast(Intent intent, String extraName) { String sessionKey = intent.getStringExtra(extraName); if(sessionKey == null) { return null; } else { clearOldSessionKey(); return getSessionValue(sessionKey); } } private void clearOldSessionKey() { long curTime = System.currentTimeMillis(); long clearInterval = 300000; if((curTime - _lastClearSessionTime) >= clearInterval) { int i = 0; SessionKeyObj keyObj = null; while(i < 100) { keyObj = _sessionKeyObjQueue.peek(); if(keyObj == null) { break; } else { if((curTime - keyObj.createTime) >= clearInterval) { //delete _sessionValueMap.remove(keyObj.sessionKey); _sessionKeyObjQueue.poll(); } else { break; } } i++; } } } /** * 取得session值.为便于各个画面之间共享数据,此处提供session容器存储变量。 * @param key * @return */ public Object getSessionValue(String key) { return _sessionValueMap.get(key); } /** * 取得session值,并且删除 * @param key * @return */ public Object getSessionValueAndRemove(String key) { Object returnVal = _sessionValueMap.get(key); _sessionValueMap.remove(key); return returnVal; } /** * 设置session值 * @param key * @param value */ public void setSessionValue(String key, Object value) { _sessionValueMap.put(key, value); } /** * 删除session值 * @param key */ public void removeSessionValue(String key) { _sessionValueMap.remove(key); } // public Class<?> loadClass(String className) throws ClassNotFoundException { // return getClassLoader().loadClass(className); // } /** * 根据类名取得类 * @param className 类名。可以是简称也可以全称(包含package) * @return 类 */ @Override public Class<?> findClass(String className) throws ClassNotFoundException { Class<?> cls = _classSimpleNameClassMapping.get(className); if(cls != null) { return cls; } cls = _classNameClassMapping.get(className); if(cls != null) { return cls; } return getClassLoader().loadClass(className); } private void scanClassesOfApplication() { try { /* hack way Field dexField = PathClassLoader.class.getDeclaredField("mDexs"); dexField.setAccessible(true); DexFile[] dexs = (DexFile[]) dexField.get(getClassLoader()); */ String currentAppPackageName = getPackageName(); String sourceDirPath = getPackageManager().getApplicationInfo( getPackageName(), 0).sourceDir; DexFile dexFile = new DexFile(sourceDirPath); Enumeration<String> entries = dexFile.entries(); String className; Class<?> cls; ClassLoader classLoader = getClassLoader(); while(entries.hasMoreElements()) { className = entries.nextElement(); try { //cls = dexFile.loadClass(className, getClassLoader()); cls = classLoader.loadClass(className); if(className.startsWith(currentAppPackageName) || className.startsWith("com.salama.android.") ) { _classSimpleNameClassMapping.put(cls.getSimpleName(), cls); _classNameClassMapping.put(className, cls); SSLog.d("ServiceSupportApplication", "scanClassesOfApplication() class:" + className); } } catch(Exception e) { //Log.e("ServiceSupportApplication", "scanClassesOfApplication() Error in while{}", e); } } } catch(Exception e) { Log.e("ServiceSupportApplication", "scanClassesOfApplication()", e); } } private long getNewSessionKey() { synchronized (_sessionKeySeqLocker) { if(_sessionKeySeq == Long.MAX_VALUE) { _sessionKeySeq = Long.MIN_VALUE; } else { _sessionKeySeq++; } return _sessionKeySeq; } } /** * 取得新viewId。提供了一个顺序自增长的序号。 * @return */ public int newViewId() { synchronized (_viewIdSeedLocker) { if(_viewIdSeed == VIEW_ID_MAX) { _viewIdSeed = VIEW_ID_MIN; } else { _viewIdSeed++; } return _viewIdSeed; } } private class SessionKeyObj { public String sessionKey = null; public long createTime = System.currentTimeMillis(); public SessionKeyObj(String key) { sessionKey = key; } } private void initHttpUserAgent() { PackageInfo pkgInfo; try { pkgInfo = this.getPackageManager().getPackageInfo(this.getPackageName(), 0); String userAgent = "Android " + Build.VERSION.RELEASE + ";" + "API " + Build.VERSION.SDK_INT + ";" + "APP " + this.getPackageName() + " " + pkgInfo.versionName + ";" + "salama" + ";"; HttpClientUtil.setUserAgent(userAgent); //SalamaHttpClientUtil.setUserAgent(userAgent); SSLog.d("ServiceSupportApplication", "setUserAgent:" + userAgent); } catch (Exception e) { SSLog.i("ServiceSupportApplication", "", e); } } }
{ "content_hash": "e213447d2943bbc611fd76765947ef92", "timestamp": "", "source": "github", "line_count": 366, "max_line_length": 137, "avg_line_length": 24.849726775956285, "alnum_prop": 0.702913688840022, "repo_name": "SalamaSoft/Hybrid-SDK-Android", "id": "3438d113c02f24edf8c73ac952b6c93727a94223", "size": "9529", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/SalamaAndroid/srcSupportUtils/com/salama/android/support/ServiceSupportApplication.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "417288" }, { "name": "Shell", "bytes": "155" } ], "symlink_target": "" }
package org.okraAx.v3.beans; public final class GpcBnRelay { private GpcBnRelay() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); } static final com.google.protobuf.Descriptors.Descriptor internal_static_org_okraAx_v3_RpcOnRelay_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_org_okraAx_v3_RpcOnRelay_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n\017BeanRelay.proto\022\rorg.okraAx.v3\032\tGpc.pr" + "oto\"B\n\nRpcOnRelay\022\016\n\006target\030\001 \001(\003\022$\n\004cal" + "l\030\002 \001(\0132\026.org.okraAx.v3.GpcCallB%\n\023org.o" + "kraAx.v3.beansB\nGpcBnRelayH\001P\001b\006proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.Descriptors.FileDescriptor root) { descriptor = root; return null; } }; com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { org.okraAx.v3.Gpc.getDescriptor(), }, assigner); internal_static_org_okraAx_v3_RpcOnRelay_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_org_okraAx_v3_RpcOnRelay_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_org_okraAx_v3_RpcOnRelay_descriptor, new java.lang.String[] { "Target", "Call", }); org.okraAx.v3.Gpc.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) }
{ "content_hash": "da34dc83cafaf266bcc9fc3732fd364a", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 93, "avg_line_length": 40.607142857142854, "alnum_prop": 0.7167985927880387, "repo_name": "ogcs/Okra-Ax", "id": "f2af6ed97c91d065dcc6bf6edf8c9ae8c2842541", "size": "2362", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "okra-ax-protobuf/src/main/java/org/okraAx/v3/beans/GpcBnRelay.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "2098" }, { "name": "Java", "bytes": "389161" }, { "name": "Protocol Buffer", "bytes": "242908" } ], "symlink_target": "" }
require 'net/http' require 'rexml/xpath' require 'rexml/document' require 'wired_for_change' class SalsaConnection include UriEncoder class AuthenticationError < StandardError; end class AuthenticationFailure < StandardError; end class PostError < StandardError; end class PostFailure < StandardError; end attr_accessor :raw_post_response, :raw_post_request def initialize(opts) @email = opts[:email] @password = opts[:password] @node = opts[:node] @use_ssl = opts[:use_ssl] @debug_http = opts[:debug_http] end def _post(object, assertive=false) self.raw_post_request = uri_encode([[:xml, "xml"]].push(object)) if @session_cookie && @session_cookie != '' post_response = @conn.post('/save', self.raw_post_request, {"Cookie" => @session_cookie}) else post_response = @conn.post('/save', self.raw_post_request) end code = post_response.code self.raw_post_response = post_response.read_body if code != "200" return post_response unless assertive raise PostError, "Unexpected response code #{post_response.code} to post" end if assertive && ! post_succeeded? raise PostFailure, "No success entity in response to post" end post_response end def post_succeeded? REXML::XPath.first(REXML::Document.new(self.raw_post_response), "//success") != nil end def post(object) connect unless @connected _post(object, false) end def post!(object) connect! unless @connected _post(object, true) end def connected? @connected == true end def connect(assertive=false) port = @use_ssl ? 443 : 80 @conn = Net::HTTP.new(@node, port) @conn.use_ssl = true if @use_ssl @conn.set_debug_output $stderr if @debug_http if @email && @email != '' @auth_resp = @conn.post('/api/authenticate.sjs', uri_encode(:email => @email, :password => @password)) #! This is so wrong! Cheap hack to dodge using something like mechanize -- whk 20100302 # They return multiple cookies, with complex formatting that seems to get eaten by Net::HTTP @session_cookie = @auth_resp["Set-Cookie"] && @auth_resp["Set-Cookie"].split(";").find{|h| h =~ /session/i} code = @auth_resp.code if code != "200" return unless assertive raise AuthenticationError, "Unexpected response code #{@auth_resp.code} to auth" end raise AuthenticationError, "No session cookie in response" unless @session_cookie && @session_cookie != '' # Too bad they don't return a distinctive HTTP status (404 maybe?) to indicate login failure if err = REXML::XPath.first(REXML::Document.new(@auth_resp.read_body), "//error") return unless assertive raise AuthenticationFailure, "Authentication error #{err.get_text}" end end @connected = true end def connect! connect(true) end end
{ "content_hash": "897f088a03a7ed4fe5a0d846057d361c", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 113, "avg_line_length": 32.98863636363637, "alnum_prop": 0.6624181880812953, "repo_name": "actblue/wired_for_change", "id": "636b5c67fd8065e63235d0456b674a26a30e3cef", "size": "2903", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/wired_for_change/salsa_connection.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "15133" } ], "symlink_target": "" }
<resources> <string name="app_name">Raid</string> <string name="pokemon">ポケモン</string> <string name="player">参加者</string> <string name="fragment_update_blank_error">ポケモンと終了時間は必須です</string> <string name="ok">OK</string> <string name="close">閉じる</string> <string name="no_location">位置情報が登録されていません</string> <string name="no_internet">ネットワークに接続していません</string> <string name="morioka">盛岡</string> <string name="takizawa">滝沢</string> <string name="no_map_application">マップアプリがありません</string> <string name="preference_notification">通知設定</string> <string name="fragment_pref_save">保存</string> <string name="end_time">終了時間</string> <string name="channel_id">raid_notification</string> <string name="fragment_raid_list_notification_error">レイド情報を先に登録してください</string> <string name="fragment_notification_dialog_title">レイド通知を送信しますか?</string> <string name="raid_information">レイド情報</string> <string name="notification_body">場所: %1$s, ポケモン: %2$s</string> </resources>
{ "content_hash": "09ee8d470b21152ba7fd3187d0fc2605", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 82, "avg_line_length": 48.76190476190476, "alnum_prop": 0.7001953125, "repo_name": "yuzumone/Raid", "id": "063e02f0c60b190f9249674a9294a3fcefb49407", "size": "1262", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/values/strings.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Kotlin", "bytes": "22901" } ], "symlink_target": "" }
"""This code example creates new activity groups. To determine which activity groups exist, run get_all_activity_groups.py. Tags: ActivityGroupService.createActivityGroups """ __author__ = 'Vincent Tsao' # Locate the client library. If module was installed via "setup.py" script, then # the following two lines are not needed. import os import sys sys.path.insert(0, os.path.join('..', '..', '..', '..', '..')) # Import appropriate classes from the client library. from adspygoogle import DfpClient from adspygoogle.common import Utils # Set the ID of the advertiser company this activity group is associated with. ADVERTISER_COMPANY_ID = 'INSERT_ADVERTISER_COMPANY_ID_HERE' def main(client, advertiser_company_id): # Initialize appropriate service. activity_group_service = client.GetService('ActivityGroupService', version='v201308') # Create a short-term activity group. short_term_activity_group = { 'name': 'Short-term activity group #%s' % Utils.GetUniqueName(), 'companyIds': [advertiser_company_id], 'clicksLookback': '1', 'impressionsLookback': '1' } # Create a long-term activity group. long_term_activity_group = { 'name': 'Long-term activity group #%s' % Utils.GetUniqueName(), 'companyIds': [advertiser_company_id], 'clicksLookback': '30', 'impressionsLookback': '30' } # Create the activity groups on the server. activity_groups = activity_group_service.CreateActivityGroups([ short_term_activity_group, long_term_activity_group]) # Display results. for activity_group in activity_groups: print ('Activity group with ID \'%s\' and name \'%s\' was created.' % (activity_group['id'], activity_group['name'])) if __name__ == '__main__': # Initialize client object. dfp_client = DfpClient(path=os.path.join('..', '..', '..', '..', '..')) main(dfp_client, ADVERTISER_COMPANY_ID)
{ "content_hash": "f191971e2df9621e829b5a577acca543", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 80, "avg_line_length": 34.12280701754386, "alnum_prop": 0.6730077120822622, "repo_name": "lociii/googleads-python-lib", "id": "24f94f32f4a6b31f9ed38162147d9fe85b3ecc9d", "size": "2563", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "examples/adspygoogle/dfp/v201308/activity_group_service/create_activity_groups.py", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "3481618" }, { "name": "Shell", "bytes": "603" } ], "symlink_target": "" }
title: JStorm 配置 layout: plain_cn top-nav-title: JStorm 配置 top-nav-group: 快速开始 top-nav-pos: 4 sub-nav-title: JStorm 配置 sub-nav-group: 快速开始 sub-nav-pos: 4 --- The page doesn't list all setting. If you want to know all setting, please extract "defaults.yaml" from jstorm-server-xxxx.jar. Here just list frequently used setting. ``` storm.zookeeper.servers: zookeeper address. storm.zookeeper.root: root directory of JStorm in zookeeper. When multiple JStorm system share a ZOOKEEPER, you need to set this option. the default is "/jstorm". nimbus.host: nimbus ip, this setting is only for $JSTORM_HOME/bin/start.sh script. storm.local.dir: JStorm temporary directory to store local binary or configuration. You need to make ensure JStorm program has written privilege to this directory. java.library.path: zeromq and java zeromq library installation directory, if you are using other shared library, please put them in this directory. The default is "/usr/local/lib:/opt/local/lib:/usr/lib". supervisor.slots.ports: a list of ports provided by the supervisors. Be careful not to conflict with other ports. The default is 68xx, while storm is 67xx. topology.enable.classloader: false, classloader is disabled by default. If the jar of the application is conflict with one of jares which JStorm depends on. For example, an application depends on thrift9, but JStorm uses thrift7, then you need to enable this configure item. ## send message with sync or async mode ## if this setting is true, netty will use sync mode which means client can send one batch message only after receive one server's response ## Async mode means client can send message without server's response storm.messaging.netty.sync.mode: false ## when netty is in async mode and client channel is unavailable( server is down or netty channel buffer is full), ## it will block sending until channel is ready or channel is closed storm.messaging.netty.async.block: true #This setting is useless when netty is in sync mode. # If this setting is true and netty is in async mode, netty will batch message # if this setting is false and netty is in async mode, netty will send tuple one by one without batch tuple into one big message. storm.messaging.netty.transfer.async.batch: true ### default worker memory size, unit is byte worker.memory.size: 2147483648 # Metrics Monitor # topology.performance.metrics: it is the switch flag for performance # purpose. When it is disabled, the data of timer and histogram metrics # will not be collected. topology.performance.metrics: true # topology.alimonitor.metrics.post: If it is disable, metrics data # will only be printed to log. If it is enabled, the metrics data will be # posted to alimonitor besides printing to log. topology.alimonitor.metrics.post: false # when supervisor is shutdown, automatically shutdown worker # if run jstorm under other container such as hadoop-yarn, # this must be set as true worker.stop.without.supervisor: false #set how many tuple can spout send in one time. # For example, if this is setting 100, # spout can't send the No. 101th tuple until spout receive one tuple's ack message topology.max.spout.pending: null ``` *** # The default storm.yaml ``` ########### These MUST be filled in for a storm configuration storm.zookeeper.servers: - "localhost" storm.zookeeper.root: "/jstorm" # %JSTORM_HOME% is the jstorm home directory storm.local.dir: "%JSTORM_HOME%/data" java.library.path: "/usr/local/lib:/opt/local/lib:/usr/lib" supervisor.slots.ports: - 6800 - 6801 - 6802 - 6803 # Default disable user-define classloader # If there are jar conflict between jstorm and application, # please enable it topology.enable.classloader: false # enable supervisor use cgroup to make resource isolation # Before enable it, you should make sure: # 1. Linux version (>= 2.6.18) # 2. Have installed cgroup (check the file's existence:/proc/cgroups) # 3. You should start your supervisor on root # You can get more about cgroup: # http://t.cn/8s7nexU supervisor.enable.cgroup: false ### Netty will send multiple messages in one batch ### Setting true will improve throughput, but more latency storm.messaging.netty.transfer.async.batch: true ### default worker memory size, unit is byte worker.memory.size: 2147483648 # Metrics Monitor # topology.performance.metrics: it is the switch flag for performance # purpose. When it is disabled, the data of timer and histogram metrics # will not be collected. # topology.alimonitor.metrics.post: If it is disable, metrics data # will only be printed to log. If it is enabled, the metrics data will be # posted to alimonitor besides printing to log. topology.performance.metrics: true topology.alimonitor.metrics.post: false ```
{ "content_hash": "33e1bcec186db10f1d57b78c865a9136", "timestamp": "", "source": "github", "line_count": 119, "max_line_length": 274, "avg_line_length": 40.19327731092437, "alnum_prop": 0.7645828977629103, "repo_name": "penuel-leo/jstorm", "id": "f43ff691e71e9994594f5be6ec687f2c371973d0", "size": "4815", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "docs/jstorm-doc/backup/quickstart_cn/configuration_cn.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "16192" }, { "name": "Java", "bytes": "5996769" }, { "name": "JavaScript", "bytes": "29378" }, { "name": "Python", "bytes": "72981" }, { "name": "Shell", "bytes": "11341" }, { "name": "Thrift", "bytes": "16134" } ], "symlink_target": "" }
@interface DW360Program : NSObject<IMDDestroyable>{ GLuint vertexShaderHandle,fragmentShaderHandle; } @property (nonatomic) int mMVPMatrixHandle; @property (nonatomic) int mMVMatrixHandle; @property (nonatomic) int mPositionHandle; @property (nonatomic) int mTextureCoordinateHandle; @property (nonatomic) int mProgramHandle; @property (nonatomic) int mContentType; @property (nonatomic) int* mTextureUniformHandle; @property (nonatomic) int mColorConversionHandle; - (void) build; - (void) use; - (int) getTextureUniformSize; @end @interface DWRGBAProgram : DW360Program @end @interface DWYUV420PProgram : DW360Program @end
{ "content_hash": "0bb07f4d0f67b6cb9c4c82022ac07963", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 51, "avg_line_length": 26.583333333333332, "alnum_prop": 0.7931034482758621, "repo_name": "OSzhou/MyTestDemo", "id": "3b5b48a86ff39bc6c0a32be32dcae64f9205e3ae", "size": "832", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "iOS_SDK_3.0.3(点播+屏幕锁定)/include/DW360Program.h", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Ada", "bytes": "89079" }, { "name": "Assembly", "bytes": "141281" }, { "name": "Batchfile", "bytes": "178" }, { "name": "C", "bytes": "12382299" }, { "name": "C#", "bytes": "55626" }, { "name": "C++", "bytes": "404191" }, { "name": "CMake", "bytes": "8098" }, { "name": "CSS", "bytes": "22134" }, { "name": "DIGITAL Command Language", "bytes": "27303" }, { "name": "GLSL", "bytes": "8064" }, { "name": "HTML", "bytes": "249326" }, { "name": "JavaScript", "bytes": "13874" }, { "name": "M4", "bytes": "786" }, { "name": "Makefile", "bytes": "45839169" }, { "name": "Module Management System", "bytes": "1545" }, { "name": "Objective-C", "bytes": "4630226" }, { "name": "Pascal", "bytes": "75203" }, { "name": "Perl", "bytes": "3895" }, { "name": "Roff", "bytes": "7799" }, { "name": "Ruby", "bytes": "14350" }, { "name": "SAS", "bytes": "1847" }, { "name": "Shell", "bytes": "168034" }, { "name": "Swift", "bytes": "824742" } ], "symlink_target": "" }
package com.wiseass.profiler; import android.support.annotation.StringRes; /** * Created by Ryan on 01/03/2017. */ public interface BaseView<T> { void setPresenter(T presenter); void makeToast(@StringRes int stringId); void makeToast(String message); }
{ "content_hash": "bfd5b60c82056e3560cf30868a8c212c", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 44, "avg_line_length": 18.133333333333333, "alnum_prop": 0.7205882352941176, "repo_name": "BracketCove/Profiler", "id": "8ce5443e42ec3aee82b4417a37580a082184ffc8", "size": "272", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/wiseass/profiler/BaseView.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "150354" } ], "symlink_target": "" }
from .download import * from .login import login_session as login from .config import load_config as config def sort_teacher(teacher_list: list) -> str: teacher_name = [] for i in teacher_list: teacher_name.append(i.string) if len(teacher_name) >= 3: teacher_name[2] += '等' break return '、'.join(teacher_name)
{ "content_hash": "ccca416c83c0ad7b5c85ac34e3e1dd05", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 44, "avg_line_length": 28, "alnum_prop": 0.6208791208791209, "repo_name": "Rhilip/cn-mooc-dl", "id": "5b88483aa5f3475f3aaf790dc8351928a4d85347", "size": "392", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "model/__init__.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "47992" } ], "symlink_target": "" }
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M14 2H4v20h16V8l-6-6zm-1 7V3.5L18.5 9H13zm1 5 2-1.06v4.12L14 16v2H8v-6h6v2z" }), 'VideoFileSharp'); exports.default = _default;
{ "content_hash": "f74b05967d5691864d3f4c742392b791", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 87, "avg_line_length": 30.27777777777778, "alnum_prop": 0.7137614678899082, "repo_name": "oliviertassinari/material-ui", "id": "06ea759b125e6dfffd0b7c0771e39723d1db9265", "size": "545", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "packages/mui-icons-material/lib/VideoFileSharp.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "2126" }, { "name": "JavaScript", "bytes": "3779365" }, { "name": "TypeScript", "bytes": "2514535" } ], "symlink_target": "" }
/* $Id: px_26.c,v 1.45 2009/12/04 22:06:37 tbox Exp $ */ /* Reviewed: Mon Mar 20 10:44:27 PST 2000 */ /* RFC2163 */ #ifndef RDATA_IN_1_PX_26_C #define RDATA_IN_1_PX_26_C #define RRTYPE_PX_ATTRIBUTES (0) static inline isc_result_t fromtext_in_px(ARGS_FROMTEXT) { isc_token_t token; dns_name_t name; isc_buffer_t buffer; REQUIRE(type == 26); REQUIRE(rdclass == 1); UNUSED(type); UNUSED(rdclass); UNUSED(callbacks); /* * Preference. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, ISC_FALSE)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); /* * MAP822. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); origin = (origin != NULL) ? origin : dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); /* * MAPX400. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); origin = (origin != NULL) ? origin : dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); return (ISC_R_SUCCESS); } static inline isc_result_t totext_in_px(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; isc_boolean_t sub; char buf[sizeof("64000")]; unsigned short num; REQUIRE(rdata->type == 26); REQUIRE(rdata->rdclass == 1); REQUIRE(rdata->length != 0); dns_name_init(&name, NULL); dns_name_init(&prefix, NULL); /* * Preference. */ dns_rdata_toregion(rdata, &region); num = uint16_fromregion(&region); isc_region_consume(&region, 2); sprintf(buf, "%u", num); RETERR(str_totext(buf, target)); RETERR(str_totext(" ", target)); /* * MAP822. */ dns_name_fromregion(&name, &region); sub = name_prefix(&name, tctx->origin, &prefix); isc_region_consume(&region, name_length(&name)); RETERR(dns_name_totext(&prefix, sub, target)); RETERR(str_totext(" ", target)); /* * MAPX400. */ dns_name_fromregion(&name, &region); sub = name_prefix(&name, tctx->origin, &prefix); return(dns_name_totext(&prefix, sub, target)); } static inline isc_result_t fromwire_in_px(ARGS_FROMWIRE) { dns_name_t name; isc_region_t sregion; REQUIRE(type == 26); REQUIRE(rdclass == 1); UNUSED(type); UNUSED(rdclass); dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL); /* * Preference. */ isc_buffer_activeregion(source, &sregion); if (sregion.length < 2) return (ISC_R_UNEXPECTEDEND); RETERR(mem_tobuffer(target, sregion.base, 2)); isc_buffer_forward(source, 2); /* * MAP822. */ RETERR(dns_name_fromwire(&name, source, dctx, options, target)); /* * MAPX400. */ return (dns_name_fromwire(&name, source, dctx, options, target)); } static inline isc_result_t towire_in_px(ARGS_TOWIRE) { dns_name_t name; dns_offsets_t offsets; isc_region_t region; REQUIRE(rdata->type == 26); REQUIRE(rdata->rdclass == 1); REQUIRE(rdata->length != 0); dns_compress_setmethods(cctx, DNS_COMPRESS_NONE); /* * Preference. */ dns_rdata_toregion(rdata, &region); RETERR(mem_tobuffer(target, region.base, 2)); isc_region_consume(&region, 2); /* * MAP822. */ dns_name_init(&name, offsets); dns_name_fromregion(&name, &region); RETERR(dns_name_towire(&name, cctx, target)); isc_region_consume(&region, name_length(&name)); /* * MAPX400. */ dns_name_init(&name, offsets); dns_name_fromregion(&name, &region); return (dns_name_towire(&name, cctx, target)); } static inline int compare_in_px(ARGS_COMPARE) { dns_name_t name1; dns_name_t name2; isc_region_t region1; isc_region_t region2; int order; REQUIRE(rdata1->type == rdata2->type); REQUIRE(rdata1->rdclass == rdata2->rdclass); REQUIRE(rdata1->type == 26); REQUIRE(rdata1->rdclass == 1); REQUIRE(rdata1->length != 0); REQUIRE(rdata2->length != 0); order = memcmp(rdata1->data, rdata2->data, 2); if (order != 0) return (order < 0 ? -1 : 1); dns_name_init(&name1, NULL); dns_name_init(&name2, NULL); dns_rdata_toregion(rdata1, &region1); dns_rdata_toregion(rdata2, &region2); isc_region_consume(&region1, 2); isc_region_consume(&region2, 2); dns_name_fromregion(&name1, &region1); dns_name_fromregion(&name2, &region2); order = dns_name_rdatacompare(&name1, &name2); if (order != 0) return (order); isc_region_consume(&region1, name_length(&name1)); isc_region_consume(&region2, name_length(&name2)); dns_name_fromregion(&name1, &region1); dns_name_fromregion(&name2, &region2); return (dns_name_rdatacompare(&name1, &name2)); } static inline isc_result_t fromstruct_in_px(ARGS_FROMSTRUCT) { dns_rdata_in_px_t *px = source; isc_region_t region; REQUIRE(type == 26); REQUIRE(rdclass == 1); REQUIRE(source != NULL); REQUIRE(px->common.rdtype == type); REQUIRE(px->common.rdclass == rdclass); UNUSED(type); UNUSED(rdclass); RETERR(uint16_tobuffer(px->preference, target)); dns_name_toregion(&px->map822, &region); RETERR(isc_buffer_copyregion(target, &region)); dns_name_toregion(&px->mapx400, &region); return (isc_buffer_copyregion(target, &region)); } static inline isc_result_t tostruct_in_px(ARGS_TOSTRUCT) { dns_rdata_in_px_t *px = target; dns_name_t name; isc_region_t region; isc_result_t result; REQUIRE(rdata->type == 26); REQUIRE(rdata->rdclass == 1); REQUIRE(target != NULL); REQUIRE(rdata->length != 0); px->common.rdclass = rdata->rdclass; px->common.rdtype = rdata->type; ISC_LINK_INIT(&px->common, link); dns_name_init(&name, NULL); dns_rdata_toregion(rdata, &region); px->preference = uint16_fromregion(&region); isc_region_consume(&region, 2); dns_name_fromregion(&name, &region); dns_name_init(&px->map822, NULL); RETERR(name_duporclone(&name, mctx, &px->map822)); isc_region_consume(&region, name_length(&px->map822)); dns_name_init(&px->mapx400, NULL); result = name_duporclone(&name, mctx, &px->mapx400); if (result != ISC_R_SUCCESS) goto cleanup; px->mctx = mctx; return (result); cleanup: dns_name_free(&px->map822, mctx); return (ISC_R_NOMEMORY); } static inline void freestruct_in_px(ARGS_FREESTRUCT) { dns_rdata_in_px_t *px = source; REQUIRE(source != NULL); REQUIRE(px->common.rdclass == 1); REQUIRE(px->common.rdtype == 26); if (px->mctx == NULL) return; dns_name_free(&px->map822, px->mctx); dns_name_free(&px->mapx400, px->mctx); px->mctx = NULL; } static inline isc_result_t additionaldata_in_px(ARGS_ADDLDATA) { REQUIRE(rdata->type == 26); REQUIRE(rdata->rdclass == 1); UNUSED(rdata); UNUSED(add); UNUSED(arg); return (ISC_R_SUCCESS); } static inline isc_result_t digest_in_px(ARGS_DIGEST) { isc_region_t r1, r2; dns_name_t name; isc_result_t result; REQUIRE(rdata->type == 26); REQUIRE(rdata->rdclass == 1); dns_rdata_toregion(rdata, &r1); r2 = r1; isc_region_consume(&r2, 2); r1.length = 2; result = (digest)(arg, &r1); if (result != ISC_R_SUCCESS) return (result); dns_name_init(&name, NULL); dns_name_fromregion(&name, &r2); result = dns_name_digest(&name, digest, arg); if (result != ISC_R_SUCCESS) return (result); isc_region_consume(&r2, name_length(&name)); dns_name_init(&name, NULL); dns_name_fromregion(&name, &r2); return (dns_name_digest(&name, digest, arg)); } static inline isc_boolean_t checkowner_in_px(ARGS_CHECKOWNER) { REQUIRE(type == 26); REQUIRE(rdclass == 1); UNUSED(name); UNUSED(type); UNUSED(rdclass); UNUSED(wildcard); return (ISC_TRUE); } static inline isc_boolean_t checknames_in_px(ARGS_CHECKNAMES) { REQUIRE(rdata->type == 26); REQUIRE(rdata->rdclass == 1); UNUSED(rdata); UNUSED(owner); UNUSED(bad); return (ISC_TRUE); } static inline int casecompare_in_px(ARGS_COMPARE) { return (compare_in_px(rdata1, rdata2)); } #endif /* RDATA_IN_1_PX_26_C */
{ "content_hash": "1758689dea5cdced3aa98759cc1bdc2c", "timestamp": "", "source": "github", "line_count": 364, "max_line_length": 68, "avg_line_length": 21.85164835164835, "alnum_prop": 0.6702288156902187, "repo_name": "juneman/server-perf", "id": "a4111ad5bb76e75cff71771bd8c2828cc813f307", "size": "8826", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "lib/dns/rdata/in_1/px_26.c", "mode": "33188", "license": "mit", "language": [ { "name": "Awk", "bytes": "11329" }, { "name": "C", "bytes": "14119666" }, { "name": "C++", "bytes": "814763" }, { "name": "CSS", "bytes": "3545" }, { "name": "Objective-C", "bytes": "8601" }, { "name": "Perl", "bytes": "228206" }, { "name": "Python", "bytes": "76120" }, { "name": "Shell", "bytes": "2377889" }, { "name": "Tcl", "bytes": "31803" }, { "name": "XSLT", "bytes": "77676" } ], "symlink_target": "" }
package com.drew.metadata.pcx; import com.drew.lang.annotations.NotNull; import com.drew.metadata.Directory; import java.util.HashMap; /** * @author Drew Noakes https://drewnoakes.com */ public class PcxDirectory extends Directory { public static final int TAG_VERSION = 1; public static final int TAG_BITS_PER_PIXEL = 2; public static final int TAG_XMIN = 3; public static final int TAG_YMIN = 4; public static final int TAG_XMAX = 5; public static final int TAG_YMAX = 6; public static final int TAG_HORIZONTAL_DPI = 7; public static final int TAG_VERTICAL_DPI = 8; public static final int TAG_PALETTE = 9; public static final int TAG_COLOR_PLANES = 10; public static final int TAG_BYTES_PER_LINE = 11; public static final int TAG_PALETTE_TYPE = 12; public static final int TAG_HSCR_SIZE = 13; public static final int TAG_VSCR_SIZE = 14; @NotNull protected static final HashMap<Integer, String> _tagNameMap = new HashMap<Integer, String>(); static { _tagNameMap.put(TAG_VERSION, "Version"); _tagNameMap.put(TAG_BITS_PER_PIXEL, "Bits Per Pixel"); _tagNameMap.put(TAG_XMIN, "X Min"); _tagNameMap.put(TAG_YMIN, "Y Min"); _tagNameMap.put(TAG_XMAX, "X Max"); _tagNameMap.put(TAG_YMAX, "Y Max"); _tagNameMap.put(TAG_HORIZONTAL_DPI, "Horizontal DPI"); _tagNameMap.put(TAG_VERTICAL_DPI, "Vertical DPI"); _tagNameMap.put(TAG_PALETTE, "Palette"); _tagNameMap.put(TAG_COLOR_PLANES, "Color Planes"); _tagNameMap.put(TAG_BYTES_PER_LINE, "Bytes Per Line"); _tagNameMap.put(TAG_PALETTE_TYPE, "Palette Type"); _tagNameMap.put(TAG_HSCR_SIZE, "H Scr Size"); _tagNameMap.put(TAG_VSCR_SIZE, "V Scr Size"); } public PcxDirectory() { this.setDescriptor(new PcxDescriptor(this)); } @Override @NotNull public String getName() { return "PCX"; } @Override @NotNull protected HashMap<Integer, String> getTagNameMap() { return _tagNameMap; } }
{ "content_hash": "a50694dcacfec9520b3d4e662b276a59", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 97, "avg_line_length": 32.223880597014926, "alnum_prop": 0.6271421954608615, "repo_name": "ycaihua/metadata-extractor", "id": "348467884822df5d31560ec97c4de51a763ee5c6", "size": "2942", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "Source/com/drew/metadata/pcx/PcxDirectory.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "13481" }, { "name": "DIGITAL Command Language", "bytes": "117" }, { "name": "HTML", "bytes": "35831" }, { "name": "Java", "bytes": "1270576" } ], "symlink_target": "" }
using namespace lemon; using namespace std; int main() { typedef ListDigraph::Node Node; typedef ListDigraph::NodeIt NodeIt; typedef ListDigraph::Arc Arc; typedef dim2::Point<int> Point; ListDigraph g; ListDigraph::Node u = g.addNode(); ListDigraph::Node v = g.addNode(); ListDigraph::Node p = g.addNode(); ListDigraph::Arc a = g.addArc(u, v); ListDigraph::Arc b = g.addArc(u, p); cout << "Hello World! This is LEMON library here." << endl; cout << "We have a directed graph with " << countNodes(g) << " nodes " << "and " << countArcs(g) << " arc." << endl; cout << endl << endl; int cnt = 0; for (ListDigraph::NodeIt n(g); n != INVALID; ++n) cnt++; std::cout << "Number of nodes: " << cnt << std::endl; ListDigraph::NodeMap<Point> coords(g); ListDigraph::NodeMap<double> sizes(g); ListDigraph::NodeMap<int> colors(g); ListDigraph::NodeMap<int> shapes(g); ListDigraph::ArcMap<int> acolors(g); ListDigraph::ArcMap<int> widths(g); coords[u]=Point(50,50); sizes[u]=1; colors[u]=1; shapes[u]=0; coords[v]=Point(50,70); sizes[v]=2; colors[v]=2; shapes[v]=2; coords[p]=Point(70,70); sizes[p]=1; colors[p]=3; shapes[p]=0; acolors[a]=0; widths[a]=1; acolors[b]=0; widths[b]=1; Palette palette; Palette paletteW(true); IdMap<ListDigraph,Node> id(g); graphToEps(g, "graph.eps") .coords(coords) .title("Sample EPS figure") .copyright("(c) 2003-2010 LEMON Project") .absoluteNodeSizes().absoluteArcWidths() .nodeScale(2).nodeSizes(sizes) .nodeShapes(shapes) .nodeColors(composeMap(palette, colors)) .arcColors(composeMap(palette, acolors)) .arcWidthScale(.4).arcWidths(widths) .nodeTexts(id).nodeTextSize(3) .drawArrows().arrowWidth(2).arrowLength(2) .run(); return 0; }
{ "content_hash": "8cc6501a10f15b8c3fca67d6316e898e", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 75, "avg_line_length": 31.983870967741936, "alnum_prop": 0.5854765506807866, "repo_name": "SyllogismRXS/planning", "id": "d3716588119cfda8cfb15b90fc7f587e84b54499", "size": "2089", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "share/hello_lemon/main.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "13867" }, { "name": "Shell", "bytes": "2033" } ], "symlink_target": "" }
<html lang="en"> <head> <title>Function Basics - GNU Compiler Collection (GCC) Internals</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="GNU Compiler Collection (GCC) Internals"> <meta name="generator" content="makeinfo 4.8"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Functions.html#Functions" title="Functions"> <link rel="next" href="Function-Properties.html#Function-Properties" title="Function Properties"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- Copyright (C) 1988-2016 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being ``Funding Free Software'', the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled ``GNU Free Documentation License''. (a) The FSF's Front-Cover Text is: A GNU Manual (b) The FSF's Back-Cover Text is: You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.--> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <p> <a name="Function-Basics"></a> Next:&nbsp;<a rel="next" accesskey="n" href="Function-Properties.html#Function-Properties">Function Properties</a>, Up:&nbsp;<a rel="up" accesskey="u" href="Functions.html#Functions">Functions</a> <hr> </div> <h4 class="subsection">10.8.1 Function Basics</h4> <p><a name="index-DECL_005fNAME-1967"></a><a name="index-DECL_005fASSEMBLER_005fNAME-1968"></a><a name="index-TREE_005fPUBLIC-1969"></a><a name="index-DECL_005fARTIFICIAL-1970"></a><a name="index-DECL_005fFUNCTION_005fSPECIFIC_005fTARGET-1971"></a><a name="index-DECL_005fFUNCTION_005fSPECIFIC_005fOPTIMIZATION-1972"></a> A function has four core parts: the name, the parameters, the result, and the body. The following macros and functions access these parts of a <code>FUNCTION_DECL</code> as well as other basic features: <dl> <dt><code>DECL_NAME</code><a name="index-DECL_005fNAME-1973"></a><dd>This macro returns the unqualified name of the function, as an <code>IDENTIFIER_NODE</code>. For an instantiation of a function template, the <code>DECL_NAME</code> is the unqualified name of the template, not something like <code>f&lt;int&gt;</code>. The value of <code>DECL_NAME</code> is undefined when used on a constructor, destructor, overloaded operator, or type-conversion operator, or any function that is implicitly generated by the compiler. See below for macros that can be used to distinguish these cases. <br><dt><code>DECL_ASSEMBLER_NAME</code><a name="index-DECL_005fASSEMBLER_005fNAME-1974"></a><dd>This macro returns the mangled name of the function, also an <code>IDENTIFIER_NODE</code>. This name does not contain leading underscores on systems that prefix all identifiers with underscores. The mangled name is computed in the same way on all platforms; if special processing is required to deal with the object file format used on a particular platform, it is the responsibility of the back end to perform those modifications. (Of course, the back end should not modify <code>DECL_ASSEMBLER_NAME</code> itself.) <p>Using <code>DECL_ASSEMBLER_NAME</code> will cause additional memory to be allocated (for the mangled name of the entity) so it should be used only when emitting assembly code. It should not be used within the optimizers to determine whether or not two declarations are the same, even though some of the existing optimizers do use it in that way. These uses will be removed over time. <br><dt><code>DECL_ARGUMENTS</code><a name="index-DECL_005fARGUMENTS-1975"></a><dd>This macro returns the <code>PARM_DECL</code> for the first argument to the function. Subsequent <code>PARM_DECL</code> nodes can be obtained by following the <code>TREE_CHAIN</code> links. <br><dt><code>DECL_RESULT</code><a name="index-DECL_005fRESULT-1976"></a><dd>This macro returns the <code>RESULT_DECL</code> for the function. <br><dt><code>DECL_SAVED_TREE</code><a name="index-DECL_005fSAVED_005fTREE-1977"></a><dd>This macro returns the complete body of the function. <br><dt><code>TREE_TYPE</code><a name="index-TREE_005fTYPE-1978"></a><dd>This macro returns the <code>FUNCTION_TYPE</code> or <code>METHOD_TYPE</code> for the function. <br><dt><code>DECL_INITIAL</code><a name="index-DECL_005fINITIAL-1979"></a><dd>A function that has a definition in the current translation unit will have a non-<code>NULL</code> <code>DECL_INITIAL</code>. However, back ends should not make use of the particular value given by <code>DECL_INITIAL</code>. <p>It should contain a tree of <code>BLOCK</code> nodes that mirrors the scopes that variables are bound in the function. Each block contains a list of decls declared in a basic block, a pointer to a chain of blocks at the next lower scope level, then a pointer to the next block at the same level and a backpointer to the parent <code>BLOCK</code> or <code>FUNCTION_DECL</code>. So given a function as follows: <pre class="smallexample"> void foo() { int a; { int b; } int c; } </pre> <p>you would get the following: <pre class="smallexample"> tree foo = FUNCTION_DECL; tree decl_a = VAR_DECL; tree decl_b = VAR_DECL; tree decl_c = VAR_DECL; tree block_a = BLOCK; tree block_b = BLOCK; tree block_c = BLOCK; BLOCK_VARS(block_a) = decl_a; BLOCK_SUBBLOCKS(block_a) = block_b; BLOCK_CHAIN(block_a) = block_c; BLOCK_SUPERCONTEXT(block_a) = foo; BLOCK_VARS(block_b) = decl_b; BLOCK_SUPERCONTEXT(block_b) = block_a; BLOCK_VARS(block_c) = decl_c; BLOCK_SUPERCONTEXT(block_c) = foo; DECL_INITIAL(foo) = block_a; </pre> </dl> <!-- --> <!-- Function Properties --> <!-- --> </body></html>
{ "content_hash": "c25db90227a165c6f8643085796208b9", "timestamp": "", "source": "github", "line_count": 141, "max_line_length": 321, "avg_line_length": 48.40425531914894, "alnum_prop": 0.7049084249084249, "repo_name": "ChangsoonKim/STM32F7DiscTutor", "id": "a0880b832dfc48b6fde359fefc187b5eb83530b0", "size": "6825", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "toolchain/osx/gcc-arm-none-eabi-6-2017-q1-update/share/doc/gcc-arm-none-eabi/html/gccint/Function-Basics.html", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "4483749" }, { "name": "C", "bytes": "155831052" }, { "name": "C++", "bytes": "14522753" }, { "name": "HTML", "bytes": "22473152" }, { "name": "Logos", "bytes": "9680" }, { "name": "Makefile", "bytes": "25498" }, { "name": "Objective-C", "bytes": "285838" }, { "name": "Python", "bytes": "288546" }, { "name": "Roff", "bytes": "2842557" }, { "name": "Shell", "bytes": "20768" }, { "name": "XC", "bytes": "9187" }, { "name": "XS", "bytes": "9137" } ], "symlink_target": "" }
// MIT License // // Copyright (c) 2017 Kyle Kingsbury // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. namespace Sitecore.Foundation.CDN { using System.Collections.Generic; using Data.Items; public interface IPathService { IList<string> GeneratePaths(Item item); } }
{ "content_hash": "a17baebe4715b611753ba02d5af11d84", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 81, "avg_line_length": 42.806451612903224, "alnum_prop": 0.7498116051243406, "repo_name": "KKings/Sitecore.Foundation.CDN", "id": "f8b85c34ed7b850231f4311e87e01be55f9cc822", "size": "1329", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/Foundation/CDN/code/IPathService.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "66587" }, { "name": "JavaScript", "bytes": "9804" } ], "symlink_target": "" }
<?xml version='1.0' encoding='UTF-8'?> <org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage_-Tag plugin="workflow-support@2.14"> <node class="org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode" plugin="workflow-cps@2.32"> <parentIds> <string>2</string> </parentIds> <id>3</id> <descriptorId>org.jenkinsci.plugins.workflow.support.steps.ExecutorStep</descriptorId> </node> <actions> <org.jenkinsci.plugins.workflow.support.actions.LogActionImpl> <charset>UTF-8</charset> </org.jenkinsci.plugins.workflow.support.actions.LogActionImpl> <org.jenkinsci.plugins.workflow.cps.actions.ArgumentsActionImpl plugin="workflow-cps@2.32"> <arguments class="linked-hash-map"> <entry> <string>label</string> <string></string> </entry> </arguments> <isUnmodifiedBySanitization>true</isUnmodifiedBySanitization> </org.jenkinsci.plugins.workflow.cps.actions.ArgumentsActionImpl> <org.jenkinsci.plugins.workflow.support.actions.WorkspaceActionImpl> <node></node> <path>/Users/xuehao.hu/Develop/state-replay/work/jobs/test-my-plugin/workspace</path> <labels class="sorted-set"/> </org.jenkinsci.plugins.workflow.support.actions.WorkspaceActionImpl> <org.jenkinsci.plugins.workflow.actions.TimingAction plugin="workflow-api@2.16"> <startTime>1506116795491</startTime> </org.jenkinsci.plugins.workflow.actions.TimingAction> </actions> </org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage_-Tag>
{ "content_hash": "93f0a31b77c05c47dd122e96ce63909f", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 113, "avg_line_length": 49.0625, "alnum_prop": 0.729936305732484, "repo_name": "10000TB/state-replay", "id": "3fceeac81f0d5c0a725972fd33a1df50cb17a29a", "size": "1570", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "work/jobs/test-step-plugins/builds/12/workflow/3.xml", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "356523" }, { "name": "Groovy", "bytes": "6983" }, { "name": "HTML", "bytes": "850883" }, { "name": "Java", "bytes": "23693" }, { "name": "JavaScript", "bytes": "23479115" }, { "name": "Roff", "bytes": "541" }, { "name": "Shell", "bytes": "1898" } ], "symlink_target": "" }
package me.prettyprint.cassandra.service; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import me.prettyprint.cassandra.connection.HConnectionManager; import me.prettyprint.hector.api.ClockResolution; import me.prettyprint.hector.api.Cluster; import me.prettyprint.hector.api.ddl.KeyspaceDefinition; import me.prettyprint.hector.api.exceptions.HectorException; import org.apache.cassandra.thrift.Cassandra; import org.apache.cassandra.thrift.InvalidRequestException; import org.apache.thrift.TException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A cluster instance the client side representation of a cassandra server cluster. * * The cluster is usually the main entry point for programs using hector. To start operating on * cassandra cluster you first get or create a cluster, then a keyspace operator for the keyspace * you're interested in and then create mutations of queries * <code> * //get a cluster: * Cluster cluster = getOrCreateCluster("MyCluster", new CassandraHostConfigurator("127.0.0.1:9170")); * //get a keyspace from this cluster: * Keyspace ko = createKeyspace("Keyspace1", cluster); * //Create a mutator: * Mutator m = createMutator(ko); * // Make a mutation: * MutationResult mr = m.insert("key", cf, createColumn("name", "value", serializer, serializer)); * </code> * * THREAD SAFETY: This class is thread safe. * * @author Ran Tavory * @author zznate */ public abstract class AbstractCluster implements Cluster { private static final Map<String, String> EMPTY_CREDENTIALS = Collections.emptyMap(); private final Logger log = LoggerFactory.getLogger(AbstractCluster.class); /** * Linked to Cassandra StorageProxy. */ public static final int RING_DELAY = 30 * 1000; // delay after which we assume ring has stablized public static final int WAIT_FOR_SCHEMA_AGREEMENT_SLEEP_TIME = 1000; protected final HConnectionManager connectionManager; private final String name; private final CassandraHostConfigurator configurator; private final ClockResolution clockResolution; private final FailoverPolicy failoverPolicy; private final CassandraClientMonitor cassandraClientMonitor; private Set<CassandraHost> knownPoolHosts; protected final ExceptionsTranslator xtrans; private final Map<String, String> credentials; public AbstractCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator) { this(clusterName, cassandraHostConfigurator, EMPTY_CREDENTIALS); } public AbstractCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator, Map<String, String> credentials) { connectionManager = new HConnectionManager(clusterName, cassandraHostConfigurator); name = clusterName; configurator = cassandraHostConfigurator; failoverPolicy = FailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE; cassandraClientMonitor = JmxMonitor.getInstance().getCassandraMonitor(connectionManager); xtrans = new ExceptionsTranslatorImpl(); clockResolution = cassandraHostConfigurator.getClockResolution(); this.credentials = Collections.unmodifiableMap(credentials == null? EMPTY_CREDENTIALS : credentials); } @Override public HConnectionManager getConnectionManager() { return connectionManager; } /* (non-Javadoc) * @see me.prettyprint.cassandra.service.Cluster#getKnownPoolHosts(boolean) */ @Override public Set<CassandraHost> getKnownPoolHosts(boolean refresh) { if (refresh || knownPoolHosts == null) { knownPoolHosts = connectionManager.getHosts(); if ( log.isInfoEnabled() ) { log.info("found knownPoolHosts: {}", knownPoolHosts); } } return knownPoolHosts; } /* (non-Javadoc) * @see me.prettyprint.cassandra.service.Cluster#addHost(me.prettyprint.cassandra.service.CassandraHost, boolean) */ @Override public void addHost(CassandraHost cassandraHost, boolean skipApplyConfig) { if (!skipApplyConfig && configurator != null) { configurator.applyConfig(cassandraHost); } connectionManager.addCassandraHost(cassandraHost); } /* (non-Javadoc) * @see me.prettyprint.cassandra.service.Cluster#getName() */ @Override public String getName() { return name; } /* (non-Javadoc) * @see me.prettyprint.cassandra.service.Cluster#describeKeyspaces() */ @Override public List<KeyspaceDefinition> describeKeyspaces() throws HectorException { Operation<List<KeyspaceDefinition>> op = new Operation<List<KeyspaceDefinition>>(OperationType.META_READ, getCredentials()) { @Override public List<KeyspaceDefinition> execute(Cassandra.Client cassandra) throws HectorException { try { return ThriftKsDef.fromThriftList(cassandra.describe_keyspaces()); } catch (Exception e) { throw xtrans.translate(e); } } }; connectionManager.operateWithFailover(op); return op.getResult(); } /* (non-Javadoc) * @see me.prettyprint.cassandra.service.Cluster#describeClusterName() */ @Override public String describeClusterName() throws HectorException { Operation<String> op = new Operation<String>(OperationType.META_READ, getCredentials()) { @Override public String execute(Cassandra.Client cassandra) throws HectorException { try { return cassandra.describe_cluster_name(); } catch (Exception e) { throw xtrans.translate(e); } } }; connectionManager.operateWithFailover(op); return op.getResult(); } /* (non-Javadoc) * @see me.prettyprint.cassandra.service.Cluster#describeThriftVersion() */ @Override public String describeThriftVersion() throws HectorException { Operation<String> op = new Operation<String>(OperationType.META_READ, getCredentials()) { @Override public String execute(Cassandra.Client cassandra) throws HectorException { try { return cassandra.describe_version(); } catch (Exception e) { throw xtrans.translate(e); } } }; connectionManager.operateWithFailover(op); return op.getResult(); } /* (non-Javadoc) * @see me.prettyprint.cassandra.service.Cluster#describeKeyspace(java.lang.String) */ @Override public KeyspaceDefinition describeKeyspace(final String keyspace) throws HectorException { Operation<KeyspaceDefinition> op = new Operation<KeyspaceDefinition>( OperationType.META_READ, getCredentials()) { @Override public KeyspaceDefinition execute(Cassandra.Client cassandra) throws HectorException { try { return new ThriftKsDef(cassandra.describe_keyspace(keyspace)); } catch (org.apache.cassandra.thrift.NotFoundException nfe) { setException(xtrans.translate(nfe)); return null; } catch (Exception e) { throw xtrans.translate(e); } } }; connectionManager.operateWithFailover(op); return op.getResult(); } /* (non-Javadoc) * @see me.prettyprint.cassandra.service.Cluster#getClusterName() */ @Override public String getClusterName() throws HectorException { return describeClusterName(); } @Override public String dropKeyspace(final String keyspace) throws HectorException { return dropKeyspace(keyspace, false); } @Override public String dropKeyspace(final String keyspace, final boolean blockUntilComplete) throws HectorException { Operation<String> op = new Operation<String>(OperationType.META_WRITE, getCredentials()) { @Override public String execute(Cassandra.Client cassandra) throws HectorException { try { String schemaId = cassandra.system_drop_keyspace(keyspace); if (blockUntilComplete) { waitForSchemaAgreement(cassandra); } return schemaId; } catch (Exception e) { throw xtrans.translate(e); } } }; connectionManager.operateWithFailover(op); return op.getResult(); } @Override public String describePartitioner() throws HectorException { Operation<String> op = new Operation<String>(OperationType.META_READ, getCredentials()) { @Override public String execute(Cassandra.Client cassandra) throws HectorException { try { if ( log.isInfoEnabled() ) { log.info("in execute with client {}", cassandra); } return cassandra.describe_partitioner(); } catch (Exception e) { throw xtrans.translate(e); } } }; connectionManager.operateWithFailover(op); return op.getResult(); } @Override public String dropColumnFamily(final String keyspaceName, final String columnFamily) throws HectorException { return dropColumnFamily(keyspaceName, columnFamily, false); } @Override public String dropColumnFamily(final String keyspaceName, final String columnFamily, final boolean blockUntilComplete) throws HectorException { Operation<String> op = new Operation<String>(OperationType.META_WRITE, FailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE, keyspaceName, getCredentials()) { @Override public String execute(Cassandra.Client cassandra) throws HectorException { try { String schemaId = cassandra.system_drop_column_family(columnFamily); if (blockUntilComplete) { waitForSchemaAgreement(cassandra); } return schemaId; } catch (Exception e) { throw xtrans.translate(e); } } }; connectionManager.operateWithFailover(op); return op.getResult(); } @Override public Map<String, String> getCredentials() { return credentials; } @Override public void truncate(final String keyspaceName, final String columnFamily) throws HectorException { Operation<Void> op = new Operation<Void>(OperationType.META_WRITE, FailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE, keyspaceName, getCredentials()) { @Override public Void execute(Cassandra.Client cassandra) throws HectorException { try { cassandra.truncate(columnFamily); } catch (Exception e) { throw xtrans.translate(e); } return null; } }; connectionManager.operateWithFailover(op); } protected static void waitForSchemaAgreement(Cassandra.Client cassandra) throws InvalidRequestException, TException, InterruptedException { int waited = 0; int versions = 0; while (versions != 1) { versions = 0; Map<String, List<String>> schema = cassandra.describe_schema_versions(); for (Map.Entry<String, List<String>> entry : schema.entrySet()) { if (!entry.getKey().equals("UNREACHABLE")) versions++; } if (versions != 1) { Thread.sleep(WAIT_FOR_SCHEMA_AGREEMENT_SLEEP_TIME); waited += WAIT_FOR_SCHEMA_AGREEMENT_SLEEP_TIME; if (waited > RING_DELAY) throw new RuntimeException("Could not reach schema agreement in " + RING_DELAY + "ms"); } } } }
{ "content_hash": "d4d2ff1b9c0876f8fca8392a52d5920a", "timestamp": "", "source": "github", "line_count": 324, "max_line_length": 150, "avg_line_length": 34.364197530864196, "alnum_prop": 0.7039698221663373, "repo_name": "normanmaurer/hector", "id": "285fe368601f6c16b89f0f69b0004429738bf9c7", "size": "11134", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "core/src/main/java/me/prettyprint/cassandra/service/AbstractCluster.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "1202112" } ], "symlink_target": "" }
const { program } = require("commander"); const fs = require("fs"); const { execSync } = require("child_process"); program.option("-e --entity <entity>", "entity name").parse(process.argv); const { entity } = program.opts(); const projections = ["mill", "merc", "aea", "lcc"]; const toCamelCase = (str) => str.replace(/_([a-z])/g, function (m, w) { return w.toUpperCase(); }); const jQuery = { fn: { vectorMap: (action, name, content) => { const mapName = toCamelCase(name); const chunks = name.split("_"); const camelCase = toCamelCase( chunks.slice(0, chunks.length - 1).join("_"), ); const entityName = camelCase .charAt(0) .toUpperCase() .concat(camelCase.slice(1)); const folderPath = `../../packages/maps/src/${entityName}`; !fs.existsSync(folderPath) && fs.mkdirSync(folderPath, { recursive: true }); fs.writeFileSync( `${folderPath}/${mapName}.json`, JSON.stringify({ name, content, }), ); fs.rmSync(`temp.js`); }, }, }; projections.forEach((projection) => { try { execSync( `wget https://jvectormap.com/js/jquery-jvectormap-${entity}-${projection}.js --no-check-certificate -O temp.js`, ); const file = fs.readFileSync("temp.js", "utf8"); eval(file); } catch (err) { console.log('Could not download map'); } });
{ "content_hash": "08d609839bae7cb030701d90768bd06d", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 118, "avg_line_length": 25.945454545454545, "alnum_prop": 0.5697266993693062, "repo_name": "kadoshms/react-jvectormap", "id": "17002594ce7220ee60538738317efbd503aee15e", "size": "1427", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "scripts/map-scraper/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "6635" }, { "name": "HTML", "bytes": "42468" }, { "name": "JavaScript", "bytes": "167608" }, { "name": "Python", "bytes": "39074" }, { "name": "SCSS", "bytes": "7539" }, { "name": "Shell", "bytes": "1362" }, { "name": "TypeScript", "bytes": "73441" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Phaser Class: Rope</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/default.css"> <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css"> <link type="text/css" rel="stylesheet" href="styles/site.cerulean.css"> </head> <body> <div class="container-fluid"> <div class="navbar navbar-fixed-top navbar-inverse"> <div style="position: absolute; width: 143px; height: 31px; right: 10px; top: 10px; z-index: 1050"><a href="http://phaser.io"><img src="img/phaser.png" border="0" /></a></div> <div class="navbar-inner"> <a class="brand" href="index.html">Phaser API</a> <ul class="nav"> <li class="dropdown"> <a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b class="caret"></b></a> <ul class="dropdown-menu "> <li class="class-depth-0"> <a href="Phaser.html">Phaser</a> </li> <li class="class-depth-0"> <a href="Phaser.KeyCode.html">KeyCode</a> </li> <li class="class-depth-0"> <a href="PIXI.html">PIXI</a> </li> </ul> </li> <li class="dropdown"> <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> <ul class="dropdown-menu "> <li class="class-depth-1"> <a href="Phaser.Animation.html">Animation</a> </li> <li class="class-depth-1"> <a href="Phaser.AnimationManager.html">AnimationManager</a> </li> <li class="class-depth-1"> <a href="Phaser.AnimationParser.html">AnimationParser</a> </li> <li class="class-depth-1"> <a href="Phaser.ArraySet.html">ArraySet</a> </li> <li class="class-depth-1"> <a href="Phaser.ArrayUtils.html">ArrayUtils</a> </li> <li class="class-depth-1"> <a href="Phaser.AudioSprite.html">AudioSprite</a> </li> <li class="class-depth-1"> <a href="Phaser.BitmapData.html">BitmapData</a> </li> <li class="class-depth-1"> <a href="Phaser.BitmapText.html">BitmapText</a> </li> <li class="class-depth-1"> <a href="Phaser.Button.html">Button</a> </li> <li class="class-depth-1"> <a href="Phaser.Cache.html">Cache</a> </li> <li class="class-depth-1"> <a href="Phaser.Camera.html">Camera</a> </li> <li class="class-depth-1"> <a href="Phaser.Canvas.html">Canvas</a> </li> <li class="class-depth-1"> <a href="Phaser.Circle.html">Circle</a> </li> <li class="class-depth-1"> <a href="Phaser.Color.html">Color</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Angle.html">Angle</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Animation.html">Animation</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.AutoCull.html">AutoCull</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Bounds.html">Bounds</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.BringToTop.html">BringToTop</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Core.html">Core</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Crop.html">Crop</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Delta.html">Delta</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Destroy.html">Destroy</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.FixedToCamera.html">FixedToCamera</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Health.html">Health</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.InCamera.html">InCamera</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.InputEnabled.html">InputEnabled</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.InWorld.html">InWorld</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.LifeSpan.html">LifeSpan</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.LoadTexture.html">LoadTexture</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Overlap.html">Overlap</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.PhysicsBody.html">PhysicsBody</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Reset.html">Reset</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.ScaleMinMax.html">ScaleMinMax</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Smoothed.html">Smoothed</a> </li> <li class="class-depth-1"> <a href="Phaser.Create.html">Create</a> </li> <li class="class-depth-1"> <a href="Phaser.Creature.html">Creature</a> </li> <li class="class-depth-1"> <a href="Phaser.Device.html">Device</a> </li> <li class="class-depth-1"> <a href="Phaser.DeviceButton.html">DeviceButton</a> </li> <li class="class-depth-1"> <a href="Phaser.DOM.html">DOM</a> </li> <li class="class-depth-1"> <a href="Phaser.Easing.html">Easing</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Back.html">Back</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Bounce.html">Bounce</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Circular.html">Circular</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Cubic.html">Cubic</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Elastic.html">Elastic</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Exponential.html">Exponential</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Linear.html">Linear</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Quadratic.html">Quadratic</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Quartic.html">Quartic</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Quintic.html">Quintic</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a> </li> <li class="class-depth-1"> <a href="Phaser.Ellipse.html">Ellipse</a> </li> <li class="class-depth-1"> <a href="Phaser.Events.html">Events</a> </li> <li class="class-depth-1"> <a href="Phaser.Filter.html">Filter</a> </li> <li class="class-depth-1"> <a href="Phaser.FlexGrid.html">FlexGrid</a> </li> <li class="class-depth-1"> <a href="Phaser.FlexLayer.html">FlexLayer</a> </li> <li class="class-depth-1"> <a href="Phaser.Frame.html">Frame</a> </li> <li class="class-depth-1"> <a href="Phaser.FrameData.html">FrameData</a> </li> <li class="class-depth-1"> <a href="Phaser.Game.html">Game</a> </li> <li class="class-depth-1"> <a href="Phaser.GameObjectCreator.html">GameObjectCreator</a> </li> <li class="class-depth-1"> <a href="Phaser.GameObjectFactory.html">GameObjectFactory</a> </li> <li class="class-depth-1"> <a href="Phaser.Gamepad.html">Gamepad</a> </li> <li class="class-depth-1"> <a href="Phaser.Graphics.html">Graphics</a> </li> <li class="class-depth-1"> <a href="Phaser.Group.html">Group</a> </li> <li class="class-depth-1"> <a href="Phaser.Image.html">Image</a> </li> <li class="class-depth-1"> <a href="Phaser.ImageCollection.html">ImageCollection</a> </li> <li class="class-depth-1"> <a href="Phaser.Input.html">Input</a> </li> <li class="class-depth-1"> <a href="Phaser.InputHandler.html">InputHandler</a> </li> <li class="class-depth-1"> <a href="Phaser.Key.html">Key</a> </li> <li class="class-depth-1"> <a href="Phaser.Keyboard.html">Keyboard</a> </li> <li class="class-depth-1"> <a href="Phaser.Line.html">Line</a> </li> <li class="class-depth-1"> <a href="Phaser.LinkedList.html">LinkedList</a> </li> <li class="class-depth-1"> <a href="Phaser.Loader.html">Loader</a> </li> <li class="class-depth-1"> <a href="Phaser.LoaderParser.html">LoaderParser</a> </li> <li class="class-depth-1"> <a href="Phaser.Math.html">Math</a> </li> <li class="class-depth-1"> <a href="Phaser.Matrix.html">Matrix</a> </li> <li class="class-depth-1"> <a href="Phaser.Mouse.html">Mouse</a> </li> <li class="class-depth-1"> <a href="Phaser.MSPointer.html">MSPointer</a> </li> <li class="class-depth-1"> <a href="Phaser.Net.html">Net</a> </li> <li class="class-depth-1"> <a href="Phaser.Particle.html">Particle</a> </li> <li class="class-depth-1"> <a href="Phaser.Particles.html">Particles</a> </li> <li class="class-depth-2"> <a href="Phaser.Particles.Arcade.html">Arcade</a> </li> <li class="class-depth-3"> <a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a> </li> <li class="class-depth-1"> <a href="Phaser.Physics.html">Physics</a> </li> <li class="class-depth-2"> <a href="Phaser.Physics.Arcade.html">Arcade</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.Arcade.Body.html">Body</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.Arcade.TilemapCollision.html">TilemapCollision</a> </li> <li class="class-depth-2"> <a href="Phaser.Physics.Ninja.html">Ninja</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.Ninja.AABB.html">AABB</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.Ninja.Body.html">Body</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.Ninja.Circle.html">Circle</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.Ninja.Tile.html">Tile</a> </li> <li class="class-depth-2"> <a href="Phaser.Physics.P2.html">P2</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.Body.html">Body</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.BodyDebug.html">BodyDebug</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.DistanceConstraint.html">DistanceConstraint</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.FixtureList.html">FixtureList</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.GearConstraint.html">GearConstraint</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.InversePointProxy.html">InversePointProxy</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.LockConstraint.html">LockConstraint</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.Material.html">Material</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.PointProxy.html">PointProxy</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.PrismaticConstraint.html">PrismaticConstraint</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.RevoluteConstraint.html">RevoluteConstraint</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.RotationalSpring.html">RotationalSpring</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.Spring.html">Spring</a> </li> <li class="class-depth-1"> <a href="Phaser.Plugin.html">Plugin</a> </li> <li class="class-depth-1"> <a href="Phaser.PluginManager.html">PluginManager</a> </li> <li class="class-depth-1"> <a href="Phaser.Point.html">Point</a> </li> <li class="class-depth-1"> <a href="Phaser.Pointer.html">Pointer</a> </li> <li class="class-depth-1"> <a href="Phaser.PointerMode.html">PointerMode</a> </li> <li class="class-depth-1"> <a href="Phaser.Polygon.html">Polygon</a> </li> <li class="class-depth-1"> <a href="Phaser.QuadTree.html">QuadTree</a> </li> <li class="class-depth-1"> <a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a> </li> <li class="class-depth-1"> <a href="Phaser.Rectangle.html">Rectangle</a> </li> <li class="class-depth-1"> <a href="Phaser.RenderTexture.html">RenderTexture</a> </li> <li class="class-depth-1"> <a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a> </li> <li class="class-depth-1"> <a href="Phaser.RetroFont.html">RetroFont</a> </li> <li class="class-depth-1"> <a href="Phaser.Rope.html">Rope</a> </li> <li class="class-depth-1"> <a href="Phaser.RoundedRectangle.html">RoundedRectangle</a> </li> <li class="class-depth-1"> <a href="Phaser.ScaleManager.html">ScaleManager</a> </li> <li class="class-depth-1"> <a href="Phaser.Signal.html">Signal</a> </li> <li class="class-depth-1"> <a href="Phaser.SignalBinding.html">SignalBinding</a> </li> <li class="class-depth-1"> <a href="Phaser.SinglePad.html">SinglePad</a> </li> <li class="class-depth-1"> <a href="Phaser.Sound.html">Sound</a> </li> <li class="class-depth-1"> <a href="Phaser.SoundManager.html">SoundManager</a> </li> <li class="class-depth-1"> <a href="Phaser.Sprite.html">Sprite</a> </li> <li class="class-depth-1"> <a href="Phaser.SpriteBatch.html">SpriteBatch</a> </li> <li class="class-depth-1"> <a href="Phaser.Stage.html">Stage</a> </li> <li class="class-depth-1"> <a href="Phaser.State.html">State</a> </li> <li class="class-depth-1"> <a href="Phaser.StateManager.html">StateManager</a> </li> <li class="class-depth-1"> <a href="Phaser.Text.html">Text</a> </li> <li class="class-depth-1"> <a href="Phaser.Tile.html">Tile</a> </li> <li class="class-depth-1"> <a href="Phaser.Tilemap.html">Tilemap</a> </li> <li class="class-depth-1"> <a href="Phaser.TilemapLayer.html">TilemapLayer</a> </li> <li class="class-depth-1"> <a href="Phaser.TilemapParser.html">TilemapParser</a> </li> <li class="class-depth-1"> <a href="Phaser.Tileset.html">Tileset</a> </li> <li class="class-depth-1"> <a href="Phaser.TileSprite.html">TileSprite</a> </li> <li class="class-depth-1"> <a href="Phaser.Time.html">Time</a> </li> <li class="class-depth-1"> <a href="Phaser.Timer.html">Timer</a> </li> <li class="class-depth-1"> <a href="Phaser.TimerEvent.html">TimerEvent</a> </li> <li class="class-depth-1"> <a href="Phaser.Touch.html">Touch</a> </li> <li class="class-depth-1"> <a href="Phaser.Tween.html">Tween</a> </li> <li class="class-depth-1"> <a href="Phaser.TweenData.html">TweenData</a> </li> <li class="class-depth-1"> <a href="Phaser.TweenManager.html">TweenManager</a> </li> <li class="class-depth-1"> <a href="Phaser.Utils.html">Utils</a> </li> <li class="class-depth-2"> <a href="Phaser.Utils.Debug.html">Debug</a> </li> <li class="class-depth-1"> <a href="Phaser.Video.html">Video</a> </li> <li class="class-depth-1"> <a href="Phaser.World.html">World</a> </li> <li class="class-depth-1"> <a href="PIXI.AbstractFilter.html">AbstractFilter</a> </li> <li class="class-depth-1"> <a href="PIXI.BaseTexture.html">BaseTexture</a> </li> <li class="class-depth-1"> <a href="PIXI.CanvasBuffer.html">CanvasBuffer</a> </li> <li class="class-depth-1"> <a href="PIXI.CanvasGraphics.html">CanvasGraphics</a> </li> <li class="class-depth-1"> <a href="PIXI.CanvasMaskManager.html">CanvasMaskManager</a> </li> <li class="class-depth-1"> <a href="PIXI.CanvasPool.html">CanvasPool</a> </li> <li class="class-depth-1"> <a href="PIXI.CanvasRenderer.html">CanvasRenderer</a> </li> <li class="class-depth-1"> <a href="PIXI.CanvasTinter.html">CanvasTinter</a> </li> <li class="class-depth-1"> <a href="PIXI.ComplexPrimitiveShader.html">ComplexPrimitiveShader</a> </li> <li class="class-depth-1"> <a href="PIXI.DisplayObject.html">DisplayObject</a> </li> <li class="class-depth-1"> <a href="PIXI.DisplayObjectContainer.html">DisplayObjectContainer</a> </li> <li class="class-depth-1"> <a href="PIXI.EarCut.html">EarCut</a> </li> <li class="class-depth-1"> <a href="PIXI.Event.html">Event</a> </li> <li class="class-depth-1"> <a href="PIXI.EventTarget.html">EventTarget</a> </li> <li class="class-depth-1"> <a href="PIXI.FilterTexture.html">FilterTexture</a> </li> <li class="class-depth-1"> <a href="PIXI.Graphics.html">Graphics</a> </li> <li class="class-depth-1"> <a href="PIXI.GraphicsData.html">GraphicsData</a> </li> <li class="class-depth-1"> <a href="PIXI.PIXI.html">PIXI</a> </li> <li class="class-depth-1"> <a href="PIXI.PixiFastShader.html">PixiFastShader</a> </li> <li class="class-depth-1"> <a href="PIXI.PixiShader.html">PixiShader</a> </li> <li class="class-depth-1"> <a href="PIXI.PolyK.html">PolyK</a> </li> <li class="class-depth-1"> <a href="PIXI.PrimitiveShader.html">PrimitiveShader</a> </li> <li class="class-depth-1"> <a href="PIXI.RenderTexture.html">RenderTexture</a> </li> <li class="class-depth-1"> <a href="PIXI.Rope.html">Rope</a> </li> <li class="class-depth-1"> <a href="PIXI.Sprite.html">Sprite</a> </li> <li class="class-depth-1"> <a href="PIXI.SpriteBatch.html">SpriteBatch</a> </li> <li class="class-depth-1"> <a href="PIXI.Strip.html">Strip</a> </li> <li class="class-depth-1"> <a href="PIXI.StripShader.html">StripShader</a> </li> <li class="class-depth-1"> <a href="PIXI.Texture.html">Texture</a> </li> <li class="class-depth-1"> <a href="PIXI.TilingSprite.html">TilingSprite</a> </li> <li class="class-depth-1"> <a href="PIXI.WebGLBlendModeManager.html">WebGLBlendModeManager</a> </li> <li class="class-depth-1"> <a href="PIXI.WebGLFastSpriteBatch.html">WebGLFastSpriteBatch</a> </li> <li class="class-depth-1"> <a href="PIXI.WebGLFilterManager.html">WebGLFilterManager</a> </li> <li class="class-depth-1"> <a href="PIXI.WebGLRenderer.html">WebGLRenderer</a> </li> </ul> </li> <li class="dropdown"> <a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a> <ul class="dropdown-menu "> <li class="class-depth-0"> <a href="global.html#AUTO">AUTO</a> </li> <li class="class-depth-0"> <a href="global.html#BITMAPDATA">BITMAPDATA</a> </li> <li class="class-depth-0"> <a href="global.html#BITMAPTEXT">BITMAPTEXT</a> </li> <li class="class-depth-0"> <a href="global.html#blendModes">blendModes</a> </li> <li class="class-depth-0"> <a href="global.html#BUTTON">BUTTON</a> </li> <li class="class-depth-0"> <a href="global.html#CANVAS">CANVAS</a> </li> <li class="class-depth-0"> <a href="global.html#CANVAS_FILTER">CANVAS_FILTER</a> </li> <li class="class-depth-0"> <a href="global.html#CIRCLE">CIRCLE</a> </li> <li class="class-depth-0"> <a href="global.html#CREATURE">CREATURE</a> </li> <li class="class-depth-0"> <a href="global.html#DOWN">DOWN</a> </li> <li class="class-depth-0"> <a href="global.html#ELLIPSE">ELLIPSE</a> </li> <li class="class-depth-0"> <a href="global.html#EMITTER">EMITTER</a> </li> <li class="class-depth-0"> <a href="global.html#GAMES">GAMES</a> </li> <li class="class-depth-0"> <a href="global.html#GRAPHICS">GRAPHICS</a> </li> <li class="class-depth-0"> <a href="global.html#GROUP">GROUP</a> </li> <li class="class-depth-0"> <a href="global.html#HEADLESS">HEADLESS</a> </li> <li class="class-depth-0"> <a href="global.html#IMAGE">IMAGE</a> </li> <li class="class-depth-0"> <a href="global.html#LEFT">LEFT</a> </li> <li class="class-depth-0"> <a href="global.html#LINE">LINE</a> </li> <li class="class-depth-0"> <a href="global.html#MATRIX">MATRIX</a> </li> <li class="class-depth-0"> <a href="global.html#NONE">NONE</a> </li> <li class="class-depth-0"> <a href="global.html#PENDING_ATLAS">PENDING_ATLAS</a> </li> <li class="class-depth-0"> <a href="global.html#POINT">POINT</a> </li> <li class="class-depth-0"> <a href="global.html#POINTER">POINTER</a> </li> <li class="class-depth-0"> <a href="global.html#POLYGON">POLYGON</a> </li> <li class="class-depth-0"> <a href="global.html#RECTANGLE">RECTANGLE</a> </li> <li class="class-depth-0"> <a href="global.html#RENDERTEXTURE">RENDERTEXTURE</a> </li> <li class="class-depth-0"> <a href="global.html#RETROFONT">RETROFONT</a> </li> <li class="class-depth-0"> <a href="global.html#RIGHT">RIGHT</a> </li> <li class="class-depth-0"> <a href="global.html#ROPE">ROPE</a> </li> <li class="class-depth-0"> <a href="global.html#ROUNDEDRECTANGLE">ROUNDEDRECTANGLE</a> </li> <li class="class-depth-0"> <a href="global.html#scaleModes">scaleModes</a> </li> <li class="class-depth-0"> <a href="global.html#SPRITE">SPRITE</a> </li> <li class="class-depth-0"> <a href="global.html#SPRITEBATCH">SPRITEBATCH</a> </li> <li class="class-depth-0"> <a href="global.html#TEXT">TEXT</a> </li> <li class="class-depth-0"> <a href="global.html#TILEMAP">TILEMAP</a> </li> <li class="class-depth-0"> <a href="global.html#TILEMAPLAYER">TILEMAPLAYER</a> </li> <li class="class-depth-0"> <a href="global.html#TILESPRITE">TILESPRITE</a> </li> <li class="class-depth-0"> <a href="global.html#UP">UP</a> </li> <li class="class-depth-0"> <a href="global.html#VERSION">VERSION</a> </li> <li class="class-depth-0"> <a href="global.html#VIDEO">VIDEO</a> </li> <li class="class-depth-0"> <a href="global.html#WEBGL">WEBGL</a> </li> <li class="class-depth-0"> <a href="global.html#WEBGL_FILTER">WEBGL_FILTER</a> </li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Core<b class="caret"></b></a> <ul class="dropdown-menu "> <li class="class-depth-1"><a href="Phaser.Game.html">Game</a></li> <li class="class-depth-1"><a href="Phaser.Group.html">Group</a></li> <li class="class-depth-1"><a href="Phaser.World.html">World</a></li> <li class="class-depth-1"><a href="Phaser.Loader.html">Loader</a></li> <li class="class-depth-1"><a href="Phaser.Cache.html">Cache</a></li> <li class="class-depth-1"><a href="Phaser.Time.html">Time</a></li> <li class="class-depth-1"><a href="Phaser.Camera.html">Camera</a></li> <li class="class-depth-1"><a href="Phaser.StateManager.html">State Manager</a></li> <li class="class-depth-1"><a href="Phaser.TweenManager.html">Tween Manager</a></li> <li class="class-depth-1"><a href="Phaser.SoundManager.html">Sound Manager</a></li> <li class="class-depth-1"><a href="Phaser.Input.html">Input Manager</a></li> <li class="class-depth-1"><a href="Phaser.ScaleManager.html">Scale Manager</a></li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Game Objects<b class="caret"></b></a> <ul class="dropdown-menu "> <li class="class-depth-1"><a href="Phaser.GameObjectFactory.html">Factory (game.add)</a></li> <li class="class-depth-1"><a href="Phaser.GameObjectCreator.html">Creator (game.make)</a></li> <li class="class-depth-1"><a href="Phaser.Sprite.html">Sprite</a></li> <li class="class-depth-1"><a href="Phaser.Image.html">Image</a></li> <li class="class-depth-1"><a href="Phaser.Sound.html">Sound</a></li> <li class="class-depth-1"><a href="Phaser.Video.html">Video</a></li> <li class="class-depth-1"><a href="Phaser.Particles.Arcade.Emitter.html">Particle Emitter</a></li> <li class="class-depth-1"><a href="Phaser.Particle.html">Particle</a></li> <li class="class-depth-1"><a href="Phaser.Text.html">Text</a></li> <li class="class-depth-1"><a href="Phaser.Tween.html">Tween</a></li> <li class="class-depth-1"><a href="Phaser.BitmapText.html">BitmapText</a></li> <li class="class-depth-1"><a href="Phaser.Tilemap.html">Tilemap</a></li> <li class="class-depth-1"><a href="Phaser.BitmapData.html">BitmapData</a></li> <li class="class-depth-1"><a href="Phaser.RetroFont.html">RetroFont</a></li> <li class="class-depth-1"><a href="Phaser.Button.html">Button</a></li> <li class="class-depth-1"><a href="Phaser.Animation.html">Animation</a></li> <li class="class-depth-1"><a href="Phaser.Graphics.html">Graphics</a></li> <li class="class-depth-1"><a href="Phaser.RenderTexture.html">RenderTexture</a></li> <li class="class-depth-1"><a href="Phaser.TileSprite.html">TileSprite</a></li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Geometry<b class="caret"></b></a> <ul class="dropdown-menu "> <li class="class-depth-1"><a href="Phaser.Circle.html">Circle</a></li> <li class="class-depth-1"><a href="Phaser.Ellipse.html">Ellipse</a></li> <li class="class-depth-1"><a href="Phaser.Line.html">Line</a></li> <li class="class-depth-1"><a href="Phaser.Matrix.html">Matrix</a></li> <li class="class-depth-1"><a href="Phaser.Point.html">Point</a></li> <li class="class-depth-1"><a href="Phaser.Polygon.html">Polygon</a></li> <li class="class-depth-1"><a href="Phaser.Rectangle.html">Rectangle</a></li> <li class="class-depth-1"><a href="Phaser.RoundedRectangle.html">Rounded Rectangle</a></li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Physics<b class="caret"></b></a> <ul class="dropdown-menu "> <li class="class-depth-1"><a href="Phaser.Physics.Arcade.html">Arcade Physics</a></li> <li class="class-depth-2"><a href="Phaser.Physics.Arcade.Body.html">Body</a></li> <li class="class-depth-1"><a href="Phaser.Physics.P2.html">P2 Physics</a></li> <li class="class-depth-2"><a href="Phaser.Physics.P2.Body.html">Body</a></li> <li class="class-depth-2"><a href="Phaser.Physics.P2.Spring.html">Spring</a></li> <li class="class-depth-2"><a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a></li> <li class="class-depth-2"><a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a></li> <li class="class-depth-1"><a href="Phaser.Physics.Ninja.html">Ninja Physics</a></li> <li class="class-depth-2"><a href="Phaser.Physics.Body.html">Body</a></li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Input<b class="caret"></b></a> <ul class="dropdown-menu "> <li class="class-depth-1"><a href="Phaser.InputHandler.html">Input Handler</a></li> <li class="class-depth-1"><a href="Phaser.Pointer.html">Pointer</a></li> <li class="class-depth-1"><a href="Phaser.DeviceButton.html">Device Button</a></li> <li class="class-depth-1"><a href="Phaser.Mouse.html">Mouse</a></li> <li class="class-depth-1"><a href="Phaser.Keyboard.html">Keyboard</a></li> <li class="class-depth-1"><a href="Phaser.Key.html">Key</a></li> <li class="class-depth-1"><a href="Phaser.Gamepad.html">Gamepad</a></li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Community<b class="caret"></b></a> <ul class="dropdown-menu "> <li class="class-depth-1"><a href="http://phaser.io">Phaser Web Site</a></li> <li class="class-depth-1"><a href="https://github.com/photonstorm/phaser">Phaser Github</a></li> <li class="class-depth-1"><a href="http://phaser.io/examples">Phaser Examples</a></li> <li class="class-depth-1"><a href="https://github.com/photonstorm/phaser-plugins">Phaser Plugins</a></li> <li class="class-depth-1"><a href="http://www.html5gamedevs.com/forum/14-phaser/">Forum</a></li> <li class="class-depth-1"><a href="http://stackoverflow.com/questions/tagged/phaser-framework">Stack Overflow</a></li> <li class="class-depth-1"><a href="http://phaser.io/learn">Tutorials</a></li> <li class="class-depth-1"><a href="https://confirmsubscription.com/h/r/369DE48E3E86AF1E">Newsletter</a></li> <li class="class-depth-1"><a href="http://phaser.io/community/twitter">Twitter</a></li> <li class="class-depth-1"><a href="http://phaser.io/community/irc">IRC</a></li> <li class="class-depth-1"><a href="https://www.codeandweb.com/texturepacker/phaser">Texture Packer</a></li> </ul> </li> </ul> </div> </div> <div class="row-fluid"> <div class="span8"> <div id="main"> <!--<h1 class="page-title">Class: Rope</h1>--> <section> <header> <h2> <span class="ancestors"><a href="Phaser.html">Phaser</a>.</span> Rope </h2> </header> <article> <div class="container-overview"> <dt> <h4 class="name " id="Rope"><span class="type-signature"></span>new Rope<span class="signature">(game, x, y, key, frame, points)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>A Rope is a Sprite that has a repeating texture.</p> <p>The texture will automatically wrap on the edges as it moves.</p> <p>Please note that Ropes cannot have an input handler.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>game</code></td> <td class="type"> <span class="param-type"><a href="Phaser.Game.html">Phaser.Game</a></span> </td> <td class="description last"><p>A reference to the currently running game.</p></td> </tr> <tr> <td class="name"><code>x</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The x coordinate (in world space) to position the Rope at.</p></td> </tr> <tr> <td class="name"><code>y</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The y coordinate (in world space) to position the Rope at.</p></td> </tr> <tr> <td class="name"><code>key</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type"><a href="Phaser.RenderTexture.html">Phaser.RenderTexture</a></span> | <span class="param-type"><a href="Phaser.BitmapData.html">Phaser.BitmapData</a></span> | <span class="param-type"><a href="PIXI.Texture.html">PIXI.Texture</a></span> </td> <td class="description last"><p>This is the image or texture used by the Rope during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.</p></td> </tr> <tr> <td class="name"><code>frame</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">number</span> </td> <td class="description last"><p>If this Rope is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.</p></td> </tr> <tr> <td class="name"><code>points</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last"><p>An array of {Phaser.Point}.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source - <a href="src_gameobjects_Rope.js.html">gameobjects/Rope.js</a>, <a href="src_gameobjects_Rope.js.html#sunlight-1-line-42">line 42</a> </dt> </dl> </dd> </div> <h3 class="subsection-title">Extends</h3> <ul> <li><a href="PIXI.Rope.html">PIXI.Rope</a></li> <li><a href="Phaser.Component.Core.html">Phaser.Component.Core</a></li> <li><a href="Phaser.Component.Angle.html">Phaser.Component.Angle</a></li> <li><a href="Phaser.Component.Animation.html">Phaser.Component.Animation</a></li> <li><a href="Phaser.Component.AutoCull.html">Phaser.Component.AutoCull</a></li> <li><a href="Phaser.Component.Bounds.html">Phaser.Component.Bounds</a></li> <li><a href="Phaser.Component.BringToTop.html">Phaser.Component.BringToTop</a></li> <li><a href="Phaser.Component.Crop.html">Phaser.Component.Crop</a></li> <li><a href="Phaser.Component.Delta.html">Phaser.Component.Delta</a></li> <li><a href="Phaser.Component.Destroy.html">Phaser.Component.Destroy</a></li> <li><a href="Phaser.Component.FixedToCamera.html">Phaser.Component.FixedToCamera</a></li> <li><a href="Phaser.Component.InWorld.html">Phaser.Component.InWorld</a></li> <li><a href="Phaser.Component.LifeSpan.html">Phaser.Component.LifeSpan</a></li> <li><a href="Phaser.Component.LoadTexture.html">Phaser.Component.LoadTexture</a></li> <li><a href="Phaser.Component.Overlap.html">Phaser.Component.Overlap</a></li> <li><a href="Phaser.Component.PhysicsBody.html">Phaser.Component.PhysicsBody</a></li> <li><a href="Phaser.Component.Reset.html">Phaser.Component.Reset</a></li> <li><a href="Phaser.Component.ScaleMinMax.html">Phaser.Component.ScaleMinMax</a></li> <li><a href="Phaser.Component.Smoothed.html">Phaser.Component.Smoothed</a></li> </ul> <h3 class="subsection-title">Members</h3> <dl> <dt> <h4 class="name " id="alive"><span class="type-signature"></span>alive<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>A useful flag to control if the Game Object is alive or dead.</p> <p>This is set automatically by the Health components <code>damage</code> method should the object run out of health. Or you can toggle it via your game code.</p> <p>This property is mostly just provided to be used by your game - it doesn't effect rendering or logic updates. However you can use <code>Group.getFirstAlive</code> in conjunction with this property for fast object pooling and recycling.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.LifeSpan.html#alive">Phaser.Component.LifeSpan#alive</a> </li></dd> <dt class="tag-default">Default Value:</dt> <dd class="tag-default"><ul class="dummy"><li>true</li></ul></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_LifeSpan.js.html">gameobjects/components/LifeSpan.js</a>, <a href="src_gameobjects_components_LifeSpan.js.html#sunlight-1-line-50">line 50</a> </dt> </dl> </dd> <dt> <h4 class="name " id="alpha"><span class="type-signature"></span>alpha<span class="type-signature"> :Number</span></h4> </dt> <dd> <div class="description"> <p>The opacity of the object.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#alpha">PIXI.DisplayObject#alpha</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-46">line 46</a> </dt> </dl> </dd> <dt> <h4 class="name " id="angle"><span class="type-signature"></span>angle<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>The angle property is the rotation of the Game Object in <em>degrees</em> from its original orientation.</p> <p>Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.</p> <p>Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90.</p> <p>If you wish to work in radians instead of degrees you can use the property <code>rotation</code> instead. Working in radians is slightly faster as it doesn't have to perform any calculations.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Angle.html#angle">Phaser.Component.Angle#angle</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Angle.js.html">gameobjects/components/Angle.js</a>, <a href="src_gameobjects_components_Angle.js.html#sunlight-1-line-29">line 29</a> </dt> </dl> </dd> <dt> <h4 class="name " id="animations"><span class="type-signature"></span>animations<span class="type-signature"> :<a href="Phaser.AnimationManager.html">Phaser.AnimationManager</a></span></h4> </dt> <dd> <div class="description"> <p>If the Game Object is enabled for animation (such as a Phaser.Sprite) this is a reference to its AnimationManager instance. Through it you can create, play, pause and stop animations.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#animations">Phaser.Component.Core#animations</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-186">line 186</a> </dt> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="Phaser.AnimationManager.html">Phaser.AnimationManager</a></li> </ul> </dd> </dl> </dd> <dt> <h4 class="name " id="autoCull"><span class="type-signature"></span>autoCull<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>A Game Object with <code>autoCull</code> set to true will check its bounds against the World Camera every frame. If it is not intersecting the Camera bounds at any point then it has its <code>renderable</code> property set to <code>false</code>. This keeps the Game Object alive and still processing updates, but forces it to skip the render step entirely.</p> <p>This is a relatively expensive operation, especially if enabled on hundreds of Game Objects. So enable it only if you know it's required, or you have tested performance and find it acceptable.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.AutoCull.html#autoCull">Phaser.Component.AutoCull#autoCull</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_AutoCull.js.html">gameobjects/components/AutoCull.js</a>, <a href="src_gameobjects_components_AutoCull.js.html#sunlight-1-line-28">line 28</a> </dt> </dl> </dd> <dt> <h4 class="name " id="blendMode"><span class="type-signature"></span>blendMode<span class="type-signature"> :Number</span></h4> </dt> <dd> <div class="description"> <p>The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.Strip.html#blendMode">PIXI.Strip#blendMode</a> </li></dd> <dt class="tag-default">Default Value:</dt> <dd class="tag-default"><ul class="dummy"><li>PIXI.blendModes.NORMAL;</li></ul></dd> <dt class="tag-source">Source - <a href="src_pixi_extras_Strip.js.html">pixi/extras/Strip.js</a>, <a href="src_pixi_extras_Strip.js.html#sunlight-1-line-51">line 51</a> </dt> </dl> </dd> <dt> <h4 class="name " id="body"><span class="type-signature"></span>body<span class="type-signature"> :<a href="Phaser.Physics.Arcade.Body.html">Phaser.Physics.Arcade.Body</a>|<a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a>|<a href="Phaser.Physics.Ninja.Body.html">Phaser.Physics.Ninja.Body</a>|null</span></h4> </dt> <dd> <div class="description"> <p><code>body</code> is the Game Objects physics body. Once a Game Object is enabled for physics you access all associated properties and methods via it.</p> <p>By default Game Objects won't add themselves to any physics system and their <code>body</code> property will be <code>null</code>.</p> <p>To enable this Game Object for physics you need to call <code>game.physics.enable(object, system)</code> where <code>object</code> is this object and <code>system</code> is the Physics system you are using. If none is given it defaults to <code>Phaser.Physics.Arcade</code>.</p> <p>You can alternatively call <code>game.physics.arcade.enable(object)</code>, or add this Game Object to a physics enabled Group.</p> <p>Important: Enabling a Game Object for P2 or Ninja physics will automatically set its <code>anchor</code> property to 0.5, so the physics body is centered on the Game Object.</p> <p>If you need a different result then adjust or re-create the Body shape offsets manually or reset the anchor after enabling physics.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type"><a href="Phaser.Physics.Arcade.Body.html">Phaser.Physics.Arcade.Body</a></span> | <span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span> | <span class="param-type"><a href="Phaser.Physics.Ninja.Body.html">Phaser.Physics.Ninja.Body</a></span> | <span class="param-type">null</span> </li> </ul> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.PhysicsBody.html#body">Phaser.Component.PhysicsBody#body</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_PhysicsBody.js.html">gameobjects/components/PhysicsBody.js</a>, <a href="src_gameobjects_components_PhysicsBody.js.html#sunlight-1-line-91">line 91</a> </dt> </dl> </dd> <dt> <h4 class="name " id="bottom"><span class="type-signature">&lt;readonly> </span>bottom<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>The sum of the y and height properties. This is the same as <code>y + height - offsetY</code>.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Bounds.html#bottom">Phaser.Component.Bounds#bottom</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Bounds.js.html">gameobjects/components/Bounds.js</a>, <a href="src_gameobjects_components_Bounds.js.html#sunlight-1-line-110">line 110</a> </dt> </dl> </dd> <dt> <h4 class="name " id="cacheAsBitmap"><span class="type-signature"></span>cacheAsBitmap<span class="type-signature"> :Boolean</span></h4> </dt> <dd> <div class="description"> <p>Set if this display object is cached as a bitmap. This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects. To remove simply set this property to 'null'</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#cacheAsBitmap">PIXI.DisplayObject#cacheAsBitmap</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-355">line 355</a> </dt> </dl> </dd> <dt> <h4 class="name " id="cameraOffset"><span class="type-signature"></span>cameraOffset<span class="type-signature"> :<a href="Phaser.Point.html">Phaser.Point</a></span></h4> </dt> <dd> <div class="description"> <p>The x/y coordinate offset applied to the top-left of the camera that this Game Object will be drawn at if <code>fixedToCamera</code> is true.</p> <p>The values are relative to the top-left of the camera view and in addition to any parent of the Game Object on the display list.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.FixedToCamera.html#cameraOffset">Phaser.Component.FixedToCamera#cameraOffset</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_FixedToCamera.js.html">gameobjects/components/FixedToCamera.js</a>, <a href="src_gameobjects_components_FixedToCamera.js.html#sunlight-1-line-86">line 86</a> </dt> </dl> </dd> <dt> <h4 class="name " id="canvasPadding"><span class="type-signature"></span>canvasPadding<span class="type-signature"> :Number</span></h4> </dt> <dd> <div class="description"> <p>Triangles in canvas mode are automatically antialiased, use this value to force triangles to overlap a bit with each other.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.Strip.html#canvasPadding">PIXI.Strip#canvasPadding</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_extras_Strip.js.html">pixi/extras/Strip.js</a>, <a href="src_pixi_extras_Strip.js.html#sunlight-1-line-60">line 60</a> </dt> </dl> </dd> <dt> <h4 class="name " id="checkWorldBounds"><span class="type-signature"></span>checkWorldBounds<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>If this is set to <code>true</code> the Game Object checks if it is within the World bounds each frame. </p> <p>When it is no longer intersecting the world bounds it dispatches the <code>onOutOfBounds</code> event.</p> <p>If it was <em>previously</em> out of bounds but is now intersecting the world bounds again it dispatches the <code>onEnterBounds</code> event.</p> <p>It also optionally kills the Game Object if <code>outOfBoundsKill</code> is <code>true</code>.</p> <p>When <code>checkWorldBounds</code> is enabled it forces the Game Object to calculate its full bounds every frame.</p> <p>This is a relatively expensive operation, especially if enabled on hundreds of Game Objects. So enable it only if you know it's required, or you have tested performance and find it acceptable.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.InWorld.html#checkWorldBounds">Phaser.Component.InWorld#checkWorldBounds</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_InWorld.js.html">gameobjects/components/InWorld.js</a>, <a href="src_gameobjects_components_InWorld.js.html#sunlight-1-line-98">line 98</a> </dt> </dl> </dd> <dt> <h4 class="name " id="children"><span class="type-signature">&lt;readonly> </span>children<span class="type-signature"> :Array.&lt;<a href="global.html#DisplayObject">DisplayObject</a>></span></h4> </dt> <dd> <div class="description"> <p>[read-only] The array of children of this container.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Array.&lt;<a href="global.html#DisplayObject">DisplayObject</a>></span> </li> </ul> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#children">PIXI.DisplayObjectContainer#children</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-17">line 17</a> </dt> </dl> </dd> <dt> <h4 class="name " id="components"><span class="type-signature">&lt;internal> </span>components<span class="type-signature"> :object</span></h4> </dt> <dd> <div class="description"> <p>The components this Game Object has installed.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#components">Phaser.Component.Core#components</a> </li></dd> <dt class="important tag-deprecated">Internal:</dt> <dd class="tag-deprecated"><ul> <li>This member is <em>internal (protected)</em> and may be modified or removed in the future.</li> </ul></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-160">line 160</a> </dt> </dl> </dd> <dt> <h4 class="name " id="cropRect"><span class="type-signature"></span>cropRect<span class="type-signature"> :<a href="Phaser.Rectangle.html">Phaser.Rectangle</a></span></h4> </dt> <dd> <div class="description"> <p>The Rectangle used to crop the texture this Game Object uses. Set this property via <code>crop</code>. If you modify this property directly you must call <code>updateCrop</code> in order to have the change take effect.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Crop.html#cropRect">Phaser.Component.Crop#cropRect</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Crop.js.html">gameobjects/components/Crop.js</a>, <a href="src_gameobjects_components_Crop.js.html#sunlight-1-line-24">line 24</a> </dt> </dl> </dd> <dt> <h4 class="name " id="debug"><span class="type-signature"></span>debug<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>A debug flag designed for use with <code>Game.enableStep</code>.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#debug">Phaser.Component.Core#debug</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-211">line 211</a> </dt> </dl> </dd> <dt> <h4 class="name " id="deltaX"><span class="type-signature">&lt;readonly> </span>deltaX<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>Returns the delta x value. The difference between world.x now and in the previous frame.</p> <p>The value will be positive if the Game Object has moved to the right or negative if to the left.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Delta.html#deltaX">Phaser.Component.Delta#deltaX</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Delta.js.html">gameobjects/components/Delta.js</a>, <a href="src_gameobjects_components_Delta.js.html#sunlight-1-line-24">line 24</a> </dt> </dl> </dd> <dt> <h4 class="name " id="deltaY"><span class="type-signature">&lt;readonly> </span>deltaY<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>Returns the delta y value. The difference between world.y now and in the previous frame.</p> <p>The value will be positive if the Game Object has moved down or negative if up.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Delta.html#deltaY">Phaser.Component.Delta#deltaY</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Delta.js.html">gameobjects/components/Delta.js</a>, <a href="src_gameobjects_components_Delta.js.html#sunlight-1-line-42">line 42</a> </dt> </dl> </dd> <dt> <h4 class="name " id="deltaZ"><span class="type-signature">&lt;readonly> </span>deltaZ<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>Returns the delta z value. The difference between rotation now and in the previous frame. The delta value.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Delta.html#deltaZ">Phaser.Component.Delta#deltaZ</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Delta.js.html">gameobjects/components/Delta.js</a>, <a href="src_gameobjects_components_Delta.js.html#sunlight-1-line-58">line 58</a> </dt> </dl> </dd> <dt> <h4 class="name " id="destroyPhase"><span class="type-signature">&lt;readonly> </span>destroyPhase<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>As a Game Object runs through its destroy method this flag is set to true, and can be checked in any sub-systems or plugins it is being destroyed from.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Destroy.html#destroyPhase">Phaser.Component.Destroy#destroyPhase</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Destroy.js.html">gameobjects/components/Destroy.js</a>, <a href="src_gameobjects_components_Destroy.js.html#sunlight-1-line-22">line 22</a> </dt> </dl> </dd> <dt> <h4 class="name " id="dirty"><span class="type-signature"></span>dirty<span class="type-signature"> :Boolean</span></h4> </dt> <dd> <div class="description"> <p>Whether the strip is dirty or not</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.Strip.html#dirty">PIXI.Strip#dirty</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_extras_Strip.js.html">pixi/extras/Strip.js</a>, <a href="src_pixi_extras_Strip.js.html#sunlight-1-line-43">line 43</a> </dt> </dl> </dd> <dt> <h4 class="name " id="events"><span class="type-signature"></span>events<span class="type-signature"> :<a href="Phaser.Events.html">Phaser.Events</a></span></h4> </dt> <dd> <div class="description"> <p>All Phaser Game Objects have an Events class which contains all of the events that are dispatched when certain things happen to this Game Object, or any of its components.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#events">Phaser.Component.Core#events</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-178">line 178</a> </dt> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="Phaser.Events.html">Phaser.Events</a></li> </ul> </dd> </dl> </dd> <dt> <h4 class="name " id="exists"><span class="type-signature"></span>exists<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>Controls if this Game Object is processed by the core game loop. If this Game Object has a physics body it also controls if its physics body is updated or not. When <code>exists</code> is set to <code>false</code> it will remove its physics body from the physics world if it has one. It also toggles the <code>visible</code> property to false as well.</p> <p>Setting <code>exists</code> to true will add its physics body back in to the physics world, if it has one. It will also set the <code>visible</code> property to <code>true</code>.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#exists">Phaser.Component.Core#exists</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-277">line 277</a> </dt> </dl> </dd> <dt> <h4 class="name " id="filterArea"><span class="type-signature"></span>filterArea<span class="type-signature"> :Rectangle</span></h4> </dt> <dd> <div class="description"> <p>The area the filter is applied to like the hitArea this is used as more of an optimisation rather than figuring out the dimensions of the displayObject each frame you can set this rectangle</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#filterArea">PIXI.DisplayObject#filterArea</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-164">line 164</a> </dt> </dl> </dd> <dt> <h4 class="name " id="filters"><span class="type-signature"></span>filters<span class="type-signature"> :Array.&lt;Filter></span></h4> </dt> <dd> <div class="description"> <p>Sets the filters for the displayObject. IMPORTANT: This is a webGL only feature and will be ignored by the Canvas renderer.</p> <p>To remove filters simply set this property to 'null'.</p> <p>You cannot have a filter and a multiply blend mode active at the same time. Setting a filter will reset this objects blend mode to NORMAL.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Array.&lt;Filter></span> </li> </ul> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#filters">PIXI.DisplayObject#filters</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-307">line 307</a> </dt> </dl> </dd> <dt> <h4 class="name " id="fixedToCamera"><span class="type-signature"></span>fixedToCamera<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>A Game Object that is &quot;fixed&quot; to the camera uses its x/y coordinates as offsets from the top left of the camera during rendering.</p> <p>The values are adjusted at the rendering stage, overriding the Game Objects actual world position.</p> <p>The end result is that the Game Object will appear to be 'fixed' to the camera, regardless of where in the game world the camera is viewing. This is useful if for example this Game Object is a UI item that you wish to be visible at all times regardless where in the world the camera is.</p> <p>The offsets are stored in the <code>cameraOffset</code> property.</p> <p>Note that the <code>cameraOffset</code> values are in addition to any parent of this Game Object on the display list.</p> <p>Be careful not to set <code>fixedToCamera</code> on Game Objects which are in Groups that already have <code>fixedToCamera</code> enabled on them.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.FixedToCamera.html#fixedToCamera">Phaser.Component.FixedToCamera#fixedToCamera</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_FixedToCamera.js.html">gameobjects/components/FixedToCamera.js</a>, <a href="src_gameobjects_components_FixedToCamera.js.html#sunlight-1-line-56">line 56</a> </dt> </dl> </dd> <dt> <h4 class="name " id="frame"><span class="type-signature"></span>frame<span class="type-signature"> :integer</span></h4> </dt> <dd> <div class="description"> <p>Gets or sets the current frame index of the texture being used to render this Game Object.</p> <p>To change the frame set <code>frame</code> to the index of the new frame in the sprite sheet you wish this Game Object to use, for example: <code>player.frame = 4</code>.</p> <p>If the frame index given doesn't exist it will revert to the first frame found in the texture.</p> <p>If you are using a texture atlas then you should use the <code>frameName</code> property instead.</p> <p>If you wish to fully replace the texture being used see <code>loadTexture</code>.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.LoadTexture.html#frame">Phaser.Component.LoadTexture#frame</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_LoadTexture.js.html">gameobjects/components/LoadTexture.js</a>, <a href="src_gameobjects_components_LoadTexture.js.html#sunlight-1-line-254">line 254</a> </dt> </dl> </dd> <dt> <h4 class="name " id="frameName"><span class="type-signature"></span>frameName<span class="type-signature"> :string</span></h4> </dt> <dd> <div class="description"> <p>Gets or sets the current frame name of the texture being used to render this Game Object.</p> <p>To change the frame set <code>frameName</code> to the name of the new frame in the texture atlas you wish this Game Object to use, for example: <code>player.frameName = &quot;idle&quot;</code>.</p> <p>If the frame name given doesn't exist it will revert to the first frame found in the texture and throw a console warning.</p> <p>If you are using a sprite sheet then you should use the <code>frame</code> property instead.</p> <p>If you wish to fully replace the texture being used see <code>loadTexture</code>.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.LoadTexture.html#frameName">Phaser.Component.LoadTexture#frameName</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_LoadTexture.js.html">gameobjects/components/LoadTexture.js</a>, <a href="src_gameobjects_components_LoadTexture.js.html#sunlight-1-line-279">line 279</a> </dt> </dl> </dd> <dt> <h4 class="name " id="fresh"><span class="type-signature">&lt;readonly> </span>fresh<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>A Game Object is considered <code>fresh</code> if it has just been created or reset and is yet to receive a renderer transform update. This property is mostly used internally by the physics systems, but is exposed for the use of plugins.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#fresh">Phaser.Component.Core#fresh</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-241">line 241</a> </dt> </dl> </dd> <dt> <h4 class="name " id="game"><span class="type-signature"></span>game<span class="type-signature"> :<a href="Phaser.Game.html">Phaser.Game</a></span></h4> </dt> <dd> <div class="description"> <p>A reference to the currently running Game.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#game">Phaser.Component.Core#game</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-145">line 145</a> </dt> </dl> </dd> <dt> <h4 class="name " id="height"><span class="type-signature"></span>height<span class="type-signature"> :Number</span></h4> </dt> <dd> <div class="description"> <p>The height of the displayObjectContainer, setting this will actually modify the scale to achieve the value set</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#height">PIXI.DisplayObjectContainer#height</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-61">line 61</a> </dt> </dl> </dd> <dt> <h4 class="name " id="hitArea"><span class="type-signature"></span>hitArea<span class="type-signature"> :Rectangle|Circle|Ellipse|Polygon</span></h4> </dt> <dd> <div class="description"> <p>This is the defined area that will pick up mouse / touch events. It is null by default. Setting it is a neat way of optimising the hitTest function that the interactionManager will use (as it will not need to hit test all the children)</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Rectangle</span> | <span class="param-type">Circle</span> | <span class="param-type">Ellipse</span> | <span class="param-type">Polygon</span> </li> </ul> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#hitArea">PIXI.DisplayObject#hitArea</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-62">line 62</a> </dt> </dl> </dd> <dt> <h4 class="name " id="inCamera"><span class="type-signature">&lt;readonly> </span>inCamera<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>Checks if the Game Objects bounds intersect with the Game Camera bounds. Returns <code>true</code> if they do, otherwise <code>false</code> if fully outside of the Cameras bounds.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.AutoCull.html#inCamera">Phaser.Component.AutoCull#inCamera</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_AutoCull.js.html">gameobjects/components/AutoCull.js</a>, <a href="src_gameobjects_components_AutoCull.js.html#sunlight-1-line-37">line 37</a> </dt> </dl> </dd> <dt> <h4 class="name " id="inWorld"><span class="type-signature">&lt;readonly> </span>inWorld<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>Checks if the Game Objects bounds are within, or intersect at any point with the Game World bounds.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.InWorld.html#inWorld">Phaser.Component.InWorld#inWorld</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_InWorld.js.html">gameobjects/components/InWorld.js</a>, <a href="src_gameobjects_components_InWorld.js.html#sunlight-1-line-129">line 129</a> </dt> </dl> </dd> <dt> <h4 class="name " id="key"><span class="type-signature"></span>key<span class="type-signature"> :string|<a href="Phaser.RenderTexture.html">Phaser.RenderTexture</a>|<a href="Phaser.BitmapData.html">Phaser.BitmapData</a>|<a href="Phaser.Video.html">Phaser.Video</a>|<a href="PIXI.Texture.html">PIXI.Texture</a></span></h4> </dt> <dd> <div class="description"> <p>The key of the image or texture used by this Game Object during rendering. If it is a string it's the string used to retrieve the texture from the Phaser Image Cache. It can also be an instance of a RenderTexture, BitmapData, Video or PIXI.Texture. If a Game Object is created without a key it is automatically assigned the key <code>__default</code> which is a 32x32 transparent PNG stored within the Cache. If a Game Object is given a key which doesn't exist in the Image Cache it is re-assigned the key <code>__missing</code> which is a 32x32 PNG of a green box with a line through it.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">string</span> | <span class="param-type"><a href="Phaser.RenderTexture.html">Phaser.RenderTexture</a></span> | <span class="param-type"><a href="Phaser.BitmapData.html">Phaser.BitmapData</a></span> | <span class="param-type"><a href="Phaser.Video.html">Phaser.Video</a></span> | <span class="param-type"><a href="PIXI.Texture.html">PIXI.Texture</a></span> </li> </ul> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#key">Phaser.Component.Core#key</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-196">line 196</a> </dt> </dl> </dd> <dt> <h4 class="name " id="left"><span class="type-signature">&lt;readonly> </span>left<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>The left coordinate of the Game Object. This is the same as <code>x - offsetX</code>.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Bounds.html#left">Phaser.Component.Bounds#left</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Bounds.js.html">gameobjects/components/Bounds.js</a>, <a href="src_gameobjects_components_Bounds.js.html#sunlight-1-line-59">line 59</a> </dt> </dl> </dd> <dt> <h4 class="name " id="lifespan"><span class="type-signature"></span>lifespan<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>The lifespan allows you to give a Game Object a lifespan in milliseconds.</p> <p>Once the Game Object is 'born' you can set this to a positive value.</p> <p>It is automatically decremented by the millisecond equivalent of <code>game.time.physicsElapsed</code> each frame. When it reaches zero it will call the <code>kill</code> method.</p> <p>Very handy for particles, bullets, collectibles, or any other short-lived entity.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.LifeSpan.html#lifespan">Phaser.Component.LifeSpan#lifespan</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_LifeSpan.js.html">gameobjects/components/LifeSpan.js</a>, <a href="src_gameobjects_components_LifeSpan.js.html#sunlight-1-line-65">line 65</a> </dt> </dl> </dd> <dt> <h4 class="name " id="mask"><span class="type-signature"></span>mask<span class="type-signature"> :<a href="PIXI.Graphics.html">PIXI.Graphics</a></span></h4> </dt> <dd> <div class="description"> <p>Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. In PIXI a regular mask must be a PIXI.Graphics object. This allows for much faster masking in canvas as it utilises shape clipping. To remove a mask, set this property to null.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#mask">PIXI.DisplayObject#mask</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-282">line 282</a> </dt> </dl> </dd> <dt> <h4 class="name " id="name"><span class="type-signature"></span>name<span class="type-signature"> :string</span></h4> </dt> <dd> <div class="description"> <p>A user defined name given to this Game Object. This value isn't ever used internally by Phaser, it is meant as a game level property.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#name">Phaser.Component.Core#name</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-153">line 153</a> </dt> </dl> </dd> <dt> <h4 class="name " id="offsetX"><span class="type-signature">&lt;readonly> </span>offsetX<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>The amount the Game Object is visually offset from its x coordinate. This is the same as <code>width * anchor.x</code>. It will only be &gt; 0 if anchor.x is not equal to zero.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Bounds.html#offsetX">Phaser.Component.Bounds#offsetX</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Bounds.js.html">gameobjects/components/Bounds.js</a>, <a href="src_gameobjects_components_Bounds.js.html#sunlight-1-line-24">line 24</a> </dt> </dl> </dd> <dt> <h4 class="name " id="offsetY"><span class="type-signature">&lt;readonly> </span>offsetY<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>The amount the Game Object is visually offset from its y coordinate. This is the same as <code>height * anchor.y</code>. It will only be &gt; 0 if anchor.y is not equal to zero.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Bounds.html#offsetY">Phaser.Component.Bounds#offsetY</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Bounds.js.html">gameobjects/components/Bounds.js</a>, <a href="src_gameobjects_components_Bounds.js.html#sunlight-1-line-42">line 42</a> </dt> </dl> </dd> <dt> <h4 class="name " id="outOfBoundsKill"><span class="type-signature"></span>outOfBoundsKill<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>If this and the <code>checkWorldBounds</code> property are both set to <code>true</code> then the <code>kill</code> method is called as soon as <code>inWorld</code> returns false.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.InWorld.html#outOfBoundsKill">Phaser.Component.InWorld#outOfBoundsKill</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_InWorld.js.html">gameobjects/components/InWorld.js</a>, <a href="src_gameobjects_components_InWorld.js.html#sunlight-1-line-106">line 106</a> </dt> </dl> </dd> <dt> <h4 class="name " id="outOfCameraBoundsKill"><span class="type-signature"></span>outOfCameraBoundsKill<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>If this and the <code>autoCull</code> property are both set to <code>true</code>, then the <code>kill</code> method is called as soon as the Game Object leaves the camera bounds.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.InWorld.html#outOfCameraBoundsKill">Phaser.Component.InWorld#outOfCameraBoundsKill</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_InWorld.js.html">gameobjects/components/InWorld.js</a>, <a href="src_gameobjects_components_InWorld.js.html#sunlight-1-line-115">line 115</a> </dt> </dl> </dd> <dt> <h4 class="name " id="parent"><span class="type-signature">&lt;readonly> </span>parent<span class="type-signature"> :<a href="PIXI.DisplayObjectContainer.html">PIXI.DisplayObjectContainer</a></span></h4> </dt> <dd> <div class="description"> <p>[read-only] The display object container that contains this display object.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#parent">PIXI.DisplayObject#parent</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-79">line 79</a> </dt> </dl> </dd> <dt> <h4 class="name " id="pendingDestroy"><span class="type-signature"></span>pendingDestroy<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>A Game Object is that is pendingDestroy is flagged to have its destroy method called on the next logic update. You can set it directly to allow you to flag an object to be destroyed on its next update.</p> <p>This is extremely useful if you wish to destroy an object from within one of its own callbacks such as with Buttons or other Input events.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#pendingDestroy">Phaser.Component.Core#pendingDestroy</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-252">line 252</a> </dt> </dl> </dd> <dt> <h4 class="name " id="pivot"><span class="type-signature"></span>pivot<span class="type-signature"> :Point</span></h4> </dt> <dd> <div class="description"> <p>The pivot point of the displayObject that it rotates around</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#pivot">PIXI.DisplayObject#pivot</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-30">line 30</a> </dt> </dl> </dd> <dt> <h4 class="name " id="position"><span class="type-signature"></span>position<span class="type-signature"> :Point</span></h4> </dt> <dd> <div class="description"> <p>The coordinate of the object relative to the local coordinates of the parent.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#position">PIXI.DisplayObject#position</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-14">line 14</a> </dt> </dl> </dd> <dt> <h4 class="name " id="previousPosition"><span class="type-signature">&lt;readonly> </span>previousPosition<span class="type-signature"> :<a href="Phaser.Point.html">Phaser.Point</a></span></h4> </dt> <dd> <div class="description"> <p>The position the Game Object was located in the previous frame.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#previousPosition">Phaser.Component.Core#previousPosition</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-218">line 218</a> </dt> </dl> </dd> <dt> <h4 class="name " id="previousRotation"><span class="type-signature">&lt;readonly> </span>previousRotation<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>The rotation the Game Object was in set to in the previous frame. Value is in radians.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#previousRotation">Phaser.Component.Core#previousRotation</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-225">line 225</a> </dt> </dl> </dd> <dt> <h4 class="name " id="renderable"><span class="type-signature"></span>renderable<span class="type-signature"> :Boolean</span></h4> </dt> <dd> <div class="description"> <p>Can this object be rendered</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#renderable">PIXI.DisplayObject#renderable</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-71">line 71</a> </dt> </dl> </dd> <dt> <h4 class="name " id="renderOrderID"><span class="type-signature">&lt;readonly> </span>renderOrderID<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>The render order ID is used internally by the renderer and Input Manager and should not be modified. This property is mostly used internally by the renderers, but is exposed for the use of plugins.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#renderOrderID">Phaser.Component.Core#renderOrderID</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-233">line 233</a> </dt> </dl> </dd> <dt> <h4 class="name " id="right"><span class="type-signature">&lt;readonly> </span>right<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>The right coordinate of the Game Object. This is the same as <code>x + width - offsetX</code>.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Bounds.html#right">Phaser.Component.Bounds#right</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Bounds.js.html">gameobjects/components/Bounds.js</a>, <a href="src_gameobjects_components_Bounds.js.html#sunlight-1-line-76">line 76</a> </dt> </dl> </dd> <dt> <h4 class="name " id="rotation"><span class="type-signature"></span>rotation<span class="type-signature"> :Number</span></h4> </dt> <dd> <div class="description"> <p>The rotation of the object in radians.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#rotation">PIXI.DisplayObject#rotation</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-38">line 38</a> </dt> </dl> </dd> <dt> <h4 class="name " id="scale"><span class="type-signature"></span>scale<span class="type-signature"> :Point</span></h4> </dt> <dd> <div class="description"> <p>The scale factor of the object.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#scale">PIXI.DisplayObject#scale</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-22">line 22</a> </dt> </dl> </dd> <dt> <h4 class="name " id="scaleMax"><span class="type-signature"></span>scaleMax<span class="type-signature"> :<a href="Phaser.Point.html">Phaser.Point</a></span></h4> </dt> <dd> <div class="description"> <p>The maximum scale this Game Object will scale up to. </p> <p>It allows you to prevent a parent from scaling this Game Object higher than the given value.</p> <p>Set it to <code>null</code> to remove the limit.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.ScaleMinMax.html#scaleMax">Phaser.Component.ScaleMinMax#scaleMax</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_ScaleMinMax.js.html">gameobjects/components/ScaleMinMax.js</a>, <a href="src_gameobjects_components_ScaleMinMax.js.html#sunlight-1-line-46">line 46</a> </dt> </dl> </dd> <dt> <h4 class="name " id="scaleMin"><span class="type-signature"></span>scaleMin<span class="type-signature"> :<a href="Phaser.Point.html">Phaser.Point</a></span></h4> </dt> <dd> <div class="description"> <p>The minimum scale this Game Object will scale down to.</p> <p>It allows you to prevent a parent from scaling this Game Object lower than the given value.</p> <p>Set it to <code>null</code> to remove the limit.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.ScaleMinMax.html#scaleMin">Phaser.Component.ScaleMinMax#scaleMin</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_ScaleMinMax.js.html">gameobjects/components/ScaleMinMax.js</a>, <a href="src_gameobjects_components_ScaleMinMax.js.html#sunlight-1-line-36">line 36</a> </dt> </dl> </dd> <dt> <h4 class="name " id="segments"><span class="type-signature"></span>segments<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>The segments that make up the rope body as an array of Phaser.Rectangles</p> </div> <dl class="details"> <h5 class="subsection-title">Properties:</h5> <dl> <table class="props table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>updateAnimation</code></td> <td class="type"> <span class="param-type">Array.&lt;Phaser.Rectangles></span> </td> <td class="description last"><p>Returns an array of Phaser.Rectangles that represent the segments of the given rope</p></td> </tr> </tbody> </table> </dl> <dt class="tag-source">Source - <a href="src_gameobjects_Rope.js.html">gameobjects/Rope.js</a>, <a href="src_gameobjects_Rope.js.html#sunlight-1-line-175">line 175</a> </dt> </dl> </dd> <dt> <h4 class="name " id="smoothed"><span class="type-signature"></span>smoothed<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>Enable or disable texture smoothing for this Game Object.</p> <p>It only takes effect if the Game Object is using an image based texture.</p> <p>Smoothing is enabled by default.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Smoothed.html#smoothed">Phaser.Component.Smoothed#smoothed</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Smoothed.js.html">gameobjects/components/Smoothed.js</a>, <a href="src_gameobjects_components_Smoothed.js.html#sunlight-1-line-25">line 25</a> </dt> </dl> </dd> <dt> <h4 class="name " id="stage"><span class="type-signature">&lt;readonly> </span>stage<span class="type-signature"> :Stage</span></h4> </dt> <dd> <div class="description"> <p>[read-only] The stage the display object is connected to, or undefined if it is not connected to the stage.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#stage">PIXI.DisplayObject#stage</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-88">line 88</a> </dt> </dl> </dd> <dt> <h4 class="name " id="texture"><span class="type-signature"></span>texture<span class="type-signature"> :<a href="PIXI.Texture.html">PIXI.Texture</a></span></h4> </dt> <dd> <div class="description"> <p>The texture of the strip</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.Strip.html#texture">PIXI.Strip#texture</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_extras_Strip.js.html">pixi/extras/Strip.js</a>, <a href="src_pixi_extras_Strip.js.html#sunlight-1-line-20">line 20</a> </dt> </dl> </dd> <dt> <h4 class="name " id="top"><span class="type-signature">&lt;readonly> </span>top<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>The y coordinate of the Game Object. This is the same as <code>y - offsetY</code>.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Bounds.html#top">Phaser.Component.Bounds#top</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Bounds.js.html">gameobjects/components/Bounds.js</a>, <a href="src_gameobjects_components_Bounds.js.html#sunlight-1-line-93">line 93</a> </dt> </dl> </dd> <dt> <h4 class="name " id="transformCallback"><span class="type-signature"></span>transformCallback<span class="type-signature"> :function</span></h4> </dt> <dd> <div class="description"> <p>The callback that will apply any scale limiting to the worldTransform.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.ScaleMinMax.html#transformCallback">Phaser.Component.ScaleMinMax#transformCallback</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_ScaleMinMax.js.html">gameobjects/components/ScaleMinMax.js</a>, <a href="src_gameobjects_components_ScaleMinMax.js.html#sunlight-1-line-20">line 20</a> </dt> </dl> </dd> <dt> <h4 class="name " id="transformCallbackContext"><span class="type-signature"></span>transformCallbackContext<span class="type-signature"> :object</span></h4> </dt> <dd> <div class="description"> <p>The context under which <code>transformCallback</code> is called.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.ScaleMinMax.html#transformCallbackContext">Phaser.Component.ScaleMinMax#transformCallbackContext</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_ScaleMinMax.js.html">gameobjects/components/ScaleMinMax.js</a>, <a href="src_gameobjects_components_ScaleMinMax.js.html#sunlight-1-line-26">line 26</a> </dt> </dl> </dd> <dt> <h4 class="name " id="type"><span class="type-signature">&lt;readonly> </span>type<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>The const type of this object.</p> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_gameobjects_Rope.js.html">gameobjects/Rope.js</a>, <a href="src_gameobjects_Rope.js.html#sunlight-1-line-57">line 57</a> </dt> </dl> </dd> <dt> <h4 class="name " id="updateAnimation"><span class="type-signature"></span>updateAnimation<span class="type-signature"> :function</span></h4> </dt> <dd> <div class="description"> <p>A Rope will call its updateAnimation function on each update loop if it has one. Set to a function if you'd like the rope to animate during the update phase. Set to false or null to remove it.</p> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_gameobjects_Rope.js.html">gameobjects/Rope.js</a>, <a href="src_gameobjects_Rope.js.html#sunlight-1-line-144">line 144</a> </dt> </dl> </dd> <dt> <h4 class="name " id="visible"><span class="type-signature"></span>visible<span class="type-signature"> :Boolean</span></h4> </dt> <dd> <div class="description"> <p>The visibility of the object.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#visible">PIXI.DisplayObject#visible</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-54">line 54</a> </dt> </dl> </dd> <dt> <h4 class="name " id="width"><span class="type-signature"></span>width<span class="type-signature"> :Number</span></h4> </dt> <dd> <div class="description"> <p>The width of the displayObjectContainer, setting this will actually modify the scale to achieve the value set</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#width">PIXI.DisplayObjectContainer#width</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-32">line 32</a> </dt> </dl> </dd> <dt> <h4 class="name " id="world"><span class="type-signature"></span>world<span class="type-signature"> :<a href="Phaser.Point.html">Phaser.Point</a></span></h4> </dt> <dd> <div class="description"> <p>The world coordinates of this Game Object in pixels. Depending on where in the display list this Game Object is placed this value can differ from <code>position</code>, which contains the x/y coordinates relative to the Game Objects parent.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#world">Phaser.Component.Core#world</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-204">line 204</a> </dt> </dl> </dd> <dt> <h4 class="name " id="worldAlpha"><span class="type-signature">&lt;readonly> </span>worldAlpha<span class="type-signature"> :Number</span></h4> </dt> <dd> <div class="description"> <p>[read-only] The multiplied alpha of the displayObject</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#worldAlpha">PIXI.DisplayObject#worldAlpha</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-97">line 97</a> </dt> </dl> </dd> <dt> <h4 class="name " id="worldPosition"><span class="type-signature">&lt;readonly> </span>worldPosition<span class="type-signature"> :Point</span></h4> </dt> <dd> <div class="description"> <p>The position of the Display Object based on the world transform. This value is updated at the end of updateTransform and takes all parent transforms into account.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#worldPosition">PIXI.DisplayObject#worldPosition</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-116">line 116</a> </dt> </dl> </dd> <dt> <h4 class="name " id="worldRotation"><span class="type-signature">&lt;readonly> </span>worldRotation<span class="type-signature"> :Number</span></h4> </dt> <dd> <div class="description"> <p>The rotation of the Display Object, in radians, based on the world transform. This value is updated at the end of updateTransform and takes all parent transforms into account.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#worldRotation">PIXI.DisplayObject#worldRotation</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-136">line 136</a> </dt> </dl> </dd> <dt> <h4 class="name " id="worldScale"><span class="type-signature">&lt;readonly> </span>worldScale<span class="type-signature"> :Point</span></h4> </dt> <dd> <div class="description"> <p>The scale of the Display Object based on the world transform. This value is updated at the end of updateTransform and takes all parent transforms into account.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#worldScale">PIXI.DisplayObject#worldScale</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-126">line 126</a> </dt> </dl> </dd> <dt> <h4 class="name " id="worldVisible"><span class="type-signature"></span>worldVisible<span class="type-signature"> :Boolean</span></h4> </dt> <dd> <div class="description"> <p>[read-only] Indicates if the sprite is globally visible.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#worldVisible">PIXI.DisplayObject#worldVisible</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-258">line 258</a> </dt> </dl> </dd> <dt> <h4 class="name " id="x"><span class="type-signature"></span>x<span class="type-signature"> :Number</span></h4> </dt> <dd> <div class="description"> <p>The position of the displayObject on the x axis relative to the local coordinates of the parent.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#x">PIXI.DisplayObject#x</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-723">line 723</a> </dt> </dl> </dd> <dt> <h4 class="name " id="y"><span class="type-signature"></span>y<span class="type-signature"> :Number</span></h4> </dt> <dd> <div class="description"> <p>The position of the displayObject on the y axis relative to the local coordinates of the parent.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#y">PIXI.DisplayObject#y</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-741">line 741</a> </dt> </dl> </dd> <dt> <h4 class="name " id="z"><span class="type-signature">&lt;readonly> </span>z<span class="type-signature"> :number</span></h4> </dt> <dd> <div class="description"> <p>The z depth of this Game Object within its parent Group. No two objects in a Group can have the same z value. This value is adjusted automatically whenever the Group hierarchy changes. If you wish to re-order the layering of a Game Object then see methods like Group.moveUp or Group.bringToTop.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#z">Phaser.Component.Core#z</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-170">line 170</a> </dt> </dl> </dd> </dl> <h3 class="subsection-title">Methods</h3> <dl> <dt> <h4 class="name " id="addChild"><span class="type-signature"></span>addChild<span class="signature">(child)</span><span class="type-signature"> &rarr; {<a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a>}</span></h4> </dt> <dd> <div class="description"> <p>Adds a child to the container.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>child</code></td> <td class="type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> </td> <td class="description last"><p>The DisplayObject to add to the container</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> - </div> <div class="returns-desc param-desc"> <p>The child that was added.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#addChild">PIXI.DisplayObjectContainer#addChild</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-91">line 91</a> </dt> </dl> </dd> <dt> <h4 class="name " id="addChildAt"><span class="type-signature"></span>addChildAt<span class="signature">(child, index)</span><span class="type-signature"> &rarr; {<a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a>}</span></h4> </dt> <dd> <div class="description"> <p>Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>child</code></td> <td class="type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> </td> <td class="description last"><p>The child to add</p></td> </tr> <tr> <td class="name"><code>index</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>The index to place the child in</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> - </div> <div class="returns-desc param-desc"> <p>The child that was added.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#addChildAt">PIXI.DisplayObjectContainer#addChildAt</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-103">line 103</a> </dt> </dl> </dd> <dt> <h4 class="name " id="bringToTop"><span class="type-signature"></span>bringToTop<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a>}</span></h4> </dt> <dd> <div class="description"> <p>Brings this Game Object to the top of its parents display list. Visually this means it will render over the top of any old child in the same Group.</p> <p>If this Game Object hasn't been added to a custom Group then this method will bring it to the top of the Game World, because the World is the root Group from which all Game Objects descend.</p> </div> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> - </div> <div class="returns-desc param-desc"> <p>This instance.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.BringToTop.html#bringToTop">Phaser.Component.BringToTop#bringToTop</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_BringToTop.js.html">gameobjects/components/BringToTop.js</a>, <a href="src_gameobjects_components_BringToTop.js.html#sunlight-1-line-24">line 24</a> </dt> </dl> </dd> <dt> <h4 class="name " id="crop"><span class="type-signature"></span>crop<span class="signature">(rect, <span class="optional">copy</span>)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Crop allows you to crop the texture being used to display this Game Object. Setting a crop rectangle modifies the core texture frame. The Game Object width and height properties will be adjusted accordingly.</p> <p>Cropping takes place from the top-left and can be modified in real-time either by providing an updated rectangle object to this method, or by modifying <code>cropRect</code> property directly and then calling <code>updateCrop</code>.</p> <p>The rectangle object given to this method can be either a <code>Phaser.Rectangle</code> or any other object so long as it has public <code>x</code>, <code>y</code>, <code>width</code>, <code>height</code>, <code>right</code> and <code>bottom</code> properties.</p> <p>A reference to the rectangle is stored in <code>cropRect</code> unless the <code>copy</code> parameter is <code>true</code>, in which case the values are duplicated to a local object.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>rect</code></td> <td class="type"> <span class="param-type"><a href="Phaser.Rectangle.html">Phaser.Rectangle</a></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The Rectangle used during cropping. Pass null or no parameters to clear a previously set crop rectangle.</p></td> </tr> <tr> <td class="name"><code>copy</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> false </td> <td class="description last"><p>If false <code>cropRect</code> will be stored as a reference to the given rect. If true it will copy the rect values into a local Phaser Rectangle object stored in cropRect.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Crop.html#crop">Phaser.Component.Crop#crop</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Crop.js.html">gameobjects/components/Crop.js</a>, <a href="src_gameobjects_components_Crop.js.html#sunlight-1-line-49">line 49</a> </dt> </dl> </dd> <dt> <h4 class="name " id="destroy"><span class="type-signature"></span>destroy<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Destroy this DisplayObject. Removes all references to transformCallbacks, its parent, the stage, filters, bounds, mask and cached Sprites.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#destroy">PIXI.DisplayObject#destroy</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-223">line 223</a> </dt> </dl> </dd> <dt> <h4 class="name " id="generateTexture"><span class="type-signature"></span>generateTexture<span class="signature">(resolution, scaleMode, renderer)</span><span class="type-signature"> &rarr; {<a href="PIXI.Texture.html">PIXI.Texture</a>}</span></h4> </dt> <dd> <div class="description"> <p>Useful function that returns a texture of the displayObject object that can then be used to create sprites This can be quite useful if your displayObject is static / complicated and needs to be reused multiple times.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>resolution</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>The resolution of the texture being generated</p></td> </tr> <tr> <td class="name"><code>scaleMode</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>See {{#crossLink &quot;PIXI/scaleModes:property&quot;}}PIXI.scaleModes{{/crossLink}} for possible values</p></td> </tr> <tr> <td class="name"><code>renderer</code></td> <td class="type"> <span class="param-type"><a href="PIXI.CanvasRenderer.html">PIXI.CanvasRenderer</a></span> | <span class="param-type"><a href="PIXI.WebGLRenderer.html">PIXI.WebGLRenderer</a></span> </td> <td class="description last"><p>The renderer used to generate the texture.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="PIXI.Texture.html">PIXI.Texture</a></span> - </div> <div class="returns-desc param-desc"> <p>a texture of the graphics object</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#generateTexture">PIXI.DisplayObject#generateTexture</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-542">line 542</a> </dt> </dl> </dd> <dt> <h4 class="name " id="getBounds"><span class="type-signature"></span>getBounds<span class="signature">(matrix)</span><span class="type-signature"> &rarr; {Rectangle}</span></h4> </dt> <dd> <div class="description"> <p>Returns the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>matrix</code></td> <td class="type"> <span class="param-type">Matrix</span> </td> <td class="description last"><p>the transformation matrix of the sprite</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">Rectangle</span> - </div> <div class="returns-desc param-desc"> <p>the framing rectangle</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.Strip.html#getBounds">PIXI.Strip#getBounds</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_extras_Strip.js.html">pixi/extras/Strip.js</a>, <a href="src_pixi_extras_Strip.js.html#sunlight-1-line-402">line 402</a> </dt> </dl> </dd> <dt> <h4 class="name " id="getChildAt"><span class="type-signature"></span>getChildAt<span class="signature">(index)</span><span class="type-signature"> &rarr; {<a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a>}</span></h4> </dt> <dd> <div class="description"> <p>Returns the child at the specified index</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>index</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>The index to get the child from</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> - </div> <div class="returns-desc param-desc"> <p>The child at the given index, if any.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#getChildAt">PIXI.DisplayObjectContainer#getChildAt</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-194">line 194</a> </dt> </dl> </dd> <dt> <h4 class="name " id="getChildIndex"><span class="type-signature"></span>getChildIndex<span class="signature">(child)</span><span class="type-signature"> &rarr; {Number}</span></h4> </dt> <dd> <div class="description"> <p>Returns the index position of a child DisplayObject instance</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>child</code></td> <td class="type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> </td> <td class="description last"><p>The DisplayObject instance to identify</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">Number</span> - </div> <div class="returns-desc param-desc"> <p>The index position of the child display object to identify</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#getChildIndex">PIXI.DisplayObjectContainer#getChildIndex</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-159">line 159</a> </dt> </dl> </dd> <dt> <h4 class="name " id="getLocalBounds"><span class="type-signature"></span>getLocalBounds<span class="signature">()</span><span class="type-signature"> &rarr; {Rectangle}</span></h4> </dt> <dd> <div class="description"> <p>Retrieves the non-global local bounds of the displayObjectContainer as a rectangle. The calculation takes all visible children into consideration.</p> </div> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">Rectangle</span> - </div> <div class="returns-desc param-desc"> <p>The rectangular bounding area</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#getLocalBounds">PIXI.DisplayObjectContainer#getLocalBounds</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-367">line 367</a> </dt> </dl> </dd> <dt> <h4 class="name " id="kill"><span class="type-signature"></span>kill<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a>}</span></h4> </dt> <dd> <div class="description"> <p>Kills a Game Object. A killed Game Object has its <code>alive</code>, <code>exists</code> and <code>visible</code> properties all set to false.</p> <p>It will dispatch the <code>onKilled</code> event. You can listen to <code>events.onKilled</code> for the signal.</p> <p>Note that killing a Game Object is a way for you to quickly recycle it in an object pool, it doesn't destroy the object or free it up from memory.</p> <p>If you don't need this Game Object any more you should call <code>destroy</code> instead.</p> </div> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> - </div> <div class="returns-desc param-desc"> <p>This instance.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.LifeSpan.html#kill">Phaser.Component.LifeSpan#kill</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_LifeSpan.js.html">gameobjects/components/LifeSpan.js</a>, <a href="src_gameobjects_components_LifeSpan.js.html#sunlight-1-line-113">line 113</a> </dt> </dl> </dd> <dt> <h4 class="name " id="loadTexture"><span class="type-signature"></span>loadTexture<span class="signature">(key, <span class="optional">frame</span>, <span class="optional">stopAnimation</span>)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Changes the base texture the Game Object is using. The old texture is removed and the new one is referenced or fetched from the Cache.</p> <p>If your Game Object is using a frame from a texture atlas and you just wish to change to another frame, then see the <code>frame</code> or <code>frameName</code> properties instead.</p> <p>You should only use <code>loadTexture</code> if you want to replace the base texture entirely.</p> <p>Calling this method causes a WebGL texture update, so use sparingly or in low-intensity portions of your game, or if you know the new texture is already on the GPU.</p> <p>You can use the new const <code>Phaser.PENDING_ATLAS</code> as the texture key for any sprite. Doing this then sets the key to be the <code>frame</code> argument (the frame is set to zero). </p> <p>This allows you to create sprites using <code>load.image</code> during development, and then change them to use a Texture Atlas later in development by simply searching your code for 'PENDING_ATLAS' and swapping it to be the key of the atlas data.</p> <p>Note: You cannot use a RenderTexture as a texture for a TileSprite.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>key</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type"><a href="Phaser.RenderTexture.html">Phaser.RenderTexture</a></span> | <span class="param-type"><a href="Phaser.BitmapData.html">Phaser.BitmapData</a></span> | <span class="param-type"><a href="Phaser.Video.html">Phaser.Video</a></span> | <span class="param-type"><a href="PIXI.Texture.html">PIXI.Texture</a></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache Image entry, or an instance of a RenderTexture, BitmapData, Video or PIXI.Texture.</p></td> </tr> <tr> <td class="name"><code>frame</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.</p></td> </tr> <tr> <td class="name"><code>stopAnimation</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> true </td> <td class="description last"><p>If an animation is already playing on this Sprite you can choose to stop it or let it carry on playing.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.LoadTexture.html#loadTexture">Phaser.Component.LoadTexture#loadTexture</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_LoadTexture.js.html">gameobjects/components/LoadTexture.js</a>, <a href="src_gameobjects_components_LoadTexture.js.html#sunlight-1-line-51">line 51</a> </dt> </dl> </dd> <dt> <h4 class="name " id="moveDown"><span class="type-signature"></span>moveDown<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a>}</span></h4> </dt> <dd> <div class="description"> <p>Moves this Game Object down one place in its parents display list. This call has no effect if the Game Object is already at the bottom of the display list.</p> <p>If this Game Object hasn't been added to a custom Group then this method will move it one object down within the Game World, because the World is the root Group from which all Game Objects descend.</p> </div> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> - </div> <div class="returns-desc param-desc"> <p>This instance.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.BringToTop.html#moveDown">Phaser.Component.BringToTop#moveDown</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_BringToTop.js.html">gameobjects/components/BringToTop.js</a>, <a href="src_gameobjects_components_BringToTop.js.html#sunlight-1-line-87">line 87</a> </dt> </dl> </dd> <dt> <h4 class="name " id="moveUp"><span class="type-signature"></span>moveUp<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a>}</span></h4> </dt> <dd> <div class="description"> <p>Moves this Game Object up one place in its parents display list. This call has no effect if the Game Object is already at the top of the display list.</p> <p>If this Game Object hasn't been added to a custom Group then this method will move it one object up within the Game World, because the World is the root Group from which all Game Objects descend.</p> </div> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> - </div> <div class="returns-desc param-desc"> <p>This instance.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.BringToTop.html#moveUp">Phaser.Component.BringToTop#moveUp</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_BringToTop.js.html">gameobjects/components/BringToTop.js</a>, <a href="src_gameobjects_components_BringToTop.js.html#sunlight-1-line-66">line 66</a> </dt> </dl> </dd> <dt> <h4 class="name " id="overlap"><span class="type-signature"></span>overlap<span class="signature">(displayObject)</span><span class="type-signature"> &rarr; {boolean}</span></h4> </dt> <dd> <div class="description"> <p>Checks to see if the bounds of this Game Object overlaps with the bounds of the given Display Object, which can be a Sprite, Image, TileSprite or anything that extends those such as Button or provides a <code>getBounds</code> method and result.</p> <p>This check ignores the <code>hitArea</code> property if set and runs a <code>getBounds</code> comparison on both objects to determine the result.</p> <p>Therefore it's relatively expensive to use in large quantities, i.e. with lots of Sprites at a high frequency. It should be fine for low-volume testing where physics isn't required.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>displayObject</code></td> <td class="type"> <span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span> | <span class="param-type"><a href="Phaser.Image.html">Phaser.Image</a></span> | <span class="param-type"><a href="Phaser.TileSprite.html">Phaser.TileSprite</a></span> | <span class="param-type"><a href="Phaser.Button.html">Phaser.Button</a></span> | <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> </td> <td class="description last"><p>The display object to check against.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">boolean</span> - </div> <div class="returns-desc param-desc"> <p>True if the bounds of this Game Object intersects at any point with the bounds of the given display object.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Overlap.html#overlap">Phaser.Component.Overlap#overlap</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Overlap.js.html">gameobjects/components/Overlap.js</a>, <a href="src_gameobjects_components_Overlap.js.html#sunlight-1-line-29">line 29</a> </dt> </dl> </dd> <dt> <h4 class="name " id="play"><span class="type-signature"></span>play<span class="signature">(name, <span class="optional">frameRate</span>, <span class="optional">loop</span>, <span class="optional">killOnComplete</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Animation.html">Phaser.Animation</a>}</span></h4> </dt> <dd> <div class="description"> <p>Plays an Animation.</p> <p>The animation should have previously been created via <code>animations.add</code>.</p> <p>If the animation is already playing calling this again won't do anything. If you need to reset an already running animation do so directly on the Animation object itself or via <code>AnimationManager.stop</code>.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The name of the animation to be played, e.g. &quot;fire&quot;, &quot;walk&quot;, &quot;jump&quot;. Must have been previously created via 'AnimationManager.add'.</p></td> </tr> <tr> <td class="name"><code>frameRate</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> null </td> <td class="description last"><p>The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used.</p></td> </tr> <tr> <td class="name"><code>loop</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> false </td> <td class="description last"><p>Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.</p></td> </tr> <tr> <td class="name"><code>killOnComplete</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> false </td> <td class="description last"><p>If set to true when the animation completes (only happens if loop=false) the parent Sprite will be killed.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="Phaser.Animation.html">Phaser.Animation</a></span> - </div> <div class="returns-desc param-desc"> <p>A reference to playing Animation.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Animation.html#play">Phaser.Component.Animation#play</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Animation.js.html">gameobjects/components/Animation.js</a>, <a href="src_gameobjects_components_Animation.js.html#sunlight-1-line-31">line 31</a> </dt> </dl> </dd> <dt> <h4 class="name " id="postUpdate"><span class="type-signature">&lt;internal> </span>postUpdate<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Internal method called by the World postUpdate cycle.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Core.html#postUpdate">Phaser.Component.Core#postUpdate</a> </li></dd> <dt class="important tag-deprecated">Internal:</dt> <dd class="tag-deprecated"><ul> <li>This member is <em>internal (protected)</em> and may be modified or removed in the future.</li> </ul></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Core.js.html">gameobjects/components/Core.js</a>, <a href="src_gameobjects_components_Core.js.html#sunlight-1-line-331">line 331</a> </dt> </dl> </dd> <dt> <h4 class="name " id="preUpdate"><span class="type-signature"></span>preUpdate<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Automatically called by World.preUpdate.</p> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_gameobjects_Rope.js.html">gameobjects/Rope.js</a>, <a href="src_gameobjects_Rope.js.html#sunlight-1-line-93">line 93</a> </dt> </dl> </dd> <dt> <h4 class="name " id="removeChild"><span class="type-signature"></span>removeChild<span class="signature">(child)</span><span class="type-signature"> &rarr; {<a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a>}</span></h4> </dt> <dd> <div class="description"> <p>Removes a child from the container.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>child</code></td> <td class="type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> </td> <td class="description last"><p>The DisplayObject to remove</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> - </div> <div class="returns-desc param-desc"> <p>The child that was removed.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#removeChild">PIXI.DisplayObjectContainer#removeChild</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-211">line 211</a> </dt> </dl> </dd> <dt> <h4 class="name " id="removeChildAt"><span class="type-signature"></span>removeChildAt<span class="signature">(index)</span><span class="type-signature"> &rarr; {<a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a>}</span></h4> </dt> <dd> <div class="description"> <p>Removes a child from the specified index position.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>index</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>The index to get the child from</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> - </div> <div class="returns-desc param-desc"> <p>The child that was removed.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#removeChildAt">PIXI.DisplayObjectContainer#removeChildAt</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-226">line 226</a> </dt> </dl> </dd> <dt> <h4 class="name " id="removeChildren"><span class="type-signature"></span>removeChildren<span class="signature">(beginIndex, endIndex)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Removes all children from this container that are within the begin and end indexes.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>beginIndex</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>The beginning position. Default value is 0.</p></td> </tr> <tr> <td class="name"><code>endIndex</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>The ending position. Default value is size of the container.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#removeChildren">PIXI.DisplayObjectContainer#removeChildren</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-244">line 244</a> </dt> </dl> </dd> <dt> <h4 class="name " id="removeStageReference"><span class="type-signature"></span>removeStageReference<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Removes the current stage reference from the container and all of its children.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#removeStageReference">PIXI.DisplayObjectContainer#removeStageReference</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-407">line 407</a> </dt> </dl> </dd> <dt> <h4 class="name " id="reset"><span class="type-signature"></span>reset<span class="signature">(x, y)</span><span class="type-signature"> &rarr; {<a href="Phaser.Rope.html">Phaser.Rope</a>}</span></h4> </dt> <dd> <div class="description"> <p>Resets the Rope. This places the Rope at the given x/y world coordinates and then sets alive, exists, visible and renderable all to true. Also resets the outOfBounds state. If the Rope has a physics body that too is reset.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>x</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The x coordinate (in world space) to position the Sprite at.</p></td> </tr> <tr> <td class="name"><code>y</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The y coordinate (in world space) to position the Sprite at.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="Phaser.Rope.html">Phaser.Rope</a></span> - </div> <div class="returns-desc param-desc"> <p>This instance.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_gameobjects_Rope.js.html">gameobjects/Rope.js</a>, <a href="src_gameobjects_Rope.js.html#sunlight-1-line-125">line 125</a> </dt> </dl> </dd> <dt> <h4 class="name " id="resetFrame"><span class="type-signature"></span>resetFrame<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Resets the texture frame dimensions that the Game Object uses for rendering.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.LoadTexture.html#resetFrame">Phaser.Component.LoadTexture#resetFrame</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_LoadTexture.js.html">gameobjects/components/LoadTexture.js</a>, <a href="src_gameobjects_components_LoadTexture.js.html#sunlight-1-line-232">line 232</a> </dt> </dl> </dd> <dt> <h4 class="name " id="resizeFrame"><span class="type-signature"></span>resizeFrame<span class="signature">(parent, width, height)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Resizes the Frame dimensions that the Game Object uses for rendering.</p> <p>You shouldn't normally need to ever call this, but in the case of special texture types such as Video or BitmapData it can be useful to adjust the dimensions directly in this way.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>parent</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"><p>The parent texture object that caused the resize, i.e. a Phaser.Video object.</p></td> </tr> <tr> <td class="name"><code>width</code></td> <td class="type"> <span class="param-type">integer</span> </td> <td class="description last"><p>The new width of the texture.</p></td> </tr> <tr> <td class="name"><code>height</code></td> <td class="type"> <span class="param-type">integer</span> </td> <td class="description last"><p>The new height of the texture.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.LoadTexture.html#resizeFrame">Phaser.Component.LoadTexture#resizeFrame</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_LoadTexture.js.html">gameobjects/components/LoadTexture.js</a>, <a href="src_gameobjects_components_LoadTexture.js.html#sunlight-1-line-220">line 220</a> </dt> </dl> </dd> <dt> <h4 class="name " id="revive"><span class="type-signature"></span>revive<span class="signature">(<span class="optional">health</span>)</span><span class="type-signature"> &rarr; {<a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a>}</span></h4> </dt> <dd> <div class="description"> <p>Brings a 'dead' Game Object back to life, optionally resetting its health value in the process.</p> <p>A resurrected Game Object has its <code>alive</code>, <code>exists</code> and <code>visible</code> properties all set to true.</p> <p>It will dispatch the <code>onRevived</code> event. Listen to <code>events.onRevived</code> for the signal.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>health</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 100 </td> <td class="description last"><p>The health to give the Game Object. Only set if the GameObject has the Health component.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> - </div> <div class="returns-desc param-desc"> <p>This instance.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.LifeSpan.html#revive">Phaser.Component.LifeSpan#revive</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_LifeSpan.js.html">gameobjects/components/LifeSpan.js</a>, <a href="src_gameobjects_components_LifeSpan.js.html#sunlight-1-line-78">line 78</a> </dt> </dl> </dd> <dt> <h4 class="name " id="sendToBack"><span class="type-signature"></span>sendToBack<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a>}</span></h4> </dt> <dd> <div class="description"> <p>Sends this Game Object to the bottom of its parents display list. Visually this means it will render below all other children in the same Group.</p> <p>If this Game Object hasn't been added to a custom Group then this method will send it to the bottom of the Game World, because the World is the root Group from which all Game Objects descend.</p> </div> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> - </div> <div class="returns-desc param-desc"> <p>This instance.</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.BringToTop.html#sendToBack">Phaser.Component.BringToTop#sendToBack</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_BringToTop.js.html">gameobjects/components/BringToTop.js</a>, <a href="src_gameobjects_components_BringToTop.js.html#sunlight-1-line-45">line 45</a> </dt> </dl> </dd> <dt> <h4 class="name " id="setChildIndex"><span class="type-signature"></span>setChildIndex<span class="signature">(child, index)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Changes the position of an existing child in the display object container</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>child</code></td> <td class="type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> </td> <td class="description last"><p>The child DisplayObject instance for which you want to change the index number</p></td> </tr> <tr> <td class="name"><code>index</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>The resulting index number for the child display object</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#setChildIndex">PIXI.DisplayObjectContainer#setChildIndex</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-176">line 176</a> </dt> </dl> </dd> <dt> <h4 class="name " id="setFrame"><span class="type-signature"></span>setFrame<span class="signature">(frame)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Sets the texture frame the Game Object uses for rendering.</p> <p>This is primarily an internal method used by <code>loadTexture</code>, but is exposed for the use of plugins and custom classes.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>frame</code></td> <td class="type"> <span class="param-type"><a href="Phaser.Frame.html">Phaser.Frame</a></span> </td> <td class="description last"><p>The Frame to be used by the texture.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.LoadTexture.html#setFrame">Phaser.Component.LoadTexture#setFrame</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_LoadTexture.js.html">gameobjects/components/LoadTexture.js</a>, <a href="src_gameobjects_components_LoadTexture.js.html#sunlight-1-line-155">line 155</a> </dt> </dl> </dd> <dt> <h4 class="name " id="setScaleMinMax"><span class="type-signature"></span>setScaleMinMax<span class="signature">(minX, minY, maxX, maxY)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Sets the scaleMin and scaleMax values. These values are used to limit how far this Game Object will scale based on its parent.</p> <p>For example if this Game Object has a <code>minScale</code> value of 1 and its parent has a <code>scale</code> value of 0.5, the 0.5 will be ignored and the scale value of 1 will be used, as the parents scale is lower than the minimum scale this Game Object should adhere to.</p> <p>By setting these values you can carefully control how Game Objects deal with responsive scaling.</p> <p>If only one parameter is given then that value will be used for both scaleMin and scaleMax: <code>setScaleMinMax(1)</code> = scaleMin.x, scaleMin.y, scaleMax.x and scaleMax.y all = 1</p> <p>If only two parameters are given the first is set as scaleMin.x and y and the second as scaleMax.x and y: <code>setScaleMinMax(0.5, 2)</code> = scaleMin.x and y = 0.5 and scaleMax.x and y = 2</p> <p>If you wish to set <code>scaleMin</code> with different values for x and y then either modify Game Object.scaleMin directly, or pass <code>null</code> for the <code>maxX</code> and <code>maxY</code> parameters.</p> <p>Call <code>setScaleMinMax(null)</code> to clear all previously set values.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>minX</code></td> <td class="type"> <span class="param-type">number</span> | <span class="param-type">null</span> </td> <td class="description last"><p>The minimum horizontal scale value this Game Object can scale down to.</p></td> </tr> <tr> <td class="name"><code>minY</code></td> <td class="type"> <span class="param-type">number</span> | <span class="param-type">null</span> </td> <td class="description last"><p>The minimum vertical scale value this Game Object can scale down to.</p></td> </tr> <tr> <td class="name"><code>maxX</code></td> <td class="type"> <span class="param-type">number</span> | <span class="param-type">null</span> </td> <td class="description last"><p>The maximum horizontal scale value this Game Object can scale up to.</p></td> </tr> <tr> <td class="name"><code>maxY</code></td> <td class="type"> <span class="param-type">number</span> | <span class="param-type">null</span> </td> <td class="description last"><p>The maximum vertical scale value this Game Object can scale up to.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.ScaleMinMax.html#setScaleMinMax">Phaser.Component.ScaleMinMax#setScaleMinMax</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_ScaleMinMax.js.html">gameobjects/components/ScaleMinMax.js</a>, <a href="src_gameobjects_components_ScaleMinMax.js.html#sunlight-1-line-110">line 110</a> </dt> </dl> </dd> <dt> <h4 class="name " id="setStageReference"><span class="type-signature"></span>setStageReference<span class="signature">(stage)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Sets the containers Stage reference. This is the Stage that this object, and all of its children, is connected to.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>stage</code></td> <td class="type"> <span class="param-type">Stage</span> </td> <td class="description last"><p>the stage that the container will have as its current stage reference</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#setStageReference">PIXI.DisplayObjectContainer#setStageReference</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-391">line 391</a> </dt> </dl> </dd> <dt> <h4 class="name " id="swapChildren"><span class="type-signature"></span>swapChildren<span class="signature">(child, child2)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Swaps the position of 2 Display Objects within this container.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>child</code></td> <td class="type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> </td> <td class="description last"><p>-</p></td> </tr> <tr> <td class="name"><code>child2</code></td> <td class="type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> </td> <td class="description last"><p>-</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObjectContainer.html#swapChildren">PIXI.DisplayObjectContainer#swapChildren</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObjectContainer.js.html">pixi/display/DisplayObjectContainer.js</a>, <a href="src_pixi_display_DisplayObjectContainer.js.html#sunlight-1-line-134">line 134</a> </dt> </dl> </dd> <dt> <h4 class="name " id="toGlobal"><span class="type-signature"></span>toGlobal<span class="signature">(position)</span><span class="type-signature"> &rarr; {Point}</span></h4> </dt> <dd> <div class="description"> <p>Calculates the global position of the display object</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>position</code></td> <td class="type"> <span class="param-type">Point</span> </td> <td class="description last"><p>The world origin to calculate from</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">Point</span> - </div> <div class="returns-desc param-desc"> <p>A point object representing the position of this object</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#toGlobal">PIXI.DisplayObject#toGlobal</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-576">line 576</a> </dt> </dl> </dd> <dt> <h4 class="name " id="toLocal"><span class="type-signature"></span>toLocal<span class="signature">(position, <span class="optional">from</span>)</span><span class="type-signature"> &rarr; {Point}</span></h4> </dt> <dd> <div class="description"> <p>Calculates the local position of the display object relative to another point</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>position</code></td> <td class="type"> <span class="param-type">Point</span> </td> <td class="attributes"> </td> <td class="description last"><p>The world origin to calculate from</p></td> </tr> <tr> <td class="name"><code>from</code></td> <td class="type"> <span class="param-type"><a href="PIXI.DisplayObject.html">PIXI.DisplayObject</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>The DisplayObject to calculate the global position from</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">Point</span> - </div> <div class="returns-desc param-desc"> <p>A point object representing the position of this object</p> </div> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#toLocal">PIXI.DisplayObject#toLocal</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-590">line 590</a> </dt> </dl> </dd> <dt> <h4 class="name " id="update"><span class="type-signature"></span>update<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Override and use this function in your own custom objects to handle any update requirements you may have.</p> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_gameobjects_Rope.js.html">gameobjects/Rope.js</a>, <a href="src_gameobjects_Rope.js.html#sunlight-1-line-110">line 110</a> </dt> </dl> </dd> <dt> <h4 class="name " id="updateCache"><span class="type-signature"></span>updateCache<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Generates and updates the cached sprite for this object.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="PIXI.DisplayObject.html#updateCache">PIXI.DisplayObject#updateCache</a> </li></dd> <dt class="tag-source">Source - <a href="src_pixi_display_DisplayObject.js.html">pixi/display/DisplayObject.js</a>, <a href="src_pixi_display_DisplayObject.js.html#sunlight-1-line-566">line 566</a> </dt> </dl> </dd> <dt> <h4 class="name " id="updateCrop"><span class="type-signature"></span>updateCrop<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>If you have set a crop rectangle on this Game Object via <code>crop</code> and since modified the <code>cropRect</code> property, or the rectangle it references, then you need to update the crop frame by calling this method.</p> </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="Phaser.Component.Crop.html#updateCrop">Phaser.Component.Crop#updateCrop</a> </li></dd> <dt class="tag-source">Source - <a href="src_gameobjects_components_Crop.js.html">gameobjects/components/Crop.js</a>, <a href="src_gameobjects_components_Crop.js.html#sunlight-1-line-86">line 86</a> </dt> </dl> </dd> </dl> </article> </section> </div> <div class="clearfix"></div> <footer> <span class="copyright"> Phaser Copyright © 2012-2016 Photon Storm Ltd. </span> <br /> <span class="jsdoc-message"> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.2</a> on Fri Apr 22 2016 15:11:54 GMT+0100 (GMT Daylight Time) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>. </span> </footer> </div> <div class="span3"> <div id="toc"></div> </div> <br clear="both"> </div> </div> <script src="scripts/sunlight.js"></script> <script src="scripts/sunlight.javascript.js"></script> <script src="scripts/sunlight-plugin.doclinks.js"></script> <script src="scripts/sunlight-plugin.linenumbers.js"></script> <script src="scripts/sunlight-plugin.menu.js"></script> <script src="scripts/jquery.min.js"></script> <script src="scripts/jquery.scrollTo.js"></script> <script src="scripts/jquery.localScroll.js"></script> <script src="scripts/bootstrap-dropdown.js"></script> <script src="scripts/toc.js"></script> <script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script> <script> $( function () { $( "#toc" ).toc( { anchorName : function(i, heading, prefix) { return $(heading).attr("id") || ( prefix + i ); }, selectors : "h1,h2,h3,h4", showAndHide : false, scrollTo : 60 } ); $( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" ); $( "#main span[id^='toc']" ).addClass( "toc-shim" ); } ); </script> </body> </html>
{ "content_hash": "31a06ec62893e29f114604d0832090be", "timestamp": "", "source": "github", "line_count": 11404, "max_line_length": 321, "avg_line_length": 17.85952297439495, "alnum_prop": 0.5347473854765061, "repo_name": "staff0rd/phaser", "id": "870dd189cae4c48b25e26fef3f3c23eaf5198ad0", "size": "203671", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "docs/Phaser.Rope.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "197804" }, { "name": "HTML", "bytes": "164009" }, { "name": "JavaScript", "bytes": "15838103" }, { "name": "PHP", "bytes": "88200" } ], "symlink_target": "" }
all: resume.html swanson_page_kenneth.pdf resume.html: resume.md style.css pandoc \ resume.md --from commonmark_x \ --to html \ --standalone \ --section-divs \ --css style.css \ --metadata title="Resume" --metadata lang="en-US" \ -o resume.html swanson_page_kenneth.pdf: resume.html style.css wkhtmltopdf \ --enable-local-file-access \ --user-style-sheet style.css \ --print-media-type \ --page-size A4 \ resume.html ./Downloads/swanson_page_kenneth.pdf
{ "content_hash": "72fc329bcb6c183fe0ddb2aad4ed6f73", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 53, "avg_line_length": 25.36842105263158, "alnum_prop": 0.6846473029045643, "repo_name": "pageSwanson/homepage", "id": "5b1c6592a8950ca4238a436c0b952633d8668f15", "size": "482", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "Makefile", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1435" }, { "name": "HTML", "bytes": "11242" }, { "name": "Makefile", "bytes": "482" } ], "symlink_target": "" }
package org.apache.drill.test.framework; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import com.beust.jcommander.Parameter; public class CmdParam { @Parameter(names = {"-b"}, description = "file extension for different baseline expected results", required=false) public String driverExt = null; public String SIMBA_ODBC = "sodbc"; @Parameter(names = {"-c"}, description = "percent of tests canceled", required=false) public int cancelPercent = 0; @Parameter(names = {"-d"}, description = "generate data", required=false) public boolean generate = false; @Parameter(names = {"-e"}, description = "filename", required=false) public String afterRunQueryFilename = "after-run.sql"; @Parameter(names = {"-f"}, description = "filename", required=false) public String beforeRunQueryFilename = "before-run.sql"; @Parameter(names = {"-g"}, description = "groups", required=true) public String groups = null; @Parameter(names = {"-h", "--help"}, description = "show usage", help=true) public boolean help = false; @Parameter(names = {"-i"}, description = "number of iterations", required=false) public int iterations = 1; @Parameter(names = {"-j"}, description = "number of testcase clones", required=false) public int clones = 1; @Parameter(names = {"-m"}, description = "track memory usage", required=false) public boolean trackMemory = false; @Parameter(names = {"-n"}, description = "number of threads", required=false) public int threads = 1; @Parameter(names = {"-r", "--report"}, description = "Generate json report", required=false) public boolean generateReports = false; @Parameter(names = {"-rf", "--runFailed"}, description = "Run tests tagged as failures", required=false) public boolean runFailed = false; @Parameter(names = {"-rR", "--repeatRun"}, description = "Log the sequence of tests and run that sequence again", required=false) public boolean repeatRun = false; @Parameter(names = {"-s"}, description = "sources", required=true) public String sources = null; @Parameter(names = {"-sR", "--skipRandom"}, description = "Skip check for random failures", required=false) public boolean skipRandom = false; @Parameter(names = {"-t"}, description = "timeout", required=false) public int timeout = 120; @Parameter(names = {"-w"}, description = "enable write actual query result to file", required=false) public boolean outputQueryResult = false; @Parameter(names = {"-x", "--exclude"}, description = "Dependencies to exclude", required=false) public String excludeDependencies = null; public List<String> excludeDependenciesAsList() { if (excludeDependencies == null) { return new ArrayList<String>(); } return Arrays.asList(excludeDependencies.split(",")); } }
{ "content_hash": "2760cdddf0f6e373d06008595da4e437", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 133, "avg_line_length": 39.932432432432435, "alnum_prop": 0.6663282571912014, "repo_name": "Agirish/drill-test-framework", "id": "12df827a9bef9bd2564afdc2b49d635ce4c5541b", "size": "2955", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "framework/src/main/java/org/apache/drill/test/framework/CmdParam.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "E", "bytes": "17812017" }, { "name": "Eiffel", "bytes": "57835115" }, { "name": "Forth", "bytes": "87" }, { "name": "HiveQL", "bytes": "780002" }, { "name": "Java", "bytes": "270573" }, { "name": "OpenEdge ABL", "bytes": "1590703" }, { "name": "PLSQL", "bytes": "49076" }, { "name": "PLpgSQL", "bytes": "46506" }, { "name": "Python", "bytes": "15030" }, { "name": "Shell", "bytes": "121778" }, { "name": "TSQL", "bytes": "920615" }, { "name": "q", "bytes": "3486166" } ], "symlink_target": "" }
package main import ( "testing" "github.com/stretchr/testify/require" ) const RequestOne = "request one" const RequestTwo = "request two" const RequestOpen = "open request" const RequestToBeClosed = "request to be closed" func TestBotRequestsAddOne(t *testing.T) { bot := &Bot{} bot.AddRequest(RequestOne) require.Len(t, bot.Requests, 1) } func TestBotRequestsAddEmpty(t *testing.T) { bot := &Bot{} bot.AddRequest("") require.Len(t, bot.Requests, 0) } func TestBotRequestsAddMultiple(t *testing.T) { bot := &Bot{} bot.AddRequest(RequestOne) bot.AddRequest(RequestTwo) require.Len(t, bot.Requests, 2) } func TestBotRequestsToText(t *testing.T) { bot := &Bot{} bot.AddRequest(RequestOne) bot.AddRequest(RequestTwo) requestsText := bot.GetRequestsText() t.Log("requestsText:", requestsText) require.Contains(t, requestsText, RequestOne) require.Contains(t, requestsText, RequestTwo) } func TestBotCloseRequest(t *testing.T) { bot := &Bot{} bot.AddRequest(RequestOpen) bot.AddRequest(RequestToBeClosed) bot.CloseRequest("1") //count from 0 requestsText := bot.GetRequestsText() t.Log("requestsText:", requestsText) require.Contains(t, requestsText, RequestOpen) require.NotContains(t, requestsText, RequestToBeClosed) } func TestBotNoOpenRequestsText(t *testing.T) { bot := &Bot{} bot.AddRequest(RequestToBeClosed) bot.CloseRequest("0") //count from 0 requestsText := bot.GetRequestsText() t.Log("requestsText:", requestsText) require.Contains(t, requestsText, "No active requests at the moment") }
{ "content_hash": "4a2d9db260f3916b0062141d70ecc18a", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 70, "avg_line_length": 19.4375, "alnum_prop": 0.7363344051446945, "repo_name": "EvilKhaosKat/KatSupplyBot", "id": "390c5afd2ec2b6c585737d6ac12ea43a49b5845f", "size": "1555", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bot_test.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Go", "bytes": "11343" }, { "name": "Shell", "bytes": "443" } ], "symlink_target": "" }
<label for="name">Name</label> <input name ="name" type ="text" ng-model ="bookmark.name" placeholder ="Name" class ="edit-name" focus-me ="bookmark.$focusInput" ng-keypress ="keypress($event)"/> <label for="name">Url</label> <input type ="text" ng-model ="bookmark.url" placeholder ="http://" class ="edit-url" ng-keypress ="keypress($event)"/> <label for="bckg">Background</label> <input name ="bckg" type ="button" colorpicker ="rgba" type ="text" ng-model ="bookmark.style.backgroundColor" ng-init ="rgba(0,0,0,0)"/>
{ "content_hash": "658f0b23d4519a3cf7c1674085289b1f", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 47, "avg_line_length": 23.77777777777778, "alnum_prop": 0.5607476635514018, "repo_name": "nopnop/homy", "id": "0e3202c2a964784d3a127e835ef93d7a5893512d", "size": "643", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/views/partials/bookmark-editor.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "7152" }, { "name": "JavaScript", "bytes": "16100" } ], "symlink_target": "" }
<?php namespace SilverStripe\Blog\Model; use SilverStripe\ORM\DataObject; /** * A blog tag for keyword descriptions of a blog post. * * * @method Blog Blog() * * @property string $Title * @property string $URLSegment * @property int $BlogID */ class BlogTag extends DataObject implements CategorisationObject { use BlogObject; /** * Use an exception code so that attempted writes can continue on * duplicate errors. * * @const string * This must be a string because ValidationException has decided we can't use int */ const DUPLICATE_EXCEPTION = 'DUPLICATE'; /** * {@inheritDoc} * @var string */ private static $table_name = 'BlogTag'; /** * @var array */ private static $db = [ 'Title' => 'Varchar(255)', 'URLSegment' => 'Varchar(255)' ]; /** * @var array */ private static $has_one = [ 'Blog' => Blog::class ]; /** * @var array */ private static $belongs_many_many = [ 'BlogPosts' => BlogPost::class ]; /** * {@inheritdoc} */ protected function getListUrlSegment() { return 'tag'; } /** * {@inheritdoc} */ protected function getDuplicateError() { return _t(__CLASS__ . '.Duplicate', 'A blog tag already exists with that name.'); } }
{ "content_hash": "c3bc01fb7f7088d0c864d608ae21beb0", "timestamp": "", "source": "github", "line_count": 73, "max_line_length": 89, "avg_line_length": 19.041095890410958, "alnum_prop": 0.5597122302158274, "repo_name": "silverstripe/silverstripe-blog", "id": "4180f67dae32d06ea50183add8114bbe04eebd61", "size": "1390", "binary": false, "copies": "2", "ref": "refs/heads/3", "path": "src/Model/BlogTag.php", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Gherkin", "bytes": "4531" }, { "name": "JavaScript", "bytes": "6300" }, { "name": "PHP", "bytes": "164741" }, { "name": "SCSS", "bytes": "4062" }, { "name": "Scheme", "bytes": "8386" } ], "symlink_target": "" }
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <link rel="SHORTCUT ICON" href="../../../../../img/clover.ico" /> <link rel="stylesheet" href="../../../../../aui/css/aui.min.css" media="all"/> <link rel="stylesheet" href="../../../../../aui/css/aui-experimental.min.css" media="all"/> <!--[if IE 9]><link rel="stylesheet" href="../../../../../aui/css/aui-ie9.min.css" media="all"/><![endif]--> <style type="text/css" media="all"> @import url('../../../../../style.css'); @import url('../../../../../tree.css'); </style> <script src="../../../../../jquery-1.8.3.min.js" type="text/javascript"></script> <script src="../../../../../aui/js/aui.min.js" type="text/javascript"></script> <script src="../../../../../aui/js/aui-experimental.min.js" type="text/javascript"></script> <script src="../../../../../aui/js/aui-soy.min.js" type="text/javascript"></script> <script src="../../../../../package-nodes-tree.js" type="text/javascript"></script> <script src="../../../../../clover-tree.js" type="text/javascript"></script> <script src="../../../../../clover.js" type="text/javascript"></script> <script src="../../../../../clover-descriptions.js" type="text/javascript"></script> <script src="../../../../../cloud.js" type="text/javascript"></script> <title>ABA Route Transit Number Validator 1.0.1-SNAPSHOT</title> </head> <body> <div id="page"> <header id="header" role="banner"> <nav class="aui-header aui-dropdown2-trigger-group" role="navigation"> <div class="aui-header-inner"> <div class="aui-header-primary"> <h1 id="logo" class="aui-header-logo aui-header-logo-clover"> <a href="http://openclover.org" title="Visit OpenClover home page"><span class="aui-header-logo-device">OpenClover</span></a> </h1> </div> <div class="aui-header-secondary"> <ul class="aui-nav"> <li id="system-help-menu"> <a class="aui-nav-link" title="Open online documentation" target="_blank" href="http://openclover.org/documentation"> <span class="aui-icon aui-icon-small aui-iconfont-help">&#160;Help</span> </a> </li> </ul> </div> </div> </nav> </header> <div class="aui-page-panel"> <div class="aui-page-panel-inner"> <div class="aui-page-panel-nav aui-page-panel-nav-clover"> <div class="aui-page-header-inner" style="margin-bottom: 20px;"> <div class="aui-page-header-image"> <a href="http://cardatechnologies.com" target="_top"> <div class="aui-avatar aui-avatar-large aui-avatar-project"> <div class="aui-avatar-inner"> <img src="../../../../../img/clover_logo_large.png" alt="Clover icon"/> </div> </div> </a> </div> <div class="aui-page-header-main" > <h1> <a href="http://cardatechnologies.com" target="_top"> ABA Route Transit Number Validator 1.0.1-SNAPSHOT </a> </h1> </div> </div> <nav class="aui-navgroup aui-navgroup-vertical"> <div class="aui-navgroup-inner"> <ul class="aui-nav"> <li class=""> <a href="../../../../../dashboard.html">Project overview</a> </li> </ul> <div class="aui-nav-heading packages-nav-heading"> <strong>Packages</strong> </div> <div class="aui-nav project-packages"> <form method="get" action="#" class="aui package-filter-container"> <input type="text" autocomplete="off" class="package-filter text" placeholder="Type to filter packages..." name="package-filter" id="package-filter" title="Start typing package name (or part of the name) to search through the tree. Use arrow keys and the Enter key to navigate."/> </form> <p class="package-filter-no-results-message hidden"> <small>No results found.</small> </p> <div class="packages-tree-wrapper" data-root-relative="../../../../../" data-package-name="com.cardatechnologies.utils.validators.abaroutevalidator"> <div class="packages-tree-container"></div> <div class="clover-packages-lozenges"></div> </div> </div> </div> </nav> </div> <section class="aui-page-panel-content"> <div class="aui-page-panel-content-clover"> <div class="aui-page-header-main"><ol class="aui-nav aui-nav-breadcrumbs"> <li><a href="../../../../../dashboard.html"> Project Clover database Sat Aug 7 2021 12:29:33 MDT</a></li> <li><a href="test-pkg-summary.html">Package com.cardatechnologies.utils.validators.abaroutevalidator</a></li> <li><a href="test-Test_AbaRouteValidator_15.html">Class Test_AbaRouteValidator_15</a></li> </ol></div> <h1 class="aui-h2-clover"> Test testAbaNumberCheck_32781_good </h1> <table class="aui"> <thead> <tr> <th>Test</th> <th><label title="The test result. Either a Pass, Fail or Error.">Status</label></th> <th><label title="When the test execution was started">Start time</label></th> <th><label title="The total time in seconds taken to run this test.">Time (seconds)</label></th> <th><label title="A failure or error message if the test is not successful.">Message</label></th> </tr> </thead> <tbody> <tr> <td> <a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_15.html?line=6668#src-6668" >testAbaNumberCheck_32781_good</a> </td> <td> <span class="sortValue">1</span><span class="aui-lozenge aui-lozenge-success">PASS</span> </td> <td> 7 Aug 12:44:51 </td> <td> 0.0 </td> <td> <div></div> <div class="errorMessage"></div> </td> </tr> </tbody> </table> <div>&#160;</div> <table class="aui aui-table-sortable"> <thead> <tr> <th style="white-space:nowrap;"><label title="A class that was directly hit by this test.">Target Class</label></th> <th colspan="4"><label title="The percentage of coverage contributed by each single test.">Coverage contributed by</label> testAbaNumberCheck_32781_good</th> </tr> </thead> <tbody> <tr> <td> <span class="sortValue">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</span> &#160;&#160;<a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/AbaRouteValidator.html?id=19017#AbaRouteValidator" title="AbaRouteValidator" name="sl-47">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</a> </td> <td> <span class="sortValue">0.7352941</span>73.5% </td> <td class="align-middle" style="width: 100%" colspan="3"> <div> <div title="73.5% Covered" style="min-width:40px;" class="barNegative contribBarNegative contribBarNegative"><div class="barPositive contribBarPositive contribBarPositive" style="width:73.5%"></div></div></div> </td> </tr> </tbody> </table> </div> <!-- class="aui-page-panel-content-clover" --> <footer id="footer" role="contentinfo"> <section class="footer-body"> <ul> <li> Report generated by <a target="_new" href="http://openclover.org">OpenClover</a> v 4.4.1 on Sat Aug 7 2021 12:49:26 MDT using coverage data from Sat Aug 7 2021 12:47:23 MDT. </li> </ul> <ul> <li>OpenClover is free and open-source software. </li> </ul> </section> </footer> </section> <!-- class="aui-page-panel-content" --> </div> <!-- class="aui-page-panel-inner" --> </div> <!-- class="aui-page-panel" --> </div> <!-- id="page" --> </body> </html>
{ "content_hash": "d458729bba5c7123bc99d5dc528ad73c", "timestamp": "", "source": "github", "line_count": 209, "max_line_length": 297, "avg_line_length": 43.91866028708134, "alnum_prop": 0.5096415731561172, "repo_name": "dcarda/aba.route.validator", "id": "aead5b9d3cc18e5cbf17b336c306afa4cbf36f74", "size": "9179", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "target13/site/clover/com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_15_testAbaNumberCheck_32781_good_eo9.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "18715254" } ], "symlink_target": "" }
export class ScheduleCreation extends React.Component { back() { renderCalendar(); } render() { var html = ( <div> <div> <div className="search-box-wrapper purple-content"> <p> <a href="#" onClick={ this.back }> <i className="fa fa-arrow-left"></i> </a> Schedule Event </p> </div> </div> <div className="designer-info"> <h6>Chose a Sequence or Regimen</h6> <select> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select> <h6>Starts</h6> <div className="flex"> <input placeholder="Today" type="text" className="flex3"></input> <select className="flex3"> <option value="volvo">12:30</option> <option value="saab">12:00</option> </select> </div> <h6>Repeats</h6> <div className="flex"> <input placeholder="2" type="text" className="flex3"></input> <select className="flex3"> <option value="volvo">days</option> <option value="saab">hours</option> </select> <input type="checkbox" name="wow" value="no">Does not repeat</input> </div> <h6>Ends</h6> <div className="flex"> <input placeholder="Today" type="text" className="flex3"></input> <select className="flex3"> <option value="volvo">12:30</option> <option value="saab">12:00</option> </select> </div> <div> <button className="purple-content"> Save </button> </div> </div> </div> ) return html; } } export function renderScheduleCreation() { React.render(<ScheduleCreation />, rightMenu); };
{ "content_hash": "ac7dec19804db40389f7f1b3063d920d", "timestamp": "", "source": "github", "line_count": 70, "max_line_length": 78, "avg_line_length": 29.185714285714287, "alnum_prop": 0.491434165442976, "repo_name": "yuvilio/farmbot-web-app", "id": "2c8ce8b5de8d853d407b52374135ced2f45a5d48", "size": "2043", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "javascripts/menus/schedule_creation.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "57195" }, { "name": "CoffeeScript", "bytes": "26759" }, { "name": "HTML", "bytes": "47131" }, { "name": "JavaScript", "bytes": "772226" }, { "name": "Ruby", "bytes": "86760" } ], "symlink_target": "" }
package termination import ( "time" "github.com/golang/glog" "k8s.io/api/core/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/util/wait" client "k8s.io/client-go/kubernetes" corev1 "k8s.io/client-go/kubernetes/typed/core/v1" "k8s.io/client-go/tools/record" ) const ( systemNamespace = "kube-system" eventReason = "NodeTermination" ) type podEvictionHandler struct { client corev1.CoreV1Interface node string recorder record.EventRecorder systemPodGracePeriod time.Duration } // List all pods on the node // Evict all pods on the node not in kube-system namespace // Return nil on success func NewPodEvictionHandler(node string, client *client.Clientset, recorder record.EventRecorder, systemPodGracePeriod time.Duration) PodEvictionHandler { return &podEvictionHandler{ client: client.CoreV1(), node: node, recorder: recorder, systemPodGracePeriod: systemPodGracePeriod, } } func (p *podEvictionHandler) EvictPods(excludePods map[string]string, timeout time.Duration) error { options := metav1.ListOptions{FieldSelector: fields.OneTermEqualSelector("spec.nodeName", string(p.node)).String()} pods, err := p.client.Pods(metav1.NamespaceAll).List(options) if err != nil { glog.V(2).Infof("Failed to list pods - %v", err) return err } var systemPods, regularPods []v1.Pod // Separate pods in kube-system namespace such that they can be evicted at the end. // This is especially helpful in scenarios like reclaiming logs prior to node termination. for _, pod := range pods.Items { if ns, exists := excludePods[pod.Name]; !exists || ns != pod.Namespace { if pod.Namespace == systemNamespace { systemPods = append(systemPods, pod) } else { regularPods = append(regularPods, pod) } } } // Evict regular pods first. var gracePeriod int64 // Reserve time for system pods if regular pods have adequate time to exit gracefully. if timeout >= 2*p.systemPodGracePeriod { gracePeriod = int64(timeout.Seconds() - p.systemPodGracePeriod.Seconds()) } deleteOptions := &metav1.DeleteOptions{GracePeriodSeconds: &gracePeriod} if err := p.deletePods(regularPods, deleteOptions); err != nil { return err } // Evict system pods. gracePeriod = int64(p.systemPodGracePeriod.Seconds()) deleteOptions.GracePeriodSeconds = &gracePeriod if err := p.deletePods(systemPods, deleteOptions); err != nil { return err } glog.V(4).Infof("Successfully evicted all pods from node %q", p.node) return nil } func (p *podEvictionHandler) deletePods(pods []v1.Pod, deleteOptions *metav1.DeleteOptions) error { for _, pod := range pods { p.recorder.Eventf(&pod, v1.EventTypeWarning, eventReason, "Node %q is about to be terminated. Evicting pod prior to node termination.", p.node) // Delete the pod with the specified timeout. glog.V(4).Infof("About to delete pod %q in namespace %q within grace period %d seconds", pod.Name, pod.Namespace, *deleteOptions.GracePeriodSeconds) if err := p.client.Pods(pod.Namespace).Delete(pod.Name, deleteOptions); err != nil { glog.V(2).Infof("Failed to delete pod %q in namespace %q - %v", pod.Name, pod.Namespace, err) return err } } // wait for pods to be actually deleted since deletion is asynchronous & pods have a deletion grace period to exit gracefully. for _, pod := range pods { if err := p.waitForPodNotFound(pod.Name, pod.Namespace, time.Duration(*deleteOptions.GracePeriodSeconds)*time.Second); err != nil { glog.Errorf("Pod %q/%q did not get deleted within grace period %d seconds: %v", pod.Namespace, pod.Name, *deleteOptions.GracePeriodSeconds, err) } } return nil } // waitForPodNotFound returns an error if it takes too long for the pod to fully terminate. func (p *podEvictionHandler) waitForPodNotFound(podName, ns string, timeout time.Duration) error { return wait.PollImmediate(time.Second, timeout, func() (bool, error) { _, err := p.client.Pods(ns).Get(podName, metav1.GetOptions{}) if apierrs.IsNotFound(err) { return true, nil // done } if err != nil { return true, err // stop wait with error } return false, nil }) }
{ "content_hash": "855393c5f9dbc6e0e225d34b91bcb6bd", "timestamp": "", "source": "github", "line_count": 112, "max_line_length": 153, "avg_line_length": 38.13392857142857, "alnum_prop": 0.7195036291266682, "repo_name": "GoogleCloudPlatform/k8s-node-termination-handler", "id": "1f104076fd59161614946da29b503c94e7779c73", "size": "4881", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "termination/eviction.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "587" }, { "name": "Go", "bytes": "31002" }, { "name": "Makefile", "bytes": "1187" }, { "name": "Python", "bytes": "5399" }, { "name": "Shell", "bytes": "2803" } ], "symlink_target": "" }
package org.apache.flex.forks.velocity.texen.util; import java.io.File; /** * A general file utility for use in the context * * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a> * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> * @version $Id: FileUtil.java,v 1.9.8.1 2004/03/03 23:23:07 geirm Exp $ */ public class FileUtil { /** * Creates the directory s (and any parent directories needed). * * @param String path/directory to create. * @param String report of path/directory creation. */ static public String mkdir (String s) { try { if ((new File(s)).mkdirs()) return "Created dir: "+s; else return "Failed to create dir or dir already exists: "+s; } catch (Exception e) { return e.toString(); } } /** * A method to get a File object. * * @param String path to file object to create. * @return File created file object. */ public static File file(String s) { File f = new File(s); return f; } /** * A method to get a File object. * * @param String base path * @param String file name * @return File created file object. */ public static File file(String base, String s) { File f = new File(base, s); return f; } }
{ "content_hash": "ad678bc6df39f8bacd8f6a1f65890a16", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 73, "avg_line_length": 23.672131147540984, "alnum_prop": 0.5554016620498615, "repo_name": "apache/flex-sdk", "id": "4c7ad93f3b3a7cca7d06571545b7a3619363d6d9", "size": "2067", "binary": false, "copies": "11", "ref": "refs/heads/master", "path": "modules/thirdparty/velocity/src/java/org/apache/flex/forks/velocity/texen/util/FileUtil.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AGS Script", "bytes": "478" }, { "name": "ASP", "bytes": "6381" }, { "name": "ActionScript", "bytes": "34795676" }, { "name": "AngelScript", "bytes": "477651" }, { "name": "Awk", "bytes": "1958" }, { "name": "Batchfile", "bytes": "40336" }, { "name": "C", "bytes": "2845" }, { "name": "C++", "bytes": "12015" }, { "name": "CSS", "bytes": "508448" }, { "name": "HTML", "bytes": "84174" }, { "name": "Java", "bytes": "15078807" }, { "name": "JavaScript", "bytes": "109405" }, { "name": "PureBasic", "bytes": "362" }, { "name": "Roff", "bytes": "59633" }, { "name": "Shell", "bytes": "308605" }, { "name": "Visual Basic", "bytes": "4498" }, { "name": "XSLT", "bytes": "757371" } ], "symlink_target": "" }
package org.wallride.web.controller.admin.analytics; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import org.wallride.service.PostService; import javax.inject.Inject; @Controller @RequestMapping("/{language}/analytics/sync") public class GoogleAnalyticsSyncController { @Inject private PostService postService; @RequestMapping(method = RequestMethod.POST) public String sync( @PathVariable String language, RedirectAttributes redirectAttributes) { postService.updatePostViews(); return "redirect:/_admin/{language}/analytics"; } }
{ "content_hash": "ab3ae3066d15d78aab36405b7c56502b", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 70, "avg_line_length": 29.107142857142858, "alnum_prop": 0.8196319018404908, "repo_name": "tagbangers/wallride", "id": "f677675da1092412e68914b4a51153a293cd224f", "size": "1414", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "wallride-core/src/main/java/org/wallride/web/controller/admin/analytics/GoogleAnalyticsSyncController.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "22338" }, { "name": "HTML", "bytes": "307430" }, { "name": "Java", "bytes": "1000425" }, { "name": "JavaScript", "bytes": "444713" } ], "symlink_target": "" }
/** * @module * @description * Change detection enables data binding in Angular. */ export { ChangeDetectionStrategy, ExpressionChangedAfterItHasBeenCheckedException, ChangeDetectionError, ChangeDetectorRef, WrappedValue, SimpleChange, PipeTransform, IterableDiffers, IterableDiffer, IterableDifferFactory, KeyValueDiffers, KeyValueDiffer, KeyValueDifferFactory, TrackByFn } from './change_detection/change_detection';
{ "content_hash": "bec37add650bfbd0f02bd6fbd9ca0d2b", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 52, "avg_line_length": 18.2, "alnum_prop": 0.7736263736263737, "repo_name": "choeller/angular", "id": "1d81e799fb389f03796eac6c508fed64fa713a2c", "size": "455", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "modules/angular2/src/core/change_detection.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "62917" }, { "name": "Dart", "bytes": "690766" }, { "name": "HTML", "bytes": "67628" }, { "name": "JavaScript", "bytes": "96711" }, { "name": "Protocol Buffer", "bytes": "4818" }, { "name": "Python", "bytes": "3535" }, { "name": "Shell", "bytes": "29098" }, { "name": "TypeScript", "bytes": "3430339" } ], "symlink_target": "" }
package com.intellij.ide.favoritesTreeView; import com.intellij.ide.projectView.ProjectViewNode; import com.intellij.ide.projectView.ViewSettings; import com.intellij.ide.util.treeView.AbstractTreeNode; import com.intellij.openapi.project.Project; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collection; import java.util.List; @Deprecated(forRemoval = true) public abstract class ProjectViewNodeWithChildrenList<T> extends ProjectViewNode<T> { protected final List<AbstractTreeNode<?>> myChildren; protected ProjectViewNodeWithChildrenList(Project project, @NotNull T t, ViewSettings viewSettings) { super(project, t, viewSettings); myChildren = new ArrayList<>(); } @NotNull @Override public Collection<? extends AbstractTreeNode<?>> getChildren() { return myChildren; } public void addChild(final AbstractTreeNode<?> node) { myChildren.add(node); node.setParent(this); } }
{ "content_hash": "01267969da28c0d4ef02f3d18acf61cf", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 103, "avg_line_length": 29.181818181818183, "alnum_prop": 0.7767393561786086, "repo_name": "GunoH/intellij-community", "id": "6d063755997a31a70fcd35025093a4655c000322", "size": "1104", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "platform/lang-impl/src/com/intellij/ide/favoritesTreeView/ProjectViewNodeWithChildrenList.java", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
{% extends "base.html" %} {% load staticfiles %} {% block side_bar %} {% endblock side_bar %} {% block content %} <div id='mountGraph'></div> {% endblock content %} {% block js %} <script src="{% static 'react/build/ViewGraph.js' %}"></script> {% endblock js %}
{ "content_hash": "6974f3204d1f32d0fba05797b8cd7213", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 67, "avg_line_length": 15.444444444444445, "alnum_prop": 0.579136690647482, "repo_name": "sergeysynergy/graph", "id": "d38c01aae2be06400bad88b46ca3f621c4c2b449", "size": "278", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "django/templates/zcore/graph.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "22894" }, { "name": "HTML", "bytes": "25174" }, { "name": "JavaScript", "bytes": "1798830" }, { "name": "Python", "bytes": "94985" }, { "name": "Shell", "bytes": "80" } ], "symlink_target": "" }
<?hh // strict class :template extends :xhp:html-element { category %flow, %phrase, %metadata; // The children declaration for this element is extraordinarily verbose so // I leave it to you to use it appropriately. protected string $tagName = 'template'; }
{ "content_hash": "124a4680ca9583f23341cadd69cf0872", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 76, "avg_line_length": 29.77777777777778, "alnum_prop": 0.7201492537313433, "repo_name": "codestackfull/XHP", "id": "3c06034856f550654e89a65f5722ace2317e73ff", "size": "575", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "src/html/tags/t/Template.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Hack", "bytes": "182143" } ], "symlink_target": "" }
SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTestNet) : QSplashScreen(pixmap, f) { setAutoFillBackground(true); // set reference point, paddings int paddingRight = 50; int paddingTop = 50; int titleVersionVSpace = 17; int titleCopyrightVSpace = 40; float fontFactor = 1.0; // define text to place QString titleText = tr("BitZeny Core"); QString versionText = QString("Version %1").arg(QString::fromStdString(FormatFullVersion())); QString copyrightText = QChar(0xA9)+QString(" 2014-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The BitZeny Core developers")); QString copyrightTextBTC= QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin Core developers")); QString testnetAddText = QString(tr("[testnet]")); // define text to place as single text object QString font = "Arial"; // load the bitmap for writing some text over it QPixmap newPixmap; if(isTestNet) { newPixmap = QPixmap(":/images/splash_testnet"); } else { newPixmap = QPixmap(":/images/splash"); } QPainter pixPaint(&newPixmap); pixPaint.setPen(QColor(100,100,100)); // check font size and drawing with pixPaint.setFont(QFont(font, 33*fontFactor)); QFontMetrics fm = pixPaint.fontMetrics(); int titleTextWidth = fm.width(titleText); if(titleTextWidth > 160) { // strange font rendering, Arial probably not found fontFactor = 0.75; } pixPaint.setFont(QFont(font, 33*fontFactor)); fm = pixPaint.fontMetrics(); titleTextWidth = fm.width(titleText); pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop,titleText); pixPaint.setFont(QFont(font, 15*fontFactor)); // if the version string is to long, reduce size fm = pixPaint.fontMetrics(); int versionTextWidth = fm.width(versionText); if(versionTextWidth > titleTextWidth+paddingRight-10) { pixPaint.setFont(QFont(font, 10*fontFactor)); titleVersionVSpace -= 5; } pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight+2,paddingTop+titleVersionVSpace,versionText); // draw copyright stuff pixPaint.setFont(QFont(font, 10*fontFactor)); pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText); pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace+14,copyrightTextBTC); // draw testnet string if testnet is on if(isTestNet) { QFont boldFont = QFont(font, 10*fontFactor); boldFont.setWeight(QFont::Bold); pixPaint.setFont(boldFont); fm = pixPaint.fontMetrics(); int testnetAddTextWidth = fm.width(testnetAddText); pixPaint.drawText(newPixmap.width()-testnetAddTextWidth-10,15,testnetAddText); } pixPaint.end(); this->setPixmap(newPixmap); subscribeToCoreSignals(); } SplashScreen::~SplashScreen() { unsubscribeFromCoreSignals(); } void SplashScreen::slotFinish(QWidget *mainWin) { finish(mainWin); } static void InitMessage(SplashScreen *splash, const std::string &message) { QMetaObject::invokeMethod(splash, "showMessage", Qt::QueuedConnection, Q_ARG(QString, QString::fromStdString(message)), Q_ARG(int, Qt::AlignBottom|Qt::AlignHCenter), Q_ARG(QColor, QColor(55,55,55))); } static void ShowProgress(SplashScreen *splash, const std::string &title, int nProgress) { InitMessage(splash, title + strprintf("%d", nProgress) + "%"); } #ifdef ENABLE_WALLET static void ConnectWallet(SplashScreen *splash, CWallet* wallet) { wallet->ShowProgress.connect(boost::bind(ShowProgress, splash, _1, _2)); } #endif void SplashScreen::subscribeToCoreSignals() { // Connect signals to client uiInterface.InitMessage.connect(boost::bind(InitMessage, this, _1)); #ifdef ENABLE_WALLET uiInterface.LoadWallet.connect(boost::bind(ConnectWallet, this, _1)); #endif } void SplashScreen::unsubscribeFromCoreSignals() { // Disconnect signals from client uiInterface.InitMessage.disconnect(boost::bind(InitMessage, this, _1)); #ifdef ENABLE_WALLET if(pwalletMain) pwalletMain->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2)); #endif }
{ "content_hash": "5f90328773908342ca8d9c71a5973d81", "timestamp": "", "source": "github", "line_count": 130, "max_line_length": 128, "avg_line_length": 33.815384615384616, "alnum_prop": 0.6910828025477707, "repo_name": "zenywallet/bitzeny", "id": "bfc88fbdbd3ab173277fee3bfcb2194fe9267d69", "size": "4800", "binary": false, "copies": "2", "ref": "refs/heads/z1.2.x", "path": "src/qt/splashscreen.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "278412" }, { "name": "C++", "bytes": "3049690" }, { "name": "CSS", "bytes": "1127" }, { "name": "HTML", "bytes": "50620" }, { "name": "M4", "bytes": "113820" }, { "name": "Makefile", "bytes": "32859" }, { "name": "Objective-C", "bytes": "1052" }, { "name": "Objective-C++", "bytes": "6330" }, { "name": "Python", "bytes": "116507" }, { "name": "QMake", "bytes": "2019" }, { "name": "Roff", "bytes": "18140" }, { "name": "Shell", "bytes": "52110" } ], "symlink_target": "" }
<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE toc PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 2.0//EN" "http://java.sun.com/products/javahelp/toc_2_0.dtd"> <toc version="2.0"> <tocitem text="ZAP User Guide" tocid="toplevelitem"> <tocitem text="Componenti Aggiuntivi" tocid="addons"> <tocitem text="Tips and Tricks" image="tips-icon" target="tips"/> </tocitem> </tocitem> </toc>
{ "content_hash": "a393627926f5b35fbd5251add3300ff4", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 69, "avg_line_length": 34.833333333333336, "alnum_prop": 0.6674641148325359, "repo_name": "thc202/zap-extensions", "id": "6353e885e86997ab8516fa6666be4c7498141e38", "size": "418", "binary": false, "copies": "8", "ref": "refs/heads/main", "path": "addOns/tips/src/main/javahelp/org/zaproxy/zap/extension/tips/resources/help_it_IT/toc.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "50766" }, { "name": "Groovy", "bytes": "29975" }, { "name": "HTML", "bytes": "16135483" }, { "name": "Haskell", "bytes": "2639622" }, { "name": "Java", "bytes": "16529521" }, { "name": "JavaScript", "bytes": "217543" }, { "name": "Kotlin", "bytes": "122569" }, { "name": "Python", "bytes": "27312" }, { "name": "Ruby", "bytes": "16548" }, { "name": "XSLT", "bytes": "9433" } ], "symlink_target": "" }
layout: doc title: delite/FormWidget --- # delite/FormWidget `delite/FormWidget` is a base class for form widgets, and predefines properties like `disabled`, `tabindex`, etc. It's useful for form widgets like buttons and checkboxes. Note that for form widgets where the user can set the value interactively, via mouse, keyboard, etc., they should extend [`delite/FormValueWidget`](FormValueWidget.md) instead.
{ "content_hash": "6feac053724226fad12c2cffd16258b7", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 101, "avg_line_length": 31.76923076923077, "alnum_prop": 0.7796610169491526, "repo_name": "Sam-Cummins/delite", "id": "c978ae23f2ed59df1d4a78f546dcab2d0db7d567", "size": "417", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "docs/FormWidget.md", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "22873" }, { "name": "HTML", "bytes": "97414" }, { "name": "JavaScript", "bytes": "584815" } ], "symlink_target": "" }
package org.ovirt.engine.core.bll; import java.util.List; import java.util.concurrent.TimeUnit; import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VdsSelectionAlgorithm; import org.ovirt.engine.core.common.config.Config; import org.ovirt.engine.core.common.config.ConfigValues; import org.ovirt.engine.core.utils.log.Log; import org.ovirt.engine.core.utils.log.LogFactory; import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.utils.timer.OnTimerMethodAnnotation; import org.ovirt.engine.core.utils.timer.SchedulerUtilQuartzImpl; /** * This class responcible to perform periodically load balancing of servers Its * activated only if load balancing enabled by configuration. */ public final class VdsLoadBalancer { private static Log log = LogFactory.getLog(VdsLoadBalancer.class); private static VdsLoadBalancer instance = new VdsLoadBalancer(); private VdsLoadBalancer() { } @OnTimerMethodAnnotation("PerformLoadBalancing") public void PerformLoadBalancing() { log.debugFormat("VdsLoadBalancer: Load Balancer timer entered."); // get all clusters List<VDSGroup> groups = DbFacade.getInstance().getVdsGroupDao().getAll(); for (VDSGroup group : groups) { if (group.getselection_algorithm() != VdsSelectionAlgorithm.None) { VdsLoadBalancingAlgorithm loadBalancingAlgorithm = VdsLoadBalancingAlgorithm .CreateVdsLoadBalancingAlgorithm(group); log.infoFormat("VdsLoadBalancer: Starting load balance for cluster: {0}, algorithm: {1}.", group.getname(), group.getselection_algorithm().toString()); log.infoFormat("VdsLoadBalancer: high util: {0}, low util: {1}, duration: {2}, threashold: {3}", group.gethigh_utilization(), group.getlow_utilization(), group.getcpu_over_commit_duration_minutes(), Config.<Integer> GetValue(ConfigValues.UtilizationThresholdInPercent)); loadBalancingAlgorithm.LoadBalance(); } else { log.debugFormat("VdsLoadBalancer: Cluster {0} skipped because no selection algorithm selected.", group.getname()); } } } public static void EnableLoadBalancer() { SchedulerUtilQuartzImpl.getInstance().scheduleAFixedDelayJob(instance, "PerformLoadBalancing", new Class[] {}, new Object[] {}, Config.<Integer> GetValue(ConfigValues.VdsLoadBalancingeIntervalInMinutes), Config.<Integer> GetValue(ConfigValues.VdsLoadBalancingeIntervalInMinutes), TimeUnit.MINUTES); } }
{ "content_hash": "146929ea8b64390ba3f51feef8a36499", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 118, "avg_line_length": 49.17857142857143, "alnum_prop": 0.6953522149600581, "repo_name": "jbeecham/ovirt-engine", "id": "de045eb3ac2060b5bdb3849d781ddd1f42fa628a", "size": "2754", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsLoadBalancer.java", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package org.sakaiproject.entitybroker.util.http; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; import java.security.Principal; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.TreeMap; import java.util.Vector; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; import javax.servlet.ServletContext; import javax.servlet.ServletInputStream; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponseWrapper; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionBindingListener; import javax.servlet.http.HttpSessionContext; /** * Makes a copy of the data in a servlet request into a new request object * * @author Aaron Zeckoski (azeckoski @ gmail.com) */ @SuppressWarnings({ "unchecked", "deprecation" }) public class EntityHttpServletRequest implements HttpServletRequest { /** * default schema: http */ public static final String DEFAULT_SCHEMA = "http"; /** * default protocol: HTTP/1.0 */ public static final String DEFAULT_PROTOCOL = "HTTP/1.0"; /** * default server address: 127.0.0.1 */ public static final String DEFAULT_SERVER_ADDR = "127.0.0.1"; /** * default server name: localhost */ public static final String DEFAULT_SERVER_NAME = "localhost"; /** * default server port: 80 */ public static final int DEFAULT_SERVER_PORT = 80; /** * default remote address: 127.0.0.1 */ public static final String DEFAULT_REMOTE_ADDR = "127.0.0.1"; /** * The default remote host: 'localhost'. */ public static final String DEFAULT_REMOTE_HOST = "localhost"; public HttpServletRequest copy = null; ConcurrentHashMap<String, Vector<String>> headers = new ConcurrentHashMap<String, Vector<String>>(); ConcurrentHashMap<String, Object> attributes = new ConcurrentHashMap<String, Object>(); ConcurrentHashMap<String, String[]> parameters = new ConcurrentHashMap<String, String[]>(); Vector<Cookie> cookies = new Vector<Cookie>(); Locale locale = Locale.getDefault(); String contentType = "text/plain"; String characterEncoding = "UTF-8"; InputStream contentStream = null; int contentLength = 0; HttpSession internalSession; String scheme = DEFAULT_PROTOCOL; String protocol = DEFAULT_PROTOCOL; String serverName = DEFAULT_SERVER_NAME; int serverPort = DEFAULT_SERVER_PORT; String remoteAddr = DEFAULT_REMOTE_ADDR; String remoteHost = DEFAULT_REMOTE_HOST; String method = "GET"; String contextPath = ""; // always starts with "/", "" indicates root String pathInfo = null; String queryString = null; String requestURI = ""; String servletPath = ""; // always starts with "/", "" indicates /* used to match @Override public String toString() { return method + " " + contextPath + (pathInfo == null ? "" : pathInfo) + (queryString == null ? "" : "?"+queryString) + " "+ super.toString(); } /** * Create a new request from a given request * @param req any request */ public EntityHttpServletRequest(HttpServletRequest req) { this(req, null, null); } /** * Create a new request from a given request and modify it based on the path string * @param req any request * @param pathString any full path or URL (/direct/prefix/id.xml) */ public EntityHttpServletRequest(HttpServletRequest req, String pathString) { this(req, null, pathString); } /** * Create a new request from a given request and modify it based on the path string and method * @param req any request * @param method GET, POST, PUT, DELETE (PUT and DELETE not supported by browsers), * this will be set to POST if null or unset * @param pathString any full path or URL (/direct/prefix/id.xml) */ public EntityHttpServletRequest(HttpServletRequest req, String method, String pathString) { copy = req; if (req != null) { setRequestValues(req); } else { throw new IllegalArgumentException("HttpServletRequest must be set and cannot be null"); } if (method == null || "".equals(method)) { setMethod( req.getMethod().toUpperCase() ); } // setup the stuff based on the pathString setPathString(pathString); } /** * Create a request using the pathString * @param pathString any path or URL */ public EntityHttpServletRequest(String pathString) { this(null, pathString, (String[]) null); } /** * Create a request using the pathString and setting the method * @param pathString any path or URL * @param method GET, POST, PUT, DELETE (PUT and DELETE not supported by browsers), * this will be set to POST if null or unset */ public EntityHttpServletRequest(String method, String pathString) { this(method, pathString, (String[]) null); } /** * Create a request using the pathString and setting the method and params * @param method GET, POST, PUT, DELETE (PUT and DELETE not supported by browsers), * this will be set to POST if null or unset * @param pathString any path or URL * @param params alternating keys and values (starting with keys) to place into the request parameters */ public EntityHttpServletRequest(String method, String pathString, String... params) { setPathString(pathString); if (method == null || "".equals(method)) { setMethod("POST"); } else { setMethod( method ); } if (params != null) { for (int i = 0; i < params.length; i++) { if (params.length < i + 1) { break; } this.addParameter(params[i], params[i+1]); i++; } } } /** * Set all the values from a request on this request object and set this request * as the one which the values were copied from * @param req any request */ public void setRequestValues(HttpServletRequest req) { if (req == null) { throw new IllegalArgumentException("request cannot be null"); } // get the collections of values out Enumeration<String> attribNames = req.getAttributeNames(); while (attribNames.hasMoreElements()) { String name = (String) attribNames.nextElement(); Object obj = req.getAttribute(name); if (obj != null) { attributes.put(name, obj); } } Cookie[] ck = req.getCookies(); if (ck != null) { for (int i = 0; i < ck.length; i++) { cookies.add(ck[i]); } } Enumeration<String> headerNames = req.getHeaderNames(); while (headerNames.hasMoreElements()) { String name = headerNames.nextElement(); Enumeration<String> henum = req.getHeaders(name); Vector<String> v = new Vector<String>(1); while (henum.hasMoreElements()) { String h = henum.nextElement(); v.add(h); } } for (Entry<String, String[]> entry : (Set<Entry<String, String[]>>) req.getParameterMap().entrySet()) { parameters.put(entry.getKey(), entry.getValue()); } // get the basic values out this.locale = req.getLocale(); this.method = req.getMethod(); this.contentType = req.getContentType(); this.characterEncoding = req.getCharacterEncoding() == null ? "UTF-8" : req.getCharacterEncoding(); this.contentLength = req.getContentLength(); this.contextPath = req.getContextPath(); this.pathInfo = req.getPathInfo(); this.queryString = req.getQueryString(); this.requestURI = req.getRequestURI(); this.servletPath = req.getServletPath(); this.scheme = req.getScheme(); this.protocol = req.getProtocol(); this.serverName = req.getServerName(); this.serverPort = req.getServerPort(); this.remoteAddr = req.getRemoteAddr(); this.remoteHost = req.getRemoteHost(); this.realDispatcher = true; } /** * This stores all the query params found when the request was created */ public Map<String, String[]> pathQueryParams = new HashMap<String, String[]>(0); /** * This will set the given url/path string values into this request, * this will override any values that are currently set * @param pathString any url or path string * @return the url data object based on the input object OR null if the string is null or empty */ public URLData setPathString(String pathString) { URLData ud = null; if (pathString != null && pathString.length() > 1) { this.requestURI = pathString; ud = HttpRESTUtils.parseURL(pathString); if (ud.pathInfo.length() > 0) { this.pathInfo = ud.pathInfo; } else { this.pathInfo = null; } if (ud.port.length() > 0) { // only if port is set and a number try { this.serverPort = new Integer(ud.port); } catch (NumberFormatException e) { // set to default if it cannot be set and is not set if (this.serverPort <= 0) { this.serverPort = 80; } } } if (ud.protocol.length() > 0) { this.scheme = ud.protocol; } if (ud.query.length() > 0) { this.queryString = ud.query; Map<String, String> p = HttpRESTUtils.parseURLintoParams(ud.query); for (Entry<String, String> entry : p.entrySet()) { String[] value = new String[] {entry.getValue()}; this.pathQueryParams.put(entry.getKey(), value); setParameter(entry.getKey(), value); } } else { this.queryString = null; } if (ud.server.length() > 0) { this.serverName = ud.server; } if (ud.servletName.length() > 0) { this.servletPath = "/" + ud.servletName; this.contextPath = ud.contextPath; } else { this.servletPath = ""; this.contextPath = ""; } } return ud; } /** * Allows control over the content data which is used in this request, * all data should be UTF-8 encoded * @param content any IS content, UTF-8 encoded, replaces existing content */ public void setContent(InputStream contentStream, int contentLength) { if (contentStream == null) { contentLength = 0; } this.contentStream = contentStream; this.contentLength = contentLength; } /** * Allows control over the content data which is used in this request, * all data should be UTF-8 encoded * @param content any byte[] content, UTF-8 encoded, replaces existing content */ public void setContent(byte[] content) { if (content == null) { this.contentLength = 0; this.contentStream = new ByteArrayInputStream(new byte[] {}); } else { this.contentLength = content.length; this.contentStream = new ByteArrayInputStream(content); } } /** * Allows control over the content data which is used in this request, * all data should be UTF-8 encoded * @param content any string content, UTF-8 encoded, replaces existing content */ public void setContent(String content) { if (content == null) { content = ""; } this.contentLength = content.length(); this.contentStream = new BufferedInputStream( new ByteArrayInputStream(content.getBytes()) ); } /** * Gets the content data out of the request, ensures that the data can be retrieved somehow * @return the content data from the request * @throws IOException if there is a failure */ public ServletInputStream getContent() throws IOException { ServletInputStream sis = null; if (contentStream != null) { // wrap the existing one sis = new EntityServletInputStream(contentStream); } else if (copy != null) { // lazy load this out of the request sis = new LazyRequestInputStream(copy); } else { // provide a default one then sis = new EntityServletInputStream(""); } return sis; } // API methods public Object getAttribute(String name) { return attributes.get(name); } public Enumeration getAttributeNames() { return Collections.enumeration(attributes.keySet()); } public void removeAttribute(String name) { attributes.remove(name); } public void setAttribute(String name, Object o) { attributes.put(name, o); } /** * Remove all attributes */ public void clearAttributes() { this.attributes.clear(); } public void setCharacterEncoding(String env) throws UnsupportedEncodingException { if (env == null || "".equals(env)) { env = "UTF-8"; } this.characterEncoding = env; } public String getCharacterEncoding() { return characterEncoding; } /** * Sets the content type for this request content * @param contentType */ public void setContentType(String contentType) { if (contentType == null || "".equals(contentType)) { contentType = "text/plain"; } this.contentType = contentType; } public String getContentType() { return contentType; } public int getContentLength() { return contentLength; } public ServletInputStream getInputStream() throws IOException { // lazy load this on request, don't use the reader return getContent(); } public BufferedReader getReader() throws IOException { // lazy load this on request, don't use the reader return new BufferedReader( new InputStreamReader( getContent() ) ); } public void setLocale(Locale locale) { this.locale = locale; } public Locale getLocale() { return locale; } public void setMethod(String method) { this.method = (method != null ? method.toUpperCase() : method); } public String getMethod() { return method; } public void setContextPath(String contextPath) { if (contextPath == null) { throw new IllegalArgumentException("contextPath cannot be null"); } this.contextPath = contextPath; } public String getContextPath() { return contextPath; } public void setPathInfo(String pathInfo) { if (pathInfo == null) { throw new IllegalArgumentException("pathInfo cannot be null"); } this.pathInfo = pathInfo; } public String getPathInfo() { return this.pathInfo; } public String getPathTranslated() { if (copy != null) { return copy.getPathTranslated(); } else { return null; } } public void setQueryString(String queryString) { this.queryString = queryString; } public String getQueryString() { return this.queryString; } public String getRequestURI() { return this.requestURI; } public StringBuffer getRequestURL() { StringBuffer sb = new StringBuffer(); sb.append(this.scheme); sb.append("://"); sb.append(this.serverName); if (this.serverPort > 0) { sb.append(":"); sb.append(this.serverPort); } if (this.contextPath == null || this.contextPath.length() == 0) { sb.append("/"); } else { sb.append(this.contextPath); } sb.append( getRequestURI() ); return sb; } public void setServletPath(String servletPath) { this.servletPath = servletPath; } public String getServletPath() { return this.servletPath; } /** * Adds a new cookie to the request * @param cookie a cookie to add, will displace existing cookies with the same name */ public void addCookie(Cookie cookie) { if (cookie == null) { throw new IllegalArgumentException("Cookie cannot be null"); } for (Iterator<Cookie> iterator = cookies.iterator(); iterator.hasNext();) { Cookie c = iterator.next(); if (cookie.getName().equals(c.getName())) { iterator.remove(); } } cookies.add(cookie); } /** * Removes the cookie with the given name from the request * @param name the name of a cookie */ public void removeCookie(String name) { if (name == null || "".equals(name)) { throw new IllegalArgumentException("name cannot be null"); } for (Iterator<Cookie> iterator = cookies.iterator(); iterator.hasNext();) { Cookie c = iterator.next(); if (name.equals(c.getName())) { iterator.remove(); } } } public Cookie[] getCookies() { Cookie[] c; if (this.cookies == null || this.cookies.size() == 0) { c = new Cookie[0]; } else { c = this.cookies.toArray(new Cookie[this.cookies.size()]); } return c; } /** * Remove all cookies */ public void clearCookies() { this.cookies.clear(); } public void addHeader(String name, String... content) { if (name == null || "".equals(name)) { throw new IllegalArgumentException("name cannot be null"); } if (content == null || content.length == 0) { throw new IllegalArgumentException("values cannot be null or empty"); } Vector<String> v = new Vector<String>(content.length); for (int i = 0; i < content.length; i++) { String c = content[i]; v.add(c); } headers.put(name, v); } public void removeHeader(String name) { headers.remove(name); } public String getHeader(String name) { if (name == null || "".equals(name)) { throw new IllegalArgumentException("name cannot be null"); } String header = null; if (headers.containsKey(name)) { Vector<String> v = headers.get(name); if (v != null) { header = v.firstElement(); } } return header; } public Enumeration getHeaderNames() { return Collections.enumeration(headers.keySet()); } public Enumeration getHeaders(String name) { if (name == null || "".equals(name)) { throw new IllegalArgumentException("name cannot be null"); } Vector<String> h = new Vector<String>(0); if (headers.containsKey(name)) { Vector<String> v = headers.get(name); if (v != null) { h = v; } } return Collections.enumeration(h); } public long getDateHeader(String name) { long date = -1l; String header = getHeader(name); if (header != null) { try { date = new Long(header).longValue(); } catch (NumberFormatException e) { throw new IllegalArgumentException("Cannot convert header value ("+header+") to long (timestamp)"); } } return date; } public int getIntHeader(String name) { int num = -1; String header = getHeader(name); if (header != null) { try { num = new Integer(header).intValue(); } catch (NumberFormatException e) { throw new IllegalArgumentException("Cannot convert header value ("+header+") to integer"); } } return num; } /** * Remove all headers */ public void clearHeaders() { this.headers.clear(); } public String getAuthType() { if (copy != null) { return copy.getAuthType(); } return null; // no auth } public String getLocalAddr() { if (copy != null) { return copy.getLocalAddr(); } return DEFAULT_SERVER_ADDR; } public Enumeration getLocales() { if (copy != null) { return copy.getLocales(); } else { ArrayList<Locale> l = new ArrayList<Locale>(); l.add(locale); return Collections.enumeration(l); } } public String getLocalName() { if (copy != null) { return copy.getLocalName(); } return DEFAULT_SERVER_NAME; } public int getLocalPort() { if (copy != null) { return copy.getLocalPort(); } return DEFAULT_SERVER_PORT; } /** * @return all parameters in this request */ public Map<String, String[]> getParameters() { return Collections.unmodifiableMap(this.parameters); } /** * @return all parameters in this request as single strings */ public Map<String, String> getStringParameters() { Map<String, String> m = new TreeMap<String, String>(); for (Entry<String, String[]> entry : this.parameters.entrySet()) { String key = entry.getKey(); String value = ""; String[] sa = entry.getValue(); if (sa != null && sa.length > 0) { value = sa[0]; } m.put(key, value); } return m; } public String getParameter(String name) { String value = null; if (parameters.containsKey(name)) { String[] vals = parameters.get(name); if (vals != null && vals.length > 0) { value = vals[0]; } } return value; } public Map getParameterMap() { return Collections.unmodifiableMap(parameters); } public Enumeration getParameterNames() { return parameters.keys(); } public String[] getParameterValues(String name) { return parameters.get(name); } /** * Add a single parameter, * this will append to an existing one */ public void addParameter(String name, String value) { addParameter(name, new String[] {value}); } /** * Add an array of values for a parameter, * these will append to existing ones */ public void addParameter(String name, String[] values) { if (name == null || "".equals(name)) { throw new IllegalArgumentException("name cannot be null"); } if (values == null || values.length < 1) { throw new IllegalArgumentException("values cannot be null or empty"); } String[] oldArr = (String[]) this.parameters.get(name); if (oldArr != null) { String[] newArr = new String[oldArr.length + values.length]; System.arraycopy(oldArr, 0, newArr, 0, oldArr.length); System.arraycopy(values, 0, newArr, oldArr.length, values.length); this.parameters.put(name, newArr); } else { this.parameters.put(name, values); } } /** * Set a new parameter (overwrite an existing one) */ public void setParameter(String name, String[] values) { if (name == null || "".equals(name)) { throw new IllegalArgumentException("name cannot be null"); } if (values == null || values.length < 1) { throw new IllegalArgumentException("values cannot be null or empty"); } this.parameters.put(name, values); } /** * Set a large number of params at once, * replaces existing params * @param params map of params */ public void setParameters(Map<String, String[]> params) { if (params != null && params.size() > 0) { this.parameters.putAll( params ); } } /** * Removes a parameter and all values for it * @param name */ public void removeParameter(String name) { if (name == null || "".equals(name)) { throw new IllegalArgumentException("name cannot be null"); } this.parameters.remove(name); } /** * Remove all parameters */ public void clearParameters() { this.parameters.clear(); } public String getProtocol() { return protocol; } public String getRealPath(String path) { if (copy != null) { return copy.getRealPath(path); } else { return path; } } public String getRemoteAddr() { return remoteAddr; } public String getRemoteHost() { return remoteHost; } public int getRemotePort() { if (copy != null) { return copy.getRemotePort(); } else { return DEFAULT_SERVER_PORT; } } public String getRemoteUser() { return copy.getRemoteUser(); } private boolean realDispatcher = false; /** * @param real if true and there is a real RequestDispatcher available then use it, * otherwise just emulate a forward/include call using the fake one * (will always use the fake one if no real one is found) */ public void setUseRealDispatcher(boolean real) { this.realDispatcher = real; } /* (non-Javadoc) * @see javax.servlet.ServletRequest#getRequestDispatcher(java.lang.String) */ public RequestDispatcher getRequestDispatcher(String path) { if (this.copy != null && this.realDispatcher) { return this.copy.getRequestDispatcher(path); } else { return new EntityRequestDispatcher(path); } } public String getScheme() { return scheme; } public String getServerName() { return serverName; } public int getServerPort() { return serverPort; } public String getRequestedSessionId() { if (copy != null) { return copy.getRequestedSessionId(); } else { return getInternalSession().getId(); } } public HttpSession getSession() { if (copy != null) { return copy.getSession(); } else { return getInternalSession(); } } public HttpSession getSession(boolean create) { if (copy != null) { return copy.getSession(create); } else { return getInternalSession(); } } private HttpSession getInternalSession() { if (internalSession == null) { internalSession = new EntityHttpSession(); } return internalSession; } public Principal getUserPrincipal() { if (copy != null) { return copy.getUserPrincipal(); } else { return null; } } public boolean isRequestedSessionIdFromCookie() { if (copy != null) { return copy.isRequestedSessionIdFromCookie(); } else { return false; } } public boolean isRequestedSessionIdFromUrl() { if (copy != null) { return copy.isRequestedSessionIdFromUrl(); } else { return false; } } public boolean isRequestedSessionIdFromURL() { if (copy != null) { return copy.isRequestedSessionIdFromURL(); } else { return false; } } public boolean isRequestedSessionIdValid() { if (copy != null) { return copy.isRequestedSessionIdValid(); } else { return true; } } public boolean isSecure() { if (copy != null) { return copy.isSecure(); } else { return false; } } public boolean isUserInRole(String role) { if (copy != null) { return copy.isUserInRole(role); } else { return false; } } /** * A non-functional request dispatcher, based on the spring mock version */ public static class EntityRequestDispatcher implements RequestDispatcher { private final String url; /** * Create a new EntityRequestDispatcher * @param url the URL to dispatch to */ public EntityRequestDispatcher(String url) { if (url == null) { throw new IllegalArgumentException("url cannot be null"); } this.url = url; } public void forward(ServletRequest request, ServletResponse response) { if (request == null || response == null) { throw new IllegalArgumentException("request and response cannot be null"); } if (response.isCommitted()) { throw new IllegalStateException("Cannot perform forward - response is already committed"); } getEntityHttpServletResponse(response).setForwardedUrl(this.url); } public void include(ServletRequest request, ServletResponse response) { if (request == null || response == null) { throw new IllegalArgumentException("request and response cannot be null"); } getEntityHttpServletResponse(response).setIncludedUrl(this.url); } protected EntityHttpServletResponse getEntityHttpServletResponse(ServletResponse response) { if (response instanceof EntityHttpServletResponse) { return (EntityHttpServletResponse) response; } if (response instanceof HttpServletResponseWrapper) { return getEntityHttpServletResponse(((HttpServletResponseWrapper) response).getResponse()); } throw new IllegalArgumentException("EntityRequestDispatcher requires EntityHttpServletResponse"); } } /** * For testing, based on the spring Mock version */ public static class EntityServletContext implements ServletContext { public static final String TEMP_DIR_CONTEXT_ATTRIBUTE = "javax.servlet.context.tempdir"; private static final String TEMP_DIR_SYSTEM_PROPERTY = "java.io.tmpdir"; private final String resourceBasePath; private String contextPath = ""; private final Map contexts = new HashMap(); private final Properties initParameters = new Properties(); private final Hashtable<String, Object> attributes = new Hashtable<String, Object>(); private String servletContextName = "MockServletContext"; /** * Create a new MockServletContext, using no base path and a * DefaultResourceLoader (i.e. the classpath root as WAR root). * @see org.springframework.core.io.DefaultResourceLoader */ public EntityServletContext() { this(""); } /** * Create a new MockServletContext, using a DefaultResourceLoader. * @param resourceBasePath the WAR root directory (should not end with a slash) * @see org.springframework.core.io.DefaultResourceLoader */ public EntityServletContext(String resourceBasePath) { this.resourceBasePath = (resourceBasePath != null ? resourceBasePath : ""); // Use JVM temp dir as ServletContext temp dir. String tempDir = System.getProperty(TEMP_DIR_SYSTEM_PROPERTY); if (tempDir != null) { this.attributes.put(TEMP_DIR_CONTEXT_ATTRIBUTE, new File(tempDir)); } } protected File getResourceFile(String path) { File f = new File(path); return f; } /** * Build a full resource location for the given path, * prepending the resource base path of this MockServletContext. * @param path the path as specified * @return the full resource path */ protected String getResourceLocation(String path) { if (!path.startsWith("/")) { path = "/" + path; } return this.resourceBasePath + path; } public void setContextPath(String contextPath) { this.contextPath = (contextPath != null ? contextPath : ""); } /* This is a Servlet API 2.5 method. */ public String getContextPath() { return this.contextPath; } public void registerContext(String contextPath, ServletContext context) { this.contexts.put(contextPath, context); } public ServletContext getContext(String contextPath) { if (this.contextPath.equals(contextPath)) { return this; } return (ServletContext) this.contexts.get(contextPath); } public int getMajorVersion() { return 2; } public int getMinorVersion() { return 5; } public String getMimeType(String filePath) { return MimeTypeResolver.getMimeType(filePath); } public Set getResourcePaths(String path) { String actualPath = (path.endsWith("/") ? path : path + "/"); try { File file = getResourceFile(getResourceLocation(actualPath)); String[] fileList = file.list(); if (fileList == null || fileList.length == 0) { return null; } Set<String> resourcePaths = new LinkedHashSet<String>(fileList.length); for (int i = 0; i < fileList.length; i++) { String resultPath = actualPath + fileList[i]; File f = getResourceFile(resultPath); if (f.isDirectory()) { resultPath += "/"; } resourcePaths.add(resultPath); } return resourcePaths; } catch (Exception ex) { return null; } } public URL getResource(String path) throws MalformedURLException { File file = getResourceFile(getResourceLocation(path)); if (!file.exists()) { return null; } try { return file.toURL(); } catch (MalformedURLException ex) { throw ex; } } public InputStream getResourceAsStream(String path) { File file = getResourceFile(getResourceLocation(path)); if (!file.exists()) { return null; } try { InputStream stream = new BufferedInputStream( new FileInputStream(file) ); return stream; } catch (IOException ex) { return null; } } public RequestDispatcher getRequestDispatcher(String path) { if (!path.startsWith("/")) { throw new IllegalArgumentException("RequestDispatcher path at ServletContext level must start with '/'"); } return new EntityRequestDispatcher(path); } public RequestDispatcher getNamedDispatcher(String path) { return null; } public Servlet getServlet(String name) { return null; } public Enumeration getServlets() { return Collections.enumeration(Collections.EMPTY_SET); } public Enumeration getServletNames() { return Collections.enumeration(Collections.EMPTY_SET); } public void log(String message) { } public void log(Exception ex, String message) { } public void log(String message, Throwable ex) { } public String getRealPath(String path) { File file = getResourceFile(getResourceLocation(path)); return file.getAbsolutePath(); } public String getServerInfo() { return "MockServletContext"; } public String getInitParameter(String name) { if (name == null) { throw new IllegalArgumentException("name cannot be null"); } return this.initParameters.getProperty(name); } public void addInitParameter(String name, String value) { if (name == null) { throw new IllegalArgumentException("name cannot be null"); } this.initParameters.setProperty(name, value); } public Enumeration getInitParameterNames() { return this.initParameters.keys(); } public Object getAttribute(String name) { if (name == null) { throw new IllegalArgumentException("name cannot be null"); } return this.attributes.get(name); } public Enumeration getAttributeNames() { return this.attributes.keys(); } public void setAttribute(String name, Object value) { if (name == null) { throw new IllegalArgumentException("name cannot be null"); } if (value != null) { this.attributes.put(name, value); } else { this.attributes.remove(name); } } public void removeAttribute(String name) { if (name == null) { throw new IllegalArgumentException("name cannot be null"); } this.attributes.remove(name); } public void setServletContextName(String servletContextName) { this.servletContextName = servletContextName; } public String getServletContextName() { return this.servletContextName; } } private static class MimeTypeResolver { public static String getMimeType(String filePath) { return "text/plain"; } } /** * A fake session for testing, from the spring mock session */ public static class EntityHttpSession implements HttpSession { public static final String SESSION_COOKIE_NAME = "JSESSION"; private static int nextId = 1; private final String id; private final long creationTime = System.currentTimeMillis(); private int maxInactiveInterval; private long lastAccessedTime = System.currentTimeMillis(); private final ServletContext servletContext; private final Hashtable<String, Object> attributes = new Hashtable<String, Object>(); private boolean invalid = false; private boolean isNew = true; /** * Create a new MockHttpSession with a default {@link MockServletContext}. * @see MockServletContext */ public EntityHttpSession() { this(null); } /** * Create a new MockHttpSession. * @param servletContext the ServletContext that the session runs in */ public EntityHttpSession(ServletContext servletContext) { this(servletContext, null); } /** * Create a new MockHttpSession. * @param servletContext the ServletContext that the session runs in * @param id a unique identifier for this session */ public EntityHttpSession(ServletContext servletContext, String id) { this.servletContext = (servletContext != null ? servletContext : new EntityServletContext()); this.id = (id != null ? id : Integer.toString(nextId++)); } public long getCreationTime() { return this.creationTime; } public String getId() { return this.id; } public void access() { this.lastAccessedTime = System.currentTimeMillis(); this.isNew = false; } public long getLastAccessedTime() { return this.lastAccessedTime; } public ServletContext getServletContext() { return this.servletContext; } public void setMaxInactiveInterval(int interval) { this.maxInactiveInterval = interval; } public int getMaxInactiveInterval() { return this.maxInactiveInterval; } public HttpSessionContext getSessionContext() { throw new UnsupportedOperationException("getSessionContext"); } public Object getAttribute(String name) { if (name == null) { throw new IllegalArgumentException("name must not be null"); } return this.attributes.get(name); } public Object getValue(String name) { return getAttribute(name); } public Enumeration getAttributeNames() { return this.attributes.keys(); } public String[] getValueNames() { return (String[]) this.attributes.keySet().toArray(new String[this.attributes.size()]); } public void setAttribute(String name, Object value) { if (name == null) { throw new IllegalArgumentException("name must not be null"); } if (value != null) { this.attributes.put(name, value); if (value instanceof HttpSessionBindingListener) { ((HttpSessionBindingListener) value).valueBound(new HttpSessionBindingEvent(this, name, value)); } } else { removeAttribute(name); } } public void putValue(String name, Object value) { setAttribute(name, value); } public void removeAttribute(String name) { if (name == null) { throw new IllegalArgumentException("name must not be null"); } Object value = this.attributes.remove(name); if (value instanceof HttpSessionBindingListener) { ((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value)); } } public void removeValue(String name) { removeAttribute(name); } /** * Clear all of this session's attributes. */ public void clearAttributes() { for (Iterator it = this.attributes.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); it.remove(); if (value instanceof HttpSessionBindingListener) { ((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value)); } } } public void invalidate() { this.invalid = true; clearAttributes(); } public boolean isInvalid() { return this.invalid; } public void setNew(boolean value) { this.isNew = value; } public boolean isNew() { return this.isNew; } /** * Serialize the attributes of this session into an object that can * be turned into a byte array with standard Java serialization. * @return a representation of this session's serialized state */ public Serializable serializeState() { HashMap<String, Object> state = new HashMap<String, Object>(); for (Iterator it = this.attributes.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); it.remove(); if (value instanceof Serializable) { state.put(name, value); } else { if (value instanceof HttpSessionBindingListener) { ((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value)); } } } return state; } /** * Deserialize the attributes of this session from a state object * created by {@link #serializeState()}. * @param state a representation of this session's serialized state */ public void deserializeState(Serializable state) { this.attributes.putAll((Map) state); } } }
{ "content_hash": "05fad23db68db76d73ac3f54b416cc2c", "timestamp": "", "source": "github", "line_count": 1465, "max_line_length": 122, "avg_line_length": 31.612286689419797, "alnum_prop": 0.572594575919848, "repo_name": "eemirtekin/Sakai-10.6-TR", "id": "e3927419c7b29dfa4c4306ad7a5026c1732470c8", "size": "47451", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "entitybroker/utils/src/java/org/sakaiproject/entitybroker/util/http/EntityHttpServletRequest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "59098" }, { "name": "Batchfile", "bytes": "6366" }, { "name": "C++", "bytes": "6402" }, { "name": "CSS", "bytes": "2616828" }, { "name": "ColdFusion", "bytes": "146057" }, { "name": "HTML", "bytes": "5982358" }, { "name": "Java", "bytes": "49585098" }, { "name": "JavaScript", "bytes": "6722774" }, { "name": "Lasso", "bytes": "26436" }, { "name": "PHP", "bytes": "223840" }, { "name": "PLSQL", "bytes": "2163243" }, { "name": "Perl", "bytes": "102776" }, { "name": "Python", "bytes": "87575" }, { "name": "Ruby", "bytes": "3606" }, { "name": "Shell", "bytes": "33041" }, { "name": "SourcePawn", "bytes": "2274" }, { "name": "XSLT", "bytes": "607759" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_72) on Sat Nov 22 23:36:40 CET 2014 --> <title>SymbolTable (MaltParser 1.8.1)</title> <meta name="date" content="2014-11-22"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="SymbolTable (MaltParser 1.8.1)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/SymbolTable.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><em><b>MaltParser 1.8.1</b></em></div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/maltparser/core/symbol/SymbolException.html" title="class in org.maltparser.core.symbol"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../org/maltparser/core/symbol/SymbolTableHandler.html" title="interface in org.maltparser.core.symbol"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/maltparser/core/symbol/SymbolTable.html" target="_top">Frames</a></li> <li><a href="SymbolTable.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.maltparser.core.symbol</div> <h2 title="Interface SymbolTable" class="title">Interface SymbolTable</h2> </div> <div class="contentContainer"> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Superinterfaces:</dt> <dd><a href="../../../../org/maltparser/core/symbol/Table.html" title="interface in org.maltparser.core.symbol">Table</a></dd> </dl> <dl> <dt>All Known Implementing Classes:</dt> <dd><a href="../../../../org/maltparser/core/symbol/hash/HashSymbolTable.html" title="class in org.maltparser.core.symbol.hash">HashSymbolTable</a>, <a href="../../../../org/maltparser/core/symbol/parse/ParseSymbolTable.html" title="class in org.maltparser.core.symbol.parse">ParseSymbolTable</a>, <a href="../../../../org/maltparser/core/symbol/trie/TrieSymbolTable.html" title="class in org.maltparser.core.symbol.trie">TrieSymbolTable</a></dd> </dl> <hr> <br> <pre>public interface <a href="../../../../src-html/org/maltparser/core/symbol/SymbolTable.html#line.9">SymbolTable</a> extends <a href="../../../../org/maltparser/core/symbol/Table.html" title="interface in org.maltparser.core.symbol">Table</a></pre> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method_summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../../org/maltparser/core/symbol/SymbolTable.html#getNullValueCode(org.maltparser.core.symbol.nullvalue.NullValues.NullValueId)">getNullValueCode</a></strong>(<a href="../../../../org/maltparser/core/symbol/nullvalue/NullValues.NullValueId.html" title="enum in org.maltparser.core.symbol.nullvalue">NullValues.NullValueId</a>&nbsp;nullValueIdentifier)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>java.lang.String</code></td> <td class="colLast"><code><strong><a href="../../../../org/maltparser/core/symbol/SymbolTable.html#getNullValueSymbol(org.maltparser.core.symbol.nullvalue.NullValues.NullValueId)">getNullValueSymbol</a></strong>(<a href="../../../../org/maltparser/core/symbol/nullvalue/NullValues.NullValueId.html" title="enum in org.maltparser.core.symbol.nullvalue">NullValues.NullValueId</a>&nbsp;nullValueIdentifier)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../../org/maltparser/core/symbol/SymbolTable.html#getValueCounter()">getValueCounter</a></strong>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../../org/maltparser/core/symbol/SymbolTable.html#isNullValue(int)">isNullValue</a></strong>(int&nbsp;code)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../../org/maltparser/core/symbol/SymbolTable.html#isNullValue(java.lang.String)">isNullValue</a></strong>(java.lang.String&nbsp;value)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../org/maltparser/core/symbol/SymbolTable.html#load(java.io.BufferedReader)">load</a></strong>(java.io.BufferedReader&nbsp;in)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>java.lang.String</code></td> <td class="colLast"><code><strong><a href="../../../../org/maltparser/core/symbol/SymbolTable.html#printSymbolTable()">printSymbolTable</a></strong>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../org/maltparser/core/symbol/SymbolTable.html#save(java.io.BufferedWriter)">save</a></strong>(java.io.BufferedWriter&nbsp;out)</code>&nbsp;</td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_org.maltparser.core.symbol.Table"> <!-- --> </a> <h3>Methods inherited from interface&nbsp;org.maltparser.core.symbol.<a href="../../../../org/maltparser/core/symbol/Table.html" title="interface in org.maltparser.core.symbol">Table</a></h3> <code><a href="../../../../org/maltparser/core/symbol/Table.html#addSymbol(java.lang.String)">addSymbol</a>, <a href="../../../../org/maltparser/core/symbol/Table.html#getName()">getName</a>, <a href="../../../../org/maltparser/core/symbol/Table.html#getSymbolCodeToString(int)">getSymbolCodeToString</a>, <a href="../../../../org/maltparser/core/symbol/Table.html#getSymbolStringToCode(java.lang.String)">getSymbolStringToCode</a>, <a href="../../../../org/maltparser/core/symbol/Table.html#size()">size</a></code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method_detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="printSymbolTable()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>printSymbolTable</h4> <pre>java.lang.String&nbsp;<a href="../../../../src-html/org/maltparser/core/symbol/SymbolTable.html#line.10">printSymbolTable</a>() throws <a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></pre> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></code></dd></dl> </li> </ul> <a name="save(java.io.BufferedWriter)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>save</h4> <pre>void&nbsp;<a href="../../../../src-html/org/maltparser/core/symbol/SymbolTable.html#line.11">save</a>(java.io.BufferedWriter&nbsp;out) throws <a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></pre> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></code></dd></dl> </li> </ul> <a name="load(java.io.BufferedReader)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>load</h4> <pre>void&nbsp;<a href="../../../../src-html/org/maltparser/core/symbol/SymbolTable.html#line.12">load</a>(java.io.BufferedReader&nbsp;in) throws <a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></pre> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></code></dd></dl> </li> </ul> <a name="getValueCounter()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getValueCounter</h4> <pre>int&nbsp;<a href="../../../../src-html/org/maltparser/core/symbol/SymbolTable.html#line.13">getValueCounter</a>()</pre> </li> </ul> <a name="getNullValueCode(org.maltparser.core.symbol.nullvalue.NullValues.NullValueId)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getNullValueCode</h4> <pre>int&nbsp;<a href="../../../../src-html/org/maltparser/core/symbol/SymbolTable.html#line.14">getNullValueCode</a>(<a href="../../../../org/maltparser/core/symbol/nullvalue/NullValues.NullValueId.html" title="enum in org.maltparser.core.symbol.nullvalue">NullValues.NullValueId</a>&nbsp;nullValueIdentifier) throws <a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></pre> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></code></dd></dl> </li> </ul> <a name="getNullValueSymbol(org.maltparser.core.symbol.nullvalue.NullValues.NullValueId)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getNullValueSymbol</h4> <pre>java.lang.String&nbsp;<a href="../../../../src-html/org/maltparser/core/symbol/SymbolTable.html#line.15">getNullValueSymbol</a>(<a href="../../../../org/maltparser/core/symbol/nullvalue/NullValues.NullValueId.html" title="enum in org.maltparser.core.symbol.nullvalue">NullValues.NullValueId</a>&nbsp;nullValueIdentifier) throws <a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></pre> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></code></dd></dl> </li> </ul> <a name="isNullValue(java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isNullValue</h4> <pre>boolean&nbsp;<a href="../../../../src-html/org/maltparser/core/symbol/SymbolTable.html#line.16">isNullValue</a>(java.lang.String&nbsp;value) throws <a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></pre> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></code></dd></dl> </li> </ul> <a name="isNullValue(int)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>isNullValue</h4> <pre>boolean&nbsp;<a href="../../../../src-html/org/maltparser/core/symbol/SymbolTable.html#line.17">isNullValue</a>(int&nbsp;code) throws <a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></pre> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../../org/maltparser/core/exception/MaltChainedException.html" title="class in org.maltparser.core.exception">MaltChainedException</a></code></dd></dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/SymbolTable.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><em><b>MaltParser 1.8.1</b></em></div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/maltparser/core/symbol/SymbolException.html" title="class in org.maltparser.core.symbol"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../org/maltparser/core/symbol/SymbolTableHandler.html" title="interface in org.maltparser.core.symbol"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/maltparser/core/symbol/SymbolTable.html" target="_top">Frames</a></li> <li><a href="SymbolTable.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright 2007-2014 Johan Hall, Jens Nilsson and Joakim Nivre.</small></p> </body> </html>
{ "content_hash": "2c933b04ac55e23fd133ff71c9e1bfee", "timestamp": "", "source": "github", "line_count": 337, "max_line_length": 520, "avg_line_length": 48.225519287833826, "alnum_prop": 0.6637336943145459, "repo_name": "jerryyeezus/nlp-summarization", "id": "986b1bb11a854dc27ec5c3804cbc5ef2a58eb6a5", "size": "16252", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "maltparser/docs/api/org/maltparser/core/symbol/SymbolTable.html", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "10226" }, { "name": "CSS", "bytes": "30720" }, { "name": "E", "bytes": "2831" }, { "name": "Forth", "bytes": "2657" }, { "name": "Java", "bytes": "1774038" }, { "name": "Perl", "bytes": "108222" }, { "name": "Python", "bytes": "98753" }, { "name": "Shell", "bytes": "924" }, { "name": "TeX", "bytes": "7823" }, { "name": "XSLT", "bytes": "11436" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using System.Net.Http.Headers; using System.Web.Http; using System.Web.Http.Description; using RestOfUs.Api.WebApi.Areas.HelpPage.Models; namespace RestOfUs.Api.WebApi.Areas.HelpPage { public static class HelpPageConfigurationExtensions { private const string ApiModelPrefix = "MS_HelpPageApiModel_"; /// <summary> /// Sets the documentation provider for help page. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="documentationProvider">The documentation provider.</param> public static void SetDocumentationProvider(this HttpConfiguration config, IDocumentationProvider documentationProvider) { config.Services.Replace(typeof(IDocumentationProvider), documentationProvider); } /// <summary> /// Sets the objects that will be used by the formatters to produce sample requests/responses. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="sampleObjects">The sample objects.</param> public static void SetSampleObjects(this HttpConfiguration config, IDictionary<Type, object> sampleObjects) { config.GetHelpPageSampleGenerator().SampleObjects = sampleObjects; } /// <summary> /// Sets the sample request directly for the specified media type and action. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="sample">The sample request.</param> /// <param name="mediaType">The media type.</param> /// <param name="controllerName">Name of the controller.</param> /// <param name="actionName">Name of the action.</param> public static void SetSampleRequest(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName) { config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Request, controllerName, actionName, new[] { "*" }), sample); } /// <summary> /// Sets the sample request directly for the specified media type and action with parameters. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="sample">The sample request.</param> /// <param name="mediaType">The media type.</param> /// <param name="controllerName">Name of the controller.</param> /// <param name="actionName">Name of the action.</param> /// <param name="parameterNames">The parameter names.</param> public static void SetSampleRequest(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName, params string[] parameterNames) { config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Request, controllerName, actionName, parameterNames), sample); } /// <summary> /// Sets the sample request directly for the specified media type of the action. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="sample">The sample response.</param> /// <param name="mediaType">The media type.</param> /// <param name="controllerName">Name of the controller.</param> /// <param name="actionName">Name of the action.</param> public static void SetSampleResponse(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName) { config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Response, controllerName, actionName, new[] { "*" }), sample); } /// <summary> /// Sets the sample response directly for the specified media type of the action with specific parameters. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="sample">The sample response.</param> /// <param name="mediaType">The media type.</param> /// <param name="controllerName">Name of the controller.</param> /// <param name="actionName">Name of the action.</param> /// <param name="parameterNames">The parameter names.</param> public static void SetSampleResponse(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName, params string[] parameterNames) { config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Response, controllerName, actionName, parameterNames), sample); } /// <summary> /// Sets the sample directly for all actions with the specified type and media type. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="sample">The sample.</param> /// <param name="mediaType">The media type.</param> /// <param name="type">The parameter type or return type of an action.</param> public static void SetSampleForType(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, Type type) { config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, type), sample); } /// <summary> /// Specifies the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> passed to the <see cref="System.Net.Http.HttpRequestMessage"/> in an action. /// The help page will use this information to produce more accurate request samples. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="type">The type.</param> /// <param name="controllerName">Name of the controller.</param> /// <param name="actionName">Name of the action.</param> public static void SetActualRequestType(this HttpConfiguration config, Type type, string controllerName, string actionName) { config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Request, controllerName, actionName, new[] { "*" }), type); } /// <summary> /// Specifies the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> passed to the <see cref="System.Net.Http.HttpRequestMessage"/> in an action. /// The help page will use this information to produce more accurate request samples. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="type">The type.</param> /// <param name="controllerName">Name of the controller.</param> /// <param name="actionName">Name of the action.</param> /// <param name="parameterNames">The parameter names.</param> public static void SetActualRequestType(this HttpConfiguration config, Type type, string controllerName, string actionName, params string[] parameterNames) { config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Request, controllerName, actionName, parameterNames), type); } /// <summary> /// Specifies the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> returned as part of the <see cref="System.Net.Http.HttpRequestMessage"/> in an action. /// The help page will use this information to produce more accurate response samples. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="type">The type.</param> /// <param name="controllerName">Name of the controller.</param> /// <param name="actionName">Name of the action.</param> public static void SetActualResponseType(this HttpConfiguration config, Type type, string controllerName, string actionName) { config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Response, controllerName, actionName, new[] { "*" }), type); } /// <summary> /// Specifies the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> returned as part of the <see cref="System.Net.Http.HttpRequestMessage"/> in an action. /// The help page will use this information to produce more accurate response samples. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="type">The type.</param> /// <param name="controllerName">Name of the controller.</param> /// <param name="actionName">Name of the action.</param> /// <param name="parameterNames">The parameter names.</param> public static void SetActualResponseType(this HttpConfiguration config, Type type, string controllerName, string actionName, params string[] parameterNames) { config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Response, controllerName, actionName, parameterNames), type); } /// <summary> /// Gets the help page sample generator. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <returns>The help page sample generator.</returns> public static HelpPageSampleGenerator GetHelpPageSampleGenerator(this HttpConfiguration config) { return (HelpPageSampleGenerator)config.Properties.GetOrAdd( typeof(HelpPageSampleGenerator), k => new HelpPageSampleGenerator()); } /// <summary> /// Sets the help page sample generator. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="sampleGenerator">The help page sample generator.</param> public static void SetHelpPageSampleGenerator(this HttpConfiguration config, HelpPageSampleGenerator sampleGenerator) { config.Properties.AddOrUpdate( typeof(HelpPageSampleGenerator), k => sampleGenerator, (k, o) => sampleGenerator); } /// <summary> /// Gets the model that represents an API displayed on the help page. The model is initialized on the first call and cached for subsequent calls. /// </summary> /// <param name="config">The <see cref="HttpConfiguration"/>.</param> /// <param name="apiDescriptionId">The <see cref="ApiDescription"/> ID.</param> /// <returns> /// An <see cref="HelpPageApiModel"/> /// </returns> public static HelpPageApiModel GetHelpPageApiModel(this HttpConfiguration config, string apiDescriptionId) { object model; string modelId = ApiModelPrefix + apiDescriptionId; if (!config.Properties.TryGetValue(modelId, out model)) { Collection<ApiDescription> apiDescriptions = config.Services.GetApiExplorer().ApiDescriptions; ApiDescription apiDescription = apiDescriptions.FirstOrDefault(api => String.Equals(api.GetFriendlyId(), apiDescriptionId, StringComparison.OrdinalIgnoreCase)); if (apiDescription != null) { HelpPageSampleGenerator sampleGenerator = config.GetHelpPageSampleGenerator(); model = GenerateApiModel(apiDescription, sampleGenerator); config.Properties.TryAdd(modelId, model); } } return (HelpPageApiModel)model; } [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "The exception is recorded as ErrorMessages.")] private static HelpPageApiModel GenerateApiModel(ApiDescription apiDescription, HelpPageSampleGenerator sampleGenerator) { HelpPageApiModel apiModel = new HelpPageApiModel(); apiModel.ApiDescription = apiDescription; try { foreach (var item in sampleGenerator.GetSampleRequests(apiDescription)) { apiModel.SampleRequests.Add(item.Key, item.Value); LogInvalidSampleAsError(apiModel, item.Value); } foreach (var item in sampleGenerator.GetSampleResponses(apiDescription)) { apiModel.SampleResponses.Add(item.Key, item.Value); LogInvalidSampleAsError(apiModel, item.Value); } } catch (Exception e) { apiModel.ErrorMessages.Add(String.Format(CultureInfo.CurrentCulture, "An exception has occurred while generating the sample. Exception Message: {0}", e.Message)); } return apiModel; } private static void LogInvalidSampleAsError(HelpPageApiModel apiModel, object sample) { InvalidSample invalidSample = sample as InvalidSample; if (invalidSample != null) { apiModel.ErrorMessages.Add(invalidSample.ErrorMessage); } } } }
{ "content_hash": "f373affb312d62140d8c11b4b3b0e538", "timestamp": "", "source": "github", "line_count": 247, "max_line_length": 196, "avg_line_length": 55.53846153846154, "alnum_prop": 0.6541040968071148, "repo_name": "dylanbeattie/RestOfUs", "id": "8adcd26e89fd7f378ddb0b57838ef3d87f873ef2", "size": "13718", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/RestOfUs.Api.WebApi/Areas/HelpPage/HelpPageConfigurationExtensions.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "321" }, { "name": "C#", "bytes": "131289" }, { "name": "CSS", "bytes": "15158" }, { "name": "JavaScript", "bytes": "572" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <RelativeLayout android:id="@+id/message_relativelayout" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="10dp" android:layout_weight="1"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/request_item_background" android:minHeight="40dp"> <TextView android:id="@+id/request_textview" android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout> </RelativeLayout> <Button android:id="@+id/accept_button" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" android:text="@string/accept_button" /> <Button android:id="@+id/decline_button" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:text="@string/decline_button" /> </LinearLayout>
{ "content_hash": "e396e2a6b183a88535c96b0a8f07feb6", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 72, "avg_line_length": 33.93181818181818, "alnum_prop": 0.6249162759544541, "repo_name": "zt7584/HierarchyChat", "id": "fe820e4cfea7cad0dacbdea92c7eb47152c8fa4a", "size": "1493", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/layout/request_item.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "65504" } ], "symlink_target": "" }
Jails is a framework for .NET that simplifies the task of running code in an isolated environment. It comes bundled with an AppDomain isolator which lets you sandbox code in a separate AppDomain. Currently, it supports two ways of interacting with your sandboxed class. Either through a `dynamic` proxy, or a typed proxy. The typed proxy lets you specify an interface that acts as a strongly typed proxy. *It is currently in early alpha and may or may not support your specific use case. Please create an issue if you feel something is wrong or missing.* ## Getting started ### Install the latest version of Jails from NuGet. ```posh Install-Package Jails ``` ### Isolate external assemblies (using a dynamic proxy) ```csharp // Create the AppDomain isolator. By default it only gives the "Execute" // permission. var isolator = new AppDomainIsolator(); // Create an environment and register an assembly name with it. // This will load the assembly in our jailed domain. var environment = new DefaultEnvironment(); environment.Register(@"C:\Temp\UntrustedAssembly.dll"); using(var jail = Jail.Create(isolator, environment)) { // Create a real dynamic proxy which will forward any calls to the // internally created instance of "Some.Untrusted.Class". dynamic proxy = jail.Resolve("Some.Untrusted.Class"); // Invoke the method "Run" passing two arguments. Both method name and // argument types must match "Some.External.Class". string result = proxy.Run("argument1", 2); Console.WriteLine(result); } ``` For more information, [see the wiki](https://github.com/jailsfx/jails/wiki) ## FAQ - **Why use Jails?** Sandboxing code can sometimes be tricky. It doesn't have to be, but Jails try to provide a layer of abstraction on top of sandboxes built with AppDomains and processes. - **Why strong naming?** Strong naming Jails is done to be able to give it full trust in the jailed domain. I know of no other way to accomplish this.
{ "content_hash": "70dd5354df6eb8034ed649d5220b1a99", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 208, "avg_line_length": 42.93617021276596, "alnum_prop": 0.7338949454905848, "repo_name": "jailsfx/jails", "id": "88a12bec90fbaa2cf8140b8361a9eea017cac558", "size": "2027", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "30314" } ], "symlink_target": "" }
A collection of Koans to illuminate the story of using Muon
{ "content_hash": "d57849b4b31179f599c833da168a57dd", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 59, "avg_line_length": 60, "alnum_prop": 0.8166666666666667, "repo_name": "russmiles/muon-koans", "id": "917535bfc552d693bb061168e61364a062fade19", "size": "73", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
using namespace Kore; static const int textureCount = 16; Graphics5::RenderTarget* currentRenderTargets[textureCount] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; Graphics5::Texture* currentTextures[textureCount] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; void Texture5Impl::setTextures(ID3D12GraphicsCommandList* commandList) { if (currentRenderTargets[0] != nullptr) { ID3D12DescriptorHeap* heaps[textureCount]; for (int i = 0; i < textureCount; ++i) { heaps[i] = currentRenderTargets[i] == nullptr ? nullptr : currentRenderTargets[i]->srvDescriptorHeap; } commandList->SetDescriptorHeaps(1, heaps); commandList->SetGraphicsRootDescriptorTable(0, currentRenderTargets[0]->srvDescriptorHeap->GetGPUDescriptorHandleForHeapStart()); } if (currentTextures[0] != nullptr) { ID3D12DescriptorHeap* heaps[textureCount]; for (int i = 0; i < textureCount; ++i) { heaps[i] = currentTextures[i] == nullptr ? nullptr : currentTextures[i]->srvDescriptorHeap; } commandList->SetDescriptorHeaps(1, heaps); commandList->SetGraphicsRootDescriptorTable(0, currentTextures[0]->srvDescriptorHeap->GetGPUDescriptorHandleForHeapStart()); } } void Graphics5::Texture::_init(const char* format, bool readable) { stage = 0; mipmap = true; texWidth = width; texHeight = height; device->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, texWidth, texHeight, 1, 1), D3D12_RESOURCE_STATE_COPY_DEST, nullptr, IID_GRAPHICS_PPV_ARGS(&image)); const UINT64 uploadBufferSize = GetRequiredIntermediateSize(image, 0, 1); device->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD), D3D12_HEAP_FLAG_NONE, &CD3DX12_RESOURCE_DESC::Buffer(uploadBufferSize), D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_GRAPHICS_PPV_ARGS(&uploadImage)); BYTE* pixel; uploadImage->Map(0, nullptr, reinterpret_cast<void**>(&pixel)); int pitch = stride(); for (int y = 0; y < height; ++y) { memcpy(&pixel[y * pitch], &this->data[y * width * 4], width * 4); } uploadImage->Unmap(0, nullptr); D3D12_DESCRIPTOR_HEAP_DESC descriptorHeapDesc = {}; descriptorHeapDesc.NumDescriptors = 1; descriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; descriptorHeapDesc.NodeMask = 0; descriptorHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; device->CreateDescriptorHeap(&descriptorHeapDesc, IID_GRAPHICS_PPV_ARGS(&srvDescriptorHeap)); D3D12_SHADER_RESOURCE_VIEW_DESC shaderResourceViewDesc = {}; shaderResourceViewDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; shaderResourceViewDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; shaderResourceViewDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; shaderResourceViewDesc.Texture2D.MipLevels = 1; shaderResourceViewDesc.Texture2D.MostDetailedMip = 0; shaderResourceViewDesc.Texture2D.ResourceMinLODClamp = 0.0f; device->CreateShaderResourceView(image, &shaderResourceViewDesc, srvDescriptorHeap->GetCPUDescriptorHandleForHeapStart()); if (!readable) { delete[] this->data; this->data = nullptr; } } Graphics5::Texture::Texture(int width, int height, Format format, bool readable) : Image(width, height, format, readable) { stage = 0; mipmap = true; texWidth = width; texHeight = height; DXGI_FORMAT d3dformat = (format == Image::RGBA32 ? DXGI_FORMAT_R8G8B8A8_UNORM_SRGB : DXGI_FORMAT_R8_UNORM); device->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &CD3DX12_RESOURCE_DESC::Tex2D(d3dformat, texWidth, texHeight, 1, 1), D3D12_RESOURCE_STATE_COPY_DEST, nullptr, IID_GRAPHICS_PPV_ARGS(&image)); const UINT64 uploadBufferSize = GetRequiredIntermediateSize(image, 0, 1); device->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD), D3D12_HEAP_FLAG_NONE, &CD3DX12_RESOURCE_DESC::Buffer(uploadBufferSize), D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_GRAPHICS_PPV_ARGS(&uploadImage)); D3D12_DESCRIPTOR_HEAP_DESC descriptorHeapDesc = {}; descriptorHeapDesc.NumDescriptors = 1; descriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; descriptorHeapDesc.NodeMask = 0; descriptorHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; device->CreateDescriptorHeap(&descriptorHeapDesc, IID_GRAPHICS_PPV_ARGS(&srvDescriptorHeap)); D3D12_SHADER_RESOURCE_VIEW_DESC shaderResourceViewDesc = {}; shaderResourceViewDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; shaderResourceViewDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; shaderResourceViewDesc.Format = d3dformat; shaderResourceViewDesc.Texture2D.MipLevels = 1; shaderResourceViewDesc.Texture2D.MostDetailedMip = 0; shaderResourceViewDesc.Texture2D.ResourceMinLODClamp = 0.0f; device->CreateShaderResourceView(image, &shaderResourceViewDesc, srvDescriptorHeap->GetCPUDescriptorHandleForHeapStart()); } Graphics5::Texture::Texture(int width, int height, int depth, Image::Format format, bool readable) : Image(width, height, depth, format, readable) {} Texture5Impl::~Texture5Impl() { unset(); } void Texture5Impl::unmipmap() { mipmap = false; } void Graphics5::Texture::_set(TextureUnit unit) { if (unit.unit < 0) return; // context->PSSetShaderResources(unit.unit, 1, &view); this->stage = unit.unit; currentTextures[stage] = this; currentRenderTargets[stage] = nullptr; } void Texture5Impl::unset() { if (currentTextures[stage] == this) { currentTextures[stage] = nullptr; } } u8* Graphics5::Texture::lock() { return (u8*)this->data; } void Graphics5::Texture::unlock() { BYTE* pixel; uploadImage->Map(0, nullptr, reinterpret_cast<void**>(&pixel)); int pitch = stride(); for (int y = 0; y < height; ++y) { memcpy(&pixel[y * pitch], &this->data[y * width], format == Image::RGBA32 ? width * 4 : width); } uploadImage->Unmap(0, nullptr); } void Graphics5::Texture::clear(int x, int y, int z, int width, int height, int depth, uint color) {} #if defined(KORE_WINDOWS) || defined(KORE_WINDOWSAPP) int d3d12_textureAlignment() { return D3D12_TEXTURE_DATA_PITCH_ALIGNMENT; } #else int d3d12_textureAlignment(); #endif int Graphics5::Texture::stride() { int baseStride = format == Image::RGBA32 ? (width * 4) : width; if (format == Image::Grey8) return width; // please investigate further for (int i = 0;; ++i) { if (d3d12_textureAlignment() * i >= baseStride) { return d3d12_textureAlignment() * i; } } } void Graphics5::Texture::generateMipmaps(int levels) {} void Graphics5::Texture::setMipmap(Texture* mipmap, int level) {}
{ "content_hash": "9ab49fa676a68e55cf07ac2252ad07c6", "timestamp": "", "source": "github", "line_count": 173, "max_line_length": 155, "avg_line_length": 41.127167630057805, "alnum_prop": 0.7239634574841883, "repo_name": "KTXSoftware/KodeStudio-linux64", "id": "8e58a7c23e51d08afdad2a36de55c890c4568b70", "size": "7219", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "resources/app/kodeExtensions/kha/Kha/Kore/Backends/Graphics5/Direct3D12/Sources/Kore/Texture5Impl.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "5752" }, { "name": "C", "bytes": "16536150" }, { "name": "C#", "bytes": "6892" }, { "name": "C++", "bytes": "2853489" }, { "name": "CMake", "bytes": "215" }, { "name": "CSS", "bytes": "580404" }, { "name": "GLSL", "bytes": "4560" }, { "name": "HTML", "bytes": "10983" }, { "name": "Haxe", "bytes": "6650959" }, { "name": "Java", "bytes": "5737" }, { "name": "JavaScript", "bytes": "15087995" }, { "name": "Lua", "bytes": "3242" }, { "name": "Objective-C", "bytes": "25344" }, { "name": "Objective-C++", "bytes": "72165" }, { "name": "PAWN", "bytes": "4478" }, { "name": "Shell", "bytes": "3786" }, { "name": "Smarty", "bytes": "13338" }, { "name": "TypeScript", "bytes": "306451" } ], "symlink_target": "" }
<?php namespace LengthOfRope\JSONLD\Schema; /** * An organization such as a school, NGO, corporation, club, etc. * * @author LengthOfRope, Bas de Kort <bdekort@gmail.com> **/ class OrganizationSchema extends ThingSchema { public static function factory() { return new OrganizationSchema('http://schema.org/', 'Organization'); } /** * Physical address of the item. * * @param $address PostalAddressSchema|TextSchema **/ public function setAddress($address) { $this->properties['address'] = $address; return $this; } /** * @return PostalAddressSchema|TextSchema **/ public function getAddress() { return $this->properties['address']; } /** * The overall rating, based on a collection of reviews or ratings, of the item. * * @param $aggregateRating AggregateRatingSchema **/ public function setAggregateRating($aggregateRating) { $this->properties['aggregateRating'] = $aggregateRating; return $this; } /** * @return AggregateRatingSchema **/ public function getAggregateRating() { return $this->properties['aggregateRating']; } /** * Alumni of an organization. * * @param $alumni PersonSchema **/ public function setAlumni($alumni) { $this->properties['alumni'] = $alumni; return $this; } /** * @return PersonSchema **/ public function getAlumni() { return $this->properties['alumni']; } /** * The geographic area where a service or offered item is provided. * * @param $areaServed PlaceSchema|AdministrativeAreaSchema|GeoShapeSchema|TextSchema **/ public function setAreaServed($areaServed) { $this->properties['areaServed'] = $areaServed; return $this; } /** * @return PlaceSchema|AdministrativeAreaSchema|GeoShapeSchema|TextSchema **/ public function getAreaServed() { return $this->properties['areaServed']; } /** * An award won by or for this item. * * @param $award TextSchema **/ public function setAward($award) { $this->properties['award'] = $award; return $this; } /** * @return TextSchema **/ public function getAward() { return $this->properties['award']; } /** * Awards won by or for this item. * * @param $awards TextSchema **/ public function setAwards($awards) { $this->properties['awards'] = $awards; return $this; } /** * @return TextSchema **/ public function getAwards() { return $this->properties['awards']; } /** * The brand(s) associated with a product or service, or the brand(s) maintained by an organization or business person. * * @param $brand BrandSchema|OrganizationSchema **/ public function setBrand($brand) { $this->properties['brand'] = $brand; return $this; } /** * @return BrandSchema|OrganizationSchema **/ public function getBrand() { return $this->properties['brand']; } /** * A contact point for a person or organization. * * @param $contactPoint ContactPointSchema **/ public function setContactPoint($contactPoint) { $this->properties['contactPoint'] = $contactPoint; return $this; } /** * @return ContactPointSchema **/ public function getContactPoint() { return $this->properties['contactPoint']; } /** * A contact point for a person or organization. * * @param $contactPoints ContactPointSchema **/ public function setContactPoints($contactPoints) { $this->properties['contactPoints'] = $contactPoints; return $this; } /** * @return ContactPointSchema **/ public function getContactPoints() { return $this->properties['contactPoints']; } /** * A relationship between an organization and a department of that organization, also described as an organization (allowing different urls, logos, opening hours). For example: a store with a pharmacy, or a bakery with a cafe. * * @param $department OrganizationSchema **/ public function setDepartment($department) { $this->properties['department'] = $department; return $this; } /** * @return OrganizationSchema **/ public function getDepartment() { return $this->properties['department']; } /** * The date that this organization was dissolved. * * @param $dissolutionDate DateSchema **/ public function setDissolutionDate($dissolutionDate) { $this->properties['dissolutionDate'] = $dissolutionDate; return $this; } /** * @return DateSchema **/ public function getDissolutionDate() { return $this->properties['dissolutionDate']; } /** * The Dun & Bradstreet DUNS number for identifying an organization or business person. * * @param $duns TextSchema **/ public function setDuns($duns) { $this->properties['duns'] = $duns; return $this; } /** * @return TextSchema **/ public function getDuns() { return $this->properties['duns']; } /** * Email address. * * @param $email TextSchema **/ public function setEmail($email) { $this->properties['email'] = $email; return $this; } /** * @return TextSchema **/ public function getEmail() { return $this->properties['email']; } /** * Someone working for this organization. * * @param $employee PersonSchema **/ public function setEmployee($employee) { $this->properties['employee'] = $employee; return $this; } /** * @return PersonSchema **/ public function getEmployee() { return $this->properties['employee']; } /** * People working for this organization. * * @param $employees PersonSchema **/ public function setEmployees($employees) { $this->properties['employees'] = $employees; return $this; } /** * @return PersonSchema **/ public function getEmployees() { return $this->properties['employees']; } /** * Upcoming or past event associated with this place, organization, or action. * * @param $event EventSchema **/ public function setEvent($event) { $this->properties['event'] = $event; return $this; } /** * @return EventSchema **/ public function getEvent() { return $this->properties['event']; } /** * Upcoming or past events associated with this place or organization. * * @param $events EventSchema **/ public function setEvents($events) { $this->properties['events'] = $events; return $this; } /** * @return EventSchema **/ public function getEvents() { return $this->properties['events']; } /** * The fax number. * * @param $faxNumber TextSchema **/ public function setFaxNumber($faxNumber) { $this->properties['faxNumber'] = $faxNumber; return $this; } /** * @return TextSchema **/ public function getFaxNumber() { return $this->properties['faxNumber']; } /** * A person who founded this organization. * * @param $founder PersonSchema **/ public function setFounder($founder) { $this->properties['founder'] = $founder; return $this; } /** * @return PersonSchema **/ public function getFounder() { return $this->properties['founder']; } /** * A person who founded this organization. * * @param $founders PersonSchema **/ public function setFounders($founders) { $this->properties['founders'] = $founders; return $this; } /** * @return PersonSchema **/ public function getFounders() { return $this->properties['founders']; } /** * The date that this organization was founded. * * @param $foundingDate DateSchema **/ public function setFoundingDate($foundingDate) { $this->properties['foundingDate'] = $foundingDate; return $this; } /** * @return DateSchema **/ public function getFoundingDate() { return $this->properties['foundingDate']; } /** * The place where the Organization was founded. * * @param $foundingLocation PlaceSchema **/ public function setFoundingLocation($foundingLocation) { $this->properties['foundingLocation'] = $foundingLocation; return $this; } /** * @return PlaceSchema **/ public function getFoundingLocation() { return $this->properties['foundingLocation']; } /** * The <a href="http://www.gs1.org/gln">Global Location Number</a> (GLN, sometimes also referred to as International Location Number or ILN) of the respective organization, person, or place. The GLN is a 13-digit number used to identify parties and physical locations. * * @param $globalLocationNumber TextSchema **/ public function setGlobalLocationNumber($globalLocationNumber) { $this->properties['globalLocationNumber'] = $globalLocationNumber; return $this; } /** * @return TextSchema **/ public function getGlobalLocationNumber() { return $this->properties['globalLocationNumber']; } /** * Indicates an OfferCatalog listing for this Organization, Person, or Service. * * @param $hasOfferCatalog OfferCatalogSchema **/ public function setHasOfferCatalog($hasOfferCatalog) { $this->properties['hasOfferCatalog'] = $hasOfferCatalog; return $this; } /** * @return OfferCatalogSchema **/ public function getHasOfferCatalog() { return $this->properties['hasOfferCatalog']; } /** * Points-of-Sales operated by the organization or person. * * @param $hasPOS PlaceSchema **/ public function setHasPOS($hasPOS) { $this->properties['hasPOS'] = $hasPOS; return $this; } /** * @return PlaceSchema **/ public function getHasPOS() { return $this->properties['hasPOS']; } /** * The International Standard of Industrial Classification of All Economic Activities (ISIC), Revision 4 code for a particular organization, business person, or place. * * @param $isicV4 TextSchema **/ public function setIsicV4($isicV4) { $this->properties['isicV4'] = $isicV4; return $this; } /** * @return TextSchema **/ public function getIsicV4() { return $this->properties['isicV4']; } /** * The official name of the organization, e.g. the registered company name. * * @param $legalName TextSchema **/ public function setLegalName($legalName) { $this->properties['legalName'] = $legalName; return $this; } /** * @return TextSchema **/ public function getLegalName() { return $this->properties['legalName']; } /** * The location of for example where the event is happening, an organization is located, or where an action takes place. * * @param $location PlaceSchema|PostalAddressSchema|TextSchema **/ public function setLocation($location) { $this->properties['location'] = $location; return $this; } /** * @return PlaceSchema|PostalAddressSchema|TextSchema **/ public function getLocation() { return $this->properties['location']; } /** * An associated logo. * * @param $logo ImageObjectSchema|URLSchema **/ public function setLogo($logo) { $this->properties['logo'] = $logo; return $this; } /** * @return ImageObjectSchema|URLSchema **/ public function getLogo() { return $this->properties['logo']; } /** * A pointer to products or services offered by the organization or person. * * @param $makesOffer OfferSchema **/ public function setMakesOffer($makesOffer) { $this->properties['makesOffer'] = $makesOffer; return $this; } /** * @return OfferSchema **/ public function getMakesOffer() { return $this->properties['makesOffer']; } /** * A member of an Organization or a ProgramMembership. Organizations can be members of organizations; ProgramMembership is typically for individuals. * * @param $member OrganizationSchema|PersonSchema **/ public function setMember($member) { $this->properties['member'] = $member; return $this; } /** * @return OrganizationSchema|PersonSchema **/ public function getMember() { return $this->properties['member']; } /** * An Organization (or ProgramMembership) to which this Person or Organization belongs. * * @param $memberOf OrganizationSchema|ProgramMembershipSchema **/ public function setMemberOf($memberOf) { $this->properties['memberOf'] = $memberOf; return $this; } /** * @return OrganizationSchema|ProgramMembershipSchema **/ public function getMemberOf() { return $this->properties['memberOf']; } /** * A member of this organization. * * @param $members OrganizationSchema|PersonSchema **/ public function setMembers($members) { $this->properties['members'] = $members; return $this; } /** * @return OrganizationSchema|PersonSchema **/ public function getMembers() { return $this->properties['members']; } /** * The North American Industry Classification System (NAICS) code for a particular organization or business person. * * @param $naics TextSchema **/ public function setNaics($naics) { $this->properties['naics'] = $naics; return $this; } /** * @return TextSchema **/ public function getNaics() { return $this->properties['naics']; } /** * The number of employees in an organization e.g. business. * * @param $numberOfEmployees QuantitativeValueSchema **/ public function setNumberOfEmployees($numberOfEmployees) { $this->properties['numberOfEmployees'] = $numberOfEmployees; return $this; } /** * @return QuantitativeValueSchema **/ public function getNumberOfEmployees() { return $this->properties['numberOfEmployees']; } /** * Products owned by the organization or person. * * @param $owns OwnershipInfoSchema|ProductSchema **/ public function setOwns($owns) { $this->properties['owns'] = $owns; return $this; } /** * @return OwnershipInfoSchema|ProductSchema **/ public function getOwns() { return $this->properties['owns']; } /** * The larger organization that this organization is a branch of, if any. * * @param $parentOrganization OrganizationSchema **/ public function setParentOrganization($parentOrganization) { $this->properties['parentOrganization'] = $parentOrganization; return $this; } /** * @return OrganizationSchema **/ public function getParentOrganization() { return $this->properties['parentOrganization']; } /** * A review of the item. * * @param $review ReviewSchema **/ public function setReview($review) { $this->properties['review'] = $review; return $this; } /** * @return ReviewSchema **/ public function getReview() { return $this->properties['review']; } /** * Review of the item. * * @param $reviews ReviewSchema **/ public function setReviews($reviews) { $this->properties['reviews'] = $reviews; return $this; } /** * @return ReviewSchema **/ public function getReviews() { return $this->properties['reviews']; } /** * A pointer to products or services sought by the organization or person (demand). * * @param $seeks DemandSchema **/ public function setSeeks($seeks) { $this->properties['seeks'] = $seeks; return $this; } /** * @return DemandSchema **/ public function getSeeks() { return $this->properties['seeks']; } /** * The geographic area where the service is provided. * * @param $serviceArea PlaceSchema|AdministrativeAreaSchema|GeoShapeSchema **/ public function setServiceArea($serviceArea) { $this->properties['serviceArea'] = $serviceArea; return $this; } /** * @return PlaceSchema|AdministrativeAreaSchema|GeoShapeSchema **/ public function getServiceArea() { return $this->properties['serviceArea']; } /** * A relationship between two organizations where the first includes the second, e.g., as a subsidiary. See also: the more specific 'department' property. * * @param $subOrganization OrganizationSchema **/ public function setSubOrganization($subOrganization) { $this->properties['subOrganization'] = $subOrganization; return $this; } /** * @return OrganizationSchema **/ public function getSubOrganization() { return $this->properties['subOrganization']; } /** * The Tax / Fiscal ID of the organization or person, e.g. the TIN in the US or the CIF/NIF in Spain. * * @param $taxID TextSchema **/ public function setTaxID($taxID) { $this->properties['taxID'] = $taxID; return $this; } /** * @return TextSchema **/ public function getTaxID() { return $this->properties['taxID']; } /** * The telephone number. * * @param $telephone TextSchema **/ public function setTelephone($telephone) { $this->properties['telephone'] = $telephone; return $this; } /** * @return TextSchema **/ public function getTelephone() { return $this->properties['telephone']; } /** * The Value-added Tax ID of the organization or person. * * @param $vatID TextSchema **/ public function setVatID($vatID) { $this->properties['vatID'] = $vatID; return $this; } /** * @return TextSchema **/ public function getVatID() { return $this->properties['vatID']; } }
{ "content_hash": "ae5a4967c1a6d95cf4d02a7eb1ef4b6b", "timestamp": "", "source": "github", "line_count": 830, "max_line_length": 272, "avg_line_length": 23.02530120481928, "alnum_prop": 0.5864162000941866, "repo_name": "nextbuzz/buzz-seo", "id": "50c3cd7ecc21081d48ddc245f720628d0bb71d43", "size": "20280", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "vendor/lengthofrope/create-jsonld-tiny/src/Schema/OrganizationSchema.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3533" }, { "name": "JavaScript", "bytes": "29749" }, { "name": "PHP", "bytes": "175414" } ], "symlink_target": "" }
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using System.Collections.Generic; using System.Linq; using System.Management.Automation; using Microsoft.Azure.Commands.Sql.ServerKeyVaultKey.Model; using Microsoft.Azure.Commands.Sql.ServerKeyVaultKey.Services; namespace Microsoft.Azure.Commands.Sql.ServerKeyVaultKey.Cmdlet { /// <summary> /// Defines the Add-AzureRmSqlServerKeyVaultKey cmdlet /// </summary> [Cmdlet(VerbsCommon.Add, "AzureRmSqlServerKeyVaultKey", ConfirmImpact = ConfirmImpact.Low, SupportsShouldProcess = true)] [OutputType(typeof(AzureSqlServerKeyVaultKeyModel))] public class AddAzureSqlServerKeyVaultKey : AzureSqlServerKeyVaultKeyCmdletBase { /// <summary> /// Gets or sets the KeyId of the Azure Key Vault /// </summary> [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 2, HelpMessage = "The Azure Key Vault KeyId.")] [ValidateNotNullOrEmpty] public string KeyId { get; set; } /// <summary> /// Check to see if the Server Key Vault Key already exists on the server. /// </summary> /// <returns>Null if the Server Key Vault Key doesn't exist.</returns> protected override IEnumerable<AzureSqlServerKeyVaultKeyModel> GetEntity() { return null; } /// <summary> /// Generates the model from user input. /// </summary> /// <param name="model">This is null since the model doesn't exist yet</param> /// <returns>The generated model from user input</returns> protected override IEnumerable<AzureSqlServerKeyVaultKeyModel> ApplyUserInputToModel(IEnumerable<AzureSqlServerKeyVaultKeyModel> model) { List<AzureSqlServerKeyVaultKeyModel> newEntity = new List<AzureSqlServerKeyVaultKeyModel>(); newEntity.Add(new AzureSqlServerKeyVaultKeyModel() { ResourceGroupName = this.ResourceGroupName, ServerName = this.ServerName, ServerKeyName = AzureSqlServerKeyVaultKeyModel.CreateServerKeyNameFromKeyId(this.KeyId), Uri = this.KeyId, Type = AzureSqlServerKeyVaultKeyModel.ServerKeyType.AzureKeyVault }); return newEntity; } /// <summary> /// Sends the changes to the service -> Associates the Azure Key Vault key with the server /// </summary> /// <param name="entity">The Server Key</param> /// <returns>The Server Key added to the server</returns> protected override IEnumerable<AzureSqlServerKeyVaultKeyModel> PersistChanges(IEnumerable<AzureSqlServerKeyVaultKeyModel> entity) { return new List<AzureSqlServerKeyVaultKeyModel>() { ModelAdapter.CreateOrUpdate(entity.First()) }; } } }
{ "content_hash": "cd2a9cce65b69dd9e9d668df754986be", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 143, "avg_line_length": 43.464285714285715, "alnum_prop": 0.6395508079978088, "repo_name": "AzureRT/azure-powershell", "id": "bc18d101177019836c331e6776518976c5944711", "size": "3653", "binary": false, "copies": "3", "ref": "refs/heads/dev", "path": "src/ResourceManager/Sql/Commands.Sql/ServerKeyVaultKey/Cmdlet/AddAzureSqlServerKeyVaultKey.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "16509" }, { "name": "C#", "bytes": "33089845" }, { "name": "HTML", "bytes": "209" }, { "name": "JavaScript", "bytes": "4979" }, { "name": "PHP", "bytes": "41" }, { "name": "PowerShell", "bytes": "3804727" }, { "name": "Ruby", "bytes": "265" }, { "name": "Shell", "bytes": "50" }, { "name": "XSLT", "bytes": "6114" } ], "symlink_target": "" }
"""Cancel an existing iSCSI account.""" # :license: MIT, see LICENSE for more details. import click import SoftLayer from SoftLayer.CLI import environment from SoftLayer.CLI import exceptions from SoftLayer.CLI import formatting from SoftLayer.CLI import helpers @click.command() @click.argument('identifier') @click.option('--reason', help="An optional reason for cancellation") @click.option('--immediate', is_flag=True, help="Cancels the iSCSI immediately instead of on the billing " "anniversary") @environment.pass_env def cli(env, identifier, reason, immediate): """Cancel an existing iSCSI account.""" iscsi_mgr = SoftLayer.ISCSIManager(env.client) iscsi_id = helpers.resolve_id(iscsi_mgr.resolve_ids, identifier, 'iSCSI') if not (env.skip_confirmations or formatting.no_going_back(iscsi_id)): raise exceptions.CLIAbort('Aborted') iscsi_mgr.cancel_iscsi(iscsi_id, reason, immediate)
{ "content_hash": "e3af1c56be97c468968cd5941e5268b1", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 77, "avg_line_length": 32.4, "alnum_prop": 0.7129629629629629, "repo_name": "skraghu/softlayer-python", "id": "f744cb62723aac06d7af3ba689ca377319e5ae3c", "size": "972", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "SoftLayer/CLI/iscsi/cancel.py", "mode": "33188", "license": "mit", "language": [ { "name": "DIGITAL Command Language", "bytes": "854" }, { "name": "Python", "bytes": "1039495" } ], "symlink_target": "" }
/** * * Process Editor - Domain Package * * (C) 2010 inubit AG * * http://frapu.net * */ package net.frapu.code.visualization.domainModel; import net.frapu.code.visualization.editors.ListSelectionPropertyEditor; import java.awt.BasicStroke; import java.awt.Polygon; import java.awt.Shape; import java.awt.Stroke; import net.frapu.code.visualization.*; /** * * @author ff */ public class Association extends ProcessEdge { protected final static int xArrowTargetPoints[] = {0, -10, -12, -2, -12, -10}; protected final static int yArrowTargetPoints[] = {0, 6, 6, 0, -6, -6}; protected final static Polygon associationFlowArrowTarget = new Polygon(xArrowTargetPoints, yArrowTargetPoints, 6); protected final static int xArrowSourcePoints[] = {0, 10, 12, 2, 12, 10}; protected final static int yArrowSourcePoints[] = {0, 6, 6, 0, -6, -6}; protected final static Polygon associationFlowArrowSource = new Polygon(xArrowSourcePoints, yArrowSourcePoints, 6); private final static float dash1[] = {2.0f}; public final static BasicStroke annotationStroke = new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, dash1, 0.0f); /** The direction of this Association. Possible values are "SOURCE, TARGET, BOTH, NONE" */ public final static String PROP_DIRECTION = "direction"; public final static String DIRECTION_SOURCE = "SOURCE"; public final static String DIRECTION_TARGET = "TARGET"; public final static String DIRECTION_BOTH = "BOTH"; public final static String DIRECTION_NONE = "NONE"; public final static String PROP_SOURCE_NAME = "sourceName"; public final static String PROP_SOURCE_MULTIPLICITY = "sourceMultiplicity"; public final static String PROP_SOURCE_VISIBILITY = "sourceVisibility"; public final static String PROP_TARGET_NAME = "targetName"; public final static String PROP_TARGET_MULTIPLICITY = "targetMultiplicity"; public final static String PROP_TARGET_VISIBILITY = "targetVisibility"; public Association() { super(); initializeProperties(); } public Association(ProcessNode source, ProcessNode target) { super(source, target); initializeProperties(); } private void initializeProperties() { setProperty(PROP_SOURCE_NAME, ""); setProperty(PROP_TARGET_NAME, ""); setProperty(PROP_SOURCE_VISIBILITY, ""); setProperty(PROP_TARGET_VISIBILITY, ""); setProperty(PROP_SOURCE_MULTIPLICITY, "1..*"); setProperty(PROP_TARGET_MULTIPLICITY, "1..*"); setProperty(PROP_DIRECTION, DIRECTION_TARGET); String[] direction = {DIRECTION_NONE, DIRECTION_SOURCE, DIRECTION_TARGET, DIRECTION_BOTH}; setPropertyEditor(PROP_DIRECTION, new ListSelectionPropertyEditor(direction)); setPropertyEditor(PROP_SOURCE_VISIBILITY, new ListSelectionPropertyEditor(Visibility.stringValues())); setPropertyEditor(PROP_TARGET_VISIBILITY, new ListSelectionPropertyEditor(Visibility.stringValues())); } @Override public Shape getSourceShape() { String direction = getProperty(PROP_DIRECTION).toUpperCase(); if (direction.equals(DIRECTION_SOURCE) || direction.equals(DIRECTION_BOTH)) { return associationFlowArrowSource; } return null; } @Override public Shape getTargetShape() { String direction = getProperty(PROP_DIRECTION).toUpperCase(); if (direction.equals(DIRECTION_TARGET) || direction.equals(DIRECTION_BOTH)) { return associationFlowArrowTarget; } return null; } @Override public Stroke getLineStroke() { // Check if target is EdgeDocker if (getTarget() instanceof EdgeDocker) { return DomainUtils.dashedStroke; } return DomainUtils.thinStroke; } @Override protected boolean isDockingSupported() { return true; } }
{ "content_hash": "0fcf2117e1ce4b7f2904e89ca1b77380", "timestamp": "", "source": "github", "line_count": 104, "max_line_length": 119, "avg_line_length": 38.26923076923077, "alnum_prop": 0.6879396984924623, "repo_name": "bptlab/processeditor", "id": "1faab8073cd00cc5f4ae7a57118fd59209c95f25", "size": "3980", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "src/net/frapu/code/visualization/domainModel/Association.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "2087" }, { "name": "HTML", "bytes": "82844" }, { "name": "Java", "bytes": "4887405" }, { "name": "JavaScript", "bytes": "541759" }, { "name": "Shell", "bytes": "71" } ], "symlink_target": "" }
import { Publish } from '../../src/Commands' import { TestCommand } from '../test-helpers' describe('/Publish', function() { it( 'Publish() should return a properly configured JSON-RPC request', function() { const stream = 'stream' const key = 'key' const data = 'data' // Signature 1: [string, string, string] TestCommand( Publish(stream, key, data), Publish, [stream, key, data], ) }, ) })
{ "content_hash": "1b992e8a70e1d626c44835a1107bf3fe", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 69, "avg_line_length": 23.5, "alnum_prop": 0.5638297872340425, "repo_name": "Tilkal/multichain-api", "id": "09c0e460d662c987b2331edefbf06d2d6234248b", "size": "470", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/Commands/Publish.ts", "mode": "33188", "license": "mit", "language": [ { "name": "TypeScript", "bytes": "177370" } ], "symlink_target": "" }
/** * Created by Jaya on 5/3/2015. */ var main = function(){ var parent = document.getElementById("left"); var child = document.getElementById("main"); parent.removeChild(child); var parent = document.getElementById("right"); var child = document.getElementById("login"); parent.removeChild(child); var child = document.getElementById("newuser"); parent.removeChild(child); } $(document).ready(main);
{ "content_hash": "1cab6813f286ce7c8e7b917030ec2de4", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 51, "avg_line_length": 22.05, "alnum_prop": 0.671201814058957, "repo_name": "jayakasadev/CS336BookMark", "id": "b08719f1c3b4c73460ead3f3c06315e538d5327e", "size": "441", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/js/headermodifiers/iteminfohead.js", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "40690" }, { "name": "CSS", "bytes": "30823" }, { "name": "HTML", "bytes": "83417" }, { "name": "Java", "bytes": "3093" }, { "name": "JavaScript", "bytes": "1102339" }, { "name": "PHP", "bytes": "134429" }, { "name": "Shell", "bytes": "5428" } ], "symlink_target": "" }
import sys import tweepy # https://github.com/tweepy/tweepy import csv import api_keys import xlsxwriter import tweet_cleaner import json import argparse parser = argparse.ArgumentParser(description='collect user tweets') parser.add_argument('-u', '--user', type=str, help='user', required=True) def get_all_tweets(screen_name): # Twitter only allows access to a users most recent 3240 tweets with this method # authorize twitter, initialize tweepy if api_keys.consumer_key == '' or api_keys.consumer_secret == '' \ or api_keys.access_token == '' or api_keys.access_secret == '': print("API key not found. Please check api_keys.py file") sys.exit(-1) auth = tweepy.OAuthHandler(api_keys.consumer_key, api_keys.consumer_secret) auth.set_access_token(api_keys.access_token, api_keys.access_secret) api = tweepy.API(auth) # initialize a list to hold all the tweepy Tweets alltweets = [] # make initial request for most recent tweets (200 is the maximum allowed count) new_tweets = api.user_timeline(screen_name=screen_name, count=200, tweet_mode='extended') # save most recent tweets alltweets.extend(new_tweets) # save the id of the oldest tweet less one oldest = alltweets[-1].id - 1 # keep grabbing tweets until there are no tweets left to grab while len(new_tweets) > 0: print("getting tweets before {}".format(oldest)) # all subsiquent requests use the max_id param to prevent duplicates new_tweets = api.user_timeline(screen_name=screen_name, count=200, max_id=oldest, tweet_mode='extended') # save most recent tweets alltweets.extend(new_tweets) # update the id of the oldest tweet less one oldest = alltweets[-1].id - 1 print("...{} tweets downloaded so far".format((len(alltweets)))) with open('{}.json'.format(screen_name), 'w') as outfile: for t in alltweets: outfile.write(json.dumps(t._json)) outfile.write('\n') print('{} tweets have been written successfully to {}.json'.format((len(alltweets)), screen_name)) def process_json(screen_name): workbook = xlsxwriter.Workbook('%s_tweets.xlsx' % screen_name) worksheet = workbook.add_worksheet() # Start from the first cell. Rows and columns are zero indexed. row = 0 col = 0 worksheet.write(row, 0, 'id') worksheet.write(row, 1, 'created_at') worksheet.write(row, 2, 'full_text') worksheet.write(row, 3, 'clean_text') row += 1 with open('{}.json'.format(screen_name)) as json_reader: lines = json_reader.readlines() for line in lines: json_tweet = json.loads(line) if 'retweeted_status' in json_tweet: text = json_tweet['retweeted_status']['full_text'] else: text = json_tweet['full_text'] clean_text = tweet_cleaner.clean_tweet(text) clean_text = tweet_cleaner.normalize_arabic(clean_text) clean_text = tweet_cleaner.remove_repeating_char(clean_text) clean_text = tweet_cleaner.keep_only_arabic(clean_text.split()) worksheet.write(row, col, json_tweet['id_str']) worksheet.write(row, col + 1, json_tweet['created_at']) worksheet.write(row, col + 2, text) worksheet.write(row, col + 3, clean_text) row += 1 workbook.close() if __name__ == '__main__': # pass in the username of the account you want to download args = parser.parse_args() user = args.user get_all_tweets(user) process_json(user)
{ "content_hash": "2b3cb59a13b2faed4b6c1911985f8ef5", "timestamp": "", "source": "github", "line_count": 99, "max_line_length": 102, "avg_line_length": 37.5959595959596, "alnum_prop": 0.6265448683503493, "repo_name": "motazsaad/tweets-collector", "id": "f77875ceec7c5aa78cf2ffcc3e4d7864eec2118b", "size": "3838", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "user_tweets_history.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "25902" } ], "symlink_target": "" }
package java.lang.ref; /** * @hide */ public final class FinalizerReference<T> extends Reference<T> { // This queue contains those objects eligible for finalization. public static final ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); // Guards the list (not the queue). private static final Object LIST_LOCK = new Object(); // This list contains a FinalizerReference for every finalizable object in the heap. // Objects in this list may or may not be eligible for finalization yet. private static FinalizerReference<?> head = null; // The links used to construct the list. private FinalizerReference<?> prev; private FinalizerReference<?> next; // When the GC wants something finalized, it moves it from the 'referent' field to // the 'zombie' field instead. private T zombie; public FinalizerReference(T r, ReferenceQueue<? super T> q) { super(r, q); } @Override public T get() { return zombie; } @Override public void clear() { zombie = null; } public static void add(Object referent) { FinalizerReference<?> reference = new FinalizerReference<Object>(referent, queue); synchronized (LIST_LOCK) { reference.prev = null; reference.next = head; if (head != null) { head.prev = reference; } head = reference; } } public static void remove(FinalizerReference<?> reference) { synchronized (LIST_LOCK) { FinalizerReference<?> next = reference.next; FinalizerReference<?> prev = reference.prev; reference.next = null; reference.prev = null; if (prev != null) { prev.next = next; } else { head = next; } if (next != null) { next.prev = prev; } } } /** * Waits for all currently-enqueued references to be finalized. */ public static void finalizeAllEnqueued() throws InterruptedException { Sentinel sentinel = new Sentinel(); enqueueSentinelReference(sentinel); sentinel.awaitFinalization(); } private static void enqueueSentinelReference(Sentinel sentinel) { synchronized (LIST_LOCK) { // When a finalizable object is allocated, a FinalizerReference is added to the list. // We search the list for that FinalizerReference (it should be at or near the head), // and then put it on the queue so that it can be finalized. for (FinalizerReference<?> r = head; r != null; r = r.next) { if (r.referent == sentinel) { FinalizerReference<Sentinel> sentinelReference = (FinalizerReference<Sentinel>) r; sentinelReference.referent = null; sentinelReference.zombie = sentinel; sentinelReference.enqueueInternal(); return; } } } // We just created a finalizable object and still hold a reference to it. // It must be on the list. throw new AssertionError("newly-created live Sentinel not on list!"); } /** * A marker object that we can immediately enqueue. When this object's * finalize() method is called, we know all previously-enqueued finalizable * references have been finalized. */ private static class Sentinel { boolean finalized = false; @Override protected synchronized void finalize() throws Throwable { if (finalized) { throw new AssertionError(); } finalized = true; notifyAll(); } synchronized void awaitFinalization() throws InterruptedException { while (!finalized) { wait(); } } } }
{ "content_hash": "3318f3f1d3c92cb872575fff1cf710fb", "timestamp": "", "source": "github", "line_count": 119, "max_line_length": 102, "avg_line_length": 33.3109243697479, "alnum_prop": 0.5867810292633703, "repo_name": "blois/AndroidSDKCloneMin", "id": "14eaae46c4d3b439009051bb20ffc42920f46489", "size": "4583", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "sdk/sources/android-20/java/lang/ref/FinalizerReference.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AppleScript", "bytes": "0" }, { "name": "Assembly", "bytes": "39964" }, { "name": "Awk", "bytes": "50821" }, { "name": "C", "bytes": "65602656" }, { "name": "C++", "bytes": "32706569" }, { "name": "CSS", "bytes": "301711" }, { "name": "Component Pascal", "bytes": "110" }, { "name": "Emacs Lisp", "bytes": "4737" }, { "name": "Groovy", "bytes": "82931" }, { "name": "IDL", "bytes": "11244" }, { "name": "Java", "bytes": "102765797" }, { "name": "JavaScript", "bytes": "27699" }, { "name": "Objective-C", "bytes": "138688" }, { "name": "Perl", "bytes": "20900909" }, { "name": "Prolog", "bytes": "2842768" }, { "name": "Python", "bytes": "17241370" }, { "name": "Rust", "bytes": "9919" }, { "name": "Shell", "bytes": "806338" }, { "name": "Visual Basic", "bytes": "481" }, { "name": "XC", "bytes": "200153" } ], "symlink_target": "" }
var main = function() { var template = function(text) { return '<p><input type="checkbox"><i class="glyphicon glyphicon-star"></i><span>' + text + '</span><i class="glyphicon glyphicon-remove"></i></p>'; }; var checkstrike = function(x){ if ($(x).siblings().is(':checked')) { $(x).siblings().prop('checked', false); $(x).removeClass('strike'); } else { $(x).siblings().prop('checked', true); $(x).addClass('strike'); } }; var add = function(item) { var html = template(item); $(html).appendTo('.list'); }; $('form').submit(function() { var todo = $('#todo'); if (todo.val() !== "") { var html = template(todo.val()); $(html).appendTo('.list'); $(todo).val(""); } return false; }); $(document).on("click", '.glyphicon-remove', function() { $(this).parent().remove(); }); $(document).on("click", '.glyphicon-star', function() { $(this).toggleClass('active'); }); $(document).on('click','span',function() { checkstrike(this); }); if (annyang) { var commands = { 'add *item': add, }; annyang.addCommands(commands); annyang.start(); } }; $(document).ready(main);
{ "content_hash": "2e2464f2e87dc5aec6d3c9b68a07edc6", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 147, "avg_line_length": 32.395833333333336, "alnum_prop": 0.4173633440514469, "repo_name": "ericgfx/ericgfx.github.io", "id": "df4be9fa40ba74c26651d1b87b2c30da6ecb7f6e", "size": "1556", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "ListEasy/worksinjsfiddle.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "55597" }, { "name": "HTML", "bytes": "48495" }, { "name": "JavaScript", "bytes": "46089" }, { "name": "PHP", "bytes": "1242" } ], "symlink_target": "" }
/// <reference path="../../../typings/tsd.d.ts" /> Ref: http://jsforallof.us/2014/10/28/pagination-with-lodash/ angular.module('app').factory('PaginatorService', function () { var fac = {}; fac.pagedItems = function (items, page) { var per_page = 10; var totalPages = Math.ceil(items.length / per_page); page = page || totalPages; var offset = (page - 1) * per_page; var paginatedItems = _.drop(items, offset).slice(0, per_page); console.table(paginatedItems); return { page: page, per_page: per_page, total: items.length, total_pages: Math.ceil(items.length / per_page), data: paginatedItems }; } return fac; });
{ "content_hash": "43b16b30037198740124163ea1bb84dc", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 70, "avg_line_length": 34.36363636363637, "alnum_prop": 0.5608465608465608, "repo_name": "pjsvis/TraceGen", "id": "c0f51f06a5953182566256ab88d35a39b91ef549", "size": "758", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/services/paginator.service.js", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "120" }, { "name": "C#", "bytes": "21509" }, { "name": "CSS", "bytes": "166845" }, { "name": "HTML", "bytes": "409650" }, { "name": "JavaScript", "bytes": "6367538" }, { "name": "PHP", "bytes": "264568" }, { "name": "PowerShell", "bytes": "468" }, { "name": "TypeScript", "bytes": "538231" } ], "symlink_target": "" }
from __future__ import division from random import random, seed, expovariate, uniform, triangular, gammavariate, gauss, lognormvariate, weibullvariate from datetime import datetime import os from csv import writer import yaml import shutil import networkx as nx from data_record import DataRecord from server import Server class Node: """ Class for a node on our network """ def __init__(self, id_number, simulation): """ Initialise a node. """ self.simulation = simulation self.mu = [self.simulation.mu[cls][id_number-1] for cls in range(len(self.simulation.mu))] self.scheduled_servers = self.simulation.schedules[id_number-1] if self.scheduled_servers: self.schedule = self.simulation.parameters[self.simulation.c[id_number-1]] self.cyclelength = self.simulation.parameters['cycle_length'] self.c = self.schedule[0][1] self.masterschedule = [i*self.cyclelength + obs for i in range(self.simulation.max_simulation_time//self.cyclelength + 1) for obs in [t[0] for t in self.schedule]][1:] else: self.c = self.simulation.c[id_number-1] self.node_capacity = "Inf" if self.simulation.queue_capacities[id_number-1] == "Inf" else self.simulation.queue_capacities[id_number-1] + self.c self.transition_row = [self.simulation.transition_matrix[j][id_number-1] for j in range(len(self.simulation.transition_matrix))] if self.simulation.class_change_matrix != 'NA': self.class_change_for_node = self.simulation.class_change_matrix[id_number-1] self.class_change_cdf = self.find_cdf_class_changes() self.individuals = [] self.id_number = id_number self.cum_transition_row = self.find_cum_transition_row() if self.scheduled_servers: self.next_event_date = self.masterschedule[0] else: self.next_event_date = "Inf" self.blocked_queue = [] if self.c < 'Inf': self.servers = [Server(self, i+1) for i in range(self.c)] if simulation.detecting_deadlock: self.simulation.digraph.add_nodes_from([str(s) for s in self.servers]) def find_cdf_class_changes(self): """ Turning the pdf of the class change probabilities into a cdf. """ return [[sum(self.class_change_for_node[j][0:i+1]) for i in range(len(self.class_change_for_node[j]))] for j in range(len(self.class_change_for_node))] def find_cum_transition_row(self): """ Finds the cumulative transition row for the node """ cum_transition_row = [] for cls in range(len(self.transition_row)): sum_p = 0 cum_transition_row.append([]) for p in self.transition_row[cls]: sum_p += p cum_transition_row[cls].append(sum_p) return cum_transition_row def __repr__(self): """ Representation of a node:: """ return 'Node %s' % self.id_number def attach_server(self, server, individual): """ Attaches a server to an individual, and vice versa """ server.cust = individual server.busy = True individual.server = server if self.simulation.detecting_deadlock: for blq in self.blocked_queue: inds = [ind for ind in self.simulation.nodes[blq[0]].individuals if ind.id_number==blq[1]] ind = inds[0] if ind != individual: self.simulation.digraph.add_edge(str(ind.server), str(server)) def detatch_server(self, server, individual): """ Detatches a server from an individual, and vice versa """ server.cust = False server.busy = False individual.server = False if self.simulation.detecting_deadlock: self.simulation.digraph.remove_edges_from(self.simulation.digraph.in_edges(str(server)) + self.simulation.digraph.out_edges(str(server))) if server.offduty: self.kill_server(server) def have_event(self): """ Has an event """ if self.check_if_shiftchange(): self.change_shift() else: self.finish_service self.finish_service() def change_shift(self): """ Add servers and deletes or indicates which servers should go off duty """ highest_id = max([srvr.id_number for srvr in self.servers]) shift = self.next_event_date%self.cyclelength self.take_servers_off_duty() self.add_new_server(shift,highest_id) indx = [obs[0] for obs in self.schedule].index(shift) self.c = self.schedule[indx][1] def take_servers_off_duty(self): """ Gathers servers that should be deleted >>> from simulation import Simulation >>> from import_params import load_parameters >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_server_schedule/')) >>> N = Q.transitive_nodes[0] >>> N.add_new_server(90, 1) >>> N.servers [Server 1 at Node 1, Server 2 at Node 1, Server 3 at Node 1, Server 4 at Node 1] >>> N.servers[1].busy = True >>> N.servers[2].busy = True >>> [obs.busy for obs in N.servers] [False, True, True, False] >>> [obs.offduty for obs in N.servers] [False, False, False, False] >>> N.take_servers_off_duty() >>> N.servers [Server 2 at Node 1, Server 3 at Node 1] >>> [obs.busy for obs in N.servers] [True, True] >>> [obs.offduty for obs in N.servers] [True, True] """ to_delete = [] for srvr in self.servers: if srvr.busy: srvr.offduty = True else: to_delete.append(srvr) for obs in to_delete: self.kill_server(obs) def check_if_shiftchange(self): """ Check whether current time is a shift change >>> from simulation import Simulation >>> from import_params import load_parameters >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_server_schedule/')) >>> N = Q.transitive_nodes[0] >>> N.next_event_date = 12.0 >>> N.check_if_shiftchange() False >>> N.next_event_date = 30.0 >>> N.check_if_shiftchange() True >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_simulation/')) >>> N = Q.transitive_nodes[0] >>> N.next_event_date = 12.0 >>> N.check_if_shiftchange() False >>> N.next_event_date = 30.0 >>> N.check_if_shiftchange() False """ if self.scheduled_servers: return self.next_event_date == self.masterschedule[0] return False def finish_service(self): """ The next individual finishes service >>> from simulation import Simulation >>> from import_params import load_parameters >>> from individual import Individual >>> seed(4) >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_simulation/')) >>> N = Q.transitive_nodes[0] >>> inds = [Individual(i+1) for i in range(3)] >>> for current_time in [0.01, 0.02, 0.03]: ... N.accept(inds[int(current_time*100 - 1)], current_time) >>> N.individuals [Individual 1, Individual 2, Individual 3] >>> N.update_next_event_date(0.03) >>> round(N.next_event_date, 5) 0.03604 >>> N.finish_service() >>> N.individuals [Individual 1, Individual 3] """ if self.c == "Inf": next_individual_index = [ind.service_end_date for ind in self.individuals].index(self.next_event_date) else: next_individual_index = [ind.service_end_date for ind in self.individuals[:self.c]].index(self.next_event_date) next_individual = self.individuals[next_individual_index] self.change_customer_class(next_individual) next_node = self.next_node(next_individual.customer_class) if len(next_node.individuals) < next_node.node_capacity: self.release(next_individual_index, next_node, self.next_event_date) else: self.block_individual(next_individual, next_node) def change_customer_class(self,individual): """ Takes individual and changes customer class according to a probability distribution. >>> from simulation import Simulation >>> from individual import Individual >>> from import_params import load_parameters >>> seed(14) >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_dynamic_classes/')) >>> N1 = Q.transitive_nodes[0] >>> ind = Individual(254, 0) >>> ind.customer_class 0 >>> ind.previous_class 0 >>> N1.change_customer_class(ind) >>> ind.customer_class 0 >>> ind.previous_class 0 >>> N1.change_customer_class(ind) >>> ind.customer_class 0 >>> ind.previous_class 0 >>> N1.change_customer_class(ind) >>> ind.customer_class 1 >>> ind.previous_class 0 >>> N1.change_customer_class(ind) >>> ind.customer_class 1 >>> ind.previous_class 1 """ if self.simulation.class_change_matrix != 'NA': rnd_num=random() cdf=self.class_change_cdf[individual.customer_class] individual.previous_class=individual.customer_class inx=0 for i in cdf: if rnd_num<=i: individual.customer_class=inx break inx+=1 def block_individual(self, individual, next_node): """ Blocks the individual from entering the next node >>> from simulation import Simulation >>> from individual import Individual >>> from import_params import load_parameters >>> seed(4) >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_deadlock_sim/')) >>> inds = [Individual(i+1) for i in range(7)] >>> N1 = Q.transitive_nodes[0] >>> N1.individuals = inds[:6] >>> N2 = Q.transitive_nodes[1] >>> N2.accept(inds[6], 2) >>> inds[6].is_blocked False >>> N1.blocked_queue [] >>> Q.digraph.edges() [] >>> N2.block_individual(inds[6], N1) >>> inds[6].is_blocked True >>> N1.blocked_queue [(2, 7)] >>> Q.digraph.edges() [('Server 1 at Node 2', 'Server 2 at Node 1'), ('Server 1 at Node 2', 'Server 1 at Node 1')] """ individual.is_blocked = True self.change_state_block() next_node.blocked_queue.append((self.id_number, individual.id_number)) if self.simulation.detecting_deadlock: for svr in next_node.servers: self.simulation.digraph.add_edge(str(individual.server), str(svr)) def release(self, next_individual_index, next_node, current_time): """ Update node when an individual is released. >>> from simulation import Simulation >>> from individual import Individual >>> from import_params import load_parameters >>> seed(4) >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_simulation/')) >>> N = Q.transitive_nodes[0] >>> inds = [Individual(i+1) for i in range(3)] >>> for current_time in [0.01, 0.02, 0.03]: ... N.accept(inds[int(current_time*100 - 1)], current_time) >>> N.individuals [Individual 1, Individual 2, Individual 3] >>> N.update_next_event_date(0.03) >>> round(N.next_event_date, 5) 0.03604 >>> N.individuals[1].exit_date = 0.04 #shouldn't affect the next event date >>> N.update_next_event_date(N.next_event_date) >>> round(N.next_event_date, 5) 0.03708 >>> N.release(1, Q.transitive_nodes[1], N.next_event_date) >>> N.individuals [Individual 1, Individual 3] >>> N.update_next_event_date(N.next_event_date) >>> round(N.next_event_date, 5) 0.06447 """ next_individual = self.individuals.pop(next_individual_index) next_individual.exit_date = current_time if self.c < 'Inf': self.detatch_server(next_individual.server, next_individual) self.write_individual_record(next_individual) self.change_state_release(next_individual) self.release_blocked_individual(current_time) self.begin_service_if_possible_release(current_time) next_node.accept(next_individual, current_time) def begin_service_if_possible_release(self, current_time): """ Begins the service of the next individual, giving that customer a service time, end date and node >>> from simulation import Simulation >>> from individual import Individual >>> from import_params import load_parameters >>> seed(50) >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_deadlock_sim/')) >>> inds = [Individual(i) for i in range(30)] >>> Q.transitive_nodes[0].individuals = inds >>> ind = Q.transitive_nodes[0].individuals[Q.transitive_nodes[0].c - 1] >>> ind.service_time = 3.14 >>> ind.arrival_date = 100.0 >>> Q.digraph.nodes() ['Server 2 at Node 1', 'Server 1 at Node 2', 'Server 1 at Node 1'] >>> ind.arrival_date 100.0 >>> ind.service_time 3.14 >>> ind.service_start_date False >>> ind.service_end_date False >>> Q.transitive_nodes[0].begin_service_if_possible_release(200.0) >>> ind.arrival_date 100.0 >>> round(ind.service_time,5) 3.14 >>> ind.service_start_date 200.0 >>> round(ind.service_end_date,5) 203.14 """ if len(self.individuals) >= self.c: for ind in self.individuals[:self.c]: if not ind.service_start_date: self.attach_server(self.find_free_server(), ind) ind.service_start_date = current_time ind.service_end_date = ind.service_start_date + ind.service_time def release_blocked_individual(self, current_time): """ Releases an individual who becomes unblocked when another individual is released >>> from simulation import Simulation >>> from individual import Individual >>> from import_params import load_parameters >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_deadlock_sim/')) >>> N1 = Q.transitive_nodes[0] >>> N2 = Q.transitive_nodes[1] >>> N1.individuals = [Individual(i) for i in range(N1.c + 3)] >>> N2.individuals = [Individual(i + 100) for i in range(N2.c + 4)] >>> for ind in N1.individuals[:2]: ... N1.attach_server(N1.find_free_server(), ind) >>> for ind in N2.individuals[:1]: ... N2.attach_server(N2.find_free_server(), ind) >>> N1.individuals [Individual 0, Individual 1, Individual 2, Individual 3, Individual 4] >>> N2.individuals [Individual 100, Individual 101, Individual 102, Individual 103, Individual 104] >>> N1.release_blocked_individual(100) >>> N1.individuals [Individual 0, Individual 1, Individual 2, Individual 3, Individual 4] >>> N2.individuals [Individual 100, Individual 101, Individual 102, Individual 103, Individual 104] >>> N1.blocked_queue = [(1, 1), (2, 100)] >>> rel_ind = N1.individuals.pop(0) >>> N1.detatch_server(rel_ind.server, rel_ind) >>> N1.release_blocked_individual(110) >>> N1.individuals [Individual 2, Individual 3, Individual 4, Individual 100, Individual 1] >>> N2.individuals [Individual 101, Individual 102, Individual 103, Individual 104] """ if len(self.blocked_queue) > 0: node_to_receive_from = self.simulation.nodes[self.blocked_queue[0][0]] individual_to_receive_index = [ind.id_number for ind in node_to_receive_from.individuals].index(self.blocked_queue[0][1]) individual_to_receive = node_to_receive_from.individuals[individual_to_receive_index] self.blocked_queue.pop(0) node_to_receive_from.release(individual_to_receive_index, self, current_time) def change_state_release(self, next_individual): """ Changes the state of the system when a customer gets blocked >>> from simulation import Simulation >>> from individual import Individual >>> from import_params import load_parameters >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_simulation/')) >>> Q.state = [[0, 0], [0, 0], [2, 1], [0, 0]] >>> N = Q.transitive_nodes[2] >>> inds = [Individual(i) for i in range(3)] >>> N.individuals = inds >>> N.change_state_release(inds[0]) >>> Q.state [[0, 0], [0, 0], [1, 1], [0, 0]] >>> inds[1].is_blocked = True >>> N.change_state_release(inds[1]) >>> Q.state [[0, 0], [0, 0], [1, 0], [0, 0]] """ if next_individual.is_blocked: self.simulation.state[self.id_number-1][1] -= 1 else: self.simulation.state[self.id_number-1][0] -= 1 def change_state_block(self): """ Changes the state of the system when a customer gets blocked >>> from simulation import Simulation >>> from import_params import load_parameters >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_simulation/')) >>> Q.state = [[0, 0], [0, 0], [2, 1], [0, 0]] >>> N = Q.transitive_nodes[2] >>> N.change_state_block() >>> Q.state [[0, 0], [0, 0], [1, 2], [0, 0]] >>> N.change_state_block() >>> Q.state [[0, 0], [0, 0], [0, 3], [0, 0]] """ self.simulation.state[self.id_number-1][1] += 1 self.simulation.state[self.id_number-1][0] -= 1 def change_state_accept(self): """ Changes the state of the system when a customer gets blocked >>> from simulation import Simulation >>> from import_params import load_parameters >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_simulation/')) >>> Q.state = [[0, 0], [0, 0], [2, 1], [0, 0]] >>> N = Q.transitive_nodes[2] >>> N.change_state_accept() >>> Q.state [[0, 0], [0, 0], [3, 1], [0, 0]] >>> N.change_state_accept() >>> Q.state [[0, 0], [0, 0], [4, 1], [0, 0]] """ self.simulation.state[self.id_number-1][0] += 1 def accept(self, next_individual, current_time): """ Accepts a new customer to the queue >>> from simulation import Simulation >>> from individual import Individual >>> from import_params import load_parameters >>> seed(6) >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_simulation/')) >>> N = Q.transitive_nodes[0] >>> N.next_event_date = 0.0 >>> N.individuals [] >>> ind1 = Individual(1) >>> ind2 = Individual(2) >>> ind3 = Individual(3) >>> ind4 = Individual(4) >>> ind5 = Individual(5) >>> ind6 = Individual(6) >>> ind7 = Individual(7) >>> ind8 = Individual(8) >>> ind9 = Individual(9) >>> ind10 = Individual(10) >>> N.accept(ind1, 0.01) >>> N.individuals [Individual 1] >>> ind1.arrival_date 0.01 >>> ind1.service_start_date 0.01 >>> round(ind1.service_time, 5) 0.18695 >>> round(ind1.service_end_date, 5) 0.19695 >>> N.accept(ind2, 0.02) >>> N.accept(ind3, 0.03) >>> N.accept(ind4, 0.04) >>> N.individuals [Individual 1, Individual 2, Individual 3, Individual 4] >>> round(ind4.arrival_date, 5) 0.04 >>> round(ind4.service_start_date, 5) 0.04 >>> round(ind4.service_time, 5) 0.1637 >>> round(ind4.service_end_date, 5) 0.2037 >>> N.accept(ind5, 0.05) >>> N.accept(ind6, 0.06) >>> N.accept(ind7, 0.07) >>> N.accept(ind8, 0.08) >>> N.accept(ind9, 0.09) >>> N.accept(ind10, 0.1) >>> N.individuals [Individual 1, Individual 2, Individual 3, Individual 4, Individual 5, Individual 6, Individual 7, Individual 8, Individual 9, Individual 10] >>> round(ind10.arrival_date, 5) 0.1 >>> ind10.service_start_date False >>> round(ind10.service_time, 5) 0.16534 """ next_individual.exit_date = False next_individual.is_blocked = False self.begin_service_if_possible_accept(next_individual, current_time) self.individuals.append(next_individual) self.change_state_accept() def begin_service_if_possible_accept(self, next_individual, current_time): """ Begins the service of the next individual, giving that customer a service time, end date and node >>> from simulation import Simulation >>> from individual import Individual >>> from import_params import load_parameters >>> seed(50) >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_deadlock_sim/')) >>> ind = Individual(1) >>> Q.digraph.nodes() ['Server 2 at Node 1', 'Server 1 at Node 2', 'Server 1 at Node 1'] >>> ind.arrival_date False >>> ind.service_time False >>> ind.service_start_date False >>> ind.service_end_date False >>> Q.transitive_nodes[0].begin_service_if_possible_accept(ind, 300) >>> ind.arrival_date 300 >>> round(ind.service_time,5) 0.03382 >>> ind.service_start_date 300 >>> round(ind.service_end_date,5) 300.03382 """ next_individual.arrival_date = current_time next_individual.service_time = self.simulation.service_times[self.id_number][next_individual.customer_class]() if len(self.individuals) < self.c: if self.c < 'Inf': self.attach_server(self.find_free_server(), next_individual) next_individual.service_start_date = current_time next_individual.service_end_date = current_time + next_individual.service_time def find_free_server(self): """ Finds a free server """ free_servers = [svr for svr in self.servers if not svr.busy] return free_servers[0] def kill_server(self,srvr): """ Kills server >>> from simulation import Simulation >>> from import_params import load_parameters >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_server_schedule/')) >>> N = Q.transitive_nodes[0] >>> s = N.servers[0] >>> N.servers [Server 1 at Node 1] >>> N.kill_server(s) >>> N.servers [] """ indx = self.servers.index(srvr) del self.servers[indx] def add_new_server(self, shift, highest_id): """ Add appropriate amount of servers for the given shift >>> from simulation import Simulation >>> from import_params import load_parameters >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_server_schedule/')) >>> N = Q.transitive_nodes[0] >>> s = 90 >>> N.servers [Server 1 at Node 1] >>> N.add_new_server(s,1) >>> N.servers [Server 1 at Node 1, Server 2 at Node 1, Server 3 at Node 1, Server 4 at Node 1] """ indx = [obs[0] for obs in self.schedule].index(shift) num_servers = self.schedule[indx][1] for i in range(num_servers): self.servers.append(Server(self, highest_id+i+1)) def update_next_event_date(self, current_time): """ Finds the time of the next event at this node >>> from simulation import Simulation >>> from individual import Individual >>> from import_params import load_parameters >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_simulation/')) >>> N = Q.transitive_nodes[0] >>> N.next_event_date 'Inf' >>> N.individuals [] >>> N.update_next_event_date(0.0) >>> N.next_event_date 'Inf' >>> ind1 = Individual(1) >>> ind1.arrival_date = 0.3 >>> ind1.service_time = 0.2 >>> ind1.service_end_date = 0.5 >>> N.next_event_date = 0.3 >>> N.individuals = [ind1] >>> N.update_next_event_date(N.next_event_date) >>> N.next_event_date 0.5 >>> ind2 = Individual(2) >>> ind2.arrival_date = 0.4 >>> ind2.service_time = 0.2 >>> ind2.service_end_date = 0.6 >>> ind2.exit_date = False >>> N.individuals = [ind1, ind2] >>> N.update_next_event_date(N.next_event_date) >>> N.next_event_date 0.6 >>> ind2.exit_date = 0.9 # shouldn't affect next_event_date >>> N.update_next_event_date(N.next_event_date) >>> N.next_event_date 'Inf' >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_server_schedule/')) >>> N = Q.transitive_nodes[0] >>> N.next_event_date 30 >>> N.individuals [] >>> N.update_next_event_date(0.0) >>> N.next_event_date 30 >>> ind1 = Individual(1) >>> ind1.arrival_date = 0.3 >>> ind1.service_time = 0.2 >>> ind1.service_end_date = 0.5 >>> N.next_event_date = 0.3 >>> N.individuals = [ind1] >>> N.update_next_event_date(N.next_event_date) >>> N.next_event_date 0.5 >>> ind2 = Individual(2) >>> ind2.arrival_date = 0.7 >>> ind2.service_time = 0.2 >>> ind2.service_end_date = 0.9 >>> ind2.exit_date = False >>> N.individuals = [ind1, ind2] >>> N.update_next_event_date(N.next_event_date) >>> N.next_event_date 30 """ if self.c == "Inf": next_end_service = min([ind.service_end_date for ind in self.individuals if not ind.is_blocked if ind.service_end_date>current_time] + ["Inf"]) else: next_end_service = min([ind.service_end_date for ind in self.individuals[:self.c] if not ind.is_blocked if ind.service_end_date>current_time] + ["Inf"]) if self.scheduled_servers: next_shift_change = self.masterschedule[0] self.next_event_date = min(next_end_service, next_shift_change) else: self.next_event_date = next_end_service def next_node(self, customer_class): """ Finds the next node according the random distribution. An example showing a node choosing both nodes and exit node randomly. >>> from simulation import Simulation >>> from import_params import load_parameters >>> seed(6) >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_simulation/')) >>> node = Q.transitive_nodes[0] >>> node.next_node(0) Node 4 >>> node.next_node(0) Node 4 >>> node.next_node(0) Node 4 >>> node.next_node(0) Node 4 >>> node.next_node(0) Node 2 >>> node.next_node(0) Node 4 Another example. >>> seed(54) >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_simulation/')) >>> node = Q.transitive_nodes[2] >>> node.next_node(0) Node 2 >>> node.next_node(0) Node 4 >>> node.next_node(0) Node 2 >>> node.next_node(0) Node 2 >>> node.next_node(0) Node 2 >>> node.next_node(0) Node 2 >>> node.next_node(0) Node 4 >>> node.next_node(0) Node 2 """ rnd_num = random() for p in range(len(self.cum_transition_row[customer_class])): if rnd_num < self.cum_transition_row[customer_class][p]: return self.simulation.transitive_nodes[p] return self.simulation.nodes[-1] def write_individual_record(self, individual): """ Write a data record for an individual: - Arrival date - Wait - Service start date - Service time - Service end date - Blocked - Exit date An example showing the data records written; can only write records once an exit date has been determined. >>> from simulation import Simulation >>> from import_params import load_parameters >>> from individual import Individual >>> seed(7) >>> Q = Simulation(load_parameters('tests/datafortesting/logs_test_for_simulation/')) >>> N = Q.transitive_nodes[0] >>> ind = Individual(6) >>> N.accept(ind, 3) >>> ind.service_start_date = 3.5 >>> ind.exit_date = 9 >>> N.write_individual_record(ind) >>> ind.data_records[1][0].arrival_date 3 >>> ind.data_records[1][0].wait 0.5 >>> ind.data_records[1][0].service_start_date 3.5 >>> round(ind.data_records[1][0].service_time, 5) 0.07894 >>> round(ind.data_records[1][0].service_end_date, 5) 3.57894 >>> round(ind.data_records[1][0].blocked, 5) 5.42106 >>> ind.data_records[1][0].exit_date 9 >>> ind.data_records[1][0].customer_class 0 """ record = DataRecord(individual.arrival_date, individual.service_time, individual.service_start_date, individual.exit_date, self.id_number, individual.previous_class) if self.id_number in individual.data_records: individual.data_records[self.id_number].append(record) else: individual.data_records[self.id_number] = [record] individual.arrival_date = False individual.service_time = False individual.service_start_date = False individual.service_end_date = False individual.exit_date = False
{ "content_hash": "a05e28aaa3a619235f47a7080d8de163", "timestamp": "", "source": "github", "line_count": 858, "max_line_length": 180, "avg_line_length": 38.35081585081585, "alnum_prop": 0.534599604923264, "repo_name": "geraintpalmer/ASQ", "id": "99a283600242bc95b026315ea2633bf05142fef0", "size": "32905", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "asq/node.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "73667" } ], "symlink_target": "" }
// Copyright (c) 2019 DHGMS Solutions and Contributors. All rights reserved. // This file is licensed to you under the MIT license. // See the LICENSE file in the project root for full license information. namespace Whipstaff.IntegrationTests { /// <summary> /// Integration Tests for the API site example. /// </summary> public static class ApiSiteTests { } }
{ "content_hash": "df6a92ac8caca2d6707a362722be7ea0", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 77, "avg_line_length": 29.76923076923077, "alnum_prop": 0.7028423772609819, "repo_name": "dpvreony/Dhgms.AspNetCoreContrib", "id": "b87a791e3548fa3bb3212c4ca3d1701ffc331abf", "size": "389", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "src/Whipstaff.IntegrationTests/ApiSiteTests.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "306180" }, { "name": "CSS", "bytes": "6584" }, { "name": "Dockerfile", "bytes": "499" }, { "name": "HTML", "bytes": "25172" }, { "name": "JavaScript", "bytes": "260" }, { "name": "PowerShell", "bytes": "6945" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> <meta name="viewport" content="width=device-width,initial-scale=1"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="lang:clipboard.copy" content="Copy to clipboard"> <meta name="lang:clipboard.copied" content="Copied to clipboard"> <meta name="lang:search.language" content="en"> <meta name="lang:search.pipeline.stopwords" content="True"> <meta name="lang:search.pipeline.trimmer" content="True"> <meta name="lang:search.result.none" content="No matching documents"> <meta name="lang:search.result.one" content="1 matching document"> <meta name="lang:search.result.other" content="# matching documents"> <meta name="lang:search.tokenizer" content="[\s\-]+"> <link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin> <link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet"> <style> body, input { font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif } code, kbd, pre { font-family: "Roboto Mono", "Courier New", Courier, monospace } </style> <link rel="stylesheet" href="../_static/stylesheets/application.css"/> <link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/> <link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/> <link rel="stylesheet" href="../_static/fonts/material-icons.css"/> <meta name="theme-color" content="#3f51b5"> <script src="../_static/javascripts/modernizr.js"></script> <title>statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_cov &#8212; statsmodels</title> <link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png"> <link rel="manifest" href="../_static/icons/site.webmanifest"> <link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191"> <meta name="msapplication-TileColor" content="#2b5797"> <meta name="msapplication-config" content="../_static/icons/browserconfig.xml"> <link rel="stylesheet" href="../_static/stylesheets/examples.css"> <link rel="stylesheet" href="../_static/stylesheets/deprecation.css"> <link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="../_static/material.css" /> <link rel="stylesheet" type="text/css" href="../_static/graphviz.css" /> <link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" /> <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> <script src="../_static/jquery.js"></script> <script src="../_static/underscore.js"></script> <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> <script src="../_static/doctools.js"></script> <script src="../_static/sphinx_highlight.js"></script> <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script> <script>window.MathJax = {"tex": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true}, "options": {"ignoreHtmlClass": "tex2jax_ignore|mathjax_ignore|document", "processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script> <script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> <link rel="shortcut icon" href="../_static/favicon.ico"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_intercept" href="statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_intercept.html" /> <link rel="prev" title="statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs" href="statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs.html" /> </head> <body dir=ltr data-md-color-primary=indigo data-md-color-accent=blue> <svg class="md-svg"> <defs data-children-count="0"> <svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg> </defs> </svg> <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer"> <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search"> <label class="md-overlay" data-md-component="overlay" for="__drawer"></label> <a href="#generated/statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_cov" tabindex="1" class="md-skip"> Skip to content </a> <header class="md-header" data-md-component="header"> <nav class="md-header-nav md-grid"> <div class="md-flex navheader"> <div class="md-flex__cell md-flex__cell--shrink"> <a href="../index.html" title="statsmodels" class="md-header-nav__button md-logo"> <img src="../_static/statsmodels-logo-v2-bw.svg" height="26" alt="statsmodels logo"> </a> </div> <div class="md-flex__cell md-flex__cell--shrink"> <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label> </div> <div class="md-flex__cell md-flex__cell--stretch"> <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title"> <span class="md-header-nav__topic">statsmodels 0.13.3</span> <span class="md-header-nav__topic"> statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_cov </span> </div> </div> <div class="md-flex__cell md-flex__cell--shrink"> <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label> <div class="md-search" data-md-component="search" role="dialog"> <label class="md-search__overlay" for="__search"></label> <div class="md-search__inner" role="search"> <form class="md-search__form" action="../search.html" method="get" name="search"> <input type="text" class="md-search__input" name="q" placeholder="Search" autocapitalize="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active"> <label class="md-icon md-search__icon" for="__search"></label> <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1"> &#xE5CD; </button> </form> <div class="md-search__output"> <div class="md-search__scrollwrap" data-md-scrollfix> <div class="md-search-result" data-md-component="result"> <div class="md-search-result__meta"> Type to start searching </div> <ol class="md-search-result__list"></ol> </div> </div> </div> </div> </div> </div> <div class="md-flex__cell md-flex__cell--shrink"> <div class="md-header-nav__source"> <a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github"> <div class="md-source__icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28"> <use xlink:href="#__github" width="24" height="24"></use> </svg> </div> <div class="md-source__repository"> statsmodels </div> </a> </div> </div> <script src="../_static/javascripts/version_dropdown.js"></script> <script> var json_loc = "../../versions-v2.json", target_loc = "../../", text = "Versions"; $( document ).ready( add_version_dropdown(json_loc, target_loc, text)); </script> </div> </nav> </header> <div class="md-container"> <nav class="md-tabs" data-md-component="tabs"> <div class="md-tabs__inner md-grid"> <ul class="md-tabs__list"> <li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li> <li class="md-tabs__item"><a href="../statespace.html" class="md-tabs__link">Time Series Analysis by State Space Methods <code class="xref py py-mod docutils literal notranslate"><span class="pre">statespace</span></code></a></li> <li class="md-tabs__item"><a href="statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.html" class="md-tabs__link">statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother</a></li> </ul> </div> </nav> <main class="md-main"> <div class="md-main__inner md-grid" data-md-component="container"> <div class="md-sidebar md-sidebar--primary" data-md-component="navigation"> <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--primary" data-md-level="0"> <label class="md-nav__title md-nav__title--site" for="__drawer"> <a href="../index.html" title="statsmodels" class="md-nav__button md-logo"> <img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48"> </a> <a href="../index.html" title="statsmodels">statsmodels 0.13.3</a> </label> <div class="md-nav__source"> <a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github"> <div class="md-source__icon"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28"> <use xlink:href="#__github" width="24" height="24"></use> </svg> </div> <div class="md-source__repository"> statsmodels </div> </a> </div> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="../install.html" class="md-nav__link">Installing statsmodels</a> </li> <li class="md-nav__item"> <a href="../gettingstarted.html" class="md-nav__link">Getting started</a> </li> <li class="md-nav__item"> <a href="../user-guide.html" class="md-nav__link">User Guide</a> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="../user-guide.html#background" class="md-nav__link">Background</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="../tsa.html" class="md-nav__link">Time Series analysis <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa</span></code></a> </li> <li class="md-nav__item"> <a href="../statespace.html" class="md-nav__link">Time Series Analysis by State Space Methods <code class="xref py py-mod docutils literal notranslate"><span class="pre">statespace</span></code></a> </li> <li class="md-nav__item"> <a href="../vector_ar.html" class="md-nav__link">Vector Autoregressions <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa.vector_ar</span></code></a> </li></ul> </li> <li class="md-nav__item"> <a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a> </li> <li class="md-nav__item"> <a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a> </li></ul> </li> <li class="md-nav__item"> <a href="../examples/index.html" class="md-nav__link">Examples</a> </li> <li class="md-nav__item"> <a href="../api.html" class="md-nav__link">API Reference</a> </li> <li class="md-nav__item"> <a href="../about.html" class="md-nav__link">About statsmodels</a> </li> <li class="md-nav__item"> <a href="../dev/index.html" class="md-nav__link">Developer Page</a> </li> <li class="md-nav__item"> <a href="../release/index.html" class="md-nav__link">Release Notes</a> </li> </ul> </nav> </div> </div> </div> <div class="md-sidebar md-sidebar--secondary" data-md-component="toc"> <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--secondary"> <label class="md-nav__title" for="__toc">Contents</label> <ul class="md-nav__list" data-md-scrollfix=""> <li class="md-nav__item"><a href="#generated-statsmodels-tsa-statespace-simulation-smoother-simulationsmoother-obs-cov--page-root" class="md-nav__link">statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_cov</a><nav class="md-nav"> <ul class="md-nav__list"> <li class="md-nav__item"><a href="#statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_cov" class="md-nav__link"><code class="docutils literal notranslate"><span class="pre">SimulationSmoother.obs_cov</span></code></a> </li></ul> </nav> </li> <li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_cov.rst.txt">Show Source</a> </li> <li id="searchbox" class="md-nav__item"></li> </ul> </nav> </div> </div> </div> <div class="md-content"> <article class="md-content__inner md-typeset" role="main"> <section id="statsmodels-tsa-statespace-simulation-smoother-simulationsmoother-obs-cov"> <h1 id="generated-statsmodels-tsa-statespace-simulation-smoother-simulationsmoother-obs-cov--page-root">statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_cov<a class="headerlink" href="#generated-statsmodels-tsa-statespace-simulation-smoother-simulationsmoother-obs-cov--page-root" title="Permalink to this heading">¶</a></h1> <dl class="py attribute"> <dt class="sig sig-object py" id="statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_cov"> <span class="sig-prename descclassname"><span class="pre">SimulationSmoother.</span></span><span class="sig-name descname"><span class="pre">obs_cov</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">None</span></em><a class="headerlink" href="#statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_cov" title="Permalink to this definition">¶</a></dt> <dd><p>(array) Observation covariance matrix: <span class="math notranslate nohighlight">\(H~(k\_endog \times k\_endog \times nobs)\)</span></p> </dd></dl> </section> </article> </div> </div> </main> </div> <footer class="md-footer"> <div class="md-footer-nav"> <nav class="md-footer-nav__inner md-grid"> <a href="statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs.html" title="statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev"> <div class="md-flex__cell md-flex__cell--shrink"> <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i> </div> <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"> <span class="md-flex__ellipsis"> <span class="md-footer-nav__direction"> Previous </span> statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs </span> </div> </a> <a href="statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_intercept.html" title="statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_intercept" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next"> <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span class="md-flex__ellipsis"> <span class="md-footer-nav__direction"> Next </span> statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_intercept </span> </div> <div class="md-flex__cell md-flex__cell--shrink"><i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i> </div> </a> </nav> </div> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class="md-footer-copyright"> <div class="md-footer-copyright__highlight"> &#169; Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers. </div> Last updated on Nov 01, 2022. <br/> Created using <a href="http://www.sphinx-doc.org/">Sphinx</a> 5.3.0. and <a href="https://github.com/bashtage/sphinx-material/">Material for Sphinx</a> </div> </div> </div> </footer> <script src="../_static/javascripts/application.js"></script> <script>app.initialize({version: "1.0.4", url: {base: ".."}})</script> </body> </html>
{ "content_hash": "3b253e757ac4f4d24dc40d660533ed1e", "timestamp": "", "source": "github", "line_count": 460, "max_line_length": 999, "avg_line_length": 42.47391304347826, "alnum_prop": 0.6153137475688402, "repo_name": "statsmodels/statsmodels.github.io", "id": "3b1565e93cd419d6158d8ca40b5c7fd6b52e7fd5", "size": "19542", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "v0.13.3/generated/statsmodels.tsa.statespace.simulation_smoother.SimulationSmoother.obs_cov.html", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
 #include <aws/glue/model/TriggerUpdate.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace Glue { namespace Model { TriggerUpdate::TriggerUpdate() : m_nameHasBeenSet(false), m_descriptionHasBeenSet(false), m_scheduleHasBeenSet(false), m_actionsHasBeenSet(false), m_predicateHasBeenSet(false), m_eventBatchingConditionHasBeenSet(false) { } TriggerUpdate::TriggerUpdate(JsonView jsonValue) : m_nameHasBeenSet(false), m_descriptionHasBeenSet(false), m_scheduleHasBeenSet(false), m_actionsHasBeenSet(false), m_predicateHasBeenSet(false), m_eventBatchingConditionHasBeenSet(false) { *this = jsonValue; } TriggerUpdate& TriggerUpdate::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("Name")) { m_name = jsonValue.GetString("Name"); m_nameHasBeenSet = true; } if(jsonValue.ValueExists("Description")) { m_description = jsonValue.GetString("Description"); m_descriptionHasBeenSet = true; } if(jsonValue.ValueExists("Schedule")) { m_schedule = jsonValue.GetString("Schedule"); m_scheduleHasBeenSet = true; } if(jsonValue.ValueExists("Actions")) { Array<JsonView> actionsJsonList = jsonValue.GetArray("Actions"); for(unsigned actionsIndex = 0; actionsIndex < actionsJsonList.GetLength(); ++actionsIndex) { m_actions.push_back(actionsJsonList[actionsIndex].AsObject()); } m_actionsHasBeenSet = true; } if(jsonValue.ValueExists("Predicate")) { m_predicate = jsonValue.GetObject("Predicate"); m_predicateHasBeenSet = true; } if(jsonValue.ValueExists("EventBatchingCondition")) { m_eventBatchingCondition = jsonValue.GetObject("EventBatchingCondition"); m_eventBatchingConditionHasBeenSet = true; } return *this; } JsonValue TriggerUpdate::Jsonize() const { JsonValue payload; if(m_nameHasBeenSet) { payload.WithString("Name", m_name); } if(m_descriptionHasBeenSet) { payload.WithString("Description", m_description); } if(m_scheduleHasBeenSet) { payload.WithString("Schedule", m_schedule); } if(m_actionsHasBeenSet) { Array<JsonValue> actionsJsonList(m_actions.size()); for(unsigned actionsIndex = 0; actionsIndex < actionsJsonList.GetLength(); ++actionsIndex) { actionsJsonList[actionsIndex].AsObject(m_actions[actionsIndex].Jsonize()); } payload.WithArray("Actions", std::move(actionsJsonList)); } if(m_predicateHasBeenSet) { payload.WithObject("Predicate", m_predicate.Jsonize()); } if(m_eventBatchingConditionHasBeenSet) { payload.WithObject("EventBatchingCondition", m_eventBatchingCondition.Jsonize()); } return payload; } } // namespace Model } // namespace Glue } // namespace Aws
{ "content_hash": "c7052234d85abf6088d234cd39920696", "timestamp": "", "source": "github", "line_count": 139, "max_line_length": 94, "avg_line_length": 20.56115107913669, "alnum_prop": 0.708187543736879, "repo_name": "cedral/aws-sdk-cpp", "id": "1adf1248924dad9f72ec1f0a412e8c22bb6427a7", "size": "2977", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "aws-cpp-sdk-glue/source/model/TriggerUpdate.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "294220" }, { "name": "C++", "bytes": "428637022" }, { "name": "CMake", "bytes": "862025" }, { "name": "Dockerfile", "bytes": "11688" }, { "name": "HTML", "bytes": "7904" }, { "name": "Java", "bytes": "352201" }, { "name": "Python", "bytes": "106761" }, { "name": "Shell", "bytes": "10891" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Web.Http; using System.Web.OData; namespace WebStack.QA.Test.OData.DollarFormat { public class DollarFormatCustomersController : ODataController { private IList<DollarFormatCustomer> customers = Enumerable.Range(0, 10).Select(i => new DollarFormatCustomer { Id = i, Name = "Customer Name " + i, Orders = Enumerable.Range(0, i).Select(j => new DollarFormatOrder { Id = i * 10 + j, PurchaseDate = DateTime.Today.Subtract(TimeSpan.FromDays(i * 10 + j)), Detail = "This is Order " + i * 10 + j }).ToList(), SpecialOrder = new DollarFormatOrder { Id = i * 10, PurchaseDate = DateTime.Today.Subtract(TimeSpan.FromDays(i * 10)), Detail = "This is Order " + i * 10 } }).ToList(); [EnableQuery(PageSize = 10, MaxExpansionDepth = 5)] public IHttpActionResult Get() { return Ok(customers); } [EnableQuery(PageSize = 10, MaxExpansionDepth = 5)] public IHttpActionResult Get(int key) { var customer = customers.FirstOrDefault(c => c.Id == key); if (customer == null) { throw new ArgumentOutOfRangeException("key"); } return Ok(customer); } } }
{ "content_hash": "92d5c14b56a41a7e47eba9062dea51ca", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 98, "avg_line_length": 34.36734693877551, "alnum_prop": 0.4815914489311164, "repo_name": "lewischeng-ms/WebApi", "id": "35de370e59716f2939d5ae8315e18efa087efa95", "size": "1686", "binary": false, "copies": "8", "ref": "refs/heads/OData60", "path": "OData/test/E2ETest/WebStack.QA.Test.OData/DollarFormat/DollarFormatController.cs", "mode": "33188", "license": "mit", "language": [ { "name": "1C Enterprise", "bytes": "185749" }, { "name": "ASP", "bytes": "119" }, { "name": "Batchfile", "bytes": "2842" }, { "name": "C#", "bytes": "14865821" }, { "name": "JavaScript", "bytes": "7493" }, { "name": "PowerShell", "bytes": "382" } ], "symlink_target": "" }
#ifndef LISTCTRLFORMATTER_H #define LISTCTRLFORMATTER_H #include <string> /*! \brief Helper to setup ListCtrl columns format. */ class ListCtrlFormatter { public: /*! * Constructor. * \param list List control to setup. */ ListCtrlFormatter( CListCtrl &list ); /*! * Destructeur. */ virtual ~ListCtrlFormatter(); /*! Adds a column to the list control. * \param strHeading Column title. * \param nWidth Column width in pixel. (-1 if not defined). * \param nFormat Text alignment (LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_CENTER). * \param nSubItemNo Index of the sub-item associates to the column. */ void AddColumn( const std::string &strHeading, int nWidth =-1, int nFormat = LVCFMT_LEFT, int nSubItemNo =-1 ); /*! Adds a column to the list control. * \param strHeading Column title. * \param nWidth Column width in pixel. (-1 if not defined). * \param nFormat Text alignment (LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_CENTER). * \param nSubItemNo Index of the sub-item associates to the column. */ void AddColumn( CString strHeading, int nWidth =-1, int nFormat = LVCFMT_LEFT, int nSubItemNo =-1 ); /*! Adds a column to the list control. * \param nIdStringHeading Resource ID of the column title string (IDS_xxx). * \param nWidth Column width in pixel. (-1 if not defined). * \param nFormat Text alignment (LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_CENTER). * \param nSubItemNo Index of the sub-item associates to the column. */ void AddColumn( UINT nIdStringHeading, int nWidth =-1, int nFormat = LVCFMT_LEFT, int nSubItemNo =-1 ); /*! Gets the sub item index of the next column. * \return Sub item index of the next column, starting with 0. */ int GetNextColumnIndex() const; private: /*! Associated list control. */ CListCtrl &m_List; /*! Next column number. */ int m_nColNo; }; #endif //WILLISTCTRLFORMATTER_H
{ "content_hash": "6011c91ea5e3e65c5a06ceb46d5212ec", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 78, "avg_line_length": 29.154929577464788, "alnum_prop": 0.6347826086956522, "repo_name": "sli-fox/jamms", "id": "badb7aab92999a982217579600bb704007228bfb", "size": "2070", "binary": false, "copies": "31", "ref": "refs/heads/master", "path": "TowerDefense/cppunit/src/msvc6/testrunner/ListCtrlFormatter.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "78516" }, { "name": "C++", "bytes": "1995658" }, { "name": "CSS", "bytes": "52549" }, { "name": "JavaScript", "bytes": "104315" }, { "name": "Prolog", "bytes": "6910" }, { "name": "Shell", "bytes": "2059" }, { "name": "TeX", "bytes": "1127055" }, { "name": "XSLT", "bytes": "6316" } ], "symlink_target": "" }
''' Provide the Auto property. ''' #----------------------------------------------------------------------------- # Boilerplate #----------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function, unicode_literals import logging log = logging.getLogger(__name__) #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- # Standard library imports # External imports # Bokeh imports from .enum import Enum #----------------------------------------------------------------------------- # Globals and constants #----------------------------------------------------------------------------- __all__ = ( 'Auto', ) #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- class Auto(Enum): ''' Accepts only the string "auto". Useful for properties that can be configured to behave "automatically". Example: This property is often most useful in conjunction with the :class:`~bokeh.core.properties.Either` property. .. code-block:: python >>> class AutoModel(HasProps): ... prop = Either(Float, Auto) ... >>> m = AutoModel() >>> m.prop = 10.2 >>> m.prop = "auto" >>> m.prop = "foo" # ValueError !! >>> m.prop = [1, 2, 3] # ValueError !! ''' def __init__(self): super(Auto, self).__init__("auto") def __str__(self): return self.__class__.__name__ def _sphinx_type(self): return self._sphinx_prop_link() #----------------------------------------------------------------------------- # Dev API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Private API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Code #-----------------------------------------------------------------------------
{ "content_hash": "44a6d18fc2e7260b9b0475c5c1f93915", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 82, "avg_line_length": 28.23170731707317, "alnum_prop": 0.2920086393088553, "repo_name": "stonebig/bokeh", "id": "51079f01e023592368e00196d1dd1a37dade9d05", "size": "2646", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "bokeh/core/property/auto.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "5455" }, { "name": "CSS", "bytes": "423978" }, { "name": "CoffeeScript", "bytes": "1961885" }, { "name": "HTML", "bytes": "1556638" }, { "name": "JavaScript", "bytes": "4741" }, { "name": "Makefile", "bytes": "5785" }, { "name": "Python", "bytes": "1696641" }, { "name": "Shell", "bytes": "14856" } ], "symlink_target": "" }
//========================================================================================== // // MapSurfer.Web.Hosting // Copyright (c) 2008-2015, MapSurfer.NET // // Authors: Maxim Rylov // //========================================================================================== using System; using System.Configuration; using System.IO; using System.Reflection; using System.Web; using System.Web.Hosting; using MapSurfer.Web.Interfaces.AspNet; [assembly: PreApplicationStartMethod(typeof(MapSurfer.Web.Hosting.AspNet.AspNetHostMapService), "RegisterModules")] namespace MapSurfer.Web.Hosting.AspNet { # region ************** Configuration Section ************** public class DynamicHttpModulesConfiguration : ConfigurationSection { public DynamicHttpModulesConfiguration() { } [ConfigurationProperty("Modules")] public DynamicHttpModuleCollection Modules { get { return ((DynamicHttpModuleCollection)(base["Modules"])); } } } public class DynamicHttpModuleElement : ConfigurationElement { public DynamicHttpModuleElement() : this(string.Empty, string.Empty) { } public DynamicHttpModuleElement(string name, string type) { Name = name; Type = type; } [ConfigurationProperty("name", DefaultValue = "", IsRequired = true, IsKey = true)] public string Name { get { return (string)this["name"]; } set { this["name"] = value; } } [ConfigurationProperty("type", DefaultValue = "", IsRequired = true, IsKey = false)] public string Type { get { return (string)this["type"]; } set { this["type"] = value; } } [ConfigurationProperty("path", DefaultValue = "", IsRequired = true, IsKey = false)] public string Path { get { return (string)this["path"]; } set { this["path"] = value; } } } public class DynamicHttpModuleCollection : ConfigurationElementCollection { public DynamicHttpModuleElement this[int index] { get { return base.BaseGet(index) as DynamicHttpModuleElement; } set { if (base.BaseGet(index) != null) { base.BaseRemoveAt(index); } this.BaseAdd(index, value); } } protected override ConfigurationElement CreateNewElement() { return new DynamicHttpModuleElement(); } protected override object GetElementKey(ConfigurationElement element) { return ((DynamicHttpModuleElement)element).Name; } } #endregion /// <summary> /// Summary description for AspNetHostMapService /// </summary> public class AspNetHostMapService : AbstractMapService, IRegisteredObject { private static readonly Action<Type> Fx45RegisterModuleDelegate = GetFx45RegisterModuleDelegate(); public AspNetHostMapService() { System.Web.Hosting.HostingEnvironment.RegisterObject(this); #if !MONO try { MapSurfer.Web.HostingEnvironment.SetWebSiteName(System.Web.Hosting.HostingEnvironment.ApplicationHost.GetSiteName()); } catch { } #endif } private static Action<Type> GetFx45RegisterModuleDelegate() { MethodInfo method = null; try { method = typeof(HttpApplication).GetMethod("RegisterModule", BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof(Type) }, null); if (!(method != null)) { return null; } } catch (Exception ex) { throw new Exception("Unable to find the method RegisterModule in HttpApplication.", ex); } return (Action<Type>)Delegate.CreateDelegate(typeof(Action<Type>), method); } public static void RegisterModules() { CheckInstallPath(); string strVersion = (string)ConfigurationManager.AppSettings["MapSurfer.Version"]; AssemblyLoader.Register(strVersion); try { DynamicHttpModulesConfiguration section = (DynamicHttpModulesConfiguration)ConfigurationManager.GetSection("DynamicHttpModules"); if (section != null) { foreach (DynamicHttpModuleElement module in section.Modules) { string path = module.Path; Assembly assembly = null; if (!string.IsNullOrEmpty(path) || !Path.IsPathRooted(path)) { assembly = AssemblyLoader.LoadAssembly(path); } else { if (File.Exists(path)) { AssemblyName name = AssemblyName.GetAssemblyName(path); assembly = Assembly.Load(name); } } if (assembly == null) continue; string typeName = module.Type; if (typeName != null) { int index = typeName.IndexOf(","); if (index > 0) typeName = typeName.Substring(0, index); Type type = assembly.GetType(typeName, true); if (type == null) { System.Diagnostics.Debug.WriteLine("Unable to find the type " + typeName); } else { RegisterModule(type); } } } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message + "StackTrace:" + ex.StackTrace); throw ex; } AssemblyLoader.Unregister(); } private static void RegisterModule(Type type) { try { if (Fx45RegisterModuleDelegate != null) { Fx45RegisterModuleDelegate(type); } else { #if !MONO && !DEBUG // Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule(type); #endif } } catch (Exception ex) { throw new Exception("Unable to register type " + type.FullName, ex); } } public void Stop(bool immediate) { if (immediate == false) { base.Stop(); } else { System.Web.Hosting.HostingEnvironment.UnregisterObject(this); } } } }
{ "content_hash": "8ef4fefc18c13b9e392b35c2fb23ded9", "timestamp": "", "source": "github", "line_count": 247, "max_line_length": 137, "avg_line_length": 25.19838056680162, "alnum_prop": 0.5747107969151671, "repo_name": "MapSurferNET/MapSurfer.NET-Web", "id": "c5320fc67a4ac5ee0b3d3d01836826de42c3fb52", "size": "6226", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Hosting/ASP.NET/Service/AspNetHostMapService.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "2135" }, { "name": "C#", "bytes": "45120" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>poltac: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.12.0 / poltac - 0.8.8</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> poltac <small> 0.8.8 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-09-14 03:58:21 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-09-14 03:58:21 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.12.0 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.07.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.07.1 Official release 4.07.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.5 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;thery@sophia.inria.fr&quot; homepage: &quot;https://github.com/thery/PolTac&quot; bug-reports: &quot;https://github.com/thery/PolTac&quot; dev-repo: &quot;git://github.com/thery/PolTac&quot; license: &quot;LGPL&quot; authors: [&quot;Laurent Théry&quot;] install: [ [make] [make &quot;install&quot;] ] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/PolTac&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.8~&quot; &amp; &lt; &quot;8.11&quot;} ] synopsis: &quot;A set of tactics to deal with inequalities in Coq over N, Z and R:&quot; flags: light-uninstall url { src: &quot;https://github.com/thery/PolTac/archive/8.8.zip&quot; checksum: &quot;md5=ce09898d4435b50a4a9503d41623222f&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-poltac.0.8.8 coq.8.12.0</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.12.0). The following dependencies couldn&#39;t be met: - coq-poltac -&gt; coq &lt; 8.11 -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-poltac.0.8.8</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "dd14bdc52a0687e1464dc0adf656a87c", "timestamp": "", "source": "github", "line_count": 163, "max_line_length": 159, "avg_line_length": 39.28834355828221, "alnum_prop": 0.5254528419737664, "repo_name": "coq-bench/coq-bench.github.io", "id": "fb50927f9b247ba024066fb7770d8bfdc3ae281f", "size": "6430", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.07.1-2.0.6/released/8.12.0/poltac/0.8.8.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
<div class="container" data-ng-controller="HeaderController"> <div class="navbar-header"> <button class="navbar-toggle" type="button" data-ng-click="toggleCollapsibleMenu()"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand">UF Database Collaboration Project</a> </div> <nav class="collapse navbar-collapse" collapse="!isCollapsed" role="navigation"> <ul class="nav navbar-nav" data-ng-if="menu.shouldRender(authentication.user);"> <li data-ng-repeat="item in menu.items | orderBy: 'position'" data-ng-if="item.shouldRender(authentication.user);" ng-switch="item.menuItemType" ui-route="{{item.uiRoute}}" class="{{item.menuItemClass}}" ng-class="{active: ($uiRoute)}" dropdown="item.menuItemType === 'dropdown'"> <a ng-switch-when="dropdown" class="dropdown-toggle"> <span data-ng-bind="item.title"></span> <b class="caret"></b> </a> <ul ng-switch-when="dropdown" class="dropdown-menu"> <li data-ng-repeat="subitem in item.items | orderBy: 'position'" data-ng-if="subitem.shouldRender(authentication.user);" ui-route="{{subitem.uiRoute}}" ng-class="{active: $uiRoute}"> <a href="/#!/{{subitem.link}}" data-ng-bind="subitem.title"></a> </li> </ul> <a ng-switch-default href="/#!/{{item.link}}" data-ng-bind="item.title"></a> </li> </ul> <ul class="nav navbar-nav navbar-right" data-ng-hide="authentication.user"> <li ui-route="/signup" ng-class="{active: $uiRoute}"> <a href="/#!/signup">Sign Up</a> </li> <li class="divider-vertical"></li> <li ui-route="/signin" ng-class="{active: $uiRoute}"> <a href="/#!/signin">Sign In</a> </li> </ul> <ul class="nav navbar-nav navbar-right" data-ng-show="authentication.user"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <span data-ng-bind="authentication.user.displayName"></span> <b class="caret"></b> </a> <ul class="dropdown-menu"> <li> <a href="/#!/settings/profile">View Profile</a> </li> <li> <a href="/#!/settings/list">View Users</a> </li> <li data-ng-show="authentication.user.provider === 'local'"> <a href="/#!/settings/password">Change Password</a> </li> <li class="divider"></li> <li> <a href="/auth/signout">Signout</a> </li> </ul> </li> </ul> </nav> </div>
{ "content_hash": "dfc91045586d91f402bc53076a8dc405", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 283, "avg_line_length": 42, "alnum_prop": 0.62590799031477, "repo_name": "kuncao0228/CEN3031FA14-master", "id": "5da2e248c0db0bb24912dcb2d2a0f4c5372b6681", "size": "2478", "binary": false, "copies": "1", "ref": "refs/heads/Kun", "path": "public/modules/core/views/header.client.view.html", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "198958" }, { "name": "Java", "bytes": "4440" }, { "name": "JavaScript", "bytes": "152764" }, { "name": "Perl", "bytes": "48" }, { "name": "Shell", "bytes": "669" } ], "symlink_target": "" }
package net.glowstone.net.message.play.inv; import com.flowpowered.network.Message; import lombok.Data; import org.bukkit.inventory.ItemStack; @Data public final class SetWindowSlotMessage implements Message { private final int id; private final int slot; private final ItemStack item; }
{ "content_hash": "7c83405066d99652bc904fd4ccfa68a0", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 60, "avg_line_length": 21.714285714285715, "alnum_prop": 0.7796052631578947, "repo_name": "GlowstonePlusPlus/GlowstonePlusPlus", "id": "a5956ab4a6d11a9336d79b16c9379840674b5c97", "size": "304", "binary": false, "copies": "2", "ref": "refs/heads/dev", "path": "src/main/java/net/glowstone/net/message/play/inv/SetWindowSlotMessage.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "2325722" }, { "name": "Python", "bytes": "1031" }, { "name": "Ruby", "bytes": "335" }, { "name": "Shell", "bytes": "2214" } ], "symlink_target": "" }
package org.killbill.billing.payment; import java.util.UUID; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.LocalDate; import org.killbill.billing.GuicyKillbillTestSuite; import org.killbill.billing.GuicyKillbillTestSuiteNoDB; import org.killbill.billing.account.api.Account; import org.killbill.billing.account.api.AccountInternalApi; import org.killbill.billing.account.api.AccountUserApi; import org.killbill.billing.account.api.ImmutableAccountInternalApi; import org.killbill.billing.callcontext.InternalCallContext; import org.killbill.billing.callcontext.InternalTenantContext; import org.killbill.billing.callcontext.MutableCallContext; import org.killbill.billing.callcontext.MutableInternalCallContext; import org.killbill.billing.catalog.api.Currency; import org.killbill.billing.events.InvoiceCreationInternalEvent; import org.killbill.billing.invoice.api.Invoice; import org.killbill.billing.invoice.api.InvoiceApiException; import org.killbill.billing.invoice.api.InvoiceInternalApi; import org.killbill.billing.invoice.api.InvoiceItem; import org.killbill.billing.mock.MockAccountBuilder; import org.killbill.billing.payment.api.PaymentApi; import org.killbill.billing.payment.api.PaymentMethodPlugin; import org.killbill.billing.payment.api.PluginProperty; import org.killbill.billing.payment.provider.DefaultNoOpPaymentMethodPlugin; import org.killbill.billing.payment.provider.MockPaymentProviderPlugin; import org.killbill.billing.util.callcontext.CallContext; import org.killbill.billing.util.callcontext.InternalCallContextFactory; import org.killbill.billing.util.dao.NonEntityDao; import org.killbill.bus.api.PersistentBus; import org.killbill.bus.api.PersistentBus.EventBusException; import org.killbill.clock.Clock; import org.mockito.Mockito; import com.google.common.collect.ImmutableList; import com.google.inject.Inject; public class TestPaymentHelper { protected final AccountUserApi accountApi; protected final AccountInternalApi accountInternalApi; protected final ImmutableAccountInternalApi immutableAccountInternalApi; protected final InvoiceInternalApi invoiceApi; private final PersistentBus eventBus; private final Clock clock; private final NonEntityDao nonEntityDao; private final MutableInternalCallContext internalCallContext; private final InternalCallContextFactory internalCallContextFactory; private final CallContext context; protected PaymentApi paymentApi; @Inject public TestPaymentHelper(final AccountUserApi accountApi, final AccountInternalApi accountInternalApi, final ImmutableAccountInternalApi immutableAccountInternalApi, final InvoiceInternalApi invoiceApi, final PaymentApi paymentApi, final PersistentBus eventBus, final Clock clock, final NonEntityDao nonEntityDao, final MutableInternalCallContext internalCallContext, final InternalCallContextFactory internalCallContextFactory, final CallContext context) { this.accountApi = accountApi; this.eventBus = eventBus; this.accountInternalApi = accountInternalApi; this.immutableAccountInternalApi = immutableAccountInternalApi; this.invoiceApi = invoiceApi; this.paymentApi = paymentApi; this.clock = clock; this.nonEntityDao = nonEntityDao; this.internalCallContext = internalCallContext; this.internalCallContextFactory = internalCallContextFactory; this.context = context; } public Invoice createTestInvoice(final Account account, final LocalDate targetDate, final Currency currency, final InvoiceItem... items) throws EventBusException, InvoiceApiException { final Invoice invoice = new MockInvoice(account.getId(), clock.getUTCToday(), targetDate, currency); for (final InvoiceItem item : items) { if (item instanceof MockRecurringInvoiceItem) { final MockRecurringInvoiceItem recurringInvoiceItem = (MockRecurringInvoiceItem) item; invoice.addInvoiceItem(new MockRecurringInvoiceItem(invoice.getId(), account.getId(), recurringInvoiceItem.getBundleId(), recurringInvoiceItem.getSubscriptionId(), recurringInvoiceItem.getPlanName(), recurringInvoiceItem.getPhaseName(), null, recurringInvoiceItem.getStartDate(), recurringInvoiceItem.getEndDate(), recurringInvoiceItem.getAmount(), recurringInvoiceItem.getRate(), recurringInvoiceItem.getCurrency())); } } Mockito.when(invoiceApi.getInvoiceById(Mockito.eq(invoice.getId()), Mockito.<InternalTenantContext>any())).thenReturn(invoice); Mockito.when(invoiceApi.getInvoiceForPaymentId(Mockito.<UUID>any(), Mockito.<InternalCallContext>any())).thenReturn(invoice); Mockito.when(invoiceApi.getInvoiceStatus(Mockito.<UUID>any(), Mockito.<InternalCallContext>any())).thenReturn(invoice.getStatus()); final InvoiceCreationInternalEvent event = new MockInvoiceCreationEvent(invoice.getId(), invoice.getAccountId(), invoice.getBalance(), invoice.getCurrency(), invoice.getInvoiceDate(), internalCallContext.getAccountRecordId(), internalCallContext.getTenantRecordId(), null); eventBus.post(event); return invoice; } public Account createTestAccount(final String email, final boolean addPaymentMethod) throws Exception { final String name = "First" + UUID.randomUUID().toString() + " " + "Last" + UUID.randomUUID().toString(); final String externalKey = UUID.randomUUID().toString(); final Account accountData = Mockito.mock(Account.class); Mockito.when(accountData.getId()).thenReturn(UUID.randomUUID()); Mockito.when(accountData.getExternalKey()).thenReturn(externalKey); Mockito.when(accountData.getName()).thenReturn(name); Mockito.when(accountData.getFirstNameLength()).thenReturn(10); Mockito.when(accountData.getPhone()).thenReturn("123-456-7890"); Mockito.when(accountData.getEmail()).thenReturn(email); Mockito.when(accountData.getCurrency()).thenReturn(Currency.USD); Mockito.when(accountData.getBillCycleDayLocal()).thenReturn(1); Mockito.when(accountData.isMigrated()).thenReturn(false); Mockito.when(accountData.getTimeZone()).thenReturn(DateTimeZone.UTC); final DateTime utcNow = clock.getUTCNow(); Mockito.when(accountData.getCreatedDate()).thenReturn(utcNow); Mockito.when(accountData.getReferenceTime()).thenReturn(utcNow); final MutableCallContext mutableCallContext = new MutableCallContext(internalCallContext); Account account; if (isFastTest()) { account = GuicyKillbillTestSuiteNoDB.createMockAccount(accountData, accountApi, accountInternalApi, immutableAccountInternalApi, nonEntityDao, clock, internalCallContextFactory, mutableCallContext, internalCallContext); } else { account = accountApi.createAccount(accountData, context); } GuicyKillbillTestSuite.refreshCallContext(account.getId(), clock, internalCallContextFactory, mutableCallContext, internalCallContext); if (addPaymentMethod) { final PaymentMethodPlugin pm = new DefaultNoOpPaymentMethodPlugin(UUID.randomUUID().toString(), true, null); account = addTestPaymentMethod(account, pm); } return account; } public Account addTestPaymentMethod(final Account account, final PaymentMethodPlugin paymentMethodInfo) throws Exception { return addTestPaymentMethod(account, paymentMethodInfo, ImmutableList.<PluginProperty>of()); } public Account addTestPaymentMethod(final Account account, final PaymentMethodPlugin paymentMethodInfo, final Iterable<PluginProperty> pluginProperties) throws Exception { final UUID pmId = addTestPaymentMethod(MockPaymentProviderPlugin.PLUGIN_NAME, account, paymentMethodInfo, pluginProperties); // To reflect the payment method id change return accountApi.getAccountById(account.getId(), context); } public UUID addTestPaymentMethod(final String pluginName, final Account account, final PaymentMethodPlugin paymentMethodInfo, final Iterable<PluginProperty> pluginProperties) throws Exception { final boolean setDefault = paymentMethodInfo.isDefaultPaymentMethod(); final UUID paymentMethodId = paymentApi.addPaymentMethod(account, paymentMethodInfo.getExternalPaymentMethodId(), pluginName, setDefault, paymentMethodInfo, pluginProperties, context); if (isFastTest() && setDefault) { final Account account1 = new MockAccountBuilder(account).paymentMethodId(paymentMethodId).build(); accountApi.updateAccount(account1, context); } return paymentMethodId; } // Unfortunately, this helper is shared across fast and slow tests private boolean isFastTest() { return Mockito.mockingDetails(accountInternalApi).isMock(); } }
{ "content_hash": "9bb1fd71a5fe8ae5f6fe7ed3b090ca4b", "timestamp": "", "source": "github", "line_count": 181, "max_line_length": 231, "avg_line_length": 56.97790055248619, "alnum_prop": 0.6728401047221952, "repo_name": "killbill/killbill", "id": "be2bd9e996113dc0fb589e9d5e0569140bc2cc60", "size": "11034", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "payment/src/test/java/org/killbill/billing/payment/TestPaymentHelper.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "105855" }, { "name": "HTML", "bytes": "16358" }, { "name": "Java", "bytes": "13037928" }, { "name": "JavaScript", "bytes": "136386" }, { "name": "Mustache", "bytes": "4593" }, { "name": "PLpgSQL", "bytes": "14609" }, { "name": "Ruby", "bytes": "9048" }, { "name": "Shell", "bytes": "22894" } ], "symlink_target": "" }
from distutils.core import setup import pytz setup( name='gae-pytz', version=pytz.__version__, url='https://github.com/potatolondon/gae-pytz/', license='MIT', author='Stuart Bishop', author_email='stuart@stuartbishop.net', description='A version of pytz for Django on Google App Engine.', zip_safe=False, platforms='any', classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Topic :: Software Development :: Libraries :: Python Modules', ], packages=['pytz'], include_package_data=True, package_data={'pytz': ['zoneinfo.zip']}, )
{ "content_hash": "ef2fa8b5291708b48e8478baa4daa57b", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 71, "avg_line_length": 30.40740740740741, "alnum_prop": 0.6236297198538368, "repo_name": "davidwtbuxton/gae-pytz", "id": "1d17be51ab0e60faedaddbe614f4587e7145bbad", "size": "821", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "setup.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "60248" } ], "symlink_target": "" }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Test.Extensions; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests { public partial class GetSemanticInfoTests : SemanticModelTestBase { [WorkItem(544320, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544320")] [Fact] public void TestBug12592() { var text = @" class B { public B(int x = 42) {} } class D : B { public D(int y) : base(/*<bind>*/x/*</bind>*/: y) { } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var sym = model.GetSymbolInfo(expr); Assert.Equal(SymbolKind.Parameter, sym.Symbol.Kind); Assert.Equal("x", sym.Symbol.Name); } [WorkItem(541948, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541948")] [Fact] public void DelegateArgumentType() { var text = @"using System; delegate void MyEvent(); class Test { event MyEvent Clicked; void Handler() { } public void Run() { Test t = new Test(); t.Clicked += new MyEvent(/*<bind>*/Handler/*</bind>*/); } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var sym = model.GetSymbolInfo(expr); Assert.Equal(SymbolKind.Method, sym.Symbol.Kind); var info = model.GetTypeInfo(expr); Assert.Null(info.Type); Assert.NotNull(info.ConvertedType); } [WorkItem(541949, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541949")] [Fact] public void LambdaWithParenthesis_BindOutsideOfParenthesis() { var text = @"using System; public class Test { delegate int D(); static void Main(int xx) { // int x = (xx); D d = /*<bind>*/( delegate() { return 0; } )/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var sym = model.GetSymbolInfo(expr); Assert.NotNull(sym.Symbol); Assert.Equal(SymbolKind.Method, sym.Symbol.Kind); var info = model.GetTypeInfo(expr); var conv = model.GetConversion(expr); Assert.Equal(ConversionKind.AnonymousFunction, conv.Kind); Assert.Null(info.Type); Assert.NotNull(info.ConvertedType); Assert.Equal("Test.D", info.ConvertedType.ToTestDisplayString()); } [WorkItem(529056, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529056")] [WorkItem(529056, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529056")] [Fact] public void LambdaWithParenthesis_BindInsideOfParenthesis() { var text = @"using System; public class Test { delegate int D(); static void Main(int xx) { // int x = (xx); D d = (/*<bind>*/ delegate() { return 0; }/*</bind>*/) ; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var sym = model.GetSymbolInfo(expr); Assert.NotNull(sym.Symbol); Assert.Equal(SymbolKind.Method, sym.Symbol.Kind); var info = model.GetTypeInfo(expr); var conv = model.GetConversion(expr); Assert.Equal(ConversionKind.AnonymousFunction, conv.Kind); Assert.Null(info.Type); Assert.NotNull(info.ConvertedType); Assert.Equal("Test.D", info.ConvertedType.ToTestDisplayString()); } [Fact, WorkItem(528656, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528656")] public void SemanticInfoForInvalidExpression() { var text = @" public class A { static void Main() { Console.WriteLine(/*<bind>*/ delegate * delegate /*</bind>*/); } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var sym = model.GetSymbolInfo(expr); Assert.Null(sym.Symbol); } [WorkItem(541973, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541973")] [Fact] public void LambdaAsAttributeArgumentErr() { var text = @"using System; delegate void D(); class MyAttr: Attribute { public MyAttr(D d) { } } [MyAttr((D)/*<bind>*/delegate { }/*</bind>*/)] // CS0182 public class A { } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var info = model.GetTypeInfo(expr); Assert.Null(info.Type); Assert.NotNull(info.ConvertedType); } [Fact] public void ClassifyConversionImplicit() { var text = @"using System; enum E { One, Two, Three } public class Test { static byte[] ary; static int Main() { // Identity ary = new byte[3]; // ImplicitConstant ary[0] = 0x0F; // ImplicitNumeric ushort ret = ary[0]; // ImplicitReference Test obj = null; // Identity obj = new Test(); // ImplicitNumeric obj.M(ary[0]); // boxing object box = -1; // ImplicitEnumeration E e = 0; // Identity E e2 = E.Two; // bind 'Two' return (int)ret; } void M(ulong p) { } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var testClass = tree.GetCompilationUnitRoot().Members[1] as TypeDeclarationSyntax; Assert.Equal(3, testClass.Members.Count); var mainMethod = testClass.Members[1] as MethodDeclarationSyntax; var mainStats = mainMethod.Body.Statements; Assert.Equal(10, mainStats.Count); // ary = new byte[3]; var v1 = (mainStats[0] as ExpressionStatementSyntax).Expression; Assert.Equal(SyntaxKind.SimpleAssignmentExpression, v1.Kind()); ConversionTestHelper(model, (v1 as AssignmentExpressionSyntax).Right, ConversionKind.Identity, ConversionKind.Identity); // ary[0] = 0x0F; var v2 = (mainStats[1] as ExpressionStatementSyntax).Expression; ConversionTestHelper(model, (v2 as AssignmentExpressionSyntax).Right, ConversionKind.ImplicitConstant, ConversionKind.ExplicitNumeric); // ushort ret = ary[0]; var v3 = (mainStats[2] as LocalDeclarationStatementSyntax).Declaration.Variables; ConversionTestHelper(model, v3[0].Initializer.Value, ConversionKind.ImplicitNumeric, ConversionKind.ImplicitNumeric); // object obj01 = null; var v4 = (mainStats[3] as LocalDeclarationStatementSyntax).Declaration.Variables; ConversionTestHelper(model, v4[0].Initializer.Value, ConversionKind.ImplicitReference, ConversionKind.NoConversion); // obj.M(ary[0]); var v6 = (mainStats[5] as ExpressionStatementSyntax).Expression; Assert.Equal(SyntaxKind.InvocationExpression, v6.Kind()); var v61 = (v6 as InvocationExpressionSyntax).ArgumentList.Arguments; ConversionTestHelper(model, v61[0].Expression, ConversionKind.ImplicitNumeric, ConversionKind.ImplicitNumeric); // object box = -1; var v7 = (mainStats[6] as LocalDeclarationStatementSyntax).Declaration.Variables; ConversionTestHelper(model, v7[0].Initializer.Value, ConversionKind.Boxing, ConversionKind.Boxing); // E e = 0; var v8 = (mainStats[7] as LocalDeclarationStatementSyntax).Declaration.Variables; ConversionTestHelper(model, v8[0].Initializer.Value, ConversionKind.ImplicitEnumeration, ConversionKind.ExplicitEnumeration); // E e2 = E.Two; var v9 = (mainStats[8] as LocalDeclarationStatementSyntax).Declaration.Variables; var v9val = (MemberAccessExpressionSyntax)(v9[0].Initializer.Value); var v9right = v9val.Name; ConversionTestHelper(model, v9right, ConversionKind.Identity, ConversionKind.Identity); } private void TestClassifyConversionBuiltInNumeric(string from, string to, ConversionKind ck) { const string template = @" class C {{ static void Goo({1} v) {{ }} static void Main() {{ {0} v = default({0}); Goo({2}v); }} }} "; var isExplicitConversion = ck == ConversionKind.ExplicitNumeric; var source = string.Format(template, from, to, isExplicitConversion ? "(" + to + ")" : ""); var tree = Parse(source); var comp = CreateCompilation(tree); comp.VerifyDiagnostics(); var model = comp.GetSemanticModel(tree); var c = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; var main = (MethodDeclarationSyntax)c.Members[1]; var call = (InvocationExpressionSyntax)((ExpressionStatementSyntax)main.Body.Statements[1]).Expression; var arg = call.ArgumentList.Arguments[0].Expression; if (isExplicitConversion) { ConversionTestHelper(model, ((CastExpressionSyntax)arg).Expression, model.GetTypeInfo(arg).ConvertedType, ck); } else { ConversionTestHelper(model, arg, ck, ck); } } [Fact] public void ClassifyConversionBuiltInNumeric() { const ConversionKind ID = ConversionKind.Identity; const ConversionKind IN = ConversionKind.ImplicitNumeric; const ConversionKind XN = ConversionKind.ExplicitNumeric; var types = new[] { "sbyte", "byte", "short", "ushort", "int", "uint", "long", "ulong", "char", "float", "double", "decimal" }; var conversions = new ConversionKind[,] { // to sb b s us i ui l ul c f d m // from /* sb */ { ID, XN, IN, XN, IN, XN, IN, XN, XN, IN, IN, IN }, /* b */ { XN, ID, IN, IN, IN, IN, IN, IN, XN, IN, IN, IN }, /* s */ { XN, XN, ID, XN, IN, XN, IN, XN, XN, IN, IN, IN }, /* us */ { XN, XN, XN, ID, IN, IN, IN, IN, XN, IN, IN, IN }, /* i */ { XN, XN, XN, XN, ID, XN, IN, XN, XN, IN, IN, IN }, /* ui */ { XN, XN, XN, XN, XN, ID, IN, IN, XN, IN, IN, IN }, /* l */ { XN, XN, XN, XN, XN, XN, ID, XN, XN, IN, IN, IN }, /* ul */ { XN, XN, XN, XN, XN, XN, XN, ID, XN, IN, IN, IN }, /* c */ { XN, XN, XN, IN, IN, IN, IN, IN, ID, IN, IN, IN }, /* f */ { XN, XN, XN, XN, XN, XN, XN, XN, XN, ID, IN, XN }, /* d */ { XN, XN, XN, XN, XN, XN, XN, XN, XN, XN, ID, XN }, /* m */ { XN, XN, XN, XN, XN, XN, XN, XN, XN, XN, XN, ID } }; for (var from = 0; from < types.Length; from++) { for (var to = 0; to < types.Length; to++) { TestClassifyConversionBuiltInNumeric(types[from], types[to], conversions[from, to]); } } } [WorkItem(527486, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/527486")] [Fact] public void ClassifyConversionExplicit() { var text = @"using System; public class Test { object obj01; public void Testing(int x, Test obj02) { uint y = 5678; // Cast y = (uint) x; // Boxing obj01 = x; // Cast x = (int)obj01; // NoConversion obj02 = (Test)obj01; } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var testClass = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; Assert.Equal(2, testClass.Members.Count); var mainMethod = testClass.Members[1] as MethodDeclarationSyntax; var mainStats = mainMethod.Body.Statements; Assert.Equal(5, mainStats.Count); // y = (uint) x; var v1 = ((mainStats[1] as ExpressionStatementSyntax).Expression as AssignmentExpressionSyntax).Right; ConversionTestHelper(model, (v1 as CastExpressionSyntax).Expression, comp.GetSpecialType(SpecialType.System_UInt32), ConversionKind.ExplicitNumeric); // obj01 = x; var v2 = (mainStats[2] as ExpressionStatementSyntax).Expression; ConversionTestHelper(model, (v2 as AssignmentExpressionSyntax).Right, comp.GetSpecialType(SpecialType.System_Object), ConversionKind.Boxing); // x = (int)obj01; var v3 = ((mainStats[3] as ExpressionStatementSyntax).Expression as AssignmentExpressionSyntax).Right; ConversionTestHelper(model, (v3 as CastExpressionSyntax).Expression, comp.GetSpecialType(SpecialType.System_Int32), ConversionKind.Unboxing); // obj02 = (Test)obj01; var tsym = comp.SourceModule.GlobalNamespace.GetTypeMembers("Test").FirstOrDefault(); var v4 = ((mainStats[4] as ExpressionStatementSyntax).Expression as AssignmentExpressionSyntax).Right; ConversionTestHelper(model, (v4 as CastExpressionSyntax).Expression, tsym, ConversionKind.ExplicitReference); } [Fact] public void DiagnosticsInStages() { var text = @" public class Test { object obj01; public void Testing(int x, Test obj02) { // ExplicitReference -> CS0266 obj02 = obj01; } binding error; parse err } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var errs = model.GetDiagnostics(); Assert.Equal(4, errs.Count()); errs = model.GetSyntaxDiagnostics(); Assert.Equal(1, errs.Count()); errs = model.GetDeclarationDiagnostics(); Assert.Equal(2, errs.Count()); errs = model.GetMethodBodyDiagnostics(); Assert.Equal(1, errs.Count()); } [Fact] public void DiagnosticsFilteredWithPragmas() { var text = @" public class Test { #pragma warning disable 1633 #pragma xyzzy whatever #pragma warning restore 1633 } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var errs = model.GetDiagnostics(); Assert.Equal(0, errs.Count()); errs = model.GetSyntaxDiagnostics(); Assert.Equal(0, errs.Count()); } [Fact] public void ClassifyConversionExplicitNeg() { var text = @" public class Test { object obj01; public void Testing(int x, Test obj02) { uint y = 5678; // ExplicitNumeric - CS0266 y = x; // Boxing obj01 = x; // unboxing - CS0266 x = obj01; // ExplicitReference -> CS0266 obj02 = obj01; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var testClass = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; Assert.Equal(2, testClass.Members.Count); var mainMethod = testClass.Members[1] as MethodDeclarationSyntax; var mainStats = mainMethod.Body.Statements; Assert.Equal(5, mainStats.Count); // y = x; var v1 = ((mainStats[1] as ExpressionStatementSyntax).Expression as AssignmentExpressionSyntax).Right; ConversionTestHelper(model, v1, ConversionKind.ExplicitNumeric, ConversionKind.ExplicitNumeric); // x = obj01; var v2 = ((mainStats[3] as ExpressionStatementSyntax).Expression as AssignmentExpressionSyntax).Right; ConversionTestHelper(model, v2, ConversionKind.Unboxing, ConversionKind.Unboxing); // obj02 = obj01; var v3 = ((mainStats[4] as ExpressionStatementSyntax).Expression as AssignmentExpressionSyntax).Right; ConversionTestHelper(model, v3, ConversionKind.ExplicitReference, ConversionKind.ExplicitReference); // CC var errs = model.GetDiagnostics(); Assert.Equal(3, errs.Count()); errs = model.GetDeclarationDiagnostics(); Assert.Equal(0, errs.Count()); } [WorkItem(527767, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/527767")] [Fact] public void ClassifyConversionNullable() { var text = @"using System; public class Test { static void Main() { // NullLiteral sbyte? nullable = null; // ImplicitNullable uint? nullable01 = 100; ushort localVal = 123; // ImplicitNullable nullable01 = localVal; E e = 0; E? en = 0; // Oddly enough, C# classifies this as an implicit enumeration conversion. } } enum E { zero, one } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var testClass = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; Assert.Equal(1, testClass.Members.Count); var mainMethod = testClass.Members[0] as MethodDeclarationSyntax; var mainStats = mainMethod.Body.Statements; Assert.Equal(6, mainStats.Count); // sbyte? nullable = null; var v1 = (mainStats[0] as LocalDeclarationStatementSyntax).Declaration.Variables; ConversionTestHelper(model, v1[0].Initializer.Value, ConversionKind.NullLiteral, ConversionKind.NoConversion); // uint? nullable01 = 100; var v2 = (mainStats[1] as LocalDeclarationStatementSyntax).Declaration.Variables; ConversionTestHelper(model, v2[0].Initializer.Value, ConversionKind.ImplicitNullable, ConversionKind.ExplicitNullable); // nullable01 = localVal; var v3 = (mainStats[3] as ExpressionStatementSyntax).Expression; Assert.Equal(SyntaxKind.SimpleAssignmentExpression, v3.Kind()); ConversionTestHelper(model, (v3 as AssignmentExpressionSyntax).Right, ConversionKind.ImplicitNullable, ConversionKind.ImplicitNullable); // E e = 0; var v4 = (mainStats[4] as LocalDeclarationStatementSyntax).Declaration.Variables; ConversionTestHelper(model, v4[0].Initializer.Value, ConversionKind.ImplicitEnumeration, ConversionKind.ExplicitEnumeration); // E? en = 0; var v5 = (mainStats[5] as LocalDeclarationStatementSyntax).Declaration.Variables; // Bug#5035 (ByDesign): Conversion from literal 0 to nullable enum is Implicit Enumeration (not ImplicitNullable). Conversion from int to nullable enum is Explicit Nullable. ConversionTestHelper(model, v5[0].Initializer.Value, ConversionKind.ImplicitEnumeration, ConversionKind.ExplicitNullable); } [Fact, WorkItem(543994, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543994")] public void ClassifyConversionImplicitUserDef() { var text = @"using System; class MyClass { public static bool operator true(MyClass p) { return true; } public static bool operator false(MyClass p) { return false; } public static MyClass operator &(MyClass mc1, MyClass mc2) { return new MyClass(); } public static int Main() { var cls1 = new MyClass(); var cls2 = new MyClass(); if (/*<bind0>*/cls1/*</bind0>*/) return 0; if (/*<bind1>*/cls1 && cls2/*</bind1>*/) return 1; return 2; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprs = GetBindingNodes<ExpressionSyntax>(comp); var expr1 = exprs.First(); var expr2 = exprs.Last(); var info = model.GetTypeInfo(expr1); Assert.NotEqual(default, info); Assert.NotNull(info.ConvertedType); // It was ImplicitUserDef -> Design Meeting resolution: not expose op_True|False as conversion through API var impconv = model.GetConversion(expr1); Assert.Equal(Conversion.Identity, impconv); Conversion conv = model.ClassifyConversion(expr1, info.ConvertedType); CheckIsAssignableTo(model, expr1); Assert.Equal(impconv, conv); Assert.Equal("Identity", conv.ToString()); conv = model.ClassifyConversion(expr2, info.ConvertedType); CheckIsAssignableTo(model, expr2); Assert.Equal(impconv, conv); } [Fact, WorkItem(1019372, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1019372")] public void ClassifyConversionImplicitUserDef02() { var text = @" class C { public static implicit operator int(C c) { return 0; } public C() { int? i = /*<bind0>*/this/*</bind0>*/; } }"; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprs = GetBindingNodes<ExpressionSyntax>(comp); var expr1 = exprs.First(); var info = model.GetTypeInfo(expr1); Assert.NotEqual(default, info); Assert.NotNull(info.ConvertedType); var impconv = model.GetConversion(expr1); Assert.True(impconv.IsImplicit); Assert.True(impconv.IsUserDefined); Conversion conv = model.ClassifyConversion(expr1, info.ConvertedType); CheckIsAssignableTo(model, expr1); Assert.Equal(impconv, conv); Assert.True(conv.IsImplicit); Assert.True(conv.IsUserDefined); } private void CheckIsAssignableTo(SemanticModel model, ExpressionSyntax syntax) { var info = model.GetTypeInfo(syntax); var conversion = info.Type != null && info.ConvertedType != null ? model.Compilation.ClassifyConversion(info.Type, info.ConvertedType) : Conversion.NoConversion; Assert.Equal(conversion.IsImplicit, model.Compilation.HasImplicitConversion(info.Type, info.ConvertedType)); } [Fact, WorkItem(544151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544151")] public void PublicViewOfPointerConversions() { ValidateConversion(Conversion.PointerToVoid, ConversionKind.ImplicitPointerToVoid); ValidateConversion(Conversion.NullToPointer, ConversionKind.ImplicitNullToPointer); ValidateConversion(Conversion.PointerToPointer, ConversionKind.ExplicitPointerToPointer); ValidateConversion(Conversion.IntegerToPointer, ConversionKind.ExplicitIntegerToPointer); ValidateConversion(Conversion.PointerToInteger, ConversionKind.ExplicitPointerToInteger); ValidateConversion(Conversion.IntPtr, ConversionKind.IntPtr); } #region "Conversion helper" private void ValidateConversion(Conversion conv, ConversionKind kind) { Assert.Equal(conv.Kind, kind); switch (kind) { case ConversionKind.NoConversion: Assert.False(conv.Exists); Assert.False(conv.IsImplicit); Assert.False(conv.IsExplicit); break; case ConversionKind.Identity: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.True(conv.IsIdentity); break; case ConversionKind.ImplicitNumeric: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.True(conv.IsNumeric); break; case ConversionKind.ImplicitEnumeration: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.True(conv.IsEnumeration); break; case ConversionKind.ImplicitNullable: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.True(conv.IsNullable); break; case ConversionKind.NullLiteral: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.True(conv.IsNullLiteral); break; case ConversionKind.ImplicitReference: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.True(conv.IsReference); break; case ConversionKind.Boxing: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.True(conv.IsBoxing); break; case ConversionKind.ImplicitDynamic: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.True(conv.IsDynamic); break; case ConversionKind.ExplicitDynamic: Assert.True(conv.Exists); Assert.True(conv.IsExplicit); Assert.False(conv.IsImplicit); Assert.True(conv.IsDynamic); break; case ConversionKind.ImplicitConstant: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.True(conv.IsConstantExpression); break; case ConversionKind.ImplicitUserDefined: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.True(conv.IsUserDefined); break; case ConversionKind.AnonymousFunction: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.True(conv.IsAnonymousFunction); break; case ConversionKind.MethodGroup: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.True(conv.IsMethodGroup); break; case ConversionKind.ExplicitNumeric: Assert.True(conv.Exists); Assert.False(conv.IsImplicit); Assert.True(conv.IsExplicit); Assert.True(conv.IsNumeric); break; case ConversionKind.ExplicitEnumeration: Assert.True(conv.Exists); Assert.False(conv.IsImplicit); Assert.True(conv.IsExplicit); Assert.True(conv.IsEnumeration); break; case ConversionKind.ExplicitNullable: Assert.True(conv.Exists); Assert.False(conv.IsImplicit); Assert.True(conv.IsExplicit); Assert.True(conv.IsNullable); break; case ConversionKind.ExplicitReference: Assert.True(conv.Exists); Assert.False(conv.IsImplicit); Assert.True(conv.IsExplicit); Assert.True(conv.IsReference); break; case ConversionKind.Unboxing: Assert.True(conv.Exists); Assert.False(conv.IsImplicit); Assert.True(conv.IsExplicit); Assert.True(conv.IsUnboxing); break; case ConversionKind.ExplicitUserDefined: Assert.True(conv.Exists); Assert.False(conv.IsImplicit); Assert.True(conv.IsExplicit); Assert.True(conv.IsUserDefined); break; case ConversionKind.ImplicitNullToPointer: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.False(conv.IsUserDefined); Assert.True(conv.IsPointer); break; case ConversionKind.ImplicitPointerToVoid: Assert.True(conv.Exists); Assert.True(conv.IsImplicit); Assert.False(conv.IsExplicit); Assert.False(conv.IsUserDefined); Assert.True(conv.IsPointer); break; case ConversionKind.ExplicitPointerToPointer: Assert.True(conv.Exists); Assert.False(conv.IsImplicit); Assert.True(conv.IsExplicit); Assert.False(conv.IsUserDefined); Assert.True(conv.IsPointer); break; case ConversionKind.ExplicitIntegerToPointer: Assert.True(conv.Exists); Assert.False(conv.IsImplicit); Assert.True(conv.IsExplicit); Assert.False(conv.IsUserDefined); Assert.True(conv.IsPointer); break; case ConversionKind.ExplicitPointerToInteger: Assert.True(conv.Exists); Assert.False(conv.IsImplicit); Assert.True(conv.IsExplicit); Assert.False(conv.IsUserDefined); Assert.True(conv.IsPointer); break; case ConversionKind.IntPtr: Assert.True(conv.Exists); Assert.False(conv.IsImplicit); Assert.True(conv.IsExplicit); Assert.False(conv.IsUserDefined); Assert.False(conv.IsPointer); Assert.True(conv.IsIntPtr); break; } } /// <summary> /// /// </summary> /// <param name="semanticModel"></param> /// <param name="expr"></param> /// <param name="ept1">expr -> TypeInParent</param> /// <param name="ept2">Type(expr) -> TypeInParent</param> private void ConversionTestHelper(SemanticModel semanticModel, ExpressionSyntax expr, ConversionKind ept1, ConversionKind ept2) { var info = semanticModel.GetTypeInfo(expr); Assert.NotEqual(default, info); Assert.NotNull(info.ConvertedType); var conv = semanticModel.GetConversion(expr); // NOT expect NoConversion Conversion act1 = semanticModel.ClassifyConversion(expr, info.ConvertedType); CheckIsAssignableTo(semanticModel, expr); Assert.Equal(ept1, act1.Kind); ValidateConversion(act1, ept1); ValidateConversion(act1, conv.Kind); if (ept2 == ConversionKind.NoConversion) { Assert.Null(info.Type); } else { Assert.NotNull(info.Type); var act2 = semanticModel.Compilation.ClassifyConversion(info.Type, info.ConvertedType); Assert.Equal(ept2, act2.Kind); ValidateConversion(act2, ept2); } } private void ConversionTestHelper(SemanticModel semanticModel, ExpressionSyntax expr, ITypeSymbol expsym, ConversionKind expkind) { var info = semanticModel.GetTypeInfo(expr); Assert.NotEqual(default, info); Assert.NotNull(info.ConvertedType); // NOT expect NoConversion Conversion act1 = semanticModel.ClassifyConversion(expr, expsym); CheckIsAssignableTo(semanticModel, expr); Assert.Equal(expkind, act1.Kind); ValidateConversion(act1, expkind); } #endregion [Fact] public void EnumOffsets() { // sbyte EnumOffset(ConstantValue.Create((sbyte)sbyte.MinValue), 1, EnumOverflowKind.NoOverflow, ConstantValue.Create((sbyte)(sbyte.MinValue + 1))); EnumOffset(ConstantValue.Create((sbyte)sbyte.MinValue), 2, EnumOverflowKind.NoOverflow, ConstantValue.Create((sbyte)(sbyte.MinValue + 2))); EnumOffset(ConstantValue.Create((sbyte)-2), 1, EnumOverflowKind.NoOverflow, ConstantValue.Create((sbyte)(-1))); EnumOffset(ConstantValue.Create((sbyte)-2), 3, EnumOverflowKind.NoOverflow, ConstantValue.Create((sbyte)(1))); EnumOffset(ConstantValue.Create((sbyte)(sbyte.MaxValue - 3)), 3, EnumOverflowKind.NoOverflow, ConstantValue.Create((sbyte)sbyte.MaxValue)); EnumOffset(ConstantValue.Create((sbyte)(sbyte.MaxValue - 3)), 4, EnumOverflowKind.OverflowReport, ConstantValue.Bad); EnumOffset(ConstantValue.Create((sbyte)(sbyte.MaxValue - 3)), 5, EnumOverflowKind.OverflowIgnore, ConstantValue.Bad); // byte EnumOffset(ConstantValue.Create((byte)0), 1, EnumOverflowKind.NoOverflow, ConstantValue.Create((byte)1)); EnumOffset(ConstantValue.Create((byte)0), 2, EnumOverflowKind.NoOverflow, ConstantValue.Create((byte)2)); EnumOffset(ConstantValue.Create((byte)(byte.MaxValue - 3)), 3, EnumOverflowKind.NoOverflow, ConstantValue.Create((byte)byte.MaxValue)); EnumOffset(ConstantValue.Create((byte)(byte.MaxValue - 3)), 4, EnumOverflowKind.OverflowReport, ConstantValue.Bad); EnumOffset(ConstantValue.Create((byte)(byte.MaxValue - 3)), 5, EnumOverflowKind.OverflowIgnore, ConstantValue.Bad); // short EnumOffset(ConstantValue.Create((short)short.MinValue), 1, EnumOverflowKind.NoOverflow, ConstantValue.Create((short)(short.MinValue + 1))); EnumOffset(ConstantValue.Create((short)short.MinValue), 2, EnumOverflowKind.NoOverflow, ConstantValue.Create((short)(short.MinValue + 2))); EnumOffset(ConstantValue.Create((short)-2), 1, EnumOverflowKind.NoOverflow, ConstantValue.Create((short)(-1))); EnumOffset(ConstantValue.Create((short)-2), 3, EnumOverflowKind.NoOverflow, ConstantValue.Create((short)(1))); EnumOffset(ConstantValue.Create((short)(short.MaxValue - 3)), 3, EnumOverflowKind.NoOverflow, ConstantValue.Create((short)short.MaxValue)); EnumOffset(ConstantValue.Create((short)(short.MaxValue - 3)), 4, EnumOverflowKind.OverflowReport, ConstantValue.Bad); EnumOffset(ConstantValue.Create((short)(short.MaxValue - 3)), 5, EnumOverflowKind.OverflowIgnore, ConstantValue.Bad); // ushort EnumOffset(ConstantValue.Create((ushort)0), 1, EnumOverflowKind.NoOverflow, ConstantValue.Create((ushort)1)); EnumOffset(ConstantValue.Create((ushort)0), 2, EnumOverflowKind.NoOverflow, ConstantValue.Create((ushort)2)); EnumOffset(ConstantValue.Create((ushort)(ushort.MaxValue - 3)), 3, EnumOverflowKind.NoOverflow, ConstantValue.Create((ushort)ushort.MaxValue)); EnumOffset(ConstantValue.Create((ushort)(ushort.MaxValue - 3)), 4, EnumOverflowKind.OverflowReport, ConstantValue.Bad); EnumOffset(ConstantValue.Create((ushort)(ushort.MaxValue - 3)), 5, EnumOverflowKind.OverflowIgnore, ConstantValue.Bad); // int EnumOffset(ConstantValue.Create((int)int.MinValue), 1, EnumOverflowKind.NoOverflow, ConstantValue.Create((int)(int.MinValue + 1))); EnumOffset(ConstantValue.Create((int)int.MinValue), 2, EnumOverflowKind.NoOverflow, ConstantValue.Create((int)(int.MinValue + 2))); EnumOffset(ConstantValue.Create((int)-2), 1, EnumOverflowKind.NoOverflow, ConstantValue.Create((int)(-1))); EnumOffset(ConstantValue.Create((int)-2), 3, EnumOverflowKind.NoOverflow, ConstantValue.Create((int)(1))); EnumOffset(ConstantValue.Create((int)(int.MaxValue - 3)), 3, EnumOverflowKind.NoOverflow, ConstantValue.Create((int)int.MaxValue)); EnumOffset(ConstantValue.Create((int)(int.MaxValue - 3)), 4, EnumOverflowKind.OverflowReport, ConstantValue.Bad); EnumOffset(ConstantValue.Create((int)(int.MaxValue - 3)), 5, EnumOverflowKind.OverflowIgnore, ConstantValue.Bad); // uint EnumOffset(ConstantValue.Create((uint)0), 1, EnumOverflowKind.NoOverflow, ConstantValue.Create((uint)1)); EnumOffset(ConstantValue.Create((uint)0), 2, EnumOverflowKind.NoOverflow, ConstantValue.Create((uint)2)); EnumOffset(ConstantValue.Create((uint)(uint.MaxValue - 3)), 3, EnumOverflowKind.NoOverflow, ConstantValue.Create((uint)uint.MaxValue)); EnumOffset(ConstantValue.Create((uint)(uint.MaxValue - 3)), 4, EnumOverflowKind.OverflowReport, ConstantValue.Bad); EnumOffset(ConstantValue.Create((uint)(uint.MaxValue - 3)), 5, EnumOverflowKind.OverflowIgnore, ConstantValue.Bad); // long EnumOffset(ConstantValue.Create((long)long.MinValue), 1, EnumOverflowKind.NoOverflow, ConstantValue.Create((long)(long.MinValue + 1))); EnumOffset(ConstantValue.Create((long)long.MinValue), 2, EnumOverflowKind.NoOverflow, ConstantValue.Create((long)(long.MinValue + 2))); EnumOffset(ConstantValue.Create((long)-2), 1, EnumOverflowKind.NoOverflow, ConstantValue.Create((long)(-1))); EnumOffset(ConstantValue.Create((long)-2), 3, EnumOverflowKind.NoOverflow, ConstantValue.Create((long)(1))); EnumOffset(ConstantValue.Create((long)(long.MaxValue - 3)), 3, EnumOverflowKind.NoOverflow, ConstantValue.Create((long)long.MaxValue)); EnumOffset(ConstantValue.Create((long)(long.MaxValue - 3)), 4, EnumOverflowKind.OverflowReport, ConstantValue.Bad); EnumOffset(ConstantValue.Create((long)(long.MaxValue - 3)), 5, EnumOverflowKind.OverflowIgnore, ConstantValue.Bad); // ulong EnumOffset(ConstantValue.Create((ulong)0), 1, EnumOverflowKind.NoOverflow, ConstantValue.Create((ulong)1)); EnumOffset(ConstantValue.Create((ulong)0), 2, EnumOverflowKind.NoOverflow, ConstantValue.Create((ulong)2)); EnumOffset(ConstantValue.Create((ulong)(ulong.MaxValue - 3)), 3, EnumOverflowKind.NoOverflow, ConstantValue.Create((ulong)ulong.MaxValue)); EnumOffset(ConstantValue.Create((ulong)(ulong.MaxValue - 3)), 4, EnumOverflowKind.OverflowReport, ConstantValue.Bad); EnumOffset(ConstantValue.Create((ulong)(ulong.MaxValue - 3)), 5, EnumOverflowKind.OverflowIgnore, ConstantValue.Bad); } private void EnumOffset(ConstantValue constantValue, uint offset, EnumOverflowKind expectedOverflowKind, ConstantValue expectedValue) { ConstantValue actualValue; var actualOverflowKind = EnumConstantHelper.OffsetValue(constantValue, offset, out actualValue); Assert.Equal(expectedOverflowKind, actualOverflowKind); Assert.Equal(expectedValue, actualValue); } [Fact] public void TestGetSemanticInfoInParentInIf() { var compilation = CreateCompilation(@" class C { void M(int x) { if (x == 10) {} } } "); var tree = compilation.SyntaxTrees[0]; var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; var ifStatement = (IfStatementSyntax)methodDecl.Body.Statements[0]; var condition = ifStatement.Condition; var model = compilation.GetSemanticModel(tree); var info = model.GetSemanticInfoSummary(condition); Assert.NotNull(info.ConvertedType); Assert.Equal("Boolean", info.Type.Name); Assert.Equal("System.Boolean System.Int32.op_Equality(System.Int32 left, System.Int32 right)", info.Symbol.ToTestDisplayString()); Assert.Equal(0, info.CandidateSymbols.Length); } [Fact] public void TestGetSemanticInfoInParentInFor() { var compilation = CreateCompilation(@" class C { void M(int x) { for (int i = 0; i < 10; i = i + 1) { } } } "); var tree = compilation.SyntaxTrees[0]; var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; var forStatement = (ForStatementSyntax)methodDecl.Body.Statements[0]; var condition = forStatement.Condition; var model = compilation.GetSemanticModel(tree); var info = model.GetSemanticInfoSummary(condition); Assert.NotNull(info.ConvertedType); Assert.Equal("Boolean", info.ConvertedType.Name); Assert.Equal("System.Boolean System.Int32.op_LessThan(System.Int32 left, System.Int32 right)", info.Symbol.ToTestDisplayString()); Assert.Equal(0, info.CandidateSymbols.Length); } [WorkItem(540279, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540279")] [Fact] public void NoMembersForVoidReturnType() { var text = @" class C { void M() { /*<bind>*/System.Console.WriteLine()/*</bind>*/; } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); IMethodSymbol methodSymbol = (IMethodSymbol)bindInfo.Symbol; ITypeSymbol returnType = methodSymbol.ReturnType; var symbols = model.LookupSymbols(0, returnType); Assert.Equal(0, symbols.Length); } [WorkItem(540767, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540767")] [Fact] public void BindIncompleteVarDeclWithDoKeyword() { var code = @" class Test { static int Main(string[] args) { do"; var compilation = CreateCompilation(code); var tree = compilation.SyntaxTrees[0]; var model = compilation.GetSemanticModel(tree); var exprSyntaxList = GetExprSyntaxList(tree); Assert.Equal(6, exprSyntaxList.Count); // Note the omitted array size expression in "string[]" Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxList[4].Kind()); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxList[5].Kind()); Assert.Equal("", exprSyntaxList[4].ToFullString()); Assert.Equal("", exprSyntaxList[5].ToFullString()); var exprSyntaxToBind = exprSyntaxList[exprSyntaxList.Count - 2]; model.GetSemanticInfoSummary(exprSyntaxToBind); } [Fact] public void TestBindBaseConstructorInitializer() { var text = @" class C { C() : base() { } } "; var bindInfo = BindFirstConstructorInitializer(text); Assert.NotEqual(default, bindInfo); var baseConstructor = bindInfo.Symbol; Assert.Equal(SymbolKind.Method, baseConstructor.Kind); Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)baseConstructor).MethodKind); Assert.Equal("System.Object..ctor()", baseConstructor.ToTestDisplayString()); } [Fact] public void TestBindThisConstructorInitializer() { var text = @" class C { C() : this(1) { } C(int x) { } } "; var bindInfo = BindFirstConstructorInitializer(text); Assert.NotEqual(default, bindInfo); var baseConstructor = bindInfo.Symbol; Assert.Equal(SymbolKind.Method, baseConstructor.Kind); Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)baseConstructor).MethodKind); Assert.Equal("C..ctor(System.Int32 x)", baseConstructor.ToTestDisplayString()); } [WorkItem(540862, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540862")] [Fact] public void BindThisStaticConstructorInitializer() { var text = @" class MyClass { static MyClass() : this() { intI = 2; } public MyClass() { } static int intI = 1; } "; var bindInfo = BindFirstConstructorInitializer(text); Assert.NotEqual(default, bindInfo); var invokedConstructor = (IMethodSymbol)bindInfo.Symbol; Assert.Equal(MethodKind.Constructor, invokedConstructor.MethodKind); Assert.Equal("MyClass..ctor()", invokedConstructor.ToTestDisplayString()); } [WorkItem(541053, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541053")] [Fact] public void CheckAndAdjustPositionOutOfRange() { var text = @" using System; > 1 "; var tree = Parse(text, options: TestOptions.Script); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var root = tree.GetCompilationUnitRoot(); Assert.NotEqual(0, root.SpanStart); var stmt = (GlobalStatementSyntax)root.Members.Single(); var expr = ((ExpressionStatementSyntax)stmt.Statement).Expression; Assert.Equal(SyntaxKind.GreaterThanExpression, expr.Kind()); var info = model.GetSemanticInfoSummary(expr); Assert.Equal(SpecialType.System_Boolean, info.Type.SpecialType); } [Fact] public void AddAccessorValueParameter() { var text = @" class C { private System.Action e; event System.Action E { add { e += /*<bind>*/value/*</bind>*/; } remove { e -= value; } } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var systemActionType = GetSystemActionType(comp); Assert.Equal(systemActionType, bindInfo.Type); var parameterSymbol = (IParameterSymbol)bindInfo.Symbol; Assert.Equal(systemActionType, parameterSymbol.Type); Assert.Equal("value", parameterSymbol.Name); Assert.Equal(MethodKind.EventAdd, ((IMethodSymbol)parameterSymbol.ContainingSymbol).MethodKind); } [Fact] public void RemoveAccessorValueParameter() { var text = @" class C { private System.Action e; event System.Action E { add { e += value; } remove { e -= /*<bind>*/value/*</bind>*/; } } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var systemActionType = GetSystemActionType(comp); Assert.Equal(systemActionType, bindInfo.Type); var parameterSymbol = (IParameterSymbol)bindInfo.Symbol; Assert.Equal(systemActionType, parameterSymbol.Type); Assert.Equal("value", parameterSymbol.Name); Assert.Equal(MethodKind.EventRemove, ((IMethodSymbol)parameterSymbol.ContainingSymbol).MethodKind); } [Fact] public void FieldLikeEventInitializer() { var text = @" class C { event System.Action E = /*<bind>*/new System.Action(() => { })/*</bind>*/; } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var systemActionType = GetSystemActionType(comp); Assert.Equal(systemActionType, bindInfo.Type); Assert.Null(bindInfo.Symbol); Assert.Equal(0, bindInfo.CandidateSymbols.Length); Assert.Equal(CandidateReason.None, bindInfo.CandidateReason); } [Fact] public void FieldLikeEventInitializer2() { var text = @" class C { event System.Action E = new /*<bind>*/System.Action/*</bind>*/(() => { }); } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var systemActionType = GetSystemActionType(comp); Assert.Null(bindInfo.Type); Assert.Equal(systemActionType, bindInfo.Symbol); } [Fact] public void CustomEventAccess() { var text = @" class C { event System.Action E { add { } remove { } } void Method() { /*<bind>*/E/*</bind>*/ += null; } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var systemActionType = GetSystemActionType(comp); Assert.Equal(systemActionType, bindInfo.Type); var eventSymbol = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E"); Assert.Equal(eventSymbol, bindInfo.Symbol); } [Fact] public void FieldLikeEventAccess() { var text = @" class C { event System.Action E; void Method() { /*<bind>*/E/*</bind>*/ += null; } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var systemActionType = GetSystemActionType(comp); Assert.Equal(systemActionType, bindInfo.Type); var eventSymbol = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E"); Assert.Equal(eventSymbol, bindInfo.Symbol); } [Fact] public void CustomEventAssignmentOperator() { var text = @" class C { event System.Action E { add { } remove { } } void Method() { /*<bind>*/E += null/*</bind>*/; } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); Assert.Equal(SpecialType.System_Void, bindInfo.Type.SpecialType); var eventSymbol = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E"); Assert.Equal(eventSymbol.AddMethod, bindInfo.Symbol); } [Fact] public void FieldLikeEventAssignmentOperator() { var text = @" class C { event System.Action E; void Method() { /*<bind>*/E += null/*</bind>*/; } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); Assert.Equal(SpecialType.System_Void, bindInfo.Type.SpecialType); var eventSymbol = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E"); Assert.Equal(eventSymbol.AddMethod, bindInfo.Symbol); } [Fact] public void CustomEventMissingAssignmentOperator() { var text = @" class C { event System.Action E { /*add { }*/ remove { } } //missing add void Method() { /*<bind>*/E += null/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); Assert.Null(bindInfo.Symbol); Assert.Equal(0, bindInfo.CandidateSymbols.Length); Assert.Equal(SpecialType.System_Void, bindInfo.Type.SpecialType); } private static INamedTypeSymbol GetSystemActionType(CSharpCompilation comp) { return GetSystemActionType((Compilation)comp); } private static INamedTypeSymbol GetSystemActionType(Compilation comp) { return (INamedTypeSymbol)comp.GlobalNamespace.GetMember<INamespaceSymbol>("System").GetMembers("Action").Where(s => !((INamedTypeSymbol)s).IsGenericType).Single(); } [Fact] public void IndexerAccess() { var text = @" class C { int this[int x] { get { return x; } } int this[int x, int y] { get { return x + y; } } void Method() { int x = /*<bind>*/this[1]/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.ElementAccessExpression, exprSyntaxToBind.Kind()); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var indexerSymbol = comp.GlobalNamespace.GetMember<NamedTypeSymbol>("C").Indexers.Where(i => i.ParameterCount == 1).Single().GetPublicSymbol(); Assert.Equal(indexerSymbol, bindInfo.Symbol); Assert.Equal(0, bindInfo.CandidateSymbols.Length); Assert.Equal(CandidateReason.None, bindInfo.CandidateReason); Assert.Equal(SpecialType.System_Int32, bindInfo.Type.SpecialType); Assert.Equal(SpecialType.System_Int32, bindInfo.ConvertedType.SpecialType); Assert.Equal(ConversionKind.Identity, bindInfo.ImplicitConversion.Kind); Assert.Equal(CandidateReason.None, bindInfo.CandidateReason); Assert.Equal(0, bindInfo.MethodGroup.Length); Assert.False(bindInfo.IsCompileTimeConstant); Assert.Null(bindInfo.ConstantValue.Value); } [Fact] public void IndexerAccessOverloadResolutionFailure() { var text = @" class C { int this[int x] { get { return x; } } int this[int x, int y] { get { return x + y; } } void Method() { int x = /*<bind>*/this[1, 2, 3]/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.ElementAccessExpression, exprSyntaxToBind.Kind()); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var indexerSymbol1 = comp.GlobalNamespace.GetMember<NamedTypeSymbol>("C").Indexers.Where(i => i.ParameterCount == 1).Single().GetPublicSymbol(); var indexerSymbol2 = comp.GlobalNamespace.GetMember<NamedTypeSymbol>("C").Indexers.Where(i => i.ParameterCount == 2).Single().GetPublicSymbol(); var candidateIndexers = ImmutableArray.Create<ISymbol>(indexerSymbol1, indexerSymbol2); Assert.Null(bindInfo.Symbol); Assert.True(bindInfo.CandidateSymbols.SetEquals(candidateIndexers, EqualityComparer<ISymbol>.Default)); Assert.Equal(CandidateReason.OverloadResolutionFailure, bindInfo.CandidateReason); Assert.Equal(SpecialType.System_Int32, bindInfo.Type.SpecialType); //still have the type since all candidates agree Assert.Equal(SpecialType.System_Int32, bindInfo.ConvertedType.SpecialType); Assert.Equal(ConversionKind.Identity, bindInfo.ImplicitConversion.Kind); Assert.Equal(CandidateReason.OverloadResolutionFailure, bindInfo.CandidateReason); Assert.Equal(0, bindInfo.MethodGroup.Length); Assert.False(bindInfo.IsCompileTimeConstant); Assert.Null(bindInfo.ConstantValue.Value); } [Fact] public void IndexerAccessNoIndexers() { var text = @" class C { void Method() { int x = /*<bind>*/this[1, 2, 3]/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.ElementAccessExpression, exprSyntaxToBind.Kind()); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); Assert.Null(bindInfo.Symbol); Assert.Equal(0, bindInfo.CandidateSymbols.Length); Assert.Equal(CandidateReason.None, bindInfo.CandidateReason); Assert.Equal(TypeKind.Error, bindInfo.Type.TypeKind); Assert.Equal(TypeKind.Struct, bindInfo.ConvertedType.TypeKind); Assert.Equal(ConversionKind.NoConversion, bindInfo.ImplicitConversion.Kind); Assert.Equal(CandidateReason.None, bindInfo.CandidateReason); Assert.Equal(0, bindInfo.MethodGroup.Length); Assert.False(bindInfo.IsCompileTimeConstant); Assert.Null(bindInfo.ConstantValue.Value); } [WorkItem(542296, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542296")] [Fact] public void TypeArgumentsOnFieldAccess1() { var text = @" public class Test { public int Fld; public int Func() { return (int)(/*<bind>*/Fld<int>/*</bind>*/); } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.GenericName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); Assert.Null(bindInfo.Symbol); Assert.Equal(CandidateReason.WrongArity, bindInfo.CandidateReason); Assert.Equal(1, bindInfo.CandidateSymbols.Length); var candidate = bindInfo.CandidateSymbols.Single(); Assert.Equal(SymbolKind.Field, candidate.Kind); Assert.Equal("Fld", candidate.Name); } [WorkItem(542296, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542296")] [Fact] public void TypeArgumentsOnFieldAccess2() { var text = @" public class Test { public int Fld; public int Func() { return (int)(Fld</*<bind>*/Test/*</bind>*/>); } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var symbol = bindInfo.Symbol; Assert.NotNull(symbol); Assert.Equal(SymbolKind.NamedType, symbol.Kind); Assert.Equal("Test", symbol.Name); } [WorkItem(528785, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528785")] [Fact] public void TopLevelIndexer() { var text = @" this[double E] { get { return /*<bind>*/E/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var symbol = bindInfo.Symbol; Assert.Null(symbol); } [WorkItem(542360, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542360")] [Fact] public void TypeAndMethodHaveSameTypeParameterName() { var text = @" interface I<T> { void Goo<T>(); } class A<T> : I<T> { void I</*<bind>*/T/*</bind>*/>.Goo<T>() { } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var symbol = bindInfo.Symbol; Assert.NotNull(symbol); Assert.Equal(SymbolKind.TypeParameter, symbol.Kind); Assert.Equal("T", symbol.Name); Assert.Equal(comp.GlobalNamespace.GetMember<INamedTypeSymbol>("A"), symbol.ContainingSymbol); //from the type, not the method } [WorkItem(542436, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542436")] [Fact] public void RecoveryFromBadNamespaceDeclaration() { var text = @"namespace alias:: using alias = /*<bind>*/N/*</bind>*/; namespace N { } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); } /// Test that binding a local declared with var binds the same way when localSymbol.Type is called before BindVariableDeclaration. /// Assert occurs if the two do not compute the same type. [Fact] [WorkItem(542634, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542634")] public void VarInitializedWithStaticType() { var text = @"using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; class Program { static string xunit = " + "@" + @"..\..\Closed\Tools\xUnit\xunit.console.x86.exe" + @"; static string test = " + @"Roslyn.VisualStudio.Services.UnitTests.dll" + @"; static string commandLine = test" + @" /html log.html" + @"; static void Main(string[] args) { var options = CreateOptions(); /*<bind>*/Parallel/*</bind>*/.For(0, 100, RunTest, options); } private static Parallel CreateOptions() { var result = new ParallelOptions(); } private static void RunTest(int i) { } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); // Bind Parallel from line Parallel.For(0, 100, RunTest, options); // This will implicitly bind "var" to determine type of options. // This calls LocalSymbol.GetType var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var varIdentifier = (IdentifierNameSyntax)tree.GetCompilationUnitRoot().DescendantNodes().First(n => n.ToString() == "var"); // var from line var options = CreateOptions; // Explicitly bind "var". // This path calls BindvariableDeclaration. bindInfo = model.GetSemanticInfoSummary(varIdentifier); } [WorkItem(542186, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542186")] [Fact] public void IndexerParameter() { var text = @" class C { int this[int x] { get { return /*<bind>*/x/*</bind>*/; } } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var symbol = bindInfo.Symbol; Assert.NotNull(symbol); Assert.Equal(SymbolKind.Parameter, symbol.Kind); Assert.Equal("x", symbol.Name); Assert.Equal(SymbolKind.Method, symbol.ContainingSymbol.Kind); var lookupSymbols = model.LookupSymbols(exprSyntaxToBind.SpanStart, name: "x"); Assert.Equal(symbol, lookupSymbols.Single()); } [WorkItem(542186, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542186")] [Fact] public void IndexerValueParameter() { var text = @" class C { int this[int x] { set { x = /*<bind>*/value/*</bind>*/; } } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var symbol = bindInfo.Symbol; Assert.NotNull(symbol); Assert.Equal(SymbolKind.Parameter, symbol.Kind); Assert.Equal("value", symbol.Name); Assert.Equal(SymbolKind.Method, symbol.ContainingSymbol.Kind); var lookupSymbols = model.LookupSymbols(exprSyntaxToBind.SpanStart, name: "value"); Assert.Equal(symbol, lookupSymbols.Single()); } [WorkItem(542777, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542777")] [Fact] public void IndexerThisParameter() { var text = @" class C { int this[int x] { set { System.Console.Write(/*<bind>*/this/*</bind>*/); } } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.ThisExpression, exprSyntaxToBind.Kind()); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var symbol = bindInfo.Symbol; Assert.NotNull(symbol); Assert.Equal(SymbolKind.Parameter, symbol.Kind); Assert.Equal("this", symbol.Name); Assert.Equal(SymbolKind.Method, symbol.ContainingSymbol.Kind); } [WorkItem(542592, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542592")] [Fact] public void TypeParameterParamsParameter() { var text = @" class Test<T> { public void Method(params T arr) { } } class Program { static void Main(string[] args) { new Test<int[]>()./*<bind>*/Method/*</bind>*/(new int[][] { }); } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSemanticInfoSummary(exprSyntaxToBind); var symbol = bindInfo.Symbol; Assert.Null(symbol); Assert.Equal(CandidateReason.OverloadResolutionFailure, bindInfo.CandidateReason); var candidate = (IMethodSymbol)bindInfo.CandidateSymbols.Single(); Assert.Equal("void Test<System.Int32[]>.Method(params System.Int32[] arr)", candidate.ToTestDisplayString()); Assert.Equal(TypeKind.Array, candidate.Parameters.Last().Type.TypeKind); Assert.Equal(TypeKind.TypeParameter, ((IMethodSymbol)candidate.OriginalDefinition).Parameters.Last().Type.TypeKind); } [WorkItem(542458, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542458")] [Fact] public void ParameterDefaultValues() { var text = @" struct S { void M( int i = 1, string str = ""hello"", object o = null, S s = default(S)) { /*<bind>*/M/*</bind>*/(); } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSymbolInfo(exprSyntaxToBind); var method = (IMethodSymbol)bindInfo.Symbol; Assert.NotNull(method); var parameters = method.Parameters; Assert.Equal(4, parameters.Length); Assert.True(parameters[0].HasExplicitDefaultValue); Assert.Equal(1, parameters[0].ExplicitDefaultValue); Assert.True(parameters[1].HasExplicitDefaultValue); Assert.Equal("hello", parameters[1].ExplicitDefaultValue); Assert.True(parameters[2].HasExplicitDefaultValue); Assert.Null(parameters[2].ExplicitDefaultValue); Assert.True(parameters[3].HasExplicitDefaultValue); Assert.Null(parameters[3].ExplicitDefaultValue); } [WorkItem(542764, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542764")] [Fact] public void UnboundGenericTypeArity() { var text = @" class C<T, U, V> { void M() { System.Console.Write(typeof(/*<bind>*/C<,,>/*</bind>*/)); } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var nameSyntaxToBind = (SimpleNameSyntax)GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.GenericName, nameSyntaxToBind.Kind()); Assert.Equal(3, nameSyntaxToBind.Arity); var bindInfo = model.GetSymbolInfo(nameSyntaxToBind); var type = (INamedTypeSymbol)bindInfo.Symbol; Assert.NotNull(type); Assert.True(type.IsUnboundGenericType); Assert.Equal(3, type.Arity); Assert.Equal("C<,,>", type.ToTestDisplayString()); } [Fact] public void GetType_VoidArray() { var text = @" class C { void M() { var x = typeof(/*<bind>*/System.Void[]/*</bind>*/); } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.ArrayType, exprSyntaxToBind.Kind()); var bindInfo = model.GetSymbolInfo(exprSyntaxToBind); var arrayType = (IArrayTypeSymbol)bindInfo.Symbol; Assert.NotNull(arrayType); Assert.Equal("System.Void[]", arrayType.ToTestDisplayString()); } [WorkItem(543295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543295")] [Fact] public void TypeParameterDiamondInheritance1() { var text = @" using System.Linq; public interface IA { object P { get; } } public interface IB : IA { } public class C<T> where T : IA, IB // can find IA.P in two different ways { void M() { new T[1]./*<bind>*/Select/*</bind>*/(i => i.P); } } "; var tree = Parse(text); var comp = CreateCompilationWithMscorlib40AndSystemCore(new[] { tree }); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSymbolInfo(exprSyntaxToBind); Assert.Equal("System.Collections.Generic.IEnumerable<System.Object> System.Collections.Generic.IEnumerable<T>.Select<T, System.Object>(System.Func<T, System.Object> selector)", bindInfo.Symbol.ToTestDisplayString()); } [WorkItem(543295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543295")] [Fact] public void TypeParameterDiamondInheritance2() //add hiding member in derived interface { var text = @" using System.Linq; public interface IA { object P { get; } } public interface IB : IA { new int P { get; } } public class C<T> where T : IA, IB { void M() { new T[1]./*<bind>*/Select/*</bind>*/(i => i.P); } } "; var tree = Parse(text); var comp = CreateCompilationWithMscorlib40AndSystemCore(new[] { tree }); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSymbolInfo(exprSyntaxToBind); Assert.Equal("System.Collections.Generic.IEnumerable<System.Int32> System.Collections.Generic.IEnumerable<T>.Select<T, System.Int32>(System.Func<T, System.Int32> selector)", bindInfo.Symbol.ToTestDisplayString()); } [WorkItem(543295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543295")] [Fact] public void TypeParameterDiamondInheritance3() //reverse order of interface list (shouldn't matter) { var text = @" using System.Linq; public interface IA { object P { get; } } public interface IB : IA { new int P { get; } } public class C<T> where T : IB, IA { void M() { new T[1]./*<bind>*/Select/*</bind>*/(i => i.P); } } "; var tree = Parse(text); var comp = CreateCompilationWithMscorlib40AndSystemCore(new[] { tree }); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSymbolInfo(exprSyntaxToBind); Assert.Equal("System.Collections.Generic.IEnumerable<System.Int32> System.Collections.Generic.IEnumerable<T>.Select<T, System.Int32>(System.Func<T, System.Int32> selector)", bindInfo.Symbol.ToTestDisplayString()); } [WorkItem(543295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543295")] [Fact] public void TypeParameterDiamondInheritance4() //Two interfaces with a common base { var text = @" using System.Linq; public interface IA { object P { get; } } public interface IB : IA { } public interface IC : IA { } public class C<T> where T : IB, IC { void M() { new T[1]./*<bind>*/Select/*</bind>*/(i => i.P); } } "; var tree = Parse(text); var comp = CreateCompilationWithMscorlib40AndSystemCore(new[] { tree }); var model = comp.GetSemanticModel(tree); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, exprSyntaxToBind.Kind()); var bindInfo = model.GetSymbolInfo(exprSyntaxToBind); Assert.Equal("System.Collections.Generic.IEnumerable<System.Object> System.Collections.Generic.IEnumerable<T>.Select<T, System.Object>(System.Func<T, System.Object> selector)", bindInfo.Symbol.ToTestDisplayString()); } [WorkItem(543295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543295")] [Fact] public void TypeParameterMemberLookup1() { var types = @" public interface IA { object P { get; } } "; var members = LookupTypeParameterMembers(types, "IA", "P", out _); Assert.Equal("System.Object IA.P { get; }", members.Single().ToTestDisplayString()); } [WorkItem(543295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543295")] [Fact] public void TypeParameterMemberLookup2() { var types = @" public interface IA { object P { get; } } public interface IB { object P { get; } } "; ITypeParameterSymbol typeParameter; var members = LookupTypeParameterMembers(types, "IA, IB", "P", out typeParameter); Assert.True(members.SetEquals(typeParameter.AllEffectiveInterfacesNoUseSiteDiagnostics().Select(i => i.GetMember<IPropertySymbol>("P")))); } [WorkItem(543295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543295")] [Fact] public void TypeParameterMemberLookup3() { var types = @" public interface IA { object P { get; } } public interface IB : IA { new object P { get; } } "; var members = LookupTypeParameterMembers(types, "IA, IB", "P", out _); Assert.Equal("System.Object IB.P { get; }", members.Single().ToTestDisplayString()); } [WorkItem(543295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543295")] [Fact] public void TypeParameterMemberLookup4() { var types = @" public interface IA { object P { get; } } public class D { public object P { get; set; } } "; var members = LookupTypeParameterMembers(types, "D, IA", "P", out _); Assert.Equal("System.Object D.P { get; set; }", members.Single().ToTestDisplayString()); } [WorkItem(543295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543295")] [Fact] public void TypeParameterMemberLookup5() { var types = @" public interface IA { void M(); } public class D { public void M() { } } "; var members = LookupTypeParameterMembers(types, "IA", "M", out _); Assert.Equal("void IA.M()", members.Single().ToTestDisplayString()); members = LookupTypeParameterMembers(types, "D, IA", "M", out _); Assert.True(members.Select(m => m.ToTestDisplayString()).SetEquals(new[] { "void IA.M()", "void D.M()" })); } [WorkItem(543295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543295")] [Fact] public void TypeParameterMemberLookup6() { var types = @" public interface IA { void M(); void M(int x); } public class D { public void M() { } } "; var members = LookupTypeParameterMembers(types, "IA", "M", out _); Assert.True(members.Select(m => m.ToTestDisplayString()).SetEquals(new[] { "void IA.M()", "void IA.M(System.Int32 x)" })); members = LookupTypeParameterMembers(types, "D, IA", "M", out _); Assert.True(members.Select(m => m.ToTestDisplayString()).SetEquals(new[] { "void D.M()", "void IA.M()", "void IA.M(System.Int32 x)" })); } [WorkItem(543295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543295")] [Fact] public void TypeParameterMemberLookup7() { var types = @" public interface IA { string ToString(); } public class D { public new string ToString() { return null; } } "; var members = LookupTypeParameterMembers(types, "IA", "ToString", out _); Assert.True(members.Select(m => m.ToTestDisplayString()).SetEquals(new[] { "System.String System.Object.ToString()", "System.String IA.ToString()" })); members = LookupTypeParameterMembers(types, "D, IA", "ToString", out _); Assert.True(members.Select(m => m.ToTestDisplayString()).SetEquals(new[] { "System.String System.Object.ToString()", "System.String D.ToString()", "System.String IA.ToString()" })); } private IEnumerable<ISymbol> LookupTypeParameterMembers(string types, string constraints, string memberName, out ITypeParameterSymbol typeParameter) { var template = @" {0} public class C<T> where T : {1} {{ void M() {{ System.Console.WriteLine(/*<bind>*/default(T)/*</bind>*/); }} }} "; var tree = Parse(string.Format(template, types, constraints)); var comp = (Compilation)CreateCompilationWithMscorlib40AndSystemCore(new[] { tree }); comp.VerifyDiagnostics(); var model = comp.GetSemanticModel(tree); var classC = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); typeParameter = classC.TypeParameters.Single(); var exprSyntaxToBind = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.DefaultExpression, exprSyntaxToBind.Kind()); return model.LookupSymbols(exprSyntaxToBind.SpanStart, typeParameter, memberName); } [WorkItem(542966, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542966")] [Fact] public async Task IndexerMemberRaceAsync() { var text = @" using System; interface IA { [System.Runtime.CompilerServices.IndexerName(""Goo"")] string this[int index] { get; } } class A : IA { public virtual string this[int index] { get { return """"; } } string IA.this[int index] { get { return """"; } } } class B : A, IA { public override string this[int index] { get { return """"; } } } class Program { public static void Main(string[] args) { IA x = new B(); Console.WriteLine(x[0]); } } "; TimeSpan timeout = TimeSpan.FromSeconds(2); for (int i = 0; i < 20; i++) { var comp = CreateCompilation(text); var task1 = new Task(() => comp.GlobalNamespace.GetMember<NamedTypeSymbol>("A").GetMembers()); var task2 = new Task(() => comp.GlobalNamespace.GetMember<NamedTypeSymbol>("IA").GetMembers()); if (i % 2 == 0) { task1.Start(); task2.Start(); } else { task2.Start(); task1.Start(); } comp.VerifyDiagnostics(); await Task.WhenAll(task1, task2); } } [Fact] public void ImplicitDeclarationMultipleDeclarators() { var text = @" using System.IO; class C { static void Main() { /*<bind>*/var a = new StreamWriter(""""), b = new StreamReader("""")/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); comp.VerifyDiagnostics( // (8,19): error CS0819: Implicitly-typed variables cannot have multiple declarators // /*<bind>*/var a = new StreamWriter(""), b = new StreamReader("")/*</bind>*/; Diagnostic(ErrorCode.ERR_ImplicitlyTypedVariableMultipleDeclarator, @"var a = new StreamWriter(""""), b = new StreamReader("""")").WithLocation(8, 19) ); var model = comp.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var typeInfo = model.GetSymbolInfo(expr); // the type info uses the type inferred for the first declared local Assert.Equal("System.IO.StreamWriter", typeInfo.Symbol.ToTestDisplayString()); } [WorkItem(543169, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543169")] [Fact] public void ParameterOfLambdaPassedToOutParameter() { var text = @" using System.Linq; class D { static void Main(string[] args) { string[] str = new string[] { }; label1: var s = str.Where(out /*<bind>*/x/*</bind>*/ => { return x == ""1""; }); } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var lambdaSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(); var parameterSymbol = model.GetDeclaredSymbol(lambdaSyntax.Parameter); Assert.NotNull(parameterSymbol); Assert.Equal("x", parameterSymbol.Name); Assert.Equal(MethodKind.AnonymousFunction, ((IMethodSymbol)parameterSymbol.ContainingSymbol).MethodKind); } [WorkItem(529096, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529096")] [Fact] public void MemberAccessExpressionResults() { var text = @" class C { public static int A; public static byte B() { return 3; } public static string D { get; set; } static void Main(string[] args) { /*<bind0>*/C.A/*</bind0>*/; /*<bind1>*/C.B/*</bind1>*/(); /*<bind2>*/C.D/*</bind2>*/; /*<bind3>*/C.B()/*</bind3>*/; int goo = /*<bind4>*/C.B()/*</bind4>*/; goo = /*<bind5>*/C.B/*</bind5>*/(); } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var exprs = GetBindingNodes<ExpressionSyntax>(comp); for (int i = 0; i < exprs.Count; i++) { var expr = exprs[i]; var symbolInfo = model.GetSymbolInfo(expr); Assert.NotNull(symbolInfo.Symbol); var typeInfo = model.GetTypeInfo(expr); switch (i) { case 0: Assert.Equal("A", symbolInfo.Symbol.Name); Assert.NotNull(typeInfo.Type); Assert.Equal("System.Int32", typeInfo.Type.ToTestDisplayString()); Assert.Equal("System.Int32", typeInfo.ConvertedType.ToTestDisplayString()); break; case 1: case 5: Assert.Equal("B", symbolInfo.Symbol.Name); Assert.Null(typeInfo.Type); break; case 2: Assert.Equal("D", symbolInfo.Symbol.Name); Assert.NotNull(typeInfo.Type); Assert.Equal("System.String", typeInfo.Type.ToTestDisplayString()); Assert.Equal("System.String", typeInfo.ConvertedType.ToTestDisplayString()); break; case 3: Assert.Equal("B", symbolInfo.Symbol.Name); Assert.NotNull(typeInfo.Type); Assert.Equal("System.Byte", typeInfo.Type.ToTestDisplayString()); Assert.Equal("System.Byte", typeInfo.ConvertedType.ToTestDisplayString()); break; case 4: Assert.Equal("B", symbolInfo.Symbol.Name); Assert.NotNull(typeInfo.Type); Assert.Equal("System.Byte", typeInfo.Type.ToTestDisplayString()); Assert.Equal("System.Int32", typeInfo.ConvertedType.ToTestDisplayString()); break; } // switch } } [WorkItem(543554, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543554")] [Fact] public void SemanticInfoForUncheckedExpression() { var text = @" public class A { static void Main() { Console.WriteLine(/*<bind>*/unchecked(42 + 42.1)/*</bind>*/); } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var sym = model.GetSymbolInfo(expr); Assert.Equal("System.Double System.Double.op_Addition(System.Double left, System.Double right)", sym.Symbol.ToTestDisplayString()); var info = model.GetTypeInfo(expr); var conv = model.GetConversion(expr); Assert.Equal(ConversionKind.Identity, conv.Kind); Assert.Equal(SpecialType.System_Double, info.Type.SpecialType); Assert.Equal(SpecialType.System_Double, info.ConvertedType.SpecialType); } [WorkItem(543554, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543554")] [Fact] public void SemanticInfoForCheckedExpression() { var text = @" class Program { public static int Add(int a, int b) { return /*<bind>*/checked(a+b)/*</bind>*/; } } "; var comp = CreateCompilation(text); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var sym = model.GetSymbolInfo(expr); Assert.Equal("System.Int32 System.Int32.op_Addition(System.Int32 left, System.Int32 right)", sym.Symbol.ToTestDisplayString()); var info = model.GetTypeInfo(expr); var conv = model.GetConversion(expr); Assert.Equal(ConversionKind.Identity, conv.Kind); Assert.Equal(SpecialType.System_Int32, info.Type.SpecialType); Assert.Equal(SpecialType.System_Int32, info.ConvertedType.SpecialType); } [WorkItem(543554, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543554")] [Fact] public void CheckedUncheckedExpression() { var text = @" class Test { public void F() { int y = /*<bind>*/(checked(unchecked((1))))/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var info = model.GetTypeInfo(expr); Assert.Equal(SpecialType.System_Int32, info.Type.SpecialType); Assert.Equal(SpecialType.System_Int32, info.ConvertedType.SpecialType); } [WorkItem(543543, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543543")] [Fact] public void SymbolInfoForImplicitOperatorParameter() { var text = @" class Program { public Program(string s) { } public static implicit operator Program(string str) { return new Program(/*<bind>*/str/*</bind>*/); } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var info = model.GetSymbolInfo(expr); var symbol = info.Symbol; Assert.NotNull(symbol); Assert.Equal(SymbolKind.Parameter, symbol.Kind); Assert.Equal(MethodKind.Conversion, ((IMethodSymbol)symbol.ContainingSymbol).MethodKind); } [WorkItem(543494, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543494")] [WorkItem(543560, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543560")] [Fact] public void BrokenPropertyDeclaration() { var source = @" using System; Class Program // this will get a Property declaration ... *sigh* { static void Main(string[] args) { Func<int, int> f = /*<bind0>*/x/*</bind0>*/ => x + 1; } } "; var compilation = CreateCompilation(source); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var expr = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().First(); var declaredSymbol = model.GetDeclaredSymbol(expr); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SemanticInfoForUserDefinedBinaryOperator() { var text = @" class C { public static C operator+(C c1, C c2) { return c1 ?? c2; } static void Main() { C c1 = new C(); C c2 = new C(); C c3 = /*<bind>*/c1 + c2/*</bind>*/; } } "; CheckOperatorSemanticInfo(text, WellKnownMemberNames.AdditionOperatorName); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SemanticInfoForUserDefinedLogicalOperator() { var text = @" class C { public static C operator &(C c1, C c2) { return c1 ?? c2; } public static bool operator true(C c) { return true; } public static bool operator false(C c) { return false; } static void Main() { C c1 = new C(); C c2 = new C(); C c3 = /*<bind>*/c1 && c2/*</bind>*/; } } "; CheckOperatorSemanticInfo(text, WellKnownMemberNames.BitwiseAndOperatorName); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SemanticInfoForUserDefinedUnaryOperator() { var text = @" class C { public static C operator+(C c1) { return c1; } static void Main() { C c1 = new C(); C c2 = /*<bind>*/+c1/*</bind>*/; } } "; CheckOperatorSemanticInfo(text, WellKnownMemberNames.UnaryPlusOperatorName); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SemanticInfoForUserDefinedExplicitConversion() { var text = @" class C { public static explicit operator C(int i) { return null; } static void Main() { C c1 = /*<bind>*/(C)1/*</bind>*/; } } "; CheckOperatorSemanticInfo(text, WellKnownMemberNames.ExplicitConversionName); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SemanticInfoForUserDefinedImplicitConversion() { var text = @" class C { public static implicit operator C(int i) { return null; } static void Main() { C c1 = /*<bind>*/(C)1/*</bind>*/; } } "; CheckOperatorSemanticInfo(text, WellKnownMemberNames.ImplicitConversionName); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SemanticInfoForUserDefinedTrueOperator() { var text = @" class C { public static bool operator true(C c) { return true; } public static bool operator false(C c) { return false; } static void Main() { C c = new C(); if (/*<bind>*/c/*</bind>*/) { } } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var type = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); var symbol = symbolInfo.Symbol; Assert.Equal(SymbolKind.Local, symbol.Kind); Assert.Equal("c", symbol.Name); Assert.Equal(type, ((ILocalSymbol)symbol).Type); var typeInfo = model.GetTypeInfo(expr); Assert.Equal(type, typeInfo.Type); Assert.Equal(type, typeInfo.ConvertedType); var conv = model.GetConversion(expr); Assert.Equal(Conversion.Identity, conv); Assert.False(model.GetConstantValue(expr).HasValue); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SemanticInfoForUserDefinedIncrement() { var text = @" class C { public static C operator ++(C c) { return c; } static void Main() { C c1 = new C(); C c2 = /*<bind>*/c1++/*</bind>*/; } } "; CheckOperatorSemanticInfo(text, WellKnownMemberNames.IncrementOperatorName); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SemanticInfoForUserDefinedCompoundAssignment() { var text = @" class C { public static C operator +(C c1, C c2) { return c1 ?? c2; } static void Main() { C c1 = new C(); C c2 = new C(); /*<bind>*/c1 += c2/*</bind>*/; } } "; CheckOperatorSemanticInfo(text, WellKnownMemberNames.AdditionOperatorName); } private void CheckOperatorSemanticInfo(string text, string operatorName) { var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var operatorSymbol = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>(operatorName); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Equal(operatorSymbol, symbolInfo.Symbol); var method = (IMethodSymbol)symbolInfo.Symbol; var returnType = method.ReturnType; var typeInfo = model.GetTypeInfo(expr); Assert.Equal(returnType, typeInfo.Type); Assert.Equal(returnType, typeInfo.ConvertedType); var conv = model.GetConversion(expr); Assert.Equal(ConversionKind.Identity, conv.Kind); Assert.False(model.GetConstantValue(expr).HasValue); } [Fact, WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550"), WorkItem(543439, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543439")] public void SymbolInfoForUserDefinedConversionOverloadResolutionFailure() { var text = @" struct S { public static explicit operator S(string s) { return default(S); } public static explicit operator S(System.Text.StringBuilder s) { return default(S); } static void Main() { S s = /*<bind>*/(S)null/*</bind>*/; } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var conversions = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("S").GetMembers(WellKnownMemberNames.ExplicitConversionName); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Null(symbolInfo.Symbol); Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason); var candidates = symbolInfo.CandidateSymbols; Assert.Equal(2, candidates.Length); Assert.True(candidates.SetEquals(conversions, EqualityComparer<ISymbol>.Default)); } [Fact, WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550"), WorkItem(543439, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543439")] public void SymbolInfoForUserDefinedConversionOverloadResolutionFailureEmpty() { var text = @" struct S { static void Main() { S s = /*<bind>*/(S)null/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var conversions = comp.GlobalNamespace.GetMember<NamedTypeSymbol>("S").GetMembers(WellKnownMemberNames.ExplicitConversionName); Assert.Equal(0, conversions.Length); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Null(symbolInfo.Symbol); Assert.Equal(CandidateReason.None, symbolInfo.CandidateReason); var candidates = symbolInfo.CandidateSymbols; Assert.Equal(0, candidates.Length); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SymbolInfoForUserDefinedUnaryOperatorOverloadResolutionFailure() { var il = @" .class public auto ansi beforefieldinit UnaryOperator extends [mscorlib]System.Object { .method public hidebysig specialname static class UnaryOperator op_UnaryPlus(class UnaryOperator unaryOperator) cil managed { ldnull throw } // Differs only by return type .method public hidebysig specialname static string op_UnaryPlus(class UnaryOperator unaryOperator) cil managed { ldnull throw } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; var text = @" class Program { static void Main() { UnaryOperator u1 = new UnaryOperator(); UnaryOperator u2 = /*<bind>*/+u1/*</bind>*/; } } "; var comp = (Compilation)CreateCompilationWithILAndMscorlib40(text, il); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var operators = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("UnaryOperator").GetMembers(WellKnownMemberNames.UnaryPlusOperatorName); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Null(symbolInfo.Symbol); Assert.Equal(CandidateReason.Ambiguous, symbolInfo.CandidateReason); var candidates = symbolInfo.CandidateSymbols; Assert.Equal(2, candidates.Length); Assert.True(candidates.SetEquals(operators, EqualityComparer<ISymbol>.Default)); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SymbolInfoForUserDefinedUnaryOperatorOverloadResolutionFailureEmpty() { var text = @" class C { static void Main() { C c1 = new C(); C c2 = /*<bind>*/+c1/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var operators = comp.GlobalNamespace.GetMember<NamedTypeSymbol>("C").GetMembers(WellKnownMemberNames.UnaryPlusOperatorName); Assert.Equal(0, operators.Length); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Null(symbolInfo.Symbol); Assert.Equal(CandidateReason.None, symbolInfo.CandidateReason); var candidates = symbolInfo.CandidateSymbols; Assert.Equal(0, candidates.Length); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SymbolInfoForUserDefinedIncrementOperatorOverloadResolutionFailure() { var il = @" .class public auto ansi beforefieldinit IncrementOperator extends [mscorlib]System.Object { .method public hidebysig specialname static class IncrementOperator op_Increment(class IncrementOperator incrementOperator) cil managed { ldnull throw } .method public hidebysig specialname static string op_Increment(class IncrementOperator incrementOperator) cil managed { ldnull throw } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; var text = @" class Program { static void Main() { IncrementOperator i1 = new IncrementOperator(); IncrementOperator i2 = /*<bind>*/i1++/*</bind>*/; } } "; var comp = (Compilation)CreateCompilationWithILAndMscorlib40(text, il); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var operators = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("IncrementOperator").GetMembers(WellKnownMemberNames.IncrementOperatorName); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Null(symbolInfo.Symbol); Assert.Equal(CandidateReason.Ambiguous, symbolInfo.CandidateReason); var candidates = symbolInfo.CandidateSymbols; Assert.Equal(2, candidates.Length); Assert.True(candidates.SetEquals(operators, EqualityComparer<ISymbol>.Default)); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SymbolInfoForUserDefinedIncrementOperatorOverloadResolutionFailureEmpty() { var text = @" class C { static void Main() { C c1 = new C(); C c2 = /*<bind>*/c1++/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var operators = comp.GlobalNamespace.GetMember<NamedTypeSymbol>("C").GetMembers(WellKnownMemberNames.IncrementOperatorName); Assert.Equal(0, operators.Length); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Null(symbolInfo.Symbol); Assert.Equal(CandidateReason.None, symbolInfo.CandidateReason); var candidates = symbolInfo.CandidateSymbols; Assert.Equal(0, candidates.Length); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SymbolInfoForUserDefinedBinaryOperatorOverloadResolutionFailure() { var text = @" class C { public static C operator+(C c1, C c2) { return c1 ?? c2; } public static C operator+(C c1, string s) { return c1; } static void Main() { C c1 = new C(); C c2 = /*<bind>*/c1 + null/*</bind>*/; } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var operators = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMembers(WellKnownMemberNames.AdditionOperatorName); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Null(symbolInfo.Symbol); Assert.Equal(CandidateReason.Ambiguous, symbolInfo.CandidateReason); var candidates = symbolInfo.CandidateSymbols; Assert.Equal(2, candidates.Length); Assert.True(candidates.SetEquals(operators, EqualityComparer<ISymbol>.Default)); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SymbolInfoForUserDefinedBinaryOperatorOverloadResolutionFailureEmpty() { var text = @" class C { static void Main() { C c1 = new C(); C c2 = /*<bind>*/c1 + null/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var operators = comp.GlobalNamespace.GetMember<NamedTypeSymbol>("C").GetMembers(WellKnownMemberNames.AdditionOperatorName); Assert.Equal(0, operators.Length); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Equal("System.String System.String.op_Addition(System.Object left, System.String right)", symbolInfo.Symbol.ToTestDisplayString()); Assert.Equal(CandidateReason.None, symbolInfo.CandidateReason); var candidates = symbolInfo.CandidateSymbols; Assert.Equal(0, candidates.Length); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SymbolInfoForUserDefinedCompoundAssignmentOperatorOverloadResolutionFailure() { var text = @" class C { public static C operator+(C c1, C c2) { return c1 ?? c2; } public static C operator+(C c1, string s) { return c1; } static void Main() { C c = new C(); /*<bind>*/c += null/*</bind>*/; } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var operators = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMembers(WellKnownMemberNames.AdditionOperatorName); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Null(symbolInfo.Symbol); Assert.Equal(CandidateReason.Ambiguous, symbolInfo.CandidateReason); var candidates = symbolInfo.CandidateSymbols; Assert.Equal(2, candidates.Length); Assert.True(candidates.SetEquals(operators, EqualityComparer<ISymbol>.Default)); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact] public void SymbolInfoForUserDefinedCompoundAssignmentOperatorOverloadResolutionFailureEmpty() { var text = @" class C { static void Main() { C c = new C(); /*<bind>*/c += null/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var operators = comp.GlobalNamespace.GetMember<NamedTypeSymbol>("C").GetMembers(WellKnownMemberNames.AdditionOperatorName); Assert.Equal(0, operators.Length); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Equal("System.String System.String.op_Addition(System.Object left, System.String right)", symbolInfo.Symbol.ToTestDisplayString()); Assert.Equal(CandidateReason.None, symbolInfo.CandidateReason); var candidates = symbolInfo.CandidateSymbols; Assert.Equal(0, candidates.Length); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550"), WorkItem(529158, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529158")] [Fact] public void MethodGroupForUserDefinedBinaryOperator() { var text = @" class C { public static C operator+(C c1, C c2) { return c1 ?? c2; } public static C operator+(C c1, int i) { return c1; } static void Main() { C c1 = new C(); C c2 = new C(); C c3 = /*<bind>*/c1 + c2/*</bind>*/; } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var operators = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMembers(WellKnownMemberNames.AdditionOperatorName).Cast<IMethodSymbol>(); var operatorSymbol = operators.Where(method => method.Parameters[0].Type.Equals(method.Parameters[1].Type, SymbolEqualityComparer.ConsiderEverything)).Single(); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Equal(operatorSymbol, symbolInfo.Symbol); // NOTE: This check captures, rather than enforces, the current behavior (i.e. feel free to change it). var memberGroup = model.GetMemberGroup(expr); Assert.Equal(0, memberGroup.Length); } [Fact] public void CacheDuplicates() { var text = @" class C { static void Main() { long l = /*<bind>*/(long)1/*</bind>*/; } } "; var tree = Parse(text); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); bool sawWrongConversionKind = false; ThreadStart ts = () => sawWrongConversionKind |= ConversionKind.Identity != model.GetConversion(expr).Kind; Thread[] threads = new Thread[4]; for (int i = 0; i < threads.Length; i++) { threads[i] = new Thread(ts); } foreach (Thread t in threads) { t.Start(); } foreach (Thread t in threads) { t.Join(); } Assert.False(sawWrongConversionKind); } [WorkItem(543674, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543674")] [Fact()] public void SemanticInfo_NormalVsLiftedUserDefinedImplicitConversion() { string text = @" using System; struct G { } struct L { public static implicit operator G(L l) { return default(G); } } class Z { public static void Main() { MNG(/*<bind>*/default(L)/*</bind>*/); } static void MNG(G? g) { } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var gType = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("G"); var mngMethod = (IMethodSymbol)comp.GlobalNamespace.GetMember<INamedTypeSymbol>("Z").GetMembers("MNG").First(); var gNullableType = mngMethod.GetParameterType(0); Assert.True(gNullableType.IsNullableType(), "MNG parameter is not a nullable type?"); Assert.Equal(gType, gNullableType.StrippedType()); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var conversion = model.ClassifyConversion(expr, gNullableType); CheckIsAssignableTo(model, expr); // Here we have a situation where Roslyn deliberately violates the specification in order // to be compatible with the native compiler. // // The specification states that there are two applicable candidates: We can use // the "lifted" operator from L? to G?, or we can use the unlifted operator // from L to G, and then convert the G that comes out the back end to G?. // The specification says that the second conversion is the better conversion. // Therefore, the conversion on the "front end" should be an identity conversion, // and the conversion on the "back end" of the user-defined conversion should // be an implicit nullable conversion. // // This is not at all what the native compiler does, and we match the native // compiler behavior. The native compiler says that there is a "half lifted" // conversion from L-->G?, and that this is the winner. Therefore the conversion // "on the back end" of the user-defined conversion is in fact an *identity* // conversion, even though obviously we are going to have to // do code generation as though it was an implicit nullable conversion. Assert.Equal(ConversionKind.Identity, conversion.UserDefinedFromConversion.Kind); Assert.Equal(ConversionKind.Identity, conversion.UserDefinedToConversion.Kind); Assert.Equal("ImplicitUserDefined", conversion.ToString()); } [WorkItem(543715, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543715")] [Fact] public void SemanticInfo_NormalVsLiftedUserDefinedConversion_ImplicitConversion() { string text = @" using System; struct G {} struct M { public static implicit operator G(M m) { System.Console.WriteLine(1); return default(G); } public static implicit operator G(M? m) {System.Console.WriteLine(2); return default(G); } } class Z { public static void Main() { M? m = new M(); MNG(/*<bind>*/m/*</bind>*/); } static void MNG(G? g) { } } "; var tree = Parse(text); var comp = (Compilation)CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var gType = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("G"); var mngMethod = (IMethodSymbol)comp.GlobalNamespace.GetMember<INamedTypeSymbol>("Z").GetMembers("MNG").First(); var gNullableType = mngMethod.GetParameterType(0); Assert.True(gNullableType.IsNullableType(), "MNG parameter is not a nullable type?"); Assert.Equal(gType, gNullableType.StrippedType()); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var conversion = model.ClassifyConversion(expr, gNullableType); CheckIsAssignableTo(model, expr); Assert.Equal(ConversionKind.ImplicitUserDefined, conversion.Kind); // Dev10 violates the spec for finding the most specific operator for an implicit user-defined conversion. // SPEC: • Find the most specific conversion operator: // SPEC: (a) If U contains exactly one user-defined conversion operator that converts from SX to TX, then this is the most specific conversion operator. // SPEC: (b) Otherwise, if U contains exactly one lifted conversion operator that converts from SX to TX, then this is the most specific conversion operator. // SPEC: (c) Otherwise, the conversion is ambiguous and a compile-time error occurs. // In this test we try to classify conversion from M? to G?. // 1) Classify conversion establishes that SX: M? and TX: G?. // 2) Most specific conversion operator from M? to G?: // (a) does not hold here as neither of the implicit operators convert from M? to G? // (b) does hold here as the lifted form of "implicit operator G(M m)" converts from M? to G? // Hence "operator G(M m)" must be chosen in lifted form, but Dev10 chooses "G M.op_Implicit(System.Nullable<M> m)" in normal form. // We may want to maintain compatibility with Dev10. Assert.Equal("G M.op_Implicit(M? m)", conversion.MethodSymbol.ToTestDisplayString()); Assert.Equal("ImplicitUserDefined", conversion.ToString()); } [Fact] public void AmbiguousImplicitConversionOverloadResolution1() { var source = @" public class A { static public implicit operator A(B b) { return default(A); } } public class B { static public implicit operator A(B b) { return default(A); } } class Test { static void M(A a) { } static void M(object o) { } static void Main() { B b = new B(); /*<bind>*/M(b)/*</bind>*/; } }"; var compilation = CreateCompilation(source); compilation.VerifyDiagnostics( // (26,21): error CS0457: Ambiguous user defined conversions 'B.implicit operator A(B)' and 'A.implicit operator A(B)' when converting from 'B' to 'A' Diagnostic(ErrorCode.ERR_AmbigUDConv, "b").WithArguments("B.implicit operator A(B)", "A.implicit operator A(B)", "B", "A")); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var expr = (InvocationExpressionSyntax)GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Equal("void Test.M(A a)", symbolInfo.Symbol.ToTestDisplayString()); var argexpr = expr.ArgumentList.Arguments.Single().Expression; var argTypeInfo = model.GetTypeInfo(argexpr); Assert.Equal("B", argTypeInfo.Type.ToTestDisplayString()); Assert.Equal("A", argTypeInfo.ConvertedType.ToTestDisplayString()); var argConversion = model.GetConversion(argexpr); Assert.Equal(ConversionKind.ImplicitUserDefined, argConversion.Kind); Assert.False(argConversion.IsValid); Assert.Null(argConversion.Method); } [Fact] public void AmbiguousImplicitConversionOverloadResolution2() { var source = @" public class A { static public implicit operator A(B<A> b) { return default(A); } } public class B<T> { static public implicit operator T(B<T> b) { return default(T); } } class C { static void M(A a) { } static void M<T>(T t) { } static void Main() { B<A> b = new B<A>(); /*<bind>*/M(b)/*</bind>*/; } }"; var compilation = CreateCompilation(source); compilation.VerifyDiagnostics(); // since no conversion is performed, the ambiguity doesn't matter var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var expr = (InvocationExpressionSyntax)GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.NotNull(expr); var symbolInfo = model.GetSymbolInfo(expr); Assert.Equal("void C.M<B<A>>(B<A> t)", symbolInfo.Symbol.ToTestDisplayString()); var argexpr = expr.ArgumentList.Arguments.Single().Expression; var argTypeInfo = model.GetTypeInfo(argexpr); Assert.Equal("B<A>", argTypeInfo.Type.ToTestDisplayString()); Assert.Equal("B<A>", argTypeInfo.ConvertedType.ToTestDisplayString()); var argConversion = model.GetConversion(argexpr); Assert.Equal(ConversionKind.Identity, argConversion.Kind); Assert.True(argConversion.IsValid); Assert.Null(argConversion.Method); } [Fact] public void DefaultParameterLocalScope() { var source = @" public class A { static void Main(string[] args, int a = /*<bind>*/System/*</bind>*/.) { } }"; var compilation = CreateCompilation(source); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal("System", expr.ToString()); var info = model.GetSemanticInfoSummary(expr); //Shouldn't throw/assert Assert.Equal(SymbolKind.Namespace, info.Symbol.Kind); } [Fact] public void PinvokeSemanticModel() { var source = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""user32.dll"", CharSet = CharSet.Unicode, ExactSpelling = false, EntryPoint = ""MessageBox"")] public static extern int MessageBox(IntPtr hwnd, string t, string c, UInt32 t2); static void Main() { /*<bind>*/MessageBox(IntPtr.Zero, """", """", 1)/*</bind>*/; } }"; var compilation = CreateCompilation(source); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var expr = (InvocationExpressionSyntax)GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal("MessageBox(IntPtr.Zero, \"\", \"\", 1)", expr.ToString()); var symbolInfo = model.GetSymbolInfo(expr); Assert.Equal("C.MessageBox(System.IntPtr, string, string, uint)", symbolInfo.Symbol.ToDisplayString()); var argTypeInfo = model.GetTypeInfo(expr.ArgumentList.Arguments.First().Expression); Assert.Equal("System.IntPtr", argTypeInfo.Type.ToTestDisplayString()); Assert.Equal("System.IntPtr", argTypeInfo.ConvertedType.ToTestDisplayString()); } [Fact] public void ImplicitBoxingConversion1() { var source = @" class C { static void Main() { object o = 1; } }"; var compilation = CreateCompilation(source); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); var literalTypeInfo = model.GetTypeInfo(literal); var conv = model.GetConversion(literal); Assert.Equal(SpecialType.System_Int32, literalTypeInfo.Type.SpecialType); Assert.Equal(SpecialType.System_Object, literalTypeInfo.ConvertedType.SpecialType); Assert.Equal(ConversionKind.Boxing, conv.Kind); } [Fact] public void ImplicitBoxingConversion2() { var source = @" class C { static void Main() { object o = (long)1; } }"; var compilation = CreateCompilation(source); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); var literalTypeInfo = model.GetTypeInfo(literal); var literalConversion = model.GetConversion(literal); Assert.Equal(SpecialType.System_Int32, literalTypeInfo.Type.SpecialType); Assert.Equal(SpecialType.System_Int32, literalTypeInfo.ConvertedType.SpecialType); Assert.Equal(ConversionKind.Identity, literalConversion.Kind); var cast = (CastExpressionSyntax)literal.Parent; var castTypeInfo = model.GetTypeInfo(cast); var castConversion = model.GetConversion(cast); Assert.Equal(SpecialType.System_Int64, castTypeInfo.Type.SpecialType); Assert.Equal(SpecialType.System_Object, castTypeInfo.ConvertedType.SpecialType); Assert.Equal(ConversionKind.Boxing, castConversion.Kind); } [Fact] public void ExplicitBoxingConversion1() { var source = @" class C { static void Main() { object o = (object)1; } }"; var compilation = CreateCompilation(source); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); var literalTypeInfo = model.GetTypeInfo(literal); var literalConversion = model.GetConversion(literal); Assert.Equal(SpecialType.System_Int32, literalTypeInfo.Type.SpecialType); Assert.Equal(SpecialType.System_Int32, literalTypeInfo.ConvertedType.SpecialType); Assert.Equal(ConversionKind.Identity, literalConversion.Kind); var cast = (CastExpressionSyntax)literal.Parent; var castTypeInfo = model.GetTypeInfo(cast); var castConversion = model.GetConversion(cast); Assert.Equal(SpecialType.System_Object, castTypeInfo.Type.SpecialType); Assert.Equal(SpecialType.System_Object, castTypeInfo.ConvertedType.SpecialType); Assert.Equal(ConversionKind.Identity, castConversion.Kind); Assert.Equal(ConversionKind.Boxing, model.ClassifyConversion(literal, castTypeInfo.Type).Kind); CheckIsAssignableTo(model, literal); } [Fact] public void ExplicitBoxingConversion2() { var source = @" class C { static void Main() { object o = (object)(long)1; } }"; var compilation = CreateCompilation(source); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); var literalTypeInfo = model.GetTypeInfo(literal); var literalConversion = model.GetConversion(literal); Assert.Equal(SpecialType.System_Int32, literalTypeInfo.Type.SpecialType); Assert.Equal(SpecialType.System_Int32, literalTypeInfo.ConvertedType.SpecialType); Assert.Equal(ConversionKind.Identity, literalConversion.Kind); var cast1 = (CastExpressionSyntax)literal.Parent; var cast1TypeInfo = model.GetTypeInfo(cast1); var cast1Conversion = model.GetConversion(cast1); Assert.Equal(SpecialType.System_Int64, cast1TypeInfo.Type.SpecialType); Assert.Equal(SpecialType.System_Int64, cast1TypeInfo.ConvertedType.SpecialType); Assert.Equal(ConversionKind.Identity, cast1Conversion.Kind); // Note that this reflects the hypothetical conversion, not the cast in the code. Assert.Equal(ConversionKind.ImplicitNumeric, model.ClassifyConversion(literal, cast1TypeInfo.Type).Kind); CheckIsAssignableTo(model, literal); var cast2 = (CastExpressionSyntax)cast1.Parent; var cast2TypeInfo = model.GetTypeInfo(cast2); var cast2Conversion = model.GetConversion(cast2); Assert.Equal(SpecialType.System_Object, cast2TypeInfo.Type.SpecialType); Assert.Equal(SpecialType.System_Object, cast2TypeInfo.ConvertedType.SpecialType); Assert.Equal(ConversionKind.Identity, cast2Conversion.Kind); Assert.Equal(ConversionKind.Boxing, model.ClassifyConversion(cast1, cast2TypeInfo.Type).Kind); CheckIsAssignableTo(model, cast1); } [WorkItem(545136, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545136")] [WorkItem(538320, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538320")] [Fact()] // TODO: Dev10 does not report ERR_SameFullNameAggAgg here - source wins. public void SpecialTypeInSourceAndMetadata() { var text = @" using System; namespace System { public struct Void { static void Main() { System./*<bind>*/Void/*</bind>*/.Equals(1, 1); } } } "; var compilation = CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var expr = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var symbolInfo = model.GetSymbolInfo(expr); Assert.Equal("System.Void", symbolInfo.Symbol.ToString()); Assert.Equal(CandidateReason.None, symbolInfo.CandidateReason); Assert.Equal(0, symbolInfo.CandidateSymbols.Length); } [WorkItem(544651, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544651")] [Fact] public void SpeculativelyBindMethodGroup1() { var text = @" using System; class C { static void M() { int here; } } "; var compilation = (Compilation)CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var position = text.IndexOf("here", StringComparison.Ordinal); var syntax = SyntaxFactory.ParseExpression(" C.M"); //Leading trivia was significant for triggering an assert before the fix. Assert.Equal(SyntaxKind.SimpleMemberAccessExpression, syntax.Kind()); var info = model.GetSpeculativeSymbolInfo(position, syntax, SpeculativeBindingOption.BindAsExpression); Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("M"), info.CandidateSymbols.Single()); Assert.Equal(CandidateReason.OverloadResolutionFailure, info.CandidateReason); } [WorkItem(544651, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544651")] [Fact] public void SpeculativelyBindMethodGroup2() { var text = @" using System; class C { static void M() { int here; } static void M(int x) { } } "; var compilation = CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var position = text.IndexOf("here", StringComparison.Ordinal); var syntax = SyntaxFactory.ParseExpression(" C.M"); //Leading trivia was significant for triggering an assert before the fix. Assert.Equal(SyntaxKind.SimpleMemberAccessExpression, syntax.Kind()); var info = model.GetSpeculativeSymbolInfo(position, syntax, SpeculativeBindingOption.BindAsExpression); Assert.Null(info.Symbol); Assert.Equal(CandidateReason.OverloadResolutionFailure, info.CandidateReason); Assert.Equal(2, info.CandidateSymbols.Length); } [WorkItem(546046, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546046")] [Fact] public void UnambiguousMethodGroupWithoutBoundParent1() { var text = @" using System; class C { static void M() { /*<bind>*/M/*</bind>*/ "; var compilation = (Compilation)CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var syntax = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, syntax.Kind()); var info = model.GetSymbolInfo(syntax); Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("M"), info.CandidateSymbols.Single()); Assert.Equal(CandidateReason.OverloadResolutionFailure, info.CandidateReason); } [WorkItem(546046, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546046")] [Fact] public void UnambiguousMethodGroupWithoutBoundParent2() { var text = @" using System; class C { static void M() { /*<bind>*/M/*</bind>*/[] "; var compilation = CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var syntax = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.IdentifierName, syntax.Kind()); var info = model.GetSymbolInfo(syntax); Assert.Null(info.Symbol); Assert.Equal(CandidateReason.NotATypeOrNamespace, info.CandidateReason); Assert.Equal(1, info.CandidateSymbols.Length); } [WorkItem(544651, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544651")] [ClrOnlyFact] public void SpeculativelyBindPropertyGroup1() { var source1 = @"Imports System.Runtime.InteropServices <Assembly: PrimaryInteropAssembly(0, 0)> <Assembly: Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E210"")> <ComImport()> <Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E211"")> Public Interface IA Property P(o As Object) As Object End Interface"; var reference1 = BasicCompilationUtils.CompileToMetadata(source1); var source2 = @" using System; class C { static void M(IA a) { int here; } } "; var compilation = (Compilation)CreateCompilation(source2, new[] { reference1 }, assemblyName: "SpeculativelyBindPropertyGroup"); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var position = source2.IndexOf("here", StringComparison.Ordinal); var syntax = SyntaxFactory.ParseExpression(" a.P"); //Leading trivia was significant for triggering an assert before the fix. Assert.Equal(SyntaxKind.SimpleMemberAccessExpression, syntax.Kind()); var info = model.GetSpeculativeSymbolInfo(position, syntax, SpeculativeBindingOption.BindAsExpression); Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("IA").GetMember<IPropertySymbol>("P"), info.Symbol); } [WorkItem(544651, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544651")] [ClrOnlyFact] public void SpeculativelyBindPropertyGroup2() { var source1 = @"Imports System.Runtime.InteropServices <Assembly: PrimaryInteropAssembly(0, 0)> <Assembly: Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E210"")> <ComImport()> <Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E211"")> Public Interface IA Property P(o As Object) As Object Property P(x As Object, y As Object) As Object End Interface"; var reference1 = BasicCompilationUtils.CompileToMetadata(source1); var source2 = @" using System; class C { static void M(IA a) { int here; } } "; var compilation = CreateCompilation(source2, new[] { reference1 }, assemblyName: "SpeculativelyBindPropertyGroup"); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var position = source2.IndexOf("here", StringComparison.Ordinal); var syntax = SyntaxFactory.ParseExpression(" a.P"); //Leading trivia was significant for triggering an assert before the fix. Assert.Equal(SyntaxKind.SimpleMemberAccessExpression, syntax.Kind()); var info = model.GetSpeculativeSymbolInfo(position, syntax, SpeculativeBindingOption.BindAsExpression); Assert.Null(info.Symbol); Assert.Equal(CandidateReason.OverloadResolutionFailure, info.CandidateReason); Assert.Equal(2, info.CandidateSymbols.Length); } // There is no test analogous to UnambiguousMethodGroupWithoutBoundParent1 because // a.P does not yield a bound property group - it yields a bound indexer access // (i.e. it doesn't actually hit the code path that formerly contained the assert). //[WorkItem(15177)] //[Fact] //public void UnambiguousPropertyGroupWithoutBoundParent1() [WorkItem(546117, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546117")] [ClrOnlyFact] public void UnambiguousPropertyGroupWithoutBoundParent2() { var source1 = @"Imports System.Runtime.InteropServices <Assembly: PrimaryInteropAssembly(0, 0)> <Assembly: Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E210"")> <ComImport()> <Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E211"")> Public Interface IA Property P(o As Object) As Object End Interface"; var reference1 = BasicCompilationUtils.CompileToMetadata(source1); var source2 = @" using System; class C { static void M(IA a) { /*<bind>*/a.P/*</bind>*/[] "; var compilation = CreateCompilation(source2, new[] { reference1 }, assemblyName: "SpeculativelyBindPropertyGroup"); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var syntax = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.QualifiedName, syntax.Kind()); var info = model.GetSymbolInfo(syntax); Assert.Null(info.Symbol); Assert.Equal(CandidateReason.NotATypeOrNamespace, info.CandidateReason); Assert.Equal(1, info.CandidateSymbols.Length); } [WorkItem(544648, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544648")] [Fact] public void SpeculativelyBindExtensionMethod() { var source = @" using System; using System.Collections.Generic; using System.Reflection; static class Program { static void Main() { FieldInfo[] fields = typeof(Exception).GetFields(); Console.WriteLine(/*<bind>*/fields.Any((Func<FieldInfo, bool>)(field => field.IsStatic))/*</bind>*/); } static bool Any<T>(this IEnumerable<T> s, Func<T, bool> predicate) { return false; } static bool Any<T>(this ICollection<T> s, Func<T, bool> predicate) { return true; } } "; var comp = (Compilation)CreateCompilationWithMscorlib40AndSystemCore(source); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var originalSyntax = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); Assert.Equal(SyntaxKind.InvocationExpression, originalSyntax.Kind()); var info1 = model.GetSymbolInfo(originalSyntax); var method1 = info1.Symbol as IMethodSymbol; Assert.NotNull(method1); Assert.Equal("System.Boolean System.Collections.Generic.ICollection<System.Reflection.FieldInfo>.Any<System.Reflection.FieldInfo>(System.Func<System.Reflection.FieldInfo, System.Boolean> predicate)", method1.ToTestDisplayString()); Assert.Same(method1.ReducedFrom.TypeParameters[0], method1.TypeParameters[0].ReducedFrom); Assert.Null(method1.ReducedFrom.TypeParameters[0].ReducedFrom); Assert.Equal("System.Boolean Program.Any<T>(this System.Collections.Generic.ICollection<T> s, System.Func<T, System.Boolean> predicate)", method1.ReducedFrom.ToTestDisplayString()); Assert.Equal("System.Collections.Generic.ICollection<System.Reflection.FieldInfo>", method1.ReceiverType.ToTestDisplayString()); Assert.Equal("System.Reflection.FieldInfo", method1.GetTypeInferredDuringReduction(method1.ReducedFrom.TypeParameters[0]).ToTestDisplayString()); Assert.Throws<InvalidOperationException>(() => method1.ReducedFrom.GetTypeInferredDuringReduction(null)); Assert.Throws<ArgumentNullException>(() => method1.GetTypeInferredDuringReduction(null)); Assert.Throws<ArgumentException>(() => method1.GetTypeInferredDuringReduction( comp.Assembly.GlobalNamespace.GetMember<INamedTypeSymbol>("Program").GetMembers("Any"). Where((m) => (object)m != (object)method1.ReducedFrom).Cast<IMethodSymbol>().Single().TypeParameters[0])); Assert.Equal("Any", method1.Name); var reducedFrom1 = method1.GetSymbol().CallsiteReducedFromMethod; Assert.NotNull(reducedFrom1); Assert.Equal("System.Boolean Program.Any<System.Reflection.FieldInfo>(this System.Collections.Generic.ICollection<System.Reflection.FieldInfo> s, System.Func<System.Reflection.FieldInfo, System.Boolean> predicate)", reducedFrom1.ToTestDisplayString()); Assert.Equal("Program", reducedFrom1.ReceiverType.ToTestDisplayString()); Assert.Equal(SpecialType.System_Collections_Generic_ICollection_T, ((TypeSymbol)reducedFrom1.Parameters[0].Type.OriginalDefinition).SpecialType); var speculativeSyntax = SyntaxFactory.ParseExpression("fields.Any((field => field.IsStatic))"); //cast removed Assert.Equal(SyntaxKind.InvocationExpression, speculativeSyntax.Kind()); var info2 = model.GetSpeculativeSymbolInfo(originalSyntax.SpanStart, speculativeSyntax, SpeculativeBindingOption.BindAsExpression); var method2 = info2.Symbol as IMethodSymbol; Assert.NotNull(method2); Assert.Equal("Any", method2.Name); var reducedFrom2 = method2.GetSymbol().CallsiteReducedFromMethod; Assert.NotNull(reducedFrom2); Assert.Equal(SpecialType.System_Collections_Generic_ICollection_T, ((TypeSymbol)reducedFrom2.Parameters[0].Type.OriginalDefinition).SpecialType); Assert.Equal(reducedFrom1, reducedFrom2); Assert.Equal(method1, method2); } /// <summary> /// This test reproduces the issue we were seeing in DevDiv #13366: LocalSymbol.SetType was asserting /// because it was set to IEnumerable&lt;int&gt; before binding the declaration of x but to an error /// type after binding the declaration of x. /// </summary> [WorkItem(545097, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545097")] [Fact] public void NameConflictDuringLambdaBinding1() { var source = @" using System.Linq; class C { static void Main() { var x = 0; var q = from e in """" let x = 2 select x; } } "; var comp = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = comp.SyntaxTrees.Single(); var localDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclarationSyntax>(); var localDecl1 = localDecls.First(); Assert.Equal("x", localDecl1.Variables.Single().Identifier.ValueText); var localDecl2 = localDecls.Last(); Assert.Equal("q", localDecl2.Variables.Single().Identifier.ValueText); var model = comp.GetSemanticModel(tree); var info0 = model.GetSymbolInfo(localDecl2.Type); Assert.Equal(SpecialType.System_Collections_Generic_IEnumerable_T, ((ITypeSymbol)info0.Symbol.OriginalDefinition).SpecialType); Assert.Equal(SpecialType.System_Int32, ((INamedTypeSymbol)info0.Symbol).TypeArguments.Single().SpecialType); var info1 = model.GetSymbolInfo(localDecl1.Type); Assert.Equal(SpecialType.System_Int32, ((ITypeSymbol)info1.Symbol).SpecialType); // This used to assert because the second binding would see the declaration of x and report CS7040, disrupting the delegate conversion. var info2 = model.GetSymbolInfo(localDecl2.Type); Assert.Equal(SpecialType.System_Collections_Generic_IEnumerable_T, ((ITypeSymbol)info2.Symbol.OriginalDefinition).SpecialType); Assert.Equal(SpecialType.System_Int32, ((INamedTypeSymbol)info2.Symbol).TypeArguments.Single().SpecialType); comp.VerifyDiagnostics( // (9,34): error CS1931: The range variable 'x' conflicts with a previous declaration of 'x' // var q = from e in "" let x = 2 select x; Diagnostic(ErrorCode.ERR_QueryRangeVariableOverrides, "x").WithArguments("x").WithLocation(9, 34), // (8,13): warning CS0219: The variable 'x' is assigned but its value is never used // var x = 0; Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "x").WithArguments("x").WithLocation(8, 13) ); } /// <summary> /// This test reverses the order of statement binding from NameConflictDuringLambdaBinding2 to confirm that /// the results are the same. /// </summary> [WorkItem(545097, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545097")] [Fact] public void NameConflictDuringLambdaBinding2() { var source = @" using System.Linq; class C { static void Main() { var x = 0; var q = from e in """" let x = 2 select x; } } "; var comp = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = comp.SyntaxTrees.Single(); var localDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclarationSyntax>(); var localDecl1 = localDecls.First(); Assert.Equal("x", localDecl1.Variables.Single().Identifier.ValueText); var localDecl2 = localDecls.Last(); Assert.Equal("q", localDecl2.Variables.Single().Identifier.ValueText); var model = comp.GetSemanticModel(tree); var info1 = model.GetSymbolInfo(localDecl1.Type); Assert.Equal(SpecialType.System_Int32, ((ITypeSymbol)info1.Symbol).SpecialType); // This used to assert because the second binding would see the declaration of x and report CS7040, disrupting the delegate conversion. var info2 = model.GetSymbolInfo(localDecl2.Type); Assert.Equal(SpecialType.System_Collections_Generic_IEnumerable_T, ((ITypeSymbol)info2.Symbol.OriginalDefinition).SpecialType); Assert.Equal(SpecialType.System_Int32, ((INamedTypeSymbol)info2.Symbol).TypeArguments.Single().SpecialType); comp.VerifyDiagnostics( // (9,34): error CS1931: The range variable 'x' conflicts with a previous declaration of 'x' // var q = from e in "" let x = 2 select x; Diagnostic(ErrorCode.ERR_QueryRangeVariableOverrides, "x").WithArguments("x").WithLocation(9, 34), // (8,13): warning CS0219: The variable 'x' is assigned but its value is never used // var x = 0; Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "x").WithArguments("x").WithLocation(8, 13) ); } [WorkItem(546263, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546263")] [Fact] public void SpeculativeSymbolInfoForOmittedTypeArgumentSyntaxNode() { var text = @"namespace N2 { using N1; class Test { class N1<G1> {} static void Main() { int res = 0; N1<int> n1 = new N1<int>(); global::N1 < > .C1 c1 = null; } } }"; var compilation = CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var position = text.IndexOf("< >", StringComparison.Ordinal); var syntax = tree.GetCompilationUnitRoot().FindToken(position).Parent.DescendantNodesAndSelf().OfType<OmittedTypeArgumentSyntax>().Single(); var info = model.GetSpeculativeSymbolInfo(syntax.SpanStart, syntax, SpeculativeBindingOption.BindAsTypeOrNamespace); Assert.Null(info.Symbol); } [WorkItem(530313, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530313")] [Fact] public void SpeculativeTypeInfoForOmittedTypeArgumentSyntaxNode() { var text = @"namespace N2 { using N1; class Test { class N1<G1> {} static void Main() { int res = 0; N1<int> n1 = new N1<int>(); global::N1 < > .C1 c1 = null; } } }"; var compilation = CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var position = text.IndexOf("< >", StringComparison.Ordinal); var syntax = tree.GetCompilationUnitRoot().FindToken(position).Parent.DescendantNodesAndSelf().OfType<OmittedTypeArgumentSyntax>().Single(); var info = model.GetSpeculativeTypeInfo(syntax.SpanStart, syntax, SpeculativeBindingOption.BindAsTypeOrNamespace); Assert.Equal(TypeInfo.None, info); } [WorkItem(546266, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546266")] [Fact] public void SpeculativeTypeInfoForGenericNameSyntaxWithinTypeOfInsideAnonMethod() { var text = @" delegate void Del(); class C { public void M1() { Del d = delegate () { var v1 = typeof(S<,,,>); }; } } "; var compilation = CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var position = text.IndexOf("S<,,,>", StringComparison.Ordinal); var syntax = tree.GetCompilationUnitRoot().FindToken(position).Parent.DescendantNodesAndSelf().OfType<GenericNameSyntax>().Single(); var info = model.GetSpeculativeTypeInfo(syntax.SpanStart, syntax, SpeculativeBindingOption.BindAsTypeOrNamespace); Assert.NotNull(info.Type); } [WorkItem(547160, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/547160")] [Fact, WorkItem(531496, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531496")] public void SemanticInfoForOmittedTypeArgumentInIncompleteMember() { var text = @" class Test { C<> "; var compilation = CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OmittedTypeArgumentSyntax>().Single(); var info = model.GetSemanticInfoSummary(syntax); Assert.Null(info.Alias); Assert.Equal(CandidateReason.None, info.CandidateReason); Assert.True(info.CandidateSymbols.IsEmpty); Assert.False(info.ConstantValue.HasValue); Assert.Null(info.ConvertedType); Assert.Equal(Conversion.Identity, info.ImplicitConversion); Assert.False(info.IsCompileTimeConstant); Assert.True(info.MemberGroup.IsEmpty); Assert.True(info.MethodGroup.IsEmpty); Assert.Null(info.Symbol); Assert.Null(info.Type); } [WorkItem(547160, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/547160")] [Fact, WorkItem(531496, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531496")] public void CollectionInitializerSpeculativeInfo() { var text = @" class Test { } "; var compilation = CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var speculativeSyntax = SyntaxFactory.ParseExpression("new List { 1, 2 }"); var initializerSyntax = speculativeSyntax.DescendantNodesAndSelf().OfType<InitializerExpressionSyntax>().Single(); var symbolInfo = model.GetSpeculativeSymbolInfo(0, initializerSyntax, SpeculativeBindingOption.BindAsExpression); Assert.Equal(SymbolInfo.None, symbolInfo); var typeInfo = model.GetSpeculativeTypeInfo(0, initializerSyntax, SpeculativeBindingOption.BindAsExpression); Assert.Equal(TypeInfo.None, typeInfo); } [WorkItem(531362, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531362")] [Fact] public void DelegateElementAccess() { var text = @" class C { void M(bool b) { System.Action o = delegate { if (b) { } } [1]; } } "; var compilation = CreateCompilation(text); compilation.VerifyDiagnostics( // (6,27): error CS0021: Cannot apply indexing with [] to an expression of type 'anonymous method' // System.Action o = delegate { if (b) { } } [1]; Diagnostic(ErrorCode.ERR_BadIndexLHS, "delegate { if (b) { } } [1]").WithArguments("anonymous method")); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(id => id.Identifier.ValueText == "b"); var info = model.GetSymbolInfo(syntax); } [Fact] public void EnumBitwiseComplement() { var text = @" using System; enum Color { Red, Green, Blue } class C { static void Main() { Func<Color, Color> f2 = x => /*<bind>*/~x/*</bind>*/; } }"; var compilation = CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var syntax = GetExprSyntaxForBinding(GetExprSyntaxList(tree)); var info = model.GetTypeInfo(syntax); var conv = model.GetConversion(syntax); Assert.Equal(TypeKind.Enum, info.Type.TypeKind); Assert.Equal(ConversionKind.Identity, conv.Kind); } [WorkItem(531534, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531534")] [Fact] public void LambdaOutsideMemberModel() { var text = @" int P { badAccessorName { M(env => env); "; var compilation = CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Last(); var symbol = model.GetDeclaredSymbol(syntax); // Doesn't assert. Assert.Null(symbol); } [WorkItem(633340, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/633340")] [Fact] public void MemberOfInaccessibleType() { var text = @" class A { private class Nested { public class Another { } } } public class B : A { public Nested.Another a; } "; var compilation = (Compilation)CreateCompilation(text); var global = compilation.GlobalNamespace; var classA = global.GetMember<INamedTypeSymbol>("A"); var classNested = classA.GetMember<INamedTypeSymbol>("Nested"); var classAnother = classNested.GetMember<INamedTypeSymbol>("Another"); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var fieldSyntax = tree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single(); var qualifiedSyntax = (QualifiedNameSyntax)fieldSyntax.Declaration.Type; var leftSyntax = qualifiedSyntax.Left; var rightSyntax = qualifiedSyntax.Right; var leftInfo = model.GetSymbolInfo(leftSyntax); Assert.Equal(CandidateReason.Inaccessible, leftInfo.CandidateReason); Assert.Equal(classNested, leftInfo.CandidateSymbols.Single()); var rightInfo = model.GetSymbolInfo(rightSyntax); Assert.Equal(CandidateReason.Inaccessible, rightInfo.CandidateReason); Assert.Equal(classAnother, rightInfo.CandidateSymbols.Single()); compilation.VerifyDiagnostics( // (12,14): error CS0060: Inconsistent accessibility: base type 'A' is less accessible than class 'B' // public class B : A Diagnostic(ErrorCode.ERR_BadVisBaseClass, "B").WithArguments("B", "A"), // (14,12): error CS0122: 'A.Nested' is inaccessible due to its protection level // public Nested.Another a; Diagnostic(ErrorCode.ERR_BadAccess, "Nested").WithArguments("A.Nested")); } [WorkItem(633340, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/633340")] [Fact] public void NotReferencableMemberOfInaccessibleType() { var text = @" class A { private class Nested { public int P { get; set; } } } class B : A { int Test(Nested nested) { return nested.get_P(); } } "; var compilation = (Compilation)CreateCompilation(text); var global = compilation.GlobalNamespace; var classA = global.GetMember<INamedTypeSymbol>("A"); var classNested = classA.GetMember<INamedTypeSymbol>("Nested"); var propertyP = classNested.GetMember<IPropertySymbol>("P"); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var memberAccessSyntax = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); var info = model.GetSymbolInfo(memberAccessSyntax); Assert.Equal(CandidateReason.NotReferencable, info.CandidateReason); Assert.Equal(propertyP.GetMethod, info.CandidateSymbols.Single()); compilation.VerifyDiagnostics( // (12,14): error CS0122: 'A.Nested' is inaccessible due to its protection level // int Test(Nested nested) Diagnostic(ErrorCode.ERR_BadAccess, "Nested").WithArguments("A.Nested"), // (14,23): error CS0571: 'A.Nested.P.get': cannot explicitly call operator or accessor // return nested.get_P(); Diagnostic(ErrorCode.ERR_CantCallSpecialMethod, "get_P").WithArguments("A.Nested.P.get") ); } [WorkItem(633340, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/633340")] [Fact] public void AccessibleMemberOfInaccessibleType() { var text = @" public class A { private class Nested { } } public class B : A { void Test() { Nested.ReferenceEquals(null, null); // Actually object.ReferenceEquals. } } "; var compilation = (Compilation)CreateCompilation(text); var global = compilation.GlobalNamespace; var classA = global.GetMember<INamedTypeSymbol>("A"); var classNested = classA.GetMember<INamedTypeSymbol>("Nested"); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); var methodAccessSyntax = (MemberAccessExpressionSyntax)callSyntax.Expression; var nestedTypeAccessSyntax = methodAccessSyntax.Expression; var typeInfo = model.GetSymbolInfo(nestedTypeAccessSyntax); Assert.Equal(CandidateReason.Inaccessible, typeInfo.CandidateReason); Assert.Equal(classNested, typeInfo.CandidateSymbols.Single()); var methodInfo = model.GetSymbolInfo(callSyntax); Assert.Equal(compilation.GetSpecialTypeMember(SpecialMember.System_Object__ReferenceEquals), methodInfo.Symbol); compilation.VerifyDiagnostics( // (13,9): error CS0122: 'A.Nested' is inaccessible due to its protection level // Nested.ReferenceEquals(null, null); // Actually object.ReferenceEquals. Diagnostic(ErrorCode.ERR_BadAccess, "Nested").WithArguments("A.Nested")); } [WorkItem(530252, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530252")] [Fact] public void MethodGroupHiddenSymbols1() { var text = @" class C { public override int GetHashCode() { return 0; } } struct S { public override int GetHashCode() { return 0; } } class Test { int M(C c) { return c.GetHashCode } int M(S s) { return s.GetHashCode } } "; var compilation = CreateCompilation(text); var global = compilation.GlobalNamespace; var classType = global.GetMember<NamedTypeSymbol>("C"); var structType = global.GetMember<NamedTypeSymbol>("S"); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var memberAccesses = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray(); Assert.Equal(2, memberAccesses.Length); var classMemberAccess = memberAccesses[0]; var structMemberAccess = memberAccesses[1]; var classInfo = model.GetSymbolInfo(classMemberAccess); var structInfo = model.GetSymbolInfo(structMemberAccess); // Only one candidate. Assert.Equal(CandidateReason.OverloadResolutionFailure, classInfo.CandidateReason); Assert.Equal("System.Int32 C.GetHashCode()", classInfo.CandidateSymbols.Single().ToTestDisplayString()); Assert.Equal(CandidateReason.OverloadResolutionFailure, structInfo.CandidateReason); Assert.Equal("System.Int32 S.GetHashCode()", structInfo.CandidateSymbols.Single().ToTestDisplayString()); } [WorkItem(530252, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530252")] [Fact] public void MethodGroupHiddenSymbols2() { var text = @" class A { public virtual void M() { } } class B : A { public override void M() { } } class C : B { public override void M() { } } class Program { static void Main(string[] args) { C c = new C(); c.M } } "; var compilation = CreateCompilation(text); var classC = compilation.GlobalNamespace.GetMember<NamedTypeSymbol>("C"); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var memberAccess = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); var info = model.GetSymbolInfo(memberAccess); // Only one candidate. Assert.Equal(CandidateReason.OverloadResolutionFailure, info.CandidateReason); Assert.Equal("void C.M()", info.CandidateSymbols.Single().ToTestDisplayString()); } [Fact] [WorkItem(645512, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/645512")] public void LookupProtectedMemberOnConstrainedTypeParameter() { var source = @" class A { protected void Goo() { } } class C : A { public void Bar<T>(T t, C c) where T : C { t.Goo(); c.Goo(); } } "; var comp = (Compilation)CreateCompilation(source); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); comp.VerifyDiagnostics(); var global = comp.GlobalNamespace; var classA = global.GetMember<INamedTypeSymbol>("A"); var methodGoo = classA.GetMember<IMethodSymbol>("Goo"); var classC = global.GetMember<INamedTypeSymbol>("C"); var methodBar = classC.GetMember<IMethodSymbol>("Bar"); var paramType0 = methodBar.GetParameterType(0); Assert.Equal(TypeKind.TypeParameter, paramType0.TypeKind); var paramType1 = methodBar.GetParameterType(1); Assert.Equal(TypeKind.Class, paramType1.TypeKind); int position = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().SpanStart; Assert.Contains("Goo", model.LookupNames(position, paramType0)); Assert.Contains("Goo", model.LookupNames(position, paramType1)); } [Fact] [WorkItem(645512, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/645512")] public void LookupProtectedMemberOnConstrainedTypeParameter2() { var source = @" class A { protected void Goo() { } } class C : A { public void Bar<T, U>(T t, C c) where T : U where U : C { t.Goo(); c.Goo(); } } "; var comp = (Compilation)CreateCompilation(source); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); comp.VerifyDiagnostics(); var global = comp.GlobalNamespace; var classA = global.GetMember<INamedTypeSymbol>("A"); var methodGoo = classA.GetMember<IMethodSymbol>("Goo"); var classC = global.GetMember<INamedTypeSymbol>("C"); var methodBar = classC.GetMember<IMethodSymbol>("Bar"); var paramType0 = methodBar.GetParameterType(0); Assert.Equal(TypeKind.TypeParameter, paramType0.TypeKind); var paramType1 = methodBar.GetParameterType(1); Assert.Equal(TypeKind.Class, paramType1.TypeKind); int position = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().SpanStart; Assert.Contains("Goo", model.LookupNames(position, paramType0)); Assert.Contains("Goo", model.LookupNames(position, paramType1)); } [Fact] [WorkItem(652583, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/652583")] public void ParameterDefaultValueWithoutParameter() { var source = @" class A { protected void Goo(bool b, = true "; var comp = CreateCompilation(source); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var trueLiteral = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); Assert.Equal(SyntaxKind.TrueLiteralExpression, trueLiteral.Kind()); model.GetSymbolInfo(trueLiteral); var parameterSyntax = trueLiteral.FirstAncestorOrSelf<ParameterSyntax>(); Assert.Equal(SyntaxKind.Parameter, parameterSyntax.Kind()); model.GetDeclaredSymbol(parameterSyntax); } [Fact] [WorkItem(530791, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530791")] public void Repro530791() { var source = @" class Program { static void Main(string[] args) { Test test = new Test(() => { return null; }); } } class Test { } "; var comp = CreateCompilation(source); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); var symbolInfo = model.GetSymbolInfo(lambdaSyntax); var lambda = (IMethodSymbol)symbolInfo.Symbol; Assert.False(lambda.ReturnsVoid); Assert.Equal(SymbolKind.ErrorType, lambda.ReturnType.Kind); } [Fact] public void InvocationInLocalDeclarationInLambdaInConstructorInitializer() { var source = @" using System; public class C { public int M() { return null; } } public class Test { public Test() : this(c => { int i = c.M(); return i; }) { } public Test(Func<C, int> f) { } } "; var comp = CreateCompilation(source); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); var symbolInfo = model.GetSymbolInfo(syntax); var methodSymbol = (IMethodSymbol)symbolInfo.Symbol; Assert.False(methodSymbol.ReturnsVoid); } [Fact] [WorkItem(654753, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/654753")] public void Repro654753() { var source = @" using System; using System.Collections.Generic; using System.Linq; public class C { private readonly C Instance = new C(); bool M(IDisposable d) { using(d) { bool any = this.Instance.GetList().OfType<D>().Any(); return any; } } IEnumerable<C> GetList() { return null; } } public class D : C { } "; var comp = CreateCompilationWithMscorlib40AndSystemCore(source); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var position = source.IndexOf("this", StringComparison.Ordinal); var statement = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); var newSyntax = SyntaxFactory.ParseExpression("Instance.GetList().OfType<D>().Any()"); var newStatement = statement.ReplaceNode(statement.Declaration.Variables[0].Initializer.Value, newSyntax); newSyntax = newStatement.Declaration.Variables[0].Initializer.Value; SemanticModel speculativeModel; bool success = model.TryGetSpeculativeSemanticModel(position, newStatement, out speculativeModel); Assert.True(success); Assert.NotNull(speculativeModel); var newSyntaxMemberAccess = newSyntax.DescendantNodesAndSelf().OfType<MemberAccessExpressionSyntax>(). Single(e => e.ToString() == "Instance.GetList().OfType<D>"); speculativeModel.GetTypeInfo(newSyntaxMemberAccess); } [Fact] [WorkItem(750557, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/750557")] public void MethodGroupFromMetadata() { var source = @" class Goo { delegate int D(int i); void M() { var v = ((D)(x => x)).Equals is bool; } } "; var comp = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var position = source.IndexOf("Equals", StringComparison.Ordinal); var equalsToken = tree.GetRoot().FindToken(position); var equalsNode = equalsToken.Parent; var symbolInfo = model.GetSymbolInfo(equalsNode); //note that we don't guarantee what symbol will come back on a method group in an is expression. Assert.Null(symbolInfo.Symbol); Assert.True(symbolInfo.CandidateSymbols.Length > 0); Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason); } [Fact, WorkItem(531304, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531304")] public void GetPreprocessingSymbolInfoForDefinedSymbol() { string sourceCode = @" #define X #if X //bind #define Z #endif #if Z //bind #endif // broken code cases #define A #if A + 1 //bind #endif #define B = 0 #if B //bind #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "X //bind"); Assert.Equal("X", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "A + 1 //bind"); Assert.Equal("A", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "B //bind"); Assert.Equal("B", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); Assert.True(symbolInfo.Symbol.Equals(symbolInfo.Symbol)); Assert.False(symbolInfo.Symbol.Equals(null)); PreprocessingSymbolInfo symbolInfo2 = GetPreprocessingSymbolInfoForTest(sourceCode, "B //bind"); Assert.NotSame(symbolInfo.Symbol, symbolInfo2.Symbol); Assert.Equal(symbolInfo.Symbol, symbolInfo2.Symbol); Assert.Equal(symbolInfo.Symbol.GetHashCode(), symbolInfo2.Symbol.GetHashCode()); } [Fact, WorkItem(531304, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531304")] public void GetPreprocessingSymbolInfoForUndefinedSymbol() { string sourceCode = @" #define X #undef X #if X //bind #endif #if x //bind #endif #if Y //bind #define Z #endif #if Z //bind #endif // Not in preprocessor trivia #define A public class T { public int Goo(int A) { return A; //bind } } "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "X //bind"); Assert.Equal("X", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "x //bind"); Assert.Equal("x", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Y //bind"); Assert.Equal("Y", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "A; //bind"); Assert.Null(symbolInfo.Symbol); } [Fact, WorkItem(531304, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531304"), WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void GetPreprocessingSymbolInfoForSymbolDefinedLaterInSource() { string sourceCode = @" #if Z //bind #endif #define Z "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_01() { string sourceCode = @" #define Z #if Z //bind #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_02() { string sourceCode = @" #if true #define Z #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_03() { string sourceCode = @" #if false #define Z #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_04() { string sourceCode = @" #if true #define Z #endif #if Z //bind #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_05() { string sourceCode = @" #if false #define Z #endif #if Z //bind #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_06() { string sourceCode = @" #if true #else #define Z #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_07() { string sourceCode = @" #if false #else #define Z #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_08() { string sourceCode = @" #if true #define Z #else #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_09() { string sourceCode = @" #if false #define Z #else #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_10() { string sourceCode = @" #if true #elif true #define Z #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_11() { string sourceCode = @" #if false #elif true #define Z #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_12() { string sourceCode = @" #if false #elif false #define Z #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_13() { string sourceCode = @" #if true #define Z #elif false #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_14() { string sourceCode = @" #if true #define Z #elif true #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_15() { string sourceCode = @" #if false #define Z #elif true #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_16() { string sourceCode = @" #if false #define Z #elif false #if Z //bind #endif #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_17() { string sourceCode = @" #if false #else #define Z #endif #if Z //bind #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_18() { string sourceCode = @" #if false #elif true #define Z #endif #if Z //bind #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.True(symbolInfo.IsDefined, "must be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_19() { string sourceCode = @" #if true #else #define Z #endif #if Z //bind #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_20() { string sourceCode = @" #if true #elif true #define Z #endif #if Z //bind #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_21() { string sourceCode = @" #if true #elif false #define Z #endif #if Z //bind #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); } [Fact, WorkItem(720566, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720566")] public void Bug720566_22() { string sourceCode = @" #if false #elif false #define Z #endif #if Z //bind #endif "; PreprocessingSymbolInfo symbolInfo = GetPreprocessingSymbolInfoForTest(sourceCode, "Z //bind"); Assert.Equal("Z", symbolInfo.Symbol.Name); Assert.False(symbolInfo.IsDefined, "must not be defined"); } [WorkItem(835391, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835391")] [Fact] public void ConstructedErrorTypeValidation() { var text = @"class C1 : E1 { } class C2<T> : E2<T> { }"; var compilation = (Compilation)CreateCompilation(text); var objectType = compilation.GetSpecialType(SpecialType.System_Object); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var root = tree.GetCompilationUnitRoot(); // Non-generic type. var type = (INamedTypeSymbol)model.GetDeclaredSymbol(root.Members[0]); Assert.False(type.IsGenericType); Assert.False(type.IsErrorType()); Assert.Throws<InvalidOperationException>(() => type.Construct(objectType)); // non-generic type // Non-generic error type. type = type.BaseType; Assert.False(type.IsGenericType); Assert.True(type.IsErrorType()); Assert.Throws<InvalidOperationException>(() => type.Construct(objectType)); // non-generic type // Generic type. type = (INamedTypeSymbol)model.GetDeclaredSymbol(root.Members[1]); Assert.True(type.IsGenericType); Assert.False(type.IsErrorType()); Assert.Throws<ArgumentException>(() => type.Construct(new ITypeSymbol[] { null })); // null type arg Assert.Throws<ArgumentException>(() => type.Construct()); // typeArgs.Length != Arity Assert.Throws<InvalidOperationException>(() => type.Construct(objectType).Construct(objectType)); // constructed type // Generic error type. type = type.BaseType.ConstructedFrom; Assert.True(type.IsGenericType); Assert.True(type.IsErrorType()); Assert.Throws<ArgumentException>(() => type.Construct(new ITypeSymbol[] { null })); // null type arg Assert.Throws<ArgumentException>(() => type.Construct()); // typeArgs.Length != Arity Assert.Throws<InvalidOperationException>(() => type.Construct(objectType).Construct(objectType)); // constructed type } [Fact] [WorkItem(849371, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/849371")] public void NestedLambdaErrorRecovery() { var source = @" using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; class Program { static void Main() { Task<IEnumerable<Task<A>>> teta = null; teta.ContinueWith(tasks => { var list = tasks.Result.Select(t => X(t.Result)); // Wrong argument type for X. list.ToString(); }); } static B X(int x) { return null; } class A { } class B { } } "; for (int i = 0; i < 10; i++) // Ten runs to ensure consistency. { var comp = CreateCompilationWithMscorlib40AndSystemCore(source); comp.VerifyDiagnostics( // (13,51): error CS1503: Argument 1: cannot convert from 'Program.A' to 'int' // var list = tasks.Result.Select(t => X(t.Result)); // Wrong argument type for X. Diagnostic(ErrorCode.ERR_BadArgType, "t.Result").WithArguments("1", "Program.A", "int").WithLocation(13, 51), // (13,30): error CS1061: 'System.Threading.Tasks.Task' does not contain a definition for 'Result' and no extension method 'Result' accepting a first argument of type 'System.Threading.Tasks.Task' could be found (are you missing a using directive or an assembly reference?) // var list = tasks.Result.Select(t => X(t.Result)); // Wrong argument type for X. Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "Result").WithArguments("System.Threading.Tasks.Task", "Result").WithLocation(13, 30)); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var invocationSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); var invocationInfo = model.GetSymbolInfo(invocationSyntax); Assert.Equal(CandidateReason.OverloadResolutionFailure, invocationInfo.CandidateReason); Assert.Null(invocationInfo.Symbol); Assert.NotEqual(0, invocationInfo.CandidateSymbols.Length); var parameterSyntax = invocationSyntax.DescendantNodes().OfType<ParameterSyntax>().First(); var parameterSymbol = model.GetDeclaredSymbol(parameterSyntax); Assert.Equal("System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task<Program.A>>>", parameterSymbol.Type.ToTestDisplayString()); } } [WorkItem(849371, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/849371")] [WorkItem(854543, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/854543")] [WorkItem(854548, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/854548")] [Fact] public void SemanticModelLambdaErrorRecovery() { var source = @" using System; class Program { static void Main() { M(() => 1); // Neither overload wins. } static void M(Func<string> a) { } static void M(Func<char> a) { } } "; { var comp = (Compilation)CreateCompilationWithMscorlib40AndSystemCore(source); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); var otherFuncType = comp.GetWellKnownType(WellKnownType.System_Func_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); var typeInfo = model.GetTypeInfo(lambdaSyntax); Assert.Null(typeInfo.Type); Assert.NotEqual(otherFuncType, typeInfo.ConvertedType); } { var comp = (Compilation)CreateCompilationWithMscorlib40AndSystemCore(source); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); var otherFuncType = comp.GetWellKnownType(WellKnownType.System_Func_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); var conversion = model.ClassifyConversion(lambdaSyntax, otherFuncType); CheckIsAssignableTo(model, lambdaSyntax); var typeInfo = model.GetTypeInfo(lambdaSyntax); Assert.Null(typeInfo.Type); Assert.NotEqual(otherFuncType, typeInfo.ConvertedType); // Not affected by call to ClassifyConversion. } } [Fact] [WorkItem(854543, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/854543")] public void ClassifyConversionOnNull() { var source = @" class Program { static void Main() { M(null); // Ambiguous. } static void M(A a) { } static void M(B b) { } } class A { } class B { } class C { } "; var comp = (Compilation)CreateCompilationWithMscorlib40AndSystemCore(source); comp.VerifyDiagnostics( // (6,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)' // M(null); // Ambiguous. Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(6, 9)); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var nullSyntax = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); var typeC = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); var conversion = model.ClassifyConversion(nullSyntax, typeC); CheckIsAssignableTo(model, nullSyntax); Assert.Equal(ConversionKind.ImplicitReference, conversion.Kind); } [WorkItem(854543, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/854543")] [Fact] public void ClassifyConversionOnLambda() { var source = @" using System; class Program { static void Main() { M(() => null); } static void M(Func<A> a) { } } class A { } class B { } "; var comp = (Compilation)CreateCompilationWithMscorlib40AndSystemCore(source); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); var typeB = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("B"); var typeFuncB = comp.GetWellKnownType(WellKnownType.System_Func_T).Construct(typeB); var conversion = model.ClassifyConversion(lambdaSyntax, typeFuncB); CheckIsAssignableTo(model, lambdaSyntax); Assert.Equal(ConversionKind.AnonymousFunction, conversion.Kind); } [WorkItem(854543, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/854543")] [Fact] public void ClassifyConversionOnAmbiguousLambda() { var source = @" using System; class Program { static void Main() { M(() => null); // Ambiguous. } static void M(Func<A> a) { } static void M(Func<B> b) { } } class A { } class B { } class C { } "; var comp = (Compilation)CreateCompilationWithMscorlib40AndSystemCore(source); comp.VerifyDiagnostics( // (8,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(System.Func<A>)' and 'Program.M(System.Func<B>)' // M(() => null); // Ambiguous. Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(System.Func<A>)", "Program.M(System.Func<B>)").WithLocation(8, 9)); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); var typeC = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); var typeFuncC = comp.GetWellKnownType(WellKnownType.System_Func_T).Construct(typeC); var conversion = model.ClassifyConversion(lambdaSyntax, typeFuncC); CheckIsAssignableTo(model, lambdaSyntax); Assert.Equal(ConversionKind.AnonymousFunction, conversion.Kind); } [WorkItem(854543, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/854543")] [Fact] public void ClassifyConversionOnAmbiguousMethodGroup() { var source = @" using System; class Base<T> { public A N(T t) { throw null; } public B N(int t) { throw null; } } class Derived : Base<int> { void Test() { M(N); // Ambiguous. } static void M(Func<int, A> a) { } static void M(Func<int, B> b) { } } class A { } class B { } class C { } "; var comp = (Compilation)CreateCompilationWithMscorlib40AndSystemCore(source); comp.VerifyDiagnostics( // (14,9): error CS0121: The call is ambiguous between the following methods or properties: 'Derived.M(System.Func<int, A>)' and 'Derived.M(System.Func<int, B>)' // M(N); // Ambiguous. Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Derived.M(System.Func<int, A>)", "Derived.M(System.Func<int, B>)").WithLocation(14, 9)); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var methodGroupSyntax = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>().Single().Expression; var global = comp.GlobalNamespace; var typeA = global.GetMember<INamedTypeSymbol>("A"); var typeB = global.GetMember<INamedTypeSymbol>("B"); var typeC = global.GetMember<INamedTypeSymbol>("C"); var typeInt = comp.GetSpecialType(SpecialType.System_Int32); var typeFunc = comp.GetWellKnownType(WellKnownType.System_Func_T2); var typeFuncA = typeFunc.Construct(typeInt, typeA); var typeFuncB = typeFunc.Construct(typeInt, typeB); var typeFuncC = typeFunc.Construct(typeInt, typeC); var conversionA = model.ClassifyConversion(methodGroupSyntax, typeFuncA); CheckIsAssignableTo(model, methodGroupSyntax); Assert.Equal(ConversionKind.MethodGroup, conversionA.Kind); var conversionB = model.ClassifyConversion(methodGroupSyntax, typeFuncB); Assert.Equal(ConversionKind.MethodGroup, conversionB.Kind); var conversionC = model.ClassifyConversion(methodGroupSyntax, typeFuncC); Assert.Equal(ConversionKind.NoConversion, conversionC.Kind); } [WorkItem(872064, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/872064")] [Fact] public void PartialMethodImplementationDiagnostics() { var file1 = @" namespace ConsoleApplication1 { class Program { static void Main(string[] args) { } } partial class MyPartialClass { partial void MyPartialMethod(MyUndefinedMethod m); } } "; var file2 = @" namespace ConsoleApplication1 { partial class MyPartialClass { partial void MyPartialMethod(MyUndefinedMethod m) { c = new MyUndefinedMethod(23, true); } } } "; var tree1 = Parse(file1); var tree2 = Parse(file2); var comp = CreateCompilation(new[] { tree1, tree2 }); var model = comp.GetSemanticModel(tree2); var errs = model.GetDiagnostics(); Assert.Equal(3, errs.Count()); errs = model.GetSyntaxDiagnostics(); Assert.Equal(0, errs.Count()); errs = model.GetDeclarationDiagnostics(); Assert.Equal(1, errs.Count()); errs = model.GetMethodBodyDiagnostics(); Assert.Equal(2, errs.Count()); } [Fact] public void PartialTypeDiagnostics_StaticConstructors() { var file1 = @" partial class C { static C() {} } "; var file2 = @" partial class C { static C() {} } "; var file3 = @" partial class C { static C() {} } "; var tree1 = Parse(file1); var tree2 = Parse(file2); var tree3 = Parse(file3); var comp = CreateCompilation(new[] { tree1, tree2, tree3 }); var model1 = comp.GetSemanticModel(tree1); var model2 = comp.GetSemanticModel(tree2); var model3 = comp.GetSemanticModel(tree3); model1.GetDeclarationDiagnostics().Verify(); model2.GetDeclarationDiagnostics().Verify( // (4,12): error CS0111: Type 'C' already defines a member called 'C' with the same parameter types Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "C").WithArguments("C", "C").WithLocation(4, 12)); model3.GetDeclarationDiagnostics().Verify( // (4,12): error CS0111: Type 'C' already defines a member called 'C' with the same parameter types Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "C").WithArguments("C", "C").WithLocation(4, 12)); Assert.Equal(3, comp.GlobalNamespace.GetMember<NamedTypeSymbol>("C").StaticConstructors.Length); } [Fact] public void PartialTypeDiagnostics_Constructors() { var file1 = @" partial class C { C() {} } "; var file2 = @" partial class C { C() {} } "; var file3 = @" partial class C { C() {} } "; var tree1 = Parse(file1); var tree2 = Parse(file2); var tree3 = Parse(file3); var comp = CreateCompilation(new[] { tree1, tree2, tree3 }); var model1 = comp.GetSemanticModel(tree1); var model2 = comp.GetSemanticModel(tree2); var model3 = comp.GetSemanticModel(tree3); model1.GetDeclarationDiagnostics().Verify(); model2.GetDeclarationDiagnostics().Verify( // (4,5): error CS0111: Type 'C' already defines a member called 'C' with the same parameter types Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "C").WithArguments("C", "C").WithLocation(4, 5)); model3.GetDeclarationDiagnostics().Verify( // (4,5): error CS0111: Type 'C' already defines a member called 'C' with the same parameter types Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "C").WithArguments("C", "C").WithLocation(4, 5)); Assert.Equal(3, comp.GlobalNamespace.GetMember<NamedTypeSymbol>("C").InstanceConstructors.Length); } [WorkItem(1076661, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1076661")] [Fact] public void Bug1076661() { const string source = @" using X = System.Collections.Generic.List<dynamic>; class Test { void Goo(ref X. x) { } }"; var comp = CreateCompilation(source); var diag = comp.GetDiagnostics(); } [Fact] public void QueryClauseInBadStatement_Catch() { var source = @"using System; class C { static void F(object[] c) { catch (Exception) when (from o in c where true) { } } }"; var comp = CreateCompilation(source); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var tokens = tree.GetCompilationUnitRoot().DescendantTokens(); var expr = tokens.Single(t => t.Kind() == SyntaxKind.TrueKeyword).Parent; Assert.Null(model.GetSymbolInfo(expr).Symbol); Assert.Equal(SpecialType.System_Boolean, model.GetTypeInfo(expr).Type.SpecialType); } [Fact] public void GetSpecialType_ThrowsOnLessThanZero() { var source = "class C1 { }"; var comp = CreateCompilation(source); var specialType = (SpecialType)(-1); var exceptionThrown = false; try { comp.GetSpecialType(specialType); } catch (ArgumentOutOfRangeException e) { exceptionThrown = true; Assert.StartsWith(expectedStartString: $"Unexpected SpecialType: '{(int)specialType}'.", actualString: e.Message); } Assert.True(exceptionThrown, $"{nameof(comp.GetSpecialType)} did not throw when it should have."); } [Fact] public void GetSpecialType_ThrowsOnGreaterThanCount() { var source = "class C1 { }"; var comp = CreateCompilation(source); var specialType = SpecialType.Count + 1; var exceptionThrown = false; try { comp.GetSpecialType(specialType); } catch (ArgumentOutOfRangeException e) { exceptionThrown = true; Assert.StartsWith(expectedStartString: $"Unexpected SpecialType: '{(int)specialType}'.", actualString: e.Message); } Assert.True(exceptionThrown, $"{nameof(comp.GetSpecialType)} did not throw when it should have."); } [Fact] [WorkItem(34984, "https://github.com/dotnet/roslyn/issues/34984")] public void ConversionIsExplicit_UnsetConversionKind() { var source = @"class C1 { } class C2 { public void M() { var c = new C1(); foreach (string item in c.Items) { } }"; var comp = CreateCompilation(source); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var root = tree.GetRoot(); var foreachSyntaxNode = root.DescendantNodes().OfType<ForEachStatementSyntax>().Single(); var foreachSymbolInfo = model.GetForEachStatementInfo(foreachSyntaxNode); Assert.Equal(Conversion.UnsetConversion, foreachSymbolInfo.CurrentConversion); Assert.True(foreachSymbolInfo.CurrentConversion.Exists); Assert.False(foreachSymbolInfo.CurrentConversion.IsImplicit); } [Fact, WorkItem(29933, "https://github.com/dotnet/roslyn/issues/29933")] public void SpeculativelyBindBaseInXmlDoc() { var text = @" class C { /// <summary> </summary> static void M() { } } "; var compilation = CreateCompilation(text); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var position = text.IndexOf(">", StringComparison.Ordinal); var syntax = SyntaxFactory.ParseExpression("base"); var info = model.GetSpeculativeSymbolInfo(position, syntax, SpeculativeBindingOption.BindAsExpression); Assert.Null(info.Symbol); Assert.Equal(CandidateReason.NotReferencable, info.CandidateReason); } [Fact] [WorkItem(42840, "https://github.com/dotnet/roslyn/issues/42840")] public void DuplicateTypeArgument() { var source = @"class A<T> { } class B<T, U, U> where T : A<U> where U : class { }"; var comp = CreateCompilation(source); comp.VerifyDiagnostics( // (4,15): error CS0692: Duplicate type parameter 'U' // class B<T, U, U> Diagnostic(ErrorCode.ERR_DuplicateTypeParameter, "U").WithArguments("U").WithLocation(4, 15), // (5,17): error CS0229: Ambiguity between 'U' and 'U' // where T : A<U> Diagnostic(ErrorCode.ERR_AmbigMember, "U").WithArguments("U", "U").WithLocation(5, 17)); comp = CreateCompilation(source); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var typeParameters = tree.GetRoot().DescendantNodes().OfType<TypeParameterSyntax>().ToArray(); var symbol = model.GetDeclaredSymbol(typeParameters[typeParameters.Length - 1]); Assert.False(symbol.IsReferenceType); symbol = model.GetDeclaredSymbol(typeParameters[typeParameters.Length - 2]); Assert.True(symbol.IsReferenceType); } } }
{ "content_hash": "26de9bcd83e8b57185d5f44db954216f", "timestamp": "", "source": "github", "line_count": 6050, "max_line_length": 293, "avg_line_length": 35.70595041322314, "alnum_prop": 0.6122599191745247, "repo_name": "genlu/roslyn", "id": "43311037e05e86c76344f64089960784bec4e8cf", "size": "216025", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/Compilers/CSharp/Test/Symbol/Compilation/GetSemanticInfoTests.cs", "mode": "33188", "license": "mit", "language": [ { "name": "1C Enterprise", "bytes": "257760" }, { "name": "Batchfile", "bytes": "9059" }, { "name": "C#", "bytes": "139228314" }, { "name": "C++", "bytes": "5602" }, { "name": "CMake", "bytes": "9153" }, { "name": "Dockerfile", "bytes": "2450" }, { "name": "F#", "bytes": "549" }, { "name": "PowerShell", "bytes": "242675" }, { "name": "Shell", "bytes": "92965" }, { "name": "Visual Basic .NET", "bytes": "71735255" } ], "symlink_target": "" }
.class final Lo/nu; .super Lo/Λ; # annotations .annotation system Ldalvik/annotation/InnerClass; accessFlags = 0x8 name = null .end annotation .annotation system Ldalvik/annotation/Signature; value = { "Lo/\u039b<Lcom/google/android/gms/common/data/a;>;" } .end annotation # direct methods .method constructor <init>(Ljava/lang/String;Ljava/util/Collection;Ljava/util/Collection;I)V .locals 0 invoke-direct {p0, p1, p2, p3, p4}, Lo/Λ;-><init>(Ljava/lang/String;Ljava/util/Collection;Ljava/util/Collection;I)V return-void .end method # virtual methods .method protected synthetic ˎ(Lcom/google/android/gms/common/data/DataHolder;II)Ljava/lang/Object; .locals 1 invoke-virtual {p0, p1, p2, p3}, Lo/nu;->ˏ(Lcom/google/android/gms/common/data/DataHolder;II)Lcom/google/android/gms/common/data/a; move-result-object v0 return-object v0 .end method .method protected ˏ(Lcom/google/android/gms/common/data/DataHolder;II)Lcom/google/android/gms/common/data/a; .locals 2 new-instance v0, Ljava/lang/IllegalStateException; const-string v1, "Thumbnail field is write only" invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V throw v0 .end method
{ "content_hash": "f571d585da6c7a8377f2e91bc17f5a39", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 135, "avg_line_length": 25.693877551020407, "alnum_prop": 0.7227958697378872, "repo_name": "gelldur/jak_oni_to_robia_prezentacja", "id": "352330ee256f53b9a21d5e6ff401c5aeb914661c", "size": "1264", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Starbucks/output/smali/o/nu.smali", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "8427" }, { "name": "Shell", "bytes": "2303" }, { "name": "Smali", "bytes": "57557982" } ], "symlink_target": "" }
/* * Do not modify this file. This file is generated from the ec2-2014-10-01.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.EC2.Model { /// <summary> /// Describes the volume status. /// </summary> public partial class VolumeStatusItem { private List<VolumeStatusAction> _actions = new List<VolumeStatusAction>(); private string _availabilityZone; private List<VolumeStatusEvent> _events = new List<VolumeStatusEvent>(); private string _volumeId; private VolumeStatusInfo _volumeStatus; /// <summary> /// Gets and sets the property Actions. /// <para> /// The details of the operation. /// </para> /// </summary> public List<VolumeStatusAction> Actions { get { return this._actions; } set { this._actions = value; } } // Check to see if Actions property is set internal bool IsSetActions() { return this._actions != null && this._actions.Count > 0; } /// <summary> /// Gets and sets the property AvailabilityZone. /// <para> /// The Availability Zone of the volume. /// </para> /// </summary> public string AvailabilityZone { get { return this._availabilityZone; } set { this._availabilityZone = value; } } // Check to see if AvailabilityZone property is set internal bool IsSetAvailabilityZone() { return this._availabilityZone != null; } /// <summary> /// Gets and sets the property Events. /// <para> /// A list of events associated with the volume. /// </para> /// </summary> public List<VolumeStatusEvent> Events { get { return this._events; } set { this._events = value; } } // Check to see if Events property is set internal bool IsSetEvents() { return this._events != null && this._events.Count > 0; } /// <summary> /// Gets and sets the property VolumeId. /// <para> /// The volume ID. /// </para> /// </summary> public string VolumeId { get { return this._volumeId; } set { this._volumeId = value; } } // Check to see if VolumeId property is set internal bool IsSetVolumeId() { return this._volumeId != null; } /// <summary> /// Gets and sets the property VolumeStatus. /// <para> /// The volume status. /// </para> /// </summary> public VolumeStatusInfo VolumeStatus { get { return this._volumeStatus; } set { this._volumeStatus = value; } } // Check to see if VolumeStatus property is set internal bool IsSetVolumeStatus() { return this._volumeStatus != null; } } }
{ "content_hash": "f3f3e8720528b3a7ff35dd57683b0e74", "timestamp": "", "source": "github", "line_count": 119, "max_line_length": 101, "avg_line_length": 27.176470588235293, "alnum_prop": 0.536178107606679, "repo_name": "ykbarros/aws-sdk-xamarin", "id": "6c6877a454e8bcb8fe56f0372dfde8df09bc1719", "size": "3821", "binary": false, "copies": "10", "ref": "refs/heads/master", "path": "AWS.XamarinSDK/AWSSDK_iOS/Amazon.EC2/Model/VolumeStatusItem.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "70640975" }, { "name": "PowerShell", "bytes": "3661" } ], "symlink_target": "" }
package org.elasticsearch.xpack.ml.dataframe.process; import org.elasticsearch.common.Strings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.core.ml.dataframe.analyses.Classification; import org.elasticsearch.xpack.core.ml.dataframe.analyses.DataFrameAnalysis; import org.elasticsearch.xpack.core.ml.dataframe.analyses.OutlierDetection; import org.elasticsearch.xpack.core.ml.dataframe.analyses.Regression; import org.elasticsearch.xpack.ml.extractor.DocValueField; import org.elasticsearch.xpack.ml.extractor.ExtractedFields; import org.junit.Before; import java.io.IOException; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.hasKey; public class AnalyticsProcessConfigTests extends ESTestCase { private String jobId; private long rows; private int cols; private ByteSizeValue memoryLimit; private int threads; private String resultsField; private Set<String> categoricalFields; @Before public void setUpConfigParams() { jobId = randomAlphaOfLength(10); rows = randomNonNegativeLong(); cols = randomIntBetween(1, 42000); memoryLimit = new ByteSizeValue(randomNonNegativeLong(), ByteSizeUnit.BYTES); threads = randomIntBetween(1, 8); resultsField = randomAlphaOfLength(10); int categoricalFieldsSize = randomIntBetween(0, 5); categoricalFields = new HashSet<>(); for (int i = 0; i < categoricalFieldsSize; i++) { categoricalFields.add(randomAlphaOfLength(10)); } } @SuppressWarnings("unchecked") public void testToXContent_GivenOutlierDetection() throws IOException { ExtractedFields extractedFields = new ExtractedFields(Arrays.asList( new DocValueField("field_1", Collections.singleton("double")), new DocValueField("field_2", Collections.singleton("float"))), Collections.emptyMap()); DataFrameAnalysis analysis = new OutlierDetection.Builder().build(); AnalyticsProcessConfig processConfig = createProcessConfig(analysis, extractedFields); Map<String, Object> asMap = toMap(processConfig); assertRandomizedFields(asMap); assertThat(asMap, hasKey("analysis")); Map<String, Object> analysisAsMap = (Map<String, Object>) asMap.get("analysis"); assertThat(analysisAsMap, hasEntry("name", "outlier_detection")); assertThat(analysisAsMap, hasKey("parameters")); } @SuppressWarnings("unchecked") public void testToXContent_GivenRegression() throws IOException { ExtractedFields extractedFields = new ExtractedFields(Arrays.asList( new DocValueField("field_1", Collections.singleton("double")), new DocValueField("field_2", Collections.singleton("float")), new DocValueField("test_dep_var", Collections.singleton("keyword"))), Collections.emptyMap()); DataFrameAnalysis analysis = new Regression("test_dep_var"); AnalyticsProcessConfig processConfig = createProcessConfig(analysis, extractedFields); Map<String, Object> asMap = toMap(processConfig); assertRandomizedFields(asMap); assertThat(asMap, hasKey("analysis")); Map<String, Object> analysisAsMap = (Map<String, Object>) asMap.get("analysis"); assertThat(analysisAsMap, hasEntry("name", "regression")); assertThat(analysisAsMap, hasKey("parameters")); Map<String, Object> paramsAsMap = (Map<String, Object>) analysisAsMap.get("parameters"); assertThat(paramsAsMap, hasEntry("dependent_variable", "test_dep_var")); } @SuppressWarnings("unchecked") public void testToXContent_GivenClassificationAndDepVarIsKeyword() throws IOException { ExtractedFields extractedFields = new ExtractedFields(Arrays.asList( new DocValueField("field_1", Collections.singleton("double")), new DocValueField("field_2", Collections.singleton("float")), new DocValueField("test_dep_var", Collections.singleton("keyword"))), Collections.singletonMap("test_dep_var", 5L)); DataFrameAnalysis analysis = new Classification("test_dep_var"); AnalyticsProcessConfig processConfig = createProcessConfig(analysis, extractedFields); Map<String, Object> asMap = toMap(processConfig); assertRandomizedFields(asMap); assertThat(asMap, hasKey("analysis")); Map<String, Object> analysisAsMap = (Map<String, Object>) asMap.get("analysis"); assertThat(analysisAsMap, hasEntry("name", "classification")); assertThat(analysisAsMap, hasKey("parameters")); Map<String, Object> paramsAsMap = (Map<String, Object>) analysisAsMap.get("parameters"); assertThat(paramsAsMap, hasEntry("dependent_variable", "test_dep_var")); assertThat(paramsAsMap, hasEntry("prediction_field_type", "string")); assertThat(paramsAsMap, hasEntry("num_classes", 5)); } @SuppressWarnings("unchecked") public void testToXContent_GivenClassificationAndDepVarIsInteger() throws IOException { ExtractedFields extractedFields = new ExtractedFields(Arrays.asList( new DocValueField("field_1", Collections.singleton("double")), new DocValueField("field_2", Collections.singleton("float")), new DocValueField("test_dep_var", Collections.singleton("integer"))), Collections.singletonMap("test_dep_var", 8L)); DataFrameAnalysis analysis = new Classification("test_dep_var"); AnalyticsProcessConfig processConfig = createProcessConfig(analysis, extractedFields); Map<String, Object> asMap = toMap(processConfig); assertRandomizedFields(asMap); assertThat(asMap, hasKey("analysis")); Map<String, Object> analysisAsMap = (Map<String, Object>) asMap.get("analysis"); assertThat(analysisAsMap, hasEntry("name", "classification")); assertThat(analysisAsMap, hasKey("parameters")); Map<String, Object> paramsAsMap = (Map<String, Object>) analysisAsMap.get("parameters"); assertThat(paramsAsMap, hasEntry("dependent_variable", "test_dep_var")); assertThat(paramsAsMap, hasEntry("prediction_field_type", "int")); assertThat(paramsAsMap, hasEntry("num_classes", 8)); } private AnalyticsProcessConfig createProcessConfig(DataFrameAnalysis analysis, ExtractedFields extractedFields) { return new AnalyticsProcessConfig(jobId, rows, cols, memoryLimit, threads, resultsField, categoricalFields, analysis, extractedFields); } private static Map<String, Object> toMap(AnalyticsProcessConfig config) throws IOException { try (XContentBuilder builder = JsonXContent.contentBuilder()) { config.toXContent(builder, ToXContent.EMPTY_PARAMS); return XContentHelper.convertToMap(JsonXContent.jsonXContent, Strings.toString(builder), false); } } @SuppressWarnings("unchecked") private void assertRandomizedFields(Map<String, Object> configAsMap) { assertThat(configAsMap, hasEntry("job_id", jobId)); assertThat(configAsMap, hasEntry("rows", rows)); assertThat(configAsMap, hasEntry("cols", cols)); assertThat(configAsMap, hasEntry("memory_limit", memoryLimit.getBytes())); assertThat(configAsMap, hasEntry("threads", threads)); assertThat(configAsMap, hasEntry("results_field", resultsField)); assertThat(configAsMap, hasKey("categorical_fields")); assertThat((List<String>) configAsMap.get("categorical_fields"), containsInAnyOrder(categoricalFields.toArray())); } }
{ "content_hash": "68297fbb225b2bd1b24071700d1710d8", "timestamp": "", "source": "github", "line_count": 166, "max_line_length": 128, "avg_line_length": 49.22289156626506, "alnum_prop": 0.7207196181617918, "repo_name": "uschindler/elasticsearch", "id": "a4db8de032af52c32e9c7eb41f83fc8fd18b744c", "size": "8412", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/dataframe/process/AnalyticsProcessConfigTests.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "11082" }, { "name": "Batchfile", "bytes": "11226" }, { "name": "Emacs Lisp", "bytes": "3341" }, { "name": "FreeMarker", "bytes": "45" }, { "name": "Groovy", "bytes": "399054" }, { "name": "HTML", "bytes": "2186" }, { "name": "Java", "bytes": "46161265" }, { "name": "Perl", "bytes": "12007" }, { "name": "Python", "bytes": "19852" }, { "name": "Shell", "bytes": "105144" } ], "symlink_target": "" }
package org.usfirst.frc.team948.robot.utilities; public class MathHelper { /** * Case 1: IF the input is greater than the max value, the max is returned * Case 2: If the input is within the range, the input is returned Case 3: * IF the input is less than the min value, then the min is returned * * @param input * @param min * @param max * @return */ public static double clamp(double input, double min, double max) { if (input < min) return min; if (input > max) return max; return input; } /** * Takes the voltage value from the potentiometer, then converts it into a * value on a scale of 0.0 to 1.0 (basically the percent to the max * potentiometer value / 100) * * @param input * @param min * @param max * @return */ public static double normalize(double input, double min, double max) { double sliderValue = clamp(input, min, max); return (sliderValue - min) / (max - min); } /** * This method takes the return value of the original normalize method, and * then subtracts it from 1, to reverse the scale (useful for a physically * flipped potentiometer orientation) * * @param input * @param min * @param max * @return */ public static double reverseNormalize(double input, double min, double max) { return 1.0 - normalize(input, min, max); } public static double normalizeAngle(double angle) { double a = angle % 360; if (a < 0) { a += 360; } return a; } /** * Converts gyro heading into a trigonometry angle in degrees. * * @param heading * heading from the gyro. * @return trigonometry angle in degrees. */ public static double headingToDegrees(double heading) { return 90.0 - heading; } /** * Takes in two values and returns which one is max * * @param x * @param y * @return */ public static double max(double x, double y) { if (x > y) { return x; } return y; } /** * Convert a heading into an equivalent heading which is within 180 degrees * of the gyroHeading. * * @param heading * The heading of which we're trying to find an equivalent that * is close to gyroHeading. * @param gyroHeading * The current value of the gyro. * @return heading+n*360 where n is chosen such that the result is within * 180 degrees of gyroHeading. */ public static double nearestEquivalentHeading(double heading, double gyroHeading) { double deltaAngle = (heading - gyroHeading) % 360; if (deltaAngle > 180) { deltaAngle -= 360; } else if (deltaAngle <= -180) { deltaAngle += 360; } return gyroHeading + deltaAngle; } public static double angleToXY(double initialX, double initialY, double finalX, double finalY) { double dX = finalX - initialX; double dY = finalY - initialY; return Math.toDegrees(Math.atan2(dY, dX)); } public static double roundTo(int nearest, double input) { return (Math.round(input * Math.pow(10, nearest)) / Math.pow(10, nearest)); } }
{ "content_hash": "d058c46444cd01bee90f88baa9021642", "timestamp": "", "source": "github", "line_count": 116, "max_line_length": 78, "avg_line_length": 25.939655172413794, "alnum_prop": 0.6596876038551014, "repo_name": "majesticfish/nrgrobot2015", "id": "b07d4683baa182bd206597aa325cbdc07de32c18", "size": "3009", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/org/usfirst/frc/team948/robot/utilities/MathHelper.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Java", "bytes": "107625" } ], "symlink_target": "" }
@interface LEOWebDAVPropertyRequest () { NSUInteger _depth; } @end @implementation LEOWebDAVPropertyRequest - (id)initWithPath:(NSString *)aPath { self = [super initWithPath:aPath]; if (self) { _depth = 1; } return self; } -(NSURLRequest *)request { NSMutableURLRequest *req=[self newRequestWithPath:self.path method:@"PROPFIND"]; // NSLog(@"request url=%@",req.URL); if (_depth>1) { [req setValue:@"infinity" forHTTPHeaderField:@"Depth"]; }else{ [req setValue:[NSString stringWithFormat:@"%d",_depth] forHTTPHeaderField:@"Depth"]; } [req setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"]; // [req setValue:nil forHTTPHeaderField:@"Content-Length"]; [req setValue:@"close" forHTTPHeaderField:@"Connection"]; [req setHTTPBody:[self generateBody]]; return req; } -(id)resultForData:(NSData *)data { // NSString *string=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; // NSLog(@"string:%@",string); LEOWebDAVParser *parser=[[LEOWebDAVParser alloc] initWithData:data]; NSError *error = nil; NSArray *items = [parser parse:&error]; if (error) { #ifdef DEBUG NSLog(@"XML Parse error: %@", error); #endif } // 不显示隐藏文件 NSMutableArray *result=[NSMutableArray array]; for (LEOWebDAVItem *item in items) { if (![item.displayName hasPrefix:@"."]) { [item setRootURL:self.rootURL]; // NSLog(@"path:%@, rel:%@",self.path,item.relativeHref); // NSLog(@"type:%@",item.contentType); if (![item.relativeHref isEqualToString:self.relativePath]) { [result addObject:item]; } } } return result; } #pragma mark - Private method -(NSData *)generateBody{ NSMutableString* o = [NSMutableString string]; [o appendString:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"]; [o appendString:@"<D:propfind xmlns:D=\"DAV:\">\n"]; // [o appendString:@"<D:propfind>\n"]; [o appendString:@" <D:prop>"]; [o appendString:@" <D:resourcetype/>\n"]; if((kWebDAVProperty & LEOWebDAVPropertyCreationDate) == LEOWebDAVPropertyCreationDate) { [o appendString:@" <D:creationdate/>\n"]; } if((kWebDAVProperty & LEOWebDAVPropertyLastModifiedDate) == LEOWebDAVPropertyLastModifiedDate) { [o appendString:@" <D:getlastmodified/>\n"]; } if((kWebDAVProperty & LEOWebDAVPropertyDisplayName) == LEOWebDAVPropertyDisplayName) { [o appendString:@" <D:displayname/>\n"]; } if((kWebDAVProperty & LEOWebDAVPropertyContentLength) == LEOWebDAVPropertyContentLength) { [o appendString:@" <D:getcontentlength/>\n"]; } if((kWebDAVProperty & LEOWebDAVPropertyContentType) == LEOWebDAVPropertyContentType) { [o appendString:@" <D:getcontenttype/>\n"]; } if((kWebDAVProperty & LEOWebDAVPropertyLockDiscovery) == LEOWebDAVPropertyLockDiscovery) { [o appendString:@" <D:lockdiscovery/>\n"]; } if((kWebDAVProperty & LEOWebDAVPropertySupportedLock) == LEOWebDAVPropertySupportedLock) { [o appendString:@" <D:supportedlock/>\n"]; } [o appendString:@" </D:prop>"]; [o appendString:@"</D:propfind>"]; return [o dataUsingEncoding:NSUTF8StringEncoding]; } @end
{ "content_hash": "c77b2ed04f25182850b8ab8e8b71eb19", "timestamp": "", "source": "github", "line_count": 104, "max_line_length": 97, "avg_line_length": 30.807692307692307, "alnum_prop": 0.6644818976279651, "repo_name": "Kalp695/leowebdav", "id": "414a5b9916bf5b7f398791d4528c4cff0bab1bbb", "size": "3482", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "LEOWebDAV/LEOWebDAVPropertyRequest.m", "mode": "33261", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "82796" } ], "symlink_target": "" }
// ReSharper disable once CheckNamespace namespace Fluent { using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using Fluent.Extensions; using Fluent.Internal; using Fluent.Internal.KnownBoxes; /// <summary> /// Represents contextual tab group /// </summary> public class RibbonContextualTabGroup : Control { #region Properties /// <summary> /// Gets or sets group header /// </summary> public string Header { get { return (string)this.GetValue(HeaderProperty); } set { this.SetValue(HeaderProperty, value); } } /// <summary> /// Using a DependencyProperty as the backing store for Header. /// This enables animation, styling, binding, etc... /// </summary> public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(nameof(Header), typeof(string), typeof(RibbonContextualTabGroup), new PropertyMetadata("RibbonContextualTabGroup", OnHeaderChanged)); /// <summary> /// Handles header chages /// </summary> /// <param name="d">Object</param> /// <param name="e">The event data.</param> private static void OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { } /// <summary> /// Gets collection of tab items /// </summary> public List<RibbonTabItem> Items { get; } = new List<RibbonTabItem>(); /// <summary> /// Gets or sets the visibility this group for internal use (this enables us to hide this group when all items in this group are hidden) /// </summary> public Visibility InnerVisibility { get { return (Visibility)this.GetValue(InnerVisibilityProperty); } private set { this.SetValue(InnerVisibilityPropertyKey, value); } } private static readonly DependencyPropertyKey InnerVisibilityPropertyKey = DependencyProperty.RegisterReadOnly(nameof(InnerVisibility), typeof(Visibility), typeof(RibbonContextualTabGroup), new PropertyMetadata(VisibilityBoxes.Visible, OnInnerVisibilityChanged)); /// <summary> /// Using a DependencyProperty as the backing store for InnerVisibility. This enables animation, styling, binding, etc... /// </summary> public static readonly DependencyProperty InnerVisibilityProperty = InnerVisibilityPropertyKey.DependencyProperty; private static void OnInnerVisibilityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var contextGroup = (RibbonContextualTabGroup)d; ForceRedraw(contextGroup); } /// <summary> /// Gets the first visible TabItem in this group /// </summary> public RibbonTabItem FirstVisibleItem => this.GetFirstVisibleItem(); /// <summary> /// Gets the first visible TabItem in this group /// </summary> public RibbonTabItem FirstVisibleAndEnabledItem => this.GetFirstVisibleAndEnabledItem(); /// <summary> /// Gets the last visible TabItem in this group /// </summary> public RibbonTabItem LastVisibleItem => this.GetLastVisibleItem(); #endregion #region Initialization /// <summary> /// Static constructor /// </summary> static RibbonContextualTabGroup() { DefaultStyleKeyProperty.OverrideMetadata(typeof(RibbonContextualTabGroup), new FrameworkPropertyMetadata(typeof(RibbonContextualTabGroup))); VisibilityProperty.OverrideMetadata(typeof(RibbonContextualTabGroup), new PropertyMetadata(VisibilityBoxes.Collapsed, OnVisibilityChanged)); } /// <summary> /// Handles visibility prioperty changed /// </summary> /// <param name="d">Object</param> /// <param name="e">The event data</param> private static void OnVisibilityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var group = (RibbonContextualTabGroup)d; group.UpdateInnerVisiblityAndGroupBorders(); ForceRedraw(group); } /// <summary> /// Default constructor /// </summary> public RibbonContextualTabGroup() { this.Loaded += this.OnLoaded; this.Unloaded += this.OnUnloaded; } private void OnLoaded(object sender, RoutedEventArgs e) { this.SubscribeEvents(); this.UpdateInnerVisibility(); } private void OnUnloaded(object sender, RoutedEventArgs e) { this.UnSubscribeEvents(); } private void SubscribeEvents() { // Always unsubscribe events to ensure we don't subscribe twice this.UnSubscribeEvents(); } private void UnSubscribeEvents() { } #endregion #region Internal Methods /// <summary> /// Appends tab item /// </summary> /// <param name="item">Ribbon tab item</param> internal void AppendTabItem(RibbonTabItem item) { this.Items.Add(item); this.UpdateInnerVisiblityAndGroupBorders(); } /// <summary> /// Removes tab item /// </summary> /// <param name="item">Ribbon tab item</param> internal void RemoveTabItem(RibbonTabItem item) { this.Items.Remove(item); this.UpdateInnerVisiblityAndGroupBorders(); } private RibbonTabItem GetFirstVisibleItem() { return this.Items.FirstOrDefault(item => item.Visibility == Visibility.Visible); } private RibbonTabItem GetLastVisibleItem() { return this.Items.LastOrDefault(item => item.Visibility == Visibility.Visible); } private RibbonTabItem GetFirstVisibleAndEnabledItem() { return this.Items.FirstOrDefault(item => item.Visibility == Visibility.Visible && item.IsEnabled); } /// <summary> /// Updates the group border /// </summary> public void UpdateInnerVisiblityAndGroupBorders() { this.UpdateInnerVisibility(); var leftset = false; var rightset = false; for (var i = 0; i < this.Items.Count; i++) { //if (i == 0) items[i].HasLeftGroupBorder = true; //else items[i].HasLeftGroupBorder = false; //if (i == items.Count - 1) items[i].HasRightGroupBorder = true; //else items[i].HasRightGroupBorder = false; //Workaround so you can have inivisible Tabs on a Group if (this.Items[i].Visibility == Visibility.Visible && leftset == false) { this.Items[i].HasLeftGroupBorder = true; leftset = true; } else { this.Items[i].HasLeftGroupBorder = false; } if (this.Items[this.Items.Count - 1 - i].Visibility == Visibility.Visible && rightset == false) { this.Items[this.Items.Count - 1 - i].HasRightGroupBorder = true; rightset = true; } else { this.Items[this.Items.Count - 1 - i].HasRightGroupBorder = false; } } } #endregion #region Override /// <inheritdoc /> protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) { var firstVisibleItem = this.FirstVisibleAndEnabledItem; if (e.ClickCount == 1 && firstVisibleItem != null) { var currentSelectedItem = firstVisibleItem.TabControlParent?.SelectedItem as RibbonTabItem; if (currentSelectedItem != null) { currentSelectedItem.IsSelected = false; } e.Handled = true; if (firstVisibleItem.TabControlParent != null) { if (firstVisibleItem.TabControlParent.IsMinimized) { firstVisibleItem.TabControlParent.IsMinimized = false; } firstVisibleItem.IsSelected = true; } } base.OnMouseLeftButtonUp(e); } #endregion /// <summary> /// Updates the Visibility of the inner container /// </summary> private void UpdateInnerVisibility() { this.InnerVisibility = this.Visibility == Visibility.Visible && this.Items.Any(item => item.Visibility == Visibility.Visible) ? Visibility.Visible : Visibility.Collapsed; } private static void ForceRedraw(RibbonContextualTabGroup contextGroup) { contextGroup.ForceMeasure(); var ribbonTitleBar = UIHelper.GetParent<RibbonTitleBar>(contextGroup); ribbonTitleBar?.ForceMeasureAndArrange(); } } }
{ "content_hash": "8412354e78f92efaa804cbe48fe31882", "timestamp": "", "source": "github", "line_count": 284, "max_line_length": 200, "avg_line_length": 33.443661971830984, "alnum_prop": 0.576753000631712, "repo_name": "Cubey2019/Fluent.Ribbon", "id": "a83684db52a12fa7cca402007b20de6584af7e5d", "size": "9500", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "Fluent.Ribbon/Controls/RibbonContextualTabGroup.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "1339054" }, { "name": "FLUX", "bytes": "1308" }, { "name": "PowerShell", "bytes": "4283" } ], "symlink_target": "" }
<html><head><title>Inca::Reporter::Version</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" > <link rel="stylesheet" title="black with blue on white" type="text/css" href="../../_black_with_blue_on_white.css" media="all" > <link rel="alternate stylesheet" title="black with magenta on white" type="text/css" href="../../_black_with_magenta_on_white.css" media="all" > <link rel="alternate stylesheet" title="black with cyan on white" type="text/css" href="../../_black_with_cyan_on_white.css" media="all" > <link rel="alternate stylesheet" title="white with purple on black" type="text/css" href="../../_white_with_purple_on_black.css" media="all" > <link rel="alternate stylesheet" title="white with navy blue on black" type="text/css" href="../../_white_with_navy_blue_on_black.css" media="all" > <link rel="alternate stylesheet" title="grey with green on black" type="text/css" href="../../_grey_with_green_on_black.css" media="all" > <link rel="alternate stylesheet" title="white with green on grey" type="text/css" href="../../_white_with_green_on_grey.css" media="all" > <link rel="alternate stylesheet" title="black with green on grey" type="text/css" href="../../_black_with_green_on_grey.css" media="all" > <link rel="alternate stylesheet" title="grey with green on white" type="text/css" href="../../_grey_with_green_on_white.css" media="all" > <link rel="alternate stylesheet" title="indexless black with blue on white" type="text/css" href="../../_indexless_black_with_blue_on_white.css" media="all" > <link rel="alternate stylesheet" title="indexless white with purple on black" type="text/css" href="../../_indexless_white_with_purple_on_black.css" media="all" > <link rel="alternate stylesheet" title="indexless white with green on grey" type="text/css" href="../../_indexless_white_with_green_on_grey.css" media="all" > <link rel="alternate stylesheet" title="indexless grey with green on white" type="text/css" href="../../_indexless_grey_with_green_on_white.css" media="all" > <script type="text/javascript" src="../../_podly.js"></script> </head> <body class='pod'> <!-- generated by Pod::Simple::HTML v3.03, using Pod::Simple::PullParser v2.02, under Perl v5.008005 at Sat Mar 24 22:17:15 2007 GMT. If you want to change this HTML document, you probably shouldn't do that by changing it directly. Instead, see about changing the calling options to Pod::Simple::HTML, and/or subclassing Pod::Simple::HTML, then reconverting this document from the Pod source. When in doubt, email the author of Pod::Simple::HTML for advice. See 'perldoc Pod::Simple::HTML' for more info. --> <!-- start doc --> <p class="backlinktop"><b><a name="___top" href="../../index.html" accesskey="1" title="All Documents">&lt;&lt;</a></b></p> <div class='indexgroup'> <ul class='indexList indexList1'> <li class='indexItem indexItem1'><a href='#NAME'>NAME</a> <li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a> <li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a> <li class='indexItem indexItem1'><a href='#CLASS_METHODS'>CLASS METHODS</a> <ul class='indexList indexList2'> <li class='indexItem indexItem2'><a href='#new'>new</a> <li class='indexItem indexItem2'><a href='#getPackageName'>getPackageName</a> <li class='indexItem indexItem2'><a href='#getPackageVersion'>getPackageVersion</a> <li class='indexItem indexItem2'><a href='#getSubpackageNames'>getSubpackageNames</a> <li class='indexItem indexItem2'><a href='#getSubpackageVersion(%24name)'>getSubpackageVersion($name)</a> <li class='indexItem indexItem2'><a href='#reportBody'>reportBody</a> <li class='indexItem indexItem2'><a href='#setPackageName(%24packageName)'>setPackageName($packageName)</a> <li class='indexItem indexItem2'><a href='#setPackageVersion(%24version)'>setPackageVersion($version)</a> <li class='indexItem indexItem2'><a href='#setSubpackageVersion(%24name%2C_%24version)'>setSubpackageVersion($name, $version)</a> <li class='indexItem indexItem2'><a href='#setVersionByCompiledProgramOutput(%25attrs)'>setVersionByCompiledProgramOutput(%attrs)</a> <li class='indexItem indexItem2'><a href='#setVersionByExecutable(%24command%2C_%24pattern%2C_%24timeout)'>setVersionByExecutable($command, $pattern, $timeout)</a> <li class='indexItem indexItem2'><a href='#setVersionByFileContents(%24path%2C_%24pattern)'>setVersionByFileContents($path, $pattern)</a> <li class='indexItem indexItem2'><a href='#setVersionByGptQuery(%40prefixes)'>setVersionByGptQuery(@prefixes)</a> <li class='indexItem indexItem2'><a href='#setVersionByRpmQuery(%24pattern)'>setVersionByRpmQuery($pattern)</a> </ul> <li class='indexItem indexItem1'><a href='#EXAMPLES'>EXAMPLES</a> <li class='indexItem indexItem1'><a href='#AUTHOR'>AUTHOR</a> <li class='indexItem indexItem1'><a href='#SEE_ALSO'>SEE ALSO</a> </ul> </div> <h1><a class='u' href='#___top' title='click to go to top of document' name="NAME" >NAME</a></h1> <p>Inca::Reporter::Version - Convenience module for creating version reporters</p> <h1><a class='u' href='#___top' title='click to go to top of document' name="SYNOPSIS" >SYNOPSIS</a></h1> <pre> use Inca::Reporter::Version; my $reporter = new Inca::Reporter::Version(); my $command = &#39;somecommand -version&#39;; my $pattern = &#39;^version &#34;(.*)&#34;&#39;; ... $reporter-&#62;setPackageName(&#39;packageX&#39;); $reporter-&#62;setVersionByExecutable($command, $pattern); $reporter-&#62;print();</pre> <p>or</p> <pre> $reporter-&#62;setVersionByGptQuery(&#39;packageX&#39;);</pre> <p>or</p> <pre> $reporter-&#62;setVersionByRpmQuery(&#39;packageX&#39;);</pre> <p>or</p> <pre> $reporter-&#62;setPackageVersion(&#39;x.x.x&#39;);</pre> <p>or</p> <pre> foreach my $subpackage(@subpackages) { $reporter-&#62;setSubpackageVersion($subpackage, $version); }</pre> <h1><a class='u' href='#___top' title='click to go to top of document' name="DESCRIPTION" >DESCRIPTION</a></h1> <p>This module is a subclass of Inca::Reporter which provides convenience methods for creating version reporters. A version reporter reports the version information for a package in the following schema (i.e., this is the body of the Inca report):</p> <pre> &#60;packageVersion&#62; &#60;ID&#62;packageX&#60;/ID&#62; &#60;version&#62;x.x.x&#60;/version&#62; &#60;/packageVersion&#62;</pre> <p>or</p> <pre> &#60;packageVersion&#62; &#60;ID&#62;packageX&#60;/ID&#62; &#60;subpackage&#62; &#60;ID&#62;subpackageX&#60;/ID&#62; &#60;version&#62;x.x.x&#60;/version&#62; &#60;/subpackage&#62; &#60;subpackage&#62; &#60;ID&#62;subpackageY&#60;/ID&#62; &#60;version&#62;x.x.x&#60;/version&#62; &#60;/subpackage&#62; &#60;/packageVersion&#62;</pre> <p>Version information can be set using one of the basic methods setPackageVersion (for the first example) or setSubpackageVersion (for the second). In this case, the user retrieves a package&#39;s version information directly and uses one of these two methods to report it. This module also provides convenience methods that retrieve a package version using conventional methods of querying version information.</p> <h1><a class='u' href='#___top' title='click to go to top of document' name="CLASS_METHODS" >CLASS METHODS</a></h1> <h2><a class='u' href='#___top' title='click to go to top of document' name="new" >new</a></h2> <p>Class constructor which returns a new Inca::Reporter::Version object. The constructor supports the following parameters in addition to those supported by <a href="../../Inca/Reporter.html" class="podlinkpod" >Inca::Reporter</a>.</p> <dl> <dt><a name="package_name" >package_name</a></dt> <dd> <p>the name of the package for which a version is being determined; default &#39;&#39;.</p> <dt><a name="package_version" >package_version</a></dt> <dd> <p>the version of the package.</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="getPackageName" >getPackageName</a></h2> <p>Returns the name of the package</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="getPackageVersion" >getPackageVersion</a></h2> <p>Returns the version of the package</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="getSubpackageNames" >getSubpackageNames</a></h2> <p>Returns an array of all the names of all subpackages with a set version</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="getSubpackageVersion($name)" >getSubpackageVersion($name)</a></h2> <p>Returns the version of subpackage $name</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="reportBody" >reportBody</a></h2> <p>Constructs and returns the body of the reporter.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="setPackageName($packageName)" >setPackageName($packageName)</a></h2> <p>Set the name of the package.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="setPackageVersion($version)" >setPackageVersion($version)</a></h2> <p>Report the version of a package as $version.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="setSubpackageVersion($name,_$version)" >setSubpackageVersion($name, $version)</a></h2> <p>Report the version of subpackage $name as $version.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="setVersionByCompiledProgramOutput(%attrs)" >setVersionByCompiledProgramOutput(%attrs)</a></h2> <p>Retrieve the package version by compiling and running a program and matching its output against a pattern. Returns 1 if successful, else 0. The function recognizes the following parameter in addition to those supported by the compiledProgramOutput method of <a href="../../Inca/Reporter.html" class="podlinkpod" >Inca::Reporter</a>: parameters:</p> <dl> <dt><a name="pattern" >pattern</a></dt> <dd> <p>pattern to search for in program output; default &#39;(.+)&#39;</p> </dd> </dl> <h2><a class='u' href='#___top' title='click to go to top of document' name="setVersionByExecutable($command,_$pattern,_$timeout)" >setVersionByExecutable($command, $pattern, $timeout)</a></h2> <p>Retrieve package version information by executing $command and greping the output for $pattern. $command is the executable and argument string to retrieve the version (e.g., command_name -version) and $pattern is a pattern containing one grouping (i.e., memory parentheses) to retrieve the version from the output. $pattern defaults to &#39;([\d\.]+)&#39; if not specified. Fails if $timeout is specified and $command does not complete within $timeout seconds. Returns 1 if successful, else 0.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="setVersionByFileContents($path,_$pattern)" >setVersionByFileContents($path, $pattern)</a></h2> <p>Retrieve the package version by grep&#39;ing the file $path for $pattern. $pattern defaults to &#39;([\d\.]+)&#39; if not specified. Returns 1 if successful, else 0.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="setVersionByGptQuery(@prefixes)" >setVersionByGptQuery(@prefixes)</a></h2> <p>Set subpackage version information by querying GPT for packages prefixed with any element of @prefixes. Returns 1 if successful, else 0.</p> <h2><a class='u' href='#___top' title='click to go to top of document' name="setVersionByRpmQuery($pattern)" >setVersionByRpmQuery($pattern)</a></h2> <p>Set subpackage version information by querying GPT for packages that contain the regular expression $pattern. Returns 1 if successful, else 0.</p> <h1><a class='u' href='#___top' title='click to go to top of document' name="EXAMPLES" >EXAMPLES</a></h1> <p>The following example demonstrates the usage of setVersionByGptQuery:</p> <pre> my $reporter = new Inca::Reporter::Version( name =&#62; &#39;grid.middleware.globus.version&#39;, version =&#62; 1.25, description =&#62; &#39;Reports globus package versions&#39;, url =&#62; &#39;http://www.globus.org&#39;, package_name =&#62; &#39;globus&#39; ); $reporter-&#62;processArgv(@ARGV); $reporter-&#62;setVersionByGptQuery(&#39;globus&#39;); $reporter-&#62;print();</pre> <p>The following example demonstrates the usage of setVersionByRpmQuery:</p> <pre> my $reporter = new Inca::Reporter::Version( name =&#62; &#39;cluster.compiler.gcc.version&#39;, version =&#62; 1.25, description =&#62; &#39;Reports the version of gcc&#39;, url =&#62; &#39;http://gcc.gnu.org&#39;, package_name =&#62; &#39;gcc&#39; ); $reporter-&#62;processArgv(@ARGV); $reporter-&#62;setVersionByRpmQuery(&#39;gcc&#39;); $reporter-&#62;print();</pre> <p>The following example demonstrates the usage of setVersionByExecutable:</p> <pre> my $command = &#34;java -version&#34;; my $pattern = &#39;^java version \&#34;(.*)\&#34;[.\n]*&#39;; my $reporter = new Inca::Reporter::Version( name =&#62; &#39;cluster.java.sun.version&#39;, version =&#62; 1.25, description =&#62; &#39;Reports the version of java in the user\&#39;s path&#39;, url =&#62; &#39;http://java.sun.com&#39;, package_name =&#62; &#39;java&#39; ); $reporter-&#62;processArgv(@ARGV); $reporter-&#62;setVersionByExecutable($command, $pattern); $reporter-&#62;print();</pre> <h1><a class='u' href='#___top' title='click to go to top of document' name="AUTHOR" >AUTHOR</a></h1> <p>Shava Smallen &#60;ssmallen@sdsc.edu&#62;</p> <h1><a class='u' href='#___top' title='click to go to top of document' name="SEE_ALSO" >SEE ALSO</a></h1> <p><a href="../../Inca/Reporter.html" class="podlinkpod" >Inca::Reporter</a></p> <p class="backlinkbottom"><b><a name="___bottom" href="../../index.html" title="All Documents">&lt;&lt;</a></b></p> <!-- end doc --> </body></html>
{ "content_hash": "3274c1c38fe61c4598f6979c3c9a04a7", "timestamp": "", "source": "github", "line_count": 305, "max_line_length": 500, "avg_line_length": 45.87540983606557, "alnum_prop": 0.6923956546598056, "repo_name": "IncaProject/IncaProject.github.io", "id": "ecd75506fbe9f124838a2ae2d340b876c813681d", "size": "13992", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "releases/2.01/perldocs/Inca/Reporter/Version.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1063094" }, { "name": "HTML", "bytes": "42399883" }, { "name": "JavaScript", "bytes": "130123" }, { "name": "Ruby", "bytes": "157" }, { "name": "Shell", "bytes": "117129" } ], "symlink_target": "" }