text
stringlengths
2
1.04M
meta
dict
package com.amazonaws.services.rds.model; import com.amazonaws.AmazonServiceException; /** * <p> * User already has a DB Instance with the given identifier. * </p> */ public class DBInstanceAlreadyExistsException extends AmazonServiceException { private static final long serialVersionUID = 1L; /** * Constructs a new DBInstanceAlreadyExistsException with the specified error * message. * * @param message Describes the error encountered. */ public DBInstanceAlreadyExistsException(String message) { super(message); } }
{ "content_hash": "56f056fe9f820991e6daf1d6736c14dd", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 81, "avg_line_length": 23.96, "alnum_prop": 0.6894824707846411, "repo_name": "apetresc/aws-sdk-for-java-on-gae", "id": "5845a068b8e220cdb17207b7981e36e6653f657a", "size": "1186", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/amazonaws/services/rds/model/DBInstanceAlreadyExistsException.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "10870469" } ], "symlink_target": "" }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Scoring { internal class TaikoScoreProcessor : ScoreProcessor { public override HitWindows CreateHitWindows() => new TaikoHitWindows(); } }
{ "content_hash": "7104ec38f1aa8fe53bcb02920e7189ca", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 79, "avg_line_length": 31.583333333333332, "alnum_prop": 0.7335092348284961, "repo_name": "johnneijzen/osu", "id": "003d40af56a9ac943215723aa37aeaf6ac5af3d6", "size": "381", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "6171154" }, { "name": "PowerShell", "bytes": "936" }, { "name": "Ruby", "bytes": "7906" } ], "symlink_target": "" }
package sound; /** * * @author Brian */ public interface Sound { public WAV getWAV(); public MIDI getMIDI(); }
{ "content_hash": "23f8cc34e74e1dc79795d6a9d7eebdaf", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 26, "avg_line_length": 10.615384615384615, "alnum_prop": 0.5434782608695652, "repo_name": "briannkym/RPGClass", "id": "ef9cc55edbad07deae6ab3fa4c60fdf1e7f9a12d", "size": "1244", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Resources/src/sound/Sound.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "106186" }, { "name": "TeX", "bytes": "106882" } ], "symlink_target": "" }
<component name="libraryTable"> <library name="ant"> <CLASSES> <root url="jar://$PROJECT_DIR$/lib/ant.jar!/" /> <root url="jar://$PROJECT_DIR$/lib/trove.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> </component>
{ "content_hash": "d0841c944956793a96fd43687bd98846", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 56, "avg_line_length": 25.3, "alnum_prop": 0.5652173913043478, "repo_name": "elliottd/vdrparser", "id": "3f4b8c36e12d0d04813034e05bcefc165df366b6", "size": "253", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "mstparser/.idea/libraries/ant.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "293901" }, { "name": "Python", "bytes": "134801" }, { "name": "Shell", "bytes": "2259" } ], "symlink_target": "" }
 #pragma once #include <aws/evidently/CloudWatchEvidently_EXPORTS.h> #include <aws/evidently/model/Experiment.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace CloudWatchEvidently { namespace Model { class AWS_CLOUDWATCHEVIDENTLY_API UpdateExperimentResult { public: UpdateExperimentResult(); UpdateExperimentResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); UpdateExperimentResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>A structure containing the configuration details of the experiment that was * updated.</p> */ inline const Experiment& GetExperiment() const{ return m_experiment; } /** * <p>A structure containing the configuration details of the experiment that was * updated.</p> */ inline void SetExperiment(const Experiment& value) { m_experiment = value; } /** * <p>A structure containing the configuration details of the experiment that was * updated.</p> */ inline void SetExperiment(Experiment&& value) { m_experiment = std::move(value); } /** * <p>A structure containing the configuration details of the experiment that was * updated.</p> */ inline UpdateExperimentResult& WithExperiment(const Experiment& value) { SetExperiment(value); return *this;} /** * <p>A structure containing the configuration details of the experiment that was * updated.</p> */ inline UpdateExperimentResult& WithExperiment(Experiment&& value) { SetExperiment(std::move(value)); return *this;} private: Experiment m_experiment; }; } // namespace Model } // namespace CloudWatchEvidently } // namespace Aws
{ "content_hash": "a294bbc98998f01e1f7e15183d07247c", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 119, "avg_line_length": 27.36231884057971, "alnum_prop": 0.7076271186440678, "repo_name": "aws/aws-sdk-cpp", "id": "ea1200b5a3c9f952173bbc1911c23ec88308cbc1", "size": "2007", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "aws-cpp-sdk-evidently/include/aws/evidently/model/UpdateExperimentResult.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "309797" }, { "name": "C++", "bytes": "476866144" }, { "name": "CMake", "bytes": "1245180" }, { "name": "Dockerfile", "bytes": "11688" }, { "name": "HTML", "bytes": "8056" }, { "name": "Java", "bytes": "413602" }, { "name": "Python", "bytes": "79245" }, { "name": "Shell", "bytes": "9246" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta name="description" content ="MATH 240: Probability" /> <meta name="keywords" content ="Probability, Lawrence" /> <meta name="author" content ="Adam Loy" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="viewport" content="width=device-width"> <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css"> <link rel="stylesheet" type="text/css" href="./assets/css/style.css"> <link rel="icon" href="./assets/images/favicon.ico"> <link rel="stylesheet" type="text/css" href="assets/css/article.css"/> <title>Resources | MATH 240 Fall 2016</title> </head> <body id="index" class="home"> <div class="head"> <h2> <a href="http://math240-lu.github.io/"> <span class="coursename">MATH 240 </span> </a> </h2> <p> Probability <br> Fall 2016</p> <p> <div class="instructors"> <span class="category">Instructor:</span> <br> Prof. Adam Loy </div> <!-- <div class="instructors"> <span class="category">Co-Instructors:</span><br> John DeNero<br>Michael I. Jordan<br>Tapan Parikh<br>David Wagner </div> --> </p> <hr/> <ul class="navigation"> <a href="./index.html"><li>Calendar</li></a> <a href="./assets/syllabus-2016-fall-m240.pdf"><li>Syllabus</li></a> </ul> <hr/> <ul class="navigation"> <a href="./resources.html"><li>Resources</li></a> <a href="https://piazza.com/"><li>Piazza</li></a> <a href="https://moodle.lawrence.edu/"><li>Moodle</li></a> </ul> <hr/> </div> <div id="content"> <h2 id="piazza">Piazza</h2> <p>This term we will be using Piazza for class discussion. The system is highly catered to getting you help fast and efficiently from classmates and myself. Rather than emailing questions to me, I encourage you to post your questions on Piazza.</p> <p>Find our class page at: <a href="https://piazza.com/lawrence/fall2016/math240/home">https://piazza.com/lawrence/fall2016/math240/home</a></p> <h2 id="bcourses">Moodle</h2> <p><a href="https://moodle.lawrence.edu/">Moodle</a> is where we will post information that can't go on the public Internet. Currently it only contains your grades. </p> <h2>Transition to Econ 380</h2> <p>If you will be taking Econ 380 in the winter, then you will need to review the following concepts before the term begins: <ul> <li>Plotting and describing data</li> <li>Sampling from a population</li> <li>Sampling distributions (i.e. distributions of a statistic)</li> <li>Hypothesis tests and confidence intervals for the mean</li> <li>Simple linear regression</li> </ul> There are a number of online resources that can help you do this. A few high quality options are listed below: </p> <p><a href="https://www.coursera.org/specializations/statistics">Duke's Statistical Inference Coursera course</a>.</p> <p><a href="https://www.coursera.org/specializations/jhu-data-science">Johns Hopkins' Statistical Inference Coursera course</a>.</p> </div> </body> </html>
{ "content_hash": "2de2b07c99d46c8ba02ea074bf25cf80", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 256, "avg_line_length": 39.04705882352941, "alnum_prop": 0.6242844230189816, "repo_name": "math240-LU/math240-LU.github.io", "id": "44959462fee5b5ce9f829889fd1de08dcb01c406", "size": "3319", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "resources.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5676" }, { "name": "HTML", "bytes": "11058" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html dir="ltr" lang="en-US"> <head> <meta charset="UTF-8" /> <!--[if IE]><![endif]--> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title> Appcelerator Documentation Guides</title> <link rel="profile" href="http://gmpg.org/xfn/11" /> <link rel="pingback" href="/xmlrpc.php" /> <link rel="EditURI" type="application/rsd+xml" title="RSD" href="/xmlrpc.php?rsd" /> <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="/wp-includes/wlwmanifest.xml" /> <link rel='index' title='Appcelerator Documentation Guides' href='' /> <meta name="generator" content="WordPress 3.0.3" /> <link rel="stylesheet" type="text/css" href="app://wp-content/themes/appcelerator/assets/stylesheets/style.css" /> <link rel="stylesheet" type="text/css" href="app://wp-content/themes/appcelerator/assets/stylesheets/syntax.css" /> <link rel="stylesheet" type="text/css" href="app://wp-content/themes/appcelerator/assets/stylesheets/print.css" media="print" /> <script type="text/javascript" src="app://wp-content/themes/appcelerator/assets/javascripts/jquery-1.4.4-min.js"> </script> </head> <body class="guide"> <div id="topNav"> <div class="wrapper"> <div id="languages"> English </div> <div class="clearfix"> </div> </div> </div> <div id="header"> <div class="wrapper clearfix"> <h1><a href="/" title="Appcelerator Documentation Guides">Appcelerator Documentation</a></h1> <p class="hide"> <a href="#mainCol">Skip navigation</a>. </p> <ul class="nav"> <li> <a href="/"></a> </li> </ul> </div> </div> <hr class="hide" /> <div id="feature"> <div class="wrapper"> <h2>Please Wait</h2> <p> Downloading the latest version of the guides. This should only take a moment. </p> <div id="desktop-progressBar-container"> <div id="desktop-progressBar"> </div> </div> </div> </div> <div id="footer"> <div class="wrapper"> <p> The documentation template was adapted from <a href="http://edgeguides.rubyonrails.org/">Rails Guides</a> which is licensed under <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0</a>. It's really beautiful and we love it so we borrowed from it. The rest of the documentation content contained herein is Copyright &copy; 2010 by Appcelerator, Inc. All Rights Reserved. Use of this website signifies your agreement to the <a href="http://www.appcelerator.com/company/terms-and-conditions-of-use/">Terms of Use</a> and <a href="http://www.appcelerator.com/company/privacy/">Online Privacy Policy</a>. </p> <p> Appcelerator is a registered trademark of <a href="http://www.appcelerator.com">Appcelerator, Inc.</a> Appcelerator Titanium is a trademark of <a href="http://www.appcelerator.com">Appcelerator, Inc.</a> You can download Appcelerator Titanium at <a href="http://www.appcelerator.com/download">Titanium Download Page</a>. </div> </div> <link rel="stylesheet" type="text/css" href="app://desktop/stylesheets/desktop.css" /> <script type="text/javascript" src="app://desktop/javascripts/options.js"> </script> <script type="text/javascript" src="app://desktop/javascripts/properties.js"> </script> <script type="text/javascript" src="app://desktop/javascripts/page.js"> </script> <script type="text/javascript" src="app://desktop/javascripts/desktop.js"> </script> <script type="text/javascript"> desktop.init(true); </script> </body> </html>
{ "content_hash": "9921386a4dd198af2fb712197ef775f3", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 670, "avg_line_length": 51.476190476190474, "alnum_prop": 0.5696114708603145, "repo_name": "dawsontoth/Guides-for-Desktop", "id": "40723ad1ab03183515a69dd33044ecf96e0b3bca", "size": "4324", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "dist/osx/Guides For Desktop.app/Contents/Resources/loading.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "0" }, { "name": "JavaScript", "bytes": "26105" } ], "symlink_target": "" }
import BaseModule from './BaseModule'; export default class AudioOutModule extends BaseModule { constructor (options) { super(options); this.name = 'Audio Out'; this.description = 'Master audio out node.'; this.rootNode = true; // dirty hack for composing a node tree this.inlets = [ 'IN' ]; } src () { return ` GLOBAL_OUT_BUFFER[i] = ${this.inlet('IN')}[i]; `; } }
{ "content_hash": "fbe9a68077631573805a2ffcc5604b19", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 65, "avg_line_length": 20.095238095238095, "alnum_prop": 0.5995260663507109, "repo_name": "teemuteemu/sp_modular", "id": "8d068c7dd940017723f48385c984b2017d0ce748", "size": "422", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/audio/modules/AudioOut.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1388" }, { "name": "HTML", "bytes": "227" }, { "name": "JavaScript", "bytes": "32652" } ], "symlink_target": "" }
// $Id$ #ifndef _FLY_HPP_ #define _FLY_HPP_ #include "network.hpp" class KNFly : public Network { int _k; int _n; void _ComputeSize( const Configuration &config ); void _BuildNet( const Configuration &config ); int _OutChannel( int stage, int addr, int port ) const; int _InChannel( int stage, int addr, int port ) const; public: KNFly( const Configuration &config, const string & name ); int GetN( ) const; int GetK( ) const; static void RegisterRoutingFunctions(){}; double Capacity( ) const; }; #endif
{ "content_hash": "607418361c364a83c29028a7d10607de", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 60, "avg_line_length": 18, "alnum_prop": 0.6666666666666666, "repo_name": "booksim/booksim2", "id": "82fbe14a3652c37760c6488ae22bdd0c012e41db", "size": "1891", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "src/networks/fly.hpp", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "8110" }, { "name": "C++", "bytes": "747659" }, { "name": "Lex", "bytes": "1028" }, { "name": "Makefile", "bytes": "2453" }, { "name": "Shell", "bytes": "5345" }, { "name": "Yacc", "bytes": "742" } ], "symlink_target": "" }
package com.mxixm.fastboot.weixin.module.menu; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.mxixm.fastboot.weixin.annotation.WxButton; import com.mxixm.fastboot.weixin.util.WxRedirectUtils; import com.mxixm.fastboot.weixin.util.WxUrlUtils; import org.springframework.util.Assert; import org.springframework.util.StringUtils; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Objects; /** * FastBootWeixin WxMenu * 微信一套菜单 * 经测试,在未启用服务器配置时,人工自定义的菜单可以被接口获取,但是数据缺失,此时菜单事件不会发送到服务器 * 但可通过接口进行自定义菜单,如果通过接口创建菜单,则自定义菜单配置页面会提示API版本菜单使用中。 * 该页面显示的菜单版本已失效。当前生效版本请调用API查看。若停用菜单,请点击这里。此时因未启用服务器配置,故不会发送事件到服务器。 * 此时仍可通过自定义菜单进行保存,保存后会覆盖API自定义的菜单。 * 在已配置菜单的情况下,启用服务器配置,已自定义的菜单会丢失,服务器菜单会变为空,同时自定义菜单功能会自动关闭。 * * @author Guangshan * @date 2018/09/13 23:39 * @since 0.7.0 */ public class WxMenu { @JsonProperty("button") public List<Button> mainButtons = new ArrayList<>(); public void add(Button button) { mainButtons.add(button); } @Override public boolean equals(Object o) { if (o == this) { return true; } if (!(o instanceof WxMenu)) { return false; } final WxMenu other = (WxMenu) o; if (!other.canEqual(this)) { return false; } final Object this$mainButtons = this.mainButtons; final Object other$mainButtons = other.mainButtons; if (this$mainButtons == null ? other$mainButtons != null : !this$mainButtons.equals(other$mainButtons)) { return false; } return true; } @Override public int hashCode() { final int PRIME = 59; int result = 1; final Object $mainButtons = this.mainButtons; result = result * PRIME + ($mainButtons == null ? 43 : $mainButtons.hashCode()); return result; } protected boolean canEqual(Object other) { return other instanceof WxMenu; } @Override public String toString() { return "com.mxixm.fastboot.weixin.module.menu.WxMenu(mainButtons=" + this.mainButtons + ")"; } public static class Button { @JsonProperty("sub_button") @JsonInclude(JsonInclude.Include.NON_EMPTY) private List<Button> subButtons = new ArrayList<>(); @JsonIgnore private WxButton.Group group; @JsonInclude(JsonInclude.Include.NON_NULL) private WxButton.Type type; @JsonInclude(JsonInclude.Include.NON_NULL) private String name; @JsonIgnore private boolean main; @JsonIgnore private WxButton.Order order; @JsonInclude(JsonInclude.Include.NON_NULL) private String key; @JsonInclude(JsonInclude.Include.NON_NULL) private String url; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty("media_id") private String mediaId; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty("appid") private String appId; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty("pagepath") private String pagePath; public Button() { } public List<Button> getSubButtons() { return subButtons; } public WxButton.Type getType() { return type; } public WxButton.Order getOrder() { return order; } public boolean isMain() { return main; } public WxButton.Level getLevel() { return isMain() ? WxButton.Level.MAIN : WxButton.Level.SUB; } public String getName() { return name; } public String getKey() { return key; } public String getUrl() { return url; } public String getMediaId() { return mediaId; } public String getAppId() { return appId; } public String getPagePath() { return pagePath; } public WxButton.Group getGroup() { return group; } void setGroup(WxButton.Group group) { this.group = group; } void setType(WxButton.Type type) { this.type = type; } void setName(String name) { this.name = name; } void setMain(boolean main) { this.main = main; } void setOrder(WxButton.Order order) { this.order = order; } void setKey(String key) { this.key = key; } void setUrl(String url) { this.url = url; } void setMediaId(String mediaId) { this.mediaId = mediaId; } void setAppId(String appId) { this.appId = appId; } void setPagePath(String pagePath) { this.pagePath = pagePath; } public Button addSubButton(Button item) { this.subButtons.add(item); return this; } Button(WxButton.Group group, WxButton.Type type, boolean main, WxButton.Order order, String name, String key, String url, String mediaId, String appId, String pagePath) { super(); this.group = group; this.type = type; this.main = main; this.order = order; this.name = name; this.key = key; this.url = url; this.mediaId = mediaId; this.appId = appId; this.pagePath = pagePath; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Button)) { return false; } Button that = (Button) o; // 子菜单数量不同,直接不相等 if (this.getSubButtons().size() != that.getSubButtons().size()) { return false; } // 父菜单只比较name和子 if (this.getSubButtons().size() > 0 && that.getSubButtons().size() > 0) { if (this.getSubButtons().equals(that.getSubButtons())) { return getName().equals(that.getName()); } return false; } // 非父菜单,全部比较,要把每个类型的比较摘出来,不想摘了 if (getType() != that.getType()) { return false; } if (!getName().equals(that.getName())) { return false; } // VIEW会自动抹掉key,只有两个key都非null的时候才做下一步判断 // if (getKey() != null && that.getKey() != null && !that.getKey().equals(getKey())) { // 上面判断不再适用 if (!Objects.equals(getKey(), that.getKey())) { return false; } // 同上 // getUrl() != null && that.getUrl() != null && !getUrl().equals(that.getUrl()) // 上面判断不再适用 if (!Objects.equals(getUrl(), that.getUrl())) { return false; } // 小程序类型,做特殊判断 if (getType() == WxButton.Type.MINI_PROGRAM) { if (!Objects.equals(getAppId(), that.getAppId()) || !Objects.equals(getPagePath(), that.getPagePath()) || !Objects.equals(getUrl(), that.getUrl())) { return false; } } return Objects.equals(getMediaId(), that.getMediaId()); } @Override public int hashCode() { int result = getSubButtons() != null ? getSubButtons().hashCode() : 0; result = 31 * result + getGroup().hashCode(); result = 31 * result + getType().hashCode(); result = 31 * result + getName().hashCode(); result = 31 * result + (isMain() ? 1 : 0); result = 31 * result + (getOrder() != null ? getOrder().hashCode() : 0); result = 31 * result + (getKey() != null ? getKey().hashCode() : 0); result = 31 * result + (getUrl() != null ? getUrl().hashCode() : 0); result = 31 * result + (getMediaId() != null ? getMediaId().hashCode() : 0); return result; } public static Builder builder() { return new Builder(); } @Override public String toString() { return "com.mxixm.fastboot.weixin.module.menu.WxMenu.Button(subButtons=" + this.getSubButtons() + ", group=" + this.getGroup() + ", type=" + this.getType() + ", name=" + this.getName() + ", main=" + this.isMain() + ", order=" + this.getOrder() + ", key=" + this.getKey() + ", url=" + this.getUrl() + ", mediaId=" + this.getMediaId() + ")"; } public static class Builder { private WxButton.Type type; private WxButton.Group group; private boolean main; private WxButton.Order order; private String name; private String key; private String url; private String mediaId; private String appId; private String pagePath; Builder() { super(); } public Builder setGroup(WxButton.Group group) { this.group = group; return this; } public Builder setType(WxButton.Type type) { this.type = type; return this; } public Builder setMain(boolean main) { this.main = main; return this; } public Builder setOrder(WxButton.Order order) { this.order = order; return this; } public Builder setName(String name) { this.name = name; return this; } public Builder setKey(String key) { this.key = StringUtils.isEmpty(key) ? null : key; return this; } public Builder setAppId(String appId) { this.appId = StringUtils.isEmpty(appId) ? null : appId; return this; } public Builder setPagePath(String pagePath) { this.pagePath = StringUtils.isEmpty(pagePath) ? null : pagePath; return this; } public Builder setUrl(String url) { // 如果是callbackUrl,则重定向,否则不重定向 // WxUrlUtils.absoluteUrl() if (!StringUtils.isEmpty(url)) { url = WxUrlUtils.absoluteUrl(url); // 因为菜单可以在未关注时打开,所以菜单的链接也要用snsapi_userinfo方式 this.url = WxUrlUtils.isCallbackUrl(url) ? WxRedirectUtils.redirect(url) : url; } return this; } public Builder setMediaId(String mediaId) { this.mediaId = StringUtils.isEmpty(mediaId) ? null : mediaId; return this; } public Button build() { Assert.isTrue(!StringUtils.isEmpty(name), "菜单名不能为空"); Assert.notNull(type, "菜单必须有类型"); Assert.notNull(group, "菜单必须有分组"); if (this.main) { // main菜单没有order this.order = null; // 判断一级菜单长度小于等于16 Assert.isTrue(name.getBytes(StandardCharsets.UTF_8).length <= 16, "一级菜单名过长,不能超过16字节"); } else { // 判断二级菜单长度小于等于60 Assert.isTrue(main || name.getBytes().length <= 60, "二级菜单名过长,不能超过60字节"); } switch (this.type) { case VIEW: { Assert.isTrue(!StringUtils.isEmpty(url), "view类型必须有url"); // view类型key、mediaId、appId、pagePath是无效的 return new Button(group, type, main, order, name, null, url, null, null, null); } case MEDIA_ID: case VIEW_LIMITED: { Assert.isTrue(!StringUtils.isEmpty(mediaId), "media_id类型和view_limited类型必须有mediaId"); // media_id类型和view_limited类型key、url、appId、pagePath是无效的 return new Button(group, type, main, order, name, null, null, mediaId, null, null); } case MINI_PROGRAM: { Assert.isTrue(!StringUtils.isEmpty(appId) && !StringUtils.isEmpty(pagePath) && !StringUtils.isEmpty(this.url), "miniprogram类型必须有appid、pagepath和url"); // miniprogram中,appid, pagepath, url是有效的。 return new Button(group, type, main, order, name, null, url, null, appId, pagePath); } default: { // 当类型为view的时候,key是url,忽略assert Assert.isTrue(!StringUtils.isEmpty(key), "click等类型必须有key"); Assert.isTrue(key.getBytes().length <= 128, "key过长,不能超过128字节"); // 其他类型只有key是有效的 return new Button(group, type, main, order, name, key, null, null, null, null); } } } } } }
{ "content_hash": "de36d10feca89a3b5b051b8a6ffd1940", "timestamp": "", "source": "github", "line_count": 415, "max_line_length": 351, "avg_line_length": 32.40963855421687, "alnum_prop": 0.5208921933085502, "repo_name": "FastBootWeixin/FastBootWeixin", "id": "d009c9059e9f49adcad39d5323430ac5d21636cb", "size": "14554", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/mxixm/fastboot/weixin/module/menu/WxMenu.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "2018941" } ], "symlink_target": "" }
package rest.posts import org.specs2.mutable._ import org.specs2.runner._ import org.junit.runner._ import play.api.test._ import play.api.test.Helpers._ import play.api.libs.json._ import MongoDBTestUtils._ /** * Add your spec here. * You can mock out a whole application including requests, plugins etc. * For more information, consult the wiki. */ @RunWith(classOf[JUnitRunner]) class PostsControllerTests extends Specification { "PostsController" should { "be able to retrieve all the posts" in withMongoDbAndData("posts","test/stubs/posts.json") { app => // When val Some(result) = route(FakeRequest(GET, "/posts")) // Then status(result) must equalTo(OK) contentType(result) must beSome("application/json") charset(result) must beSome("utf-8") contentAsJson(result).as[JsArray].value.size must equalTo(5) } "be able to retrieve a specific post" in withMongoDbAndData("posts","test/stubs/posts.json") { app => // When val Some(result) = route(FakeRequest(GET, "/post/5143ddf3bcf1bf4ab37d9c6d")) // Then status(result) must equalTo(OK) contentType(result) must beSome("application/json") charset(result) must beSome("utf-8") (contentAsJson(result).as[JsObject] \ "title").as[String] must equalTo("Blog post 1") } } }
{ "content_hash": "e339c94475cb1fb1404de1c2a13613f6", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 105, "avg_line_length": 27.895833333333332, "alnum_prop": 0.6855862584017924, "repo_name": "ychartois/MAP-Stack", "id": "92ec1f46f512160ab423f16490fc37e596d42437", "size": "1339", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/rest/posts/PostsControllerTests.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "0" }, { "name": "Scala", "bytes": "6127" } ], "symlink_target": "" }
@implementation DXAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UITabBarController *tab = [[UITabBarController alloc] init]; FeedViewController *feed = [FeedViewController new]; feed.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Feed" image:nil selectedImage:nil]; SingleViewController *single = [SingleViewController new]; single.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Single" image:nil selectedImage:nil]; tab.viewControllers = @[feed, single]; self.window.rootViewController = tab; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; [SDWebImageManager sharedManager].imageDownloader.maxConcurrentDownloads = 15; [[SDImageCache sharedImageCache] clearDisk]; return YES; } - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - (void)applicationWillEnterForeground:(UIApplication *)application { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } @end
{ "content_hash": "9a3947e55f27d9c2b6c93abead276fdb", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 281, "avg_line_length": 50.372549019607845, "alnum_prop": 0.7715064227325807, "repo_name": "xiekw2010/DXRoundProgressImageView", "id": "bd5b8f5dd152837b0e513e26d13bc82d85c6636a", "size": "2859", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "DXRoundProgressImageView/DXAppDelegate.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "145877" } ], "symlink_target": "" }
#include "tensorflow/lite/kernels/internal/optimized/integer_ops/conv.h" #include <algorithm> #include <cassert> #include <cmath> #include <cstdint> #include <cstdio> #include <cstdlib> #include <iostream> #include <limits> #include "tensorflow/lite/c/builtin_op_data.h" #include "tensorflow/lite/c/common.h" #include "tensorflow/lite/kernels/cpu_backend_context.h" #include "tensorflow/lite/kernels/eigen_support.h" // b/131835803 forces us to include multithreaded_conv.h before optimized_ops.h #ifndef TFLITE_WITH_RUY #include "tensorflow/lite/kernels/internal/optimized/multithreaded_conv.h" #endif #include "tensorflow/lite/kernels/internal/optimized/optimized_ops.h" #include "tensorflow/lite/kernels/internal/quantization_util.h" #include "tensorflow/lite/kernels/internal/reference/conv.h" #include "tensorflow/lite/kernels/internal/reference/integer_ops/conv.h" #include "tensorflow/lite/kernels/internal/tensor.h" #include "tensorflow/lite/kernels/internal/tensor_ctypes.h" #include "tensorflow/lite/kernels/internal/tensor_utils.h" #include "tensorflow/lite/kernels/kernel_util.h" #include "tensorflow/lite/kernels/op_macros.h" #include "tensorflow/lite/kernels/padding.h" namespace tflite { namespace ops { namespace builtin { namespace conv { // This file has 4 implementation of Conv. enum KernelType { kReference, kGenericOptimized, // Neon-free // kMultithreadOptimized is a mixture of an Eigen-based kernel when threads // are available and kGenericOptimized when we must use only one thread. kMultithreadOptimized, // The kernel uses use CBLAS interface for matrix multiplication. // It's fast when an optimized CBLAS implementation is available (e.g. Apple // Accelerate Framework), and it's slow when falling back to naive // implementation. kCblasOptimized, }; const int kTensorNotAllocated = -1; struct OpData { // IDs are the arbitrary identifiers used by TF Lite to identify and access // memory buffers. int im2col_id = kTensorNotAllocated; int hwcn_weights_id = kTensorNotAllocated; int input_quantized_id = kTensorNotAllocated; int scaling_factors_id = kTensorNotAllocated; int input_offset_id = kTensorNotAllocated; int accum_scratch_id = kTensorNotAllocated; // Row sums are used to cache filter sums for hybrid zero-point calculations. int row_sums_id = kTensorNotAllocated; TfLitePaddingValues padding; // The scaling factor from input to output (aka the 'real multiplier') can // be represented as a fixed point multiplier plus a left shift. int32_t output_multiplier; int output_shift; // Per channel output multiplier and shift. std::vector<int32_t> per_channel_output_multiplier; std::vector<int> per_channel_output_shift; // The range of the fused activation layer. For example for kNone and // uint8_t these would be 0 and 255. int32_t output_activation_min; int32_t output_activation_max; // Indexes are the offset to the memory buffer in the array used to keep track // of the allocated temporaries. int32_t im2col_index; int32_t hwcn_weights_index; int32_t input_quantized_index; int32_t scaling_factors_index; int32_t accum_scratch_index; int32_t input_offset_index; int32_t row_sums_index; bool need_hwcn_weights = false; bool have_weights_been_transposed = false; bool need_im2col = false; bool supports_multithreaded_kernel = false; bool is_hybrid_per_channel = false; bool compute_hybrid_row_sums = true; }; inline PaddingType RuntimePaddingType(TfLitePadding padding) { switch (padding) { case TfLitePadding::kTfLitePaddingSame: return PaddingType::kSame; case TfLitePadding::kTfLitePaddingValid: return PaddingType::kValid; case TfLitePadding::kTfLitePaddingUnknown: default: return PaddingType::kNone; } } void* Init(TfLiteContext* context, const char* buffer, size_t length) { // This is a builtin op, so we don't use the contents in 'buffer', if any. // Instead, we allocate a new object to use as scratch space for im2col, and // to carry information from Prepare() to Eval(). auto* data = new OpData; eigen_support::IncrementUsageCounter(context); return data; } void Free(TfLiteContext* context, void* buffer) { eigen_support::DecrementUsageCounter(context); delete reinterpret_cast<OpData*>(buffer); } // Naive implementation of transpose for floats. Could be optimized to be more // cache friendly, but for now it's a one-time cost on first run, and we would // prefer to remove the need to do this at all eventually. void TransposeFloatTensor(TfLiteTensor* input, TfLiteTensor* output) { const int rows = output->dims->data[1]; const int cols = output->dims->data[0]; const float* input_data = GetTensorData<float>(input); float* output_data = GetTensorData<float>(output); for (int i = 0; i < rows; ++i) { for (int j = 0; j < cols; ++j) { const float in_value = input_data[i * cols + j]; output_data[j * rows + i] = in_value; } } } // Check if im2col needs to be allocated, as some version of optimized Conv dont // use it. If any change is supporting im2col in any of the Conv versions, then // it should be updated here as well bool IsIm2ColRequired(TfLiteTensor* input, TfLiteConvParams* params, TfLiteTensor* filter, OpData* data, bool is_hybrid, KernelType kernel_type) { // If HWCN weights are required, Im2Col not required if (data->need_hwcn_weights) return false; // segregate based on dilated conv & non-dialated conv const bool need_dilated_im2col = params->dilation_width_factor != 1 || params->dilation_height_factor != 1; const bool need_non_dilated_im2col = params->stride_width != 1 || params->stride_height != 1 || filter->dims->data[2] != 1 || filter->dims->data[1] != 1; const bool need_im2col = need_dilated_im2col || need_non_dilated_im2col; // Return early as basic requirement is not met if (!need_im2col) return false; // Special case for Hybrid, as it supports only non-dilated im2col currently const bool is_hybrid_non_dilated = is_hybrid && need_non_dilated_im2col; const bool is_quantized = input->type == kTfLiteUInt8 || input->type == kTfLiteInt8; switch (kernel_type) { case kReference: if (is_hybrid) { return true; } else { return false; } case kGenericOptimized: case kCblasOptimized: if (is_hybrid && !need_non_dilated_im2col) { return false; } else { return true; } case kMultithreadOptimized: if (is_hybrid_non_dilated || is_quantized || !data->supports_multithreaded_kernel) { return true; } else { return false; } default: return false; } } // Allocate temporary tensors (`im2col`, `hwcn_weights` if necessary). // Note: `context->AddTensors` might invalidate pointers to existing tensors. // Therefore the logic to add tensors are isolated into this function. static TfLiteStatus AllocateTemporaryTensorsIfRequired(TfLiteContext* context, TfLiteNode* node, bool is_hybrid, bool is_per_channel, KernelType kernel_type) { auto* params = reinterpret_cast<TfLiteConvParams*>(node->builtin_data); OpData* data = reinterpret_cast<OpData*>(node->user_data); TF_LITE_ENSURE(context, node->inputs->size >= 2); TfLiteTensor* input = &context->tensors[node->inputs->data[0]]; TfLiteTensor* filter = &context->tensors[node->inputs->data[1]]; // If we're using the optimized multithreaded EigenTensor implementation of // convolution, it expects the filter weights to be transposed compared to // the normal TF Lite buffer format. Typical TF Lite weights are // [filter_count, filter_height, filter_width, input_depth], but for the float // implementation we need them as [filter_height, filter_width, input_depth, // filter_count]. We get to that format by transposing, and create a temporary // buffer to store the results. // This path is only used for float processing, so only create the buffer if // we're running with that data type. data->need_hwcn_weights = input->type == kTfLiteFloat32 && data->supports_multithreaded_kernel; // We don't always need to allocate im2col. It is only used in some versions // of the optimized Conv. This test just mimics something that happens inside // optimized_ops.h, in order to avoid a DCHECK(!im2col_data). data->need_im2col = IsIm2ColRequired(input, params, filter, data, is_hybrid, kernel_type); int temporaries_count = 0; if (data->need_im2col) { data->im2col_index = temporaries_count; if (data->im2col_id == kTensorNotAllocated) { context->AddTensors(context, 1, &data->im2col_id); } ++temporaries_count; } if (data->need_hwcn_weights) { data->hwcn_weights_index = temporaries_count; if (data->hwcn_weights_id == kTensorNotAllocated) { context->AddTensors(context, 1, &data->hwcn_weights_id); } ++temporaries_count; } if (is_hybrid) { // Allocate tensor to store the on-the-fly quantized inputs. data->input_quantized_index = temporaries_count; if (data->input_quantized_id == kTensorNotAllocated) { TF_LITE_ENSURE_OK( context, context->AddTensors(context, 1, &data->input_quantized_id)); } ++temporaries_count; // Allocate tensor to store the quantization params computed during // on-the-fly input quantization. data->scaling_factors_index = temporaries_count; if (data->scaling_factors_id == kTensorNotAllocated) { TF_LITE_ENSURE_OK( context, context->AddTensors(context, 1, &data->scaling_factors_id)); } ++temporaries_count; // Allocate tensor to store the accumulators for the matrix multiply. data->accum_scratch_index = temporaries_count; if (data->accum_scratch_id == kTensorNotAllocated) { TF_LITE_ENSURE_OK( context, context->AddTensors(context, 1, &data->accum_scratch_id)); } ++temporaries_count; if (is_per_channel) { data->input_offset_index = temporaries_count; if (data->input_offset_id == kTensorNotAllocated) { TF_LITE_ENSURE_OK( context, context->AddTensors(context, 1, &data->input_offset_id)); } ++temporaries_count; data->row_sums_index = temporaries_count; if (data->row_sums_id == kTensorNotAllocated) { TF_LITE_ENSURE_OK(context, context->AddTensors(context, 1, &data->row_sums_id)); } ++temporaries_count; } } TfLiteIntArrayFree(node->temporaries); node->temporaries = TfLiteIntArrayCreate(temporaries_count); return kTfLiteOk; } TfLiteStatus Prepare(KernelType kernel_type, TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteConvParams*>(node->builtin_data); OpData* data = reinterpret_cast<OpData*>(node->user_data); bool has_bias = node->inputs->size == 3; // Check number of inputs/outputs TF_LITE_ENSURE(context, has_bias || node->inputs->size == 2); TF_LITE_ENSURE_EQ(context, node->outputs->size, 1); TfLiteTensor* output = &context->tensors[node->outputs->data[0]]; TfLiteTensor* input = &context->tensors[node->inputs->data[0]]; TfLiteTensor* filter = &context->tensors[node->inputs->data[1]]; // Check dimensionality of input, filter TF_LITE_ENSURE_EQ(context, input->dims->size, 4); TF_LITE_ENSURE_EQ(context, filter->dims->size, 4); // Check input channels matching filter TF_LITE_ENSURE_EQ(context, input->dims->data[3], filter->dims->data[3]); // Check types. (We assume that UINT8 refers to quantized tensors) TfLiteType input_type = input->type; TF_LITE_ENSURE(context, input_type == kTfLiteFloat32 || input_type == kTfLiteUInt8 || input_type == kTfLiteInt8); TF_LITE_ENSURE_EQ(context, output->type, input_type); TfLiteTensor* bias = nullptr; // TODO(ahentz): At this point the optimized versions require 'bias'. We can // either change that or document that convolution requires it. TF_LITE_ENSURE(context, has_bias); if (has_bias) { bias = &context->tensors[node->inputs->data[2]]; if (input_type == kTfLiteUInt8 || input_type == kTfLiteInt8) { TF_LITE_ENSURE_EQ(context, bias->type, kTfLiteInt32); TF_LITE_ENSURE_EQ(context, bias->params.zero_point, 0); } else { TF_LITE_ENSURE_EQ(context, bias->type, input_type); } TF_LITE_ENSURE_EQ(context, NumElements(bias), SizeOfDimension(filter, 0)); } const bool is_hybrid = (input->type == kTfLiteFloat32 && (filter->type == kTfLiteUInt8 || filter->type == kTfLiteInt8)); if (is_hybrid && filter->type == kTfLiteInt8 && filter->quantization.type == kTfLiteAffineQuantization && filter->quantization.params && reinterpret_cast<TfLiteAffineQuantization*>(filter->quantization.params) ->scale && reinterpret_cast<TfLiteAffineQuantization*>(filter->quantization.params) ->scale->size > 1) { const auto* affine_quantization = reinterpret_cast<TfLiteAffineQuantization*>( filter->quantization.params); const float scale = affine_quantization->scale->data[0]; for (int i = 1; i < affine_quantization->scale->size; i++) { if (affine_quantization->scale->data[i] != scale) { data->is_hybrid_per_channel = true; break; } } } // The multi-threaded kernel supports neither dilation nor hybrid kernels. data->supports_multithreaded_kernel = (kernel_type == kMultithreadOptimized) && (context->recommended_num_threads != 1) && !is_hybrid && (params->dilation_width_factor == 1) && (params->dilation_height_factor == 1); TF_LITE_ENSURE_STATUS(AllocateTemporaryTensorsIfRequired( context, node, is_hybrid, data->is_hybrid_per_channel, kernel_type)); int channels_in = filter->dims->data[3]; int channels_out = filter->dims->data[0]; int width = input->dims->data[2]; int height = input->dims->data[1]; int filter_width = filter->dims->data[2]; int filter_height = filter->dims->data[1]; int batches = input->dims->data[0]; // Matching GetWindowedOutputSize in TensorFlow. auto padding = params->padding; int out_width, out_height; data->padding = ComputePaddingHeightWidth( params->stride_height, params->stride_width, params->dilation_height_factor, params->dilation_width_factor, height, width, filter_height, filter_width, padding, &out_height, &out_width); TF_LITE_ENSURE(context, has_bias); // Note that full fixed-point inference requires that all tensors have their // parameters set. This is usually done during quantized training or // calibration. if (input_type != kTfLiteFloat32) { TF_LITE_ENSURE_EQ(context, filter->quantization.type, kTfLiteAffineQuantization); const auto* affine_quantization = reinterpret_cast<TfLiteAffineQuantization*>( filter->quantization.params); TF_LITE_ENSURE(context, affine_quantization); TF_LITE_ENSURE(context, affine_quantization->scale); TF_LITE_ENSURE(context, (affine_quantization->scale->size == 1 || affine_quantization->scale->size == channels_out)); data->per_channel_output_multiplier.resize(channels_out); data->per_channel_output_shift.resize(channels_out); TF_LITE_ENSURE_STATUS(tflite::PopulateConvolutionQuantizationParams( context, input, filter, bias, output, params->activation, &data->output_multiplier, &data->output_shift, &data->output_activation_min, &data->output_activation_max, data->per_channel_output_multiplier.data(), data->per_channel_output_shift.data(), channels_out)); } TfLiteIntArray* output_size = TfLiteIntArrayCreate(4); output_size->data[0] = batches; output_size->data[1] = out_height; output_size->data[2] = out_width; output_size->data[3] = channels_out; auto output_status = context->ResizeTensor(context, output, output_size); if (output_status != kTfLiteOk) return output_status; if (data->need_im2col) { node->temporaries->data[data->im2col_index] = data->im2col_id; TfLiteIntArray* im2col_size = TfLiteIntArrayCreate(4); int input_depth = input->dims->data[3]; im2col_size->data[0] = output_size->data[0]; im2col_size->data[1] = output_size->data[1]; im2col_size->data[2] = output_size->data[2]; im2col_size->data[3] = input_depth * filter_height * filter_width; TfLiteTensor* im2col = &context->tensors[node->temporaries->data[data->im2col_index]]; im2col->type = input->type; if (is_hybrid) { im2col->type = filter->type; } im2col->allocation_type = kTfLiteArenaRw; auto im2col_status = context->ResizeTensor(context, im2col, im2col_size); if (im2col_status != kTfLiteOk) return im2col_status; } if (data->need_hwcn_weights) { node->temporaries->data[data->hwcn_weights_index] = data->hwcn_weights_id; TfLiteIntArray* hwcn_weights_size = TfLiteIntArrayCreate(2); // Because we're treating the filter weights as a matrix when we do the // transpose, we allocate the buffer with a two-dimensional shape, where one // dimension is the number of elements in each filter, and the second is the // total number of filters. int input_depth = input->dims->data[3]; hwcn_weights_size->data[0] = (filter_height * filter_width * input_depth); hwcn_weights_size->data[1] = channels_out; TfLiteTensor* hwcn_weights = &context->tensors[node->temporaries->data[data->hwcn_weights_index]]; hwcn_weights->type = input_type; hwcn_weights->allocation_type = kTfLiteArenaRwPersistent; auto hwcn_weights_status = context->ResizeTensor(context, hwcn_weights, hwcn_weights_size); if (hwcn_weights_status != kTfLiteOk) return hwcn_weights_status; // TODO(petewarden): If Resize() is called when the size hasn't actually // changed, this will do extra redundant work. data->have_weights_been_transposed = false; } if (is_hybrid) { node->temporaries->data[data->input_quantized_index] = data->input_quantized_id; TfLiteTensor* input_quantized = GetTemporary(context, node, data->input_quantized_index); input_quantized->type = kTfLiteInt8; input_quantized->allocation_type = kTfLiteArenaRw; if (!TfLiteIntArrayEqual(input_quantized->dims, input->dims)) { TfLiteIntArray* input_quantized_size = TfLiteIntArrayCopy(input->dims); TF_LITE_ENSURE_OK(context, context->ResizeTensor(context, input_quantized, input_quantized_size)); } node->temporaries->data[data->scaling_factors_index] = data->scaling_factors_id; TfLiteTensor* scaling_factors = GetTemporary(context, node, data->scaling_factors_index); scaling_factors->type = kTfLiteFloat32; scaling_factors->allocation_type = kTfLiteArenaRw; // Only one scale factor per batch is typically necessary. See optimized // implementation for why we need to allocate for the height of the inputs // flattened to 2D. const int height = NumElements(input) / channels_in; int scaling_dims[1] = {height}; if (!TfLiteIntArrayEqualsArray(scaling_factors->dims, 1, scaling_dims)) { TfLiteIntArray* scaling_factors_size = TfLiteIntArrayCreate(1); scaling_factors_size->data[0] = height; TF_LITE_ENSURE_OK(context, context->ResizeTensor(context, scaling_factors, scaling_factors_size)); } node->temporaries->data[data->accum_scratch_index] = data->accum_scratch_id; TfLiteTensor* accum_scratch = GetTemporary(context, node, data->accum_scratch_index); accum_scratch->type = kTfLiteInt32; accum_scratch->allocation_type = kTfLiteArenaRw; const int scratch_width = batches * out_height * out_width; int accum_scratch_dims[2] = {channels_out, scratch_width}; if (!TfLiteIntArrayEqualsArray(accum_scratch->dims, 2, accum_scratch_dims)) { TfLiteIntArray* accum_scratch_size = TfLiteIntArrayCreate(2); accum_scratch_size->data[0] = channels_out; accum_scratch_size->data[1] = scratch_width; TF_LITE_ENSURE_OK(context, context->ResizeTensor(context, accum_scratch, accum_scratch_size)); } if (data->is_hybrid_per_channel) { const auto* affine_quantization = reinterpret_cast<TfLiteAffineQuantization*>( filter->quantization.params); TF_LITE_ENSURE_EQ( context, affine_quantization->scale->size, filter->dims->data[affine_quantization->quantized_dimension]); node->temporaries->data[data->input_offset_index] = data->input_offset_id; TfLiteTensor* input_offsets = GetTemporary(context, node, data->input_offset_index); input_offsets->type = kTfLiteInt32; input_offsets->allocation_type = kTfLiteArenaRw; // See above comment for the need to allocate for height of inputs. const int height = NumElements(input) / channels_in; const int input_offset_dims[1] = {height}; if (!TfLiteIntArrayEqualsArray(input_offsets->dims, 1, input_offset_dims)) { TfLiteIntArray* input_offsets_size = TfLiteIntArrayCreate(1); input_offsets_size->data[0] = input_offset_dims[0]; TF_LITE_ENSURE_OK(context, context->ResizeTensor(context, input_offsets, input_offsets_size)); } node->temporaries->data[data->row_sums_index] = data->row_sums_id; TfLiteTensor* row_sums = GetTemporary(context, node, data->row_sums_index); row_sums->type = kTfLiteInt32; row_sums->allocation_type = kTfLiteArenaRwPersistent; // See above comment for the need to allocate for height of inputs. const int row_sums_dims[1] = {channels_out}; if (!TfLiteIntArrayEqualsArray(row_sums->dims, 1, row_sums_dims)) { TfLiteIntArray* row_sums_size = TfLiteIntArrayCreate(1); row_sums_size->data[0] = row_sums_dims[0]; TF_LITE_ENSURE_OK( context, context->ResizeTensor(context, row_sums, row_sums_size)); } } } return kTfLiteOk; } template <KernelType kernel_type> TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { return Prepare(kernel_type, context, node); } template <KernelType kernel_type> void EvalQuantized(TfLiteContext* context, TfLiteNode* node, TfLiteConvParams* params, OpData* data, TfLiteTensor* input, TfLiteTensor* filter, TfLiteTensor* bias, TfLiteTensor* im2col, TfLiteTensor* output) { auto input_offset = -input->params.zero_point; auto filter_offset = -filter->params.zero_point; auto output_offset = output->params.zero_point; KernelType effective_kernel_type; if ((kernel_type == kMultithreadOptimized || kernel_type == kCblasOptimized) && (params->dilation_width_factor != 1 || params->dilation_height_factor != 1)) { // kMultithreadOptimized and kCblasOptimized do not support dilation. // Therefore, fallback to optimized. effective_kernel_type = kGenericOptimized; } else { effective_kernel_type = kernel_type; } ConvParams op_params; op_params.padding_type = PaddingType::kSame; op_params.padding_values.width = data->padding.width; op_params.padding_values.height = data->padding.height; op_params.stride_width = params->stride_width; op_params.stride_height = params->stride_height; op_params.dilation_width_factor = params->dilation_width_factor; op_params.dilation_height_factor = params->dilation_height_factor; op_params.input_offset = input_offset; op_params.weights_offset = filter_offset; op_params.output_offset = output_offset; op_params.output_multiplier = data->output_multiplier; op_params.output_shift = -data->output_shift; op_params.quantized_activation_min = data->output_activation_min; op_params.quantized_activation_max = data->output_activation_max; switch (effective_kernel_type) { case kReference: { reference_ops::Conv( op_params, GetTensorShape(input), GetTensorData<uint8_t>(input), GetTensorShape(filter), GetTensorData<uint8_t>(filter), GetTensorShape(bias), GetTensorData<int32_t>(bias), GetTensorShape(output), GetTensorData<uint8_t>(output), GetTensorShape(im2col), GetTensorData<uint8_t>(im2col), /* cpu_backend_context = */ nullptr); break; } case kGenericOptimized: case kMultithreadOptimized: case kCblasOptimized: { // There is only one optimized implementation for Quantized Conv. optimized_ops::Conv( op_params, GetTensorShape(input), GetTensorData<uint8_t>(input), GetTensorShape(filter), GetTensorData<uint8_t>(filter), GetTensorShape(bias), GetTensorData<int32_t>(bias), GetTensorShape(output), GetTensorData<uint8_t>(output), GetTensorShape(im2col), GetTensorData<uint8_t>(im2col), CpuBackendContext::GetFromContext(context)); break; } } } template <KernelType kernel_type> void EvalQuantizedPerChannel(TfLiteContext* context, TfLiteNode* node, TfLiteConvParams* params, OpData* data, TfLiteTensor* input, TfLiteTensor* filter, TfLiteTensor* bias, TfLiteTensor* output, TfLiteTensor* im2col) { ConvParams op_params; op_params.input_offset = -input->params.zero_point; op_params.output_offset = output->params.zero_point; op_params.stride_height = params->stride_height; op_params.stride_width = params->stride_width; op_params.dilation_height_factor = params->dilation_height_factor; op_params.dilation_width_factor = params->dilation_width_factor; op_params.padding_values.height = data->padding.height; op_params.padding_values.width = data->padding.width; op_params.quantized_activation_min = data->output_activation_min; op_params.quantized_activation_max = data->output_activation_max; switch (kernel_type) { case kReference: { reference_integer_ops::ConvPerChannel( op_params, data->per_channel_output_multiplier.data(), data->per_channel_output_shift.data(), GetTensorShape(input), GetTensorData<int8>(input), GetTensorShape(filter), GetTensorData<int8>(filter), GetTensorShape(bias), GetTensorData<int32>(bias), GetTensorShape(output), GetTensorData<int8>(output)); break; } case kGenericOptimized: case kMultithreadOptimized: case kCblasOptimized: { optimized_integer_ops::ConvPerChannel( op_params, data->per_channel_output_multiplier.data(), data->per_channel_output_shift.data(), GetTensorShape(input), GetTensorData<int8>(input), GetTensorShape(filter), GetTensorData<int8>(filter), GetTensorShape(bias), GetTensorData<int32>(bias), GetTensorShape(output), GetTensorData<int8>(output), GetTensorShape(im2col), GetTensorData<int8>(im2col), CpuBackendContext::GetFromContext(context)); break; } } } template <KernelType kernel_type> void EvalFloat(TfLiteContext* context, TfLiteNode* node, TfLiteConvParams* params, OpData* data, TfLiteTensor* input, TfLiteTensor* filter, TfLiteTensor* bias, TfLiteTensor* im2col, TfLiteTensor* hwcn_weights, TfLiteTensor* output) { float output_activation_min, output_activation_max; CalculateActivationRange(params->activation, &output_activation_min, &output_activation_max); KernelType effective_kernel_type = kernel_type; // Fall back to the optimized path if multi-threaded conv is unsupported. if ((kernel_type == kMultithreadOptimized) && !data->supports_multithreaded_kernel) { effective_kernel_type = kGenericOptimized; } ConvParams op_params; op_params.padding_type = RuntimePaddingType(params->padding); op_params.padding_values.width = data->padding.width; op_params.padding_values.height = data->padding.height; op_params.stride_width = params->stride_width; op_params.stride_height = params->stride_height; op_params.dilation_width_factor = params->dilation_width_factor; op_params.dilation_height_factor = params->dilation_height_factor; op_params.float_activation_min = output_activation_min; op_params.float_activation_max = output_activation_max; switch (effective_kernel_type) { case kReference: { reference_ops::Conv(op_params, GetTensorShape(input), GetTensorData<float>(input), GetTensorShape(filter), GetTensorData<float>(filter), GetTensorShape(bias), GetTensorData<float>(bias), GetTensorShape(output), GetTensorData<float>(output), GetTensorShape(im2col), GetTensorData<float>(im2col)); break; } case kCblasOptimized: case kGenericOptimized: { optimized_ops::Conv(op_params, GetTensorShape(input), GetTensorData<float>(input), GetTensorShape(filter), GetTensorData<float>(filter), GetTensorShape(bias), GetTensorData<float>(bias), GetTensorShape(output), GetTensorData<float>(output), GetTensorShape(im2col), GetTensorData<float>(im2col), CpuBackendContext::GetFromContext(context)); break; } case kMultithreadOptimized: { #ifdef TFLITE_WITH_RUY // See Register_CONV_2D: we should never be here when tflite_with_ruy // was enabled. We #if out this code in order to get the corresponding // binary size benefits. TFLITE_DCHECK(false); #else const float* filter_data; if (data->need_hwcn_weights) { filter_data = GetTensorData<float>(hwcn_weights); } else { filter_data = GetTensorData<float>(filter); } multithreaded_ops::Conv( *eigen_support::GetThreadPoolDevice(context), op_params, GetTensorShape(input), GetTensorData<float>(input), GetTensorShape(filter), filter_data, GetTensorShape(bias), GetTensorData<float>(bias), GetTensorShape(output), GetTensorData<float>(output), GetTensorShape(im2col), GetTensorData<float>(im2col)); break; #endif } } } template <KernelType kernel_type> void EvalHybridPerChannel(TfLiteContext* context, TfLiteNode* node, TfLiteConvParams* params, OpData* data, TfLiteTensor* input, TfLiteTensor* filter, TfLiteTensor* bias, TfLiteTensor* im2col, TfLiteTensor* output) { float output_activation_min, output_activation_max; CalculateActivationRange(params->activation, &output_activation_min, &output_activation_max); const int input_size = NumElements(input) / SizeOfDimension(input, 0); const int batch_size = SizeOfDimension(input, 0); int8_t* quantized_input_ptr_batch = GetTensorData<int8_t>( GetTemporary(context, node, data->input_quantized_index)); float* scaling_factors_ptr = GetTensorData<float>( GetTemporary(context, node, data->scaling_factors_index)); int32_t* input_offset_ptr = GetTensorData<int32_t>( GetTemporary(context, node, data->input_offset_index)); for (int b = 0; b < batch_size; ++b) { const int offset = b * input_size; tensor_utils::AsymmetricQuantizeFloats( GetTensorData<float>(input) + offset, input_size, quantized_input_ptr_batch + offset, &scaling_factors_ptr[b], &input_offset_ptr[b]); } int8_t* im2col_ptr = nullptr; int8_t* filter_ptr = nullptr; if (im2col != nullptr) { im2col_ptr = im2col->data.int8; } filter_ptr = filter->data.int8; const auto* affine_quantization = reinterpret_cast<TfLiteAffineQuantization*>(filter->quantization.params); ConvParams op_params; op_params.padding_type = PaddingType::kSame; op_params.padding_values.width = data->padding.width; op_params.padding_values.height = data->padding.height; op_params.stride_width = params->stride_width; op_params.stride_height = params->stride_height; op_params.dilation_width_factor = 1; op_params.dilation_height_factor = 1; op_params.float_activation_min = output_activation_min; op_params.float_activation_max = output_activation_max; switch (kernel_type) { case kReference: reference_ops::HybridConvPerChannel( op_params, scaling_factors_ptr, GetTensorShape(input), quantized_input_ptr_batch, GetTensorShape(filter), filter_ptr, GetTensorShape(bias), GetTensorData<float>(bias), GetTensorShape(output), GetTensorData<float>(output), GetTensorShape(im2col), im2col_ptr, affine_quantization->scale->data, input_offset_ptr); break; case kGenericOptimized: case kMultithreadOptimized: case kCblasOptimized: { TfLiteTensor* row_sums = GetTemporary(context, node, data->row_sums_index); TfLiteTensor* scratch = GetTemporary(context, node, data->accum_scratch_index); optimized_ops::HybridConvPerChannel( op_params, scaling_factors_ptr, GetTensorShape(input), quantized_input_ptr_batch, GetTensorShape(filter), filter_ptr, GetTensorShape(bias), GetTensorData<float>(bias), GetTensorShape(output), GetTensorData<float>(output), GetTensorShape(im2col), im2col_ptr, affine_quantization->scale->data, input_offset_ptr, GetTensorShape(scratch), GetTensorData<int32>(scratch), GetTensorData<int32_t>(row_sums), &data->compute_hybrid_row_sums, CpuBackendContext::GetFromContext(context)); data->compute_hybrid_row_sums = false; break; } } } template <KernelType kernel_type> void EvalHybrid(TfLiteContext* context, TfLiteNode* node, TfLiteConvParams* params, OpData* data, TfLiteTensor* input, TfLiteTensor* filter, TfLiteTensor* bias, TfLiteTensor* im2col, TfLiteTensor* accum_scratch, TfLiteTensor* output) { float output_activation_min, output_activation_max; CalculateActivationRange(params->activation, &output_activation_min, &output_activation_max); const int input_size = NumElements(input) / SizeOfDimension(input, 0); const int batch_size = SizeOfDimension(input, 0); float* input_ptr = GetTensorData<float>(input); int8_t* quantized_input_ptr_batch = GetTensorData<int8_t>( GetTemporary(context, node, data->input_quantized_index)); float* scaling_factors_ptr = GetTensorData<float>( GetTemporary(context, node, data->scaling_factors_index)); // Per-batch input quantization for higher accuracy. for (int b = 0; b < batch_size; ++b) { float unused_min, unused_max; const int offset = b * input_size; tensor_utils::SymmetricQuantizeFloats( input_ptr + offset, input_size, quantized_input_ptr_batch + offset, &unused_min, &unused_max, &scaling_factors_ptr[b]); scaling_factors_ptr[b] *= filter->params.scale; } switch (kernel_type) { case kReference: case kGenericOptimized: case kMultithreadOptimized: case kCblasOptimized: { // There is only one implementation for hybrid kernel. Note // this does not make use of gemmlowp nor supports multithreading. ConvParams op_params; op_params.padding_type = PaddingType::kSame; op_params.padding_values.width = data->padding.width; op_params.padding_values.height = data->padding.height; op_params.stride_width = params->stride_width; op_params.stride_height = params->stride_height; op_params.dilation_width_factor = 1; op_params.dilation_height_factor = 1; op_params.float_activation_min = output_activation_min; op_params.float_activation_max = output_activation_max; optimized_ops::HybridConv( op_params, scaling_factors_ptr, GetTensorShape(input), quantized_input_ptr_batch, GetTensorShape(filter), GetTensorData<int8_t>(filter), GetTensorShape(bias), GetTensorData<float>(bias), GetTensorShape(accum_scratch), GetTensorData<int32_t>(accum_scratch), GetTensorShape(output), GetTensorData<float>(output), GetTensorShape(im2col), GetTensorData<int8_t>(im2col), CpuBackendContext::GetFromContext(context)); break; } } } template <KernelType kernel_type, TfLiteType input_type> TfLiteStatus EvalImpl(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteConvParams*>(node->builtin_data); OpData* data = reinterpret_cast<OpData*>(node->user_data); TfLiteTensor* output = &context->tensors[node->outputs->data[0]]; TfLiteTensor* input = &context->tensors[node->inputs->data[0]]; TfLiteTensor* filter = &context->tensors[node->inputs->data[1]]; bool has_bias = node->inputs->size == 3; TfLiteTensor* bias = has_bias ? &context->tensors[node->inputs->data[2]] : nullptr; TfLiteTensor* im2col = data->need_im2col ? &context->tensors[node->temporaries->data[data->im2col_index]] : nullptr; TfLiteTensor* hwcn_weights = data->need_hwcn_weights ? &context->tensors[node->temporaries->data[data->hwcn_weights_index]] : nullptr; if (data->need_hwcn_weights && !data->have_weights_been_transposed) { TransposeFloatTensor(filter, hwcn_weights); data->have_weights_been_transposed = true; } TFLITE_DCHECK_EQ(input_type, input->type); switch (input_type) { // Already know in/outtypes are same. case kTfLiteFloat32: if (filter->type == kTfLiteUInt8 || filter->type == kTfLiteInt8) { if (data->is_hybrid_per_channel) { EvalHybridPerChannel<kernel_type>(context, node, params, data, input, filter, bias, im2col, output); } else { TfLiteTensor* accum_scratch = &context->tensors[node->temporaries ->data[data->accum_scratch_index]]; EvalHybrid<kernel_type>(context, node, params, data, input, filter, bias, im2col, accum_scratch, output); } } else { EvalFloat<kernel_type>(context, node, params, data, input, filter, bias, im2col, hwcn_weights, output); } break; case kTfLiteUInt8: EvalQuantized<kernel_type>(context, node, params, data, input, filter, bias, im2col, output); break; case kTfLiteInt8: EvalQuantizedPerChannel<kernel_type>(context, node, params, data, input, filter, bias, output, im2col); break; default: context->ReportError(context, "Type %s currently not supported.", TfLiteTypeGetName(input->type)); return kTfLiteError; } return kTfLiteOk; } template <KernelType kernel_type> TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { TfLiteTensor* input = &context->tensors[node->inputs->data[0]]; switch (input->type) { case kTfLiteFloat32: return EvalImpl<kernel_type, kTfLiteFloat32>(context, node); case kTfLiteUInt8: return EvalImpl<kernel_type, kTfLiteUInt8>(context, node); case kTfLiteInt8: return EvalImpl<kernel_type, kTfLiteInt8>(context, node); default: context->ReportError(context, "Type %d not currently supported.", input->type); return kTfLiteError; } } } // namespace conv TfLiteRegistration* Register_CONVOLUTION_REF() { static TfLiteRegistration r = {conv::Init, conv::Free, conv::Prepare<conv::kReference>, conv::Eval<conv::kReference>}; return &r; } TfLiteRegistration* Register_CONVOLUTION_GENERIC_OPT() { static TfLiteRegistration r = {conv::Init, conv::Free, conv::Prepare<conv::kGenericOptimized>, conv::Eval<conv::kGenericOptimized>}; return &r; } TfLiteRegistration* Register_CONVOLUTION_GENERIC_OPT_UINT8() { static TfLiteRegistration r = { conv::Init, conv::Free, conv::Prepare<conv::kGenericOptimized>, conv::EvalImpl<conv::kGenericOptimized, kTfLiteUInt8>}; return &r; } TfLiteRegistration* Register_CONVOLUTION_MULTITHREADED_OPT() { static TfLiteRegistration r = {conv::Init, conv::Free, conv::Prepare<conv::kMultithreadOptimized>, conv::Eval<conv::kMultithreadOptimized>}; return &r; } TfLiteRegistration* Register_CONVOLUTION_CBLAS_OPT() { static TfLiteRegistration r = {conv::Init, conv::Free, conv::Prepare<conv::kCblasOptimized>, conv::Eval<conv::kCblasOptimized>}; return &r; } TfLiteRegistration* Register_CONV_2D() { #if defined TFLITE_USE_APPLE_ACCELERATE_FOR_CONV return Register_CONVOLUTION_CBLAS_OPT(); #elif defined TFLITE_WITH_RUY // tflite_with_ruy optimizes the generic kernel type. return Register_CONVOLUTION_GENERIC_OPT(); #else return Register_CONVOLUTION_MULTITHREADED_OPT(); #endif } // Warning: Clients using this variant are responsible for ensuring that their // models only need the UINT8 type. TFLite's op registration mechanism doesn't // yet allow for more nuanced registration mechanisms. TfLiteRegistration* Register_CONV_2D_UINT8() { #if defined TFLITE_WITH_RUY // tflite_with_ruy optimizes the generic kernel type. return Register_CONVOLUTION_GENERIC_OPT_UINT8(); #else return Register_CONV_2D(); #endif } } // namespace builtin } // namespace ops } // namespace tflite
{ "content_hash": "0d53b790911201062bf56c43f59c355c", "timestamp": "", "source": "github", "line_count": 1013, "max_line_length": 80, "avg_line_length": 41.98519249753208, "alnum_prop": 0.6693235522324893, "repo_name": "renyi533/tensorflow", "id": "8a3539df8d5c1e20b49a56a94930e311d192a019", "size": "43199", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tensorflow/lite/kernels/conv.cc", "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": "" }
namespace media { class VideoCaptureBufferPool; class VideoFrameReceiver; class VideoCaptureJpegDecoder; using VideoCaptureJpegDecoderFactoryCB = base::OnceCallback<std::unique_ptr<VideoCaptureJpegDecoder>()>; // Implementation of VideoCaptureDevice::Client that uses a buffer pool // to provide buffers and converts incoming data to the I420 format for // consumption by a given VideoFrameReceiver. If // |optional_jpeg_decoder_factory_callback| is provided, the // VideoCaptureDeviceClient will attempt to use it for decoding of MJPEG frames. // Otherwise, it will use libyuv to perform MJPEG to I420 conversion in // software. // // Methods of this class may be called from any thread, and in practice will // often be called on some auxiliary thread depending on the platform and the // device type; including, for example, the DirectShow thread on Windows, the // v4l2_thread on Linux, and the UI thread for tab capture. // The owner is responsible for making sure that the instance outlives these // calls. class CAPTURE_EXPORT VideoCaptureDeviceClient : public VideoCaptureDevice::Client { public: #if BUILDFLAG(IS_CHROMEOS_ASH) VideoCaptureDeviceClient( VideoCaptureBufferType target_buffer_type, std::unique_ptr<VideoFrameReceiver> receiver, scoped_refptr<VideoCaptureBufferPool> buffer_pool, VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback); #else VideoCaptureDeviceClient(VideoCaptureBufferType target_buffer_type, std::unique_ptr<VideoFrameReceiver> receiver, scoped_refptr<VideoCaptureBufferPool> buffer_pool); #endif // BUILDFLAG(IS_CHROMEOS_ASH) VideoCaptureDeviceClient(const VideoCaptureDeviceClient&) = delete; VideoCaptureDeviceClient& operator=(const VideoCaptureDeviceClient&) = delete; ~VideoCaptureDeviceClient() override; static Buffer MakeBufferStruct( scoped_refptr<VideoCaptureBufferPool> buffer_pool, int buffer_id, int frame_feedback_id); // VideoCaptureDevice::Client implementation. // TODO(crbug.com/978143): remove |frame_feedback_id| default value. void OnIncomingCapturedData(const uint8_t* data, int length, const VideoCaptureFormat& frame_format, const gfx::ColorSpace& color_space, int clockwise_rotation, bool flip_y, base::TimeTicks reference_time, base::TimeDelta timestamp, int frame_feedback_id = 0) override; // TODO(crbug.com/978143): remove |frame_feedback_id| default value. void OnIncomingCapturedGfxBuffer(gfx::GpuMemoryBuffer* buffer, const VideoCaptureFormat& frame_format, int clockwise_rotation, base::TimeTicks reference_time, base::TimeDelta timestamp, int frame_feedback_id = 0) override; void OnIncomingCapturedExternalBuffer( CapturedExternalVideoBuffer buffer, std::vector<CapturedExternalVideoBuffer> scaled_buffers, base::TimeTicks reference_time, base::TimeDelta timestamp) override; ReserveResult ReserveOutputBuffer(const gfx::Size& dimensions, VideoPixelFormat format, int frame_feedback_id, Buffer* buffer) override; void OnIncomingCapturedBuffer(Buffer buffer, const VideoCaptureFormat& format, base::TimeTicks reference_time, base::TimeDelta timestamp) override; void OnIncomingCapturedBufferExt( Buffer buffer, const VideoCaptureFormat& format, const gfx::ColorSpace& color_space, base::TimeTicks reference_time, base::TimeDelta timestamp, gfx::Rect visible_rect, const VideoFrameMetadata& additional_metadata) override; void OnError(VideoCaptureError error, const base::Location& from_here, const std::string& reason) override; void OnFrameDropped(VideoCaptureFrameDropReason reason) override; void OnLog(const std::string& message) override; void OnStarted() override; double GetBufferPoolUtilization() const override; private: ReadyFrameInBuffer CreateReadyFrameFromExternalBuffer( CapturedExternalVideoBuffer buffer, base::TimeTicks reference_time, base::TimeDelta timestamp); // A branch of OnIncomingCapturedData for Y16 frame_format.pixel_format. void OnIncomingCapturedY16Data(const uint8_t* data, int length, const VideoCaptureFormat& frame_format, base::TimeTicks reference_time, base::TimeDelta timestamp, int frame_feedback_id); const VideoCaptureBufferType target_buffer_type_; // The receiver to which we post events. const std::unique_ptr<VideoFrameReceiver> receiver_; std::vector<int> buffer_ids_known_by_receiver_; #if BUILDFLAG(IS_CHROMEOS_ASH) VideoCaptureJpegDecoderFactoryCB optional_jpeg_decoder_factory_callback_; std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_; base::OnceClosure on_started_using_gpu_cb_; #endif // BUILDFLAG(IS_CHROMEOS_ASH) // The pool of shared-memory buffers used for capturing. const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; VideoPixelFormat last_captured_pixel_format_; // Thread collision warner to ensure that producer-facing API is not called // concurrently. Producers are allowed to call from multiple threads, but not // concurrently. DFAKE_MUTEX(call_from_producer_); }; } // namespace media #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_
{ "content_hash": "e5e8e08269f0a4580878a843c40e3728", "timestamp": "", "source": "github", "line_count": 134, "max_line_length": 80, "avg_line_length": 44.90298507462686, "alnum_prop": 0.6681070300814359, "repo_name": "youtube/cobalt", "id": "f57f2d139f835951ccf6b92621579a1680d3c541", "size": "6684", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "third_party/chromium/media/capture/video/video_capture_device_client.h", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
.class public Landroid/view/VolumePanel$StreamControl; .super Ljava/lang/Object; .source "VolumePanel.java" # annotations .annotation system Ldalvik/annotation/EnclosingClass; value = Landroid/view/VolumePanel; .end annotation .annotation system Ldalvik/annotation/InnerClass; accessFlags = 0x4 name = "StreamControl" .end annotation # instance fields .field group:Landroid/view/ViewGroup; .field icon:Landroid/widget/ImageView; .field iconMuteRes:I .field iconRes:I .field seekbarView:Landroid/widget/SeekBar; .field streamType:I .field final synthetic this$0:Landroid/view/VolumePanel; # direct methods .method protected constructor <init>(Landroid/view/VolumePanel;)V .locals 0 .parameter .prologue .line 214 iput-object p1, p0, Landroid/view/VolumePanel$StreamControl;->this$0:Landroid/view/VolumePanel; invoke-direct {p0}, Ljava/lang/Object;-><init>()V return-void .end method .method synthetic constructor <init>(Landroid/view/VolumePanel;Landroid/view/VolumePanel$1;)V .locals 0 .parameter "x0" .parameter "x1" .prologue .line 214 invoke-direct {p0, p1}, Landroid/view/VolumePanel$StreamControl;-><init>(Landroid/view/VolumePanel;)V return-void .end method
{ "content_hash": "db9b145bc95db2b40b64778bd45b3159", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 105, "avg_line_length": 21.94736842105263, "alnum_prop": 0.7442046362909672, "repo_name": "baidurom/devices-g520", "id": "2d2caddd24d97478ffb1a53a6843bd1a6dec9396", "size": "1251", "binary": false, "copies": "1", "ref": "refs/heads/coron-4.1", "path": "secondary-framework.jar.out/smali/android/view/VolumePanel$StreamControl.smali", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Makefile", "bytes": "12575" }, { "name": "Python", "bytes": "1261" }, { "name": "Shell", "bytes": "2159" } ], "symlink_target": "" }
package my.modules.web.user.validation; import my.modules.web.user.model.PasswordConfirmation; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * This class allocates the validator implementation to check two passwords. * * @author Kai Paroth */ public class PasswordMatchesValidator implements ConstraintValidator<MatchesPassword, Object> { /** * {@inheritDoc}. * * @see ConstraintValidator#initialize(java.lang.annotation.Annotation) */ @Override public void initialize(final MatchesPassword constraintAnnotation) { } /** * {@inheritDoc}. * * @see ConstraintValidator#isValid(Object, ConstraintValidatorContext) */ @Override public boolean isValid(final Object o, final ConstraintValidatorContext constraintValidatorContext) { if (null != o && o instanceof PasswordConfirmation) { PasswordConfirmation user = (PasswordConfirmation) o; return null != user.getPassword() && user.getPassword().equals(user.getPasswordConfirm()); } return false; } }
{ "content_hash": "4d52a0cbf3837a58b61c78a94718f4ac", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 105, "avg_line_length": 29, "alnum_prop": 0.7055702917771883, "repo_name": "kparoth/my-modules", "id": "3c6bcaa2571a014465132b2ba5b5a4128450053e", "size": "1131", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "my-modules-core/src/main/java/my/modules/web/user/validation/PasswordMatchesValidator.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "612" }, { "name": "FreeMarker", "bytes": "683" }, { "name": "Java", "bytes": "272705" }, { "name": "Shell", "bytes": "789" } ], "symlink_target": "" }
/* ************************************************ * GEANT4 VCGLIB/CAD INTERFACE - basic example * * File: PhysicsList.hh * * Author: Christopher M Poole, * Email: mail@christopherpoole.net * * Date: 20th March, 2011 **************************************************/ #ifndef PhysicsList_h #define PhysicsList_h 1 // GEANT4 // #include "globals.hh" #include "G4VModularPhysicsList.hh" class PhysicsList: public G4VModularPhysicsList { public: PhysicsList(); ~PhysicsList(); protected: void ConstructParticle(); void ConstructProcess(); void SetCuts(); }; #endif
{ "content_hash": "eb3fc9bd381a8759f59b33f969ab554b", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 52, "avg_line_length": 19.545454545454547, "alnum_prop": 0.537984496124031, "repo_name": "Kohlrabi/CADMesh", "id": "32991df178ca9ddefaf33228a4b699ee6fa402e8", "size": "645", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/basic/include/PhysicsList.hh", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "13510" }, { "name": "CMake", "bytes": "7430" } ], "symlink_target": "" }
require "spec_helper" require "savon/mock/spec_helper" describe Zanders::Address do include Savon::SpecHelper before(:all) { savon.mock! } after(:all) { savon.unmock! } let(:credentials) { { username: 'login', password: 'password' } } let(:address) { Zanders::Address.new(credentials) } let(:address_hash) do { name: 'Mindhunters', address1: '100 Pongo Dog Rd', address2: '', city: 'Plano', state: 'TX', zip: '12345', fflno: '10000008', fflexp: '2019-09-01' } end describe '#ship_to_number' do let(:ship_to_addresses) { FixtureHelper.get_fixture_file('ship_to_addresses.xml').read } it 'should have the correct `ship_to_number`' do savon.expects(:use_ship_to).with(message: :any).returns(ship_to_addresses) number = address.ship_to_number(address_hash) expect(number[:success]).to eq(true) expect(number[:ship_to_number]).to eq("9993") end end end
{ "content_hash": "4b09423408ed23d6f871dc9d7ff44abf", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 92, "avg_line_length": 26.10810810810811, "alnum_prop": 0.6283643892339544, "repo_name": "ammoready/zanders", "id": "d0e1adaf1e56fffa3b2501949500bc92d7e88345", "size": "966", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/zanders/address_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "33069" }, { "name": "Shell", "bytes": "131" } ], "symlink_target": "" }
package tech.unstable.mineQuery.jsHelers.events.world; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.BlockEvent.BreakEvent; import net.minecraftforge.event.world.BlockEvent.CreateFluidSourceEvent; import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent; import net.minecraftforge.event.world.BlockEvent.MultiPlaceEvent; import net.minecraftforge.event.world.BlockEvent.NeighborNotifyEvent; import net.minecraftforge.event.world.BlockEvent.PlaceEvent; import tech.unstable.mineQuery.jsHelers.JsBlock; import tech.unstable.mineQuery.jsHelers.events.JsEvent; public class JsBlockEvent extends JsEvent { public final JsBlock block; public JsBlockEvent(BlockEvent event){ super("block", event); block = new JsBlock(event.getState(), event.getWorld(), event.getPos()); } private JsBlockEvent(BlockEvent event, String eventName){ super(eventName, event); block = new JsBlock(event.getState(), event.getWorld(), event.getPos()); } private int getOffsetPos(int x1, String x2){ if ( x2.lastIndexOf("~") >= 0){ x2 = x2.replaceAll("~",""); if (x2.length() == 0) { return x1; } int dif = Integer.parseInt(x2); return x1 + dif; } else { return Integer.parseInt(x2); } } private boolean between(int x1, int x2, int check){ return Math.min(x1, x2) <= check && check <= Math.max(x1, x2); } @Override public boolean evalSelector(String selector){ if (selector.matches("\\[" + block.x + "," + block.y + "," + block.z + "]")){ // Chords selector return true; } if (selector.matches("\\[[\\d\\-]*,[\\d\\-]*,[\\d\\-]*\\]:to\\[[\\d\\+~\\-]*,[\\d\\+~\\-]*,[\\d\\+~\\-]*\\]")) { // Choords range selector String[] chords = selector.substring(1,selector.length()-1).split("[\\[\\],:to]+", 6); int[] pos = new int[6]; pos[0] = Integer.parseInt(chords[0]); pos[1] = Integer.parseInt(chords[1]); pos[2] = Integer.parseInt(chords[2]); //Other side pos[3] = getOffsetPos(pos[0], chords[3]); pos[4] = getOffsetPos(pos[1], chords[4]); pos[5] = getOffsetPos(pos[2], chords[5]); return between(pos[0], pos[3], block.x) && between(pos[1], pos[4], block.y) && between(pos[2], pos[5], block.z); } if (("@" + block.registryName + ":" + block.meta).contains(selector)){ // Mod + Block? + meta? selector return true; } return super.evalSelector(selector); } @Override public Object getValidSelector(){ return block; } public class JsHarvestDropsEvent extends JsBlockEvent{ public JsHarvestDropsEvent(HarvestDropsEvent event){ super(event, "harvent"); } } public class JsBreakEvent extends JsBlockEvent{ public JsBreakEvent(BreakEvent event){ super(event, "break"); } @Override public boolean evalSelector(String selector){ return super.evalSelector(selector); } } public class JsPlaceEvent extends JsBlockEvent{ public JsPlaceEvent(PlaceEvent event){ super(event, "place"); } } public class JsMultiPlaceEvent extends JsBlockEvent{ public JsMultiPlaceEvent(MultiPlaceEvent event){ super(event, "multiplace"); } } public class JsNeighborNotifyEvent extends JsBlockEvent{ public JsNeighborNotifyEvent(NeighborNotifyEvent event){ super(event, "notify"); } } public class JsCreateFluidSourceEvent extends JsBlockEvent{ public JsCreateFluidSourceEvent(CreateFluidSourceEvent event){ super(event, "createsource"); } } }
{ "content_hash": "9ea80ca864ca89a0df6b0266095dc0a9", "timestamp": "", "source": "github", "line_count": 129, "max_line_length": 142, "avg_line_length": 27.86046511627907, "alnum_prop": 0.6597106288258208, "repo_name": "cody-code-wy/MineQuery", "id": "66f3010868023067c725ff678c494f7360cb36db", "size": "3594", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/tech/unstable/mineQuery/jsHelers/events/world/JsBlockEvent.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "15835" } ], "symlink_target": "" }
<!-- ~ Copyright (c) 2017 Antony Esik ~ ~ 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. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>camunda-task-dispatcher</artifactId> <groupId>com.ae.camunda</groupId> <version>1.5.5-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>camunda-task-dispatcher-example-jms-json</artifactId> <packaging>pom</packaging> <name>camunda-task-dispatcher-example-jms-json</name> <url>http://maven.apache.org</url> <modules> <module>camuda-task-dispatcher-example-jms-json-dispatcher</module> <module>camunda-task-dispatcher-example-jms-json-processor</module> </modules> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${version.spring.framework}</version> </dependency> </dependencies> </project>
{ "content_hash": "d9a15775888c2150a24e1da1166e235a", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 108, "avg_line_length": 37.51020408163265, "alnum_prop": 0.6789989118607181, "repo_name": "EsikAntony/camunda-task-dispatcher", "id": "36f90280fdb11c733e0a568478c7df66c4177728", "size": "1838", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/camunda-task-dispatcher-example-jms-json/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "183644" } ], "symlink_target": "" }
namespace rocksdb { ColumnFamilyOptions::ColumnFamilyOptions() : comparator(BytewiseComparator()), merge_operator(nullptr), compaction_filter(nullptr), compaction_filter_factory(std::shared_ptr<CompactionFilterFactory>( new DefaultCompactionFilterFactory())), compaction_filter_factory_v2(new DefaultCompactionFilterFactoryV2()), write_buffer_size(4 << 20), max_write_buffer_number(2), min_write_buffer_number_to_merge(1), compression(kSnappyCompression), prefix_extractor(nullptr), num_levels(7), level0_file_num_compaction_trigger(4), level0_slowdown_writes_trigger(20), level0_stop_writes_trigger(24), max_mem_compaction_level(2), target_file_size_base(2 * 1048576), target_file_size_multiplier(1), max_bytes_for_level_base(10 * 1048576), max_bytes_for_level_multiplier(10), max_bytes_for_level_multiplier_additional(num_levels, 1), expanded_compaction_factor(25), source_compaction_factor(1), max_grandparent_overlap_factor(10), soft_rate_limit(0.0), hard_rate_limit(0.0), rate_limit_delay_max_milliseconds(1000), arena_block_size(0), disable_auto_compactions(false), purge_redundant_kvs_while_flush(true), compaction_style(kCompactionStyleLevel), verify_checksums_in_compaction(true), filter_deletes(false), max_sequential_skip_in_iterations(8), memtable_factory(std::shared_ptr<SkipListFactory>(new SkipListFactory)), table_factory( std::shared_ptr<TableFactory>(new BlockBasedTableFactory())), inplace_update_support(false), inplace_update_num_locks(10000), inplace_callback(nullptr), memtable_prefix_bloom_bits(0), memtable_prefix_bloom_probes(6), memtable_prefix_bloom_huge_page_tlb_size(0), bloom_locality(0), max_successive_merges(0), min_partial_merge_operands(2) { assert(memtable_factory.get() != nullptr); } ColumnFamilyOptions::ColumnFamilyOptions(const Options& options) : comparator(options.comparator), merge_operator(options.merge_operator), compaction_filter(options.compaction_filter), compaction_filter_factory(options.compaction_filter_factory), compaction_filter_factory_v2(options.compaction_filter_factory_v2), write_buffer_size(options.write_buffer_size), max_write_buffer_number(options.max_write_buffer_number), min_write_buffer_number_to_merge( options.min_write_buffer_number_to_merge), compression(options.compression), compression_per_level(options.compression_per_level), compression_opts(options.compression_opts), prefix_extractor(options.prefix_extractor), num_levels(options.num_levels), level0_file_num_compaction_trigger( options.level0_file_num_compaction_trigger), level0_slowdown_writes_trigger(options.level0_slowdown_writes_trigger), level0_stop_writes_trigger(options.level0_stop_writes_trigger), max_mem_compaction_level(options.max_mem_compaction_level), target_file_size_base(options.target_file_size_base), target_file_size_multiplier(options.target_file_size_multiplier), max_bytes_for_level_base(options.max_bytes_for_level_base), max_bytes_for_level_multiplier(options.max_bytes_for_level_multiplier), max_bytes_for_level_multiplier_additional( options.max_bytes_for_level_multiplier_additional), expanded_compaction_factor(options.expanded_compaction_factor), source_compaction_factor(options.source_compaction_factor), max_grandparent_overlap_factor(options.max_grandparent_overlap_factor), soft_rate_limit(options.soft_rate_limit), hard_rate_limit(options.hard_rate_limit), rate_limit_delay_max_milliseconds( options.rate_limit_delay_max_milliseconds), arena_block_size(options.arena_block_size), disable_auto_compactions(options.disable_auto_compactions), purge_redundant_kvs_while_flush(options.purge_redundant_kvs_while_flush), compaction_style(options.compaction_style), verify_checksums_in_compaction(options.verify_checksums_in_compaction), compaction_options_universal(options.compaction_options_universal), compaction_options_fifo(options.compaction_options_fifo), filter_deletes(options.filter_deletes), max_sequential_skip_in_iterations( options.max_sequential_skip_in_iterations), memtable_factory(options.memtable_factory), table_factory(options.table_factory), table_properties_collector_factories( options.table_properties_collector_factories), inplace_update_support(options.inplace_update_support), inplace_update_num_locks(options.inplace_update_num_locks), inplace_callback(options.inplace_callback), memtable_prefix_bloom_bits(options.memtable_prefix_bloom_bits), memtable_prefix_bloom_probes(options.memtable_prefix_bloom_probes), memtable_prefix_bloom_huge_page_tlb_size( options.memtable_prefix_bloom_huge_page_tlb_size), bloom_locality(options.bloom_locality), max_successive_merges(options.max_successive_merges), min_partial_merge_operands(options.min_partial_merge_operands) { assert(memtable_factory.get() != nullptr); if (max_bytes_for_level_multiplier_additional.size() < static_cast<unsigned int>(num_levels)) { max_bytes_for_level_multiplier_additional.resize(num_levels, 1); } } DBOptions::DBOptions() : create_if_missing(false), create_missing_column_families(false), error_if_exists(false), paranoid_checks(true), env(Env::Default()), rate_limiter(nullptr), info_log(nullptr), info_log_level(INFO_LEVEL), max_open_files(5000), max_total_wal_size(0), statistics(nullptr), disableDataSync(false), use_fsync(false), db_log_dir(""), wal_dir(""), delete_obsolete_files_period_micros(6 * 60 * 60 * 1000000UL), max_background_compactions(1), max_background_flushes(1), max_log_file_size(0), log_file_time_to_roll(0), keep_log_file_num(1000), max_manifest_file_size(std::numeric_limits<uint64_t>::max()), table_cache_numshardbits(4), table_cache_remove_scan_count_limit(16), WAL_ttl_seconds(0), WAL_size_limit_MB(0), manifest_preallocation_size(4 * 1024 * 1024), allow_os_buffer(true), allow_mmap_reads(false), allow_mmap_writes(false), is_fd_close_on_exec(true), skip_log_error_on_recovery(false), stats_dump_period_sec(3600), advise_random_on_open(true), access_hint_on_compaction_start(NORMAL), use_adaptive_mutex(false), allow_thread_local(true), bytes_per_sync(0) {} DBOptions::DBOptions(const Options& options) : create_if_missing(options.create_if_missing), create_missing_column_families(options.create_missing_column_families), error_if_exists(options.error_if_exists), paranoid_checks(options.paranoid_checks), env(options.env), rate_limiter(options.rate_limiter), info_log(options.info_log), info_log_level(options.info_log_level), max_open_files(options.max_open_files), max_total_wal_size(options.max_total_wal_size), statistics(options.statistics), disableDataSync(options.disableDataSync), use_fsync(options.use_fsync), db_paths(options.db_paths), db_log_dir(options.db_log_dir), wal_dir(options.wal_dir), delete_obsolete_files_period_micros( options.delete_obsolete_files_period_micros), max_background_compactions(options.max_background_compactions), max_background_flushes(options.max_background_flushes), max_log_file_size(options.max_log_file_size), log_file_time_to_roll(options.log_file_time_to_roll), keep_log_file_num(options.keep_log_file_num), max_manifest_file_size(options.max_manifest_file_size), table_cache_numshardbits(options.table_cache_numshardbits), table_cache_remove_scan_count_limit( options.table_cache_remove_scan_count_limit), WAL_ttl_seconds(options.WAL_ttl_seconds), WAL_size_limit_MB(options.WAL_size_limit_MB), manifest_preallocation_size(options.manifest_preallocation_size), allow_os_buffer(options.allow_os_buffer), allow_mmap_reads(options.allow_mmap_reads), allow_mmap_writes(options.allow_mmap_writes), is_fd_close_on_exec(options.is_fd_close_on_exec), skip_log_error_on_recovery(options.skip_log_error_on_recovery), stats_dump_period_sec(options.stats_dump_period_sec), advise_random_on_open(options.advise_random_on_open), access_hint_on_compaction_start(options.access_hint_on_compaction_start), use_adaptive_mutex(options.use_adaptive_mutex), allow_thread_local(options.allow_thread_local), bytes_per_sync(options.bytes_per_sync) {} static const char* const access_hints[] = { "NONE", "NORMAL", "SEQUENTIAL", "WILLNEED" }; void DBOptions::Dump(Logger* log) const { Log(log," Options.error_if_exists: %d", error_if_exists); Log(log," Options.create_if_missing: %d", create_if_missing); Log(log," Options.paranoid_checks: %d", paranoid_checks); Log(log," Options.env: %p", env); Log(log," Options.info_log: %p", info_log.get()); Log(log," Options.max_open_files: %d", max_open_files); Log(log," Options.max_total_wal_size: %" PRIu64, max_total_wal_size); Log(log, " Options.disableDataSync: %d", disableDataSync); Log(log, " Options.use_fsync: %d", use_fsync); Log(log, " Options.max_log_file_size: %zu", max_log_file_size); Log(log, "Options.max_manifest_file_size: %lu", (unsigned long)max_manifest_file_size); Log(log, " Options.log_file_time_to_roll: %zu", log_file_time_to_roll); Log(log, " Options.keep_log_file_num: %zu", keep_log_file_num); Log(log, " Options.allow_os_buffer: %d", allow_os_buffer); Log(log, " Options.allow_mmap_reads: %d", allow_mmap_reads); Log(log, " Options.allow_mmap_writes: %d", allow_mmap_writes); Log(log, " Options.create_missing_column_families: %d", create_missing_column_families); Log(log, " Options.db_log_dir: %s", db_log_dir.c_str()); Log(log, " Options.wal_dir: %s", wal_dir.c_str()); Log(log, " Options.table_cache_numshardbits: %d", table_cache_numshardbits); Log(log, " Options.table_cache_remove_scan_count_limit: %d", table_cache_remove_scan_count_limit); Log(log, " Options.delete_obsolete_files_period_micros: %lu", (unsigned long)delete_obsolete_files_period_micros); Log(log, " Options.max_background_compactions: %d", max_background_compactions); Log(log, " Options.max_background_flushes: %d", max_background_flushes); Log(log, " Options.WAL_ttl_seconds: %lu", (unsigned long)WAL_ttl_seconds); Log(log, " Options.WAL_size_limit_MB: %lu", (unsigned long)WAL_size_limit_MB); Log(log, " Options.manifest_preallocation_size: %zu", manifest_preallocation_size); Log(log, " Options.allow_os_buffer: %d", allow_os_buffer); Log(log, " Options.allow_mmap_reads: %d", allow_mmap_reads); Log(log, " Options.allow_mmap_writes: %d", allow_mmap_writes); Log(log, " Options.is_fd_close_on_exec: %d", is_fd_close_on_exec); Log(log, " Options.skip_log_error_on_recovery: %d", skip_log_error_on_recovery); Log(log, " Options.stats_dump_period_sec: %u", stats_dump_period_sec); Log(log, " Options.advise_random_on_open: %d", advise_random_on_open); Log(log, " Options.access_hint_on_compaction_start: %s", access_hints[access_hint_on_compaction_start]); Log(log, " Options.use_adaptive_mutex: %d", use_adaptive_mutex); Log(log, " Options.rate_limiter: %p", rate_limiter.get()); Log(log, " Options.bytes_per_sync: %lu", (unsigned long)bytes_per_sync); } // DBOptions::Dump void ColumnFamilyOptions::Dump(Logger* log) const { Log(log, " Options.comparator: %s", comparator->Name()); Log(log, " Options.merge_operator: %s", merge_operator ? merge_operator->Name() : "None"); Log(log, " Options.compaction_filter: %s", compaction_filter ? compaction_filter->Name() : "None"); Log(log, " Options.compaction_filter_factory: %s", compaction_filter_factory->Name()); Log(log, " Options.compaction_filter_factory_v2: %s", compaction_filter_factory_v2->Name()); Log(log, " Options.memtable_factory: %s", memtable_factory->Name()); Log(log, " Options.table_factory: %s", table_factory->Name()); Log(log, " table_factory options: %s", table_factory->GetPrintableTableOptions().c_str()); Log(log, " Options.write_buffer_size: %zd", write_buffer_size); Log(log, " Options.max_write_buffer_number: %d", max_write_buffer_number); if (!compression_per_level.empty()) { for (unsigned int i = 0; i < compression_per_level.size(); i++) { Log(log," Options.compression[%d]: %d", i, compression_per_level[i]); } } else { Log(log," Options.compression: %d", compression); } Log(log," Options.prefix_extractor: %s", prefix_extractor == nullptr ? "nullptr" : prefix_extractor->Name()); Log(log," Options.num_levels: %d", num_levels); Log(log," Options.min_write_buffer_number_to_merge: %d", min_write_buffer_number_to_merge); Log(log," Options.purge_redundant_kvs_while_flush: %d", purge_redundant_kvs_while_flush); Log(log," Options.compression_opts.window_bits: %d", compression_opts.window_bits); Log(log," Options.compression_opts.level: %d", compression_opts.level); Log(log," Options.compression_opts.strategy: %d", compression_opts.strategy); Log(log," Options.level0_file_num_compaction_trigger: %d", level0_file_num_compaction_trigger); Log(log," Options.level0_slowdown_writes_trigger: %d", level0_slowdown_writes_trigger); Log(log," Options.level0_stop_writes_trigger: %d", level0_stop_writes_trigger); Log(log," Options.max_mem_compaction_level: %d", max_mem_compaction_level); Log(log," Options.target_file_size_base: %d", target_file_size_base); Log(log," Options.target_file_size_multiplier: %d", target_file_size_multiplier); Log(log," Options.max_bytes_for_level_base: %lu", (unsigned long)max_bytes_for_level_base); Log(log," Options.max_bytes_for_level_multiplier: %d", max_bytes_for_level_multiplier); for (int i = 0; i < num_levels; i++) { Log(log,"Options.max_bytes_for_level_multiplier_addtl[%d]: %d", i, max_bytes_for_level_multiplier_additional[i]); } Log(log," Options.max_sequential_skip_in_iterations: %lu", (unsigned long)max_sequential_skip_in_iterations); Log(log," Options.expanded_compaction_factor: %d", expanded_compaction_factor); Log(log," Options.source_compaction_factor: %d", source_compaction_factor); Log(log," Options.max_grandparent_overlap_factor: %d", max_grandparent_overlap_factor); Log(log," Options.arena_block_size: %zu", arena_block_size); Log(log," Options.soft_rate_limit: %.2f", soft_rate_limit); Log(log," Options.hard_rate_limit: %.2f", hard_rate_limit); Log(log," Options.rate_limit_delay_max_milliseconds: %u", rate_limit_delay_max_milliseconds); Log(log," Options.disable_auto_compactions: %d", disable_auto_compactions); Log(log," Options.purge_redundant_kvs_while_flush: %d", purge_redundant_kvs_while_flush); Log(log," Options.filter_deletes: %d", filter_deletes); Log(log, " Options.verify_checksums_in_compaction: %d", verify_checksums_in_compaction); Log(log," Options.compaction_style: %d", compaction_style); Log(log," Options.compaction_options_universal.size_ratio: %u", compaction_options_universal.size_ratio); Log(log,"Options.compaction_options_universal.min_merge_width: %u", compaction_options_universal.min_merge_width); Log(log,"Options.compaction_options_universal.max_merge_width: %u", compaction_options_universal.max_merge_width); Log(log,"Options.compaction_options_universal." "max_size_amplification_percent: %u", compaction_options_universal.max_size_amplification_percent); Log(log, "Options.compaction_options_universal.compression_size_percent: %u", compaction_options_universal.compression_size_percent); Log(log, "Options.compaction_options_fifo.max_table_files_size: %" PRIu64, compaction_options_fifo.max_table_files_size); std::string collector_names; for (const auto& collector_factory : table_properties_collector_factories) { collector_names.append(collector_factory->Name()); collector_names.append("; "); } Log(log, " Options.table_properties_collectors: %s", collector_names.c_str()); Log(log, " Options.inplace_update_support: %d", inplace_update_support); Log(log, " Options.inplace_update_num_locks: %zd", inplace_update_num_locks); Log(log, " Options.min_partial_merge_operands: %u", min_partial_merge_operands); // TODO: easier config for bloom (maybe based on avg key/value size) Log(log, " Options.memtable_prefix_bloom_bits: %d", memtable_prefix_bloom_bits); Log(log, " Options.memtable_prefix_bloom_probes: %d", memtable_prefix_bloom_probes); Log(log, " Options.memtable_prefix_bloom_huge_page_tlb_size: %zu", memtable_prefix_bloom_huge_page_tlb_size); Log(log, " Options.bloom_locality: %d", bloom_locality); Log(log, " Options.max_successive_merges: %zd", max_successive_merges); } // ColumnFamilyOptions::Dump void Options::Dump(Logger* log) const { DBOptions::Dump(log); ColumnFamilyOptions::Dump(log); } // Options::Dump // // The goal of this method is to create a configuration that // allows an application to write all files into L0 and // then do a single compaction to output all files into L1. Options* Options::PrepareForBulkLoad() { // never slowdown ingest. level0_file_num_compaction_trigger = (1<<30); level0_slowdown_writes_trigger = (1<<30); level0_stop_writes_trigger = (1<<30); // no auto compactions please. The application should issue a // manual compaction after all data is loaded into L0. disable_auto_compactions = true; disableDataSync = true; // A manual compaction run should pick all files in L0 in // a single compaction run. source_compaction_factor = (1<<30); // It is better to have only 2 levels, otherwise a manual // compaction would compact at every possible level, thereby // increasing the total time needed for compactions. num_levels = 2; // Prevent a memtable flush to automatically promote files // to L1. This is helpful so that all files that are // input to the manual compaction are all at L0. max_background_compactions = 2; // The compaction would create large files in L1. target_file_size_base = 256 * 1024 * 1024; return this; } // Optimization functions ColumnFamilyOptions* ColumnFamilyOptions::OptimizeForPointLookup( uint64_t block_cache_size_mb) { prefix_extractor.reset(NewNoopTransform()); BlockBasedTableOptions block_based_options; block_based_options.index_type = BlockBasedTableOptions::kHashSearch; block_based_options.filter_policy.reset(NewBloomFilterPolicy(10)); block_based_options.block_cache = NewLRUCache(block_cache_size_mb * 1024 * 1024); table_factory.reset(new BlockBasedTableFactory(block_based_options)); #ifndef ROCKSDB_LITE memtable_factory.reset(NewHashLinkListRepFactory()); #endif return this; } ColumnFamilyOptions* ColumnFamilyOptions::OptimizeLevelStyleCompaction( uint64_t memtable_memory_budget) { write_buffer_size = memtable_memory_budget / 4; // merge two memtables when flushing to L0 min_write_buffer_number_to_merge = 2; // this means we'll use 50% extra memory in the worst case, but will reduce // write stalls. max_write_buffer_number = 6; // start flushing L0->L1 as soon as possible. each file on level0 is // (memtable_memory_budget / 2). This will flush level 0 when it's bigger than // memtable_memory_budget. level0_file_num_compaction_trigger = 2; // doesn't really matter much, but we don't want to create too many files target_file_size_base = memtable_memory_budget / 8; // make Level1 size equal to Level0 size, so that L0->L1 compactions are fast max_bytes_for_level_base = memtable_memory_budget; // level style compaction compaction_style = kCompactionStyleLevel; // only compress levels >= 2 compression_per_level.resize(num_levels); for (int i = 0; i < num_levels; ++i) { if (i < 2) { compression_per_level[i] = kNoCompression; } else { compression_per_level[i] = kSnappyCompression; } } return this; } ColumnFamilyOptions* ColumnFamilyOptions::OptimizeUniversalStyleCompaction( uint64_t memtable_memory_budget) { write_buffer_size = memtable_memory_budget / 4; // merge two memtables when flushing to L0 min_write_buffer_number_to_merge = 2; // this means we'll use 50% extra memory in the worst case, but will reduce // write stalls. max_write_buffer_number = 6; // universal style compaction compaction_style = kCompactionStyleUniversal; compaction_options_universal.compression_size_percent = 80; return this; } DBOptions* DBOptions::IncreaseParallelism(int total_threads) { max_background_compactions = total_threads - 1; max_background_flushes = 1; env->SetBackgroundThreads(total_threads, Env::LOW); env->SetBackgroundThreads(1, Env::HIGH); return this; } } // namespace rocksdb
{ "content_hash": "533163cf521c0d2aa9fef3255a2dce6f", "timestamp": "", "source": "github", "line_count": 502, "max_line_length": 80, "avg_line_length": 45.99402390438247, "alnum_prop": 0.6503529819394517, "repo_name": "tschottdorf/rocksdb", "id": "b16c6f2f57ad77ef8a355bbbb2c3bf3574ad7dd5", "size": "24097", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "util/options.cc", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "81059" }, { "name": "C++", "bytes": "3330735" }, { "name": "CSS", "bytes": "1127" }, { "name": "Java", "bytes": "249689" }, { "name": "Objective-C", "bytes": "2945" }, { "name": "PHP", "bytes": "12341" }, { "name": "Python", "bytes": "187768" }, { "name": "Shell", "bytes": "45770" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "b902a6d9938ac2c84a824cd8898a1b60", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "4f28a513cc97b0b460d2a4e094a109db14941b64", "size": "189", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Rosales/Rhamnaceae/Rhamnus/Rhamnus rubra/Rhamnus rubra typica/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "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 (1.8.0_212) on Sun Jan 26 10:16:10 PST 2020 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class org.apache.guacamole.GuacamoleResourceConflictException (guacamole-common 1.1.0 API)</title> <meta name="date" content="2020-01-26"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.apache.guacamole.GuacamoleResourceConflictException (guacamole-common 1.1.0 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../org/apache/guacamole/GuacamoleResourceConflictException.html" title="class in org.apache.guacamole">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/guacamole/class-use/GuacamoleResourceConflictException.html" target="_top">Frames</a></li> <li><a href="GuacamoleResourceConflictException.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.apache.guacamole.GuacamoleResourceConflictException" class="title">Uses of Class<br>org.apache.guacamole.GuacamoleResourceConflictException</h2> </div> <div class="classUseContainer">No usage of org.apache.guacamole.GuacamoleResourceConflictException</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../org/apache/guacamole/GuacamoleResourceConflictException.html" title="class in org.apache.guacamole">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/guacamole/class-use/GuacamoleResourceConflictException.html" target="_top">Frames</a></li> <li><a href="GuacamoleResourceConflictException.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2020. All rights reserved.</small></p> <!-- Google Analytics --> <script type="text/javascript"> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-75289145-1', 'auto'); ga('send', 'pageview'); </script> </body> </html>
{ "content_hash": "74a4c1bbd26fae75d29a09ef92871749", "timestamp": "", "source": "github", "line_count": 136, "max_line_length": 173, "avg_line_length": 38.654411764705884, "alnum_prop": 0.6309682328324139, "repo_name": "mike-jumper/incubator-guacamole-website", "id": "af4e0dc4b1b593199f5c657f6e745de212505720", "size": "5257", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "doc/1.1.0/guacamole-common/org/apache/guacamole/class-use/GuacamoleResourceConflictException.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "12886" }, { "name": "HTML", "bytes": "37702" }, { "name": "JavaScript", "bytes": "439018" }, { "name": "Perl", "bytes": "2217" }, { "name": "Ruby", "bytes": "660" }, { "name": "Shell", "bytes": "4849" } ], "symlink_target": "" }
package cyclops.control.reader; public interface UserRepository { public User get(int id); public User find(String username); }
{ "content_hash": "5bcd2a7f8ae80d6e7658a05f0f664857", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 35, "avg_line_length": 18.857142857142858, "alnum_prop": 0.7727272727272727, "repo_name": "aol/cyclops-react", "id": "f309145d460c0207e1d70f1b81a9dfbe81307bf3", "size": "132", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "cyclops-pure/src/test/java/cyclops/control/reader/UserRepository.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "9298098" } ], "symlink_target": "" }
package org.qi4j.runtime.bootstrap; import org.qi4j.api.common.AppliesToFilter; import java.lang.reflect.Method; import java.lang.reflect.Modifier; /** * JAVADOC */ final class ImplementsMethodAppliesToFilter implements AppliesToFilter { public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass ) { try { return !Modifier.isAbstract( fragmentClass.getMethod( method.getName(), method.getParameterTypes() ) .getModifiers() ); } catch( NoSuchMethodException e ) { return false; } } }
{ "content_hash": "eed7d2d9b01261642b2c0d08f62abc3b", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 112, "avg_line_length": 23.857142857142858, "alnum_prop": 0.6152694610778443, "repo_name": "Qi4j/qi4j-core", "id": "15720ab7f950c702610e111cb9d3ed7bdba94a89", "size": "1282", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "runtime/src/main/java/org/qi4j/runtime/bootstrap/ImplementsMethodAppliesToFilter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "3452" }, { "name": "Java", "bytes": "2279578" } ], "symlink_target": "" }
import { h } from "hastscript"; import { paragraphStyleToAttributes } from "../common/paragraphStyle"; import { namedStyleTypeToTag } from "../common/style"; import { transformInlineObject } from "./inlineObject"; import { transformPerson } from "./person"; import { transformRichLink } from "./richLink"; import { transformTextRun } from "./textRun"; import type { Context } from ".."; import type { docs_v1 } from "@googleapis/docs"; import type { Element, Text } from "hast"; export const paragraphToElement = ( paragraph: docs_v1.Schema$Paragraph, { doc }: Context ): Element => { // @see https://developers.google.com/docs/api/reference/rest/v1/documents#Paragraph const { elements, paragraphStyle, bullet } = paragraph; // TODO apply styles to bullets if (bullet) { return h( "li", elements.map((el) => paragraphElementToElement(el, doc)) ); } return h( namedStyleTypeToTag(paragraphStyle.namedStyleType), paragraphStyleToAttributes(paragraphStyle), elements .map((el) => paragraphElementToElement(el, doc)) .filter((el) => el != undefined) ); }; const paragraphElementToElement = ( el: docs_v1.Schema$ParagraphElement, doc: docs_v1.Schema$Document ): Element | Text => { // @see https://developers.google.com/docs/api/reference/rest/v1/documents#ParagraphElement // TODO support other types of paragraph elements const { inlineObjectElement, person, richLink, textRun } = el; if (inlineObjectElement) { return transformInlineObject(inlineObjectElement, doc); } if (person) { return transformPerson(person); } if (richLink) { return transformRichLink(richLink); } if (textRun) { return transformTextRun(textRun); } console.warn( `Unsupported element: paragraph.${Object.keys(el) .filter((k) => !k.match(/.*Index$/)) .pop()}` ); };
{ "content_hash": "b0fc6eaacabe14b86eb99370db9e2335", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 93, "avg_line_length": 27.544117647058822, "alnum_prop": 0.6823278163374266, "repo_name": "googleworkspace/google-docs-hast", "id": "cd389ec9377657aca827734563416f361915ff12", "size": "2468", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "src/hast/paragraph/index.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "457" }, { "name": "HTML", "bytes": "22317" }, { "name": "JavaScript", "bytes": "381" }, { "name": "TypeScript", "bytes": "39408" } ], "symlink_target": "" }
package repo import ( "errors" "fmt" "io/ioutil" "net/url" "regexp" "strings" "time" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/validation" "code.gitea.io/gitea/routers/utils" "code.gitea.io/gitea/services/mailer" mirror_service "code.gitea.io/gitea/services/mirror" repo_service "code.gitea.io/gitea/services/repository" "github.com/unknwon/com" "mvdan.cc/xurls/v2" ) const ( tplSettingsOptions base.TplName = "repo/settings/options" tplCollaboration base.TplName = "repo/settings/collaboration" tplBranches base.TplName = "repo/settings/branches" tplGithooks base.TplName = "repo/settings/githooks" tplGithookEdit base.TplName = "repo/settings/githook_edit" tplDeployKeys base.TplName = "repo/settings/deploy_keys" tplProtectedBranch base.TplName = "repo/settings/protected_branch" ) var validFormAddress *regexp.Regexp // Settings show a repository's settings page func Settings(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings") ctx.Data["PageIsSettingsOptions"] = true ctx.Data["ForcePrivate"] = setting.Repository.ForcePrivate ctx.HTML(200, tplSettingsOptions) } // SettingsPost response for changes of a repository func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { ctx.Data["Title"] = ctx.Tr("repo.settings") ctx.Data["PageIsSettingsOptions"] = true repo := ctx.Repo.Repository switch ctx.Query("action") { case "update": if ctx.HasError() { ctx.HTML(200, tplSettingsOptions) return } newRepoName := form.RepoName // Check if repository name has been changed. if repo.LowerName != strings.ToLower(newRepoName) { // Close the GitRepo if open if ctx.Repo.GitRepo != nil { ctx.Repo.GitRepo.Close() ctx.Repo.GitRepo = nil } if err := repo_service.ChangeRepositoryName(ctx.Repo.Owner, repo, newRepoName); err != nil { ctx.Data["Err_RepoName"] = true switch { case models.IsErrRepoAlreadyExist(err): ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tplSettingsOptions, &form) case models.IsErrNameReserved(err): ctx.RenderWithErr(ctx.Tr("repo.form.name_reserved", err.(models.ErrNameReserved).Name), tplSettingsOptions, &form) case models.IsErrNamePatternNotAllowed(err): ctx.RenderWithErr(ctx.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), tplSettingsOptions, &form) default: ctx.ServerError("ChangeRepositoryName", err) } return } log.Trace("Repository name changed: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newRepoName) } // In case it's just a case change. repo.Name = newRepoName repo.LowerName = strings.ToLower(newRepoName) repo.Description = form.Description repo.Website = form.Website repo.IsTemplate = form.Template // Visibility of forked repository is forced sync with base repository. if repo.IsFork { form.Private = repo.BaseRepo.IsPrivate } visibilityChanged := repo.IsPrivate != form.Private // when ForcePrivate enabled, you could change public repo to private, but only admin users can change private to public if visibilityChanged && setting.Repository.ForcePrivate && !form.Private && !ctx.User.IsAdmin { ctx.ServerError("Force Private enabled", errors.New("cannot change private repository to public")) return } repo.IsPrivate = form.Private if err := models.UpdateRepository(repo, visibilityChanged); err != nil { ctx.ServerError("UpdateRepository", err) return } log.Trace("Repository basic settings updated: %s/%s", ctx.Repo.Owner.Name, repo.Name) ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success")) ctx.Redirect(repo.Link() + "/settings") case "mirror": if !repo.IsMirror { ctx.NotFound("", nil) return } // This section doesn't require repo_name/RepoName to be set in the form, don't show it // as an error on the UI for this action ctx.Data["Err_RepoName"] = nil interval, err := time.ParseDuration(form.Interval) if err != nil || (interval != 0 && interval < setting.Mirror.MinInterval) { ctx.Data["Err_Interval"] = true ctx.RenderWithErr(ctx.Tr("repo.mirror_interval_invalid"), tplSettingsOptions, &form) } else { ctx.Repo.Mirror.EnablePrune = form.EnablePrune ctx.Repo.Mirror.Interval = interval if interval != 0 { ctx.Repo.Mirror.NextUpdateUnix = timeutil.TimeStampNow().AddDuration(interval) } else { ctx.Repo.Mirror.NextUpdateUnix = 0 } if err := models.UpdateMirror(ctx.Repo.Mirror); err != nil { ctx.Data["Err_Interval"] = true ctx.RenderWithErr(ctx.Tr("repo.mirror_interval_invalid"), tplSettingsOptions, &form) return } } // Validate the form.MirrorAddress u, err := url.Parse(form.MirrorAddress) if err != nil { ctx.Data["Err_MirrorAddress"] = true ctx.RenderWithErr(ctx.Tr("repo.mirror_address_url_invalid"), tplSettingsOptions, &form) return } if u.Opaque != "" || !(u.Scheme == "http" || u.Scheme == "https" || u.Scheme == "git") { ctx.Data["Err_MirrorAddress"] = true ctx.RenderWithErr(ctx.Tr("repo.mirror_address_protocol_invalid"), tplSettingsOptions, &form) return } if form.MirrorUsername != "" || form.MirrorPassword != "" { u.User = url.UserPassword(form.MirrorUsername, form.MirrorPassword) } // Now use xurls address := validFormAddress.FindString(form.MirrorAddress) if address != form.MirrorAddress && form.MirrorAddress != "" { ctx.Data["Err_MirrorAddress"] = true ctx.RenderWithErr(ctx.Tr("repo.mirror_address_url_invalid"), tplSettingsOptions, &form) return } if u.EscapedPath() == "" || u.Host == "" || !u.IsAbs() { ctx.Data["Err_MirrorAddress"] = true ctx.RenderWithErr(ctx.Tr("repo.mirror_address_url_invalid"), tplSettingsOptions, &form) return } address = u.String() if err := mirror_service.SaveAddress(ctx.Repo.Mirror, address); err != nil { ctx.ServerError("SaveAddress", err) return } ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success")) ctx.Redirect(repo.Link() + "/settings") case "mirror-sync": if !repo.IsMirror { ctx.NotFound("", nil) return } mirror_service.StartToMirror(repo.ID) ctx.Flash.Info(ctx.Tr("repo.settings.mirror_sync_in_progress")) ctx.Redirect(repo.Link() + "/settings") case "advanced": var units []models.RepoUnit var deleteUnitTypes []models.UnitType // This section doesn't require repo_name/RepoName to be set in the form, don't show it // as an error on the UI for this action ctx.Data["Err_RepoName"] = nil if form.EnableWiki && form.EnableExternalWiki && !models.UnitTypeExternalWiki.UnitGlobalDisabled() { if !validation.IsValidExternalURL(form.ExternalWikiURL) { ctx.Flash.Error(ctx.Tr("repo.settings.external_wiki_url_error")) ctx.Redirect(repo.Link() + "/settings") return } units = append(units, models.RepoUnit{ RepoID: repo.ID, Type: models.UnitTypeExternalWiki, Config: &models.ExternalWikiConfig{ ExternalWikiURL: form.ExternalWikiURL, }, }) deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeWiki) } else if form.EnableWiki && !form.EnableExternalWiki && !models.UnitTypeWiki.UnitGlobalDisabled() { units = append(units, models.RepoUnit{ RepoID: repo.ID, Type: models.UnitTypeWiki, Config: new(models.UnitConfig), }) deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeExternalWiki) } else { if !models.UnitTypeExternalWiki.UnitGlobalDisabled() { deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeExternalWiki) } if !models.UnitTypeWiki.UnitGlobalDisabled() { deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeWiki) } } if form.EnableIssues && form.EnableExternalTracker && !models.UnitTypeExternalTracker.UnitGlobalDisabled() { if !validation.IsValidExternalURL(form.ExternalTrackerURL) { ctx.Flash.Error(ctx.Tr("repo.settings.external_tracker_url_error")) ctx.Redirect(repo.Link() + "/settings") return } if len(form.TrackerURLFormat) != 0 && !validation.IsValidExternalTrackerURLFormat(form.TrackerURLFormat) { ctx.Flash.Error(ctx.Tr("repo.settings.tracker_url_format_error")) ctx.Redirect(repo.Link() + "/settings") return } units = append(units, models.RepoUnit{ RepoID: repo.ID, Type: models.UnitTypeExternalTracker, Config: &models.ExternalTrackerConfig{ ExternalTrackerURL: form.ExternalTrackerURL, ExternalTrackerFormat: form.TrackerURLFormat, ExternalTrackerStyle: form.TrackerIssueStyle, }, }) deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeIssues) } else if form.EnableIssues && !form.EnableExternalTracker && !models.UnitTypeIssues.UnitGlobalDisabled() { units = append(units, models.RepoUnit{ RepoID: repo.ID, Type: models.UnitTypeIssues, Config: &models.IssuesConfig{ EnableTimetracker: form.EnableTimetracker, AllowOnlyContributorsToTrackTime: form.AllowOnlyContributorsToTrackTime, EnableDependencies: form.EnableIssueDependencies, }, }) deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeExternalTracker) } else { if !models.UnitTypeExternalTracker.UnitGlobalDisabled() { deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeExternalTracker) } if !models.UnitTypeIssues.UnitGlobalDisabled() { deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeIssues) } } if form.EnablePulls && !models.UnitTypePullRequests.UnitGlobalDisabled() { units = append(units, models.RepoUnit{ RepoID: repo.ID, Type: models.UnitTypePullRequests, Config: &models.PullRequestsConfig{ IgnoreWhitespaceConflicts: form.PullsIgnoreWhitespace, AllowMerge: form.PullsAllowMerge, AllowRebase: form.PullsAllowRebase, AllowRebaseMerge: form.PullsAllowRebaseMerge, AllowSquash: form.PullsAllowSquash, }, }) } else if !models.UnitTypePullRequests.UnitGlobalDisabled() { deleteUnitTypes = append(deleteUnitTypes, models.UnitTypePullRequests) } if err := models.UpdateRepositoryUnits(repo, units, deleteUnitTypes); err != nil { ctx.ServerError("UpdateRepositoryUnits", err) return } log.Trace("Repository advanced settings updated: %s/%s", ctx.Repo.Owner.Name, repo.Name) ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success")) ctx.Redirect(ctx.Repo.RepoLink + "/settings") case "admin": if !ctx.User.IsAdmin { ctx.Error(403) return } if repo.IsFsckEnabled != form.EnableHealthCheck { repo.IsFsckEnabled = form.EnableHealthCheck } if repo.CloseIssuesViaCommitInAnyBranch != form.EnableCloseIssuesViaCommitInAnyBranch { repo.CloseIssuesViaCommitInAnyBranch = form.EnableCloseIssuesViaCommitInAnyBranch } if err := models.UpdateRepository(repo, false); err != nil { ctx.ServerError("UpdateRepository", err) return } log.Trace("Repository admin settings updated: %s/%s", ctx.Repo.Owner.Name, repo.Name) ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success")) ctx.Redirect(ctx.Repo.RepoLink + "/settings") case "convert": if !ctx.Repo.IsOwner() { ctx.Error(404) return } if repo.Name != form.RepoName { ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), tplSettingsOptions, nil) return } if !repo.IsMirror { ctx.Error(404) return } repo.IsMirror = false if _, err := repository.CleanUpMigrateInfo(repo); err != nil { ctx.ServerError("CleanUpMigrateInfo", err) return } else if err = models.DeleteMirrorByRepoID(ctx.Repo.Repository.ID); err != nil { ctx.ServerError("DeleteMirrorByRepoID", err) return } log.Trace("Repository converted from mirror to regular: %s/%s", ctx.Repo.Owner.Name, repo.Name) ctx.Flash.Success(ctx.Tr("repo.settings.convert_succeed")) ctx.Redirect(setting.AppSubURL + "/" + ctx.Repo.Owner.Name + "/" + repo.Name) case "transfer": if !ctx.Repo.IsOwner() { ctx.Error(404) return } if repo.Name != form.RepoName { ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), tplSettingsOptions, nil) return } newOwner, err := models.GetUserByName(ctx.Query("new_owner_name")) if err != nil { if models.IsErrUserNotExist(err) { ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_owner_name"), tplSettingsOptions, nil) return } ctx.ServerError("IsUserExist", err) return } if newOwner.Type == models.UserTypeOrganization { if !ctx.User.IsAdmin && newOwner.Visibility == structs.VisibleTypePrivate && !ctx.User.IsUserPartOfOrg(newOwner.ID) { // The user shouldn't know about this organization ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_owner_name"), tplSettingsOptions, nil) return } } // Close the GitRepo if open if ctx.Repo.GitRepo != nil { ctx.Repo.GitRepo.Close() ctx.Repo.GitRepo = nil } if err = repo_service.TransferOwnership(ctx.User, newOwner, repo, nil); err != nil { if models.IsErrRepoAlreadyExist(err) { ctx.RenderWithErr(ctx.Tr("repo.settings.new_owner_has_same_repo"), tplSettingsOptions, nil) } else { ctx.ServerError("TransferOwnership", err) } return } log.Trace("Repository transferred: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newOwner) ctx.Flash.Success(ctx.Tr("repo.settings.transfer_succeed")) ctx.Redirect(setting.AppSubURL + "/" + newOwner.Name + "/" + repo.Name) case "delete": if !ctx.Repo.IsOwner() { ctx.Error(404) return } if repo.Name != form.RepoName { ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), tplSettingsOptions, nil) return } if err := repo_service.DeleteRepository(ctx.User, ctx.Repo.Repository); err != nil { ctx.ServerError("DeleteRepository", err) return } log.Trace("Repository deleted: %s/%s", ctx.Repo.Owner.Name, repo.Name) ctx.Flash.Success(ctx.Tr("repo.settings.deletion_success")) ctx.Redirect(ctx.Repo.Owner.DashboardLink()) case "delete-wiki": if !ctx.Repo.IsOwner() { ctx.Error(404) return } if repo.Name != form.RepoName { ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), tplSettingsOptions, nil) return } err := repo.DeleteWiki() if err != nil { log.Error("Delete Wiki: %v", err.Error()) } log.Trace("Repository wiki deleted: %s/%s", ctx.Repo.Owner.Name, repo.Name) ctx.Flash.Success(ctx.Tr("repo.settings.wiki_deletion_success")) ctx.Redirect(ctx.Repo.RepoLink + "/settings") case "archive": if !ctx.Repo.IsOwner() { ctx.Error(403) return } if repo.IsMirror { ctx.Flash.Error(ctx.Tr("repo.settings.archive.error_ismirror")) ctx.Redirect(ctx.Repo.RepoLink + "/settings") return } if err := repo.SetArchiveRepoState(true); err != nil { log.Error("Tried to archive a repo: %s", err) ctx.Flash.Error(ctx.Tr("repo.settings.archive.error")) ctx.Redirect(ctx.Repo.RepoLink + "/settings") return } ctx.Flash.Success(ctx.Tr("repo.settings.archive.success")) log.Trace("Repository was archived: %s/%s", ctx.Repo.Owner.Name, repo.Name) ctx.Redirect(ctx.Repo.RepoLink + "/settings") case "unarchive": if !ctx.Repo.IsOwner() { ctx.Error(403) return } if err := repo.SetArchiveRepoState(false); err != nil { log.Error("Tried to unarchive a repo: %s", err) ctx.Flash.Error(ctx.Tr("repo.settings.unarchive.error")) ctx.Redirect(ctx.Repo.RepoLink + "/settings") return } ctx.Flash.Success(ctx.Tr("repo.settings.unarchive.success")) log.Trace("Repository was un-archived: %s/%s", ctx.Repo.Owner.Name, repo.Name) ctx.Redirect(ctx.Repo.RepoLink + "/settings") default: ctx.NotFound("", nil) } } // Collaboration render a repository's collaboration page func Collaboration(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings") ctx.Data["PageIsSettingsCollaboration"] = true users, err := ctx.Repo.Repository.GetCollaborators(models.ListOptions{}) if err != nil { ctx.ServerError("GetCollaborators", err) return } ctx.Data["Collaborators"] = users teams, err := ctx.Repo.Repository.GetRepoTeams() if err != nil { ctx.ServerError("GetRepoTeams", err) return } ctx.Data["Teams"] = teams ctx.Data["Repo"] = ctx.Repo.Repository ctx.Data["OrgID"] = ctx.Repo.Repository.OwnerID ctx.Data["OrgName"] = ctx.Repo.Repository.OwnerName ctx.Data["Org"] = ctx.Repo.Repository.Owner ctx.Data["Units"] = models.Units ctx.HTML(200, tplCollaboration) } // CollaborationPost response for actions for a collaboration of a repository func CollaborationPost(ctx *context.Context) { name := utils.RemoveUsernameParameterSuffix(strings.ToLower(ctx.Query("collaborator"))) if len(name) == 0 || ctx.Repo.Owner.LowerName == name { ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path) return } u, err := models.GetUserByName(name) if err != nil { if models.IsErrUserNotExist(err) { ctx.Flash.Error(ctx.Tr("form.user_not_exist")) ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path) } else { ctx.ServerError("GetUserByName", err) } return } if !u.IsActive { ctx.Flash.Error(ctx.Tr("repo.settings.add_collaborator_inactive_user")) ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path) return } // Organization is not allowed to be added as a collaborator. if u.IsOrganization() { ctx.Flash.Error(ctx.Tr("repo.settings.org_not_allowed_to_be_collaborator")) ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path) return } if got, err := ctx.Repo.Repository.IsCollaborator(u.ID); err == nil && got { ctx.Flash.Error(ctx.Tr("repo.settings.add_collaborator_duplicate")) ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") return } if err = ctx.Repo.Repository.AddCollaborator(u); err != nil { ctx.ServerError("AddCollaborator", err) return } if setting.Service.EnableNotifyMail { mailer.SendCollaboratorMail(u, ctx.User, ctx.Repo.Repository) } ctx.Flash.Success(ctx.Tr("repo.settings.add_collaborator_success")) ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path) } // ChangeCollaborationAccessMode response for changing access of a collaboration func ChangeCollaborationAccessMode(ctx *context.Context) { if err := ctx.Repo.Repository.ChangeCollaborationAccessMode( ctx.QueryInt64("uid"), models.AccessMode(ctx.QueryInt("mode"))); err != nil { log.Error("ChangeCollaborationAccessMode: %v", err) } } // DeleteCollaboration delete a collaboration for a repository func DeleteCollaboration(ctx *context.Context) { if err := ctx.Repo.Repository.DeleteCollaboration(ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteCollaboration: " + err.Error()) } else { ctx.Flash.Success(ctx.Tr("repo.settings.remove_collaborator_success")) } ctx.JSON(200, map[string]interface{}{ "redirect": ctx.Repo.RepoLink + "/settings/collaboration", }) } // AddTeamPost response for adding a team to a repository func AddTeamPost(ctx *context.Context) { if !ctx.Repo.Owner.RepoAdminChangeTeamAccess && !ctx.Repo.IsOwner() { ctx.Flash.Error(ctx.Tr("repo.settings.change_team_access_not_allowed")) ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") return } name := utils.RemoveUsernameParameterSuffix(strings.ToLower(ctx.Query("team"))) if len(name) == 0 { ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") return } team, err := ctx.Repo.Owner.GetTeam(name) if err != nil { if models.IsErrTeamNotExist(err) { ctx.Flash.Error(ctx.Tr("form.team_not_exist")) ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") } else { ctx.ServerError("GetTeam", err) } return } if team.OrgID != ctx.Repo.Repository.OwnerID { ctx.Flash.Error(ctx.Tr("repo.settings.team_not_in_organization")) ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") return } if models.HasTeamRepo(ctx.Repo.Repository.OwnerID, team.ID, ctx.Repo.Repository.ID) { ctx.Flash.Error(ctx.Tr("repo.settings.add_team_duplicate")) ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") return } if err = team.AddRepository(ctx.Repo.Repository); err != nil { ctx.ServerError("team.AddRepository", err) return } ctx.Flash.Success(ctx.Tr("repo.settings.add_team_success")) ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") } // DeleteTeam response for deleting a team from a repository func DeleteTeam(ctx *context.Context) { if !ctx.Repo.Owner.RepoAdminChangeTeamAccess && !ctx.Repo.IsOwner() { ctx.Flash.Error(ctx.Tr("repo.settings.change_team_access_not_allowed")) ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") return } team, err := models.GetTeamByID(ctx.QueryInt64("id")) if err != nil { ctx.ServerError("GetTeamByID", err) return } if err = team.RemoveRepository(ctx.Repo.Repository.ID); err != nil { ctx.ServerError("team.RemoveRepositorys", err) return } ctx.Flash.Success(ctx.Tr("repo.settings.remove_team_success")) ctx.JSON(200, map[string]interface{}{ "redirect": ctx.Repo.RepoLink + "/settings/collaboration", }) } // parseOwnerAndRepo get repos by owner func parseOwnerAndRepo(ctx *context.Context) (*models.User, *models.Repository) { owner, err := models.GetUserByName(ctx.Params(":username")) if err != nil { if models.IsErrUserNotExist(err) { ctx.NotFound("GetUserByName", err) } else { ctx.ServerError("GetUserByName", err) } return nil, nil } repo, err := models.GetRepositoryByName(owner.ID, ctx.Params(":reponame")) if err != nil { if models.IsErrRepoNotExist(err) { ctx.NotFound("GetRepositoryByName", err) } else { ctx.ServerError("GetRepositoryByName", err) } return nil, nil } return owner, repo } // GitHooks hooks of a repository func GitHooks(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings.githooks") ctx.Data["PageIsSettingsGitHooks"] = true hooks, err := ctx.Repo.GitRepo.Hooks() if err != nil { ctx.ServerError("Hooks", err) return } ctx.Data["Hooks"] = hooks ctx.HTML(200, tplGithooks) } // GitHooksEdit render for editing a hook of repository page func GitHooksEdit(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings.githooks") ctx.Data["PageIsSettingsGitHooks"] = true ctx.Data["RequireSimpleMDE"] = true name := ctx.Params(":name") hook, err := ctx.Repo.GitRepo.GetHook(name) if err != nil { if err == git.ErrNotValidHook { ctx.NotFound("GetHook", err) } else { ctx.ServerError("GetHook", err) } return } ctx.Data["Hook"] = hook ctx.HTML(200, tplGithookEdit) } // GitHooksEditPost response for editing a git hook of a repository func GitHooksEditPost(ctx *context.Context) { name := ctx.Params(":name") hook, err := ctx.Repo.GitRepo.GetHook(name) if err != nil { if err == git.ErrNotValidHook { ctx.NotFound("GetHook", err) } else { ctx.ServerError("GetHook", err) } return } hook.Content = ctx.Query("content") if err = hook.Update(); err != nil { ctx.ServerError("hook.Update", err) return } ctx.Redirect(ctx.Repo.RepoLink + "/settings/hooks/git") } // DeployKeys render the deploy keys list of a repository page func DeployKeys(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings.deploy_keys") ctx.Data["PageIsSettingsKeys"] = true ctx.Data["DisableSSH"] = setting.SSH.Disabled keys, err := models.ListDeployKeys(ctx.Repo.Repository.ID, models.ListOptions{}) if err != nil { ctx.ServerError("ListDeployKeys", err) return } ctx.Data["Deploykeys"] = keys ctx.HTML(200, tplDeployKeys) } // DeployKeysPost response for adding a deploy key of a repository func DeployKeysPost(ctx *context.Context, form auth.AddKeyForm) { ctx.Data["Title"] = ctx.Tr("repo.settings.deploy_keys") ctx.Data["PageIsSettingsKeys"] = true keys, err := models.ListDeployKeys(ctx.Repo.Repository.ID, models.ListOptions{}) if err != nil { ctx.ServerError("ListDeployKeys", err) return } ctx.Data["Deploykeys"] = keys if ctx.HasError() { ctx.HTML(200, tplDeployKeys) return } content, err := models.CheckPublicKeyString(form.Content) if err != nil { if models.IsErrSSHDisabled(err) { ctx.Flash.Info(ctx.Tr("settings.ssh_disabled")) } else if models.IsErrKeyUnableVerify(err) { ctx.Flash.Info(ctx.Tr("form.unable_verify_ssh_key")) } else { ctx.Data["HasError"] = true ctx.Data["Err_Content"] = true ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error())) } ctx.Redirect(ctx.Repo.RepoLink + "/settings/keys") return } key, err := models.AddDeployKey(ctx.Repo.Repository.ID, form.Title, content, !form.IsWritable) if err != nil { ctx.Data["HasError"] = true switch { case models.IsErrDeployKeyAlreadyExist(err): ctx.Data["Err_Content"] = true ctx.RenderWithErr(ctx.Tr("repo.settings.key_been_used"), tplDeployKeys, &form) case models.IsErrKeyAlreadyExist(err): ctx.Data["Err_Content"] = true ctx.RenderWithErr(ctx.Tr("settings.ssh_key_been_used"), tplDeployKeys, &form) case models.IsErrKeyNameAlreadyUsed(err): ctx.Data["Err_Title"] = true ctx.RenderWithErr(ctx.Tr("repo.settings.key_name_used"), tplDeployKeys, &form) default: ctx.ServerError("AddDeployKey", err) } return } log.Trace("Deploy key added: %d", ctx.Repo.Repository.ID) ctx.Flash.Success(ctx.Tr("repo.settings.add_key_success", key.Name)) ctx.Redirect(ctx.Repo.RepoLink + "/settings/keys") } // DeleteDeployKey response for deleting a deploy key func DeleteDeployKey(ctx *context.Context) { if err := models.DeleteDeployKey(ctx.User, ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteDeployKey: " + err.Error()) } else { ctx.Flash.Success(ctx.Tr("repo.settings.deploy_key_deletion_success")) } ctx.JSON(200, map[string]interface{}{ "redirect": ctx.Repo.RepoLink + "/settings/keys", }) } func init() { var err error validFormAddress, err = xurls.StrictMatchingScheme(`(https?)|(git)://`) if err != nil { panic(err) } } // UpdateAvatarSetting update repo's avatar func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm) error { ctxRepo := ctx.Repo.Repository if form.Avatar == nil { // No avatar is uploaded and we not removing it here. // No random avatar generated here. // Just exit, no action. if !com.IsFile(ctxRepo.CustomAvatarPath()) { log.Trace("No avatar was uploaded for repo: %d. Default icon will appear instead.", ctxRepo.ID) } return nil } r, err := form.Avatar.Open() if err != nil { return fmt.Errorf("Avatar.Open: %v", err) } defer r.Close() if form.Avatar.Size > setting.AvatarMaxFileSize { return errors.New(ctx.Tr("settings.uploaded_avatar_is_too_big")) } data, err := ioutil.ReadAll(r) if err != nil { return fmt.Errorf("ioutil.ReadAll: %v", err) } if !base.IsImageFile(data) { return errors.New(ctx.Tr("settings.uploaded_avatar_not_a_image")) } if err = ctxRepo.UploadAvatar(data); err != nil { return fmt.Errorf("UploadAvatar: %v", err) } return nil } // SettingsAvatar save new POSTed repository avatar func SettingsAvatar(ctx *context.Context, form auth.AvatarForm) { form.Source = auth.AvatarLocal if err := UpdateAvatarSetting(ctx, form); err != nil { ctx.Flash.Error(err.Error()) } else { ctx.Flash.Success(ctx.Tr("repo.settings.update_avatar_success")) } ctx.Redirect(ctx.Repo.RepoLink + "/settings") } // SettingsDeleteAvatar delete repository avatar func SettingsDeleteAvatar(ctx *context.Context) { if err := ctx.Repo.Repository.DeleteAvatar(); err != nil { ctx.Flash.Error(fmt.Sprintf("DeleteAvatar: %v", err)) } ctx.Redirect(ctx.Repo.RepoLink + "/settings") }
{ "content_hash": "d49bae731eb0f33659d5bc51950a5b4f", "timestamp": "", "source": "github", "line_count": 886, "max_line_length": 142, "avg_line_length": 31.452595936794584, "alnum_prop": 0.7076470377148598, "repo_name": "lafriks/gitea", "id": "dff13ff5b37571912977c864dd73aa185fe49b45", "size": "28087", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "routers/repo/setting.go", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "1203" }, { "name": "Go", "bytes": "3689553" }, { "name": "Makefile", "bytes": "19390" }, { "name": "Perl", "bytes": "19962" }, { "name": "Roff", "bytes": "164" }, { "name": "Shell", "bytes": "278337" }, { "name": "TSQL", "bytes": "117" } ], "symlink_target": "" }
/* eslint-disable consistent-return, no-undef, no-unused-expressions */ import { parse } from "url"; import chai, { expect } from "chai"; import { stub, match } from "sinon"; import sinonChai from "sinon-chai"; import { JSDOM } from "jsdom"; import * as facebookSharer from "../../src/sharers/facebook.js"; chai.use(sinonChai); describe("Facebook sharer", () => { it("must have name 'facebook'", () => { expect(facebookSharer.name).to.equal("facebook"); }); it("must render a link to Facebook", () => { const html = facebookSharer.render("foo", "foo", "path/to/whatever"); const { window } = new JSDOM(html); const anchor = window.document.querySelector("a[href^='https://www.facebook.com/']"); expect(anchor).to.not.be.null; }); describe("`getShareUrl` method", () => { it("must have a `getShareUrl` helper method", () => { expect(typeof facebookSharer.getShareUrl).to.equal("function"); }); it("must have a `u` and a `quote` parameter in the sharing URL", () => { const shareUrl = facebookSharer.getShareUrl("foo", "path/to/whatever"); const parsed = parse(shareUrl, true); expect(parsed.query).to.eql({ quote: "foo", u: "path/to/whatever" }); }); }); describe("`action` method", () => { it("must have a `action` method", () => { expect(typeof facebookSharer.action).to.equal("function"); }); it("must prevent the event's default", () => { const html = facebookSharer.render("foo", "foo", "path/to/whatever"); const { window } = new JSDOM(html); const event = new window.Event("click"); const preventStub = stub(event, "preventDefault"); stub(window, "open").returns({}); facebookSharer.action(event, window.document.body); expect(preventStub.called).to.be.true; }); it("must open a new window", () => { const html = facebookSharer.render("foo", "foo", "path/to/whatever"); const { window } = new JSDOM(html); const event = new window.Event("click"); const openStub = stub(window, "open"); openStub.returns({}); facebookSharer.action(event, window.document.body); expect(openStub.calledOnce).to.be.true; }); it("must open a new window named \"share_via_facebook\"", () => { const html = facebookSharer.render("foo", "foo", "path/to/whatever"); const { window } = new JSDOM(html); const event = new window.Event("click"); const openStub = stub(window, "open"); openStub.returns({}); facebookSharer.action(event, window.document.body); expect(openStub).to.have.been.calledWith(match.any, "share_via_facebook", match.any); }); it("must open a new window with the link provided by `getShareUrl`", () => { const html = facebookSharer.render("foo", "foo", "path/to/whatever"); const { window } = new JSDOM(html); const event = new window.Event("click"); const openStub = stub(window, "open"); openStub.returns({}); const url = facebookSharer.getShareUrl("foo", "path/to/whatever"); facebookSharer.action(event, window.document.body); expect(openStub).to.have.been.calledWith(url, match.any, match.any); }); it("must nullify the popup's `opener` property", () => { const html = facebookSharer.render("foo", "foo", "path/to/whatever"); const { window } = new JSDOM(html); const event = new window.Event("click"); const openStub = stub(window, "open"); const popup = {}; openStub.returns(popup); facebookSharer.action(event, window.document.body); expect(popup.opener).to.be.null; }); }); });
{ "content_hash": "a72f2c84e64436ead1e3ad83914f4f8d", "timestamp": "", "source": "github", "line_count": 105, "max_line_length": 97, "avg_line_length": 38.22857142857143, "alnum_prop": 0.5655206776283009, "repo_name": "MaxArt2501/share-this", "id": "4e8eed7808c0599f3710da9dd2d6c60da9775b0d", "size": "4014", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/sharers/facebook.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "54257" }, { "name": "Less", "bytes": "3752" }, { "name": "SCSS", "bytes": "3933" } ], "symlink_target": "" }
project = 'Faunus' copyright = '2019, Mikael Lund' author = 'Mikael Lund' source_suffix = ['.rst', '.md'] master_doc = 'index' extensions = ['recommonmark', 'sphinx_markdown_tables', 'sphinx.ext.autosectionlabel'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] autosectionlabel_prefix_document = True
{ "content_hash": "20de180b4becdcc3b1365be95fa79a59", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 86, "avg_line_length": 28.454545454545453, "alnum_prop": 0.6996805111821086, "repo_name": "gitesei/faunus", "id": "312967d5db660fa15b5379d494a166e9ec812493", "size": "916", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/conf.py", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "817501" }, { "name": "CMake", "bytes": "26012" }, { "name": "Python", "bytes": "18450" }, { "name": "Shell", "bytes": "21641" }, { "name": "Tcl", "bytes": "1037" } ], "symlink_target": "" }
<?php namespace yiisolutions\user\models; use yii\web\Application; class LoginFormTest extends \PHPUnit_Framework_TestCase { /** * @var Application */ private $_application; /** * @param $username * @param $password * @param $exists * * @dataProvider loginDataProvider */ public function testLoginMethod($username, $password, $exists) { $this->loadApplication(); $model = new LoginForm([ 'username' => $username, 'password' => $password, ]); $this->assertEquals($exists, $model->login()); } public function loginDataProvider() { return [ ['user', 'test', true], ['test', 'test', false], ]; } /** * @return Application */ private function loadApplication() { if (!$this->_application) { $this->_application = (new Application(require(__DIR__ . '/../../../app/config/web.php'))); } return $this->_application; } }
{ "content_hash": "293b3bf87d63af88a9debd72979c16a6", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 103, "avg_line_length": 20.28846153846154, "alnum_prop": 0.524170616113744, "repo_name": "yiisolutions/yii2-user-module", "id": "4bdeae36b9e3af5fe033fa643976c4cf70eb3aa9", "size": "1055", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/yiisolutions/user/models/LoginFormTest.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "PHP", "bytes": "67853" }, { "name": "Shell", "bytes": "429" } ], "symlink_target": "" }
'user strict'; var config = require('./config/config'), express = require('express'), fs = require('fs'), http = require('http'), https = require('https'), privateKey = fs.readFileSync('/var/mount/ssl/wyn.tech.key','utf8'), certificate = fs.readFileSync('/var/mount/ssl/wyn.tech.crt','utf8'), bodyParser = require('body-parser'), request = require("request"), app = express(), cors = require('cors'), redisSvc = require('./services/redisSvc'), slackSvc = require('./services/slackSvc'), firebaseSvc = require('./services/firebaseSvc'); var corsOptions = { origin: [ 'http://127.0.0.1:8081' ,'http://127.0.0.1:8080' ,'http://localhost' ,'http://localhost:8080' ,'https://wyn.tech' ] }; app.use(bodyParser.json()); // support json encoded bodies app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies app.get('/', function (req, res){ res.send({message: "Hello World!"}); }); app.get('/members', cors(corsOptions), function (req, res){ var respond = function(members){ res.send(members); } slackSvc.getSlackMembers(respond); }); app.get('/set_members', function(req,res){ var respond = function(){ res.send({message: "Members Saved!"}); } slackSvc.setSlackMembers(channelId,respond); }); app.get('/new_subscriber_request', function(req,res){ if(req.body.data){ var email = req.body.data.email; slackSvc.sendNewMemberInvite(email); var message = "Request has been sent"; } else { var message = "No email has been provided"; } return res.send({message: message}); }); app.post('/new_subscriber_request', function(req,res){ if(req.body.data){ var email = req.body.data.email; slackSvc.sendNewMemberInvite(email); var message = "Request has been sent"; } else { var message = "No email has been provided"; } return res.send({message: message}); }); app.post('/incr_message_counter', function (req, res){ if (slackSvc.checkToken(req.body.token)){ redisSvc.increaseMessageCounter(); res.send("Message counter increased!"); } else { res.send({message: "Token is invalid"}); } }); app.post('/new_message', function (req, res){ if (slackSvc.checkToken(req.body.token)){ var payload = { room: req.body.channel_name, token: req.body.token, userId: req.body.user_id, message: req.body.text, username: req.body.user_name, timestamp: req.body.timestamp } if (payload.message == ''){ return res.send('No message provided'); } slackSvc.getUserProfile(payload,firebaseSvc.pushToFirebase); redisSvc.increaseMessageCounter(); res.send('success'); } else { res.send('Token is invalid'); } }); var options = { key: privateKey, cert: certificate } var server = https.createServer(options,app); server.listen(3002, config.server.listenAddress, function (){ var host = server.address().address; var port = server.address().port; slackSvc.setSlackMembers('',function(){}); console.log('wyn.slack app listening at https://%s:%s', host, port); })
{ "content_hash": "937026e75b73eb5db163e75c0ce1b065", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 77, "avg_line_length": 25.647540983606557, "alnum_prop": 0.643975711089805, "repo_name": "WynwoodTech/wyn.slack", "id": "c3c739c775456ab14f6c6112ef62752c013beaee", "size": "3129", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "9590" } ], "symlink_target": "" }
namespace BaristaLabs.BaristaCore.Tests { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; /// <summary> /// A collection of weak references to objects. By default, weak references are purged by iteration/count operations, not by add/remove operations. /// </summary> /// <typeparam name="T">The type of object to hold weak references to.</typeparam> /// <remarks> /// <para>Since the collection holds weak references to the actual objects, the collection is comprised of both living and dead references. Living references refer to objects that have not been garbage collected, and may be used as normal references. Dead references refer to objects that have been garbage collected.</para> /// <para>Dead references do consume resources; each dead reference is a garbage collection handle.</para> /// <para>Dead references may be cleaned up by a <see cref="Purge"/> operation. Some properties and methods cause a purge as a side effect; the member documentation specifies whether a purge takes place.</para> /// </remarks> [ExcludeFromCodeCoverage] public sealed class WeakCollection<T> : ICollection<T> where T : class { /// <summary> /// The actual collection of strongly-typed weak references. /// </summary> private List<WeakReference<T>> m_list; /// <summary> /// Initializes a new instance of the <see cref="WeakCollection{T}"/> class that is empty. /// </summary> public WeakCollection() { m_list = new List<WeakReference<T>>(); } /// <summary> /// Gets a sequence of live objects from the collection, causing a purge. /// </summary> public IEnumerable<T> LiveList { get { List<T> ret = new List<T>(m_list.Count); ret.AddRange(UnsafeLiveList); return ret; } } /// <summary> /// Gets a complete sequence of objects from the collection. Does not cause a purge. Null entries represent dead objects. /// </summary> public IEnumerable<T> CompleteList { get { return m_list.Select(x => { if (x.TryGetTarget(out T target)) return target; return null; }); } } /// <summary> /// Gets a sequence of live objects from the collection without causing a purge. /// </summary> public IEnumerable<T> LiveListWithoutPurge { get { return CompleteList.Where(x => x != null); } } /// <summary> /// Gets the number of live and dead entries in the collection. Does not cause a purge. O(1). /// </summary> public int CompleteCount { get { return m_list.Count; } } /// <summary> /// Gets the number of dead entries in the collection. Does not cause a purge. O(n). /// </summary> public int DeadCount { get { return CompleteList.Count(x => x == null); } } /// <summary> /// Gets the number of live entries in the collection, causing a purge. O(n). /// </summary> public int LiveCount { get { return UnsafeLiveList.Count(); } } /// <summary> /// Gets the number of live entries in the collection without causing a purge. O(n). /// </summary> public int LiveCountWithoutPurge { get { return CompleteList.Count(x => x != null); } } #region ICollection<T> Properties /// <summary> /// Gets the number of live entries in the collection, causing a purge. O(n). /// </summary> int ICollection<T>.Count { get { return LiveCount; } } /// <summary> /// Gets a value indicating whether the collection is read only. /// </summary> bool ICollection<T>.IsReadOnly { get { return ((ICollection<T>)m_list).IsReadOnly; } } #endregion /// <summary> /// Gets a sequence of live objects from the collection, causing a purge. The entire sequence MUST always be enumerated! /// </summary> private IEnumerable<T> UnsafeLiveList { get { //Iterate through the list, when a 'dead' reference is found, shift the list at that position left. int writeIndex = 0; for (int readIndex = 0; readIndex != m_list.Count; ++readIndex) { WeakReference<T> weakReference = m_list[readIndex]; if (weakReference.TryGetTarget(out T weakDelegate)) { yield return weakDelegate; if (readIndex != writeIndex) { m_list[writeIndex] = m_list[readIndex]; } ++writeIndex; } } m_list.RemoveRange(writeIndex, m_list.Count - writeIndex); } } /// <summary> /// Adds a weak reference to an object to the collection. Does not cause a purge. /// </summary> /// <param name="item">The object to add a weak reference to.</param> public void Add(T item) { m_list.Add(new WeakReference<T>(item)); } /// <summary> /// Removes a weak reference to an object from the collection. Does not cause a purge. /// </summary> /// <param name="item">The object to remove a weak reference to.</param> /// <returns>True if the object was found and removed; false if the object was not found.</returns> public bool Remove(T item) { for (int i = 0; i != m_list.Count; ++i) { WeakReference<T> weakReference = m_list[i]; if (weakReference.TryGetTarget(out T weakDelegate)) { if (weakDelegate == item) { m_list.RemoveAt(i); return true; } } } return false; } /// <summary> /// Removes all dead objects from the collection. /// </summary> public void Purge() { UnsafeLiveList.All( x => true); } /// <summary> /// Empties the collection. /// </summary> public void Clear() { m_list.Clear(); } #region ICollection<T> Methods /// <summary> /// Determines whether the collection contains a specific value. /// </summary> /// <param name="item">The object to locate.</param> /// <returns>True if the collection contains a specific value; false if it does not.</returns> public bool Contains(T item) { return LiveListWithoutPurge.Contains(item); } /// <summary> /// Copies all live objects to an array. /// </summary> /// <param name="array">The destination array.</param> /// <param name="arrayIndex">The index to begin writing into the array.</param> public void CopyTo(T[] array, int arrayIndex) { List<T> ret = new List<T>(m_list.Count); ret.AddRange(UnsafeLiveList); ret.CopyTo(array, arrayIndex); } #endregion #region IEnumerable<T> Members /// <summary> /// Gets a sequence of live objects from the collection, causing a purge. /// </summary> /// <returns>The sequence of live objects.</returns> IEnumerator<T> IEnumerable<T>.GetEnumerator() { return LiveList.GetEnumerator(); } #endregion #region IEnumerable Members /// <summary> /// Gets a sequence of live objects from the collection, causing a purge. /// </summary> /// <returns>The sequence of live objects.</returns> System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return ((IEnumerable<T>)this).GetEnumerator(); } #endregion } }
{ "content_hash": "be4595e774d5f6edf4c10cae57fa9b91", "timestamp": "", "source": "github", "line_count": 266, "max_line_length": 328, "avg_line_length": 32.973684210526315, "alnum_prop": 0.5216052901607571, "repo_name": "BaristaLabs/BaristaCore", "id": "1683e0539b295be14e36e869cf690b3ed0650cbe", "size": "8773", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/BaristaLabs.BaristaCore.Tests/WeakCollection.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "1521863" }, { "name": "Dockerfile", "bytes": "518" }, { "name": "HTML", "bytes": "4316" }, { "name": "PowerShell", "bytes": "1648" } ], "symlink_target": "" }
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.structuralsearch.plugin.replace; import com.intellij.openapi.util.JDOMExternalizable; import com.intellij.structuralsearch.MatchOptions; import com.intellij.structuralsearch.ReplacementVariableDefinition; import org.jdom.Attribute; import org.jdom.DataConversionException; import org.jdom.Element; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import java.util.*; /** * @author Maxim.Mossienko */ public class ReplaceOptions implements JDOMExternalizable { private final Map<String, ReplacementVariableDefinition> variableDefs; private String replacement; private boolean toShortenFQN; private boolean myToReformatAccordingToStyle; private boolean myToUseStaticImport; private final MatchOptions matchOptions; @NonNls private static final String REFORMAT_ATTR_NAME = "reformatAccordingToStyle"; @NonNls private static final String REPLACEMENT_ATTR_NAME = "replacement"; @NonNls private static final String SHORTEN_FQN_ATTR_NAME = "shortenFQN"; @NonNls private static final String USE_STATIC_IMPORT_ATTR_NAME = "useStaticImport"; @NonNls private static final String VARIABLE_DEFINITION_TAG_NAME = "variableDefinition"; public ReplaceOptions() { this(new MatchOptions()); } public ReplaceOptions(MatchOptions matchOptions) { variableDefs = new LinkedHashMap<>(); this.matchOptions = matchOptions; replacement = ""; myToUseStaticImport = false; } ReplaceOptions(ReplaceOptions options) { variableDefs = new LinkedHashMap<>(options.variableDefs.size()); options.variableDefs.forEach((key, value) -> variableDefs.put(key, value.copy())); // deep copy replacement = options.replacement; toShortenFQN = options.toShortenFQN; myToReformatAccordingToStyle = options.myToReformatAccordingToStyle; myToUseStaticImport = options.myToUseStaticImport; matchOptions = options.matchOptions.copy(); // deep copy } public ReplaceOptions copy() { return new ReplaceOptions(this); } public String getReplacement() { return replacement; } public void setReplacement(@NotNull String replacement) { this.replacement = replacement; } public boolean isToShortenFQN() { return toShortenFQN; } public void setToShortenFQN(boolean shortedFQN) { this.toShortenFQN = shortedFQN; } public boolean isToReformatAccordingToStyle() { return myToReformatAccordingToStyle; } public MatchOptions getMatchOptions() { return matchOptions; } public void setToReformatAccordingToStyle(boolean reformatAccordingToStyle) { myToReformatAccordingToStyle = reformatAccordingToStyle; } public boolean isToUseStaticImport() { return myToUseStaticImport; } public void setToUseStaticImport(boolean useStaticImport) { myToUseStaticImport = useStaticImport; } @Override public void readExternal(Element element) { matchOptions.readExternal(element); Attribute attribute = element.getAttribute(REFORMAT_ATTR_NAME); try { myToReformatAccordingToStyle = attribute.getBooleanValue(); } catch(DataConversionException ignored) {} attribute = element.getAttribute(SHORTEN_FQN_ATTR_NAME); try { toShortenFQN = attribute.getBooleanValue(); } catch(DataConversionException ignored) {} attribute = element.getAttribute(USE_STATIC_IMPORT_ATTR_NAME); if (attribute != null) { // old saved configurations without this attribute present try { myToUseStaticImport = attribute.getBooleanValue(); } catch (DataConversionException ignore) {} } replacement = element.getAttributeValue(REPLACEMENT_ATTR_NAME); for (final Element child : element.getChildren(VARIABLE_DEFINITION_TAG_NAME)) { final ReplacementVariableDefinition variableDefinition = new ReplacementVariableDefinition(); variableDefinition.readExternal(child); addVariableDefinition(variableDefinition); } } @Override public void writeExternal(Element element) { matchOptions.writeExternal(element); element.setAttribute(REFORMAT_ATTR_NAME,String.valueOf(myToReformatAccordingToStyle)); element.setAttribute(SHORTEN_FQN_ATTR_NAME,String.valueOf(toShortenFQN)); if (myToUseStaticImport) { element.setAttribute(USE_STATIC_IMPORT_ATTR_NAME, String.valueOf(myToUseStaticImport)); } element.setAttribute(REPLACEMENT_ATTR_NAME,replacement); for (final ReplacementVariableDefinition variableDefinition : variableDefs.values()) { final Element infoElement = new Element(VARIABLE_DEFINITION_TAG_NAME); element.addContent(infoElement); variableDefinition.writeExternal(infoElement); } } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ReplaceOptions)) return false; final ReplaceOptions replaceOptions = (ReplaceOptions)o; if (myToReformatAccordingToStyle != replaceOptions.myToReformatAccordingToStyle) return false; if (toShortenFQN != replaceOptions.toShortenFQN) return false; if (myToUseStaticImport != replaceOptions.myToUseStaticImport) return false; if (!matchOptions.equals(replaceOptions.matchOptions)) return false; if (replacement != null ? !replacement.equals(replaceOptions.replacement) : replaceOptions.replacement != null) return false; if (!variableDefs.equals(replaceOptions.variableDefs)) return false; return true; } public int hashCode() { int result = replacement.hashCode(); result = 29 * result + (toShortenFQN ? 1 : 0); result = 29 * result + (myToReformatAccordingToStyle ? 1 : 0); result = 29 * result + (myToUseStaticImport ? 1 : 0); result = 29 * result + matchOptions.hashCode(); result = 29 * result + variableDefs.hashCode(); return result; } public ReplacementVariableDefinition getVariableDefinition(String name) { return variableDefs != null ? variableDefs.get(name): null; } public void addVariableDefinition(ReplacementVariableDefinition definition) { variableDefs.put(definition.getName(), definition); } public Collection<ReplacementVariableDefinition> getReplacementVariableDefinitions() { return variableDefs.values(); } public void clearVariableDefinitions() { variableDefs.clear(); } }
{ "content_hash": "67ef876d99e08b2ecad49cc0d720c005", "timestamp": "", "source": "github", "line_count": 184, "max_line_length": 140, "avg_line_length": 34.91847826086956, "alnum_prop": 0.7525291828793774, "repo_name": "ThiagoGarciaAlves/intellij-community", "id": "2230b1a2051c9328c7bb2c7bf22b8c949540f9ed", "size": "6425", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AMPL", "bytes": "20665" }, { "name": "AspectJ", "bytes": "182" }, { "name": "Batchfile", "bytes": "63518" }, { "name": "C", "bytes": "214180" }, { "name": "C#", "bytes": "1538" }, { "name": "C++", "bytes": "190028" }, { "name": "CSS", "bytes": "111474" }, { "name": "CoffeeScript", "bytes": "1759" }, { "name": "Cucumber", "bytes": "14382" }, { "name": "Erlang", "bytes": "10" }, { "name": "FLUX", "bytes": "57" }, { "name": "Groff", "bytes": "35232" }, { "name": "Groovy", "bytes": "2194261" }, { "name": "HTML", "bytes": "1726130" }, { "name": "J", "bytes": "5050" }, { "name": "Java", "bytes": "148273590" }, { "name": "JavaScript", "bytes": "125292" }, { "name": "Kotlin", "bytes": "454154" }, { "name": "Lex", "bytes": "166177" }, { "name": "Makefile", "bytes": "2352" }, { "name": "NSIS", "bytes": "85969" }, { "name": "Objective-C", "bytes": "28634" }, { "name": "Perl6", "bytes": "26" }, { "name": "Protocol Buffer", "bytes": "6570" }, { "name": "Python", "bytes": "21460459" }, { "name": "Ruby", "bytes": "1213" }, { "name": "Scala", "bytes": "11698" }, { "name": "Shell", "bytes": "63190" }, { "name": "Smalltalk", "bytes": "64" }, { "name": "TeX", "bytes": "60798" }, { "name": "TypeScript", "bytes": "6152" }, { "name": "XSLT", "bytes": "113040" } ], "symlink_target": "" }
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ #pragma warning disable 1591 namespace Moneta { /// <summary> ///Represents a strongly typed in-memory cache of data. ///</summary> [global::System.Serializable()] [global::System.ComponentModel.DesignerCategoryAttribute("code")] [global::System.ComponentModel.ToolboxItem(true)] [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")] [global::System.Xml.Serialization.XmlRootAttribute("mydbDataSet")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")] public partial class mydbDataSet : global::System.Data.DataSet { private clientsDataTable tableclients; private invoicesDataTable tableinvoices; private itemsDataTable tableitems; private global::System.Data.DataRelation relationfk_Invoices_Clients; private global::System.Data.DataRelation relationfk_Items_Invoices1; private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public mydbDataSet() { this.BeginInit(); this.InitClass(); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); base.Tables.CollectionChanged += schemaChangedHandler; base.Relations.CollectionChanged += schemaChangedHandler; this.EndInit(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected mydbDataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context, false) { if ((this.IsBinarySerialized(info, context) == true)) { this.InitVars(false); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); this.Tables.CollectionChanged += schemaChangedHandler1; this.Relations.CollectionChanged += schemaChangedHandler1; return; } string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string)))); if ((this.DetermineSchemaSerializationMode(info, context) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { global::System.Data.DataSet ds = new global::System.Data.DataSet(); ds.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema))); if ((ds.Tables["clients"] != null)) { base.Tables.Add(new clientsDataTable(ds.Tables["clients"])); } if ((ds.Tables["invoices"] != null)) { base.Tables.Add(new invoicesDataTable(ds.Tables["invoices"])); } if ((ds.Tables["items"] != null)) { base.Tables.Add(new itemsDataTable(ds.Tables["items"])); } this.DataSetName = ds.DataSetName; this.Prefix = ds.Prefix; this.Namespace = ds.Namespace; this.Locale = ds.Locale; this.CaseSensitive = ds.CaseSensitive; this.EnforceConstraints = ds.EnforceConstraints; this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add); this.InitVars(); } else { this.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema))); } this.GetSerializationData(info, context); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); base.Tables.CollectionChanged += schemaChangedHandler; this.Relations.CollectionChanged += schemaChangedHandler; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] public clientsDataTable clients { get { return this.tableclients; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] public invoicesDataTable invoices { get { return this.tableinvoices; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] public itemsDataTable items { get { return this.tableitems; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.BrowsableAttribute(true)] [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Visible)] public override global::System.Data.SchemaSerializationMode SchemaSerializationMode { get { return this._schemaSerializationMode; } set { this._schemaSerializationMode = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] public new global::System.Data.DataTableCollection Tables { get { return base.Tables; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] public new global::System.Data.DataRelationCollection Relations { get { return base.Relations; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void InitializeDerivedDataSet() { this.BeginInit(); this.InitClass(); this.EndInit(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public override global::System.Data.DataSet Clone() { mydbDataSet cln = ((mydbDataSet)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return cln; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override bool ShouldSerializeTables() { return false; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override bool ShouldSerializeRelations() { return false; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void ReadXmlSerializable(global::System.Xml.XmlReader reader) { if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { this.Reset(); global::System.Data.DataSet ds = new global::System.Data.DataSet(); ds.ReadXml(reader); if ((ds.Tables["clients"] != null)) { base.Tables.Add(new clientsDataTable(ds.Tables["clients"])); } if ((ds.Tables["invoices"] != null)) { base.Tables.Add(new invoicesDataTable(ds.Tables["invoices"])); } if ((ds.Tables["items"] != null)) { base.Tables.Add(new itemsDataTable(ds.Tables["items"])); } this.DataSetName = ds.DataSetName; this.Prefix = ds.Prefix; this.Namespace = ds.Namespace; this.Locale = ds.Locale; this.CaseSensitive = ds.CaseSensitive; this.EnforceConstraints = ds.EnforceConstraints; this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add); this.InitVars(); } else { this.ReadXml(reader); this.InitVars(); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Xml.Schema.XmlSchema GetSchemaSerializable() { global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream(); this.WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null)); stream.Position = 0; return global::System.Xml.Schema.XmlSchema.Read(new global::System.Xml.XmlTextReader(stream), null); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars() { this.InitVars(true); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars(bool initTable) { this.tableclients = ((clientsDataTable)(base.Tables["clients"])); if ((initTable == true)) { if ((this.tableclients != null)) { this.tableclients.InitVars(); } } this.tableinvoices = ((invoicesDataTable)(base.Tables["invoices"])); if ((initTable == true)) { if ((this.tableinvoices != null)) { this.tableinvoices.InitVars(); } } this.tableitems = ((itemsDataTable)(base.Tables["items"])); if ((initTable == true)) { if ((this.tableitems != null)) { this.tableitems.InitVars(); } } this.relationfk_Invoices_Clients = this.Relations["fk_Invoices_Clients"]; this.relationfk_Items_Invoices1 = this.Relations["fk_Items_Invoices1"]; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitClass() { this.DataSetName = "mydbDataSet"; this.Prefix = ""; this.Namespace = "http://tempuri.org/mydbDataSet.xsd"; this.EnforceConstraints = true; this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; this.tableclients = new clientsDataTable(); base.Tables.Add(this.tableclients); this.tableinvoices = new invoicesDataTable(); base.Tables.Add(this.tableinvoices); this.tableitems = new itemsDataTable(); base.Tables.Add(this.tableitems); this.relationfk_Invoices_Clients = new global::System.Data.DataRelation("fk_Invoices_Clients", new global::System.Data.DataColumn[] { this.tableclients.ClientIDColumn}, new global::System.Data.DataColumn[] { this.tableinvoices.Clients_ClientIDColumn}, false); this.Relations.Add(this.relationfk_Invoices_Clients); this.relationfk_Items_Invoices1 = new global::System.Data.DataRelation("fk_Items_Invoices1", new global::System.Data.DataColumn[] { this.tableinvoices.InvoiceIDColumn}, new global::System.Data.DataColumn[] { this.tableitems.Invoices_InvoiceIDColumn}, false); this.Relations.Add(this.relationfk_Items_Invoices1); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private bool ShouldSerializeclients() { return false; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private bool ShouldSerializeinvoices() { return false; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private bool ShouldSerializeitems() { return false; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) { if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) { this.InitVars(); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { mydbDataSet ds = new mydbDataSet(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public delegate void clientsRowChangeEventHandler(object sender, clientsRowChangeEvent e); [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public delegate void invoicesRowChangeEventHandler(object sender, invoicesRowChangeEvent e); [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public delegate void itemsRowChangeEventHandler(object sender, itemsRowChangeEvent e); /// <summary> ///Represents the strongly named DataTable class. ///</summary> [global::System.Serializable()] [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] public partial class clientsDataTable : global::System.Data.TypedTableBase<clientsRow> { private global::System.Data.DataColumn columnClientID; private global::System.Data.DataColumn columnFirstName; private global::System.Data.DataColumn columnLastName; private global::System.Data.DataColumn columnCompany; private global::System.Data.DataColumn columnPhone; private global::System.Data.DataColumn columnEmail; private global::System.Data.DataColumn columnAddress; private global::System.Data.DataColumn columnNote; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public clientsDataTable() { this.TableName = "clients"; this.BeginInit(); this.InitClass(); this.EndInit(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal clientsDataTable(global::System.Data.DataTable table) { this.TableName = table.TableName; if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { this.CaseSensitive = table.CaseSensitive; } if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { this.Locale = table.Locale; } if ((table.Namespace != table.DataSet.Namespace)) { this.Namespace = table.Namespace; } this.Prefix = table.Prefix; this.MinimumCapacity = table.MinimumCapacity; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected clientsDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context) { this.InitVars(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn ClientIDColumn { get { return this.columnClientID; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn FirstNameColumn { get { return this.columnFirstName; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn LastNameColumn { get { return this.columnLastName; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn CompanyColumn { get { return this.columnCompany; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn PhoneColumn { get { return this.columnPhone; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn EmailColumn { get { return this.columnEmail; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn AddressColumn { get { return this.columnAddress; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn NoteColumn { get { return this.columnNote; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] public int Count { get { return this.Rows.Count; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public clientsRow this[int index] { get { return ((clientsRow)(this.Rows[index])); } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event clientsRowChangeEventHandler clientsRowChanging; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event clientsRowChangeEventHandler clientsRowChanged; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event clientsRowChangeEventHandler clientsRowDeleting; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event clientsRowChangeEventHandler clientsRowDeleted; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public void AddclientsRow(clientsRow row) { this.Rows.Add(row); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public clientsRow AddclientsRow(string FirstName, string LastName, string Company, string Phone, string Email, string Address, string Note) { clientsRow rowclientsRow = ((clientsRow)(this.NewRow())); object[] columnValuesArray = new object[] { null, FirstName, LastName, Company, Phone, Email, Address, Note}; rowclientsRow.ItemArray = columnValuesArray; this.Rows.Add(rowclientsRow); return rowclientsRow; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public clientsRow FindByClientID(int ClientID) { return ((clientsRow)(this.Rows.Find(new object[] { ClientID}))); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public override global::System.Data.DataTable Clone() { clientsDataTable cln = ((clientsDataTable)(base.Clone())); cln.InitVars(); return cln; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Data.DataTable CreateInstance() { return new clientsDataTable(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars() { this.columnClientID = base.Columns["ClientID"]; this.columnFirstName = base.Columns["FirstName"]; this.columnLastName = base.Columns["LastName"]; this.columnCompany = base.Columns["Company"]; this.columnPhone = base.Columns["Phone"]; this.columnEmail = base.Columns["Email"]; this.columnAddress = base.Columns["Address"]; this.columnNote = base.Columns["Note"]; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitClass() { this.columnClientID = new global::System.Data.DataColumn("ClientID", typeof(int), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnClientID); this.columnFirstName = new global::System.Data.DataColumn("FirstName", typeof(string), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnFirstName); this.columnLastName = new global::System.Data.DataColumn("LastName", typeof(string), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnLastName); this.columnCompany = new global::System.Data.DataColumn("Company", typeof(string), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnCompany); this.columnPhone = new global::System.Data.DataColumn("Phone", typeof(string), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnPhone); this.columnEmail = new global::System.Data.DataColumn("Email", typeof(string), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnEmail); this.columnAddress = new global::System.Data.DataColumn("Address", typeof(string), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnAddress); this.columnNote = new global::System.Data.DataColumn("Note", typeof(string), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnNote); this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { this.columnClientID}, true)); this.columnClientID.AutoIncrement = true; this.columnClientID.AutoIncrementSeed = -1; this.columnClientID.AutoIncrementStep = -1; this.columnClientID.AllowDBNull = false; this.columnClientID.Unique = true; this.columnFirstName.AllowDBNull = false; this.columnFirstName.MaxLength = 100; this.columnLastName.AllowDBNull = false; this.columnLastName.MaxLength = 100; this.columnCompany.MaxLength = 50; this.columnPhone.AllowDBNull = false; this.columnPhone.MaxLength = 15; this.columnEmail.AllowDBNull = false; this.columnEmail.MaxLength = 100; this.columnAddress.MaxLength = 250; this.columnNote.MaxLength = 500; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public clientsRow NewclientsRow() { return ((clientsRow)(this.NewRow())); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { return new clientsRow(builder); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Type GetRowType() { return typeof(clientsRow); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { base.OnRowChanged(e); if ((this.clientsRowChanged != null)) { this.clientsRowChanged(this, new clientsRowChangeEvent(((clientsRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { base.OnRowChanging(e); if ((this.clientsRowChanging != null)) { this.clientsRowChanging(this, new clientsRowChangeEvent(((clientsRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { base.OnRowDeleted(e); if ((this.clientsRowDeleted != null)) { this.clientsRowDeleted(this, new clientsRowChangeEvent(((clientsRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { base.OnRowDeleting(e); if ((this.clientsRowDeleting != null)) { this.clientsRowDeleting(this, new clientsRowChangeEvent(((clientsRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public void RemoveclientsRow(clientsRow row) { this.Rows.Remove(row); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); mydbDataSet ds = new mydbDataSet(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "clientsDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; } } /// <summary> ///Represents the strongly named DataTable class. ///</summary> [global::System.Serializable()] [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] public partial class invoicesDataTable : global::System.Data.TypedTableBase<invoicesRow> { private global::System.Data.DataColumn columnInvoiceID; private global::System.Data.DataColumn columnDate; private global::System.Data.DataColumn columnClients_ClientID; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public invoicesDataTable() { this.TableName = "invoices"; this.BeginInit(); this.InitClass(); this.EndInit(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal invoicesDataTable(global::System.Data.DataTable table) { this.TableName = table.TableName; if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { this.CaseSensitive = table.CaseSensitive; } if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { this.Locale = table.Locale; } if ((table.Namespace != table.DataSet.Namespace)) { this.Namespace = table.Namespace; } this.Prefix = table.Prefix; this.MinimumCapacity = table.MinimumCapacity; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected invoicesDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context) { this.InitVars(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn InvoiceIDColumn { get { return this.columnInvoiceID; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn DateColumn { get { return this.columnDate; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn Clients_ClientIDColumn { get { return this.columnClients_ClientID; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] public int Count { get { return this.Rows.Count; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public invoicesRow this[int index] { get { return ((invoicesRow)(this.Rows[index])); } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event invoicesRowChangeEventHandler invoicesRowChanging; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event invoicesRowChangeEventHandler invoicesRowChanged; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event invoicesRowChangeEventHandler invoicesRowDeleting; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event invoicesRowChangeEventHandler invoicesRowDeleted; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public void AddinvoicesRow(invoicesRow row) { this.Rows.Add(row); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public invoicesRow AddinvoicesRow(System.DateTime Date, clientsRow parentclientsRowByfk_Invoices_Clients) { invoicesRow rowinvoicesRow = ((invoicesRow)(this.NewRow())); object[] columnValuesArray = new object[] { null, Date, null}; if ((parentclientsRowByfk_Invoices_Clients != null)) { columnValuesArray[2] = parentclientsRowByfk_Invoices_Clients[0]; } rowinvoicesRow.ItemArray = columnValuesArray; this.Rows.Add(rowinvoicesRow); return rowinvoicesRow; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public invoicesRow FindByInvoiceID(int InvoiceID) { return ((invoicesRow)(this.Rows.Find(new object[] { InvoiceID}))); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public override global::System.Data.DataTable Clone() { invoicesDataTable cln = ((invoicesDataTable)(base.Clone())); cln.InitVars(); return cln; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Data.DataTable CreateInstance() { return new invoicesDataTable(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars() { this.columnInvoiceID = base.Columns["InvoiceID"]; this.columnDate = base.Columns["Date"]; this.columnClients_ClientID = base.Columns["Clients_ClientID"]; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitClass() { this.columnInvoiceID = new global::System.Data.DataColumn("InvoiceID", typeof(int), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnInvoiceID); this.columnDate = new global::System.Data.DataColumn("Date", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnDate); this.columnClients_ClientID = new global::System.Data.DataColumn("Clients_ClientID", typeof(int), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnClients_ClientID); this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { this.columnInvoiceID}, true)); this.columnInvoiceID.AutoIncrement = true; this.columnInvoiceID.AutoIncrementSeed = -1; this.columnInvoiceID.AutoIncrementStep = -1; this.columnInvoiceID.AllowDBNull = false; this.columnInvoiceID.Unique = true; this.columnDate.AllowDBNull = false; this.columnClients_ClientID.AllowDBNull = false; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public invoicesRow NewinvoicesRow() { return ((invoicesRow)(this.NewRow())); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { return new invoicesRow(builder); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Type GetRowType() { return typeof(invoicesRow); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { base.OnRowChanged(e); if ((this.invoicesRowChanged != null)) { this.invoicesRowChanged(this, new invoicesRowChangeEvent(((invoicesRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { base.OnRowChanging(e); if ((this.invoicesRowChanging != null)) { this.invoicesRowChanging(this, new invoicesRowChangeEvent(((invoicesRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { base.OnRowDeleted(e); if ((this.invoicesRowDeleted != null)) { this.invoicesRowDeleted(this, new invoicesRowChangeEvent(((invoicesRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { base.OnRowDeleting(e); if ((this.invoicesRowDeleting != null)) { this.invoicesRowDeleting(this, new invoicesRowChangeEvent(((invoicesRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public void RemoveinvoicesRow(invoicesRow row) { this.Rows.Remove(row); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); mydbDataSet ds = new mydbDataSet(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "invoicesDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; } } /// <summary> ///Represents the strongly named DataTable class. ///</summary> [global::System.Serializable()] [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] public partial class itemsDataTable : global::System.Data.TypedTableBase<itemsRow> { private global::System.Data.DataColumn columnItemID; private global::System.Data.DataColumn columnItem; private global::System.Data.DataColumn columnPrice; private global::System.Data.DataColumn columnTaxApplicable; private global::System.Data.DataColumn columnInvoices_InvoiceID; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public itemsDataTable() { this.TableName = "items"; this.BeginInit(); this.InitClass(); this.EndInit(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal itemsDataTable(global::System.Data.DataTable table) { this.TableName = table.TableName; if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { this.CaseSensitive = table.CaseSensitive; } if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { this.Locale = table.Locale; } if ((table.Namespace != table.DataSet.Namespace)) { this.Namespace = table.Namespace; } this.Prefix = table.Prefix; this.MinimumCapacity = table.MinimumCapacity; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected itemsDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context) { this.InitVars(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn ItemIDColumn { get { return this.columnItemID; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn ItemColumn { get { return this.columnItem; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn PriceColumn { get { return this.columnPrice; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn TaxApplicableColumn { get { return this.columnTaxApplicable; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn Invoices_InvoiceIDColumn { get { return this.columnInvoices_InvoiceID; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] public int Count { get { return this.Rows.Count; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public itemsRow this[int index] { get { return ((itemsRow)(this.Rows[index])); } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event itemsRowChangeEventHandler itemsRowChanging; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event itemsRowChangeEventHandler itemsRowChanged; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event itemsRowChangeEventHandler itemsRowDeleting; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event itemsRowChangeEventHandler itemsRowDeleted; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public void AdditemsRow(itemsRow row) { this.Rows.Add(row); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public itemsRow AdditemsRow(string Item, int Price, int TaxApplicable, invoicesRow parentinvoicesRowByfk_Items_Invoices1) { itemsRow rowitemsRow = ((itemsRow)(this.NewRow())); object[] columnValuesArray = new object[] { null, Item, Price, TaxApplicable, null}; if ((parentinvoicesRowByfk_Items_Invoices1 != null)) { columnValuesArray[4] = parentinvoicesRowByfk_Items_Invoices1[0]; } rowitemsRow.ItemArray = columnValuesArray; this.Rows.Add(rowitemsRow); return rowitemsRow; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public itemsRow FindByItemID(int ItemID) { return ((itemsRow)(this.Rows.Find(new object[] { ItemID}))); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public override global::System.Data.DataTable Clone() { itemsDataTable cln = ((itemsDataTable)(base.Clone())); cln.InitVars(); return cln; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Data.DataTable CreateInstance() { return new itemsDataTable(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars() { this.columnItemID = base.Columns["ItemID"]; this.columnItem = base.Columns["Item"]; this.columnPrice = base.Columns["Price"]; this.columnTaxApplicable = base.Columns["TaxApplicable"]; this.columnInvoices_InvoiceID = base.Columns["Invoices_InvoiceID"]; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitClass() { this.columnItemID = new global::System.Data.DataColumn("ItemID", typeof(int), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnItemID); this.columnItem = new global::System.Data.DataColumn("Item", typeof(string), null, global::System.Data.MappingType.Element); this.columnItem.ExtendedProperties.Add("Generator_ColumnPropNameInRow", "Item"); this.columnItem.ExtendedProperties.Add("Generator_ColumnPropNameInTable", "ItemColumn"); this.columnItem.ExtendedProperties.Add("Generator_ColumnVarNameInTable", "columnItem"); this.columnItem.ExtendedProperties.Add("Generator_UserColumnName", "Item"); base.Columns.Add(this.columnItem); this.columnPrice = new global::System.Data.DataColumn("Price", typeof(int), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnPrice); this.columnTaxApplicable = new global::System.Data.DataColumn("TaxApplicable", typeof(int), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnTaxApplicable); this.columnInvoices_InvoiceID = new global::System.Data.DataColumn("Invoices_InvoiceID", typeof(int), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnInvoices_InvoiceID); this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { this.columnItemID}, true)); this.columnItemID.AutoIncrement = true; this.columnItemID.AutoIncrementSeed = -1; this.columnItemID.AutoIncrementStep = -1; this.columnItemID.AllowDBNull = false; this.columnItemID.Unique = true; this.columnItem.AllowDBNull = false; this.columnItem.MaxLength = 5000; this.columnPrice.AllowDBNull = false; this.columnTaxApplicable.AllowDBNull = false; this.columnInvoices_InvoiceID.AllowDBNull = false; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public itemsRow NewitemsRow() { return ((itemsRow)(this.NewRow())); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { return new itemsRow(builder); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Type GetRowType() { return typeof(itemsRow); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { base.OnRowChanged(e); if ((this.itemsRowChanged != null)) { this.itemsRowChanged(this, new itemsRowChangeEvent(((itemsRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { base.OnRowChanging(e); if ((this.itemsRowChanging != null)) { this.itemsRowChanging(this, new itemsRowChangeEvent(((itemsRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { base.OnRowDeleted(e); if ((this.itemsRowDeleted != null)) { this.itemsRowDeleted(this, new itemsRowChangeEvent(((itemsRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { base.OnRowDeleting(e); if ((this.itemsRowDeleting != null)) { this.itemsRowDeleting(this, new itemsRowChangeEvent(((itemsRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public void RemoveitemsRow(itemsRow row) { this.Rows.Remove(row); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); mydbDataSet ds = new mydbDataSet(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "itemsDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; } } /// <summary> ///Represents strongly named DataRow class. ///</summary> public partial class clientsRow : global::System.Data.DataRow { private clientsDataTable tableclients; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal clientsRow(global::System.Data.DataRowBuilder rb) : base(rb) { this.tableclients = ((clientsDataTable)(this.Table)); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public int ClientID { get { return ((int)(this[this.tableclients.ClientIDColumn])); } set { this[this.tableclients.ClientIDColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public string FirstName { get { return ((string)(this[this.tableclients.FirstNameColumn])); } set { this[this.tableclients.FirstNameColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public string LastName { get { return ((string)(this[this.tableclients.LastNameColumn])); } set { this[this.tableclients.LastNameColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public string Company { get { try { return ((string)(this[this.tableclients.CompanyColumn])); } catch (global::System.InvalidCastException e) { throw new global::System.Data.StrongTypingException("The value for column \'Company\' in table \'clients\' is DBNull.", e); } } set { this[this.tableclients.CompanyColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public string Phone { get { return ((string)(this[this.tableclients.PhoneColumn])); } set { this[this.tableclients.PhoneColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public string Email { get { return ((string)(this[this.tableclients.EmailColumn])); } set { this[this.tableclients.EmailColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public string Address { get { try { return ((string)(this[this.tableclients.AddressColumn])); } catch (global::System.InvalidCastException e) { throw new global::System.Data.StrongTypingException("The value for column \'Address\' in table \'clients\' is DBNull.", e); } } set { this[this.tableclients.AddressColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public string Note { get { try { return ((string)(this[this.tableclients.NoteColumn])); } catch (global::System.InvalidCastException e) { throw new global::System.Data.StrongTypingException("The value for column \'Note\' in table \'clients\' is DBNull.", e); } } set { this[this.tableclients.NoteColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public bool IsCompanyNull() { return this.IsNull(this.tableclients.CompanyColumn); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public void SetCompanyNull() { this[this.tableclients.CompanyColumn] = global::System.Convert.DBNull; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public bool IsAddressNull() { return this.IsNull(this.tableclients.AddressColumn); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public void SetAddressNull() { this[this.tableclients.AddressColumn] = global::System.Convert.DBNull; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public bool IsNoteNull() { return this.IsNull(this.tableclients.NoteColumn); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public void SetNoteNull() { this[this.tableclients.NoteColumn] = global::System.Convert.DBNull; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public invoicesRow[] GetinvoicesRows() { if ((this.Table.ChildRelations["fk_Invoices_Clients"] == null)) { return new invoicesRow[0]; } else { return ((invoicesRow[])(base.GetChildRows(this.Table.ChildRelations["fk_Invoices_Clients"]))); } } } /// <summary> ///Represents strongly named DataRow class. ///</summary> public partial class invoicesRow : global::System.Data.DataRow { private invoicesDataTable tableinvoices; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal invoicesRow(global::System.Data.DataRowBuilder rb) : base(rb) { this.tableinvoices = ((invoicesDataTable)(this.Table)); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public int InvoiceID { get { return ((int)(this[this.tableinvoices.InvoiceIDColumn])); } set { this[this.tableinvoices.InvoiceIDColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public System.DateTime Date { get { return ((global::System.DateTime)(this[this.tableinvoices.DateColumn])); } set { this[this.tableinvoices.DateColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public int Clients_ClientID { get { return ((int)(this[this.tableinvoices.Clients_ClientIDColumn])); } set { this[this.tableinvoices.Clients_ClientIDColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public clientsRow clientsRow { get { return ((clientsRow)(this.GetParentRow(this.Table.ParentRelations["fk_Invoices_Clients"]))); } set { this.SetParentRow(value, this.Table.ParentRelations["fk_Invoices_Clients"]); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public itemsRow[] GetitemsRows() { if ((this.Table.ChildRelations["fk_Items_Invoices1"] == null)) { return new itemsRow[0]; } else { return ((itemsRow[])(base.GetChildRows(this.Table.ChildRelations["fk_Items_Invoices1"]))); } } } /// <summary> ///Represents strongly named DataRow class. ///</summary> public partial class itemsRow : global::System.Data.DataRow { private itemsDataTable tableitems; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal itemsRow(global::System.Data.DataRowBuilder rb) : base(rb) { this.tableitems = ((itemsDataTable)(this.Table)); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public int ItemID { get { return ((int)(this[this.tableitems.ItemIDColumn])); } set { this[this.tableitems.ItemIDColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public string Item { get { return ((string)(this[this.tableitems.ItemColumn])); } set { this[this.tableitems.ItemColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public int Price { get { return ((int)(this[this.tableitems.PriceColumn])); } set { this[this.tableitems.PriceColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public int TaxApplicable { get { return ((int)(this[this.tableitems.TaxApplicableColumn])); } set { this[this.tableitems.TaxApplicableColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public int Invoices_InvoiceID { get { return ((int)(this[this.tableitems.Invoices_InvoiceIDColumn])); } set { this[this.tableitems.Invoices_InvoiceIDColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public invoicesRow invoicesRow { get { return ((invoicesRow)(this.GetParentRow(this.Table.ParentRelations["fk_Items_Invoices1"]))); } set { this.SetParentRow(value, this.Table.ParentRelations["fk_Items_Invoices1"]); } } } /// <summary> ///Row event argument class ///</summary> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public class clientsRowChangeEvent : global::System.EventArgs { private clientsRow eventRow; private global::System.Data.DataRowAction eventAction; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public clientsRowChangeEvent(clientsRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public clientsRow Row { get { return this.eventRow; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataRowAction Action { get { return this.eventAction; } } } /// <summary> ///Row event argument class ///</summary> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public class invoicesRowChangeEvent : global::System.EventArgs { private invoicesRow eventRow; private global::System.Data.DataRowAction eventAction; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public invoicesRowChangeEvent(invoicesRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public invoicesRow Row { get { return this.eventRow; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataRowAction Action { get { return this.eventAction; } } } /// <summary> ///Row event argument class ///</summary> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public class itemsRowChangeEvent : global::System.EventArgs { private itemsRow eventRow; private global::System.Data.DataRowAction eventAction; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public itemsRowChangeEvent(itemsRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public itemsRow Row { get { return this.eventRow; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataRowAction Action { get { return this.eventAction; } } } } } namespace Moneta.mydbDataSetTableAdapters { /// <summary> ///Represents the connection and commands used to retrieve and save data. ///</summary> [global::System.ComponentModel.DesignerCategoryAttribute("code")] [global::System.ComponentModel.ToolboxItem(true)] [global::System.ComponentModel.DataObjectAttribute(true)] [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + ", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public partial class clientsTableAdapter : global::System.ComponentModel.Component { private global::MySql.Data.MySqlClient.MySqlDataAdapter _adapter; private global::MySql.Data.MySqlClient.MySqlConnection _connection; private global::MySql.Data.MySqlClient.MySqlTransaction _transaction; private global::MySql.Data.MySqlClient.MySqlCommand[] _commandCollection; private bool _clearBeforeFill; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public clientsTableAdapter() { this.ClearBeforeFill = true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected internal global::MySql.Data.MySqlClient.MySqlDataAdapter Adapter { get { if ((this._adapter == null)) { this.InitAdapter(); } return this._adapter; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal global::MySql.Data.MySqlClient.MySqlConnection Connection { get { if ((this._connection == null)) { this.InitConnection(); } return this._connection; } set { this._connection = value; if ((this.Adapter.InsertCommand != null)) { this.Adapter.InsertCommand.Connection = value; } if ((this.Adapter.DeleteCommand != null)) { this.Adapter.DeleteCommand.Connection = value; } if ((this.Adapter.UpdateCommand != null)) { this.Adapter.UpdateCommand.Connection = value; } for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { if ((this.CommandCollection[i] != null)) { ((global::MySql.Data.MySqlClient.MySqlCommand)(this.CommandCollection[i])).Connection = value; } } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal global::MySql.Data.MySqlClient.MySqlTransaction Transaction { get { return this._transaction; } set { this._transaction = value; for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { this.CommandCollection[i].Transaction = this._transaction; } if (((this.Adapter != null) && (this.Adapter.DeleteCommand != null))) { this.Adapter.DeleteCommand.Transaction = this._transaction; } if (((this.Adapter != null) && (this.Adapter.InsertCommand != null))) { this.Adapter.InsertCommand.Transaction = this._transaction; } if (((this.Adapter != null) && (this.Adapter.UpdateCommand != null))) { this.Adapter.UpdateCommand.Transaction = this._transaction; } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected global::MySql.Data.MySqlClient.MySqlCommand[] CommandCollection { get { if ((this._commandCollection == null)) { this.InitCommandCollection(); } return this._commandCollection; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public bool ClearBeforeFill { get { return this._clearBeforeFill; } set { this._clearBeforeFill = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitAdapter() { this._adapter = new global::MySql.Data.MySqlClient.MySqlDataAdapter(); global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); tableMapping.SourceTable = "Table"; tableMapping.DataSetTable = "clients"; tableMapping.ColumnMappings.Add("ClientID", "ClientID"); tableMapping.ColumnMappings.Add("FirstName", "FirstName"); tableMapping.ColumnMappings.Add("LastName", "LastName"); tableMapping.ColumnMappings.Add("Company", "Company"); tableMapping.ColumnMappings.Add("Phone", "Phone"); tableMapping.ColumnMappings.Add("Email", "Email"); tableMapping.ColumnMappings.Add("Address", "Address"); tableMapping.ColumnMappings.Add("Note", "Note"); this._adapter.TableMappings.Add(tableMapping); this._adapter.DeleteCommand = new global::MySql.Data.MySqlClient.MySqlCommand(); this._adapter.DeleteCommand.Connection = this.Connection; this._adapter.DeleteCommand.CommandText = @"DELETE FROM `clients` WHERE ((`ClientID` = @p1) AND (`FirstName` = @p2) AND (`LastName` = @p3) AND ((@p4 = 1 AND `Company` IS NULL) OR (`Company` = @p5)) AND (`Phone` = @p6) AND (`Email` = @p7) AND ((@p8 = 1 AND `Address` IS NULL) OR (`Address` = @p9)) AND ((@p10 = 1 AND `Note` IS NULL) OR (`Note` = @p11)))"; this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text; global::MySql.Data.MySqlClient.MySqlParameter param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p1"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "ClientID"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p2"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "FirstName"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p3"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "LastName"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p4"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Company"; param.SourceVersion = global::System.Data.DataRowVersion.Original; param.SourceColumnNullMapping = true; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p5"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Company"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p6"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Phone"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p7"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Email"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p8"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Address"; param.SourceVersion = global::System.Data.DataRowVersion.Original; param.SourceColumnNullMapping = true; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p9"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Address"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p10"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Note"; param.SourceVersion = global::System.Data.DataRowVersion.Original; param.SourceColumnNullMapping = true; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p11"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Note"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); this._adapter.InsertCommand = new global::MySql.Data.MySqlClient.MySqlCommand(); this._adapter.InsertCommand.Connection = this.Connection; this._adapter.InsertCommand.CommandText = "INSERT INTO `clients` (`FirstName`, `LastName`, `Company`, `Phone`, `Email`, `Add" + "ress`, `Note`) VALUES (@p1, @p2, @p3, @p4, @p5, @p6, @p7)"; this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text; param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p1"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "FirstName"; this._adapter.InsertCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p2"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "LastName"; this._adapter.InsertCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p3"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Company"; this._adapter.InsertCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p4"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Phone"; this._adapter.InsertCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p5"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Email"; this._adapter.InsertCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p6"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Address"; this._adapter.InsertCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p7"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Note"; this._adapter.InsertCommand.Parameters.Add(param); this._adapter.UpdateCommand = new global::MySql.Data.MySqlClient.MySqlCommand(); this._adapter.UpdateCommand.Connection = this.Connection; this._adapter.UpdateCommand.CommandText = @"UPDATE `clients` SET `FirstName` = @p1, `LastName` = @p2, `Company` = @p3, `Phone` = @p4, `Email` = @p5, `Address` = @p6, `Note` = @p7 WHERE ((`ClientID` = @p8) AND (`FirstName` = @p9) AND (`LastName` = @p10) AND ((@p11 = 1 AND `Company` IS NULL) OR (`Company` = @p12)) AND (`Phone` = @p13) AND (`Email` = @p14) AND ((@p15 = 1 AND `Address` IS NULL) OR (`Address` = @p16)) AND ((@p17 = 1 AND `Note` IS NULL) OR (`Note` = @p18)))"; this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text; param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p1"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "FirstName"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p2"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "LastName"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p3"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Company"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p4"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Phone"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p5"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Email"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p6"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Address"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p7"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Note"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p8"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "ClientID"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p9"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "FirstName"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p10"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "LastName"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p11"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Company"; param.SourceVersion = global::System.Data.DataRowVersion.Original; param.SourceColumnNullMapping = true; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p12"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Company"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p13"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Phone"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p14"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Email"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p15"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Address"; param.SourceVersion = global::System.Data.DataRowVersion.Original; param.SourceColumnNullMapping = true; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p16"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Address"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p17"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Note"; param.SourceVersion = global::System.Data.DataRowVersion.Original; param.SourceColumnNullMapping = true; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p18"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Note"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitConnection() { this._connection = new global::MySql.Data.MySqlClient.MySqlConnection(); this._connection.ConnectionString = global::Moneta.Properties.Settings.Default.mydbConnectionString; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitCommandCollection() { this._commandCollection = new global::MySql.Data.MySqlClient.MySqlCommand[1]; this._commandCollection[0] = new global::MySql.Data.MySqlClient.MySqlCommand(); this._commandCollection[0].Connection = this.Connection; this._commandCollection[0].CommandText = "SELECT `ClientID`, `FirstName`, `LastName`, `Company`, `Phone`, `Email`, `Address" + "`, `Note` FROM `clients`"; this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(mydbDataSet.clientsDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; if ((this.ClearBeforeFill == true)) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); return returnValue; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] public virtual mydbDataSet.clientsDataTable GetData() { this.Adapter.SelectCommand = this.CommandCollection[0]; mydbDataSet.clientsDataTable dataTable = new mydbDataSet.clientsDataTable(); this.Adapter.Fill(dataTable); return dataTable; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(mydbDataSet.clientsDataTable dataTable) { return this.Adapter.Update(dataTable); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(mydbDataSet dataSet) { return this.Adapter.Update(dataSet, "clients"); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(global::System.Data.DataRow dataRow) { return this.Adapter.Update(new global::System.Data.DataRow[] { dataRow}); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(global::System.Data.DataRow[] dataRows) { return this.Adapter.Update(dataRows); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)] public virtual int Delete(int p1, string p2, string p3, string p5, string p6, string p7, string p9, string p11) { this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(p1)); if ((p2 == null)) { throw new global::System.ArgumentNullException("p2"); } else { this.Adapter.DeleteCommand.Parameters[1].Value = ((string)(p2)); } if ((p3 == null)) { throw new global::System.ArgumentNullException("p3"); } else { this.Adapter.DeleteCommand.Parameters[2].Value = ((string)(p3)); } if ((p5 == null)) { this.Adapter.DeleteCommand.Parameters[3].Value = ((object)(1)); this.Adapter.DeleteCommand.Parameters[4].Value = global::System.DBNull.Value; } else { this.Adapter.DeleteCommand.Parameters[3].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[4].Value = ((string)(p5)); } if ((p6 == null)) { throw new global::System.ArgumentNullException("p6"); } else { this.Adapter.DeleteCommand.Parameters[5].Value = ((string)(p6)); } if ((p7 == null)) { throw new global::System.ArgumentNullException("p7"); } else { this.Adapter.DeleteCommand.Parameters[6].Value = ((string)(p7)); } if ((p9 == null)) { this.Adapter.DeleteCommand.Parameters[7].Value = ((object)(1)); this.Adapter.DeleteCommand.Parameters[8].Value = global::System.DBNull.Value; } else { this.Adapter.DeleteCommand.Parameters[7].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[8].Value = ((string)(p9)); } if ((p11 == null)) { this.Adapter.DeleteCommand.Parameters[9].Value = ((object)(1)); this.Adapter.DeleteCommand.Parameters[10].Value = global::System.DBNull.Value; } else { this.Adapter.DeleteCommand.Parameters[9].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[10].Value = ((string)(p11)); } global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State; if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.DeleteCommand.Connection.Open(); } try { int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery(); return returnValue; } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.DeleteCommand.Connection.Close(); } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)] public virtual int Insert(string p1, string p2, string p3, string p4, string p5, string p6, string p7) { if ((p1 == null)) { throw new global::System.ArgumentNullException("p1"); } else { this.Adapter.InsertCommand.Parameters[0].Value = ((string)(p1)); } if ((p2 == null)) { throw new global::System.ArgumentNullException("p2"); } else { this.Adapter.InsertCommand.Parameters[1].Value = ((string)(p2)); } if ((p3 == null)) { this.Adapter.InsertCommand.Parameters[2].Value = global::System.DBNull.Value; } else { this.Adapter.InsertCommand.Parameters[2].Value = ((string)(p3)); } if ((p4 == null)) { throw new global::System.ArgumentNullException("p4"); } else { this.Adapter.InsertCommand.Parameters[3].Value = ((string)(p4)); } if ((p5 == null)) { throw new global::System.ArgumentNullException("p5"); } else { this.Adapter.InsertCommand.Parameters[4].Value = ((string)(p5)); } if ((p6 == null)) { this.Adapter.InsertCommand.Parameters[5].Value = global::System.DBNull.Value; } else { this.Adapter.InsertCommand.Parameters[5].Value = ((string)(p6)); } if ((p7 == null)) { this.Adapter.InsertCommand.Parameters[6].Value = global::System.DBNull.Value; } else { this.Adapter.InsertCommand.Parameters[6].Value = ((string)(p7)); } global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State; if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.InsertCommand.Connection.Open(); } try { int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery(); return returnValue; } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.InsertCommand.Connection.Close(); } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)] public virtual int Update(string p1, string p2, string p3, string p4, string p5, string p6, string p7, int p8, string p9, string p10, string p12, string p13, string p14, string p16, string p18) { if ((p1 == null)) { throw new global::System.ArgumentNullException("p1"); } else { this.Adapter.UpdateCommand.Parameters[0].Value = ((string)(p1)); } if ((p2 == null)) { throw new global::System.ArgumentNullException("p2"); } else { this.Adapter.UpdateCommand.Parameters[1].Value = ((string)(p2)); } if ((p3 == null)) { this.Adapter.UpdateCommand.Parameters[2].Value = global::System.DBNull.Value; } else { this.Adapter.UpdateCommand.Parameters[2].Value = ((string)(p3)); } if ((p4 == null)) { throw new global::System.ArgumentNullException("p4"); } else { this.Adapter.UpdateCommand.Parameters[3].Value = ((string)(p4)); } if ((p5 == null)) { throw new global::System.ArgumentNullException("p5"); } else { this.Adapter.UpdateCommand.Parameters[4].Value = ((string)(p5)); } if ((p6 == null)) { this.Adapter.UpdateCommand.Parameters[5].Value = global::System.DBNull.Value; } else { this.Adapter.UpdateCommand.Parameters[5].Value = ((string)(p6)); } if ((p7 == null)) { this.Adapter.UpdateCommand.Parameters[6].Value = global::System.DBNull.Value; } else { this.Adapter.UpdateCommand.Parameters[6].Value = ((string)(p7)); } this.Adapter.UpdateCommand.Parameters[7].Value = ((int)(p8)); if ((p9 == null)) { throw new global::System.ArgumentNullException("p9"); } else { this.Adapter.UpdateCommand.Parameters[8].Value = ((string)(p9)); } if ((p10 == null)) { throw new global::System.ArgumentNullException("p10"); } else { this.Adapter.UpdateCommand.Parameters[9].Value = ((string)(p10)); } if ((p12 == null)) { this.Adapter.UpdateCommand.Parameters[10].Value = ((object)(1)); this.Adapter.UpdateCommand.Parameters[11].Value = global::System.DBNull.Value; } else { this.Adapter.UpdateCommand.Parameters[10].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[11].Value = ((string)(p12)); } if ((p13 == null)) { throw new global::System.ArgumentNullException("p13"); } else { this.Adapter.UpdateCommand.Parameters[12].Value = ((string)(p13)); } if ((p14 == null)) { throw new global::System.ArgumentNullException("p14"); } else { this.Adapter.UpdateCommand.Parameters[13].Value = ((string)(p14)); } if ((p16 == null)) { this.Adapter.UpdateCommand.Parameters[14].Value = ((object)(1)); this.Adapter.UpdateCommand.Parameters[15].Value = global::System.DBNull.Value; } else { this.Adapter.UpdateCommand.Parameters[14].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[15].Value = ((string)(p16)); } if ((p18 == null)) { this.Adapter.UpdateCommand.Parameters[16].Value = ((object)(1)); this.Adapter.UpdateCommand.Parameters[17].Value = global::System.DBNull.Value; } else { this.Adapter.UpdateCommand.Parameters[16].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[17].Value = ((string)(p18)); } global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State; if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.UpdateCommand.Connection.Open(); } try { int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery(); return returnValue; } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.UpdateCommand.Connection.Close(); } } } } /// <summary> ///Represents the connection and commands used to retrieve and save data. ///</summary> [global::System.ComponentModel.DesignerCategoryAttribute("code")] [global::System.ComponentModel.ToolboxItem(true)] [global::System.ComponentModel.DataObjectAttribute(true)] [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + ", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public partial class invoicesTableAdapter : global::System.ComponentModel.Component { private global::MySql.Data.MySqlClient.MySqlDataAdapter _adapter; private global::MySql.Data.MySqlClient.MySqlConnection _connection; private global::MySql.Data.MySqlClient.MySqlTransaction _transaction; private global::MySql.Data.MySqlClient.MySqlCommand[] _commandCollection; private bool _clearBeforeFill; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public invoicesTableAdapter() { this.ClearBeforeFill = true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected internal global::MySql.Data.MySqlClient.MySqlDataAdapter Adapter { get { if ((this._adapter == null)) { this.InitAdapter(); } return this._adapter; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal global::MySql.Data.MySqlClient.MySqlConnection Connection { get { if ((this._connection == null)) { this.InitConnection(); } return this._connection; } set { this._connection = value; if ((this.Adapter.InsertCommand != null)) { this.Adapter.InsertCommand.Connection = value; } if ((this.Adapter.DeleteCommand != null)) { this.Adapter.DeleteCommand.Connection = value; } if ((this.Adapter.UpdateCommand != null)) { this.Adapter.UpdateCommand.Connection = value; } for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { if ((this.CommandCollection[i] != null)) { ((global::MySql.Data.MySqlClient.MySqlCommand)(this.CommandCollection[i])).Connection = value; } } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal global::MySql.Data.MySqlClient.MySqlTransaction Transaction { get { return this._transaction; } set { this._transaction = value; for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { this.CommandCollection[i].Transaction = this._transaction; } if (((this.Adapter != null) && (this.Adapter.DeleteCommand != null))) { this.Adapter.DeleteCommand.Transaction = this._transaction; } if (((this.Adapter != null) && (this.Adapter.InsertCommand != null))) { this.Adapter.InsertCommand.Transaction = this._transaction; } if (((this.Adapter != null) && (this.Adapter.UpdateCommand != null))) { this.Adapter.UpdateCommand.Transaction = this._transaction; } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected global::MySql.Data.MySqlClient.MySqlCommand[] CommandCollection { get { if ((this._commandCollection == null)) { this.InitCommandCollection(); } return this._commandCollection; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public bool ClearBeforeFill { get { return this._clearBeforeFill; } set { this._clearBeforeFill = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitAdapter() { this._adapter = new global::MySql.Data.MySqlClient.MySqlDataAdapter(); global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); tableMapping.SourceTable = "Table"; tableMapping.DataSetTable = "invoices"; tableMapping.ColumnMappings.Add("InvoiceID", "InvoiceID"); tableMapping.ColumnMappings.Add("Date", "Date"); tableMapping.ColumnMappings.Add("Clients_ClientID", "Clients_ClientID"); this._adapter.TableMappings.Add(tableMapping); this._adapter.DeleteCommand = new global::MySql.Data.MySqlClient.MySqlCommand(); this._adapter.DeleteCommand.Connection = this.Connection; this._adapter.DeleteCommand.CommandText = "DELETE FROM `invoices` WHERE ((`InvoiceID` = @p1) AND (`Date` = @p2) AND (`Client" + "s_ClientID` = @p3))"; this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text; global::MySql.Data.MySqlClient.MySqlParameter param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p1"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "InvoiceID"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p2"; param.DbType = global::System.Data.DbType.Date; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Date; param.IsNullable = true; param.SourceColumn = "Date"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p3"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Clients_ClientID"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); this._adapter.InsertCommand = new global::MySql.Data.MySqlClient.MySqlCommand(); this._adapter.InsertCommand.Connection = this.Connection; this._adapter.InsertCommand.CommandText = "INSERT INTO `invoices` (`Date`, `Clients_ClientID`) VALUES (@p1, @p2)"; this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text; param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p1"; param.DbType = global::System.Data.DbType.Date; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Date; param.IsNullable = true; param.SourceColumn = "Date"; this._adapter.InsertCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p2"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Clients_ClientID"; this._adapter.InsertCommand.Parameters.Add(param); this._adapter.UpdateCommand = new global::MySql.Data.MySqlClient.MySqlCommand(); this._adapter.UpdateCommand.Connection = this.Connection; this._adapter.UpdateCommand.CommandText = "UPDATE `invoices` SET `Date` = @p1, `Clients_ClientID` = @p2 WHERE ((`InvoiceID` " + "= @p3) AND (`Date` = @p4) AND (`Clients_ClientID` = @p5))"; this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text; param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p1"; param.DbType = global::System.Data.DbType.Date; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Date; param.IsNullable = true; param.SourceColumn = "Date"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p2"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Clients_ClientID"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p3"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "InvoiceID"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p4"; param.DbType = global::System.Data.DbType.Date; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Date; param.IsNullable = true; param.SourceColumn = "Date"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p5"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Clients_ClientID"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitConnection() { this._connection = new global::MySql.Data.MySqlClient.MySqlConnection(); this._connection.ConnectionString = global::Moneta.Properties.Settings.Default.mydbConnectionString; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitCommandCollection() { this._commandCollection = new global::MySql.Data.MySqlClient.MySqlCommand[1]; this._commandCollection[0] = new global::MySql.Data.MySqlClient.MySqlCommand(); this._commandCollection[0].Connection = this.Connection; this._commandCollection[0].CommandText = "SELECT `InvoiceID`, `Date`, `Clients_ClientID` FROM `invoices`"; this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(mydbDataSet.invoicesDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; if ((this.ClearBeforeFill == true)) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); return returnValue; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] public virtual mydbDataSet.invoicesDataTable GetData() { this.Adapter.SelectCommand = this.CommandCollection[0]; mydbDataSet.invoicesDataTable dataTable = new mydbDataSet.invoicesDataTable(); this.Adapter.Fill(dataTable); return dataTable; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(mydbDataSet.invoicesDataTable dataTable) { return this.Adapter.Update(dataTable); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(mydbDataSet dataSet) { return this.Adapter.Update(dataSet, "invoices"); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(global::System.Data.DataRow dataRow) { return this.Adapter.Update(new global::System.Data.DataRow[] { dataRow}); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(global::System.Data.DataRow[] dataRows) { return this.Adapter.Update(dataRows); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)] public virtual int Delete(int p1, System.DateTime p2, int p3) { this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(p1)); this.Adapter.DeleteCommand.Parameters[1].Value = ((System.DateTime)(p2)); this.Adapter.DeleteCommand.Parameters[2].Value = ((int)(p3)); global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State; if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.DeleteCommand.Connection.Open(); } try { int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery(); return returnValue; } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.DeleteCommand.Connection.Close(); } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)] public virtual int Insert(System.DateTime p1, int p2) { this.Adapter.InsertCommand.Parameters[0].Value = ((System.DateTime)(p1)); this.Adapter.InsertCommand.Parameters[1].Value = ((int)(p2)); global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State; if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.InsertCommand.Connection.Open(); } try { int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery(); return returnValue; } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.InsertCommand.Connection.Close(); } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)] public virtual int Update(System.DateTime p1, int p2, int p3, System.DateTime p4, int p5) { this.Adapter.UpdateCommand.Parameters[0].Value = ((System.DateTime)(p1)); this.Adapter.UpdateCommand.Parameters[1].Value = ((int)(p2)); this.Adapter.UpdateCommand.Parameters[2].Value = ((int)(p3)); this.Adapter.UpdateCommand.Parameters[3].Value = ((System.DateTime)(p4)); this.Adapter.UpdateCommand.Parameters[4].Value = ((int)(p5)); global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State; if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.UpdateCommand.Connection.Open(); } try { int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery(); return returnValue; } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.UpdateCommand.Connection.Close(); } } } } /// <summary> ///Represents the connection and commands used to retrieve and save data. ///</summary> [global::System.ComponentModel.DesignerCategoryAttribute("code")] [global::System.ComponentModel.ToolboxItem(true)] [global::System.ComponentModel.DataObjectAttribute(true)] [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + ", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public partial class itemsTableAdapter : global::System.ComponentModel.Component { private global::MySql.Data.MySqlClient.MySqlDataAdapter _adapter; private global::MySql.Data.MySqlClient.MySqlConnection _connection; private global::MySql.Data.MySqlClient.MySqlTransaction _transaction; private global::MySql.Data.MySqlClient.MySqlCommand[] _commandCollection; private bool _clearBeforeFill; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public itemsTableAdapter() { this.ClearBeforeFill = true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected internal global::MySql.Data.MySqlClient.MySqlDataAdapter Adapter { get { if ((this._adapter == null)) { this.InitAdapter(); } return this._adapter; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal global::MySql.Data.MySqlClient.MySqlConnection Connection { get { if ((this._connection == null)) { this.InitConnection(); } return this._connection; } set { this._connection = value; if ((this.Adapter.InsertCommand != null)) { this.Adapter.InsertCommand.Connection = value; } if ((this.Adapter.DeleteCommand != null)) { this.Adapter.DeleteCommand.Connection = value; } if ((this.Adapter.UpdateCommand != null)) { this.Adapter.UpdateCommand.Connection = value; } for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { if ((this.CommandCollection[i] != null)) { ((global::MySql.Data.MySqlClient.MySqlCommand)(this.CommandCollection[i])).Connection = value; } } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal global::MySql.Data.MySqlClient.MySqlTransaction Transaction { get { return this._transaction; } set { this._transaction = value; for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { this.CommandCollection[i].Transaction = this._transaction; } if (((this.Adapter != null) && (this.Adapter.DeleteCommand != null))) { this.Adapter.DeleteCommand.Transaction = this._transaction; } if (((this.Adapter != null) && (this.Adapter.InsertCommand != null))) { this.Adapter.InsertCommand.Transaction = this._transaction; } if (((this.Adapter != null) && (this.Adapter.UpdateCommand != null))) { this.Adapter.UpdateCommand.Transaction = this._transaction; } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected global::MySql.Data.MySqlClient.MySqlCommand[] CommandCollection { get { if ((this._commandCollection == null)) { this.InitCommandCollection(); } return this._commandCollection; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public bool ClearBeforeFill { get { return this._clearBeforeFill; } set { this._clearBeforeFill = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitAdapter() { this._adapter = new global::MySql.Data.MySqlClient.MySqlDataAdapter(); global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); tableMapping.SourceTable = "Table"; tableMapping.DataSetTable = "items"; tableMapping.ColumnMappings.Add("ItemID", "ItemID"); tableMapping.ColumnMappings.Add("Item", "Item"); tableMapping.ColumnMappings.Add("Price", "Price"); tableMapping.ColumnMappings.Add("TaxApplicable", "TaxApplicable"); tableMapping.ColumnMappings.Add("Invoices_InvoiceID", "Invoices_InvoiceID"); this._adapter.TableMappings.Add(tableMapping); this._adapter.DeleteCommand = new global::MySql.Data.MySqlClient.MySqlCommand(); this._adapter.DeleteCommand.Connection = this.Connection; this._adapter.DeleteCommand.CommandText = "DELETE FROM `items` WHERE ((`ItemID` = @p1) AND (`Item` = @p2) AND (`Price` = @p3" + ") AND (`TaxApplicable` = @p4) AND (`Invoices_InvoiceID` = @p5))"; this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text; global::MySql.Data.MySqlClient.MySqlParameter param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p1"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "ItemID"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p2"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Item"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p3"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Price"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p4"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "TaxApplicable"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p5"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Invoices_InvoiceID"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.DeleteCommand.Parameters.Add(param); this._adapter.InsertCommand = new global::MySql.Data.MySqlClient.MySqlCommand(); this._adapter.InsertCommand.Connection = this.Connection; this._adapter.InsertCommand.CommandText = "INSERT INTO `items` (`Item`, `Price`, `TaxApplicable`, `Invoices_InvoiceID`) VALU" + "ES (@p1, @p2, @p3, @p4)"; this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text; param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p1"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Item"; this._adapter.InsertCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p2"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Price"; this._adapter.InsertCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p3"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "TaxApplicable"; this._adapter.InsertCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p4"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Invoices_InvoiceID"; this._adapter.InsertCommand.Parameters.Add(param); this._adapter.UpdateCommand = new global::MySql.Data.MySqlClient.MySqlCommand(); this._adapter.UpdateCommand.Connection = this.Connection; this._adapter.UpdateCommand.CommandText = "UPDATE `items` SET `Item` = @p1, `Price` = @p2, `TaxApplicable` = @p3, `Invoices_" + "InvoiceID` = @p4 WHERE ((`ItemID` = @p5) AND (`Item` = @p6) AND (`Price` = @p7) " + "AND (`TaxApplicable` = @p8) AND (`Invoices_InvoiceID` = @p9))"; this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text; param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p1"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Item"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p2"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Price"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p3"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "TaxApplicable"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p4"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Invoices_InvoiceID"; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p5"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "ItemID"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p6"; param.DbType = global::System.Data.DbType.String; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.VarChar; param.IsNullable = true; param.SourceColumn = "Item"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p7"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Price"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p8"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "TaxApplicable"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); param = new global::MySql.Data.MySqlClient.MySqlParameter(); param.ParameterName = "@p9"; param.DbType = global::System.Data.DbType.Int32; param.MySqlDbType = global::MySql.Data.MySqlClient.MySqlDbType.Int32; param.IsNullable = true; param.SourceColumn = "Invoices_InvoiceID"; param.SourceVersion = global::System.Data.DataRowVersion.Original; this._adapter.UpdateCommand.Parameters.Add(param); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitConnection() { this._connection = new global::MySql.Data.MySqlClient.MySqlConnection(); this._connection.ConnectionString = global::Moneta.Properties.Settings.Default.mydbConnectionString; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitCommandCollection() { this._commandCollection = new global::MySql.Data.MySqlClient.MySqlCommand[1]; this._commandCollection[0] = new global::MySql.Data.MySqlClient.MySqlCommand(); this._commandCollection[0].Connection = this.Connection; this._commandCollection[0].CommandText = "SELECT `ItemID`, `Item`, `Price`, `TaxApplicable`, `Invoices_InvoiceID` FROM `ite" + "ms`"; this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(mydbDataSet.itemsDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; if ((this.ClearBeforeFill == true)) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); return returnValue; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] public virtual mydbDataSet.itemsDataTable GetData() { this.Adapter.SelectCommand = this.CommandCollection[0]; mydbDataSet.itemsDataTable dataTable = new mydbDataSet.itemsDataTable(); this.Adapter.Fill(dataTable); return dataTable; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(mydbDataSet.itemsDataTable dataTable) { return this.Adapter.Update(dataTable); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(mydbDataSet dataSet) { return this.Adapter.Update(dataSet, "items"); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(global::System.Data.DataRow dataRow) { return this.Adapter.Update(new global::System.Data.DataRow[] { dataRow}); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(global::System.Data.DataRow[] dataRows) { return this.Adapter.Update(dataRows); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)] public virtual int Delete(int p1, string p2, int p3, int p4, int p5) { this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(p1)); if ((p2 == null)) { throw new global::System.ArgumentNullException("p2"); } else { this.Adapter.DeleteCommand.Parameters[1].Value = ((string)(p2)); } this.Adapter.DeleteCommand.Parameters[2].Value = ((int)(p3)); this.Adapter.DeleteCommand.Parameters[3].Value = ((int)(p4)); this.Adapter.DeleteCommand.Parameters[4].Value = ((int)(p5)); global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State; if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.DeleteCommand.Connection.Open(); } try { int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery(); return returnValue; } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.DeleteCommand.Connection.Close(); } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)] public virtual int Insert(string p1, int p2, int p3, int p4) { if ((p1 == null)) { throw new global::System.ArgumentNullException("p1"); } else { this.Adapter.InsertCommand.Parameters[0].Value = ((string)(p1)); } this.Adapter.InsertCommand.Parameters[1].Value = ((int)(p2)); this.Adapter.InsertCommand.Parameters[2].Value = ((int)(p3)); this.Adapter.InsertCommand.Parameters[3].Value = ((int)(p4)); global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State; if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.InsertCommand.Connection.Open(); } try { int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery(); return returnValue; } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.InsertCommand.Connection.Close(); } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)] public virtual int Update(string p1, int p2, int p3, int p4, int p5, string p6, int p7, int p8, int p9) { if ((p1 == null)) { throw new global::System.ArgumentNullException("p1"); } else { this.Adapter.UpdateCommand.Parameters[0].Value = ((string)(p1)); } this.Adapter.UpdateCommand.Parameters[1].Value = ((int)(p2)); this.Adapter.UpdateCommand.Parameters[2].Value = ((int)(p3)); this.Adapter.UpdateCommand.Parameters[3].Value = ((int)(p4)); this.Adapter.UpdateCommand.Parameters[4].Value = ((int)(p5)); if ((p6 == null)) { throw new global::System.ArgumentNullException("p6"); } else { this.Adapter.UpdateCommand.Parameters[5].Value = ((string)(p6)); } this.Adapter.UpdateCommand.Parameters[6].Value = ((int)(p7)); this.Adapter.UpdateCommand.Parameters[7].Value = ((int)(p8)); this.Adapter.UpdateCommand.Parameters[8].Value = ((int)(p9)); global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State; if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.UpdateCommand.Connection.Open(); } try { int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery(); return returnValue; } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.UpdateCommand.Connection.Close(); } } } } /// <summary> ///TableAdapterManager is used to coordinate TableAdapters in the dataset to enable Hierarchical Update scenarios ///</summary> [global::System.ComponentModel.DesignerCategoryAttribute("code")] [global::System.ComponentModel.ToolboxItem(true)] [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerDesigner, Microsoft.VSD" + "esigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapterManager")] public partial class TableAdapterManager : global::System.ComponentModel.Component { private UpdateOrderOption _updateOrder; private clientsTableAdapter _clientsTableAdapter; private invoicesTableAdapter _invoicesTableAdapter; private itemsTableAdapter _itemsTableAdapter; private bool _backupDataSetBeforeUpdate; private global::System.Data.IDbConnection _connection; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public UpdateOrderOption UpdateOrder { get { return this._updateOrder; } set { this._updateOrder = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" + "ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" + "a", "System.Drawing.Design.UITypeEditor")] public clientsTableAdapter clientsTableAdapter { get { return this._clientsTableAdapter; } set { this._clientsTableAdapter = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" + "ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" + "a", "System.Drawing.Design.UITypeEditor")] public invoicesTableAdapter invoicesTableAdapter { get { return this._invoicesTableAdapter; } set { this._invoicesTableAdapter = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" + "ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" + "a", "System.Drawing.Design.UITypeEditor")] public itemsTableAdapter itemsTableAdapter { get { return this._itemsTableAdapter; } set { this._itemsTableAdapter = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public bool BackupDataSetBeforeUpdate { get { return this._backupDataSetBeforeUpdate; } set { this._backupDataSetBeforeUpdate = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] public global::System.Data.IDbConnection Connection { get { if ((this._connection != null)) { return this._connection; } if (((this._clientsTableAdapter != null) && (this._clientsTableAdapter.Connection != null))) { return this._clientsTableAdapter.Connection; } if (((this._invoicesTableAdapter != null) && (this._invoicesTableAdapter.Connection != null))) { return this._invoicesTableAdapter.Connection; } if (((this._itemsTableAdapter != null) && (this._itemsTableAdapter.Connection != null))) { return this._itemsTableAdapter.Connection; } return null; } set { this._connection = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] public int TableAdapterInstanceCount { get { int count = 0; if ((this._clientsTableAdapter != null)) { count = (count + 1); } if ((this._invoicesTableAdapter != null)) { count = (count + 1); } if ((this._itemsTableAdapter != null)) { count = (count + 1); } return count; } } /// <summary> ///Update rows in top-down order. ///</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private int UpdateUpdatedRows(mydbDataSet dataSet, global::System.Collections.Generic.List<global::System.Data.DataRow> allChangedRows, global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows) { int result = 0; if ((this._clientsTableAdapter != null)) { global::System.Data.DataRow[] updatedRows = dataSet.clients.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent); updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows); if (((updatedRows != null) && (0 < updatedRows.Length))) { result = (result + this._clientsTableAdapter.Update(updatedRows)); allChangedRows.AddRange(updatedRows); } } if ((this._invoicesTableAdapter != null)) { global::System.Data.DataRow[] updatedRows = dataSet.invoices.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent); updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows); if (((updatedRows != null) && (0 < updatedRows.Length))) { result = (result + this._invoicesTableAdapter.Update(updatedRows)); allChangedRows.AddRange(updatedRows); } } if ((this._itemsTableAdapter != null)) { global::System.Data.DataRow[] updatedRows = dataSet.items.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent); updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows); if (((updatedRows != null) && (0 < updatedRows.Length))) { result = (result + this._itemsTableAdapter.Update(updatedRows)); allChangedRows.AddRange(updatedRows); } } return result; } /// <summary> ///Insert rows in top-down order. ///</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private int UpdateInsertedRows(mydbDataSet dataSet, global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows) { int result = 0; if ((this._clientsTableAdapter != null)) { global::System.Data.DataRow[] addedRows = dataSet.clients.Select(null, null, global::System.Data.DataViewRowState.Added); if (((addedRows != null) && (0 < addedRows.Length))) { result = (result + this._clientsTableAdapter.Update(addedRows)); allAddedRows.AddRange(addedRows); } } if ((this._invoicesTableAdapter != null)) { global::System.Data.DataRow[] addedRows = dataSet.invoices.Select(null, null, global::System.Data.DataViewRowState.Added); if (((addedRows != null) && (0 < addedRows.Length))) { result = (result + this._invoicesTableAdapter.Update(addedRows)); allAddedRows.AddRange(addedRows); } } if ((this._itemsTableAdapter != null)) { global::System.Data.DataRow[] addedRows = dataSet.items.Select(null, null, global::System.Data.DataViewRowState.Added); if (((addedRows != null) && (0 < addedRows.Length))) { result = (result + this._itemsTableAdapter.Update(addedRows)); allAddedRows.AddRange(addedRows); } } return result; } /// <summary> ///Delete rows in bottom-up order. ///</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private int UpdateDeletedRows(mydbDataSet dataSet, global::System.Collections.Generic.List<global::System.Data.DataRow> allChangedRows) { int result = 0; if ((this._itemsTableAdapter != null)) { global::System.Data.DataRow[] deletedRows = dataSet.items.Select(null, null, global::System.Data.DataViewRowState.Deleted); if (((deletedRows != null) && (0 < deletedRows.Length))) { result = (result + this._itemsTableAdapter.Update(deletedRows)); allChangedRows.AddRange(deletedRows); } } if ((this._invoicesTableAdapter != null)) { global::System.Data.DataRow[] deletedRows = dataSet.invoices.Select(null, null, global::System.Data.DataViewRowState.Deleted); if (((deletedRows != null) && (0 < deletedRows.Length))) { result = (result + this._invoicesTableAdapter.Update(deletedRows)); allChangedRows.AddRange(deletedRows); } } if ((this._clientsTableAdapter != null)) { global::System.Data.DataRow[] deletedRows = dataSet.clients.Select(null, null, global::System.Data.DataViewRowState.Deleted); if (((deletedRows != null) && (0 < deletedRows.Length))) { result = (result + this._clientsTableAdapter.Update(deletedRows)); allChangedRows.AddRange(deletedRows); } } return result; } /// <summary> ///Remove inserted rows that become updated rows after calling TableAdapter.Update(inserted rows) first ///</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private global::System.Data.DataRow[] GetRealUpdatedRows(global::System.Data.DataRow[] updatedRows, global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows) { if (((updatedRows == null) || (updatedRows.Length < 1))) { return updatedRows; } if (((allAddedRows == null) || (allAddedRows.Count < 1))) { return updatedRows; } global::System.Collections.Generic.List<global::System.Data.DataRow> realUpdatedRows = new global::System.Collections.Generic.List<global::System.Data.DataRow>(); for (int i = 0; (i < updatedRows.Length); i = (i + 1)) { global::System.Data.DataRow row = updatedRows[i]; if ((allAddedRows.Contains(row) == false)) { realUpdatedRows.Add(row); } } return realUpdatedRows.ToArray(); } /// <summary> ///Update all changes to the dataset. ///</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public virtual int UpdateAll(mydbDataSet dataSet) { if ((dataSet == null)) { throw new global::System.ArgumentNullException("dataSet"); } if ((dataSet.HasChanges() == false)) { return 0; } if (((this._clientsTableAdapter != null) && (this.MatchTableAdapterConnection(this._clientsTableAdapter.Connection) == false))) { throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + "tring."); } if (((this._invoicesTableAdapter != null) && (this.MatchTableAdapterConnection(this._invoicesTableAdapter.Connection) == false))) { throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + "tring."); } if (((this._itemsTableAdapter != null) && (this.MatchTableAdapterConnection(this._itemsTableAdapter.Connection) == false))) { throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + "tring."); } global::System.Data.IDbConnection workConnection = this.Connection; if ((workConnection == null)) { throw new global::System.ApplicationException("TableAdapterManager contains no connection information. Set each TableAdapterMana" + "ger TableAdapter property to a valid TableAdapter instance."); } bool workConnOpened = false; if (((workConnection.State & global::System.Data.ConnectionState.Broken) == global::System.Data.ConnectionState.Broken)) { workConnection.Close(); } if ((workConnection.State == global::System.Data.ConnectionState.Closed)) { workConnection.Open(); workConnOpened = true; } global::System.Data.IDbTransaction workTransaction = workConnection.BeginTransaction(); if ((workTransaction == null)) { throw new global::System.ApplicationException("The transaction cannot begin. The current data connection does not support transa" + "ctions or the current state is not allowing the transaction to begin."); } global::System.Collections.Generic.List<global::System.Data.DataRow> allChangedRows = new global::System.Collections.Generic.List<global::System.Data.DataRow>(); global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows = new global::System.Collections.Generic.List<global::System.Data.DataRow>(); global::System.Collections.Generic.List<global::System.Data.Common.DataAdapter> adaptersWithAcceptChangesDuringUpdate = new global::System.Collections.Generic.List<global::System.Data.Common.DataAdapter>(); global::System.Collections.Generic.Dictionary<object, global::System.Data.IDbConnection> revertConnections = new global::System.Collections.Generic.Dictionary<object, global::System.Data.IDbConnection>(); int result = 0; global::System.Data.DataSet backupDataSet = null; if (this.BackupDataSetBeforeUpdate) { backupDataSet = new global::System.Data.DataSet(); backupDataSet.Merge(dataSet); } try { // ---- Prepare for update ----------- // if ((this._clientsTableAdapter != null)) { revertConnections.Add(this._clientsTableAdapter, this._clientsTableAdapter.Connection); this._clientsTableAdapter.Connection = ((global::MySql.Data.MySqlClient.MySqlConnection)(workConnection)); this._clientsTableAdapter.Transaction = ((global::MySql.Data.MySqlClient.MySqlTransaction)(workTransaction)); if (this._clientsTableAdapter.Adapter.AcceptChangesDuringUpdate) { this._clientsTableAdapter.Adapter.AcceptChangesDuringUpdate = false; adaptersWithAcceptChangesDuringUpdate.Add(this._clientsTableAdapter.Adapter); } } if ((this._invoicesTableAdapter != null)) { revertConnections.Add(this._invoicesTableAdapter, this._invoicesTableAdapter.Connection); this._invoicesTableAdapter.Connection = ((global::MySql.Data.MySqlClient.MySqlConnection)(workConnection)); this._invoicesTableAdapter.Transaction = ((global::MySql.Data.MySqlClient.MySqlTransaction)(workTransaction)); if (this._invoicesTableAdapter.Adapter.AcceptChangesDuringUpdate) { this._invoicesTableAdapter.Adapter.AcceptChangesDuringUpdate = false; adaptersWithAcceptChangesDuringUpdate.Add(this._invoicesTableAdapter.Adapter); } } if ((this._itemsTableAdapter != null)) { revertConnections.Add(this._itemsTableAdapter, this._itemsTableAdapter.Connection); this._itemsTableAdapter.Connection = ((global::MySql.Data.MySqlClient.MySqlConnection)(workConnection)); this._itemsTableAdapter.Transaction = ((global::MySql.Data.MySqlClient.MySqlTransaction)(workTransaction)); if (this._itemsTableAdapter.Adapter.AcceptChangesDuringUpdate) { this._itemsTableAdapter.Adapter.AcceptChangesDuringUpdate = false; adaptersWithAcceptChangesDuringUpdate.Add(this._itemsTableAdapter.Adapter); } } // //---- Perform updates ----------- // if ((this.UpdateOrder == UpdateOrderOption.UpdateInsertDelete)) { result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)); result = (result + this.UpdateInsertedRows(dataSet, allAddedRows)); } else { result = (result + this.UpdateInsertedRows(dataSet, allAddedRows)); result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)); } result = (result + this.UpdateDeletedRows(dataSet, allChangedRows)); // //---- Commit updates ----------- // workTransaction.Commit(); if ((0 < allAddedRows.Count)) { global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count]; allAddedRows.CopyTo(rows); for (int i = 0; (i < rows.Length); i = (i + 1)) { global::System.Data.DataRow row = rows[i]; row.AcceptChanges(); } } if ((0 < allChangedRows.Count)) { global::System.Data.DataRow[] rows = new System.Data.DataRow[allChangedRows.Count]; allChangedRows.CopyTo(rows); for (int i = 0; (i < rows.Length); i = (i + 1)) { global::System.Data.DataRow row = rows[i]; row.AcceptChanges(); } } } catch (global::System.Exception ex) { workTransaction.Rollback(); // ---- Restore the dataset ----------- if (this.BackupDataSetBeforeUpdate) { global::System.Diagnostics.Debug.Assert((backupDataSet != null)); dataSet.Clear(); dataSet.Merge(backupDataSet); } else { if ((0 < allAddedRows.Count)) { global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count]; allAddedRows.CopyTo(rows); for (int i = 0; (i < rows.Length); i = (i + 1)) { global::System.Data.DataRow row = rows[i]; row.AcceptChanges(); row.SetAdded(); } } } throw ex; } finally { if (workConnOpened) { workConnection.Close(); } if ((this._clientsTableAdapter != null)) { this._clientsTableAdapter.Connection = ((global::MySql.Data.MySqlClient.MySqlConnection)(revertConnections[this._clientsTableAdapter])); this._clientsTableAdapter.Transaction = null; } if ((this._invoicesTableAdapter != null)) { this._invoicesTableAdapter.Connection = ((global::MySql.Data.MySqlClient.MySqlConnection)(revertConnections[this._invoicesTableAdapter])); this._invoicesTableAdapter.Transaction = null; } if ((this._itemsTableAdapter != null)) { this._itemsTableAdapter.Connection = ((global::MySql.Data.MySqlClient.MySqlConnection)(revertConnections[this._itemsTableAdapter])); this._itemsTableAdapter.Transaction = null; } if ((0 < adaptersWithAcceptChangesDuringUpdate.Count)) { global::System.Data.Common.DataAdapter[] adapters = new System.Data.Common.DataAdapter[adaptersWithAcceptChangesDuringUpdate.Count]; adaptersWithAcceptChangesDuringUpdate.CopyTo(adapters); for (int i = 0; (i < adapters.Length); i = (i + 1)) { global::System.Data.Common.DataAdapter adapter = adapters[i]; adapter.AcceptChangesDuringUpdate = true; } } } return result; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected virtual void SortSelfReferenceRows(global::System.Data.DataRow[] rows, global::System.Data.DataRelation relation, bool childFirst) { global::System.Array.Sort<global::System.Data.DataRow>(rows, new SelfReferenceComparer(relation, childFirst)); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected virtual bool MatchTableAdapterConnection(global::System.Data.IDbConnection inputConnection) { if ((this._connection != null)) { return true; } if (((this.Connection == null) || (inputConnection == null))) { return true; } if (string.Equals(this.Connection.ConnectionString, inputConnection.ConnectionString, global::System.StringComparison.Ordinal)) { return true; } return false; } /// <summary> ///Update Order Option ///</summary> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public enum UpdateOrderOption { InsertUpdateDelete = 0, UpdateInsertDelete = 1, } /// <summary> ///Used to sort self-referenced table's rows ///</summary> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private class SelfReferenceComparer : object, global::System.Collections.Generic.IComparer<global::System.Data.DataRow> { private global::System.Data.DataRelation _relation; private int _childFirst; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal SelfReferenceComparer(global::System.Data.DataRelation relation, bool childFirst) { this._relation = relation; if (childFirst) { this._childFirst = -1; } else { this._childFirst = 1; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private global::System.Data.DataRow GetRoot(global::System.Data.DataRow row, out int distance) { global::System.Diagnostics.Debug.Assert((row != null)); global::System.Data.DataRow root = row; distance = 0; global::System.Collections.Generic.IDictionary<global::System.Data.DataRow, global::System.Data.DataRow> traversedRows = new global::System.Collections.Generic.Dictionary<global::System.Data.DataRow, global::System.Data.DataRow>(); traversedRows[row] = row; global::System.Data.DataRow parent = row.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); for ( ; ((parent != null) && (traversedRows.ContainsKey(parent) == false)); ) { distance = (distance + 1); root = parent; traversedRows[parent] = parent; parent = parent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); } if ((distance == 0)) { traversedRows.Clear(); traversedRows[row] = row; parent = row.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); for ( ; ((parent != null) && (traversedRows.ContainsKey(parent) == false)); ) { distance = (distance + 1); root = parent; traversedRows[parent] = parent; parent = parent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); } } return root; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public int Compare(global::System.Data.DataRow row1, global::System.Data.DataRow row2) { if (object.ReferenceEquals(row1, row2)) { return 0; } if ((row1 == null)) { return -1; } if ((row2 == null)) { return 1; } int distance1 = 0; global::System.Data.DataRow root1 = this.GetRoot(row1, out distance1); int distance2 = 0; global::System.Data.DataRow root2 = this.GetRoot(row2, out distance2); if (object.ReferenceEquals(root1, root2)) { return (this._childFirst * distance1.CompareTo(distance2)); } else { global::System.Diagnostics.Debug.Assert(((root1.Table != null) && (root2.Table != null))); if ((root1.Table.Rows.IndexOf(root1) < root2.Table.Rows.IndexOf(root2))) { return -1; } else { return 1; } } } } } } #pragma warning restore 1591
{ "content_hash": "7ca85434ab26b950184d2d2a2682a1b7", "timestamp": "", "source": "github", "line_count": 3891, "max_line_length": 486, "avg_line_length": 55.89694166024158, "alnum_prop": 0.581594979194924, "repo_name": "TanayParikh/MonetaFMS", "id": "6c05cdc3934c81e0df7a9a683cec626382f0b3f5", "size": "217497", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Visual-Studio-Project/Moneta/mydbDataSet.Designer.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "269549" }, { "name": "PowerShell", "bytes": "98800" } ], "symlink_target": "" }
<!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]--> <!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> <head> <title><?= $page['title']; ?></title> <meta name="description" content="<?= $params['tagline']; ?>" /> <meta name="author" content="<?= $params['author']; ?>"> <meta charset="UTF-8"> <link rel="icon" href="<?= $params['theme']['favicon']; ?>" type="image/x-icon"> <!-- Mobile --> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Font --> <?php foreach ($params['theme']['fonts'] as $font) { echo "<link href='$font' rel='stylesheet' type='text/css'>"; } ?> <!-- CSS --> <?php foreach ($params['theme']['css'] as $css) { echo "<link href='$css' rel='stylesheet' type='text/css'>"; } ?> <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body class="<?= $params['html']['float'] ? 'with-float' : ''; ?>"> <?= $this->section('content'); ?> <?php if ($params['html']['google_analytics']) { $this->insert('theme::partials/google_analytics', ['analytics' => $params['html']['google_analytics'], 'host' => array_key_exists('host', $params) ? $params['host'] : '']); } if ($params['html']['piwik_analytics']) { $this->insert('theme::partials/piwik_analytics', ['url' => $params['html']['piwik_analytics'], 'id' => $params['html']['piwik_analytics_id']]); } ?> <!-- jQuery --> <?= '<script src="' . $base_url . 'themes/daux/js/jquery-1.11.3.min.js' . '"></script>' ?> <!-- hightlight.js --> <script src="<?= $base_url; ?>themes/daux/js/highlight.min.js"></script> <script>hljs.initHighlightingOnLoad();</script> <!-- JS --> <?php foreach ($params['theme']['js'] as $js) { echo '<script src="' . $js . '"></script>'; } ?> <script src="<?= $base_url; ?>themes/daux/js/daux.js"></script> </body> </html>
{ "content_hash": "af74c4a5101750f4ba281d8b1f8daceb", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 180, "avg_line_length": 39.50877192982456, "alnum_prop": 0.5293072824156305, "repo_name": "gbaumgart/daux.io", "id": "e2a62070c88601605861e6ab461b70ca27260b12", "size": "2252", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "templates/layout/00_layout.php", "mode": "33261", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "137" }, { "name": "CSS", "bytes": "395385" }, { "name": "JavaScript", "bytes": "7748" }, { "name": "PHP", "bytes": "136451" }, { "name": "Shell", "bytes": "51" } ], "symlink_target": "" }
namespace navigation_space { Triplet navigation_space::IGVCBasicStrategy::getTargetLocation(double x1, double y1, double heading) { heading *= (3.142 / 180.0); double alpha = -heading; double x2 = x1 * cos(alpha) + y1 * sin(alpha); double y2 = -x1 * sin(alpha) + y1 * cos(alpha); // Adjusting according to map's scale x2 *= 100; y2 *= 100; // Shifting to bot's center x2 += 500; y2 += 100; int tx, ty; navigation_space::truncate(x2, y2, &tx, &ty); Triplet target_location; target_location.x = tx; target_location.y = ty; target_location.z = 90; return target_location; } Triplet navigation_space::IGVCBasicStrategy::getBotLocation() { Triplet bot_location; bot_location.x = 0.5 * MAP_MAX; bot_location.y = 0.1 * MAP_MAX; bot_location.z = 90; return bot_location; } }
{ "content_hash": "07f561b8253e6fcc2b4347ec65d19187", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 106, "avg_line_length": 26.16216216216216, "alnum_prop": 0.5568181818181818, "repo_name": "jitrc/eklavya-ros-pkg", "id": "0cda44d22f58cb6c16abffab04801fb21c7f5023", "size": "993", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "eklavya_node/src/Modules/Navigation/igvc_basic_strategy.cpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Arduino", "bytes": "44247" }, { "name": "C", "bytes": "636256" }, { "name": "C++", "bytes": "337253" }, { "name": "Python", "bytes": "21278" }, { "name": "Shell", "bytes": "551" } ], "symlink_target": "" }
<?php namespace Drupal\Tests\contact\Kernel\Migrate\d6; use Drupal\contact\Entity\ContactForm; use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase; /** * Migrate contact categories to contact.form.*.yml. * * @group migrate_drupal_6 */ class MigrateContactCategoryTest extends MigrateDrupal6TestBase { /** * {@inheritdoc} */ public static $modules = ['contact']; /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->executeMigration('contact_category'); } /** * The Drupal 6 contact categories to Drupal 8 migration. */ public function testContactCategory() { /** @var \Drupal\contact\Entity\ContactForm $contact_form */ $contact_form = ContactForm::load('website_feedback'); $this->assertIdentical('Website feedback', $contact_form->label()); $this->assertIdentical(array('admin@example.com'), $contact_form->getRecipients()); $this->assertIdentical('', $contact_form->getReply()); $this->assertIdentical(0, $contact_form->getWeight()); $contact_form = ContactForm::load('some_other_category'); $this->assertIdentical('Some other category', $contact_form->label()); $this->assertIdentical(array('test@example.com'), $contact_form->getRecipients()); $this->assertIdentical('Thanks for contacting us, we will reply ASAP!', $contact_form->getReply()); $this->assertIdentical(1, $contact_form->getWeight()); $contact_form = ContactForm::load('a_category_much_longer_than_thir'); $this->assertIdentical('A category much longer than thirty two characters', $contact_form->label()); $this->assertIdentical(array('fortyninechars@example.com'), $contact_form->getRecipients()); $this->assertIdentical('', $contact_form->getReply()); $this->assertIdentical(2, $contact_form->getWeight()); } }
{ "content_hash": "1e4c209aa6619397c17de65a764db151", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 104, "avg_line_length": 35.34615384615385, "alnum_prop": 0.6926006528835691, "repo_name": "hrod/agile-california", "id": "d613cacdf5b6f2a3877cc8350bd03897f222a289", "size": "1838", "binary": false, "copies": "137", "ref": "refs/heads/master", "path": "docroot/core/modules/contact/tests/src/Kernel/Migrate/d6/MigrateContactCategoryTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "27457" }, { "name": "CSS", "bytes": "421251" }, { "name": "Cucumber", "bytes": "308" }, { "name": "HTML", "bytes": "491100" }, { "name": "JavaScript", "bytes": "877020" }, { "name": "Nginx", "bytes": "1025" }, { "name": "PHP", "bytes": "29519528" }, { "name": "Shell", "bytes": "76785" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <section version="5.0" xsi:schemaLocation="http://docbook.org/ns/docbook http://www.docbook.org/xml/5.0/xsd/docbook.xsd http://www.w3.org/1999/xlink http://www.docbook.org/xml/5.0/xsd/xlink.xsd" xml:base="../" xml:id="releaseNotes_6.0.0-SNAPSHOT" xmlns="http://docbook.org/ns/docbook" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:ns="http://docbook.org/ns/docbook"> <title>What is New and Noteworthy in Drools 6.0.0</title> <section xml:id="releaseNotes_6.0.0_Expert"> <title>Drools Expert</title> <section> <title>Expression timers and additional timers parameters</title> <para>When declaring an interval timer it can be sometimes useful to define both the delay and interval as an expression instead of a fixed value. To do that it is now possible to use an expression timer (indicated by "expr:") as in the following example:</para> <example> <title>An Expression Timer Example</title> <programlisting language="java">declare Bean delay : String = "30s" period : long = 60000 end rule "Expression timer" timer( expr: $d, $p ) when Bean( $d : delay, $p : period ) then end</programlisting> </example> <para>The expressions, $d and $p in this case, can use any variable defined in the pattern matching part of the rule and can be any String that can be parsed in a time duration or any numeric value that will be internally converted in a long representing a duration expressed in milliseconds.</para> <para>Both interval and expression timers can have 3 optional parameters named "start", "end" and "repeat-limit". When one or more of these parameters are used the first part of the timer definition must be followed by a semicolon ';' and the parameters have to be separated by a comma ',' as in the following example:</para> <example> <title>An Interval Timer with a start and an end</title> <programlisting language="java">timer (int: 30s 10s; start=3-JAN-2010, end=5-JAN-2010)</programlisting> </example> <para>The value for start and end parameters can be a Date, a String representing a Date or a long, or more in general any Number, that will be transformed in a Java Date applying the following conversion:</para> <programlisting language="java">new Date( ((Number) n).longValue() )</programlisting> <para>Conversely the repeat-limit can be only an integer and it defines the maximum number of repetitions allowed by the timer. If both the end and the repeat-limit parameters are set the timer will stop when the first of the two will be matched.</para> <para>The using of the start parameter implies the definition of a phase for the timer, where the beginning of the phase is given by the start itself plus the eventual delay. In other words in this case the timed rule will then be scheduled at times:</para> <programlisting language="java">start + delay + n*period</programlisting> <para>for up to repeat-limit times and no later than the end timestamp (whichever first). For instance the rule having the following interval timer</para> <programlisting language="java">timer ( int: 30s 1m; start="3-JAN-2010" )</programlisting> <para>will be scheduled at the 30th second of every minute after the midnight of the 3-JAN-2010. This also means that if for example you turn the system on at midnight of the 3-FEB-2010 it won't be scheduled immediately but will preserve the phase defined by the timer and so it will be scheduled for the first time 30 seconds after the midnight. If for some reason the system is paused (e.g. the session is serialized and then deserialized after a while) the rule will be scheduled only once to recover from missing activations (regardless of how many activations we missed) and subsequently it will be scheduled again in phase with the timer.</para> </section> <section> <title>Better OSGi support</title> <para>OSGi support is substantially improved. Also, the production jars no longer have any split packages.</para> </section> </section> <section xml:id="releaseNotes_6.0.0_Guvnor"> <title>Guvnor</title> <section> <title>New Maven groupId: org.kie.guvnor</title> <para>The Maven groupId has changed from org.drools.guvnor to org.kie.guvnor.</para> <para>Before</para> <programlisting language="xml">&lt;dependency&gt; &lt;groupId&gt;org.drools.guvnor&lt;/groupId&gt; ... &lt;/dependency&gt;</programlisting> <para>After</para> <programlisting language="xml">&lt;dependency&gt; &lt;groupId&gt;org.kie.guvnor&lt;/groupId&gt; ... &lt;/dependency&gt;</programlisting> </section> </section> <section xml:id="releaseNotes_6.0.0_DroolsWorkbench"> <title>Drools Workbench</title> <section> <title>General</title> <para>Many things are changing for Drools 6.0.</para> <para>Along with the functional and feature changes we have restructured the <link xlink:href="https://github.com/droolsjbpm/guvnor">Guvnor</link> github repository to better reflect our new architecture. Guvnor has historically been the web application for Drools. It was a composition of editors specific to Drools, a back-end repository and a simplistic asset management system.</para> <para>Things are now different.</para> <para>For Drools 6.0 the web application has been extensively re-written to use <link xlink:href="http://droolsjbpm.github.io/uberfire/">UberFire</link> that provides a generic Workbench environment, a Metadata Engine, Security Framework, a VFS API and clustering support.</para> <para>Guvnor has become a generic asset management framework providing common services for generic projects and their dependencies. Drools use of both UberFire and Guvnor has born the Drools Workbench.</para> <para>A picture always helps:</para> <figure> <title>New structue</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/kie-structure.png" format="PNG"/> </imageobject> </mediaobject> </figure> <section> <title><link xlink:href="https://github.com/droolsjbpm/uberfire">uberfire</link></title> <para>UberFire is the foundation of all components for both Drools and jBPM. Every editor and service leverages UberFire. Components can be mixed and matched into either a full featured application of used in isolation.</para> </section> <section> <title><link xlink:href="https://github.com/droolsjbpm/guvnor">guvnor</link></title> <para>Guvnor adds project services and dependency management to the mix.</para> <para>At present Guvnor consists of few parts; being principally a port of common project services that existed in the old Guvnor. As things settle down and the module matures pluggable workflow will be supported allowing for sensitive operations to be controlled by jBPM processes and rules. Work is already underway to include this for 6.0.</para> </section> <section> <title><link xlink:href="https://github.com/droolsjbpm/kie-wb-common">kie-wb-common</link></title> <para>Both Drools and jBPM editors and services share the need for a common set of re-usable screens, services and widgets.</para> <para>Rather than pollute Guvnor with screens and services needed only by Drools and jBPM this module contains such common dependencies.</para> <para>It is possible to just re-use the UberFire and Guvnor stack to create your own project-based workbench type application and take advantage of the underlying services.</para> </section> <section> <title><link xlink:href="https://github.com/droolsjbpm/drools-wb">Drools Workbench (drools-wb)</link></title> <para>Drools Workbench is the end product for people looking for a web application that is composed of all Drools related editors, screens and services. It is equivalent to the old Guvnor.</para> <para>Looking for the web application to accompany Drools Expert and Drools Fusion; an environment to author, test and deploy rules. This is what you're looking for.</para> </section> <section> <title><link xlink:href="https://github.com/droolsjbpm/kie-wb-distributions/tree/master/kie-drools-wb">KIE Drools Workbench (kie-drools-wb)</link></title> <para>KIE Drools Workbench (for want of a better name - it's amazing how difficult names can be) is an extension of Drools Workbench including jBPM Designer to support Rule Flow.</para> <para>jBPM Designer, now being an UberFire compatible component, does not need to be deployed as a separate web application. We bundle it here, along with Drools as a convenience for people looking to author Rule Flows along side their rules.</para> </section> <section> <title><link xlink:href="https://github.com/droolsjbpm/kie-wb-distributions/tree/master/kie-wb">KIE Workbench (kie-wb)</link></title> <para>This is the daddy of them all.</para> <para>KIE Workbench is the composition of everything known to man; from both the Drools and jBPM worlds. It provides for authoring of projects, data models, guided rules, decision tables etc, test services, process authoring, a process run-time execution environment and human task interaction.</para> <para>KIE Workbench is the old Guvnor, jBPM Designer and jBPM Console applications combined. On steroids.</para> </section> <section> <title>The World is not enough?</title> <para>You may have noticed; KIE Drools Workbench and KIE Workbench are in the same repository. This highlights a great thing about the new module design we have with UberFire. Web applications are just a composition of dependencies.</para> <para>You want your own web application that consists of just the Guided Rule Editor and jBPM Designer? You want your own web application that has the the Data Modeller and some of your own screens?</para> <para>Pick your dependencies and add them to your own UberFire compliant web application and, as the saying goes, the world is your oyster.</para> </section> </section> <section> <title>UberFire Provided Infrastructure</title> <section> <title>Virtual File System</title> <para>UberFire VFS is a <link xlink:href="http://jcp.org/en/jsr/detail?id=203">NIO.2</link> based API that provides a unified interface to access different file systems - by default it uses <link xlink:href="http://git-scm.com/">Git</link> as its primary backend implematation. Resources (ie. files and directories) are represented, as proposed by NIO.2, as URIs. Here are some examples:</para> <itemizedlist> <listitem> <para>file:///path/to/some/file.txt</para> </listitem> <listitem> <para>git://repository-name/path/to/file.txt</para> </listitem> <listitem> <para>git://repository-name/path/to/dir/</para> </listitem> <listitem> <para>git://my_branch@repository-name/path/to/file.txt</para> </listitem> </itemizedlist> <para>By using Git as its default implementation, UberFire VFS provides out-of-box a versioned system, which means that every information stored/deleted has its history preserved.</para> <important> <para>Your system doesn't need to have GIT installed, UberFire uses <link xlink:href="http://www.eclipse.org/jgit/">JGIT</link> internally, a 100% Java based Git implementation.</para> </important> </section> <section> <title>Metadata Engine</title> <para>Metadata engine provides two complementary services: Indexing and Searching. Both services were designed to be as minimum invasive as possible and, in the same time, providing all the complex features needed by the subject.</para> <section> <title>Index</title> <para>Indexing is automatically handled on VFS layer in completely transparent way. In order to agregate metadata to a VFS resource using the NIO.2 based API, all you need to do is set a resource attributes.</para> <important> <para>All metadata are stored on dot files alongside its resource. So if anything bad happens to your index and it get corrupted, you can always recreate the index based on those persistent dot files.</para> </important> <para>The metadata engine is not only for VFS resources, behind the scenes there's a powerfull metadata API that you can define your own MetaModel with custom MetaTypes, MetaObjects and MetaProperties.</para> </section> <section> <title>Search</title> <para>The Metadata Search API is very simple and yet powerful. It provides basically two methods, one that allows a full text search (including wildcards and boolean operations) or by a set of predefined attributes.</para> </section> <para>For those curious to know what is under the hood, Metadata engine uses <link xlink:href="http://lucene.apache.org/">Apache Lucene 4</link> as its default backend, but was designed to be able to have different and eventually mixed/composed backends.</para> </section> </section> <section> <title>Drools Workbench - In depth</title> <para>Drools Workbench is the corner stone of the new function and features for 6.0.</para> <para>Many of the new concepts and functions are described in more detail in the following sections.</para> <important> <para>Remember Drools Workbench is integrated into other distributions. Therefore many of the core concepts and functions are also within the other distributions. Furthemore jBPM web-based Tooling extends from UberFire and re-use features from Drools Workbench that are common across the KIE platform; such as Project Explorer, Project Editor and the M2 Repository.</para> </important> <section> <title>Home</title> <para>Home is where the heart is.</para> <para>Drools Workbench starts with a Home Page that will provides short-cut navigation to common tasks.</para> <para>What is provided in this release is minimal and largely a cosmetic exercise to hopefully increase usability for non-technical people.</para> <para>The appearance and content of the Home is likely to change as we approach a final release.</para> <figure> <title>Home</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/drools-wb-homepage.png" format="PNG"/> </imageobject> </mediaobject> </figure> </section> <section> <title>Project Explorer</title> <para>The Project Explorer is where most users will find themselves when authoring projects.</para> <para>The Project Explorer shows four drop-down selectors that are driven by Group, Repository, Project and Package.<itemizedlist> <listitem> <para>Group : The top level logical entitiy within the KIE world. This can represent a Company, Organization, Department etc.</para> </listitem> <listitem> <para>Repository : Groups have access to one or more repositories. Default repositories are setup; but you can create or clone your own.</para> </listitem> <listitem> <para>Project : Repositories contain one or more KIE projects. New Projects can be created using the "New" Menu option, provided a target repository is selected.</para> </listitem> <listitem> <para>Package : The package concept is no different to Guvnor 5.5. Projects contain packages.</para> </listitem> </itemizedlist></para> <para>Once a Group, Repository, Project and Package are selected the Project Explorer shows the items within that context.</para> <figure> <title>Project Explorer</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/drools-wb-projectexplorer.png" format="PNG"/> </imageobject> </mediaobject> </figure> <warning> <para>The Project Explorer will support both a Business and Technical views. The Technical view will probably not make it into 6.0.0.Beta4.</para> </warning> </section> <section> <title>Creating new things</title> <para>Creation of anything "new" is accomplished using the "New" menu option.</para> <para>The types of thing that can be created from the "New" menu option depends upon the selected context. Projects require a Repository; rules, tests etc require a Package within a Project. New things are created in the context selected in the Project Explorer. I.E. if Repository 1, Project X is selected new items will be created in Project X.</para> <figure> <title>New Menu</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/drools-wb-newitem-menu.png" format="PNG"/> </imageobject> </mediaobject> </figure> <figure> <title>New Popup</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/drools-wb-newitem-popup.png" format="PNG"/> </imageobject> </mediaobject> </figure> </section> <section> <title>Editing</title> <para>By and large, other than the specific changes mentioned in this document, all of the old Guvnor asset editors have been ported to 6.0 with no or little change.</para> <para>The layout of the workbench has however changed and the following screen-shots give an example of the new, common layout for most editors.</para> <section> <title>The Editor itself</title> <para>Asset editors have been ported to 6.0 with no or little change.</para> <figure> <title>The Editor</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/drools-wb-guided-rule-editor.png" format="PNG"/> </imageobject> </mediaobject> </figure> </section> <section> <title>The Source View</title> <para>The (DRL) Source View of the asset has been moved to a mini-tab within the editor.</para> <figure> <title>The Source View</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/drools-wb-source-view.png" format="PNG"/> </imageobject> </mediaobject> </figure> </section> <section> <title>The Imports View</title> <para>Types not within the package that contains the asset being authored need to be imported before they can be used.</para> <para>Guvnor 5.5 had the user define package-wide imports from the Package Screen. Drools Workbench 6.0 has moved the selection of imports from the Package level to the Asset level; positioning the facility on a mini-tab within the editor.</para> <figure> <title>The Imports View</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/drools-wb-imports.png" format="PNG"/> </imageobject> </mediaobject> </figure> </section> <section> <title>The Meta Data</title> <para>Meta Data has been moved to a mini-tab within the editor.</para> <figure> <title>The Meta Data</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/drools-wb-metadata.png" format="PNG"/> </imageobject> </mediaobject> </figure> </section> </section> <section> <title>Project Editor</title> <para>Project editor does what Package Editor did previously. It manages the the KIE projects. You can access the Project Editor from the menu bar Tools-&gt;Project Editor. The editor shows the configurations for the current active project and the content changes when you move around in your code repository.</para> <figure> <title>How to access the Project Editor</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/PE-menu.png" format="PNG"/> </imageobject> </mediaobject> </figure> <section> <title>Group artifact version options</title> <para>Allows you to set the group, artifact and version id's for the project. Basically this screen is editing a pom.xml since we use Maven to build our KIE projects.</para> <figure> <title>Panel for editing group, artifact and version id</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/PE-GAV.png" format="PNG"/> </imageobject> </mediaobject> </figure> </section> <section> <title>Dependencies options</title> <para>Lets you set the dependencies for the current project. It is possible to pick the the resources from an internal repository.</para> <figure> <title>Dependencies for the current project</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/PE-dependencies.png" format="PNG"/> </imageobject> </mediaobject> </figure> </section> <section> <title>Metadata</title> <para/> The different files used by the Project Editor still have metadata like they did in Guvnor 5.x. <figure> <title>Metadata for pom.xml</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/PE-metadata.png" format="PNG"/> </imageobject> </mediaobject> </figure> </section> <section> <title>Knowledge bases and sessions options</title> <para>Editor for kmodule.xml explained more detail in the KIE core documentation. Editors for knowledge bases and knowledge session inside.</para> <figure> <title>Knowledge bases and sessions defined in the current project</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/PE-kbases-and-ksessions.png" format="PNG"/> </imageobject> </mediaobject> </figure> </section> <section> <title>Import suggestions</title> <para>In import suggestions it is possible to specify a set of imports used in the project. Each editor has it's own imports now. Because of this these imports differ from what Guvnor 5.x Package Editor had, the imports are no longer automatically used in each asset, they just make use automated editor in KIE workbench easier and suggest fact types that the user might want to use.</para> <figure> <title>Imports that will be used as suggestions in the editors</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/PE-imports.png" format="PNG"/> </imageobject> </mediaobject> </figure> </section> </section> <section> <title>Incremental Builds</title> <para>Whenever a Project is built or an asset saved they are validated.</para> <para>In the example below, the Fact Type "Smurf" has not been imported into the project and hence cannot be resolved.</para> <figure> <title>The Problems panel</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/drools-wb-incremental-build.png" format="PNG"/> </imageobject> </mediaobject> </figure> </section> <section> <title>BPM Console</title> <para>The following sections describe the improvements for the different components provided by the jBPM Console NG or the BPM related screens inside KIE Workbench for Beta4.</para> <section> <title>General Integration with Drools and Core Uberfire Components</title> <itemizedlist> <listitem> <para>Business Oriented access to projects structures</para> </listitem> <listitem> <para>Build and deploy projects containing processes with the standard Kmodule structure</para> </listitem> <listitem> <para>Improvements on security domain configuration</para> </listitem> <listitem> <para>Improvements on single sign on with the Dashboards application</para> </listitem> </itemizedlist> <figure> <title>Process Authoring Perspective</title> <mediaobject> <imageobject> <imagedata align="left" fileref="images/Chapter-Release_Notes/BPM-ProcessAuthoring.png"/> </imageobject> </mediaobject> </figure> </section> <section> <title>Process Management</title> <itemizedlist> <listitem> <para>Improved lists with search/filter capabilities</para> </listitem> <listitem> <para>Access to the process model and process instance graph through the Process Designer</para> </listitem> </itemizedlist> <figure> <title>Process Instance Details</title> <mediaobject> <imageobject> <imagedata align="left" fileref="images/Chapter-Release_Notes/BPM-ProcessInstanceDetails.png"/> </imageobject> </mediaobject> </figure> <figure> <title>Process Instances Lists</title> <mediaobject> <imageobject> <imagedata align="left" fileref="images/Chapter-Release_Notes/BPM-ProcessInstanceslist.png"/> </imageobject> </mediaobject> </figure> </section> <section> <title>Tasks List</title> <itemizedlist> <listitem> <para>Calendar and Grid View merged into a single view</para> </listitem> <listitem> <para>Filter capabilities improved</para> </listitem> <listitem> <para>Search and filter is now possible</para> </listitem> <listitem> <para>New task creation allows to set up multiple users and groups for the task</para> </listitem> <listitem> <para>Now you can release every task that you have assigned (WS-HT conformance)</para> </listitem> <listitem> <para>Initial version of the assignments tab added</para> </listitem> </itemizedlist> <figure> <title>Unified Filters</title> <mediaobject> <imageobject> <imagedata align="left" fileref="images/Chapter-Release_Notes/BPM-TasksListUnifiedDetails.png"/> </imageobject> </mediaobject> </figure> <figure> <title>Day View</title> <mediaobject> <imageobject> <imagedata align="left" fileref="images/Chapter-Release_Notes/BPM-TasksListDayView.png"/> </imageobject> </mediaobject> </figure> <figure> <title>Month View</title> <mediaobject> <imageobject> <imagedata align="left" fileref="images/Chapter-Release_Notes/BPM-TasksListMonthView.png"/> </imageobject> </mediaobject> </figure> </section> <section> <title>Deployments</title> <itemizedlist> <listitem> <para>Deployments screen added for admins</para> </listitem> <listitem> <para>Automatic deployments by default</para> </listitem> <listitem> <para>Custom deployments based on available KModules</para> </listitem> <listitem> <para>Filter capabilities</para> </listitem> <listitem> <para>Undeploy possible only on KModules with no active process instances</para> </listitem> </itemizedlist> <figure> <title>Deployed Units</title> <mediaobject> <imageobject> <imagedata align="left" fileref="images/Chapter-Release_Notes/BPM-DeployedUnitsList.png"/> </imageobject> </mediaobject> </figure> </section> </section> <section> <title>Data Modeller</title> <para>Typically, a business process analyst or data analyst will capture the requirements for a process or appliaction and turn these into a formal set of data structures and their relationships. The new Data Modeller tool enables configuration of such data models (both logical and physical), without the need for explicit coding. Its main goals are to make data models into first class citizens in the process improvement cycle and allow for full process automation using data and forms, without the need for advanced development skills.</para> <section> <title>Key features</title> <itemizedlist> <listitem> <para>Simple data modelling UI</para> </listitem> <listitem> <para>Allows adding conceptual information to the model (such as user friendly labels)</para> </listitem> <listitem> <para>Common tool for both analysts and developers</para> </listitem> <listitem> <para>Automatically generates all assets required for execution</para> </listitem> <listitem> <para>Single representation enables developer roundtrip</para> </listitem> </itemizedlist> </section> <para>By default, whenever a new project is created, it automatically associates an empty data model to it. The currently active project's data model can be opened from the menu bar Tools-&gt; Data Modeller:</para> <figure> <title>How to access the Data Modeller</title> <mediaobject> <imageobject> <imagedata align="left" fileref="images/Chapter-Release_Notes/DM-menu.png"/> </imageobject> </mediaobject> </figure> <para/> <para>The basic aspect of the Data Modeller is shown in the following screenshot:</para> <figure> <title>The Data Modeller screen</title> <mediaobject> <imageobject> <imagedata align="left" fileref="images/Chapter-Release_Notes/DM-screen.png"/> </imageobject> </mediaobject> </figure> <para/> <para>The Data Modeller screen is divided into the following sections:</para> <itemizedlist> <listitem> <para>Model browser: the leftmost section, which allows creation of new data objects and where the existing ones are listed.</para> </listitem> <listitem> <para>Object browser: the middle section, which displays a table with the fields of the data object that has been selected in the Model browser. This section also enables creating new attributes for the currently selected object.</para> </listitem> <listitem> <para>Object / Attribute editor: the rightmost section. This is a tabbed editor where either the currently selected object's properties (as currently shown in the screenshot), or a previously selected object attribute's properties, can be modified.</para> </listitem> </itemizedlist> <para/> <para>Whenever a data model screen is activated, an additional entry will appear in the top menu, allowing creation of new data objects, as well as saving the model's modifications. Saving the model will also generate all its assets (pojo's), which will then become available to the rest of the tools.</para> <figure> <title>The Data Modeller menu</title> <mediaobject> <imageobject> <imagedata align="left" fileref="images/Chapter-Release_Notes/DM-topmenu.png"/> </imageobject> </mediaobject> </figure> </section> <section> <title>Form Designer</title> <para>As well as being able to easily define data structures and their internal relationships, which is possible through the new Data Modeller utility, providing a tool that empowers analysts and developers to define the graphical interfaces to those data structures is of equal importance. The form designer tool allows non-technical users to configure complex data forms for data capture and visualization a WYSIWYG fashion, define the relationships between those forms and the underlying data structure(s), and execute those forms inside the context of business processes.</para> <section> <title>Key features</title> <itemizedlist> <listitem> <para>Simple WYSIWYG UI for easy form modelling</para> </listitem> <listitem> <para>Form autogeneration from datamodel/process task or java objects</para> </listitem> <listitem> <para>Data binding for java objects</para> </listitem> <listitem> <para>Customized form layouts</para> </listitem> <listitem> <para>Forms embedding</para> </listitem> </itemizedlist> </section> <section> <title>Target users:</title> <itemizedlist spacing="compact"> <listitem> <para>Process / data analysts. Designing forms.</para> </listitem> <listitem> <para>Developers. Advanced form configuration, such as adding formulas and expressions for dynamic form recognition.</para> </listitem> </itemizedlist> </section> <figure> <title>A peak at the Form Designer aspect is shown in the following screenshot:</title> <mediaobject> <imageobject> <imagedata align="left" fileref="images/Chapter-Release_Notes/FD-screen.png"/> </imageobject> </mediaobject> </figure> <para/> </section> <section> <title>jBPM Dashboard</title> <para>The ability to monitor the status of process instances and tasks, is essential to evaluate the correctness of their design and implementation. With this in mind, the workbench integrates a complete process and task dashboard set, based on the "Dashboard Builder" tool (described below), which provide the views, data providers and key performance indicators that are needed to monitor the status of processes and tasks in real-time.</para> <section> <title>Key features</title> <itemizedlist> <listitem> <para>Visualization of process instances and tasks by process</para> </listitem> <listitem> <para>Visualization of process instances and tasks by user</para> </listitem> <listitem> <para>Visualization of process instances and tasks by date</para> </listitem> <listitem> <para>Visualization of process instances and tasks by duration</para> </listitem> <listitem> <para>Visualization of process instances and tasks by status</para> </listitem> <listitem> <para>Filter by process, process status, process version, task, task status, task start- and end-date</para> </listitem> <listitem> <para>Chart drill-down by process</para> </listitem> <listitem> <para>Chart drill-down by user</para> </listitem> </itemizedlist> </section> <figure> <title>Example of the jBPM dashboard:</title> <mediaobject> <imageobject> <imagedata align="left" fileref="images/Chapter-Release_Notes/jBPM_dashboard1.png"/> </imageobject> </mediaobject> </figure> <para/> </section> <section> <title>M2 Repository</title> <para>Upload, download and manage KJars with Guvnor M2 repository.</para> <figure> <title>M2 Repository</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/M2_repo_overview.png" format="PNG"/> </imageobject> </mediaobject> </figure> <para>Upload KJars to Guvnor M2 repository:</para> <para>A valid KJar must have a pom.xml (and pom.properties) that define the GAV and POJO model dependencies. If the pom.properties is missing the user is prompted for the GAV and a pom.properties file is appended to the JAR before being uploaded to Guvnor M2 repo.</para> <para/> <figure> <title>2 Repository</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/M2_repo_gav_warning.png" format="PNG"/> </imageobject> </mediaobject> </figure> <figure> <title>M2 Repository</title> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/M2_repo_gav.png" format="PNG"/> </imageobject> </mediaobject> </figure> <para>The Guvnor M2 REPO is exposed via REST with URL pattern http://{ServerName}/{httpPort}/{droolsWBWarFilename}/rest</para> <para/> </section> <section> <title>Data Migration</title> <para>jcr2vfs is a cli tool that migrates legancys Guvnor repository to 6.0.</para> <para>runMigration --help</para> <para>usage: runMigration [options...]</para> <para>-f,--forceOverwriteOutputVfsRepository Force overwriting the Guvnor 6 VFS repository</para> <para>-h,--help help for the command.</para> <para>-i,--inputJcrRepository &lt;arg&gt; The Guvnor 5 JCR repository</para> <para>-o,--outputVfsRepository &lt;arg&gt; The Guvnor 6 VFS repository</para> <para/> <para>Deploy to Guvnor M2 Repository remotely:</para> <para>You can deploy to Guvnor M2 Repository throuse SSH. The example belows show how to deploy to Guvnor M2 Repository using wagon-ssh plugin:</para> <programlisting> &lt;build&gt; &lt;extensions&gt; &lt;extension&gt; &lt;groupId&gt;org.apache.maven.wagon&lt;/groupId&gt; &lt;artifactId&gt;wagon-ssh&lt;/artifactId&gt; &lt;version&gt;1.0&lt;/version&gt; &lt;/extension&gt; &lt;/extensions&gt; &lt;/build&gt; &lt;!-- Enabling the use of FTP --&gt; &lt;distributionManagement&gt; &lt;repository&gt; &lt;id&gt;guvnor-m2-repo&lt;/id&gt; &lt;url&gt;sftp://10.66.16.171/local/dev/jboss-as-7.1.1.Final/bin/repository&lt;/url&gt; &lt;/repository&gt; &lt;/distributionManagement&gt; </programlisting> <para>You may need a login password for scp to work. For example, add following to settings.xml file:</para> <programlisting> &lt;servers&gt; &lt;server&gt; &lt;id&gt;guvnor-m2-repo&lt;/id&gt; &lt;username&gt;yourusername&lt;/username&gt; &lt;password&gt;yourpwd&lt;/password&gt; &lt;/server&gt; &lt;/servers&gt;</programlisting> <para/> <para/> </section> <section> <title>REST</title> <para>The GuvnorNG Rest API provides access to project "service" resources, i.e., any "service" that is not part of the underlying persistence mechanism (i.e, Git, VFS).</para> <para>The http address to use as base address is http://{ServerName}/{httpPort}/{droolsWBWarFilename}/rest where ServerName is the host name on the server on which drools-wb is deployed, httpPort the port number (8080 by default development) and droolsWBWarFilename the name of the archived deployed (drools-workbench-6.0.0 for version 6.0) without the extension.</para> <para>Check this doc for API details: https://app.apiary.io/jervisliu/editor</para> <para/> </section> </section> </section> <section xml:id="releaseNotes_6.0.0_OptaPlanner"> <title>OptaPlanner (AKA Drools Planner)</title> <section> <title>Drools Planner renamed to OptaPlanner</title> <para>OptaPlanner is the new name for Drools Planner. OptaPlanner is now standalone, but can still be optionally combined with the Drools rule engine for a powerful declarative approach to planning optimization.</para> <para>OptaPlanner has a new website (<link xlink:href="http://www.optaplanner.org">http://www.optaplanner.org</link>), a <link xlink:href="http://www.optaplanner.org/download/download.html">new groupId/artifactId</link> and its own <link xlink:href="http://www.optaplanner.org/community/chat.html">IRC channel</link>. It's a rename, not a fork. It's still the same license (ASL), same team, ...</para> <para>For more information, see <link xlink:href="http://www.optaplanner.org/community/droolsPlannerRenamed.html">the full announcement</link>.</para> </section> <section> <title>Faster and easier scoreDRL</title> <para>The new ConstraintMatch system is:</para> <itemizedlist> <listitem> <para>Faster: the average calculate count per seconds increases between 7% and 40% on average per use case.</para> </listitem> <listitem> <para>Easier to read and write</para> </listitem> <listitem> <para>Far less error-prone. It's much harder to cause score corruption in your DRL.</para> </listitem> </itemizedlist> <para>Before:</para> <programlisting language="java"> rule "conflictingLecturesSameCourseInSamePeriod" when ... then insertLogical(new IntConstraintOccurrence("conflictingLecturesSameCourseInSamePeriod", ConstraintType.HARD, -1, $leftLecture, $rightLecture)); end</programlisting> <para>After:</para> <programlisting language="java"> rule "conflictingLecturesSameCourseInSamePeriod" when ... then scoreHolder.addHardConstraintMatch(kcontext, -1); end</programlisting> <para>Notice that you don't need to repeat the ruleName or the causes (the lectures) no more. OptaPlanner figures out it itself through the kcontext variable. Drools automatically exposes the kcontext variable in the RHS, so you don't need any extra code for it.</para> <para>You also no longer need to hack the API's to get a list of all ConstraintOcurrence's: the ConstraintMatch objects (and their totals per constraint) are available directly on the ScoreDirector API.</para> <para>For more information, see <link xlink:href="http://blog.athico.com/2013/04/score-drl-faster-and-easier-in.html">the blog post</link> and the manual.</para> </section> <section> <title>Construction heuristics now use selectors</title> <para>The construction heuristics now use the selector architecture so they support selection filtering, etc. Sorting can be overwritten at a configuration level (very handy for benchmarking).</para> <para>In cases with multiple planning variables (for example period, room and teacher), you can now switch to a far more scalable configuration.</para> </section> <section> <title>Automatic solution cloning</title> <para>Implementing the <literal>Solution's</literal> planning <literal>clone</literal> method is now optional. This means there's less boilerplate code to write and it's hard to cause score corruption in your code.</para> <para>For more information, see <link xlink:href="http://blog.athico.com/2013/02/automatic-solution-cloning-in-planner.html">the blog post</link> and the manual.</para> </section> <section> <title>New build-in scores</title> <para>New build-in score definitions include: <literal>HardMediumSoftScore</literal> (3 score levels), <literal>BendableScore</literal> (configurable number of score levels), <literal>HardSoftLongScore</literal>, <literal>HardSoftDoubleScore</literal>, <literal>HardSoftBigDecimalScore</literal>, ...</para> </section> <section> <title>Planning Variable Listener (shadow variables)</title> <para>A planning variable can now have a listener which updates a shadow planning variable.</para> <para>A shadow planning variable is a variable that is never changed directly, but can be calculated based on the state of the genuine planning variables. For example: in VRP with time windows, the arrival time at a customer can be calculated based on the previous customers of that vehicle.</para> </section> <section> <title>New example: VRP with time windows</title> <para>The VRP example can now also handle the capacitated vehicle routing problem with time windows.</para> <para>Use the import button to import a time windowed dataset.</para> <mediaobject> <imageobject> <imagedata align="center" fileref="images/Chapter-Release_Notes/vehicleRoutingWithTimeWindows.png" format="PNG"/> </imageobject> </mediaobject> </section> <section> <title>Bi-directional variable relationship for chained variables</title> <para>A shadow planning variable can now be <literal>mappedBy</literal> a genuine variable. Planner will automatically update the shadow variable if the genuine variable is changed.</para> <para>Currently this is only supported for chained variables.</para> </section> <section> <title>TSP and VRP: Chained variables are more scalable</title> <para>Several improvements have made use cases like TSP and VRP more scalable. The code has been optimized to run significantly faster. Also ,<literal>&lt;subChainSelector&gt;</literal> now supports <literal>&lt;maximumSubChainSize&gt;</literal> to scale out better.</para> </section> <section> <title>New example: Project job scheduling</title> <para>Project job scheduling is a form of job shop scheduling, for example to schedule the production of diverse books, cars or other products to machines and employees (thanks to Lukáš Petrovický).</para> </section> <section> <title>Benchmarker improvements</title> <itemizedlist> <listitem> <para>The best solution mutation statistic shows for every new best solution found, how many variables needed to change to improve the last best solution.</para> </listitem> <listitem> <para>The step score statistic shows how the step score evolves over time.</para> </listitem> <listitem> <para>The Benchmarker now highlights infeasible solutions with an orange exclamation mark.</para> </listitem> </itemizedlist> </section> <section> <title>Example improvements</title> <itemizedlist> <listitem> <para>The GUI's of course scheduling, exam scheduling, hospital bed planning and sport scheduling have been improved.</para> </listitem> <listitem> <para>The optaplanner examples Swing GUI has been redesigned to take up less space.</para> </listitem> <listitem> <para>A web variant of the cloud balancing example has been added to optaplanner-webexamples.war.</para> </listitem> <listitem> <para>The Benchmarker now shows standard deviation per solver configuration (thanks to Miroslav Svitok).</para> </listitem> </itemizedlist> </section> <section> <title>Other improvements</title> <itemizedlist> <listitem> <para>Domain classes that extend/implement a <literal>@PlanningEntity</literal> class or interface can now be used as planning entities.</para> </listitem> <listitem> <para>Late Acceptance improved.</para> </listitem> <listitem> <para>Ratio based entity tabu (thanks to Lukáš Petrovický)</para> </listitem> <listitem> <para>Drools properties can now be optionally specified in the solver configuration XML.</para> </listitem> <listitem> <para>Mimic selection: usefull to create a cartesian product selection of 2 change move selectors that move different variables of the <emphasis>same</emphasis> entity</para> </listitem> <listitem> <para>KieBase support</para> </listitem> <listitem> <para>Nullable variables support improved</para> </listitem> <listitem> <para>OSGi support out-of-the-box in the optaplanner jars.</para> </listitem> </itemizedlist> </section> </section> <section xml:id="releaseNotes_6.0.0_DashboardBuilder"> <title>Dashboard Builder</title> <section> <title>What is JBoss Dashboard Builder?</title> <para>The Dashboard Builder is a full featured web application which allows non-technical users to visually create business dashboards. Dashboard data can be extracted from heterogeneous sources of information such as JDBC databases or regular text files. It also provides a generic process dashboard for the jBPM Human Task module. Such dashboard can display multiple key performance indicators regarding process instances, tasks and users.</para> <para>Some ready-to-use sample dashboards are provided as well, for demo and learning purposes.</para> <section> <title>Key features:</title> <itemizedlist spacing="compact"> <listitem> <para>Visual configuration of dashboards (Drag'n'drop).</para> </listitem> <listitem> <para>Graphical representation of KPIs (Key Performance Indicators).</para> </listitem> <listitem> <para>Configuration of interactive report tables.</para> </listitem> <listitem> <para>Data export to Excel and CSV format.</para> </listitem> <listitem> <para>Filtering and search, both in-memory or SQL based.</para> </listitem> <listitem> <para>Process and tasks dashboards with jBPM.</para> </listitem> <listitem> <para>Data extraction from external systems, through different protocols.</para> </listitem> <listitem> <para>Granular access control for different user profiles.</para> </listitem> <listitem> <para>Look'n'feel customization tools.</para> </listitem> <listitem> <para>Pluggable chart library architecture.</para> </listitem> <listitem> <para>Chart libraries provided: NVD3 &amp; OFC2.</para> </listitem> </itemizedlist> </section> <section> <title>Target users:</title> <itemizedlist spacing="compact"> <listitem> <para>Managers / Business owners. Consumer of dashboards and reports.</para> </listitem> <listitem> <para>IT / System architects. Connectivity and data extraction.</para> </listitem> <listitem> <para>Analysts. Dashboard composition &amp; configuration.</para> </listitem> </itemizedlist> </section> <section> <title>More info:</title> <para>For more info on the Dashboard Builder application, please refer to: <link xlink:href="https://github.com/droolsjbpm/dashboard-builder/blob/master/docs/quick-start-guide/index.html">Dash Builder Quick Start Guide</link>.</para> </section> </section> </section> </section>
{ "content_hash": "02f8279de9a62067e6b19f795e10abbf", "timestamp": "", "source": "github", "line_count": 1474, "max_line_length": 180, "avg_line_length": 37.758480325644506, "alnum_prop": 0.6293661060802069, "repo_name": "mrietveld/droolsjbpm-knowledge", "id": "ec901837ca8ecc46c5899f26723ed130f89ea549", "size": "55662", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "droolsjbpm-introduction-docs/src/main/docbook/en-US/Release_Notes/What_is_new_Drools_6.0.0.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "863023" } ], "symlink_target": "" }
`expected ${actual} not to be divisible by ${expected}`;
{ "content_hash": "239311b10885e0c8f809ba6e528f17a9", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 56, "avg_line_length": 57, "alnum_prop": 0.7017543859649122, "repo_name": "stas-vilchik/bdd-ml", "id": "6a195b9a662f7c0360993671634bededa9bfea99", "size": "57", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "data/4428.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "6666795" }, { "name": "Python", "bytes": "3199" } ], "symlink_target": "" }
package azurerm import ( "fmt" "log" "github.com/hashicorp/terraform/helper/schema" "github.com/jen20/riviera/dns" ) func resourceArmDnsARecord() *schema.Resource { return &schema.Resource{ Create: resourceArmDnsARecordCreate, Read: resourceArmDnsARecordRead, Update: resourceArmDnsARecordCreate, Delete: resourceArmDnsARecordDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, Required: true, ForceNew: true, }, "resource_group_name": &schema.Schema{ Type: schema.TypeString, Required: true, ForceNew: true, }, "zone_name": &schema.Schema{ Type: schema.TypeString, Required: true, }, "records": &schema.Schema{ Type: schema.TypeSet, Required: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, "ttl": &schema.Schema{ Type: schema.TypeInt, Required: true, }, "tags": tagsSchema(), }, } } func resourceArmDnsARecordCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient) rivieraClient := client.rivieraClient tags := d.Get("tags").(map[string]interface{}) expandedTags := expandTags(tags) createCommand := &dns.CreateARecordSet{ Name: d.Get("name").(string), Location: "global", ResourceGroupName: d.Get("resource_group_name").(string), ZoneName: d.Get("zone_name").(string), TTL: d.Get("ttl").(int), Tags: *expandedTags, } recordStrings := d.Get("records").(*schema.Set).List() records := make([]dns.ARecord, len(recordStrings)) for i, v := range recordStrings { records[i] = dns.ARecord{ IPv4Address: v.(string), } } createCommand.ARecords = records createRequest := rivieraClient.NewRequest() createRequest.Command = createCommand createResponse, err := createRequest.Execute() if err != nil { return fmt.Errorf("Error creating DNS A Record: %s", err) } if !createResponse.IsSuccessful() { return fmt.Errorf("Error creating DNS A Record: %s", createResponse.Error) } readRequest := rivieraClient.NewRequest() readRequest.Command = &dns.GetARecordSet{ Name: d.Get("name").(string), ResourceGroupName: d.Get("resource_group_name").(string), ZoneName: d.Get("zone_name").(string), } readResponse, err := readRequest.Execute() if err != nil { return fmt.Errorf("Error reading DNS A Record: %s", err) } if !readResponse.IsSuccessful() { return fmt.Errorf("Error reading DNS A Record: %s", readResponse.Error) } resp := readResponse.Parsed.(*dns.GetARecordSetResponse) d.SetId(resp.ID) return resourceArmDnsARecordRead(d, meta) } func resourceArmDnsARecordRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient) rivieraClient := client.rivieraClient id, err := parseAzureResourceID(d.Id()) if err != nil { return err } readRequest := rivieraClient.NewRequestForURI(d.Id()) readRequest.Command = &dns.GetARecordSet{} readResponse, err := readRequest.Execute() if err != nil { return fmt.Errorf("Error reading DNS A Record: %s", err) } if !readResponse.IsSuccessful() { log.Printf("[INFO] Error reading DNS A Record %q - removing from state", d.Id()) d.SetId("") return fmt.Errorf("Error reading DNS A Record: %s", readResponse.Error) } resp := readResponse.Parsed.(*dns.GetARecordSetResponse) d.Set("name", resp.Name) d.Set("resource_group_name", id.ResourceGroup) d.Set("zone_name", id.Path["dnszones"]) d.Set("ttl", resp.TTL) if resp.ARecords != nil { records := make([]string, 0, len(resp.ARecords)) for _, record := range resp.ARecords { records = append(records, record.IPv4Address) } if err := d.Set("records", records); err != nil { return err } } flattenAndSetTags(d, &resp.Tags) return nil } func resourceArmDnsARecordDelete(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient) rivieraClient := client.rivieraClient deleteRequest := rivieraClient.NewRequestForURI(d.Id()) deleteRequest.Command = &dns.DeleteRecordSet{ RecordSetType: "A", } deleteResponse, err := deleteRequest.Execute() if err != nil { return fmt.Errorf("Error deleting DNS A Record: %s", err) } if !deleteResponse.IsSuccessful() { return fmt.Errorf("Error deleting DNS A Record: %s", deleteResponse.Error) } return nil }
{ "content_hash": "b56456e2d5b01cf08ecb729decf6cc21", "timestamp": "", "source": "github", "line_count": 176, "max_line_length": 82, "avg_line_length": 25.59090909090909, "alnum_prop": 0.677619893428064, "repo_name": "stardog-union/stardog-graviton", "id": "ba56deb637ae4653c7498ce774edfb671c00595f", "size": "4504", "binary": false, "copies": "98", "ref": "refs/heads/develop", "path": "vendor/github.com/hashicorp/terraform/builtin/providers/azurerm/resource_arm_dns_a_record.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "BitBake", "bytes": "50002" }, { "name": "Dockerfile", "bytes": "1212" }, { "name": "Go", "bytes": "195457" }, { "name": "HCL", "bytes": "26587" }, { "name": "Makefile", "bytes": "602" }, { "name": "Python", "bytes": "43992" }, { "name": "Shell", "bytes": "11173" }, { "name": "Smarty", "bytes": "2192" } ], "symlink_target": "" }
TE_BEGIN_TERMINUS_NAMESPACE class ZipFile : public File { public: ZipFile(void* handle, size_t size); ~ZipFile(); virtual size_t size() override; virtual FileType type() override; virtual size_t read(void* buffer, const size_t& size, const size_t& count) override; virtual size_t write(void* data, const size_t& size, const size_t& count) override; virtual void seek(const size_t& offset) override; void* handle() override; void close() override; private: size_t m_start; size_t m_size; void* m_handle; }; TE_END_TERMINUS_NAMESPACE
{ "content_hash": "a5b5c92bfaf3e56b95dff17fea0b4ddf", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 85, "avg_line_length": 25.045454545454547, "alnum_prop": 0.7186932849364791, "repo_name": "diharaw/Terminus-Engine", "id": "9df6399d2cbb98ac79c7a90c43e5ea085c8e49ac", "size": "589", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "engine/include/io/zip_file.hpp", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "452" }, { "name": "C", "bytes": "932612" }, { "name": "C++", "bytes": "945376" }, { "name": "CMake", "bytes": "26358" }, { "name": "GLSL", "bytes": "663" }, { "name": "Shell", "bytes": "766" } ], "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_13) on Thu Feb 13 10:50:43 CST 2014 --> <title>PDFView.PDFViewListener</title> <meta name="date" content="2014-02-13"> <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="PDFView.PDFViewListener"; } //--> </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/PDFView.PDFViewListener.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-files/index-1.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../com/radaee/pdfex/PDFView.PDFSelDispPara.html" title="class in com.radaee.pdfex"><span class="strong">Prev Class</span></a></li> <li><a href="../../../com/radaee/pdfex/PDFView.STATUS.html" title="enum in com.radaee.pdfex"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?com/radaee/pdfex/PDFView.PDFViewListener.html" target="_top">Frames</a></li> <li><a href="PDFView.PDFViewListener.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">com.radaee.pdfex</div> <h2 title="Interface PDFView.PDFViewListener" class="title">Interface PDFView.PDFViewListener</h2> </div> <div class="contentContainer"> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>Enclosing interface:</dt> <dd><a href="../../../com/radaee/pdfex/PDFView.html" title="interface in com.radaee.pdfex">PDFView</a></dd> </dl> <hr> <br> <pre>public static interface <span class="strong">PDFView.PDFViewListener</span></pre> <div class="block">Interface for view operations listener.</div> </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>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onFound(boolean)">onFound</a></strong>(boolean&nbsp;found)</code> <div class="block">fired when find returned</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onInvalidate()">onInvalidate</a></strong>()</code> <div class="block">fired when the view need redraw.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onOpen3D(java.lang.String)">onOpen3D</a></strong>(java.lang.String&nbsp;file_name)</code> <div class="block">fired when a 3D object to be opened.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onOpenAttachment(java.lang.String)">onOpenAttachment</a></strong>(java.lang.String&nbsp;file_name)</code> <div class="block">fired when an attachment to be opened.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onOpenMovie(java.lang.String)">onOpenMovie</a></strong>(java.lang.String&nbsp;file_name)</code> <div class="block">fired when a movie to be opened.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onOpenSound(int[], java.lang.String)">onOpenSound</a></strong>(int[]&nbsp;paras, java.lang.String&nbsp;file_name)</code> <div class="block">fired when an audio to be opened.<br/> if paras[0] == 0 means formatted audio file (mp3/wav/midi/...)</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onOpenURL(java.lang.String)">onOpenURL</a></strong>(java.lang.String&nbsp;url)</code> <div class="block">fired when an URL link to be opened.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onPageChanged(int)">onPageChanged</a></strong>(int&nbsp;pageno)</code> <div class="block">fired when page NO.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onPageDisplayed(com.radaee.pdfex.PDFView.PDFPageDispPara)">onPageDisplayed</a></strong>(<a href="../../../com/radaee/pdfex/PDFView.PDFPageDispPara.html" title="class in com.radaee.pdfex">PDFView.PDFPageDispPara</a>&nbsp;para)</code> <div class="block">fired when a page displayed in view.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onSelDisplayed(com.radaee.pdfex.PDFView.PDFSelDispPara)">onSelDisplayed</a></strong>(<a href="../../../com/radaee/pdfex/PDFView.PDFSelDispPara.html" title="class in com.radaee.pdfex">PDFView.PDFSelDispPara</a>&nbsp;para)</code> <div class="block">fired when text selection displayed.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onSelectEnd(java.lang.String)">onSelectEnd</a></strong>(java.lang.String&nbsp;text)</code> <div class="block">fired when text selected.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onSelectStart()">onSelectStart</a></strong>()</code> <div class="block">fired when long pressed, and start text selection.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onSingleTap(float, float)">onSingleTap</a></strong>(float&nbsp;x, float&nbsp;y)</code> <div class="block">fired when single taped</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/radaee/pdfex/PDFView.PDFViewListener.html#onSubmit(java.lang.String, java.lang.String)">onSubmit</a></strong>(java.lang.String&nbsp;target, java.lang.String&nbsp;para)</code>&nbsp;</td> </tr> </table> </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="onSingleTap(float, float)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onSingleTap</h4> <pre>void&nbsp;onSingleTap(float&nbsp;x, float&nbsp;y)</pre> <div class="block">fired when single taped</div> </li> </ul> <a name="onInvalidate()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onInvalidate</h4> <pre>void&nbsp;onInvalidate()</pre> <div class="block">fired when the view need redraw.</div> </li> </ul> <a name="onFound(boolean)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onFound</h4> <pre>void&nbsp;onFound(boolean&nbsp;found)</pre> <div class="block">fired when find returned</div> </li> </ul> <a name="onSelectStart()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onSelectStart</h4> <pre>void&nbsp;onSelectStart()</pre> <div class="block">fired when long pressed, and start text selection.</div> </li> </ul> <a name="onSelectEnd(java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onSelectEnd</h4> <pre>void&nbsp;onSelectEnd(java.lang.String&nbsp;text)</pre> <div class="block">fired when text selected.</div> </li> </ul> <a name="onSelDisplayed(com.radaee.pdfex.PDFView.PDFSelDispPara)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onSelDisplayed</h4> <pre>void&nbsp;onSelDisplayed(<a href="../../../com/radaee/pdfex/PDFView.PDFSelDispPara.html" title="class in com.radaee.pdfex">PDFView.PDFSelDispPara</a>&nbsp;para)</pre> <div class="block">fired when text selection displayed.</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>para</code> - x1, y1: first char left-top coordinate for selection<br/> x1, y1: last char right-bottom coordinate for selection</dd></dl> </li> </ul> <a name="onSubmit(java.lang.String, java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onSubmit</h4> <pre>void&nbsp;onSubmit(java.lang.String&nbsp;target, java.lang.String&nbsp;para)</pre> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>target</code> - "http:" header or "mailto:" header, and so on</dd><dd><code>para</code> - <br/>mail mode: return whole XML string for form data.<br/> other mode: url data likes: "para1=xxx&para2=xxx".</dd></dl> </li> </ul> <a name="onOpenURL(java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onOpenURL</h4> <pre>void&nbsp;onOpenURL(java.lang.String&nbsp;url)</pre> <div class="block">fired when an URL link to be opened.</div> </li> </ul> <a name="onOpen3D(java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onOpen3D</h4> <pre>void&nbsp;onOpen3D(java.lang.String&nbsp;file_name)</pre> <div class="block">fired when a 3D object to be opened.</div> </li> </ul> <a name="onOpenMovie(java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onOpenMovie</h4> <pre>void&nbsp;onOpenMovie(java.lang.String&nbsp;file_name)</pre> <div class="block">fired when a movie to be opened.</div> </li> </ul> <a name="onOpenSound(int[], java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onOpenSound</h4> <pre>void&nbsp;onOpenSound(int[]&nbsp;paras, java.lang.String&nbsp;file_name)</pre> <div class="block">fired when an audio to be opened.<br/> if paras[0] == 0 means formatted audio file (mp3/wav/midi/...)</div> </li> </ul> <a name="onOpenAttachment(java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onOpenAttachment</h4> <pre>void&nbsp;onOpenAttachment(java.lang.String&nbsp;file_name)</pre> <div class="block">fired when an attachment to be opened.</div> </li> </ul> <a name="onPageChanged(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onPageChanged</h4> <pre>void&nbsp;onPageChanged(int&nbsp;pageno)</pre> <div class="block">fired when page NO. changed.</div> </li> </ul> <a name="onPageDisplayed(com.radaee.pdfex.PDFView.PDFPageDispPara)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>onPageDisplayed</h4> <pre>void&nbsp;onPageDisplayed(<a href="../../../com/radaee/pdfex/PDFView.PDFPageDispPara.html" title="class in com.radaee.pdfex">PDFView.PDFPageDispPara</a>&nbsp;para)</pre> <div class="block">fired when a page displayed in view.</div> </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/PDFView.PDFViewListener.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-files/index-1.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../com/radaee/pdfex/PDFView.PDFSelDispPara.html" title="class in com.radaee.pdfex"><span class="strong">Prev Class</span></a></li> <li><a href="../../../com/radaee/pdfex/PDFView.STATUS.html" title="enum in com.radaee.pdfex"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?com/radaee/pdfex/PDFView.PDFViewListener.html" target="_top">Frames</a></li> <li><a href="PDFView.PDFViewListener.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 ======= --> </body> </html>
{ "content_hash": "634e08646bd89c31afa4364d92ce35fc", "timestamp": "", "source": "github", "line_count": 431, "max_line_length": 330, "avg_line_length": 37.2784222737819, "alnum_prop": 0.6419991286487832, "repo_name": "gearit/RadaeePDF-B4A", "id": "9cff3468af5de1e820e92253a0d567b9e930b0b5", "size": "16067", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Documentation/javadoc/com/radaee/pdfex/PDFView.PDFViewListener.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "23226" }, { "name": "Java", "bytes": "772169" }, { "name": "Visual Basic", "bytes": "2739" } ], "symlink_target": "" }
/** * @license Highstock JS v10.1.0 (2022-04-29) * * Indicator series type for Highcharts Stock * * (c) 2010-2021 Wojciech Chmiel * * License: www.highcharts.com/license */ (function (factory) { if (typeof module === 'object' && module.exports) { factory['default'] = factory; module.exports = factory; } else if (typeof define === 'function' && define.amd) { define('highcharts/indicators/chaikin', ['highcharts', 'highcharts/modules/stock'], function (Highcharts) { factory(Highcharts); factory.Highcharts = Highcharts; return factory; }); } else { factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined); } }(function (Highcharts) { 'use strict'; var _modules = Highcharts ? Highcharts._modules : {}; function _registerModule(obj, path, args, fn) { if (!obj.hasOwnProperty(path)) { obj[path] = fn.apply(null, args); if (typeof CustomEvent === 'function') { window.dispatchEvent( new CustomEvent( 'HighchartsModuleLoaded', { detail: { path: path, module: obj[path] } }) ); } } } _registerModule(_modules, 'Stock/Indicators/AD/ADIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var error = U.error, extend = U.extend, merge = U.merge; /** * The AD series type. * * @private * @class * @name Highcharts.seriesTypes.ad * * @augments Highcharts.Series */ var ADIndicator = /** @class */ (function (_super) { __extends(ADIndicator, _super); function ADIndicator() { /* * * * Static Properties * * */ var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Static Functions * * */ ADIndicator.populateAverage = function (xVal, yVal, yValVolume, i, _period) { var high = yVal[i][1], low = yVal[i][2], close = yVal[i][3], volume = yValVolume[i], adY = close === high && close === low || high === low ? 0 : ((2 * close - low - high) / (high - low)) * volume, adX = xVal[i]; return [adX, adY]; }; /* * * * Functions * * */ ADIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, volumeSeriesID = params.volumeSeriesID, volumeSeries = series.chart.get(volumeSeriesID), yValVolume = volumeSeries && volumeSeries.yData, yValLen = yVal ? yVal.length : 0, AD = [], xData = [], yData = [], len, i, ADPoint; if (xVal.length <= period && yValLen && yVal[0].length !== 4) { return; } if (!volumeSeries) { error('Series ' + volumeSeriesID + ' not found! Check `volumeSeriesID`.', true, series.chart); return; } // i = period <-- skip first N-points // Calculate value one-by-one for each period in visible data for (i = period; i < yValLen; i++) { len = AD.length; ADPoint = ADIndicator.populateAverage(xVal, yVal, yValVolume, i, period); if (len > 0) { ADPoint[1] += AD[len - 1][1]; } AD.push(ADPoint); xData.push(ADPoint[0]); yData.push(ADPoint[1]); } return { values: AD, xData: xData, yData: yData }; }; /** * Accumulation Distribution (AD). This series requires `linkedTo` option to * be set. * * @sample stock/indicators/accumulation-distribution * Accumulation/Distribution indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/accumulation-distribution * @optionparent plotOptions.ad */ ADIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index */ params: { index: void 0, /** * The id of volume series which is mandatory. * For example using OHLC data, volumeSeriesID='volume' means * the indicator will be calculated using OHLC and volume values. * * @since 6.0.0 */ volumeSeriesID: 'volume' } }); return ADIndicator; }(SMAIndicator)); extend(ADIndicator.prototype, { nameComponents: false, nameBase: 'Accumulation/Distribution' }); SeriesRegistry.registerSeriesType('ad', ADIndicator); /* * * * Default Export * * */ /* * * * API Options * * */ /** * A `AD` series. If the [type](#series.ad.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.ad * @since 6.0.0 * @excluding dataParser, dataURL * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/accumulation-distribution * @apioption series.ad */ ''; // add doclet above to transpiled file return ADIndicator; }); _registerModule(_modules, 'Stock/Indicators/Chaikin/ChaikinIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var _a = SeriesRegistry.seriesTypes, AD = _a.ad, EMAIndicator = _a.ema; var correctFloat = U.correctFloat, extend = U.extend, merge = U.merge, error = U.error; /* * * * Class * * */ /** * The Chaikin series type. * * @private * @class * @name Highcharts.seriesTypes.chaikin * * @augments Highcharts.Series */ var ChaikinIndicator = /** @class */ (function (_super) { __extends(ChaikinIndicator, _super); function ChaikinIndicator() { /* * * * Static Properties * * */ var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ ChaikinIndicator.prototype.getValues = function (series, params) { var periods = params.periods, period = params.period, // Accumulation Distribution Line data ADL, // 0- date, 1- Chaikin Oscillator CHA = [], xData = [], yData = [], periodsOffset, // Shorter Period EMA SPE, // Longer Period EMA LPE, oscillator, i; // Check if periods are correct if (periods.length !== 2 || periods[1] <= periods[0]) { error('Error: "Chaikin requires two periods. Notice, first ' + 'period should be lower than the second one."'); return; } ADL = AD.prototype.getValues.call(this, series, { volumeSeriesID: params.volumeSeriesID, period: period }); // Check if adl is calculated properly, if not skip if (!ADL) { return; } SPE = EMAIndicator.prototype.getValues.call(this, ADL, { period: periods[0] }); LPE = EMAIndicator.prototype.getValues.call(this, ADL, { period: periods[1] }); // Check if ema is calculated properly, if not skip if (!SPE || !LPE) { return; } periodsOffset = periods[1] - periods[0]; for (i = 0; i < LPE.yData.length; i++) { oscillator = correctFloat(SPE.yData[i + periodsOffset] - LPE.yData[i]); CHA.push([LPE.xData[i], oscillator]); xData.push(LPE.xData[i]); yData.push(oscillator); } return { values: CHA, xData: xData, yData: yData }; }; /** * Chaikin Oscillator. This series requires the `linkedTo` option to * be set and should be loaded after the `stock/indicators/indicators.js`. * * @sample {highstock} stock/indicators/chaikin * Chaikin Oscillator * * @extends plotOptions.ema * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, joinBy, keys, navigatorOptions, * pointInterval, pointIntervalUnit, pointPlacement, * pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/chaikin * @optionparent plotOptions.chaikin */ ChaikinIndicator.defaultOptions = merge(EMAIndicator.defaultOptions, { /** * Paramters used in calculation of Chaikin Oscillator * series points. * * @excluding index */ params: { index: void 0, /** * The id of volume series which is mandatory. * For example using OHLC data, volumeSeriesID='volume' means * the indicator will be calculated using OHLC and volume values. */ volumeSeriesID: 'volume', /** * Parameter used indirectly for calculating the `AD` indicator. * Decides about the number of data points that are taken * into account for the indicator calculations. */ period: 9, /** * Periods for Chaikin Oscillator calculations. * * @type {Array<number>} * @default [3, 10] */ periods: [3, 10] } }); return ChaikinIndicator; }(EMAIndicator)); extend(ChaikinIndicator.prototype, { nameBase: 'Chaikin Osc', nameComponents: ['periods'] }); SeriesRegistry.registerSeriesType('chaikin', ChaikinIndicator); /* * * * Default Export * * */ /** * A `Chaikin Oscillator` series. If the [type](#series.chaikin.type) * option is not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.chaikin * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, dataParser, dataURL, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, stacking, showInNavigator * @requires stock/indicators/indicators * @requires stock/indicators/chaikin * @apioption series.chaikin */ ''; // to include the above in the js output return ChaikinIndicator; }); _registerModule(_modules, 'masters/indicators/chaikin.src.js', [], function () { }); }));
{ "content_hash": "63809cad4e04b0ba350865ace915afed", "timestamp": "", "source": "github", "line_count": 428, "max_line_length": 184, "avg_line_length": 37.37850467289719, "alnum_prop": 0.43024128016002, "repo_name": "cdnjs/cdnjs", "id": "a03fde20640710c65171a6cf0db8492f467ede4e", "size": "15998", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ajax/libs/highcharts/10.1.0/indicators/chaikin.src.js", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
package org.vizzini.ai.neuralnetwork.format; import org.vizzini.ai.neuralnetwork.Layer; import org.vizzini.core.Format; /** * Defines methods required by a layer formatter. */ public interface LayerFormat extends Format<Layer> { // Nothing to do. }
{ "content_hash": "8fc0276e6519a247dd4b94f0b708f6f9", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 50, "avg_line_length": 21.416666666666668, "alnum_prop": 0.754863813229572, "repo_name": "jmthompson2015/vizzini", "id": "fdd6059457376bbc93ab4d82c496b6c47e3e2d16", "size": "257", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ai/src/main/java/org/vizzini/ai/neuralnetwork/format/LayerFormat.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "57354" }, { "name": "HTML", "bytes": "657815" }, { "name": "Java", "bytes": "4693320" }, { "name": "JavaScript", "bytes": "10995004" }, { "name": "Shell", "bytes": "3240" } ], "symlink_target": "" }
import React, { Component, PropTypes} from 'react' import { connect } from 'react-redux' import { go } from '../../actions/server' import { viewTimeReportBy } from '../../actions/session' export class SideBar extends Component { render() { const {users,period}=this.props const page =(view)=> (e) => { e.preventDefault(); this.props.viewTimeReportBy((view||'users').toUpperCase()); this.props.go(`/period/${period.start}/${period.end}/reports/view/${view}/`); } const profile =(view)=> (e) => { e.preventDefault(); this.props.go(`/period/${period.start}/${period.end}/user/${view}`); } return ( <aside className="main-sidebar"> <section className="sidebar"> <div className="user-panel"> <div className="pull-left image"> <img src="/node_modules/admin-lte/dist/img/user2-160x160.jpg" className="img-circle" alt="User Image" /> </div> <div className="pull-left info"> <p>Turbo Coder</p> <a href="#"><i className="fa fa-circle text-success"></i> Online</a> </div> </div> <form action="#" method="get" className="sidebar-form"> <div className="input-group"> <input type="text" name="q" className="form-control" placeholder="TURBO Search..." /> <span className="input-group-btn"> <button type="submit" name="search" id="search-btn" className="btn btn-flat"> <i className="fa fa-search"></i> </button> </span> </div> </form> <ul className="sidebar-menu"> <li className="header">REPORTS</li> <li><a href="#" onClick={page('svn_users')}><i className="fa fa-upload"></i> <span>Commits</span></a></li> <li><a href="#" onClick={page('svn_repo')}><i className="fa fa-inbox"></i> <span>Repo</span></a></li> <li><a href="#" onClick={page('svn_branch')}><i className="fa fa-code-fork"></i> <span>Branch</span></a></li> <li><a href="#" onClick={page('svn_month')}><i className="fa fa-calendar"></i> <span>Month</span></a></li> <li><a href="#" onClick={page('users')}><i className="fa fa-user"></i> <span>Users</span></a></li> <li><a href="#" onClick={page('projects')}><i className="fa fa-list"></i> <span>Projects</span></a></li> <li><a href="#" onClick={page('issues')}><i className="fa fa-money"></i> <span>Issues</span></a></li> <li><a href="#" onClick={page('months')}><i className="fa fa-calendar"></i> <span>Month</span></a></li> <li className="treeview active"> <a href="#"> <i className="fa fa-users"></i> <span>Users</span> <span className="pull-right-container"> <i className="fa fa-angle-left pull-right"></i> </span> </a> <ul className="treeview-menu menu-open"> {users.map(user=> <li key={user.id}><a href="#" onClick={profile(user.username)}><i className="fa fa-user"></i> {user.fullName}</a></li> )} </ul> </li> </ul> </section> </aside> ) } } function mapStateToProps (state) { return { period: state.server.period, } } export default connect( mapStateToProps, {go,viewTimeReportBy} )(SideBar)
{ "content_hash": "6aaae0a2b9f7e8fca569aa1df8d70046", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 146, "avg_line_length": 47.65432098765432, "alnum_prop": 0.4772020725388601, "repo_name": "nikitaignatov/magictimes", "id": "00d978796c656ed9a55ef2961e95a796befa4f60", "size": "3862", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "components/layout/SideBar.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "2277" }, { "name": "JavaScript", "bytes": "33832" } ], "symlink_target": "" }
require 'English' module Inch module Language module Ruby module Provider module YARD module NodocHelper # Returns true if the code object is somehow marked not to be # documented. # # @note Doesnot recognize ":startdoc:" and ":stopdoc:" # def nodoc? tagged_as_private? || nodoc_comment? end NO_DOC_REGEX = /#\s*\:nodoc\:/ NO_DOC_ALL_REGEX = /#\s*\:nodoc\:\s*all/ DOC_REGEX = /#\s*\:doc\:/ def nodoc_comment? explicit_nodoc_comment? || implicit_nodoc_comment? end def explicit_nodoc_comment? declarations.any? { |str| str =~ NO_DOC_REGEX } end def explicit_nodoc_all_comment? declarations.any? { |str| str =~ NO_DOC_ALL_REGEX } end def explicit_doc_comment? declarations.any? { |str| str =~ DOC_REGEX } end def implicit_nodoc_all_comment? if parent parent.explicit_nodoc_all_comment? || parent.implicit_nodoc_all_comment? end end def implicit_nodoc_comment? return false if explicit_doc_comment? if parent return false if parent.explicit_doc_comment? if namespace? if parent.explicit_nodoc_all_comment? return true else return parent.implicit_nodoc_all_comment? end else if parent.explicit_nodoc_comment? return true else return parent.implicit_nodoc_all_comment? end end end end # Returns all lines in all files declaring the object # # @example # declarations # => ["class Base # :nodoc:", "class Foo < Base"] # # @return [Array<String>] def declarations @declarations ||= files.map do |f| get_line_no(f.filename, f.line_no) end end # Returns a +line_number+ from a file # # @param filename [String] # @param line_number [Fixnum] # @return [String] def get_line_no(filename, line_number) f = File.open(filename) line_number.times { f.gets } result = $LAST_READ_LINE f.close result.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') end end end end end end end
{ "content_hash": "47fc84aa4903d16e7c0eb78f8877d01f", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 78, "avg_line_length": 29.608247422680414, "alnum_prop": 0.4557799442896936, "repo_name": "jasnow/inch", "id": "73f6b4943ce260f1125cf0bee9f98250d065d122", "size": "2872", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "lib/inch/language/ruby/provider/yard/nodoc_helper.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "372396" } ], "symlink_target": "" }
Introduction ============= The module be from Tengine, specific information please taking a look [url](http://tengine.taobao.org/document_cn/http_upstream_dynamic_cn.html).
{ "content_hash": "e317ca4dca128a02d554ea363e62f9d2", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 145, "avg_line_length": 43.5, "alnum_prop": 0.735632183908046, "repo_name": "xiaokai-wang/nginx-discovery", "id": "787307ec784d7f2ead33beba9436c3201e9b8aa9", "size": "174", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "modules/ngx_http_upstream_dynamic_module/README.md", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "4267150" }, { "name": "C++", "bytes": "18636" }, { "name": "HTML", "bytes": "1149" }, { "name": "Nginx", "bytes": "2928" }, { "name": "Objective-C", "bytes": "1226" }, { "name": "Perl", "bytes": "227324" }, { "name": "Perl6", "bytes": "60448" }, { "name": "Python", "bytes": "150662" }, { "name": "Shell", "bytes": "312" }, { "name": "VimL", "bytes": "37498" }, { "name": "XS", "bytes": "21306" } ], "symlink_target": "" }
"use strict"; $(document).ready(function() { var slider = $('.c-layout-revo-slider .tp-banner'); var cont = $('.c-layout-revo-slider .tp-banner-container'); var api = slider.show().revolution({ delay: 15000, startwidth:1170, startheight: 620, navigationType: "hide", navigationArrows: "solo", touchenabled: "on", onHoverStop: "on", keyboardNavigation: "off", navigationStyle: "circle", navigationHAlign: "center", navigationVAlign: "bottom", spinner: "spinner2", fullScreen: "on", fullScreenAlignForce:"on", fullScreenOffsetContainer: (App.getViewPort().width < App.getBreakpoint('md') ? '.c-layout-header' : ''), shadow: 0, fullWidth: "off", forceFullWidth: "off", hideTimerBar:"on", hideThumbsOnMobile: "on", hideNavDelayOnMobile: 1500, hideBulletsOnMobile: "on", hideArrowsOnMobile: "on", hideThumbsUnderResolution: 0 }); }); //ready
{ "content_hash": "c17f351f99e0548fe33813b3331bda00", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 113, "avg_line_length": 27.024390243902438, "alnum_prop": 0.5505415162454874, "repo_name": "lamquochuy/yii_web", "id": "e29e294103554a8ec745b8783810f730147876c3", "size": "1108", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "frontend/web/js/scripts/revo-slider/slider-fullscreen.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "120" }, { "name": "Batchfile", "bytes": "1541" }, { "name": "CSS", "bytes": "1968207" }, { "name": "HTML", "bytes": "2084100" }, { "name": "JavaScript", "bytes": "3345141" }, { "name": "PHP", "bytes": "755770" } ], "symlink_target": "" }
package org.apache.derby.iapi.services.io; import java.io.*; /** Utility methods for InputStream that are stand-ins for a small subset of DataInput methods. This avoids pushing a DataInputStream just to get this functionality. */ public final class InputStreamUtil { private static final int SKIP_FRAGMENT_SIZE = Integer.MAX_VALUE; /** Read an unsigned byte from an InputStream, throwing an EOFException if the end of the input is reached. @param in Whence to read a byte @return the byte @exception IOException if an I/O error occurs. @exception EOFException if the end of the stream is reached @see DataInput#readUnsignedByte */ public static int readUnsignedByte(InputStream in) throws IOException { int b = in.read(); if (b < 0) throw new EOFException(); return b; } /** Read a number of bytes into an array. @param in Whence to read @param b The byte array to fill @param offset Position in byte array where we should start writing @param len Number of bytes to read @exception IOException if an I/O error occurs. @exception EOFException if the end of the stream is reached @see DataInput#readFully */ public static void readFully(InputStream in, byte b[], int offset, int len) throws IOException { do { int bytesRead = in.read(b, offset, len); if (bytesRead < 0) throw new EOFException(); len -= bytesRead; offset += bytesRead; } while (len != 0); } /** Read a number of bytes into an array. Keep reading in a loop until len bytes are read or EOF is reached or an exception is thrown. Return the number of bytes read. (InputStream.read(byte[],int,int) does not guarantee to read len bytes even if it can do so without reaching EOF or raising an exception.) @param in Whence to read @param b The byte array to fill @param offset Position in byte array where we should start writing @param len Number of bytes to read @return the number of bytes read @exception IOException if an I/O error occurs. */ public static int readLoop(InputStream in, byte b[], int offset, int len) throws IOException { int firstOffset = offset; do { int bytesRead = in.read(b, offset, len); if (bytesRead <= 0) break; len -= bytesRead; offset += bytesRead; } while (len != 0); return offset - firstOffset; } /** * Skips until EOF, returns number of bytes skipped. * @param is * InputStream to be skipped. * @return * number of bytes skipped in fact. * @throws IOException * if IOException occurs. It doesn't contain EOFException. * @throws NullPointerException * if the param 'is' equals null. */ public static long skipUntilEOF(InputStream is) throws IOException { if(is == null) throw new NullPointerException(); long bytes = 0; while(true){ long r = skipPersistent(is, SKIP_FRAGMENT_SIZE); bytes += r; if(r < SKIP_FRAGMENT_SIZE) return bytes; } } /** * Skips requested number of bytes, * throws EOFException if there is too few bytes in the stream. * @param is InputStream to be skipped. * @param skippedBytes number of bytes to skip. if skippedBytes &gt;= zero, do nothing. * @throws EOFException * if EOF meets before requested number of bytes are skipped. * @throws IOException * if IOException occurs. It doesn't contain EOFException. * @throws NullPointerException * if the param 'is' equals null. */ public static void skipFully(InputStream is, long skippedBytes) throws IOException { if(is == null) throw new NullPointerException(); if(skippedBytes <= 0) return; long bytes = skipPersistent(is, skippedBytes); if(bytes < skippedBytes) throw new EOFException(); } /** * Tries harder to skip the requested number of bytes. * <p> * Note that even if the method fails to skip the requested number of bytes, * it will not throw an exception. If this happens, the caller can be sure * that end-of-stream has been reached. * * @param in byte stream * @param bytesToSkip the number of bytes to skip * @return The number of bytes skipped. * @throws IOException if reading from the stream fails */ public static final long skipPersistent(InputStream in, long bytesToSkip) throws IOException { long skipped = 0; while (skipped < bytesToSkip) { long skippedNow = in.skip(bytesToSkip - skipped); if (skippedNow == 0) { if (in.read() == -1) { // EOF, return what we have and leave it up to caller to // decide what to do about it. break; } else { skippedNow = 1; // Added to count below. } } skipped += skippedNow; } return skipped; } }
{ "content_hash": "d29a2fc035a7d58e752a52b3b9d7fec1", "timestamp": "", "source": "github", "line_count": 173, "max_line_length": 91, "avg_line_length": 30.982658959537574, "alnum_prop": 0.6020522388059701, "repo_name": "apache/derby", "id": "01382af6b48ab6bea11d7706bca057b4974b63b6", "size": "6226", "binary": false, "copies": "2", "ref": "refs/heads/trunk", "path": "java/org.apache.derby.engine/org/apache/derby/iapi/services/io/InputStreamUtil.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "15348" }, { "name": "C++", "bytes": "1814" }, { "name": "CSS", "bytes": "13737" }, { "name": "Gnuplot", "bytes": "3125" }, { "name": "HTML", "bytes": "236284" }, { "name": "Java", "bytes": "43206341" }, { "name": "PLSQL", "bytes": "92914" }, { "name": "PLpgSQL", "bytes": "150136" }, { "name": "Pawn", "bytes": "3220" }, { "name": "SQLPL", "bytes": "45437" }, { "name": "Shell", "bytes": "211693" }, { "name": "TSQL", "bytes": "2366395" }, { "name": "XSLT", "bytes": "15231" }, { "name": "sed", "bytes": "6410" } ], "symlink_target": "" }
module Abstractor class AbstractorRuleType < ActiveRecord::Base include Abstractor::Methods::Models::AbstractorRuleType # @!parse extend Moo::ClassMethods end end
{ "content_hash": "a4c5aed0478ec49606d06cd7a4cb7b9e", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 59, "avg_line_length": 29, "alnum_prop": 0.7758620689655172, "repo_name": "NUBIC/abstractor", "id": "544731f6859636967c5f8fd7482518afa9f77671", "size": "174", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/models/abstractor/abstractor_rule_type.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "8578" }, { "name": "CoffeeScript", "bytes": "5032" }, { "name": "Cucumber", "bytes": "79940" }, { "name": "HTML", "bytes": "20027" }, { "name": "Java", "bytes": "77293" }, { "name": "JavaScript", "bytes": "48992" }, { "name": "Ruby", "bytes": "652893" } ], "symlink_target": "" }
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchlib.aggregation; import com.yahoo.searchlib.expression.ExpressionNode; import com.yahoo.vespa.objects.Deserializer; import com.yahoo.vespa.objects.Identifiable; import com.yahoo.vespa.objects.ObjectVisitor; import com.yahoo.vespa.objects.Serializer; public class GroupingLevel extends Identifiable { // The global class identifier shared with C++. public static final int classId = registerClass(0x4000 + 93, GroupingLevel.class); // The maximum number of groups allowed at this level. private long maxGroups = -1; // The precision used for estimation. This is number of groups returned up when using orderby that need more info to get it correct. private long precision = -1; // The classifier expression; the result of this is the group key. private ExpressionNode classify = null; // The prototype of the groups to create for each class. private Group collect = new Group(); /** Returns the precision (i.e number of groups) returned up from this level. */ public long getPrecision() { return precision; } /** Returns the maximum number of groups allowed at this level. */ public long getMaxGroups() { return maxGroups; } /** Sets the maximum number of groups allowed at this level. */ public GroupingLevel setMaxGroups(long max) { maxGroups = max; if (precision < maxGroups) { precision = maxGroups; } return this; } /** * Sets the precision (i.e number of groups) returned up from this level. * * @param precision the precision to set * @return this, to allow chaining */ public GroupingLevel setPrecision(long precision) { this.precision = precision; return this; } /** Returns the expression used to classify hits into groups. */ public ExpressionNode getExpression() { return classify; } /** Sets the expression used to classify hits into groups. */ public GroupingLevel setExpression(ExpressionNode exp) { classify = exp; return this; } /** * <p>Sets the prototype to use when creating groups at this level.</p> * * @param group The group prototype. * @return This, to allow chaining. */ public GroupingLevel setGroupPrototype(Group group) { this.collect = group; return this; } /** * <p>Returns the prototype to use when creating groups at this level.</p> * * @return The group prototype. */ public Group getGroupPrototype() { return collect; } /** * <p>Tell if ordering will need results collected in children.</p> * * @return If deeper resultcollection is needed. */ public boolean needResultCollection() { return !collect.isRankedByRelevance(); } @Override protected int onGetClassId() { return classId; } @Override protected void onSerialize(Serializer buf) { buf.putLong(null, maxGroups); buf.putLong(null, precision); serializeOptional(buf, classify); collect.serializeWithId(buf); } @Override protected void onDeserialize(Deserializer buf) { maxGroups = buf.getLong(null); precision = buf.getLong(null); classify = (ExpressionNode)deserializeOptional(buf); collect.deserializeWithId(buf); } @Override public int hashCode() { return super.hashCode() + (int)maxGroups + (int)precision + collect.hashCode(); } @Override public boolean equals(Object obj) { if (!super.equals(obj)) { return false; } GroupingLevel rhs = (GroupingLevel)obj; if (maxGroups != rhs.maxGroups) { return false; } if (precision != rhs.precision) { return false; } if (!equals(classify, rhs.classify)) { return false; } if (!collect.equals(rhs.collect)) { return false; } return true; } @Override public GroupingLevel clone() { GroupingLevel obj = (GroupingLevel)super.clone(); if (classify != null) { obj.classify = classify.clone(); } obj.collect = collect.clone(); return obj; } @Override public void visitMembers(ObjectVisitor visitor) { super.visitMembers(visitor); visitor.visit("maxGroups", maxGroups); visitor.visit("precision", precision); visitor.visit("classify", classify); visitor.visit("collect", collect); } }
{ "content_hash": "7236f6333ec0ce01e8b4f93e559a7052", "timestamp": "", "source": "github", "line_count": 162, "max_line_length": 136, "avg_line_length": 29.290123456790123, "alnum_prop": 0.6288724973656481, "repo_name": "vespa-engine/vespa", "id": "0db933966a8fbb805513508bcaefa0c0c8a750db", "size": "4745", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "searchlib/src/main/java/com/yahoo/searchlib/aggregation/GroupingLevel.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "8130" }, { "name": "C", "bytes": "60315" }, { "name": "C++", "bytes": "29580035" }, { "name": "CMake", "bytes": "593981" }, { "name": "Emacs Lisp", "bytes": "91" }, { "name": "GAP", "bytes": "3312" }, { "name": "Go", "bytes": "560664" }, { "name": "HTML", "bytes": "54520" }, { "name": "Java", "bytes": "40814190" }, { "name": "JavaScript", "bytes": "73436" }, { "name": "LLVM", "bytes": "6152" }, { "name": "Lex", "bytes": "11499" }, { "name": "Makefile", "bytes": "5553" }, { "name": "Objective-C", "bytes": "12369" }, { "name": "Perl", "bytes": "23134" }, { "name": "Python", "bytes": "52392" }, { "name": "Roff", "bytes": "17506" }, { "name": "Ruby", "bytes": "10690" }, { "name": "Shell", "bytes": "268737" }, { "name": "Yacc", "bytes": "14735" } ], "symlink_target": "" }
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner read = new Scanner(System.in); int n = read.nextInt(); int mishkaWinCount = 0; int chrisWinCount = 0; for (int i = 0; i < n; ++i) { int m = read.nextInt(); int c = read.nextInt(); if (m > c) { mishkaWinCount++; } else if (c > m) { chrisWinCount++; } } if (mishkaWinCount > chrisWinCount) { System.out.println("Mishka"); } else if (chrisWinCount > mishkaWinCount) { System.out.println("Chris"); } else { System.out.println("Friendship is magic!^^"); } // Close scanner read.close(); } }
{ "content_hash": "3a264c273d4d20cd7793c85686751c67", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 48, "avg_line_length": 18, "alnum_prop": 0.5885885885885885, "repo_name": "dvt32/cpp-journey", "id": "4a2943117e050e6fee3f7da4fc713109bca3148d", "size": "717", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Java/CodeForces/Mishka and Game.java", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "785" }, { "name": "C", "bytes": "920" }, { "name": "C#", "bytes": "100455" }, { "name": "C++", "bytes": "589720" }, { "name": "CSS", "bytes": "3829" }, { "name": "Common Lisp", "bytes": "20887" }, { "name": "HTML", "bytes": "130173" }, { "name": "Java", "bytes": "1929687" }, { "name": "JavaScript", "bytes": "2537015" }, { "name": "PHP", "bytes": "2968" }, { "name": "PLSQL", "bytes": "6470" }, { "name": "Pascal", "bytes": "1084" }, { "name": "PowerShell", "bytes": "178622" }, { "name": "Prolog", "bytes": "27435" }, { "name": "Python", "bytes": "16747" }, { "name": "Ruby", "bytes": "7135" }, { "name": "Shell", "bytes": "1331" }, { "name": "TSQL", "bytes": "672" }, { "name": "TypeScript", "bytes": "155525" }, { "name": "VBA", "bytes": "30605" } ], "symlink_target": "" }
const CVector GRAVITY_ORI(0, 1, 0); const CVector GRAVITY_ZERO(0, 0, 0); const double GRAVITY = 9.81; class CDynamics{ private: public: CLink link[DOF]; double kinetic; double potential; double energy; public: CVector inverseDynamics(CVector qdot, CVector qddot, CVector gravity = GRAVITY * GRAVITY_ORI); //forward dynamics¿¡¼­ È£Ãâ CVector forwardDynamics(CVector q, CVector qdot, CVector input_torque ); CVector getFrictionForce(CVector qdot, CVector torque); double SGN(double x); CMatrix getRotorInertiaMatrix(void); }; #endif
{ "content_hash": "943ea3314e670b4868dc46c14ffa53af", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 123, "avg_line_length": 22.04, "alnum_prop": 0.7459165154264973, "repo_name": "tapomayukh/projects_in_c_cpp", "id": "d8569a0acd22bd87a19b742906bcc89c188b6b2e", "size": "675", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sandbox_tapo/rgcp(tapo)/win32/RKH/dynamics.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "6216170" }, { "name": "C++", "bytes": "9040376" }, { "name": "Objective-C", "bytes": "43965" }, { "name": "Python", "bytes": "1880" }, { "name": "Visual Basic", "bytes": "109480" } ], "symlink_target": "" }
package org.apache.karaf.features.internal.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import org.apache.karaf.features.BundleInfo; /** * * Deployable element to install. * * * <p>Java class for bundle complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="bundle"> * &lt;simpleContent> * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>anyURI"> * &lt;attribute name="start-level" type="{http://www.w3.org/2001/XMLSchema}int" /> * &lt;attribute name="start" type="{http://www.w3.org/2001/XMLSchema}boolean" /> * &lt;attribute name="dependency" type="{http://www.w3.org/2001/XMLSchema}boolean" /> * &lt;/extension> * &lt;/simpleContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "bundle", propOrder = { "value" }) public class Bundle implements BundleInfo { @XmlValue @XmlSchemaType(name = "anyURI") protected String value; @XmlAttribute(name = "start-level") protected int startLevel; @XmlAttribute protected boolean start = true; @XmlAttribute protected boolean dependency; public Bundle() { } public Bundle(String value) { this.value = value; } /** * Gets the value of the value property. * * @return * possible object is * {@link String } * */ public String getLocation() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link String } * */ public void setLocation(String value) { this.value = value; } /** * Gets the value of the startLevel property. * * @return * possible object is * {@link Integer } * */ public int getStartLevel() { return startLevel; } /** * Sets the value of the startLevel property. * * @param value * allowed object is * {@link Integer } * */ public void setStartLevel(Integer value) { this.startLevel = value; } /** * Gets the value of the start property. * * @return * possible object is * {@link Boolean } * */ public boolean isStart() { return start; } /** * Sets the value of the start property. * * @param value * allowed object is * {@link Boolean } * */ public void setStart(Boolean value) { this.start = value; } /** * Gets the value of the dependency property. * * @return * possible object is * {@link Boolean } * */ public boolean isDependency() { return dependency; } /** * Sets the value of the dependency property. * * @param value * allowed object is * {@link Boolean } * */ public void setDependency(Boolean value) { this.dependency = value; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Bundle bundle = (Bundle) o; if (dependency != bundle.dependency) return false; if (start != bundle.start) return false; if (startLevel != bundle.startLevel) return false; if (value != null ? !value.equals(bundle.value) : bundle.value != null) return false; return true; } @Override public int hashCode() { int result = value != null ? value.hashCode() : 0; result = 31 * result + startLevel; result = 31 * result + (start ? 1 : 0); result = 31 * result + (dependency ? 1 : 0); return result; } }
{ "content_hash": "a8e33cc2d3a3d8fdb2e2fd2a81119161", "timestamp": "", "source": "github", "line_count": 181, "max_line_length": 95, "avg_line_length": 23.18232044198895, "alnum_prop": 0.5662535748331744, "repo_name": "tonit/karafonexam2", "id": "320d7666ecb49e04139c9d200301fa0870bf5a53", "size": "5002", "binary": false, "copies": "1", "ref": "refs/heads/trunk", "path": "features/core/src/main/java/org/apache/karaf/features/internal/model/Bundle.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "2105667" }, { "name": "JavaScript", "bytes": "23153" }, { "name": "Shell", "bytes": "1155" }, { "name": "Visual Basic", "bytes": "4147" } ], "symlink_target": "" }
package com.mytest.activity; import android.os.Bundle; import android.text.TextUtils; import android.widget.EditText; import com.mytest.R; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by Jason on 2016/11/24. */ public class RegisterActivity extends BaseActivity { @Bind(R.id.register_pager_input_account_ed) EditText newAccountEd; @Bind(R.id.register_pager_input_password_ed) EditText firstPasswordEd; @Bind(R.id.register_pager_input_password_again_ed) EditText surePasswordEd; private String userEmail; private String userPassword; private String userPasswordAgain; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.user_register_new_account_activity); ButterKnife.bind(this); } @OnClick(R.id.create_new_account_bt) public void createAccount(){ userEmail = newAccountEd.getText().toString(); userPassword = firstPasswordEd.getText().toString(); userPasswordAgain = surePasswordEd.getText().toString(); if(TextUtils.isEmpty(userEmail)){ } } @OnClick(R.id.have_account_to_login) public void openLoginPager(){ startActivity(LoginActivity.class); } public void showSnackbar(String messsage){ } }
{ "content_hash": "d795e949af2c90e544ce550e2108a225", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 68, "avg_line_length": 25.666666666666668, "alnum_prop": 0.7092352092352092, "repo_name": "jasondp/MyTest", "id": "6cbaba36874fe3a6294a1214cc844f97c29b7b1f", "size": "1386", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "MyTest/app/src/main/java/com/mytest/activity/RegisterActivity.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "39100" } ], "symlink_target": "" }
package com.ge.predix.integration.test; import static com.ge.predix.integration.test.SubjectResourceFixture.BOB_V1; import static com.ge.predix.integration.test.SubjectResourceFixture.JLO_V1; import static com.ge.predix.integration.test.SubjectResourceFixture.JOE_V1; import static com.ge.predix.integration.test.SubjectResourceFixture.MARISSA_V1; import static com.ge.predix.integration.test.SubjectResourceFixture.PETE_V1; import static com.ge.predix.integration.test.SubjectResourceFixture.SANRAMON; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.security.auth.Subject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.oauth2.client.OAuth2RestTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; import org.springframework.util.MultiValueMap; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.HttpServerErrorException; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.ge.predix.acs.model.Attribute; import com.ge.predix.acs.rest.BaseResource; import com.ge.predix.acs.rest.BaseSubject; import com.ge.predix.test.TestConfig; import com.ge.predix.test.utils.ACSITSetUpFactory; import com.ge.predix.test.utils.ACSTestUtil; import com.ge.predix.test.utils.PolicyHelper; import com.ge.predix.test.utils.PrivilegeHelper; import com.ge.predix.test.utils.ZoneFactory; @ContextConfiguration("classpath:integration-test-spring-context.xml") // @Test(dependsOnGroups = { "acsHealthCheck.*" }) @Test public class PrivilegeManagementAccessControlServiceIT extends AbstractTestNGSpringContextTests { private String acsZone1Name; @Value("${zone1UaaUrl}/oauth/token") private String primaryZoneIssuerId; private String acsZone3Name; @Autowired private ZoneFactory zoneFactory; @Autowired private PrivilegeHelper privilegeHelper; @Autowired private ACSITSetUpFactory acsitSetUpFactory; @Value("${ACS_UAA_URL}") private String uaaUrl; private String acsUrl; private HttpHeaders zone1Headers; private HttpHeaders zone3Headers; private OAuth2RestTemplate acsAdminRestTemplate; @BeforeClass public void setup() throws JsonParseException, JsonMappingException, IOException { TestConfig.setupForEclipse(); // Starts ACS when running the test in eclipse. this.acsitSetUpFactory.setUp(); this.acsUrl = this.acsitSetUpFactory.getAcsUrl(); this.zone1Headers = this.acsitSetUpFactory.getZone1Headers(); this.zone3Headers = this.acsitSetUpFactory.getZone3Headers(); this.acsAdminRestTemplate = this.acsitSetUpFactory.getAcsZonesAdminRestTemplate(); this.acsZone1Name = this.acsitSetUpFactory.getZone1().getSubdomain(); this.acsZone3Name = this.acsitSetUpFactory.getAcsZone3Name(); } public void testBatchCreateSubjectsEmptyList() { List<BaseSubject> subjects = new ArrayList<BaseSubject>(); try { this.acsAdminRestTemplate.postForEntity(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH, new HttpEntity<>(subjects, this.zone1Headers), BaseSubject[].class); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.UNPROCESSABLE_ENTITY); return; } Assert.fail("Expected unprocessable entity http client error."); } @Test public void testBatchSubjectsDataConstraintViolationSubjectIdentifier() { List<BaseSubject> subjects = new ArrayList<BaseSubject>(); subjects.add(this.privilegeHelper.createSubject("marissa")); subjects.add(this.privilegeHelper.createSubject("marissa")); try { this.acsAdminRestTemplate.postForEntity(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH, new HttpEntity<>(subjects, this.zone1Headers), ResponseEntity.class); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.UNPROCESSABLE_ENTITY); return; } this.acsAdminRestTemplate .exchange(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + "/marissa", HttpMethod.DELETE, new HttpEntity<>(this.zone1Headers), ResponseEntity.class); Assert.fail("Expected unprocessable entity http client error."); } public void testCreateSubjectWithMalformedJSON() { try { String badSubject = "{\"subject\": bad-subject-form\"}"; MultiValueMap<String, String> headers = ACSTestUtil.httpHeaders(); headers.add("Content-type", "application/json"); headers.add(PolicyHelper.PREDIX_ZONE_ID, this.acsZone1Name); HttpEntity<String> httpEntity = new HttpEntity<String>(badSubject, headers); this.acsAdminRestTemplate .put(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + "/bad-subject-form", httpEntity); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.BAD_REQUEST); return; } this.acsAdminRestTemplate .exchange(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + "/bad-subject-form", HttpMethod.DELETE, new HttpEntity<>(this.zone1Headers), ResponseEntity.class); Assert.fail("testCreateSubjectWithMalformedJSON should have failed!"); } public void testCreateBatchSubjectsWithMalformedJSON() { try { String badSubject = "{\"subject\":{\"name\" : \"good-subject-brittany\"}," + "{\"subject\": bad-subject-sarah\"}"; MultiValueMap<String, String> headers = ACSTestUtil.httpHeaders(); headers.add("Content-type", "application/json"); headers.add(PolicyHelper.PREDIX_ZONE_ID, this.acsZone1Name); HttpEntity<String> httpEntity = new HttpEntity<String>(badSubject, headers); this.acsAdminRestTemplate .postForEntity(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH, httpEntity, Subject[].class); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.BAD_REQUEST); return; } this.acsAdminRestTemplate .exchange(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + "/bad-subject-sarah", HttpMethod.DELETE, new HttpEntity<>(this.zone1Headers), ResponseEntity.class); this.acsAdminRestTemplate .exchange(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + "/good-subject-brittany", HttpMethod.DELETE, new HttpEntity<>(this.zone1Headers), ResponseEntity.class); Assert.fail("testCreateBatchSubjectsWithMalformedJSON should have failed!"); } public void testCreateResourceWithMalformedJSON() { try { String badResource = "{\"resource\": bad-resource-form\"}"; MultiValueMap<String, String> headers = ACSTestUtil.httpHeaders(); headers.add("Content-type", "application/json"); headers.add(PolicyHelper.PREDIX_ZONE_ID, this.acsZone1Name); HttpEntity<String> httpEntity = new HttpEntity<String>(badResource, headers); this.acsAdminRestTemplate .put(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH + "/bad-resource-form", httpEntity); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.BAD_REQUEST); return; } this.acsAdminRestTemplate .exchange(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH + "/bad-resource-form", HttpMethod.DELETE, new HttpEntity<>(this.zone1Headers), ResponseEntity.class); Assert.fail("testCreateResourceWithMalformedJSON should have failed!"); } public void testCreateBatchResourcesWithMalformedJSON() { try { String badResource = "{\"resource\":{\"name\" : \"Site\", \"uriTemplate\" : " + "\"/secured-by-value/sites/{site_id}\"},{\"resource\": bad-resource-form\"}"; MultiValueMap<String, String> headers = ACSTestUtil.httpHeaders(); headers.add("Content-type", "application/json"); headers.add(PolicyHelper.PREDIX_ZONE_ID, this.acsZone1Name); HttpEntity<String> httpEntity = new HttpEntity<String>(badResource, headers); this.acsAdminRestTemplate.postForEntity(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH, httpEntity, BaseResource[].class); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.BAD_REQUEST); return; } this.acsAdminRestTemplate .exchange(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH + "/bad-resource-form", HttpMethod.DELETE, new HttpEntity<>(this.zone1Headers), ResponseEntity.class); this.acsAdminRestTemplate .exchange(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH + "/Site", HttpMethod.DELETE, new HttpEntity<>(this.zone1Headers), ResponseEntity.class); Assert.fail("testCreateBatchResourcesWithMalformedJSON should have failed!"); } public void testBatchCreateResourcesEmptyList() { List<BaseResource> resources = new ArrayList<BaseResource>(); try { this.acsAdminRestTemplate.postForEntity(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH, new HttpEntity<>(resources, this.zone1Headers), BaseResource[].class); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.UNPROCESSABLE_ENTITY); return; } Assert.fail("Expected unprocessable entity http client error."); } public void testResourceUpdateAttributes() { BaseResource resource1 = this.privilegeHelper.createResource("marissa"); BaseResource resource2 = this.privilegeHelper.createResource("marissa"); Set<Attribute> attributes = new HashSet<Attribute>(); Attribute attribute = new Attribute(); attribute.setName("site"); attribute.setIssuer("http://attributes.net"); attribute.setValue("sanfrancisco"); attributes.add(attribute); resource2.setAttributes(attributes); this.acsAdminRestTemplate.put(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH + "/marissa", new HttpEntity<>(resource1, this.zone1Headers)); this.acsAdminRestTemplate.put(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH + "/marissa", new HttpEntity<>(resource2, this.zone1Headers)); ResponseEntity<BaseResource> response = acsAdminRestTemplate .exchange(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH + "/marissa", HttpMethod.GET, new HttpEntity<>(this.zone1Headers), BaseResource.class); Assert.assertEquals(response.getBody(), resource2); this.acsAdminRestTemplate .exchange(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH + "/marissa", HttpMethod.DELETE, new HttpEntity<>(this.zone1Headers), ResponseEntity.class); } @Test public void testBatchResourcesDataConstraintViolationResourceIdentifier() { List<BaseResource> resources = new ArrayList<BaseResource>(); resources.add(this.privilegeHelper.createResource("dupResourceIdentifier")); resources.add(this.privilegeHelper.createResource("dupResourceIdentifier")); try { // This POST causes a data constraint violation on the service bcos // of duplicate // resource_identifiers which returns a HTTP 422 error. this.acsAdminRestTemplate.postForEntity(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH, new HttpEntity<>(resources, this.zone1Headers), ResponseEntity.class); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.UNPROCESSABLE_ENTITY); return; } this.acsAdminRestTemplate .exchange(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH + "/marissa", HttpMethod.DELETE, new HttpEntity<>(this.zone1Headers), ResponseEntity.class); Assert.fail("Expected unprocessable entity http client error on post for 2 resources with duplicate resource" + "identifiers."); } @Test(dataProvider = "subjectProvider") public void testPutGetDeleteSubject(final BaseSubject subject) throws UnsupportedEncodingException { ResponseEntity<BaseSubject> responseEntity = null; try { this.privilegeHelper.putSubject(this.acsAdminRestTemplate, subject, this.acsUrl, this.zone1Headers, this.privilegeHelper.getDefaultAttribute()); } catch (HttpClientErrorException e) { Assert.fail("Unable to create subject."); } String encodedSubjectIdentifier = URLEncoder.encode(subject.getSubjectIdentifier(), "UTF-8"); URI uri = URI.create(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + encodedSubjectIdentifier); try { responseEntity = this.acsAdminRestTemplate .exchange(uri, HttpMethod.GET, new HttpEntity<>(this.zone1Headers), BaseSubject.class); Assert.assertEquals(responseEntity.getStatusCode(), HttpStatus.OK); } catch (HttpClientErrorException e) { Assert.fail("Unable to get subject."); } try { this.acsAdminRestTemplate .exchange(uri, HttpMethod.DELETE, new HttpEntity<>(this.zone1Headers), ResponseEntity.class); responseEntity = this.acsAdminRestTemplate .exchange(uri, HttpMethod.GET, new HttpEntity<>(this.zone1Headers), BaseSubject.class); Assert.fail("Subject " + subject.getSubjectIdentifier() + " was not properly deleted"); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.NOT_FOUND, "Subject was not deleted."); } } // To test cascade delete for postgres, comment out delete-db-service and delete executions. Run integration with // -PCloud. Bind db to pgPhpAdmin and browse the db to ensure all entries with zone 'test-zone-dev3' as a foreign // key are deleted respectively. public void testPutSubjectDeleteZone() throws JsonParseException, JsonMappingException, IOException { this.zoneFactory.createTestZone(this.acsAdminRestTemplate, this.acsZone3Name, Collections.singletonList(this.primaryZoneIssuerId)); ResponseEntity<BaseSubject> responseEntity = null; try { this.privilegeHelper.putSubject(this.acsAdminRestTemplate, MARISSA_V1, this.acsUrl, this.zone3Headers, this.privilegeHelper.getDefaultAttribute()); } catch (HttpClientErrorException e) { Assert.fail("Unable to create subject.", e); } try { responseEntity = this.acsAdminRestTemplate .exchange(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + MARISSA_V1.getSubjectIdentifier(), HttpMethod.GET, new HttpEntity<>(this.zone3Headers), BaseSubject.class); Assert.assertEquals(responseEntity.getStatusCode(), HttpStatus.OK); } catch (HttpClientErrorException e) { Assert.fail("Unable to get subject.", e); } try { this.zoneFactory.deleteZone(this.acsAdminRestTemplate, this.acsZone3Name); this.acsAdminRestTemplate .exchange(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + MARISSA_V1.getSubjectIdentifier(), HttpMethod.GET, new HttpEntity<>(this.zone3Headers), BaseSubject.class); Assert.fail("Zone '" + this.acsZone3Name + "' was not properly deleted."); } catch (HttpServerErrorException e) { // This following lines to be uncommented once TokenService returns the right exception instead of a // 500 - Defect url https://rally1.rallydev.com/#/30377833713d/detail/defect/42793900179 // catch (OAuth2Exception e) { // Assert.assertTrue(e.getSummary().contains(HttpStatus.FORBIDDEN.toString()), // "Zone deletion did not produce the expected HTTP status code. Failed with: " + e); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.BAD_REQUEST); } catch (Exception e) { Assert.fail("Failed with unexpected exception.", e); } } public void testPutSubjectMismatchURI() { try { String subjectIdentifier = "marcia"; URI subjectUri = URI.create(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + URLEncoder .encode(subjectIdentifier, "UTF-8")); this.acsAdminRestTemplate.put(subjectUri, new HttpEntity<>(BOB_V1, this.zone1Headers)); Assert.fail("Subject " + subjectIdentifier + " was not supposed to be created"); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.UNPROCESSABLE_ENTITY); return; } catch (Exception e) { Assert.fail("Unable to create subject."); } Assert.fail("Expected Unprocessible Entity status code in testPutSubjectMismatchURIV1"); } @Test(dataProvider = "invalidSubjectPostProvider") public void testPostSubjectNegativeCases(final BaseSubject subject, final String endpoint) { try { this.privilegeHelper.postMultipleSubjects(this.acsAdminRestTemplate, endpoint, this.zone1Headers, subject); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.UNPROCESSABLE_ENTITY); return; } catch (Exception e) { Assert.fail("Unable to create subject."); } Assert.fail("Expected Unprocessible Entity status code in testPostSubjectNegativeCases"); } @Test(dataProvider = "subjectPostProvider") public void testPostSubjectPostiveCases(final BaseSubject subject, final String endpoint) { try { ResponseEntity<Object> responseEntity = this.privilegeHelper .postMultipleSubjects(this.acsAdminRestTemplate, endpoint, this.zone1Headers, subject); Assert.assertEquals(responseEntity.getStatusCode(), HttpStatus.NO_CONTENT); } catch (Exception e) { Assert.fail("Unable to create subject."); } } @Test(dataProvider = "subjectPostProvider") public void testPostSubjectsUpdateAttributes(final BaseSubject subject, final String endpoint) { // This test was added to test that the graph repo behaves transactionally. try { BaseSubject subject2 = new BaseSubject(BOB_V1.getSubjectIdentifier()); subject2.setAttributes(new HashSet<Attribute>( Arrays.asList(new Attribute[] { this.privilegeHelper.getDefaultAttribute() }))); subject.setAttributes(new HashSet<Attribute>( Arrays.asList(new Attribute[] { this.privilegeHelper.getDefaultAttribute() }))); ResponseEntity<Object> responseEntity = this.privilegeHelper .postSubjects(this.acsAdminRestTemplate, endpoint, this.zone1Headers, subject, subject2); Assert.assertEquals(responseEntity.getStatusCode(), HttpStatus.NO_CONTENT); subject2.setAttributes(new HashSet<Attribute>( Arrays.asList(new Attribute[] { this.privilegeHelper.getAlternateAttribute() }))); subject.setAttributes(new HashSet<Attribute>( Arrays.asList(new Attribute[] { this.privilegeHelper.getAlternateAttribute() }))); this.privilegeHelper .postSubjects(this.acsAdminRestTemplate, endpoint, this.zone1Headers, subject, subject2); String encodedSubjectIdentifier = URLEncoder.encode(subject.getSubjectIdentifier(), "UTF-8"); URI uri = URI.create(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + encodedSubjectIdentifier); ResponseEntity<BaseSubject> forEntity = this.acsAdminRestTemplate .exchange(uri, HttpMethod.GET, new HttpEntity<>(this.zone1Headers), BaseSubject.class); Assert.assertTrue( forEntity.getBody().getAttributes().contains(this.privilegeHelper.getAlternateAttribute())); encodedSubjectIdentifier = URLEncoder.encode(subject2.getSubjectIdentifier(), "UTF-8"); uri = URI.create(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + encodedSubjectIdentifier); forEntity = this.acsAdminRestTemplate .exchange(uri, HttpMethod.GET, new HttpEntity<>(this.zone1Headers), BaseSubject.class); Assert.assertTrue( forEntity.getBody().getAttributes().contains(this.privilegeHelper.getAlternateAttribute())); encodedSubjectIdentifier = URLEncoder.encode(subject.getSubjectIdentifier(), "UTF-8"); uri = URI.create(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + encodedSubjectIdentifier); forEntity = this.acsAdminRestTemplate .exchange(uri, HttpMethod.GET, new HttpEntity<>(this.zone1Headers), BaseSubject.class); Assert.assertTrue( forEntity.getBody().getAttributes().contains(this.privilegeHelper.getAlternateAttribute())); encodedSubjectIdentifier = URLEncoder.encode(subject2.getSubjectIdentifier(), "UTF-8"); uri = URI.create(this.acsUrl + PrivilegeHelper.ACS_SUBJECT_API_PATH + encodedSubjectIdentifier); forEntity = this.acsAdminRestTemplate .exchange(uri, HttpMethod.GET, new HttpEntity<>(this.zone1Headers), BaseSubject.class); Assert.assertTrue( forEntity.getBody().getAttributes().contains(this.privilegeHelper.getAlternateAttribute())); } catch (Exception e) { Assert.fail("Unable to create subject."); } } @Test(dataProvider = "resourcePostProvider") public void testPostResourcePostiveCases(final BaseResource resource, final String endpoint) { try { ResponseEntity<Object> responseEntity = this.privilegeHelper .postResources(this.acsAdminRestTemplate, endpoint, this.zone1Headers, resource); Assert.assertEquals(responseEntity.getStatusCode(), HttpStatus.NO_CONTENT); } catch (Exception e) { Assert.fail("Unable to create resource."); } } @Test(dataProvider = "invalidResourcePostProvider") public void testPostResourceNegativeCases(final BaseResource resource, final String endpoint) { try { this.privilegeHelper.postResources(this.acsAdminRestTemplate, endpoint, this.zone1Headers, resource); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.UNPROCESSABLE_ENTITY); return; } catch (Exception e) { Assert.fail("Unable to create resource."); } Assert.fail("Expected UnprocessibleEntity status code in testPostResourceNegativeCases"); } public void testPutGetDeleteResource() throws Exception { try { this.privilegeHelper.putResource(this.acsAdminRestTemplate, SANRAMON, this.acsUrl, this.zone1Headers, this.privilegeHelper.getDefaultAttribute()); } catch (Exception e) { Assert.fail("Unable to create resource. " + e.getMessage()); } URI resourceUri = URI.create(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH + URLEncoder .encode(SANRAMON.getResourceIdentifier(), "UTF-8")); try { this.acsAdminRestTemplate .exchange(resourceUri, HttpMethod.GET, new HttpEntity<>(this.zone1Headers), BaseResource.class); } catch (HttpClientErrorException e) { Assert.fail("Unable to get resource."); } try { this.acsAdminRestTemplate.exchange(resourceUri, HttpMethod.DELETE, new HttpEntity<>(this.zone1Headers), ResponseEntity.class); } catch (HttpClientErrorException e) { Assert.fail("Unable to delete resource."); } // properly delete try { this.acsAdminRestTemplate.exchange(resourceUri, HttpMethod.DELETE, new HttpEntity<>(this.zone1Headers), ResponseEntity.class); this.acsAdminRestTemplate .exchange(resourceUri, HttpMethod.GET, new HttpEntity<>(this.zone1Headers), BaseResource.class); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.NOT_FOUND); } } public void testUpdateResourceURIMismatch() throws Exception { try { this.privilegeHelper.putResource(this.acsAdminRestTemplate, SANRAMON, this.acsUrl, this.zone1Headers, this.privilegeHelper.getDefaultAttribute()); URI resourceUri = URI.create(this.acsUrl + PrivilegeHelper.ACS_RESOURCE_API_PATH + URLEncoder .encode("/different/resource", "UTF-8")); this.acsAdminRestTemplate.put(resourceUri, new HttpEntity<>(SANRAMON, this.zone1Headers)); } catch (HttpClientErrorException e) { Assert.assertEquals(e.getStatusCode(), HttpStatus.UNPROCESSABLE_ENTITY); return; } Assert.fail("Expected Unprocessible Entity status code in testUpdateResourceURIMismatchV1"); } @DataProvider(name = "subjectProvider") public Object[][] getSubjectProvider() { Object[][] data = new Object[][] { { MARISSA_V1 }, { JOE_V1 }, { PETE_V1 }, { JLO_V1 }, { BOB_V1 } }; return data; } @DataProvider(name = "invalidSubjectPostProvider") public Object[][] getInvalidSubjectsPost() { Object[][] data = new Object[][] { // empty subjectIdentifier { new BaseSubject(null), this.acsUrl } }; return data; } @DataProvider(name = "resourcePostProvider") public Object[][] getResourcesPost() { Object[][] data = new Object[][] { // non empty resourceIdentifier { new BaseResource("/sites/sanramon"), this.acsUrl }, }; return data; } @DataProvider(name = "invalidResourcePostProvider") public Object[][] getInvalidResourcesPost() { Object[][] data = new Object[][] { // empty resourceIdentifier { new BaseResource(null), this.acsUrl }, }; return data; } @DataProvider(name = "subjectPostProvider") public Object[][] getSubjectsPost() { Object[][] data = new Object[][] { // non empty subjectIdentifier { MARISSA_V1, this.acsUrl } }; return data; } @DataProvider(name = "endpointProvider") public Object[][] getAcsEndpoint() { Object[][] data = new Object[][] { { this.acsUrl } }; return data; } @AfterMethod public void cleanup() throws Exception { this.privilegeHelper.deleteResources(this.acsAdminRestTemplate, this.acsUrl, this.zone1Headers); this.privilegeHelper.deleteSubjects(this.acsAdminRestTemplate, this.acsUrl, this.zone1Headers); } @AfterClass public void destroy() { this.acsitSetUpFactory.destroy(); } }
{ "content_hash": "461c1402ed5c9d5c1651c3619b8569f3", "timestamp": "", "source": "github", "line_count": 559, "max_line_length": 120, "avg_line_length": 51.49552772808587, "alnum_prop": 0.671194330577364, "repo_name": "predix/acs", "id": "045906fefc595d1c6ace1f279c56f82ec6793df7", "size": "29591", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "acs-integration-tests/src/test/java/com/ge/predix/integration/test/PrivilegeManagementAccessControlServiceIT.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Gherkin", "bytes": "8014" }, { "name": "Groovy", "bytes": "4593" }, { "name": "Java", "bytes": "1536944" }, { "name": "Shell", "bytes": "52236" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Text; using BonnToCode.Logging.Framework.Internal; namespace BonnToCode.Logging.Framework { public static class LogManager { private static IList<ILog> log = new List<ILog>(); private static IList<IAppender> appender = new List<IAppender>(); public static ILog GetLogger(Type context) { Log res = new Log(context); foreach (IAppender app in appender) { res.AddAppender(app); } log.Add(res); return res; } public static void AddAppender(IAppender initAppender) { appender.Add(initAppender); foreach (ILog aLog in log) { ((Log)aLog).AddAppender(initAppender); } } } }
{ "content_hash": "dcf8c35ef3eeb8c9bf2928b4b20fb700", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 73, "avg_line_length": 24.571428571428573, "alnum_prop": 0.5616279069767441, "repo_name": "ThomasMentzel/SlideShareCode", "id": "e1c65e1b2b6511d79131c88bb316cb85f6b8013c", "size": "860", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "BonnToCode.Logging.Demo.10MinFramework/BonnToCode.Logging.Framework/LogManager.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "81015" } ], "symlink_target": "" }
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET. // Licensed under the Apache License, Version 2.0. using ImageMagick; using Xunit; namespace Magick.NET.Tests { public partial class MagickImageTests { public class TheFlipMethod { [Fact] public void ShouldFlipTheImageVertically() { using (var images = new MagickImageCollection()) { images.Add(new MagickImage(MagickColors.DodgerBlue, 10, 10)); images.Add(new MagickImage(MagickColors.Firebrick, 10, 10)); using (var image = images.AppendVertically()) { ColorAssert.Equal(MagickColors.DodgerBlue, image, 5, 0); ColorAssert.Equal(MagickColors.Firebrick, image, 5, 10); image.Flip(); ColorAssert.Equal(MagickColors.Firebrick, image, 5, 0); ColorAssert.Equal(MagickColors.DodgerBlue, image, 5, 10); } } } } } }
{ "content_hash": "b826021a7ee85be73efb437b5abc1c97", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 81, "avg_line_length": 32.371428571428574, "alnum_prop": 0.526919682259488, "repo_name": "dlemstra/Magick.NET", "id": "5c62c081cdb326bcfd2885e081fbdc5d0ae63ee0", "size": "1135", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "tests/Magick.NET.Tests/MagickImageTests/TheFlipMethod.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "10855" }, { "name": "C#", "bytes": "5673596" }, { "name": "Dockerfile", "bytes": "1665" }, { "name": "PowerShell", "bytes": "25178" }, { "name": "Shell", "bytes": "3538" } ], "symlink_target": "" }
package com.amazonaws.services.machinelearning.model; import javax.annotation.Generated; /** * <p> * A second request to use or change an object was not allowed. This can result from retrying a request using a * parameter that was not present in the original request. * </p> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class IdempotentParameterMismatchException extends com.amazonaws.services.machinelearning.model.AmazonMachineLearningException { private static final long serialVersionUID = 1L; private Integer code; /** * Constructs a new IdempotentParameterMismatchException with the specified error message. * * @param message * Describes the error encountered. */ public IdempotentParameterMismatchException(String message) { super(message); } /** * @param code */ @com.fasterxml.jackson.annotation.JsonProperty("code") public void setCode(Integer code) { this.code = code; } /** * @return */ @com.fasterxml.jackson.annotation.JsonProperty("code") public Integer getCode() { return this.code; } /** * @param code * @return Returns a reference to this object so that method calls can be chained together. */ public IdempotentParameterMismatchException withCode(Integer code) { setCode(code); return this; } }
{ "content_hash": "73bc2a01087875153c577acf7a65dbfa", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 135, "avg_line_length": 25.428571428571427, "alnum_prop": 0.6776685393258427, "repo_name": "jentfoo/aws-sdk-java", "id": "7372f03c35c6fadd74d529fef48f6808f7102a21", "size": "2004", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "aws-java-sdk-machinelearning/src/main/java/com/amazonaws/services/machinelearning/model/IdempotentParameterMismatchException.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "270" }, { "name": "FreeMarker", "bytes": "173637" }, { "name": "Gherkin", "bytes": "25063" }, { "name": "Java", "bytes": "356214839" }, { "name": "Scilab", "bytes": "3924" }, { "name": "Shell", "bytes": "295" } ], "symlink_target": "" }
module Mittsu class Material # TODO: init_shader for these material-types # MeshDepthMaterial => :depth, # TODO... # MeshNormalMaterial => :normal, # TODO... # LineDashedMaterial => :dashed, # TODO... # PointCloudMaterial => :particle_basic # TODO... attr_accessor :shadow_pass attr_reader :shader, :uniforms_list def init(lights, fog, object, renderer) @renderer = renderer add_event_listener(:dispose, @renderer.method(:on_material_dispose)) init_shader self.program = find_or_create_program(lights, fog, object) count_supported_morph_attributes(program.attributes) @uniforms_list = get_uniforms_list end def set(renderer) @renderer = renderer if transparent @renderer.state.set_blending(blending, blend_equation, blend_src, blend_dst, blend_equation_alpha, blend_src_alpha, blend_dst_alpha) else @renderer.state.set_blending(NoBlending) end @renderer.state.set_depth_test(depth_test) @renderer.state.set_depth_write(depth_write) @renderer.state.set_color_write(color_write) @renderer.state.set_polygon_offset(polygon_offset, polygon_offset_factor, polygon_offset_units) end def needs_face_normals? shading == FlatShading end def clear_custom_attributes attributes.each do |attribute| attribute.needs_update = false end end def custom_attributes_dirty? attributes.each do |attribute| return true if attribute.needs_update end false end def refresh_uniforms(_) # NOOP end def needs_camera_position_uniform? env_map end def needs_view_matrix_uniform? skinning end def needs_lights? lights end protected def init_shader @shader = { uniforms: uniforms, vertex_shader: vertex_shader, fragment_shader: fragment_shader } end def shader_id nil end private def allocate_lights(lights) lights.reject { |light| light.only_shadow || !light.visible }.each_with_object({ directional: 0, point: 0, spot: 0, hemi: 0, other: 0 }) { |light, counts| counts[light.to_sym] += 1 } end def allocate_shadows(lights) max_shadows = 0 lights.each do |light| next unless light.cast_shadow max_shadows += 1 if light.is_a?(SpotLight) max_shadows += 1 if light.is_a?(DirectionalLight) && !light.shadow_cascade end max_shadows end def allocate_bones(object = nil) if @renderer.supports_bone_textures? && object && object.skeleton && object.skeleton.use_vertex_texture return 1024 end # default for when object is not specified # ( for example when prebuilding shader # to be used with multiple objects ) # # - leave some extra space for other uniforms # - limit here is ANGLE's 254 max uniform vectors # (up to 54 should be safe) n_vertex_uniforms = (glGetParameter(GL_MAX_VERTEX_UNIFORM_COMPONENTS) / 4.0).floor n_vertex_matrices = ((n_vertex_uniforms - 20) / 4.0).floor max_bones = n_vertex_matrices # TODO: when SkinnedMesh exists # if !object.nil? && object.is_a?(SkinnedMesh) # max_bones = [object.skeleton.bones.length, max_bones].min # # if max_bones < object.skeleton.bones.length # puts "WARNING: OpenGLRenderer: too many bones - #{object.skeleton.bones.length}, this GPU supports just #{max_bones}" # end # end max_bones end def count_supported_morph_attributes(attributes) if morph_targets self.num_supported_morph_normals = count_supported_morph_attribute(attributes, 'morphTarget', @renderer.max_morph_normals) end if morph_normals self.num_supported_morph_normals = count_supported_morph_attribute(attributes, 'morphNormal', @renderer.max_morph_normals) end end def count_supported_morph_attribute(attributes, base, max) max.times.reduce do |num, i| attribute = attributes["#{base}#{i}"] attribute && attribute >= 0 ? num + 1 : num end end def get_uniforms_list @shader[:uniforms].map { |(key, uniform)| location = program.uniforms[key] if location [uniform, location] end }.compact end def program_parameters(lights, fog, object) # heuristics to create shader paramaters according to lights in the scene # (not to blow over max_lights budget) max_light_count = allocate_lights(lights) max_shadows = allocate_shadows(lights) max_bones = allocate_bones(object) { supports_vertex_textures: @renderer.supports_vertex_textures?, map: !!map, env_map: !!env_map, env_map_mode: env_map && env_map.mapping, light_map: !!light_map, bump_map: !!light_map, normal_map: !!normal_map, specular_map: !!specular_map, alpha_map: !!alpha_map, combine: combine, vertex_colors: vertex_colors, fog: fog, use_fog: fog, # fog_exp: fog.is_a?(FogExp2), # TODO: when FogExp2 exists flat_shading: shading == FlatShading, size_attenuation: size_attenuation, logarithmic_depth_buffer: @renderer.logarithmic_depth_buffer, skinning: skinning, max_bones: max_bones, use_vertex_texture: @renderer.supports_bone_textures?, morph_targets: morph_targets, morph_normals: morph_normals, max_morph_targets: @renderer.max_morph_targets, max_morph_normals: @renderer.max_morph_normals, max_dir_lights: max_light_count[:directional], max_point_lights: max_light_count[:point], max_spot_lights: max_light_count[:spot], max_hemi_lights: max_light_count[:hemi], max_shadows: max_shadows, shadow_map_enabled: @renderer.shadow_map_enabled? && object.receive_shadow && max_shadows > 0, shadow_map_type: @renderer.shadow_map_type, shadow_map_debug: @renderer.shadow_map_debug, shadow_map_cascade: @renderer.shadow_map_cascade, alpha_test: alpha_test, metal: metal, wrap_around: wrap_around, double_sided: side == DoubleSide, flip_sided: side == BackSide } end def program_slug(parameters) chunks = [] if shader_id chunks << shader_id else chunks << fragment_shader chunks << vertex_shader end if !defines.nil? defines.each do |(name, define)| chunks << name chunks << define end end parameters.each do |(name, parameter)| chunks << name chunks << parameter end chunks.join end def find_or_create_program(lights, fog, object) parameters = program_parameters(lights, fog, object) code = program_slug(parameters) program = @renderer.programs.find do |program_info| program_info.code == code end if program.nil? program = OpenGLProgram.new(@renderer, code, self, parameters) @renderer.programs.push(program) @renderer.info[:memory][:programs] = @renderer.programs.length else program.used_times += 1 end program end end end
{ "content_hash": "e5ddc118a6994eb1cfc8064241ff0f1f", "timestamp": "", "source": "github", "line_count": 274, "max_line_length": 140, "avg_line_length": 27.21897810218978, "alnum_prop": 0.6166532582461786, "repo_name": "jellymann/mittsu", "id": "2fe0a1da8007ded7e55517dabbf79e5c530ce56e", "size": "7458", "binary": false, "copies": "2", "ref": "refs/heads/ds-jruby-attempt-2", "path": "lib/mittsu/renderers/opengl/materials/material.rb", "mode": "33188", "license": "mit", "language": [ { "name": "GLSL", "bytes": "38695" }, { "name": "HTML", "bytes": "5661" }, { "name": "PowerShell", "bytes": "434" }, { "name": "Ruby", "bytes": "653650" }, { "name": "Shell", "bytes": "580" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using FluentNHibernate.Data; using Microsoft.VisualStudio.TestTools.UnitTesting; using Purchasing.Core; using Purchasing.Core.Domain; using Purchasing.Core.Queries; using Purchasing.Tests.Core; using Purchasing.Mvc; using Purchasing.Mvc.App_GlobalResources; using Purchasing.Mvc.Helpers; using Purchasing.Mvc.Services; using UCDArch.Core.PersistanceSupport; using UCDArch.Core.Utils; using UCDArch.Testing; using UCDArch.Testing.Extensions; using UCDArch.Testing.Fakes; using AutoMapper; using Moq; namespace Purchasing.Tests.ServiceTests { [TestClass] public class WorkgroupServiceTests { public IWorkgroupService WorkgroupService; public IRepositoryWithTypedId<Vendor, string> VendorRepository; public IRepositoryWithTypedId<VendorAddress, Guid> VendorAddressRepository; public IRepositoryWithTypedId<User, string> UserRepository; public IRepositoryWithTypedId<EmailPreferences, string> EmailPreferencesRepository; public IRepository<WorkgroupPermission> WorkgroupPermissionRepository; public IRepository<Workgroup> WorkgroupRepository; public IRepositoryWithTypedId<Organization, string> OrganizationRepository; public IDirectorySearchService SearchService; public IRepositoryFactory RepositoryFactory; public IQueryRepositoryFactory QueryRepositoryFactory; public IUserIdentity UserIdentity; public IMapper Mapper; #region Init public WorkgroupServiceTests() { Mapper = new MapperConfiguration(cfg => { cfg.AddProfile<ViewModelProfile>(); }).CreateMapper(); VendorRepository = Mock.Of<IRepositoryWithTypedId<Vendor, string>>(); VendorAddressRepository = Mock.Of<IRepositoryWithTypedId<VendorAddress, Guid>>(); UserRepository = Mock.Of<IRepositoryWithTypedId<User, string>>(); EmailPreferencesRepository = Mock.Of<IRepositoryWithTypedId<EmailPreferences, string>>(); WorkgroupPermissionRepository = Mock.Of<IRepository<WorkgroupPermission>>(); WorkgroupRepository = Mock.Of<IRepository<Workgroup>>(); OrganizationRepository = Mock.Of<IRepositoryWithTypedId<Organization, string>>(); SearchService = Mock.Of<IDirectorySearchService>(); RepositoryFactory = Mock.Of<IRepositoryFactory>(); Mock.Get(RepositoryFactory).SetupGet(r => r.RoleRepository).Returns(Mock.Of<IRepositoryWithTypedId<Role, string>>()); Mock.Get(RepositoryFactory).SetupGet(r => r.WorkgroupPermissionRepository).Returns(WorkgroupPermissionRepository); Mock.Get(RepositoryFactory).SetupGet(r => r.AccountRepository).Returns(Mock.Of<IRepositoryWithTypedId<Account, string>>()); QueryRepositoryFactory = Mock.Of<IQueryRepositoryFactory>(); UserIdentity = Mock.Of<IUserIdentity>(); QueryRepositoryFactory.RelatatedWorkgroupsRepository = Mock.Of<IRepository<RelatedWorkgroups>>(); WorkgroupService = new WorkgroupService(VendorRepository, VendorAddressRepository, UserRepository, EmailPreferencesRepository, WorkgroupPermissionRepository, WorkgroupRepository, OrganizationRepository, SearchService, RepositoryFactory, QueryRepositoryFactory, UserIdentity, Mapper); } #endregion Init #region TransferValues Tests [TestMethod] public void TestTransferValuesWhenKfsVendorHasNullState() { #region Arrange var vendors = new List<Vendor>(); vendors.Add(CreateValidEntities.Vendor(1)); vendors[0].Id = "1"; new FakeVendors(0, VendorRepository, vendors, true); var vendorAddress = new List<VendorAddress>(); vendorAddress.Add(CreateValidEntities.VendorAddress(2)); vendorAddress[0].Vendor = VendorRepository.Queryable.Single(a => a.Id == "1"); vendorAddress[0].TypeCode = "2"; vendorAddress[0].State = null; new FakeVendorAddresses(0, VendorAddressRepository, vendorAddress, false); var source = CreateValidEntities.WorkgroupVendor(1); source.VendorId = "1"; source.VendorAddressTypeCode = "2"; var destination = new WorkgroupVendor(); Assert.AreNotEqual(destination.State, "XX"); #endregion Arrange #region Act WorkgroupService.TransferValues(source, ref destination); #endregion Act #region Assert Assert.AreEqual("XX", destination.State); #endregion Assert } [TestMethod] public void TestTransferValuesWhenKfsVendorHasNullZip() { #region Arrange var vendors = new List<Vendor>(); vendors.Add(CreateValidEntities.Vendor(1)); vendors[0].Id = "1"; new FakeVendors(0, VendorRepository, vendors, true); var vendorAddress = new List<VendorAddress>(); vendorAddress.Add(CreateValidEntities.VendorAddress(2)); vendorAddress[0].Vendor = VendorRepository.Queryable.Single(a => a.Id == "1"); vendorAddress[0].TypeCode = "2"; vendorAddress[0].Zip = null; new FakeVendorAddresses(0, VendorAddressRepository, vendorAddress, false); var source = CreateValidEntities.WorkgroupVendor(1); source.VendorId = "1"; source.VendorAddressTypeCode = "2"; var destination = new WorkgroupVendor(); Assert.AreNotEqual(destination.Zip, "XXXXX"); #endregion Arrange #region Act WorkgroupService.TransferValues(source, ref destination); #endregion Act #region Assert Assert.AreEqual("XXXXX", destination.Zip); #endregion Assert } [TestMethod] public void TestTransferValuesWhenKfsVendor() { #region Arrange var vendors = new List<Vendor>(); vendors.Add(CreateValidEntities.Vendor(1)); vendors[0].Name = "VendorName1"; vendors[0].Id = "1"; new FakeVendors(0, VendorRepository, vendors, true); var vendorAddress = new List<VendorAddress>(); vendorAddress.Add(CreateValidEntities.VendorAddress(2)); vendorAddress[0].Vendor = VendorRepository.Queryable.Single(a => a.Id == "1"); vendorAddress[0].TypeCode = "2"; vendorAddress[0].Zip = "98765"; vendorAddress[0].Name = "DoesNotMatter"; vendorAddress[0].Line1 = "VaLine1"; vendorAddress[0].Line2 = "VaLine2"; vendorAddress[0].Line3 = "VaLine3"; vendorAddress[0].City = "VaCity1"; vendorAddress[0].State = "AB"; vendorAddress[0].CountryCode = "UK"; vendorAddress[0].PhoneNumber = "333-444-55555"; vendorAddress[0].FaxNumber = "222-444-55555"; new FakeVendorAddresses(0, VendorAddressRepository, vendorAddress, false); var source = CreateValidEntities.WorkgroupVendor(1); source.VendorId = "1"; source.VendorAddressTypeCode = "2"; var destination = new WorkgroupVendor(); #endregion Arrange #region Act WorkgroupService.TransferValues(source, ref destination); #endregion Act #region Assert Assert.AreEqual("VendorName1", destination.Name); Assert.AreEqual("VaLine1", destination.Line1); Assert.AreEqual("VaLine2", destination.Line2); Assert.AreEqual("VaLine3", destination.Line3); Assert.AreEqual("VaCity1", destination.City); Assert.AreEqual("AB", destination.State); Assert.AreEqual("98765", destination.Zip); Assert.AreEqual("UK", destination.CountryCode); Assert.AreEqual("333-444-55555", destination.Phone); Assert.AreEqual("222-444-55555", destination.Fax); #endregion Assert } [TestMethod] public void TestTransferValuesWhenNotKfsVendor() { #region Arrange var vendors = new List<Vendor>(); vendors.Add(CreateValidEntities.Vendor(1)); vendors[0].Name = "VendorName1"; vendors[0].Id = "1"; new FakeVendors(0, VendorRepository, vendors, true); var vendorAddress = new List<VendorAddress>(); vendorAddress.Add(CreateValidEntities.VendorAddress(2)); vendorAddress[0].Vendor = VendorRepository.Queryable.Single(a => a.Id == "1"); vendorAddress[0].TypeCode = "2"; vendorAddress[0].Zip = "98765"; vendorAddress[0].Name = "DoesNotMatter"; vendorAddress[0].Line1 = "VaLine1"; vendorAddress[0].Line2 = "VaLine2"; vendorAddress[0].Line3 = "VaLine3"; vendorAddress[0].City = "VaCity1"; vendorAddress[0].State = "AB"; vendorAddress[0].CountryCode = "UK"; vendorAddress[0].PhoneNumber = "333-444-55555"; vendorAddress[0].FaxNumber = "222-444-55555"; new FakeVendorAddresses(0, VendorAddressRepository, vendorAddress, false); var source = CreateValidEntities.WorkgroupVendor(1); source.VendorId = null; source.VendorAddressTypeCode = "2"; source.Phone = "111"; source.Fax = "222"; var destination = new WorkgroupVendor(); #endregion Arrange #region Act WorkgroupService.TransferValues(source, ref destination); #endregion Act #region Assert Assert.AreEqual("Name1", destination.Name); Assert.AreEqual("Line11", destination.Line1); Assert.AreEqual(null, destination.Line2); Assert.AreEqual(null, destination.Line3); Assert.AreEqual("City1", destination.City); Assert.AreEqual("CA", destination.State); Assert.AreEqual("95616", destination.Zip); Assert.AreEqual("US", destination.CountryCode); Assert.AreEqual("111", destination.Phone); Assert.AreEqual("222", destination.Fax); #endregion Assert } #endregion TransferValues Tests #region TryToAddPeople Tests [TestMethod] public void TestTryToAddPeopleWhenUserIsNotFound1() { #region Arrange new FakeUsers(0, UserRepository); Mock.Get(SearchService).Setup(a => a.FindUser(It.IsAny<string>())).Returns<DirectoryUser>(null); var failCount = 0; var dupCount = 0; var notAdded = new List<KeyValuePair<string, string>>(); #endregion Arrange #region Act var result = WorkgroupService.TryToAddPeople(1, new Role(), new Workgroup(), 0, "test", ref failCount, ref dupCount, notAdded); #endregion Act #region Assert Mock.Get(UserRepository).Verify(a => a.GetNullableById("test")); Mock.Get(SearchService).Verify(a => a.FindUser("test")); Assert.AreEqual(1, failCount); Assert.AreEqual(0, dupCount); Assert.AreEqual(0, result); Assert.AreEqual(1, notAdded.Count()); Assert.AreEqual("Not found", notAdded[0].Value); Assert.AreEqual("test", notAdded[0].Key); #endregion Assert } [TestMethod] public void TestTryToAddPeopleWhenUserIsNotFound2() { #region Arrange new FakeUsers(0, UserRepository); Mock.Get(SearchService).Setup(a => a.FindUser(It.IsAny<string>())).Returns<DirectoryUser>(null); var failCount = 2; var dupCount = 4; var notAdded = new List<KeyValuePair<string, string>>(); #endregion Arrange #region Act var result = WorkgroupService.TryToAddPeople(1, new Role(), new Workgroup(), 0, "test", ref failCount, ref dupCount, notAdded); #endregion Act #region Assert Mock.Get(UserRepository).Verify(a => a.GetNullableById("test")); Mock.Get(SearchService).Verify(a => a.FindUser("test")); Assert.AreEqual(3, failCount); Assert.AreEqual(4, dupCount); Assert.AreEqual(0, result); Assert.AreEqual(1, notAdded.Count()); Assert.AreEqual("Not found", notAdded[0].Value); Assert.AreEqual("test", notAdded[0].Key); #endregion Assert } [TestMethod] public void TestTryToAddPeopleWhenUserAlreadyExists1() { #region Arrange new FakeUsers(3, UserRepository); new FakeWorkgroupPermissions(0, WorkgroupPermissionRepository); var failCount = 0; var dupCount = 0; var notAdded = new List<KeyValuePair<string, string>>(); new FakeRoles(3, RepositoryFactory.RoleRepository); new FakeWorkgroups(3, WorkgroupRepository); WorkgroupPermission args = default; Mock.Get(WorkgroupPermissionRepository).Setup(a => a.EnsurePersistent(It.IsAny<WorkgroupPermission>())) .Callback<WorkgroupPermission>(x => args = x); #endregion Arrange #region Act var result = WorkgroupService.TryToAddPeople(1, RepositoryFactory.RoleRepository.Queryable.Single(a => a.Id == "2"), new Workgroup(), 0, "2", ref failCount, ref dupCount, notAdded); #endregion Act #region Assert Assert.AreEqual(1, result); Assert.AreEqual(0, failCount); Assert.AreEqual(0, dupCount); Assert.AreEqual(0, notAdded.Count()); Mock.Get(EmailPreferencesRepository).Verify(a => a.EnsurePersistent(It.IsAny<EmailPreferences>()), Times.Never()); Mock.Get(WorkgroupPermissionRepository).Verify(a => a.EnsurePersistent(It.IsAny<WorkgroupPermission>())); Assert.IsNotNull(args); Assert.AreEqual("2", args.Role.Id); Assert.AreEqual("2", args.User.Id); Assert.AreEqual(1, args.Workgroup.Id); Mock.Get(UserIdentity).Verify(a => a.RemoveUserRoleFromCache(Resources.Role_CacheId, "2")); #endregion Assert } [TestMethod] public void TestTryToAddPeopleWhenUserAlreadyExists2() { #region Arrange new FakeUsers(3, UserRepository); var failCount = 0; var dupCount = 0; var notAdded = new List<KeyValuePair<string, string>>(); new FakeRoles(3, RepositoryFactory.RoleRepository); new FakeWorkgroups(3, WorkgroupRepository); var wp = new List<WorkgroupPermission>(); wp.Add(CreateValidEntities.WorkgroupPermission(1)); wp[0].User = UserRepository.Queryable.Single(a => a.Id == "2"); wp[0].Role = RepositoryFactory.RoleRepository.Queryable.Single(a => a.Id == "2"); wp[0].Workgroup = WorkgroupRepository.Queryable.Single(a => a.Id == 1); new FakeWorkgroupPermissions(0, WorkgroupPermissionRepository, wp); #endregion Arrange #region Act var result = WorkgroupService.TryToAddPeople(1, RepositoryFactory.RoleRepository.Queryable.Single(a => a.Id == "2"), WorkgroupRepository.Queryable.Single(a => a.Id == 1), 0, "2", ref failCount, ref dupCount, notAdded); #endregion Act #region Assert Assert.AreEqual(0, result); Assert.AreEqual(1, failCount); Assert.AreEqual(1, dupCount); Assert.AreEqual(1, notAdded.Count()); Mock.Get(EmailPreferencesRepository).Verify(a => a.EnsurePersistent(It.IsAny<EmailPreferences>()), Times.Never()); Mock.Get(WorkgroupPermissionRepository).Verify(a => a.EnsurePersistent(It.IsAny<WorkgroupPermission>()), Times.Never()); Assert.AreEqual("Is a duplicate", notAdded[0].Value); Assert.AreEqual("2", notAdded[0].Key); #endregion Assert } [TestMethod] public void TestTryToAddPeopleWhenUserIsFoundWithLdap1() { #region Arrange new FakeUsers(3, UserRepository); new FakeWorkgroupPermissions(0, WorkgroupPermissionRepository); var failCount = 0; var dupCount = 0; var notAdded = new List<KeyValuePair<string, string>>(); new FakeRoles(3, RepositoryFactory.RoleRepository); new FakeWorkgroups(3, WorkgroupRepository); var directoryUser = new DirectoryUser(); directoryUser.LoginId = "3"; directoryUser.EmailAddress = "test3@testy.com"; directoryUser.FirstName = "F3"; directoryUser.LastName = "Last3"; Mock.Get(SearchService).Setup(a => a.FindUser("LDAP")).Returns(directoryUser); WorkgroupPermission args = default; Mock.Get(WorkgroupPermissionRepository).Setup(a => a.EnsurePersistent(It.IsAny<WorkgroupPermission>())) .Callback<WorkgroupPermission>(x => args = x); #endregion Arrange #region Act var result = WorkgroupService.TryToAddPeople(1, RepositoryFactory.RoleRepository.Queryable.Single(a => a.Id == "2"), new Workgroup(), 0, "LDAP", ref failCount, ref dupCount, notAdded); #endregion Act #region Assert Assert.AreEqual(1, result); Assert.AreEqual(0, failCount); Assert.AreEqual(0, dupCount); Assert.AreEqual(0, notAdded.Count()); Mock.Get(UserRepository).Verify(a => a.EnsurePersistent(It.IsAny<User>()), Times.Never()); Mock.Get(EmailPreferencesRepository).Verify(a => a.EnsurePersistent(It.IsAny<EmailPreferences>()), Times.Never()); Mock.Get(WorkgroupPermissionRepository).Verify(a => a.EnsurePersistent(It.IsAny<WorkgroupPermission>())); Assert.IsNotNull(args); Assert.AreEqual("2", args.Role.Id); Assert.AreEqual("3", args.User.Id); Assert.AreEqual(1, args.Workgroup.Id); #endregion Assert } [TestMethod] public void TestTryToAddPeopleWhenUserIsFoundWithLdap2() { #region Arrange //HttpContext.Current = new HttpContext(new HttpRequest(null, "http://test.org", null), new HttpResponse(null)); //new FakeUsers(3, UserRepository); Mock.Get(UserRepository) .SetupSequence(a => a.GetNullableById("LDAP")) .Returns((User)null) .Returns((User)null) .Returns(CreateValidEntities.User(3)) .Throws(new Exception("Called too many times")); new FakeWorkgroupPermissions(0, WorkgroupPermissionRepository); var failCount = 0; var dupCount = 0; var notAdded = new List<KeyValuePair<string, string>>(); new FakeRoles(3, RepositoryFactory.RoleRepository); new FakeWorkgroups(3, WorkgroupRepository); var directoryUser = new DirectoryUser(); directoryUser.LoginId = "LDAP"; directoryUser.EmailAddress = "test3@testy.com"; directoryUser.FirstName = "F3"; directoryUser.LastName = "Last3"; Mock.Get(SearchService).Setup(a => a.FindUser("LDAP")).Returns(directoryUser); WorkgroupPermission args = default; Mock.Get(WorkgroupPermissionRepository).Setup(a => a.EnsurePersistent(It.IsAny<WorkgroupPermission>())) .Callback<WorkgroupPermission>(x => args = x); #endregion Arrange #region Act var result = WorkgroupService.TryToAddPeople(1, RepositoryFactory.RoleRepository.Queryable.Single(a => a.Id == "2"), new Workgroup(), 0, "LDAP", ref failCount, ref dupCount, notAdded); #endregion Act #region Assert Assert.AreEqual(1, result); Assert.AreEqual(0, failCount); Assert.AreEqual(0, dupCount); Assert.AreEqual(0, notAdded.Count()); Mock.Get(UserRepository).Verify(a => a.EnsurePersistent(It.IsAny<User>())); Mock.Get(EmailPreferencesRepository).Verify(a => a.EnsurePersistent(It.IsAny<EmailPreferences>())); Mock.Get(WorkgroupPermissionRepository).Verify(a => a.EnsurePersistent(It.IsAny<WorkgroupPermission>())); Assert.IsNotNull(args); Assert.AreEqual("2", args.Role.Id); Assert.AreEqual("3", args.User.Id); Assert.AreEqual(1, args.Workgroup.Id); #endregion Assert } #endregion TryToAddPeople Tests #region TryBulkLoadPeople Tests [TestMethod] public void TestTryBulkLoadPeopleWithKerb1() { #region Arrange var failCount = 0; var dupCount = 0; var notAdded = new List<KeyValuePair<string, string>>(); var role = CreateValidEntities.Role(1); var workgroup = CreateValidEntities.Workgroup(1); #endregion Arrange #region Act var result = WorkgroupService.TryBulkLoadPeople("kerb1,kerb2 kerb3", false, 1, role, workgroup, 0, ref failCount, ref dupCount, notAdded); #endregion Act #region Assert Assert.AreEqual(0, result); Mock.Get(UserRepository).Verify(a => a.GetNullableById("kerb1")); Mock.Get(UserRepository).Verify(a => a.GetNullableById("kerb2")); Mock.Get(UserRepository).Verify(a => a.GetNullableById("kerb3")); Mock.Get(UserRepository).Verify(a => a.GetNullableById(It.IsAny<string>()), Times.Exactly(3)); #endregion Assert } [TestMethod] public void TestTryBulkLoadPeopleWithEmail1() { #region Arrange var failCount = 0; var dupCount = 0; var notAdded = new List<KeyValuePair<string, string>>(); var role = CreateValidEntities.Role(1); var workgroup = CreateValidEntities.Workgroup(1); #endregion Arrange #region Act var result = WorkgroupService.TryBulkLoadPeople("kerb1,kerb2 kerb3", true, 1, role, workgroup, 0, ref failCount, ref dupCount, notAdded); #endregion Act #region Assert Assert.AreEqual(0, result); Mock.Get(UserRepository).Verify(a => a.GetNullableById(It.IsAny<string>()), Times.Never()); #endregion Assert } [TestMethod] public void TestTryBulkLoadPeopleWithEmail2() { #region Arrange var failCount = 0; var dupCount = 0; var notAdded = new List<KeyValuePair<string, string>>(); var role = CreateValidEntities.Role(1); var workgroup = CreateValidEntities.Workgroup(1); #endregion Arrange #region Act var result = WorkgroupService.TryBulkLoadPeople("Getchell, Adam <acgetchell@ucdavis.edu>; Kirkland, Scott <srkirkland@ucdavis.edu>; Lai, Alan <anlai@ucdavis.edu>; Sylvestre, Jason <jsylvestre@ucdavis.edu>; Taylor, Ken <kentaylor@ucdavis.edu>", true, 1, role, workgroup, 0, ref failCount, ref dupCount, notAdded); #endregion Act #region Assert Assert.AreEqual(0, result); Mock.Get(UserRepository).Verify(a => a.GetNullableById("acgetchell@ucdavis.edu")); Mock.Get(UserRepository).Verify(a => a.GetNullableById("srkirkland@ucdavis.edu")); Mock.Get(UserRepository).Verify(a => a.GetNullableById("anlai@ucdavis.edu")); Mock.Get(UserRepository).Verify(a => a.GetNullableById("jsylvestre@ucdavis.edu")); Mock.Get(UserRepository).Verify(a => a.GetNullableById("kentaylor@ucdavis.edu")); Mock.Get(UserRepository).Verify(a => a.GetNullableById(It.IsAny<string>()), Times.Exactly(5)); #endregion Assert } #endregion TryBulkLoadPeople Tests #region CreateWorkgroup Tests [TestMethod] public void TestCreateWorkgroupAddsPrimaryOrgAsASubOrg() { #region Arrange var workgroup = CreateValidEntities.Workgroup(1); workgroup.PrimaryOrganization = CreateValidEntities.Organization(9); workgroup.Organizations = new List<Organization>(); new FakeRelatedWorkgroups(3, QueryRepositoryFactory.RelatatedWorkgroupsRepository); new FakeWorkgroupPermissions(3, WorkgroupPermissionRepository); #endregion Arrange #region Act var result = WorkgroupService.CreateWorkgroup(workgroup, null); #endregion Act #region Assert Assert.IsNotNull(result); Assert.AreEqual("Name9", result.PrimaryOrganization.Name); Assert.AreEqual(1, result.Organizations.Count()); Assert.AreEqual("Name9", result.Organizations[0].Name); Mock.Get(WorkgroupRepository).Verify(a => a.EnsurePersistent(result)); #endregion Assert } [TestMethod] public void TestCreateWorkgroupReplacesExistingSubOrgs() { #region Arrange new FakeOrganizations(3, OrganizationRepository); var workgroup = CreateValidEntities.Workgroup(1); workgroup.PrimaryOrganization = CreateValidEntities.Organization(9); workgroup.Organizations = new List<Organization>(); workgroup.Organizations.Add(OrganizationRepository.Queryable.Single(a => a.Id == "2")); workgroup.Organizations.Add(OrganizationRepository.Queryable.Single(a => a.Id == "3")); new FakeRelatedWorkgroups(3, QueryRepositoryFactory.RelatatedWorkgroupsRepository); new FakeWorkgroupPermissions(3, WorkgroupPermissionRepository); #endregion Arrange #region Act var result = WorkgroupService.CreateWorkgroup(workgroup, new string[] { "1" }); #endregion Act #region Assert Assert.IsNotNull(result); Assert.AreEqual("Name9", result.PrimaryOrganization.Name); Assert.AreEqual(2, result.Organizations.Count()); Assert.AreEqual("Name1", result.Organizations[0].Name); Assert.AreEqual("Name9", result.Organizations[1].Name); Mock.Get(WorkgroupRepository).Verify(a => a.EnsurePersistent(result)); #endregion Assert } [TestMethod] public void TestCreateWorkgroupWhenSyncAccountsIsNotSelectedDoesNotAddAccounts() { #region Arrange var workgroup = CreateValidEntities.Workgroup(1); workgroup.SyncAccounts = false; workgroup.Accounts = new List<WorkgroupAccount>(); new FakeRelatedWorkgroups(3, QueryRepositoryFactory.RelatatedWorkgroupsRepository); new FakeWorkgroupPermissions(3, WorkgroupPermissionRepository); #endregion Arrange #region Act var result = WorkgroupService.CreateWorkgroup(workgroup, null); #endregion Act #region Assert Assert.IsNotNull(result); Mock.Get(WorkgroupRepository).Verify(a => a.EnsurePersistent(result)); Mock.Get(RepositoryFactory.AccountRepository).Verify(a => a.Queryable, Times.Never()); Assert.AreEqual(0, result.Accounts.Count()); #endregion Assert } [TestMethod] public void TestCreateWorkgroupWhenSyncAccountsIsSelectedAddsAccounts() { #region Arrange var organizations = new List<Organization>(); organizations.Add(CreateValidEntities.Organization(1)); organizations[0].Id = "1"; organizations.Add(CreateValidEntities.Organization(2)); organizations[1].Id = "2"; new FakeOrganizations(0, OrganizationRepository, organizations, true); var accounts = new List<Account>(); for (int i = 0; i < 5; i++) { accounts.Add(CreateValidEntities.Account(i + 1)); accounts[i].OrganizationId = "1"; } accounts[3].OrganizationId = "2"; new FakeAccounts(0, RepositoryFactory.AccountRepository, accounts, false); var workgroup = CreateValidEntities.Workgroup(1); workgroup.SyncAccounts = true; workgroup.Accounts = new List<WorkgroupAccount>(); workgroup.PrimaryOrganization = organizations[0]; workgroup.Organizations.Add(organizations[1]); new FakeRelatedWorkgroups(3, QueryRepositoryFactory.RelatatedWorkgroupsRepository); new FakeWorkgroupPermissions(3, WorkgroupPermissionRepository); #endregion Arrange #region Act var result = WorkgroupService.CreateWorkgroup(workgroup, new[] { "2" }); #endregion Act #region Assert Assert.IsNotNull(result); Mock.Get(WorkgroupRepository).Verify(a => a.EnsurePersistent(result)); #endregion Assert } [Ignore("Need to test the related workgroups")] public void TestRelatedWorkgroups() { #region Arrange #endregion Arrange #region Act #endregion Act #region Assert #endregion Assert } #endregion CreateWorkgroup Tests } }
{ "content_hash": "32922b48402508a6bc4c6f74b4347ad5", "timestamp": "", "source": "github", "line_count": 695, "max_line_length": 270, "avg_line_length": 43.90503597122302, "alnum_prop": 0.6072294684407158, "repo_name": "ucdavis/Purchasing", "id": "e1f27620ad2c3fb547ff6382738c33fca77b251f", "size": "30516", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Purchasing.Tests/ServiceTests/WorkgroupServiceTests.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "335" }, { "name": "C#", "bytes": "5413441" }, { "name": "CSS", "bytes": "261981" }, { "name": "HTML", "bytes": "669498" }, { "name": "JavaScript", "bytes": "1351804" }, { "name": "TSQL", "bytes": "277785" } ], "symlink_target": "" }
/* * array.c * */ #include <assert.h> #include <roaring/containers/array.h> #include <stdio.h> #include <stdlib.h> extern inline uint16_t array_container_minimum(const array_container_t *arr); extern inline uint16_t array_container_maximum(const array_container_t *arr); extern inline int array_container_index_equalorlarger(const array_container_t *arr, uint16_t x); extern inline int array_container_rank(const array_container_t *arr, uint16_t x); extern inline bool array_container_contains(const array_container_t *arr, uint16_t pos); extern inline int array_container_cardinality(const array_container_t *array); extern inline bool array_container_nonzero_cardinality(const array_container_t *array); extern inline void array_container_clear(array_container_t *array); extern inline int32_t array_container_serialized_size_in_bytes(int32_t card); extern inline bool array_container_empty(const array_container_t *array); extern inline bool array_container_full(const array_container_t *array); /* Create a new array with capacity size. Return NULL in case of failure. */ array_container_t *array_container_create_given_capacity(int32_t size) { array_container_t *container; if ((container = (array_container_t *)malloc(sizeof(array_container_t))) == NULL) { return NULL; } if( size <= 0 ) { // we don't want to rely on malloc(0) container->array = NULL; } else if ((container->array = (uint16_t *)malloc(sizeof(uint16_t) * size)) == NULL) { free(container); return NULL; } container->capacity = size; container->cardinality = 0; return container; } /* Create a new array. Return NULL in case of failure. */ array_container_t *array_container_create() { return array_container_create_given_capacity(ARRAY_DEFAULT_INIT_SIZE); } /* Create a new array containing all values in [min,max). */ array_container_t * array_container_create_range(uint32_t min, uint32_t max) { array_container_t * answer = array_container_create_given_capacity(max - min + 1); if(answer == NULL) return answer; answer->cardinality = 0; for(uint32_t k = min; k < max; k++) { answer->array[answer->cardinality++] = k; } return answer; } /* Duplicate container */ array_container_t *array_container_clone(const array_container_t *src) { array_container_t *newcontainer = array_container_create_given_capacity(src->capacity); if (newcontainer == NULL) return NULL; newcontainer->cardinality = src->cardinality; memcpy(newcontainer->array, src->array, src->cardinality * sizeof(uint16_t)); return newcontainer; } int array_container_shrink_to_fit(array_container_t *src) { if (src->cardinality == src->capacity) return 0; // nothing to do int savings = src->capacity - src->cardinality; src->capacity = src->cardinality; if( src->capacity == 0) { // we do not want to rely on realloc for zero allocs free(src->array); src->array = NULL; } else { uint16_t *oldarray = src->array; src->array = (uint16_t *)realloc(oldarray, src->capacity * sizeof(uint16_t)); if (src->array == NULL) free(oldarray); // should never happen? } return savings; } /* Free memory. */ void array_container_free(array_container_t *arr) { if(arr->array != NULL) {// Jon Strabala reports that some tools complain otherwise free(arr->array); arr->array = NULL; // pedantic } free(arr); } static inline int32_t grow_capacity(int32_t capacity) { return (capacity <= 0) ? ARRAY_DEFAULT_INIT_SIZE : capacity < 64 ? capacity * 2 : capacity < 1024 ? capacity * 3 / 2 : capacity * 5 / 4; } static inline int32_t clamp(int32_t val, int32_t min, int32_t max) { return ((val < min) ? min : (val > max) ? max : val); } void array_container_grow(array_container_t *container, int32_t min, bool preserve) { int32_t max = (min <= DEFAULT_MAX_SIZE ? DEFAULT_MAX_SIZE : 65536); int32_t new_capacity = clamp(grow_capacity(container->capacity), min, max); container->capacity = new_capacity; uint16_t *array = container->array; if (preserve) { container->array = (uint16_t *)realloc(array, new_capacity * sizeof(uint16_t)); if (container->array == NULL) free(array); } else { // Jon Strabala reports that some tools complain otherwise if (array != NULL) { free(array); } container->array = (uint16_t *)malloc(new_capacity * sizeof(uint16_t)); } // handle the case where realloc fails if (container->array == NULL) { fprintf(stderr, "could not allocate memory\n"); } assert(container->array != NULL); } /* Copy one container into another. We assume that they are distinct. */ void array_container_copy(const array_container_t *src, array_container_t *dst) { const int32_t cardinality = src->cardinality; if (cardinality > dst->capacity) { array_container_grow(dst, cardinality, false); } dst->cardinality = cardinality; memcpy(dst->array, src->array, cardinality * sizeof(uint16_t)); } void array_container_add_from_range(array_container_t *arr, uint32_t min, uint32_t max, uint16_t step) { for (uint32_t value = min; value < max; value += step) { array_container_append(arr, value); } } /* Computes the union of array1 and array2 and write the result to arrayout. * It is assumed that arrayout is distinct from both array1 and array2. */ void array_container_union(const array_container_t *array_1, const array_container_t *array_2, array_container_t *out) { const int32_t card_1 = array_1->cardinality, card_2 = array_2->cardinality; const int32_t max_cardinality = card_1 + card_2; if (out->capacity < max_cardinality) { array_container_grow(out, max_cardinality, false); } out->cardinality = (int32_t)fast_union_uint16(array_1->array, card_1, array_2->array, card_2, out->array); } /* Computes the difference of array1 and array2 and write the result * to array out. * Array out does not need to be distinct from array_1 */ void array_container_andnot(const array_container_t *array_1, const array_container_t *array_2, array_container_t *out) { if (out->capacity < array_1->cardinality) array_container_grow(out, array_1->cardinality, false); #ifdef ROARING_VECTOR_OPERATIONS_ENABLED if((out != array_1) && (out != array_2)) { out->cardinality = difference_vector16(array_1->array, array_1->cardinality, array_2->array, array_2->cardinality, out->array); } else { out->cardinality = difference_uint16(array_1->array, array_1->cardinality, array_2->array, array_2->cardinality, out->array); } #else out->cardinality = difference_uint16(array_1->array, array_1->cardinality, array_2->array, array_2->cardinality, out->array); #endif } /* Computes the symmetric difference of array1 and array2 and write the * result * to arrayout. * It is assumed that arrayout is distinct from both array1 and array2. */ void array_container_xor(const array_container_t *array_1, const array_container_t *array_2, array_container_t *out) { const int32_t card_1 = array_1->cardinality, card_2 = array_2->cardinality; const int32_t max_cardinality = card_1 + card_2; if (out->capacity < max_cardinality) { array_container_grow(out, max_cardinality, false); } #ifdef ROARING_VECTOR_OPERATIONS_ENABLED out->cardinality = xor_vector16(array_1->array, array_1->cardinality, array_2->array, array_2->cardinality, out->array); #else out->cardinality = xor_uint16(array_1->array, array_1->cardinality, array_2->array, array_2->cardinality, out->array); #endif } static inline int32_t minimum_int32(int32_t a, int32_t b) { return (a < b) ? a : b; } /* computes the intersection of array1 and array2 and write the result to * arrayout. * It is assumed that arrayout is distinct from both array1 and array2. * */ void array_container_intersection(const array_container_t *array1, const array_container_t *array2, array_container_t *out) { int32_t card_1 = array1->cardinality, card_2 = array2->cardinality, min_card = minimum_int32(card_1, card_2); const int threshold = 64; // subject to tuning #ifdef USEAVX if (out->capacity < min_card) { array_container_grow(out, min_card + sizeof(__m128i) / sizeof(uint16_t), false); } #else if (out->capacity < min_card) { array_container_grow(out, min_card, false); } #endif if (card_1 * threshold < card_2) { out->cardinality = intersect_skewed_uint16( array1->array, card_1, array2->array, card_2, out->array); } else if (card_2 * threshold < card_1) { out->cardinality = intersect_skewed_uint16( array2->array, card_2, array1->array, card_1, out->array); } else { #ifdef USEAVX out->cardinality = intersect_vector16( array1->array, card_1, array2->array, card_2, out->array); #else out->cardinality = intersect_uint16(array1->array, card_1, array2->array, card_2, out->array); #endif } } /* computes the size of the intersection of array1 and array2 * */ int array_container_intersection_cardinality(const array_container_t *array1, const array_container_t *array2) { int32_t card_1 = array1->cardinality, card_2 = array2->cardinality; const int threshold = 64; // subject to tuning if (card_1 * threshold < card_2) { return intersect_skewed_uint16_cardinality(array1->array, card_1, array2->array, card_2); } else if (card_2 * threshold < card_1) { return intersect_skewed_uint16_cardinality(array2->array, card_2, array1->array, card_1); } else { #ifdef USEAVX return intersect_vector16_cardinality(array1->array, card_1, array2->array, card_2); #else return intersect_uint16_cardinality(array1->array, card_1, array2->array, card_2); #endif } } bool array_container_intersect(const array_container_t *array1, const array_container_t *array2) { int32_t card_1 = array1->cardinality, card_2 = array2->cardinality; const int threshold = 64; // subject to tuning if (card_1 * threshold < card_2) { return intersect_skewed_uint16_nonempty( array1->array, card_1, array2->array, card_2); } else if (card_2 * threshold < card_1) { return intersect_skewed_uint16_nonempty( array2->array, card_2, array1->array, card_1); } else { // we do not bother vectorizing return intersect_uint16_nonempty(array1->array, card_1, array2->array, card_2); } } /* computes the intersection of array1 and array2 and write the result to * array1. * */ void array_container_intersection_inplace(array_container_t *src_1, const array_container_t *src_2) { // todo: can any of this be vectorized? int32_t card_1 = src_1->cardinality, card_2 = src_2->cardinality; const int threshold = 64; // subject to tuning if (card_1 * threshold < card_2) { src_1->cardinality = intersect_skewed_uint16( src_1->array, card_1, src_2->array, card_2, src_1->array); } else if (card_2 * threshold < card_1) { src_1->cardinality = intersect_skewed_uint16( src_2->array, card_2, src_1->array, card_1, src_1->array); } else { src_1->cardinality = intersect_uint16( src_1->array, card_1, src_2->array, card_2, src_1->array); } } int array_container_to_uint32_array(void *vout, const array_container_t *cont, uint32_t base) { int outpos = 0; uint32_t *out = (uint32_t *)vout; for (int i = 0; i < cont->cardinality; ++i) { const uint32_t val = base + cont->array[i]; memcpy(out + outpos, &val, sizeof(uint32_t)); // should be compiled as a MOV on x64 outpos++; } return outpos; } void array_container_printf(const array_container_t *v) { if (v->cardinality == 0) { printf("{}"); return; } printf("{"); printf("%d", v->array[0]); for (int i = 1; i < v->cardinality; ++i) { printf(",%d", v->array[i]); } printf("}"); } void array_container_printf_as_uint32_array(const array_container_t *v, uint32_t base) { if (v->cardinality == 0) { return; } printf("%u", v->array[0] + base); for (int i = 1; i < v->cardinality; ++i) { printf(",%u", v->array[i] + base); } } /* Compute the number of runs */ int32_t array_container_number_of_runs(const array_container_t *a) { // Can SIMD work here? int32_t nr_runs = 0; int32_t prev = -2; for (const uint16_t *p = a->array; p != a->array + a->cardinality; ++p) { if (*p != prev + 1) nr_runs++; prev = *p; } return nr_runs; } int32_t array_container_serialize(const array_container_t *container, char *buf) { int32_t l, off; uint16_t cardinality = (uint16_t)container->cardinality; memcpy(buf, &cardinality, off = sizeof(cardinality)); l = sizeof(uint16_t) * container->cardinality; if (l) memcpy(&buf[off], container->array, l); return (off + l); } /** * Writes the underlying array to buf, outputs how many bytes were written. * The number of bytes written should be * array_container_size_in_bytes(container). * */ int32_t array_container_write(const array_container_t *container, char *buf) { memcpy(buf, container->array, container->cardinality * sizeof(uint16_t)); return array_container_size_in_bytes(container); } bool array_container_is_subset(const array_container_t *container1, const array_container_t *container2) { if (container1->cardinality > container2->cardinality) { return false; } int i1 = 0, i2 = 0; while (i1 < container1->cardinality && i2 < container2->cardinality) { if (container1->array[i1] == container2->array[i2]) { i1++; i2++; } else if (container1->array[i1] > container2->array[i2]) { i2++; } else { // container1->array[i1] < container2->array[i2] return false; } } if (i1 == container1->cardinality) { return true; } else { return false; } } int32_t array_container_read(int32_t cardinality, array_container_t *container, const char *buf) { if (container->capacity < cardinality) { array_container_grow(container, cardinality, false); } container->cardinality = cardinality; memcpy(container->array, buf, container->cardinality * sizeof(uint16_t)); return array_container_size_in_bytes(container); } uint32_t array_container_serialization_len(const array_container_t *container) { return (sizeof(uint16_t) /* container->cardinality converted to 16 bit */ + (sizeof(uint16_t) * container->cardinality)); } void *array_container_deserialize(const char *buf, size_t buf_len) { array_container_t *ptr; if (buf_len < 2) /* capacity converted to 16 bit */ return (NULL); else buf_len -= 2; if ((ptr = (array_container_t *)malloc(sizeof(array_container_t))) != NULL) { size_t len; int32_t off; uint16_t cardinality; memcpy(&cardinality, buf, off = sizeof(cardinality)); ptr->capacity = ptr->cardinality = (uint32_t)cardinality; len = sizeof(uint16_t) * ptr->cardinality; if (len != buf_len) { free(ptr); return (NULL); } if ((ptr->array = (uint16_t *)malloc(sizeof(uint16_t) * ptr->capacity)) == NULL) { free(ptr); return (NULL); } if (len) memcpy(ptr->array, &buf[off], len); /* Check if returned values are monotonically increasing */ for (int32_t i = 0, j = 0; i < ptr->cardinality; i++) { if (ptr->array[i] < j) { free(ptr->array); free(ptr); return (NULL); } else j = ptr->array[i]; } } return (ptr); } bool array_container_iterate(const array_container_t *cont, uint32_t base, roaring_iterator iterator, void *ptr) { for (int i = 0; i < cont->cardinality; i++) if (!iterator(cont->array[i] + base, ptr)) return false; return true; } bool array_container_iterate64(const array_container_t *cont, uint32_t base, roaring_iterator64 iterator, uint64_t high_bits, void *ptr) { for (int i = 0; i < cont->cardinality; i++) if (!iterator(high_bits | (uint64_t)(cont->array[i] + base), ptr)) return false; return true; }
{ "content_hash": "f29697b0816260431c72cd6107f744b2", "timestamp": "", "source": "github", "line_count": 502, "max_line_length": 96, "avg_line_length": 35.85059760956175, "alnum_prop": 0.590265044174029, "repo_name": "lemire/CRoaring", "id": "6212a1965470ebad553ba049c21852a6bb5f3702", "size": "17997", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/containers/array.c", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "337139" }, { "name": "C++", "bytes": "2605" }, { "name": "CMake", "bytes": "3458" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.9.1"/> <title>Crap Engine 2: Class Members - Functions</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">Crap Engine 2 </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.9.1 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li class="current"><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <div id="navrow3" class="tabs2"> <ul class="tablist"> <li><a href="functions.html"><span>All</span></a></li> <li class="current"><a href="functions_func.html"><span>Functions</span></a></li> <li><a href="functions_vars.html"><span>Variables</span></a></li> <li><a href="functions_type.html"><span>Typedefs</span></a></li> <li><a href="functions_enum.html"><span>Enumerations</span></a></li> <li><a href="functions_eval.html"><span>Enumerator</span></a></li> <li><a href="functions_rela.html"><span>Related&#160;Functions</span></a></li> </ul> </div> <div id="navrow4" class="tabs3"> <ul class="tablist"> <li><a href="functions_func.html#index_a"><span>a</span></a></li> <li><a href="functions_func_b.html#index_b"><span>b</span></a></li> <li><a href="functions_func_c.html#index_c"><span>c</span></a></li> <li><a href="functions_func_d.html#index_d"><span>d</span></a></li> <li><a href="functions_func_e.html#index_e"><span>e</span></a></li> <li><a href="functions_func_f.html#index_f"><span>f</span></a></li> <li><a href="functions_func_g.html#index_g"><span>g</span></a></li> <li><a href="functions_func_h.html#index_h"><span>h</span></a></li> <li><a href="functions_func_i.html#index_i"><span>i</span></a></li> <li><a href="functions_func_k.html#index_k"><span>k</span></a></li> <li><a href="functions_func_l.html#index_l"><span>l</span></a></li> <li><a href="functions_func_m.html#index_m"><span>m</span></a></li> <li><a href="functions_func_n.html#index_n"><span>n</span></a></li> <li><a href="functions_func_o.html#index_o"><span>o</span></a></li> <li><a href="functions_func_p.html#index_p"><span>p</span></a></li> <li><a href="functions_func_q.html#index_q"><span>q</span></a></li> <li><a href="functions_func_r.html#index_r"><span>r</span></a></li> <li><a href="functions_func_s.html#index_s"><span>s</span></a></li> <li><a href="functions_func_t.html#index_t"><span>t</span></a></li> <li><a href="functions_func_u.html#index_u"><span>u</span></a></li> <li><a href="functions_func_v.html#index_v"><span>v</span></a></li> <li class="current"><a href="functions_func_w.html#index_w"><span>w</span></a></li> <li><a href="functions_func_x.html#index_x"><span>x</span></a></li> <li><a href="functions_func_~.html#index_~"><span>~</span></a></li> </ul> </div> </div><!-- top --> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="contents"> &#160; <h3><a class="anchor" id="index_w"></a>- w -</h3><ul> <li>WaveFile() : <a class="el" href="structcrap_1_1_wave_file.html#a3579a949926180dc03436a229f533a4d">crap::WaveFile</a> </li> <li>WaveFileFilter() : <a class="el" href="classcrap_1_1_wave_file_filter.html#a3cfcb3d2a4fe523d9d6ffd5c7d48e1ea">crap::WaveFileFilter</a> </li> <li>weight() : <a class="el" href="classcrap_1_1tree.html#a19ad6ba585b2c718ac1384c4fb6a054f">crap::tree&lt; T &gt;</a> , <a class="el" href="classcrap_1_1tree__map.html#adc86e2f3c17ca3322523970fbf1405b4">crap::tree_map&lt; K, V &gt;</a> </li> <li>WhitespaceMode() : <a class="el" href="classtinyxml2_1_1_x_m_l_document.html#a94b3ea2f77c9ac831723984df5a02d01">tinyxml2::XMLDocument</a> </li> <li>write() : <a class="el" href="structcrap_1_1log__channel__audio.html#a28a9c9acc9c857e40e0c6a2995f7d9cf">crap::log_channel_audio</a> , <a class="el" href="structcrap_1_1log__channel__core.html#ac0b2f6125aeff6e6cb4e7d67be3c9c84">crap::log_channel_core</a> , <a class="el" href="structcrap_1_1log__channel__network.html#a94cf47c130d05ea96c52b08d898ca2f7">crap::log_channel_network</a> , <a class="el" href="structcrap_1_1log__channel__none.html#a42266d60908df5f29eeae4c1783b0d35">crap::log_channel_none</a> , <a class="el" href="structcrap_1_1log__channel__physic.html#a2115c53dd4af1cddcc5594cbc42fafe7">crap::log_channel_physic</a> , <a class="el" href="structcrap_1_1log__channel__video.html#afd7f3f8cb6ee03908fbcbbc4ce5b9368">crap::log_channel_video</a> , <a class="el" href="structcrap_1_1log__time__date.html#a202cd42e06c6c408f373ffefa28bd822">crap::log_time_date</a> , <a class="el" href="structcrap_1_1log__time__none.html#a14e69b83387d030a6e691cc53468c4d9">crap::log_time_none</a> , <a class="el" href="structcrap_1_1log__time__time.html#ae3f317eee317c8cf9b5a4dd0cc43e881">crap::log_time_time</a> , <a class="el" href="structcrap_1_1log__time__timedate.html#a6c894c253f2a8da344f12aeeef84636c">crap::log_time_timedate</a> , <a class="el" href="structcrap_1_1log__type__assert.html#aca4ccaa24ce56a132349b8752e40f1a9">crap::log_type_assert</a> , <a class="el" href="structcrap_1_1log__type__debug.html#acf418f0c5aca6d864a913fc5438c88ec">crap::log_type_debug</a> , <a class="el" href="structcrap_1_1log__type__error.html#a5753a8d8d91fae170d08ceb5ae54fb2a">crap::log_type_error</a> , <a class="el" href="structcrap_1_1log__type__info.html#ade1f38f5e14847c98ccbbdc2fb2305b2">crap::log_type_info</a> , <a class="el" href="structcrap_1_1log__type__none.html#a0d844ed1b7b13c7ae0398da665d45919">crap::log_type_none</a> , <a class="el" href="structcrap_1_1log__type__warning.html#a1b523db5b36965a4834d94290edcdd78">crap::log_type_warning</a> </li> <li>writeData() : <a class="el" href="classcrap_1_1_network_command.html#ab05cc2392f21413b4b23c36fd2345a78">crap::NetworkCommand</a> </li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Wed Jan 7 2015 21:59:13 for Crap Engine 2 by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.9.1 </small></address> </body> </html>
{ "content_hash": "fb326a47868348edafbb04fe8dd907f1", "timestamp": "", "source": "github", "line_count": 171, "max_line_length": 154, "avg_line_length": 53.15204678362573, "alnum_prop": 0.6595885135878534, "repo_name": "stevenblaster/crapengine", "id": "562af08dfb5da925a4dd39407449397aa15e5208", "size": "9089", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/html/functions_func_w.html", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "12523661" }, { "name": "C++", "bytes": "23360766" }, { "name": "CMake", "bytes": "326783" }, { "name": "CSS", "bytes": "35671" }, { "name": "GLSL", "bytes": "8948" }, { "name": "Gnuplot", "bytes": "642" }, { "name": "HTML", "bytes": "6041656" }, { "name": "JavaScript", "bytes": "27337" }, { "name": "Lua", "bytes": "132195" }, { "name": "M", "bytes": "3824" }, { "name": "Makefile", "bytes": "64911" }, { "name": "Mathematica", "bytes": "27410" }, { "name": "Objective-C", "bytes": "113786" }, { "name": "Objective-C++", "bytes": "57542" }, { "name": "Perl", "bytes": "34534" }, { "name": "Python", "bytes": "8712" }, { "name": "Scala", "bytes": "12855" }, { "name": "Shell", "bytes": "87113" }, { "name": "SuperCollider", "bytes": "113278" } ], "symlink_target": "" }
#pragma once #include "CachedImageClient.h" #include "CachedResourceHandle.h" #include "SVGAnimatedBoolean.h" #include "SVGAnimatedPreserveAspectRatio.h" #include "SVGExternalResourcesRequired.h" #include "SVGFEImage.h" #include "SVGFilterPrimitiveStandardAttributes.h" #include "SVGURIReference.h" namespace WebCore { class SVGFEImageElement final : public SVGFilterPrimitiveStandardAttributes, public SVGURIReference, public SVGExternalResourcesRequired, public CachedImageClient { public: static Ref<SVGFEImageElement> create(const QualifiedName&, Document&); virtual ~SVGFEImageElement(); bool hasSingleSecurityOrigin() const; private: SVGFEImageElement(const QualifiedName&, Document&); void didFinishInsertingNode() override; void parseAttribute(const QualifiedName&, const AtomicString&) override; void svgAttributeChanged(const QualifiedName&) override; void notifyFinished(CachedResource&) final; void addSubresourceAttributeURLs(ListHashSet<URL>&) const override; RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; void clearResourceReferences(); void requestImageResource(); void buildPendingResource() override; InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; void removedFromAncestor(RemovalType, ContainerNode&) override; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEImageElement) DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) END_DECLARE_ANIMATED_PROPERTIES CachedResourceHandle<CachedImage> m_cachedImage; }; } // namespace WebCore
{ "content_hash": "f4a7556b60b80d17364d1b1a6f0cc193", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 95, "avg_line_length": 34.018181818181816, "alnum_prop": 0.7557455905932656, "repo_name": "gubaojian/trylearn", "id": "9f136a737b445c6d8b5aa43729f00bce5779453f", "size": "2778", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "WebLayoutCore/Source/WebCore/svg/SVGFEImageElement.h", "mode": "33188", "license": "mit", "language": [ { "name": "AspectJ", "bytes": "623" }, { "name": "Assembly", "bytes": "1942" }, { "name": "Batchfile", "bytes": "6632" }, { "name": "C", "bytes": "6629351" }, { "name": "C++", "bytes": "57418677" }, { "name": "CMake", "bytes": "1269316" }, { "name": "CSS", "bytes": "99559" }, { "name": "HTML", "bytes": "283332" }, { "name": "Java", "bytes": "267448" }, { "name": "JavaScript", "bytes": "282026" }, { "name": "Makefile", "bytes": "164797" }, { "name": "Objective-C", "bytes": "956074" }, { "name": "Objective-C++", "bytes": "3645713" }, { "name": "Perl", "bytes": "192119" }, { "name": "Python", "bytes": "39191" }, { "name": "Ragel", "bytes": "128173" }, { "name": "Roff", "bytes": "26536" }, { "name": "Ruby", "bytes": "32784" }, { "name": "Shell", "bytes": "7177" }, { "name": "Vue", "bytes": "1776" }, { "name": "Yacc", "bytes": "11866" } ], "symlink_target": "" }
using System; using System.Collections.Generic; namespace Expressive.Expressions.Binary.Bitwise { internal class BitwiseOrExpression : BinaryExpressionBase { #region Constructors public BitwiseOrExpression(IExpression lhs, IExpression rhs, Context context) : base(lhs, rhs, context) { } #endregion #region BinaryExpressionBase Members /// <inheritdoc /> protected override object EvaluateImpl(object lhsResult, IExpression rightHandSide, IDictionary<string, object> variables) => EvaluateAggregates(lhsResult, rightHandSide, variables, (l, r) => Convert.ToUInt16(l) | Convert.ToUInt16(r)); #endregion } }
{ "content_hash": "7fe747eb32d0a4791397de626ed0ac6b", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 133, "avg_line_length": 29.5, "alnum_prop": 0.6878531073446328, "repo_name": "bijington/expressive", "id": "d537e6ae997441022c20f99a410f965a69b19e07", "size": "710", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "Source/Expressive/Expressions/Binary/Bitwise/BitwiseOrExpression.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1721" }, { "name": "C#", "bytes": "543825" }, { "name": "PowerShell", "bytes": "654" } ], "symlink_target": "" }
require "helper" require_relative "../heelspec/rio_2016" class TestSpecRio < Minitest::Test context "heelspec of aqi" do setup do @klass = Heelspec::Rio2016.new end should "initialize with properties" do assert_equal("Medal Count of RIO 2016 Olympic Games", @klass.name) end should "Rank\tCode\tGold\tSilver\tBronze\tTotal\tCountry" do output_prefix = "" output = Heel::Util.capture_stdout do @klass.run([]) end assert_equal(true, output.start_with?(output_prefix)) end end end
{ "content_hash": "aa4a078ca31ae9658e2a8ac84d01e452", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 72, "avg_line_length": 25.09090909090909, "alnum_prop": 0.6612318840579711, "repo_name": "crispgm/heelbot", "id": "706298015ad20685b69127c2973028b41d3f2928", "size": "552", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/test_spec_rio.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Liquid", "bytes": "346" }, { "name": "Ruby", "bytes": "49477" } ], "symlink_target": "" }
<pre class="ttb"><code prsm class="ttm"><span class="tt18 tt1j">import</span> <span class="tt18 ttae">&#123;</span> NgModule <span class="tt18 ttae">&#125;</span> <span class="tt18 tt1j">from</span> <span class="tt18 tt3z">'@angular/core'</span><span class="tt18 ttae">;</span> <span class="tt18 tt1j">import</span> <span class="tt18 ttae">&#123;</span> CommonModule <span class="tt18 ttae">&#125;</span> <span class="tt18 tt1j">from</span> <span class="tt18 tt3z">'@angular/common'</span><span class="tt18 ttae">;</span> <span class="tt18 tt1j">import</span> <span class="tt18 ttae">&#123;</span> LyTableModule <span class="tt18 ttae">&#125;</span> <span class="tt18 tt1j">from</span> <span class="tt18 tt3z">'@alyle/ui/table'</span><span class="tt18 ttae">;</span> <span class="tt18 tt1j">import</span> <span class="tt18 ttae">&#123;</span> TableUsingNgForExampleComponent <span class="tt18 ttae">&#125;</span> <span class="tt18 tt1j">from</span> <span class="tt18 tt3z">'./table-using-ng-for-example.component'</span><span class="tt18 ttae">;</span> <span class="tt18 ttdr"><span class="tt18 ttdg ttb0">@</span><span class="tt18 tta3">NgModule</span></span><span class="tt18 ttae">(</span><span class="tt18 ttae">&#123;</span> declarations<span class="tt18 ttb0">:</span> <span class="tt18 ttae">[</span> TableUsingNgForExampleComponent <span class="tt18 ttae">]</span><span class="tt18 ttae">,</span> imports<span class="tt18 ttb0">:</span> <span class="tt18 ttae">[</span> CommonModule<span class="tt18 ttae">,</span> LyTableModule <span class="tt18 ttae">]</span> <span class="tt18 ttae">&#125;</span><span class="tt18 ttae">)</span> <span class="tt18 tt1j">export</span> <span class="tt18 tt1j">class</span> <span class="tt18 ttc8">TableUsingNgForExampleModule</span> <span class="tt18 ttae">&#123;</span> <span class="tt18 ttae">&#125;</span> </code></pre>
{ "content_hash": "dce4c4945e5951823a727ad712c3ff23", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 285, "avg_line_length": 99.36842105263158, "alnum_prop": 0.683792372881356, "repo_name": "A-l-y-l-e/Alyle-UI", "id": "04d35562487657290110c93dff4c9483d585c9d5", "size": "1888", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/api/docs/demos/table-using-ng-for-example.module.ts.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "1958186" }, { "name": "JavaScript", "bytes": "6569" }, { "name": "Shell", "bytes": "4177" }, { "name": "TypeScript", "bytes": "1142002" } ], "symlink_target": "" }
angular .module('guru', [ 'ngRoute', 'ngResource' ]) .config( ['$routeProvider', '$httpProvider', function( $routeProvider, $httpProvider ) { $httpProvider.defaults.withCredentials = true; $routeProvider.when('/', { controller: 'MainController', templateUrl: 'views/main.html' }); $routeProvider.otherwise({redirectTo: '/'}); }]) .run(['$http', function ($http) { $http.defaults.withCredentials = true; }]) .controller('MainController', ['$scope', 'CardsService', function ($scope, CardsService) { $scope.viewState = { landing: true, training: false, reviewing: false }; $scope.cardIdx = 0; $scope.cards = []; CardsService.list().then(function(res) { $scope.cards = res; }); $scope.createCard = function() { console.log('create card clicked'); }; $scope.begin = function() { $scope.viewState = { landing: false, training: true, reviewing: false }; } $scope.$watch('cardIdx', function (val) { if ($scope.cardIdx >= $scope.cards.length) { $scope.viewState = { landing: false, training: false, reviewing: true }; } }) }]) .directive('guruCard', ['CardsService', function (CardsService) { return { replace: true, templateUrl: "views/guru-card.html", scope: { card: '=', cardIdx: '=' }, link: function($scope, el, attrs) { function init() { $scope.viewState = { obverse: true }; } function nextCard() { $scope.cardIdx++; $scope.viewState.obverse = true; } $scope.flipCard = function() { $scope.viewState.obverse = !$scope.viewState.obverse; }; $scope.gradeCard = function(grade) { nextCard(); }; init(); } }; }]) .factory('CardsService', ['$q', 'CardsData', function ($q, CardsData) { function list() { var data = CardsData; var deferred = $q.defer(); deferred.resolve(data); return deferred.promise; } return { list: list }; }]) .factory('CardsData', function () { return [ { id: 1, question: 'What\'s the capital of Tunisia?', answer: 'Tunis', easinessFactor: 3, tags: ['geography', 'capitals'] }, { id: 2, question: 'What\'s the Capital of El Salvidor?', answer: 'San Salvador', easinessFactor: 3, tags: ['geography', 'capitals'] }, { id: 3, question: 'What\'s the Capital of Oklahoma?', answer: 'Oklahoma City', easinessFactor: 3, tags: ['geography', 'capitals'] } ]; }) ;
{ "content_hash": "daf37f0c77ad340af71f67c09ebcaa50", "timestamp": "", "source": "github", "line_count": 134, "max_line_length": 92, "avg_line_length": 21.33582089552239, "alnum_prop": 0.5120671563483735, "repo_name": "adamgibbons/guru", "id": "7554c6dbbb71ccd1500b8cb0a82204ba4a10bc8f", "size": "2859", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/javascripts/guru.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "907" }, { "name": "HTML", "bytes": "1979" }, { "name": "JavaScript", "bytes": "5014" } ], "symlink_target": "" }
namespace AjScript.Tests { using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] public class TypeUtilitiesTests { [TestMethod] public void GetTypeByName() { Type type = TypeUtilities.GetType("System.Int32"); Assert.IsNotNull(type); Assert.AreEqual(type, typeof(int)); } [TestMethod] public void GetTypeInAnotherAssembly() { Type type = TypeUtilities.GetType(new Context(), "System.Data.DataSet"); Assert.IsNotNull(type); Assert.AreEqual(type, typeof(System.Data.DataSet)); } [TestMethod] [ExpectedException(typeof(InvalidOperationException), "Unknown Type 'Foo.Bar'")] public void RaiseIfUnknownType() { TypeUtilities.GetType(new Context(), "Foo.Bar"); } [TestMethod] public void AsType() { Assert.IsNotNull(TypeUtilities.AsType("System.IO.File")); Assert.IsNull(TypeUtilities.AsType("Foo.Bar")); } [TestMethod] public void IsNamespace() { Assert.IsTrue(TypeUtilities.IsNamespace("System")); Assert.IsTrue(TypeUtilities.IsNamespace("AjScript")); Assert.IsTrue(TypeUtilities.IsNamespace("AjScript.Language")); Assert.IsTrue(TypeUtilities.IsNamespace("System.IO")); Assert.IsTrue(TypeUtilities.IsNamespace("System.Data")); Assert.IsFalse(TypeUtilities.IsNamespace("Foo.Bar")); } [TestMethod] public void GetValueFromType() { Assert.IsFalse((bool)TypeUtilities.InvokeTypeMember(typeof(System.IO.File), "Exists", new object[] { "unknown.txt" })); } [TestMethod] public void GetValueFromEnum() { Assert.AreEqual(System.UriKind.RelativeOrAbsolute, TypeUtilities.InvokeTypeMember(typeof(System.UriKind), "RelativeOrAbsolute", null)); } } }
{ "content_hash": "01be684c0e020561a1062d4204e77e78", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 147, "avg_line_length": 31.63768115942029, "alnum_prop": 0.5858909757214842, "repo_name": "tario/AjScript-migrated", "id": "ca7474be39e1093c2913dafcc31c46d7d83b91c2", "size": "2185", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Src/AjScript.Tests/TypeUtilitiesTests.cs", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C#", "bytes": "209853" }, { "name": "JavaScript", "bytes": "1489" } ], "symlink_target": "" }
using RootSystem = System; using System.Linq; using System.Collections.Generic; namespace Windows.Kinect { // // Windows.Kinect.CoordinateMappingChangedEventArgs // public sealed partial class CoordinateMappingChangedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper { internal RootSystem.IntPtr _pNative; RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } // Constructors and Finalizers internal CoordinateMappingChangedEventArgs(RootSystem.IntPtr pNative) { _pNative = pNative; Windows_Kinect_CoordinateMappingChangedEventArgs_AddRefObject(ref _pNative); } ~CoordinateMappingChangedEventArgs() { Dispose(false); } [RootSystem.Runtime.InteropServices.DllImport("XboxOneUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)] private static extern void Windows_Kinect_CoordinateMappingChangedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative); [RootSystem.Runtime.InteropServices.DllImport("XboxOneUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)] private static extern void Windows_Kinect_CoordinateMappingChangedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative); private void Dispose(bool disposing) { if (_pNative == RootSystem.IntPtr.Zero) { return; } Helper.NativeObjectCache.RemoveObject<CoordinateMappingChangedEventArgs>(_pNative); Windows_Kinect_CoordinateMappingChangedEventArgs_ReleaseObject(ref _pNative); _pNative = RootSystem.IntPtr.Zero; } } }
{ "content_hash": "bf8bf43ee4384aec262ca2db91d08382", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 153, "avg_line_length": 38.41304347826087, "alnum_prop": 0.7057159026598755, "repo_name": "FlappyChicken/Kinect2014", "id": "3ff5f3b0f8305fa33a5aa53682fd4c3364f00357", "size": "1767", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "DumpingGround/anjul/Assets/Standard Assets/Windows/Kinect/CoordinateMappingChangedEventArgs.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "496091" }, { "name": "Shell", "bytes": "9" } ], "symlink_target": "" }
<?php namespace hipanel\modules\finance\models\decorators\server; use hipanel\inputs\OptionsInput; use Yii; class IspResourceDecorator extends AbstractServerResourceDecorator { public function displayTitle() { return Yii::t('hipanel.finance.resource', 'ISP Manager'); } public function displayPrepaidAmount() { return $this->getPrepaidQuantity() > 0 ? $this->amountOptions()[1] : $this->amountOptions()[0]; } public function prepaidAmountType() { return new OptionsInput($this->amountOptions()); } private function amountOptions() { return [0 => Yii::t('hipanel', 'Disabled'), 1 => Yii::t('hipanel', 'Enabled')]; } }
{ "content_hash": "f11cc29a166f83d87ade4ba70d8c3e8a", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 103, "avg_line_length": 23.466666666666665, "alnum_prop": 0.6548295454545454, "repo_name": "hiqdev/hipanel-module-finance", "id": "8c75b37b7bde867e024964504604629d64fc498b", "size": "938", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/models/decorators/server/IspResourceDecorator.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "1378" }, { "name": "JavaScript", "bytes": "40208" }, { "name": "PHP", "bytes": "1275646" }, { "name": "TypeScript", "bytes": "31901" } ], "symlink_target": "" }
'use strict'; describe('TextParameter: input/text/textParameter.js', function () { describe('Default construction', function () { var textParameter; before(function (done) { textParameter = new MyScript.TextParameter(); done(); }); it('Check initial state', function () { expect(textParameter).to.be.an('object'); expect(textParameter).to.be.an.instanceOf(MyScript.AbstractParameter); expect(textParameter).to.be.an.instanceOf(MyScript.TextParameter); expect(textParameter).to.have.ownProperty('textProperties'); }); it('Get language', function () { expect(textParameter.getLanguage()).to.be.undefined; }); it('Set language', function () { textParameter.setLanguage('en_US'); expect(textParameter.getLanguage()).to.equal('en_US'); }); it('Get input mode', function () { expect(textParameter.getInputMode()).to.be.undefined; }); it('Set input mode', function () { textParameter.setInputMode('CURSIVE'); expect(textParameter.getInputMode()).to.equal('CURSIVE'); }); it('Get content types', function () { expect(textParameter.getContentTypes()).to.be.undefined; }); it('Set content types', function () { textParameter.setContentTypes(['text']); expect(textParameter.getContentTypes().length).to.equal(1); expect(textParameter.getContentTypes()[0]).to.equal('text'); }); it('Get SK', function () { expect(textParameter.getSubsetKnowledges()).to.be.undefined; }); it('Set SK', function () { textParameter.setSubsetKnowledges(['digit']); expect(textParameter.getSubsetKnowledges().length).to.equal(1); expect(textParameter.getSubsetKnowledges()[0]).to.equal('digit'); }); it('Get user resources', function () { expect(textParameter.getUserResources()).to.be.empty; }); it('Set user resources', function () { textParameter.setUserResources(['myResource1', 'myResource2']); expect(textParameter.getUserResources().length).to.equal(2); expect(textParameter.getUserResources()[0]).to.equal('myResource1'); expect(textParameter.getUserResources()[1]).to.equal('myResource2'); }); it('Get user LK words', function () { expect(textParameter.getUserLkWords()).to.be.empty; }); it('Set user LK words', function () { textParameter.setUserLkWords(['city', 'country']); expect(textParameter.getUserLkWords().length).to.equal(2); expect(textParameter.getUserLkWords()[0]).to.equal('city'); expect(textParameter.getUserLkWords()[1]).to.equal('country'); }); it('Get result detail', function () { expect(textParameter.getResultDetail()).to.be.empty; }); it('Set result detail', function () { textParameter.setResultDetail('CHARACTER'); expect(textParameter.getResultDetail()).to.equal('CHARACTER'); }); it('Get properties', function () { expect(textParameter.getTextProperties()).to.be.an.instanceOf(MyScript.TextProperties); }); it('Set properties', function () { textParameter.setTextProperties(new MyScript.TextProperties()); expect(textParameter.getTextProperties()).not.to.be.undefined; }); }); });
{ "content_hash": "05ca5938a0efdc2c5c9399fe1db1e313", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 99, "avg_line_length": 36.4, "alnum_prop": 0.5873626373626374, "repo_name": "helloncanella/MyScriptJS", "id": "8c309e1e8e1339965fcf78b2361aa9f2b909d943", "size": "3640", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "test/unit/input/text/textParameter.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "9895" }, { "name": "HTML", "bytes": "74613" }, { "name": "JavaScript", "bytes": "1387185" }, { "name": "Makefile", "bytes": "103" } ], "symlink_target": "" }
ACCEPTED #### According to Index Fungorum #### Published in null #### Original name Alectoria viridescens var. prostrata Gyeln. ### Remarks null
{ "content_hash": "46028d56d8d73a7b1322638524aeec89", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 43, "avg_line_length": 11.384615384615385, "alnum_prop": 0.722972972972973, "repo_name": "mdoering/backbone", "id": "da1e70b71a6f612eeaa7e81778163628395d62a9", "size": "215", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Ascomycota/Lecanoromycetes/Lecanorales/Parmeliaceae/Alectoria/Alectoria viridescens/Alectoria viridescens prostrata/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package co.com.codesoftware.server.nsigemco; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Clase Java para obtieneSubCuentasFiltroResponse complex type. * * <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. * * <pre> * &lt;complexType name="obtieneSubCuentasFiltroResponse"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="return" type="{http://nsigemco.server.codesoftware.com.co/}subCuentaEntity" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "obtieneSubCuentasFiltroResponse", propOrder = { "_return" }) public class ObtieneSubCuentasFiltroResponse { @XmlElement(name = "return") protected List<SubCuentaEntity> _return; /** * Gets the value of the return property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the return property. * * <p> * For example, to add a new item, do as follows: * <pre> * getReturn().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link SubCuentaEntity } * * */ public List<SubCuentaEntity> getReturn() { if (_return == null) { _return = new ArrayList<SubCuentaEntity>(); } return this._return; } }
{ "content_hash": "bc4e3801a8ce418870d2073f5b832652", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 142, "avg_line_length": 28.666666666666668, "alnum_prop": 0.6516683518705764, "repo_name": "codesoftware/NSIGEMCO", "id": "977e4e6bf45936fd678471a2d9d319d2d24cb254", "size": "1978", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/co/com/codesoftware/server/nsigemco/ObtieneSubCuentasFiltroResponse.java", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "375397" }, { "name": "HTML", "bytes": "346771" }, { "name": "Java", "bytes": "3225146" } ], "symlink_target": "" }
<?php namespace Smartling\Tests; use Smartling\SmartlingApi; /** * Test class for SmartlingAPI. */ class SmartlingApiTest extends \PHPUnit_Framework_TestCase { /** * @var \PHPUnit_Framework_MockObject_MockObject|\Smartling\SmartlingApi */ protected $object; /** * @var string */ protected $apiKey = 'TEST_API_KEY'; /** * @var string */ protected $projectId = 'TEST_PROJECT_ID'; /** * @var string */ protected $validResponse = '{"response":{"data":{"wordCount":1629,"stringCount":503,"overWritten":false},"code":"SUCCESS","messages":[]}}'; /** * @var string */ protected $responseWithException = '{"response":{"data":null,"code":"VALIDATION_ERROR","messages":["Validation error text"]}}'; /** * @var \PHPUnit_Framework_MockObject_MockObject|\GuzzleHttp\ClientInterface */ protected $client; /** * @var string */ protected $streamPlaceholder = 'stream'; /** * @var \PHPUnit_Framework_MockObject_MockObject|\Psr\Http\Message\StreamInterface */ protected $responseMock; /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->client = $this->getMockBuilder('GuzzleHttp\\ClientInterface') ->setMethods(['request', 'send', 'sendAsync', 'requestAsync', 'getConfig']) ->disableOriginalConstructor() ->getMock(); $this->responseMock = $this->getMockBuilder('Psr\\Http\\Message\\ResponseInterface') ->disableOriginalConstructor() ->getMock(); $this->responseMock->expects($this->any()) ->method('getBody') ->willReturn($this->validResponse); $this->object = $this->getMockBuilder('Smartling\\SmartlingApi') ->setMethods(['readFile']) ->setConstructorArgs([$this->apiKey, $this->projectId, $this->client]) ->getMock(); $this->object->expects($this->any()) ->method('readFile') ->willReturn($this->streamPlaceholder); } /** * Invokes protected or private method of given object. * * @param object $object * Object with protected or private method to invoke. * @param string $methodName * Name of the property to invoke. * @param array $parameters * Array of parameters to be passed to invoking method. * * @return mixed * Value invoked method will return or exception. */ protected function invokeMethod($object, $methodName, array $parameters = []) { $reflection = new \ReflectionClass(get_class($object)); $method = $reflection->getMethod($methodName); $method->setAccessible(true); return $method->invokeArgs($object, $parameters); } /** * Reads protected or private property of given object. * * @param object $object * Object with protected or private property. * @param string $propertyName * Name of the property to access. * * @return mixed * Value of read property. */ protected function readProperty($object, $propertyName) { $reflection = new \ReflectionClass(get_class($object)); $property = $reflection->getProperty($propertyName); $property->setAccessible(true); return $property->getValue($object); } /** * Tests constructor. * * @param string $apiKey * Api key string. * @param string $projectId * Project Id string. * @param \GuzzleHttp\ClientInterface $client * Mock of Guzzle http client instance. * @param string|null $expected_base_url * Base Url string that will be used as based url. * @param string|null $actual_base_url * Base Url string that will be passed as and argument to constructor. * * @covers \Smartling\SmartlingApi::__construct * * @dataProvider constructorDataProvider */ public function testConstructor($apiKey, $projectId, $client, $expected_base_url, $actual_base_url) { $smartlingApi = new SmartlingApi($apiKey, $projectId, $client, $actual_base_url); $this->assertEquals($expected_base_url, $this->readProperty($smartlingApi, 'baseUrl')); $this->assertEquals($apiKey, $this->readProperty($smartlingApi, 'apiKey')); $this->assertEquals($projectId, $this->readProperty($smartlingApi, 'projectId')); $this->assertEquals($client, $this->readProperty($smartlingApi, 'httpClient')); } /** * Data provider for testConstructor method. * * Tests if base url will be set correctly depending on income baseurl * and mode. * * @return array */ public function constructorDataProvider() { $mockedClient = $this->getMockBuilder('GuzzleHttp\\ClientInterface') ->setMethods(['request', 'send', 'sendAsync', 'requestAsync', 'getConfig']) ->disableOriginalConstructor() ->getMock(); return [ ['api-key', 'product-id', $mockedClient, SmartlingApi::DEFAULT_SERVICE_URL, null], ['api-key', 'product-id', $mockedClient, SmartlingApi::DEFAULT_SERVICE_URL, SmartlingApi::DEFAULT_SERVICE_URL], ['api-key', 'product-id', $mockedClient, SmartlingApi::DEFAULT_SERVICE_URL, SmartlingApi::DEFAULT_SERVICE_URL . '/'], ['api-key', 'product-id', $mockedClient, 'https://www.google.com.ua/webhp', 'https://www.google.com.ua/webhp'], ]; } /** * @covers \Smartling\SmartlingApi::uploadFile */ public function testUploadFile() { $this->client->expects($this->once()) ->method('request') ->with('POST', SmartlingApi::DEFAULT_SERVICE_URL . '/file/upload', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'multipart' => [ [ 'name' => 'file', 'contents' => $this->streamPlaceholder, ], [ 'name' => 'approved', 'contents' => '1' ], [ 'name' => 'fileUri', 'contents' => 'test.xml' ], [ 'name' => 'fileType', 'contents' => 'xml' ], [ 'name' => 'apiKey', 'contents' => $this->apiKey, ], [ 'name' => 'projectId', 'contents' => $this->projectId, ], ], ]) ->willReturn($this->responseMock); $this->object->uploadFile('tests/resources/test.xml', 'test.xml', 'xml', ['approved' => TRUE]); } /** * @covers \Smartling\SmartlingApi::downloadFile * * @dataProvider downloadFileParams */ public function testDownloadFile($options, $expected_translated_file) { $this->responseMock = $this->getMockBuilder('Psr\\Http\\Message\\ResponseInterface') ->disableOriginalConstructor() ->getMock(); $this->responseMock->expects($this->any()) ->method('getBody') ->willReturn($expected_translated_file); $this->client->expects($this->once()) ->method('request') ->with('GET', SmartlingApi::DEFAULT_SERVICE_URL . '/file/get', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'query' => $options + [ 'fileUri' => 'test.xml', 'locale' => 'en-EN', 'apiKey' => $this->apiKey, 'projectId' => $this->projectId, ], ]) ->willReturn($this->responseMock); $actual_xml = $this->object->downloadFile('test.xml', 'en-EN', $options); $this->assertEquals($expected_translated_file, $actual_xml); } public function downloadFileParams() { return [ [['retrievalType' => 'pseudo'], '<?xml version="1.0"?><response><item key="6"></item></response>'], [[], '<?xml version="1.0"?><response><item key="6"></item></response>'], [[], '{"string1":"translation1", "string2":"translation2"}'], ]; } /** * @covers \Smartling\SmartlingApi::getStatus */ public function testGetStatus() { $this->client->expects($this->once()) ->method('request') ->with('GET', SmartlingApi::DEFAULT_SERVICE_URL . '/file/status', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'query' => [ 'fileUri' => 'test.xml', 'locale' => 'en-EN', 'apiKey' => $this->apiKey, 'projectId' => $this->projectId, ], ]) ->willReturn($this->responseMock); $this->object->getStatus('test.xml', 'en-EN'); } /** * @covers \Smartling\SmartlingApi::getLocaleList */ public function testGetLocaleList() { $this->client->expects($this->once()) ->method('request') ->with('GET', SmartlingApi::DEFAULT_SERVICE_URL . '/project/locale/list', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'query' => [ 'apiKey' => $this->apiKey, 'projectId' => $this->projectId, ], ]) ->willReturn($this->responseMock); $this->object->getLocaleList(); } /** * @covers \Smartling\SmartlingApi::getList */ public function testGetList() { $this->client->expects($this->once()) ->method('request') ->with('GET', SmartlingApi::DEFAULT_SERVICE_URL . '/file/list', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'query' => [ 'locale' => 'en-EN', 'apiKey' => $this->apiKey, 'projectId' => $this->projectId, ], ]) ->willReturn($this->responseMock); $this->object->getList('en-EN'); } /** * @covers \Smartling\SmartlingApi::renameFile */ public function testRenameFile() { $this->client->expects($this->once()) ->method('request') ->with('POST', SmartlingApi::DEFAULT_SERVICE_URL . '/file/rename', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'multipart' => [ [ 'name' => 'fileUri', 'contents' => 'test.xml' ], [ 'name' => 'newFileUri', 'contents' => 'new_test.xml' ], [ 'name' => 'apiKey', 'contents' => $this->apiKey, ], [ 'name' => 'projectId', 'contents' => $this->projectId, ], ], ]) ->willReturn($this->responseMock); $this->object->renameFile('test.xml', 'new_test.xml'); } /** * @covers \Smartling\SmartlingApi::getAuthorizedLocales */ public function testGetAuthorizedLocales() { $this->client->expects($this->once()) ->method('request') ->with('GET', SmartlingApi::DEFAULT_SERVICE_URL . '/file/authorized_locales', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'query' => [ 'fileUri' => 'test.xml', 'apiKey' => $this->apiKey, 'projectId' => $this->projectId, ], ]) ->willReturn($this->responseMock); $this->object->getAuthorizedLocales('test.xml'); } /** * @covers \Smartling\SmartlingApi::import */ public function testImport() { $this->client->expects($this->once()) ->method('request') ->with('POST', SmartlingApi::DEFAULT_SERVICE_URL . '/file/import', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'multipart' => [ [ 'name' => 'file', 'contents' => $this->streamPlaceholder, ], [ 'name' => 'overwrite', 'contents' => '0', ], [ 'name' => 'fileUri', 'contents' => 'test.xml' ], [ 'name' => 'fileType', 'contents' => 'xml' ], [ 'name' => 'locale', 'contents' => 'en-EN' ], [ 'name' => 'translationState', 'contents' => 'PUBLISHED' ], [ 'name' => 'apiKey', 'contents' => $this->apiKey, ], [ 'name' => 'projectId', 'contents' => $this->projectId, ], ], ]) ->willReturn($this->responseMock); $this->object->import('test.xml', 'xml', 'en-EN', 'tests/resources/test.xml', 'PUBLISHED', ['overwrite' => FALSE]); } /** * @covers \Smartling\SmartlingApi::deleteFile */ public function testDeleteFile() { $this->client->expects($this->once()) ->method('request') ->with('DELETE', SmartlingApi::DEFAULT_SERVICE_URL . '/file/delete', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'query' => [ 'fileUri' => 'test.xml', 'apiKey' => $this->apiKey, 'projectId' => $this->projectId, ], ]) ->willReturn($this->responseMock); $this->object->deleteFile('test.xml'); } /** * @covers \Smartling\SmartlingApi::getContextStats */ public function testGetContextStats() { $this->client->expects($this->once()) ->method('request') ->with('GET', SmartlingApi::DEFAULT_SERVICE_URL . '/context/html', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'query' => [ 'apiKey' => $this->apiKey, 'projectId' => $this->projectId, ], ]) ->willReturn($this->responseMock); $this->object->getContextStats([]); } /** * @covers \Smartling\SmartlingApi::uploadContext */ public function testUploadContext() { $this->client->expects($this->once()) ->method('request') ->with('POST', SmartlingApi::DEFAULT_SERVICE_URL . '/context/html', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'multipart' => [ [ 'name' => 'apiKey', 'contents' => $this->apiKey, ], [ 'name' => 'projectId', 'contents' => $this->projectId, ] ], ]) ->willReturn($this->responseMock); $this->object->uploadContext([]); } /** * @covers \Smartling\SmartlingApi::sendRequest * @expectedException \Smartling\SmartlingApiException * @expectedExceptionMessage Validation error text */ public function testValidationErrorSendRequest() { $response = $this->getMockBuilder('Psr\\Http\\Message\\ResponseInterface') ->disableOriginalConstructor() ->getMock(); $response->expects($this->any()) ->method('getStatusCode') ->willReturn(400); $response->expects($this->any()) ->method('getBody') ->willReturn($this->responseWithException); $this->client->expects($this->once()) ->method('request') ->with('GET', SmartlingApi::DEFAULT_SERVICE_URL . '/context/html', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'query' => [ 'apiKey' => $this->apiKey, 'projectId' => $this->projectId, ], ]) ->willReturn($response); $this->invokeMethod($this->object, 'sendRequest', ['context/html', [], 'GET']); } /** * @covers \Smartling\SmartlingApi::sendRequest * @expectedException \Smartling\SmartlingApiException * @expectedExceptionMessage Bad response format from Smartling */ public function testBadJsonFormatSendRequest() { $response = $this->getMockBuilder('Psr\\Http\\Message\\ResponseInterface') ->disableOriginalConstructor() ->getMock(); $response->expects($this->any()) ->method('getStatusCode') ->willReturn(200); $response->expects($this->any()) ->method('getBody') ->willReturn(rtrim($this->responseWithException, '}')); $this->client->expects($this->once()) ->method('request') ->with('GET', SmartlingApi::DEFAULT_SERVICE_URL . '/context/html', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'query' => [ 'apiKey' => $this->apiKey, 'projectId' => $this->projectId, ], ]) ->willReturn($response); $this->invokeMethod($this->object, 'sendRequest', ['context/html', [], 'GET']); } /** * @covers \Smartling\SmartlingApi::sendRequest * @expectedException \Smartling\SmartlingApiException * @expectedExceptionMessage Bad response format from Smartling */ public function testBadJsonFormatInErrorMessageSendRequest() { $response = $this->getMockBuilder('Psr\\Http\\Message\\ResponseInterface') ->disableOriginalConstructor() ->getMock(); $response->expects($this->any()) ->method('getStatusCode') ->willReturn(401); $response->expects($this->any()) ->method('getBody') ->willReturn(rtrim($this->responseWithException, '}')); $this->client->expects($this->once()) ->method('request') ->with('GET', SmartlingApi::DEFAULT_SERVICE_URL . '/context/html', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'query' => [ 'apiKey' => $this->apiKey, 'projectId' => $this->projectId, ], ]) ->willReturn($response); $this->invokeMethod($this->object, 'sendRequest', ['context/html', [], 'GET']); } /** * @param string $uri * @param array $requestData * @param string $method * @param array $params * * @covers \Smartling\SmartlingApi::sendRequest * @dataProvider sendRequestValidProvider */ public function testSendRequest($uri, $requestData, $method, $params) { $this->client->expects($this->once()) ->method('request') ->with($method, SmartlingApi::DEFAULT_SERVICE_URL . '/' .$uri, $params) ->willReturn($this->responseMock); $result = $this->invokeMethod($this->object, 'sendRequest', [$uri, $requestData, $method]); $this->assertEquals(['wordCount' => 1629, 'stringCount' => 503, 'overWritten' => false], $result); } /** * Data provider callback for testSendRequest method. * * @return array */ public function sendRequestValidProvider() { return [ [ 'uri', [], 'GET', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'query' => [ 'apiKey' => $this->apiKey, 'projectId' => $this->projectId, ], ] ], [ 'uri', [ 'key' => 'value', 'boolean_false' => FALSE, 'boolean_true' => TRUE, 'file' => './tests/resources/test.xml' ], 'POST', [ 'headers' => ['Accept' => 'application/json'], 'http_errors' => FALSE, 'multipart' => [ [ 'name' => 'file', 'contents' => $this->streamPlaceholder, ], [ 'name' => 'key', 'contents' => 'value', ], [ 'name' => 'boolean_false', 'contents' => '0', ], [ 'name' => 'boolean_true', 'contents' => '1', ], [ 'name' => 'apiKey', 'contents' => $this->apiKey, ], [ 'name' => 'projectId', 'contents' => $this->projectId, ] ], ] ] ]; } /** * @covers \Smartling\SmartlingApi::readFile */ public function testReadFile() { $validFilePath = './tests/resources/test.xml'; $smartlingApi = $this->getMockBuilder('Smartling\\SmartlingApi') ->setConstructorArgs([$this->apiKey, $this->projectId, $this->client]) ->getMock(); $stream = $this->invokeMethod($smartlingApi, 'readFile', [$validFilePath]); $this->assertEquals('stream', get_resource_type($stream)); } /** * @covers \Smartling\SmartlingApi::readFile * * @expectedException \Smartling\SmartlingApiException * @expectedExceptionMessage File unexisted was not able to be read. */ public function testFailedReadFile() { $invalidFilePath = 'unexisted'; $smartlingApi = $this->getMockBuilder('Smartling\\SmartlingApi') ->setConstructorArgs([$this->apiKey, $this->projectId, $this->client]) ->getMock(); $this->invokeMethod($smartlingApi, 'readFile', [$invalidFilePath]); } }
{ "content_hash": "780fdf4013c5e7c32d9e3568ba361e2c", "timestamp": "", "source": "github", "line_count": 697, "max_line_length": 143, "avg_line_length": 34.3428981348637, "alnum_prop": 0.4713205497764966, "repo_name": "M1r1k/api-sdk-php", "id": "89a227f15e5cd3a6270061f86519c150082dc7e2", "size": "23937", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/SmartlingApiTest.php", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "PHP", "bytes": "42451" } ], "symlink_target": "" }
DOCS_TO_UPDATE_FOLDER=docs/content if [ $# != 2 ]; then echo "Invalid number of arguments" 1>&2 echo "Usage: $0 ic-version helm-chart-version" 1>&2 exit 1 fi ic_version=$1 helm_chart_version=$2 todays_date=$(date '+%d %b %Y') prev_ic_version=$(echo $ic_version | awk -F. '{ printf("%s\\.%s\\.%d", $1, $2, $3-1) }') prev_helm_chart_version=$(echo $helm_chart_version | awk -F. '{ printf("%s\\.%s\\.%d", $1, $2, $3-1) }') # update docs hack/common-release-prep.sh $prev_ic_version $ic_version $prev_helm_chart_version $helm_chart_version # update docs CHANGELOG for minor release sed -i "" "8r hack/minor-changelog-template.txt" $DOCS_TO_UPDATE_FOLDER/releases.md sed -i "" -e "s/%%TITLE%%/## NGINX Ingress Controller $ic_version/g" -e "s/%%IC_VERSION%%/$ic_version/g" -e "s/%%HELM_CHART_VERSION%%/$helm_chart_version/g" -e "s/%%DATE%%/$todays_date/g" $DOCS_TO_UPDATE_FOLDER/releases.md
{ "content_hash": "34a36206dc1e7da018c3e2eec29e4564", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 222, "avg_line_length": 41.04545454545455, "alnum_prop": 0.6489479512735327, "repo_name": "nginxinc/kubernetes-ingress", "id": "c94c707dde9075ea01a8b0f4e7038136320c0286", "size": "1148", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "hack/prepare-minor-release.sh", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "17266" }, { "name": "Go", "bytes": "2018886" }, { "name": "JavaScript", "bytes": "12899" }, { "name": "Makefile", "bytes": "11737" }, { "name": "Mustache", "bytes": "2980" }, { "name": "Python", "bytes": "1037476" }, { "name": "Shell", "bytes": "11201" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>fundamental-arithmetics: 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.10.0 / fundamental-arithmetics - 8.6.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> fundamental-arithmetics <small> 8.6.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-06-12 16:57:09 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-06-12 16:57:09 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.10.0 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.08.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.08.1 Official release 4.08.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.3 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/fundamental-arithmetics&quot; license: &quot;LGPL&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/FundamentalArithmetics&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} ] tags: [ &quot;keyword: arithmetic&quot; &quot;keyword: number theory&quot; &quot;category: Mathematics/Arithmetic and Number Theory/Miscellaneous&quot; &quot;date: 2008-02-1&quot; ] authors: [ &quot;Sébastien Briais &lt;sebastien.briais at ens-lyon.fr&gt; [http://perso.ens-lyon.fr/sebastien.briais/]&quot; ] bug-reports: &quot;https://github.com/coq-contribs/fundamental-arithmetics/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/fundamental-arithmetics.git&quot; synopsis: &quot;Fundamental theorems of arithmetic&quot; description: &quot;http://perso.ens-lyon.fr/sebastien.briais/tools/Arith_080201.tar.gz&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/fundamental-arithmetics/archive/v8.6.0.tar.gz&quot; checksum: &quot;md5=bc916a69028cf2aacdce0c8140a1f7c7&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-fundamental-arithmetics.8.6.0 coq.8.10.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.10.0). The following dependencies couldn&#39;t be met: - coq-fundamental-arithmetics -&gt; coq &lt; 8.7~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) 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-fundamental-arithmetics.8.6.0</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": "64c7348d33085da8ab02697d047c8f94", "timestamp": "", "source": "github", "line_count": 162, "max_line_length": 181, "avg_line_length": 42.623456790123456, "alnum_prop": 0.5482983345401883, "repo_name": "coq-bench/coq-bench.github.io", "id": "f66d4a4f8e079a65e6332059c5fb0ae1e47054ac", "size": "6931", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.08.1-2.0.5/released/8.10.0/fundamental-arithmetics/8.6.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
package com.example.coolweather.db; import org.litepal.crud.DataSupport; /** * Created by BYX on 2016-12-28. */ public class Province extends DataSupport { private int id; private String provinceName; private int provinceCode; public int getId() { return id; } public String getProvinceName() { return provinceName; } public int getProvinceCode() { return provinceCode; } public void setId(int id) { this.id = id; } public void setProvinceName(String provinceName) { this.provinceName = provinceName; } public void setProvinceCode(int provinceCode) { this.provinceCode = provinceCode; } }
{ "content_hash": "87336ff0183420620fca8f02df617abe", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 54, "avg_line_length": 17.775, "alnum_prop": 0.639943741209564, "repo_name": "angrybirds0527/coolweather", "id": "0cfda049727e25aeb4bc783e5a87cc25484b1654", "size": "711", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/example/coolweather/db/Province.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "32851" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "ce6055d5552f9d9370eefa96a39298a0", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "f3c4f859097883387462da9be8e7afaccf04ed59", "size": "172", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Rosales/Rhamnaceae/Sageretia/Sageretia ramosa/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package net.centro.rtb.monitoringcenter.infos; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.apache.commons.lang3.SystemUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FilenameFilter; import java.lang.management.ManagementFactory; import java.lang.management.OperatingSystemMXBean; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * This class holds the information about the operating system that hosts this application. * * @see OperatingSystemMXBean */ @JsonIgnoreProperties(ignoreUnknown = true) public class OperatingSystemInfo { private static final Logger logger = LoggerFactory.getLogger(OperatingSystemInfo.class); private static final List<Pattern> LINUX_DISTRIBUTION_PATTERNS = Collections.unmodifiableList(Arrays.asList( Pattern.compile("PRETTY_NAME=\"(.+)\""), Pattern.compile("DISTRIB_DESCRIPTION=\"(.+)\"")) ); private String name; private String version; private String distributionName; private String architecture; private int numberOfLogicalProcessors; private long physicalMemorySizeInBytes; private long swapSpaceSizeInBytes; private Map<String, Long> diskSpaceInBytesByRootPaths; private OperatingSystemInfo() { } public static OperatingSystemInfo create() { OperatingSystemInfo operatingSystemInfo = new OperatingSystemInfo(); OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean(); operatingSystemInfo.name = operatingSystemMXBean.getName(); operatingSystemInfo.version = operatingSystemMXBean.getVersion(); if (SystemUtils.IS_OS_LINUX) { operatingSystemInfo.distributionName = resolveLinuxDistributionName(); } operatingSystemInfo.architecture = operatingSystemMXBean.getArch(); operatingSystemInfo.numberOfLogicalProcessors = operatingSystemMXBean.getAvailableProcessors(); if (com.sun.management.OperatingSystemMXBean.class.isAssignableFrom(operatingSystemMXBean.getClass())) { com.sun.management.OperatingSystemMXBean sunOsMxBean = com.sun.management.OperatingSystemMXBean.class.cast(operatingSystemMXBean); operatingSystemInfo.physicalMemorySizeInBytes = sunOsMxBean.getTotalPhysicalMemorySize(); operatingSystemInfo.swapSpaceSizeInBytes = sunOsMxBean.getTotalSwapSpaceSize(); } Map<String, Long> diskSpaceInBytesByRootPaths = new HashMap<>(); for (File rootFile : File.listRoots()) { diskSpaceInBytesByRootPaths.put(rootFile.getAbsolutePath(), rootFile.getTotalSpace()); } operatingSystemInfo.diskSpaceInBytesByRootPaths = diskSpaceInBytesByRootPaths; return operatingSystemInfo; } /** * Retrieves the name of the operating system. For Linux, this method simply returns "Linux"; method * {@link #getDistributionName()} can then be utilized to retrieve the distribution name and version. * * @see OperatingSystemMXBean#getName() * @return the name of the operating system. */ public String getName() { return name; } /** * Retrieves the version of the operating system. For Linux, kernel version is returned. * * @see OperatingSystemMXBean#getVersion() * @return the version of the operating system. */ public String getVersion() { return version; } /** * Retrieves the name of the operating system distribution. Currently, this method only supports Linux * distributions. For instance, for a Debian 8, it may return "Debian GNU/Linux 8 (jessie)". * * @return the name of the operating system distribution. */ public String getDistributionName() { return distributionName; } /** * Retrieves the operating system architecture. * * @see OperatingSystemMXBean#getArch() * @return the operating system architecture. */ public String getArchitecture() { return architecture; } /** * Retrieves the number of logical processors. Logical processors are individual cores, summed up for all sockets * and, possibly, multiplied by a factor of two whenever Intel's hyper-threading technology is in play. * * @see OperatingSystemMXBean#getAvailableProcessors() * @return the number of logical processors. */ public int getNumberOfLogicalProcessors() { return numberOfLogicalProcessors; } /** * Retrieves the physical memory (RAM) size in bytes. * * @see com.sun.management.OperatingSystemMXBean#getTotalPhysicalMemorySize() * @return the physical memory (RAM) size in bytes. */ public long getPhysicalMemorySizeInBytes() { return physicalMemorySizeInBytes; } /** * Retrieves the swap space size in bytes. * * @see com.sun.management.OperatingSystemMXBean#getTotalSwapSpaceSize() * @return the swap space size in bytes. */ public long getSwapSpaceSizeInBytes() { return swapSpaceSizeInBytes; } /** * Retrieves the total disk space in bytes by root paths. * * @return a map of total disk space in bytes by root paths. */ public Map<String, Long> getDiskSpaceInBytesByRootPaths() { return Collections.unmodifiableMap(diskSpaceInBytesByRootPaths); } // This is not a bullet-proof method, but it should work nicely for most Linux distributions. private static String resolveLinuxDistributionName() { File etcDirectory = new File("/etc/"); if (etcDirectory.exists() && etcDirectory.isDirectory()) { File[] releaseFiles = etcDirectory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String filename) { return filename.endsWith("-release"); } }); if (releaseFiles != null) { for (File file : releaseFiles) { try (BufferedReader bufferedReader = new BufferedReader(new FileReader(file))) { String line = null; while ((line = bufferedReader.readLine()) != null) { for (Pattern pattern : LINUX_DISTRIBUTION_PATTERNS) { Matcher matcher = pattern.matcher(line); if (matcher.find()) { return matcher.group(1); } } } } catch (Exception e) { logger.debug("Error while reading a Linux release file: {}", file.getAbsolutePath(), e); if (InterruptedException.class.isInstance(e)) { Thread.currentThread().interrupt(); } } } } } return null; } }
{ "content_hash": "adf4c8c31b7b1c8699888f5dd1cb72a9", "timestamp": "", "source": "github", "line_count": 197, "max_line_length": 142, "avg_line_length": 36.85279187817259, "alnum_prop": 0.656198347107438, "repo_name": "centro/monitoring-center", "id": "bc0fd1a3e7004d899a51167ad9dd030ed539baae", "size": "8101", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/net/centro/rtb/monitoringcenter/infos/OperatingSystemInfo.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "514113" } ], "symlink_target": "" }
package git4idea.branch; import com.intellij.dvcs.DvcsUtil; import com.intellij.notification.Notification; import com.intellij.notification.NotificationListener; import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.vcs.VcsNotifier; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ArrayUtil; import git4idea.GitUtil; import git4idea.commands.*; import git4idea.config.GitVcsSettings; import git4idea.repo.GitRepository; import git4idea.util.GitPreservingProcess; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.event.HyperlinkEvent; import java.util.Collection; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import static com.intellij.util.containers.UtilKt.getIfSingle; import static git4idea.util.GitUIUtil.code; import static java.util.Arrays.stream; /** * Represents {@code git checkout} operation. * Fails to checkout if there are unmerged files. * Fails to checkout if there are untracked files that would be overwritten by checkout. Shows the list of files. * If there are local changes that would be overwritten by checkout, proposes to perform a "smart checkout" which means stashing local * changes, checking out, and then unstashing the changes back (possibly with showing the conflict resolving dialog). * * @author Kirill Likhodedov */ class GitCheckoutOperation extends GitBranchOperation { @NotNull private final String myStartPointReference; private final boolean myDetach; private final boolean myRefShouldBeValid; @Nullable private final String myNewBranch; GitCheckoutOperation(@NotNull Project project, @NotNull Git git, @NotNull GitBranchUiHandler uiHandler, @NotNull Collection<GitRepository> repositories, @NotNull String startPointReference, boolean detach, boolean refShouldBeValid, @Nullable String newBranch) { super(project, git, uiHandler, repositories); myStartPointReference = startPointReference; myDetach = detach; myRefShouldBeValid = refShouldBeValid; myNewBranch = newBranch; } @Override protected void execute() { saveAllDocuments(); boolean fatalErrorHappened = false; AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject); try { while (hasMoreRepositories() && !fatalErrorHappened) { final GitRepository repository = next(); VirtualFile root = repository.getRoot(); GitLocalChangesWouldBeOverwrittenDetector localChangesDetector = new GitLocalChangesWouldBeOverwrittenDetector(root, GitLocalChangesWouldBeOverwrittenDetector.Operation.CHECKOUT); GitSimpleEventDetector unmergedFiles = new GitSimpleEventDetector(GitSimpleEventDetector.Event.UNMERGED_PREVENTING_CHECKOUT); GitSimpleEventDetector unknownPathspec = new GitSimpleEventDetector(GitSimpleEventDetector.Event.INVALID_REFERENCE); GitUntrackedFilesOverwrittenByOperationDetector untrackedOverwrittenByCheckout = new GitUntrackedFilesOverwrittenByOperationDetector(root); GitCommandResult result = myGit.checkout(repository, myStartPointReference, myNewBranch, false, myDetach, localChangesDetector, unmergedFiles, unknownPathspec, untrackedOverwrittenByCheckout); if (result.success()) { refresh(repository); markSuccessful(repository); } else if (unmergedFiles.hasHappened()) { fatalUnmergedFilesError(); fatalErrorHappened = true; } else if (localChangesDetector.wasMessageDetected()) { boolean smartCheckoutSucceeded = smartCheckoutOrNotify(repository, localChangesDetector); if (!smartCheckoutSucceeded) { fatalErrorHappened = true; } } else if (untrackedOverwrittenByCheckout.wasMessageDetected()) { fatalUntrackedFilesError(repository.getRoot(), untrackedOverwrittenByCheckout.getRelativeFilePaths()); fatalErrorHappened = true; } else if (!myRefShouldBeValid && unknownPathspec.hasHappened()) { markSkip(repository); } else { fatalError(getCommonErrorTitle(), result.getErrorOutputAsJoinedString()); fatalErrorHappened = true; } } } finally { DvcsUtil.workingTreeChangeFinished(myProject, token); } if (!fatalErrorHappened) { if (wereSuccessful()) { if (!wereSkipped()) { notifySuccess(); updateRecentBranch(); } else { String mentionSuccess = getSuccessMessage() + GitUtil.mention(getSuccessfulRepositories(), 4); String mentionSkipped = wereSkipped() ? "<br>Revision not found" + GitUtil.mention(getSkippedRepositories(), 4) : ""; VcsNotifier.getInstance(myProject).notifySuccess("", mentionSuccess + mentionSkipped + "<br><a href='rollback'>Rollback</a>", new RollbackOperationNotificationListener()); updateRecentBranch(); } } else { LOG.assertTrue(!myRefShouldBeValid); notifyError("Couldn't checkout " + myStartPointReference, "Revision not found" + GitUtil.mention(getSkippedRepositories(), 4)); } } } private boolean smartCheckoutOrNotify(@NotNull GitRepository repository, @NotNull GitMessageWithFilesDetector localChangesOverwrittenByCheckout) { Pair<List<GitRepository>, List<Change>> conflictingRepositoriesAndAffectedChanges = getConflictingRepositoriesAndAffectedChanges(repository, localChangesOverwrittenByCheckout, myCurrentHeads.get(repository), myStartPointReference); List<GitRepository> allConflictingRepositories = conflictingRepositoriesAndAffectedChanges.getFirst(); List<Change> affectedChanges = conflictingRepositoriesAndAffectedChanges.getSecond(); Collection<String> absolutePaths = GitUtil.toAbsolute(repository.getRoot(), localChangesOverwrittenByCheckout.getRelativeFilePaths()); int smartCheckoutDecision = myUiHandler.showSmartOperationDialog(myProject, affectedChanges, absolutePaths, "checkout", "&Force Checkout"); if (smartCheckoutDecision == GitSmartOperationDialog.SMART_EXIT_CODE) { boolean smartCheckedOutSuccessfully = smartCheckout(allConflictingRepositories, myStartPointReference, myNewBranch, getIndicator()); if (smartCheckedOutSuccessfully) { for (GitRepository conflictingRepository : allConflictingRepositories) { markSuccessful(conflictingRepository); refresh(conflictingRepository); } return true; } else { // notification is handled in smartCheckout() return false; } } else if (smartCheckoutDecision == GitSmartOperationDialog.FORCE_EXIT_CODE) { boolean forceCheckoutSucceeded = checkoutOrNotify(allConflictingRepositories, myStartPointReference, myNewBranch, true); if (forceCheckoutSucceeded) { markSuccessful(ArrayUtil.toObjectArray(allConflictingRepositories, GitRepository.class)); refresh(ArrayUtil.toObjectArray(allConflictingRepositories, GitRepository.class)); } return forceCheckoutSucceeded; } else { fatalLocalChangesError(myStartPointReference); return false; } } @NotNull @Override protected String getRollbackProposal() { String previousBranch = getIfSingle(getSuccessfulRepositories().stream().map(myCurrentHeads::get).distinct()); if (previousBranch == null) previousBranch = "previous branch"; String rollBackProposal = "You may rollback (checkout back to " + previousBranch + ") not to let branches diverge."; return "However checkout has succeeded for the following " + repositories() + ":<br/>" + successfulRepositoriesJoined() + "<br/>" + rollBackProposal; } @NotNull @Override protected String getOperationName() { return "checkout"; } @Override protected void rollback() { GitCompoundResult checkoutResult = new GitCompoundResult(myProject); GitCompoundResult deleteResult = new GitCompoundResult(myProject); for (GitRepository repository : getSuccessfulRepositories()) { GitCommandResult result = myGit.checkout(repository, myCurrentHeads.get(repository), null, true, false); checkoutResult.append(repository, result); if (result.success() && myNewBranch != null) { /* force delete is needed, because we create new branch from branch other that the current one e.g. being on master create newBranch from feature, then rollback => newBranch is not fully merged to master (although it is obviously fully merged to feature). */ deleteResult.append(repository, myGit.branchDelete(repository, myNewBranch, true)); } refresh(repository); } if (!checkoutResult.totalSuccess() || !deleteResult.totalSuccess()) { StringBuilder message = new StringBuilder(); if (!checkoutResult.totalSuccess()) { message.append("Errors during checkout: "); message.append(checkoutResult.getErrorOutputWithReposIndication()); } if (!deleteResult.totalSuccess()) { message.append("Errors during deleting ").append(code(myNewBranch)).append(": "); message.append(deleteResult.getErrorOutputWithReposIndication()); } VcsNotifier.getInstance(myProject).notifyError("Error during rollback", message.toString()); } } @NotNull private String getCommonErrorTitle() { return "Couldn't checkout " + myStartPointReference; } @NotNull @Override public String getSuccessMessage() { if (myNewBranch == null) { return String.format("Checked out <b><code>%s</code></b>", myStartPointReference); } return String.format("Checked out new branch <b><code>%s</code></b> from <b><code>%s</code></b>", myNewBranch, myStartPointReference); } // stash - checkout - unstash private boolean smartCheckout(@NotNull final List<GitRepository> repositories, @NotNull final String reference, @Nullable final String newBranch, @NotNull ProgressIndicator indicator) { final AtomicBoolean result = new AtomicBoolean(); GitPreservingProcess preservingProcess = new GitPreservingProcess(myProject, myGit, GitUtil.getRootsFromRepositories(repositories), "checkout", reference, GitVcsSettings.UpdateChangesPolicy.STASH, indicator, new Runnable() { @Override public void run() { result.set(checkoutOrNotify(repositories, reference, newBranch, false)); } }); preservingProcess.execute(); return result.get(); } /** * Checks out or shows an error message. */ private boolean checkoutOrNotify(@NotNull List<GitRepository> repositories, @NotNull String reference, @Nullable String newBranch, boolean force) { GitCompoundResult compoundResult = new GitCompoundResult(myProject); for (GitRepository repository : repositories) { compoundResult.append(repository, myGit.checkout(repository, reference, newBranch, force, myDetach)); } if (compoundResult.totalSuccess()) { return true; } notifyError("Couldn't checkout " + reference, compoundResult.getErrorOutputWithReposIndication()); return false; } private void refresh(GitRepository... repositories) { // repositories state will be auto-updated with the following VFS refresh => there is no need to call GitRepository#update() // but we want repository state to be updated as soon as possible, without waiting for the whole VFS refresh to complete. stream(repositories).forEach(GitRepository::update); for (GitRepository repository : repositories) { refreshRoot(repository); } } private class RollbackOperationNotificationListener implements NotificationListener { @Override public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED && event.getDescription().equalsIgnoreCase("rollback")) { rollback(); } } } }
{ "content_hash": "acf4cce2b490efc57ced1077631e80f5", "timestamp": "", "source": "github", "line_count": 291, "max_line_length": 140, "avg_line_length": 45.29553264604811, "alnum_prop": 0.6809043319930203, "repo_name": "youdonghai/intellij-community", "id": "0b93eb5091060e3a20a7c69a22c7d67121db9291", "size": "13781", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AMPL", "bytes": "20665" }, { "name": "AspectJ", "bytes": "182" }, { "name": "Batchfile", "bytes": "60477" }, { "name": "C", "bytes": "195270" }, { "name": "C#", "bytes": "1264" }, { "name": "C++", "bytes": "197804" }, { "name": "CMake", "bytes": "1195" }, { "name": "CSS", "bytes": "201445" }, { "name": "CoffeeScript", "bytes": "1759" }, { "name": "Cucumber", "bytes": "14382" }, { "name": "Erlang", "bytes": "10" }, { "name": "Groff", "bytes": "35232" }, { "name": "Groovy", "bytes": "3078038" }, { "name": "HLSL", "bytes": "57" }, { "name": "HTML", "bytes": "1837329" }, { "name": "J", "bytes": "5050" }, { "name": "Java", "bytes": "160121025" }, { "name": "JavaScript", "bytes": "570364" }, { "name": "Jupyter Notebook", "bytes": "93222" }, { "name": "Kotlin", "bytes": "2803472" }, { "name": "Lex", "bytes": "183993" }, { "name": "Makefile", "bytes": "2352" }, { "name": "NSIS", "bytes": "49795" }, { "name": "Objective-C", "bytes": "28750" }, { "name": "Perl", "bytes": "903" }, { "name": "Perl6", "bytes": "26" }, { "name": "Protocol Buffer", "bytes": "6639" }, { "name": "Python", "bytes": "24055272" }, { "name": "Ruby", "bytes": "1217" }, { "name": "Scala", "bytes": "11698" }, { "name": "Shell", "bytes": "63389" }, { "name": "Smalltalk", "bytes": "338" }, { "name": "TeX", "bytes": "25473" }, { "name": "Thrift", "bytes": "1846" }, { "name": "TypeScript", "bytes": "9469" }, { "name": "Visual Basic", "bytes": "77" }, { "name": "XSLT", "bytes": "113040" } ], "symlink_target": "" }
<?php namespace Drupal\content_translation; use Drupal\Core\Access\AccessResult; use Drupal\Core\DependencyInjection\DependencySerializationTrait; use Drupal\Core\Entity\EntityChangedInterface; use Drupal\Core\Entity\EntityHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Render\Element; use Drupal\Core\Session\AccountInterface; use Drupal\user\Entity\User; use Drupal\user\EntityOwnerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Base class for content translation handlers. * * @ingroup entity_api */ class ContentTranslationHandler implements ContentTranslationHandlerInterface, EntityHandlerInterface { use DependencySerializationTrait; /** * The type of the entity being translated. * * @var string */ protected $entityTypeId; /** * Information about the entity type. * * @var \Drupal\Core\Entity\EntityTypeInterface */ protected $entityType; /** * The language manager. * * @var \Drupal\Core\Language\LanguageManagerInterface */ protected $languageManager; /** * The content translation manager. * * @var \Drupal\content_translation\ContentTranslationManagerInterface */ protected $manager; /** * The current user. * * @var \Drupal\Core\Session\AccountInterface */ protected $currentUser; /** * The array of installed field storage definitions for the entity type, keyed * by field name. * * @var \Drupal\Core\Field\FieldStorageDefinitionInterface[] */ protected $fieldStorageDefinitions; /** * Initializes an instance of the content translation controller. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The info array of the given entity type. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. * @param \Drupal\content_translation\ContentTranslationManagerInterface $manager * The content translation manager service. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. * @param \Drupal\Core\Session\AccountInterface $current_user * The current user. */ public function __construct(EntityTypeInterface $entity_type, LanguageManagerInterface $language_manager, ContentTranslationManagerInterface $manager, EntityManagerInterface $entity_manager, AccountInterface $current_user) { $this->entityTypeId = $entity_type->id(); $this->entityType = $entity_type; $this->languageManager = $language_manager; $this->manager = $manager; $this->currentUser = $current_user; $this->fieldStorageDefinitions = $entity_manager->getLastInstalledFieldStorageDefinitions($this->entityTypeId); } /** * {@inheritdoc} */ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( $entity_type, $container->get('language_manager'), $container->get('content_translation.manager'), $container->get('entity.manager'), $container->get('current_user') ); } /** * {@inheritdoc} */ public function getFieldDefinitions() { $definitions = []; $definitions['content_translation_source'] = BaseFieldDefinition::create('language') ->setLabel(t('Translation source')) ->setDescription(t('The source language from which this translation was created.')) ->setDefaultValue(LanguageInterface::LANGCODE_NOT_SPECIFIED) ->setInitialValue(LanguageInterface::LANGCODE_NOT_SPECIFIED) ->setRevisionable(TRUE) ->setTranslatable(TRUE); $definitions['content_translation_outdated'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Translation outdated')) ->setDescription(t('A boolean indicating whether this translation needs to be updated.')) ->setDefaultValue(FALSE) ->setInitialValue(FALSE) ->setRevisionable(TRUE) ->setTranslatable(TRUE); if (!$this->hasAuthor()) { $definitions['content_translation_uid'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Translation author')) ->setDescription(t('The author of this translation.')) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') ->setRevisionable(TRUE) ->setDefaultValueCallback(get_class($this) . '::getDefaultOwnerId') ->setTranslatable(TRUE); } if (!$this->hasPublishedStatus()) { $definitions['content_translation_status'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Translation status')) ->setDescription(t('A boolean indicating whether the translation is visible to non-translators.')) ->setDefaultValue(TRUE) ->setInitialValue(TRUE) ->setRevisionable(TRUE) ->setTranslatable(TRUE); } if (!$this->hasCreatedTime()) { $definitions['content_translation_created'] = BaseFieldDefinition::create('created') ->setLabel(t('Translation created time')) ->setDescription(t('The Unix timestamp when the translation was created.')) ->setRevisionable(TRUE) ->setTranslatable(TRUE); } if (!$this->hasChangedTime()) { $definitions['content_translation_changed'] = BaseFieldDefinition::create('changed') ->setLabel(t('Translation changed time')) ->setDescription(t('The Unix timestamp when the translation was most recently saved.')) ->setRevisionable(TRUE) ->setTranslatable(TRUE); } return $definitions; } /** * Checks whether the entity type supports author natively. * * @return bool * TRUE if metadata is natively supported, FALSE otherwise. */ protected function hasAuthor() { // Check for field named uid, but only in case the entity implements the // EntityOwnerInterface. This helps to exclude cases, where the uid is // defined as field name, but is not meant to be an owner field; for // instance, the User entity. return $this->entityType->entityClassImplements(EntityOwnerInterface::class) && $this->checkFieldStorageDefinitionTranslatability('uid'); } /** * Checks whether the entity type supports published status natively. * * @return bool * TRUE if metadata is natively supported, FALSE otherwise. */ protected function hasPublishedStatus() { return $this->checkFieldStorageDefinitionTranslatability('status'); } /** * Checks whether the entity type supports modification time natively. * * @return bool * TRUE if metadata is natively supported, FALSE otherwise. */ protected function hasChangedTime() { return $this->entityType->entityClassImplements(EntityChangedInterface::class) && $this->checkFieldStorageDefinitionTranslatability('changed'); } /** * Checks whether the entity type supports creation time natively. * * @return bool * TRUE if metadata is natively supported, FALSE otherwise. */ protected function hasCreatedTime() { return $this->checkFieldStorageDefinitionTranslatability('created'); } /** * Checks the field storage definition for translatability support. * * Checks whether the given field is defined in the field storage definitions * and if its definition specifies it as translatable. * * @param string $field_name * The name of the field. * * @return bool * TRUE if translatable field storage definition exists, FALSE otherwise. */ protected function checkFieldStorageDefinitionTranslatability($field_name) { return array_key_exists($field_name, $this->fieldStorageDefinitions) && $this->fieldStorageDefinitions[$field_name]->isTranslatable(); } /** * {@inheritdoc} */ public function retranslate(EntityInterface $entity, $langcode = NULL) { $updated_langcode = !empty($langcode) ? $langcode : $entity->language()->getId(); foreach ($entity->getTranslationLanguages() as $langcode => $language) { $this->manager->getTranslationMetadata($entity->getTranslation($langcode)) ->setOutdated($langcode != $updated_langcode); } } /** * {@inheritdoc} */ public function getTranslationAccess(EntityInterface $entity, $op) { // @todo Move this logic into a translation access control handler checking also // the translation language and the given account. $entity_type = $entity->getEntityType(); $translate_permission = TRUE; // If no permission granularity is defined this entity type does not need an // explicit translate permission. if (!$this->currentUser->hasPermission('translate any entity') && $permission_granularity = $entity_type->getPermissionGranularity()) { $translate_permission = $this->currentUser->hasPermission($permission_granularity == 'bundle' ? "translate {$entity->bundle()} {$entity->getEntityTypeId()}" : "translate {$entity->getEntityTypeId()}"); } return AccessResult::allowedIf($translate_permission && $this->currentUser->hasPermission("$op content translations"))->cachePerPermissions(); } /** * {@inheritdoc} */ public function getSourceLangcode(FormStateInterface $form_state) { if ($source = $form_state->get(['content_translation', 'source'])) { return $source->getId(); } return FALSE; } /** * {@inheritdoc} */ public function entityFormAlter(array &$form, FormStateInterface $form_state, EntityInterface $entity) { $form_object = $form_state->getFormObject(); $form_langcode = $form_object->getFormLangcode($form_state); $entity_langcode = $entity->getUntranslated()->language()->getId(); $source_langcode = $this->getSourceLangcode($form_state); $new_translation = !empty($source_langcode); $translations = $entity->getTranslationLanguages(); if ($new_translation) { // Make sure a new translation does not appear as existing yet. unset($translations[$form_langcode]); } $is_translation = !$form_object->isDefaultFormLangcode($form_state); $has_translations = count($translations) > 1; // Adjust page title to specify the current language being edited, if we // have at least one translation. $languages = $this->languageManager->getLanguages(); if (isset($languages[$form_langcode]) && ($has_translations || $new_translation)) { $title = $this->entityFormTitle($entity); // When editing the original values display just the entity label. if ($is_translation) { $t_args = ['%language' => $languages[$form_langcode]->getName(), '%title' => $entity->label(), '@title' => $title]; $title = empty($source_langcode) ? t('@title [%language translation]', $t_args) : t('Create %language translation of %title', $t_args); } $form['#title'] = $title; } // Display source language selector only if we are creating a new // translation and there are at least two translations available. if ($has_translations && $new_translation) { $form['source_langcode'] = [ '#type' => 'details', '#title' => t('Source language: @language', ['@language' => $languages[$source_langcode]->getName()]), '#tree' => TRUE, '#weight' => -100, '#multilingual' => TRUE, 'source' => [ '#title' => t('Select source language'), '#title_display' => 'invisible', '#type' => 'select', '#default_value' => $source_langcode, '#options' => [], ], 'submit' => [ '#type' => 'submit', '#value' => t('Change'), '#submit' => [[$this, 'entityFormSourceChange']], ], ]; foreach ($this->languageManager->getLanguages() as $language) { if (isset($translations[$language->getId()])) { $form['source_langcode']['source']['#options'][$language->getId()] = $language->getName(); } } } // Locate the language widget. $langcode_key = $this->entityType->getKey('langcode'); if (isset($form[$langcode_key])) { $language_widget = &$form[$langcode_key]; } // If we are editing the source entity, limit the list of languages so that // it is not possible to switch to a language for which a translation // already exists. Note that this will only work if the widget is structured // like \Drupal\Core\Field\Plugin\Field\FieldWidget\LanguageSelectWidget. if (isset($language_widget['widget'][0]['value']) && !$is_translation && $has_translations) { $language_select = &$language_widget['widget'][0]['value']; if ($language_select['#type'] == 'language_select') { $options = []; foreach ($this->languageManager->getLanguages() as $language) { // Show the current language, and the languages for which no // translation already exists. if (empty($translations[$language->getId()]) || $language->getId() == $entity_langcode) { $options[$language->getId()] = $language->getName(); } } $language_select['#options'] = $options; } } if ($is_translation) { if (isset($language_widget)) { $language_widget['widget']['#access'] = FALSE; } // Replace the delete button with the delete translation one. if (!$new_translation) { $weight = 100; foreach (['delete', 'submit'] as $key) { if (isset($form['actions'][$key]['weight'])) { $weight = $form['actions'][$key]['weight']; break; } } $access = $this->getTranslationAccess($entity, 'delete')->isAllowed() || ($entity->access('delete') && $this->entityType->hasLinkTemplate('delete-form')); $form['actions']['delete_translation'] = [ '#type' => 'submit', '#value' => t('Delete translation'), '#weight' => $weight, '#submit' => [[$this, 'entityFormDeleteTranslation']], '#access' => $access, ]; } // Always remove the delete button on translation forms. unset($form['actions']['delete']); } // We need to display the translation tab only when there is at least one // translation available or a new one is about to be created. if ($new_translation || $has_translations) { $form['content_translation'] = [ '#type' => 'details', '#title' => t('Translation'), '#tree' => TRUE, '#weight' => 10, '#access' => $this->getTranslationAccess($entity, $source_langcode ? 'create' : 'update')->isAllowed(), '#multilingual' => TRUE, ]; if (isset($form['advanced'])) { $form['content_translation'] += [ '#group' => 'advanced', '#weight' => 100, '#attributes' => [ 'class' => ['entity-translation-options'], ], ]; } // A new translation is enabled by default. $metadata = $this->manager->getTranslationMetadata($entity); $status = $new_translation || $metadata->isPublished(); // If there is only one published translation we cannot unpublish it, // since there would be nothing left to display. $enabled = TRUE; if ($status) { $published = 0; foreach ($entity->getTranslationLanguages() as $langcode => $language) { $published += $this->manager->getTranslationMetadata($entity->getTranslation($langcode)) ->isPublished(); } $enabled = $published > 1; } $description = $enabled ? t('An unpublished translation will not be visible without translation permissions.') : t('Only this translation is published. You must publish at least one more translation to unpublish this one.'); $form['content_translation']['status'] = [ '#type' => 'checkbox', '#title' => t('This translation is published'), '#default_value' => $status, '#description' => $description, '#disabled' => !$enabled, ]; $translate = !$new_translation && $metadata->isOutdated(); if (!$translate) { $form['content_translation']['retranslate'] = [ '#type' => 'checkbox', '#title' => t('Flag other translations as outdated'), '#default_value' => FALSE, '#description' => t('If you made a significant change, which means the other translations should be updated, you can flag all translations of this content as outdated. This will not change any other property of them, like whether they are published or not.'), ]; } else { $form['content_translation']['outdated'] = [ '#type' => 'checkbox', '#title' => t('This translation needs to be updated'), '#default_value' => $translate, '#description' => t('When this option is checked, this translation needs to be updated. Uncheck when the translation is up to date again.'), ]; $form['content_translation']['#open'] = TRUE; } // Default to the anonymous user. $uid = 0; if ($new_translation) { $uid = $this->currentUser->id(); } elseif (($account = $metadata->getAuthor()) && $account->id()) { $uid = $account->id(); } $form['content_translation']['uid'] = [ '#type' => 'entity_autocomplete', '#title' => t('Authored by'), '#target_type' => 'user', '#default_value' => User::load($uid), // Validation is done by static::entityFormValidate(). '#validate_reference' => FALSE, '#maxlength' => 60, '#description' => t('Leave blank for %anonymous.', ['%anonymous' => \Drupal::config('user.settings')->get('anonymous')]), ]; $date = $new_translation ? REQUEST_TIME : $metadata->getCreatedTime(); $form['content_translation']['created'] = [ '#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#description' => t('Format: %time. The date format is YYYY-MM-DD and %timezone is the time zone offset from UTC. Leave blank to use the time of form submission.', ['%time' => format_date(REQUEST_TIME, 'custom', 'Y-m-d H:i:s O'), '%timezone' => format_date(REQUEST_TIME, 'custom', 'O')]), '#default_value' => $new_translation || !$date ? '' : format_date($date, 'custom', 'Y-m-d H:i:s O'), ]; if (isset($language_widget)) { $language_widget['#multilingual'] = TRUE; } $form['#process'][] = [$this, 'entityFormSharedElements']; } // Process the submitted values before they are stored. $form['#entity_builders'][] = [$this, 'entityFormEntityBuild']; // Handle entity validation. $form['#validate'][] = [$this, 'entityFormValidate']; // Handle entity deletion. if (isset($form['actions']['delete'])) { $form['actions']['delete']['#submit'][] = [$this, 'entityFormDelete']; } // Handle entity form submission before the entity has been saved. foreach (Element::children($form['actions']) as $action) { if (isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] == 'submit') { array_unshift($form['actions'][$action]['#submit'], [$this, 'entityFormSubmit']); } } } /** * Process callback: determines which elements get clue in the form. * * @see \Drupal\content_translation\ContentTranslationHandler::entityFormAlter() */ public function entityFormSharedElements($element, FormStateInterface $form_state, $form) { static $ignored_types; // @todo Find a more reliable way to determine if a form element concerns a // multilingual value. if (!isset($ignored_types)) { $ignored_types = array_flip(['actions', 'value', 'hidden', 'vertical_tabs', 'token', 'details']); } foreach (Element::children($element) as $key) { if (!isset($element[$key]['#type'])) { $this->entityFormSharedElements($element[$key], $form_state, $form); } else { // Ignore non-widget form elements. if (isset($ignored_types[$element[$key]['#type']])) { continue; } // Elements are considered to be non multilingual by default. if (empty($element[$key]['#multilingual'])) { // If we are displaying a multilingual entity form we need to provide // translatability clues, otherwise the shared form elements should be // hidden. if (!$form_state->get(['content_translation', 'translation_form'])) { $this->addTranslatabilityClue($element[$key]); } else { $element[$key]['#access'] = FALSE; } } } } return $element; } /** * Adds a clue about the form element translatability. * * If the given element does not have a #title attribute, the function is * recursively applied to child elements. * * @param array $element * A form element array. */ protected function addTranslatabilityClue(&$element) { static $suffix, $fapi_title_elements; // Elements which can have a #title attribute according to FAPI Reference. if (!isset($suffix)) { $suffix = ' <span class="translation-entity-all-languages">(' . t('all languages') . ')</span>'; $fapi_title_elements = array_flip(['checkbox', 'checkboxes', 'date', 'details', 'fieldset', 'file', 'item', 'password', 'password_confirm', 'radio', 'radios', 'select', 'text_format', 'textarea', 'textfield', 'weight']); } // Update #title attribute for all elements that are allowed to have a // #title attribute according to the Form API Reference. The reason for this // check is because some elements have a #title attribute even though it is // not rendered; for instance, field containers. if (isset($element['#type']) && isset($fapi_title_elements[$element['#type']]) && isset($element['#title'])) { $element['#title'] .= $suffix; } // If the current element does not have a (valid) title, try child elements. elseif ($children = Element::children($element)) { foreach ($children as $delta) { $this->addTranslatabilityClue($element[$delta], $suffix); } } // If there are no children, fall back to the current #title attribute if it // exists. elseif (isset($element['#title'])) { $element['#title'] .= $suffix; } } /** * Entity builder method. * * @param string $entity_type * The type of the entity. * @param \Drupal\Core\Entity\EntityInterface $entity * The entity whose form is being built. * * @see \Drupal\content_translation\ContentTranslationHandler::entityFormAlter() */ public function entityFormEntityBuild($entity_type, EntityInterface $entity, array $form, FormStateInterface $form_state) { $form_object = $form_state->getFormObject(); $form_langcode = $form_object->getFormLangcode($form_state); $values = &$form_state->getValue('content_translation', []); $metadata = $this->manager->getTranslationMetadata($entity); $metadata->setAuthor(!empty($values['uid']) ? User::load($values['uid']) : User::load(0)); $metadata->setPublished(!empty($values['status'])); $metadata->setCreatedTime(!empty($values['created']) ? strtotime($values['created']) : REQUEST_TIME); $source_langcode = $this->getSourceLangcode($form_state); if ($source_langcode) { $metadata->setSource($source_langcode); } $metadata->setOutdated(!empty($values['outdated'])); if (!empty($values['retranslate'])) { $this->retranslate($entity, $form_langcode); } } /** * Form validation handler for ContentTranslationHandler::entityFormAlter(). * * Validates the submitted content translation metadata. */ public function entityFormValidate($form, FormStateInterface $form_state) { if (!$form_state->isValueEmpty('content_translation')) { $translation = $form_state->getValue('content_translation'); // Validate the "authored by" field. if (!empty($translation['uid']) && !($account = User::load($translation['uid']))) { $form_state->setErrorByName('content_translation][uid', t('The translation authoring username %name does not exist.', ['%name' => $account->getUsername()])); } // Validate the "authored on" field. if (!empty($translation['created']) && strtotime($translation['created']) === FALSE) { $form_state->setErrorByName('content_translation][created', t('You have to specify a valid translation authoring date.')); } } } /** * Form submission handler for ContentTranslationHandler::entityFormAlter(). * * Updates metadata fields, which should be updated only after the validation * has run and before the entity is saved. */ public function entityFormSubmit($form, FormStateInterface $form_state) { /** @var \Drupal\Core\Entity\ContentEntityFormInterface $form_object */ $form_object = $form_state->getFormObject(); /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */ $entity = $form_object->getEntity(); // ContentEntityForm::submit will update the changed timestamp on submit // after the entity has been validated, so that it does not break the // EntityChanged constraint validator. The content translation metadata // field for the changed timestamp does not have such a constraint defined // at the moment, but it is correct to update it's value in a submission // handler as well and have the same logic like in the Form API. if ($entity->hasField('content_translation_changed')) { $metadata = $this->manager->getTranslationMetadata($entity); $metadata->setChangedTime(REQUEST_TIME); } } /** * Form submission handler for ContentTranslationHandler::entityFormAlter(). * * Takes care of the source language change. */ public function entityFormSourceChange($form, FormStateInterface $form_state) { $form_object = $form_state->getFormObject(); $entity = $form_object->getEntity(); $source = $form_state->getValue(['source_langcode', 'source']); $entity_type_id = $entity->getEntityTypeId(); $form_state->setRedirect("entity.$entity_type_id.content_translation_add", [ $entity_type_id => $entity->id(), 'source' => $source, 'target' => $form_object->getFormLangcode($form_state), ]); $languages = $this->languageManager->getLanguages(); drupal_set_message(t('Source language set to: %language', ['%language' => $languages[$source]->getName()])); } /** * Form submission handler for ContentTranslationHandler::entityFormAlter(). * * Takes care of entity deletion. */ public function entityFormDelete($form, FormStateInterface $form_state) { $form_object = $form_state->getFormObject()->getEntity(); $entity = $form_object->getEntity(); if (count($entity->getTranslationLanguages()) > 1) { drupal_set_message(t('This will delete all the translations of %label.', ['%label' => $entity->label()]), 'warning'); } } /** * Form submission handler for ContentTranslationHandler::entityFormAlter(). * * Takes care of content translation deletion. */ public function entityFormDeleteTranslation($form, FormStateInterface $form_state) { /** @var \Drupal\Core\Entity\ContentEntityFormInterface $form_object */ $form_object = $form_state->getFormObject(); /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */ $entity = $form_object->getEntity(); $entity_type_id = $entity->getEntityTypeId(); if ($entity->access('delete') && $this->entityType->hasLinkTemplate('delete-form')) { $form_state->setRedirectUrl($entity->urlInfo('delete-form')); } else { $form_state->setRedirect("entity.$entity_type_id.content_translation_delete", [ $entity_type_id => $entity->id(), 'language' => $form_object->getFormLangcode($form_state), ]); } } /** * Returns the title to be used for the entity form page. * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity whose form is being altered. * * @return string|null * The label of the entity, or NULL if there is no label defined. */ protected function entityFormTitle(EntityInterface $entity) { return $entity->label(); } /** * Default value callback for the owner base field definition. * * @return int * The user ID. */ public static function getDefaultOwnerId() { return \Drupal::currentUser()->id(); } }
{ "content_hash": "d3d902c5cf941c0824755af25fe8b4d9", "timestamp": "", "source": "github", "line_count": 732, "max_line_length": 296, "avg_line_length": 39.44808743169399, "alnum_prop": 0.643233134783211, "repo_name": "wow-yorick/suffix-zx", "id": "7e6a7ca3ea6cdd034b9556c974916002c541fc1f", "size": "28876", "binary": false, "copies": "26", "ref": "refs/heads/master", "path": "cms/core/modules/content_translation/src/ContentTranslationHandler.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "711070" }, { "name": "HTML", "bytes": "944057" }, { "name": "JavaScript", "bytes": "1530798" }, { "name": "PHP", "bytes": "39866961" }, { "name": "Shell", "bytes": "55615" } ], "symlink_target": "" }
pub mod cookie_utils; pub mod ebml; pub mod elements;
{ "content_hash": "753a71e5ed0fb597580425cc24436e12", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 21, "avg_line_length": 18, "alnum_prop": 0.7592592592592593, "repo_name": "rust-av/matroska", "id": "60fdc1214da8a24db4a83832594e51c596b03545", "size": "54", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/serializer/mod.rs", "mode": "33188", "license": "mit", "language": [ { "name": "Rust", "bytes": "143267" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>BOOST_OUTCOME_SYMBOL_VISIBLE - Boost.Outcome documentation</title> <link rel="stylesheet" href="../../css/boost.css" type="text/css"> <meta name="generator" content="Hugo 0.52 with Boostdoc theme"> <meta name="viewport" content="width=device-width,initial-scale=1.0"/> <link rel="icon" href="../../images/favicon.ico" type="image/ico"/> <body><div class="spirit-nav"> <a accesskey="p" href="../../reference/macros/requires.html"><img src="../../images/prev.png" alt="Prev"></a> <a accesskey="u" href="../../reference/macros.html"><img src="../../images/up.png" alt="Up"></a> <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../reference/macros/thread_local.html"><img src="../../images/next.png" alt="Next"></a></div><div id="content"> <div class="titlepage"><div><div><h1 style="clear: both"><code>BOOST_OUTCOME_SYMBOL_VISIBLE</code></h1></div></div></div> <p>Compiler-specific markup used to mark throwable types as always having default ELF symbol visibility, without which it will be impossible to catch throws of such types across shared library boundaries on ELF only.</p> <p><em>Overridable</em>: Define before inclusion.</p> <p><em>Default</em>:<dl> <dt>Standalone Outcome: <dd>To <code>__attribute__((visibility(&quot;default&quot;))</code> on GCC and clang when targeting ELF, otherwise nothing. <dt>Boost.Outcome: <dd>To <code>BOOST_SYMBOL_VISIBLE</code>. </dl></p> <p><em>Header</em>: <code>&lt;boost/outcome/config.hpp&gt;</code></p> </div><p><small>Last revised: December 12, 2018 at 22:01:42 UTC</small></p> <hr> <div class="spirit-nav"> <a accesskey="p" href="../../reference/macros/requires.html"><img src="../../images/prev.png" alt="Prev"></a> <a accesskey="u" href="../../reference/macros.html"><img src="../../images/up.png" alt="Up"></a> <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../reference/macros/thread_local.html"><img src="../../images/next.png" alt="Next"></a></div></body> </html>
{ "content_hash": "6d905d81742059d82fe74129922cab6b", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 230, "avg_line_length": 66.70588235294117, "alnum_prop": 0.6631393298059964, "repo_name": "arangodb/arangodb", "id": "8ddc724c428776c70ce36c6e32a0fe681689d3e4", "size": "2268", "binary": false, "copies": "4", "ref": "refs/heads/devel", "path": "3rdParty/boost/1.78.0/libs/outcome/doc/html/reference/macros/symbol_visible.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "61827" }, { "name": "C", "bytes": "311036" }, { "name": "C++", "bytes": "35149373" }, { "name": "CMake", "bytes": "387268" }, { "name": "CSS", "bytes": "210549" }, { "name": "EJS", "bytes": "232160" }, { "name": "HTML", "bytes": "23114" }, { "name": "JavaScript", "bytes": "33841256" }, { "name": "LLVM", "bytes": "15003" }, { "name": "NASL", "bytes": "381737" }, { "name": "NSIS", "bytes": "47138" }, { "name": "Pascal", "bytes": "75391" }, { "name": "Perl", "bytes": "9811" }, { "name": "PowerShell", "bytes": "6806" }, { "name": "Python", "bytes": "190515" }, { "name": "SCSS", "bytes": "255542" }, { "name": "Shell", "bytes": "133576" }, { "name": "TypeScript", "bytes": "179074" }, { "name": "Yacc", "bytes": "79620" } ], "symlink_target": "" }
//----------------------------------*-C++-*----------------------------------// //---------------------------------------------------------------------------// #include "Epetra_Operator.h" #include "Epetra_MultiVector.h" #include "AnasaziEpetraAdapter.hpp" #include "AnasaziTpetraAdapter.hpp" #include "LinearSolverBuilder.t.hh" #include "LinAlgTypedefs.hh" namespace profugus { template class LinearSolverBuilder<EpetraTypes>; template class LinearSolverBuilder<TpetraTypes>; } // end namespace profugus //---------------------------------------------------------------------------// // end of LinearSolverBuilder.pt.cc //---------------------------------------------------------------------------//
{ "content_hash": "dd096d141a45b4d3329044015a16ae01", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 79, "avg_line_length": 31.47826086956522, "alnum_prop": 0.42955801104972374, "repo_name": "ORNL-CEES/Profugus", "id": "858ce25510ebecb9a2207f92e57e49eaec34f2e4", "size": "977", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "packages/SPn/solvers/LinearSolverBuilder.pt.cc", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "72175" }, { "name": "C++", "bytes": "4949401" }, { "name": "CMake", "bytes": "95533" }, { "name": "Cuda", "bytes": "48916" }, { "name": "Fortran", "bytes": "1667" }, { "name": "Python", "bytes": "11371" }, { "name": "Shell", "bytes": "29128" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android"> <data> <import type="com.google.android.agera.Reservoir"/> <variable name="value" type="int"/> <variable name="observable" type="Reservoir"/> </data> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_margin="@dimen/activity_horizontal_margin" android:text="@{@string/count_time(value)}"/> <Button android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/activity_horizontal_margin" android:onClick="@{() -> observable.accept(value)}" android:text="@string/button_reservoir"/> </LinearLayout> </layout>
{ "content_hash": "c0089e10f68236b91b2fd547de823cc1", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 69, "avg_line_length": 33.94117647058823, "alnum_prop": 0.6117850953206239, "repo_name": "captain-miao/AndroidAgeraTutorial", "id": "c529c753e5cfe05c29061e59f5c4f5573e2d9ad8", "size": "1154", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/layout/activity_agera_reservoir.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "89591" } ], "symlink_target": "" }
import { RxQueryBase } from './rx-query'; import type { DataMigrator } from './plugins/migration'; import { Crypter } from './crypter'; import { DocCache } from './doc-cache'; import { QueryCache } from './query-cache'; import { ChangeEventBuffer } from './change-event-buffer'; import { Subscription, Observable } from 'rxjs'; import type { KeyFunctionMap, RxCouchDBReplicationState, MigrationState, SyncOptions, RxCollection, RxDatabase, RxQuery, RxDocument, SyncOptionsGraphQL, RxDumpCollection, RxDumpCollectionAny, MangoQuery, MangoQueryNoLimit, RxCacheReplacementPolicy, RxStorageBulkWriteError, RxStorageKeyObjectInstance, RxChangeEvent, RxChangeEventInsert, RxChangeEventUpdate, RxChangeEventDelete, RxStorageInstance, CollectionsOfDatabase } from './types'; import type { RxGraphQLReplicationState } from './plugins/replication-graphql'; import { RxSchema } from './rx-schema'; export declare class RxCollectionBase<InstanceCreationOptions, RxDocumentType = { [prop: string]: any; }, OrmMethods = {}, StaticMethods = { [key: string]: any; }> { database: RxDatabase<CollectionsOfDatabase, any, InstanceCreationOptions>; name: string; schema: RxSchema<RxDocumentType>; /** * Stores all 'normal' documents */ storageInstance: RxStorageInstance<RxDocumentType, any, InstanceCreationOptions>; /** * Stores the local documents so that they are not deleted * when a migration runs. */ localDocumentsStore: RxStorageKeyObjectInstance<any, InstanceCreationOptions>; instanceCreationOptions: InstanceCreationOptions; migrationStrategies: KeyFunctionMap; methods: KeyFunctionMap; attachments: KeyFunctionMap; options: any; cacheReplacementPolicy: RxCacheReplacementPolicy; statics: KeyFunctionMap; constructor(database: RxDatabase<CollectionsOfDatabase, any, InstanceCreationOptions>, name: string, schema: RxSchema<RxDocumentType>, /** * Stores all 'normal' documents */ storageInstance: RxStorageInstance<RxDocumentType, any, InstanceCreationOptions>, /** * Stores the local documents so that they are not deleted * when a migration runs. */ localDocumentsStore: RxStorageKeyObjectInstance<any, InstanceCreationOptions>, instanceCreationOptions?: InstanceCreationOptions, migrationStrategies?: KeyFunctionMap, methods?: KeyFunctionMap, attachments?: KeyFunctionMap, options?: any, cacheReplacementPolicy?: RxCacheReplacementPolicy, statics?: KeyFunctionMap); /** * returns observable */ get $(): Observable<RxChangeEvent<any>>; get insert$(): Observable<RxChangeEventInsert<RxDocumentType>>; get update$(): Observable<RxChangeEventUpdate<RxDocumentType>>; get remove$(): Observable<RxChangeEventDelete<RxDocumentType>>; get onDestroy(): Promise<void>; _isInMemory: boolean; destroyed: boolean; _atomicUpsertQueues: Map<any, any>; synced: boolean; hooks: any; _subs: Subscription[]; _repStates: Set<RxCouchDBReplicationState>; _docCache: DocCache<RxDocument<RxDocumentType, OrmMethods>>; _queryCache: QueryCache; _crypter: Crypter; _observable$: Observable<RxChangeEvent<RxDocumentType>>; _changeEventBuffer: ChangeEventBuffer; /** * returns a promise that is resolved when the collection gets destroyed */ private _onDestroy?; private _onDestroyCall?; prepare( /** * TODO is this still needed? * set to true if the collection data already exists on this storage adapter */ _wasCreatedBefore: boolean): Promise<void>; migrationNeeded(): Promise<boolean>; getDataMigrator(): DataMigrator; migrate(batchSize?: number): Observable<MigrationState>; migratePromise(batchSize?: number): Promise<any>; /** * wrapps the query function of the storage instance. */ _queryStorageInstance(rxQuery: RxQuery | RxQueryBase, limit?: number, noDecrypt?: boolean): Promise<any[]>; /** * TODO internally call bulkInsert * to not have duplicated code. */ insert(json: RxDocumentType | RxDocument): Promise<RxDocument<RxDocumentType, OrmMethods>>; bulkInsert(docsData: RxDocumentType[]): Promise<{ success: RxDocument<RxDocumentType, OrmMethods>[]; error: RxStorageBulkWriteError<RxDocumentType>[]; }>; bulkRemove(ids: string[]): Promise<{ success: RxDocument<RxDocumentType, OrmMethods>[]; error: RxStorageBulkWriteError<RxDocumentType>[]; }>; /** * same as insert but overwrites existing document with same primary */ upsert(json: Partial<RxDocumentType>): Promise<RxDocument<RxDocumentType, OrmMethods>>; /** * upserts to a RxDocument, uses atomicUpdate if document already exists */ atomicUpsert(json: Partial<RxDocumentType>): Promise<RxDocument<RxDocumentType, OrmMethods>>; find(queryObj?: MangoQuery<RxDocumentType>): RxQuery<RxDocumentType, RxDocument<RxDocumentType, OrmMethods>[]>; findOne(queryObj?: MangoQueryNoLimit<RxDocumentType> | string): RxQuery<RxDocumentType, RxDocument<RxDocumentType, OrmMethods> | null>; /** * find a list documents by their primary key * has way better performance then running multiple findOne() or a find() with a complex $or-selected */ findByIds(ids: string[]): Promise<Map<string, RxDocument<RxDocumentType, OrmMethods>>>; /** * like this.findByIds but returns an observable * that always emits the current state */ findByIds$(ids: string[]): Observable<Map<string, RxDocument<RxDocumentType, OrmMethods>>>; /** * Export collection to a JSON friendly format. * @param _decrypted * When true, all encrypted values will be decrypted. * When false or omitted and an interface or type is loaded in this collection, * all base properties of the type are typed as `any` since data could be encrypted. */ exportJSON(_decrypted: boolean): Promise<RxDumpCollection<RxDocumentType>>; exportJSON(_decrypted?: false): Promise<RxDumpCollectionAny<RxDocumentType>>; /** * Import the parsed JSON export into the collection. * @param _exportedJSON The previously exported data from the `<collection>.exportJSON()` method. */ importJSON(_exportedJSON: RxDumpCollectionAny<RxDocumentType>): Promise<void>; /** * sync with a CouchDB endpoint */ syncCouchDB(_syncOptions: SyncOptions): RxCouchDBReplicationState; /** * sync with a GraphQL endpoint */ syncGraphQL(_options: SyncOptionsGraphQL<RxDocumentType>): RxGraphQLReplicationState<RxDocumentType>; /** * Create a replicated in-memory-collection */ inMemory(): Promise<RxCollection<RxDocumentType, OrmMethods>>; /** * HOOKS */ addHook(when: string, key: string, fun: any, parallel?: boolean): void; getHooks(when: string, key: string): any; _runHooks(when: string, key: string, data: any, instance?: any): Promise<any>; /** * does the same as ._runHooks() but with non-async-functions */ _runHooksSync(when: string, key: string, data: any, instance: any): void; /** * creates a temporaryDocument which can be saved later */ newDocument(docData?: Partial<RxDocumentType>): RxDocument<RxDocumentType, OrmMethods>; destroy(): Promise<boolean>; /** * remove all data of the collection */ remove(): Promise<any>; get asRxCollection(): RxCollection<RxDocumentType, OrmMethods, StaticMethods>; } /** * creates and prepares a new collection */ export declare function createRxCollection({ database, name, schema, instanceCreationOptions, migrationStrategies, autoMigrate, statics, methods, attachments, options, cacheReplacementPolicy }: any, wasCreatedBefore: boolean): Promise<RxCollection>; export declare function isRxCollection(obj: any): boolean;
{ "content_hash": "0253a1e4b1c497eb1501e116ac06290e", "timestamp": "", "source": "github", "line_count": 168, "max_line_length": 438, "avg_line_length": 46.875, "alnum_prop": 0.7165714285714285, "repo_name": "cdnjs/cdnjs", "id": "95ebbf841d796d647b560cf4d6bc062212315cf2", "size": "7875", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "ajax/libs/rxdb/11.6.1/types/rx-collection.d.ts", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
title: 'Project Management' date: 2018-11-18T12:33:46+10:00 icon: 'services/service-icon-1.png' draft: false featured: false weight: 1 heroHeading: 'Project Management' heroSubHeading: 'Professional project management for large and small projects' heroBackground: 'images/service1.jpg' --- I am a positive, driven and structured Senior Project Manager, Coach and Entrepreneur with 20 years of experience within the IT industry. My passion is to help people and organizations grow and deliver great results through pragmatic approaches where people take the central role. Processes and tools should support people and teams, not the other way around. Communication, and a bit of fun, is the key to make this work! I have a wide experience of delivering IT projects, ranging from challenging complex global integration projects to internal process improvement projects, in several of the largest manufacturing companies in Sweden. I lived in Silicon Valley for three years, during which time I experienced the challenging task of leading teams remotely from a different time zone. I have been part of building organizations from scratch to refining already running ones. The project teams have often been multicultural and the language either English or Swedish. One of my strengths is the ability to see the overall picture and, with a background as a developer and database administrator, understand the technical details as well. I tend to see how different changes will effect the projects and this allows me to take the necessary action to handle them. Flexibility and situation based work is essential. I coach and mentor other Project Managers and Entrepreneurs who wants to either grow in their personal role or in their own business, from new startups to more mature companies.
{ "content_hash": "f79b7995664bf37b18dd21eee09594f8", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 345, "avg_line_length": 74.66666666666667, "alnum_prop": 0.8141741071428571, "repo_name": "andersjanmyr/equilo", "id": "700fe173c62a3aedd6011a79fed40d5afa351fa6", "size": "1796", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "content/pages/project-management.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "60738" }, { "name": "HTML", "bytes": "21399" }, { "name": "JavaScript", "bytes": "393" } ], "symlink_target": "" }
'use strict'; const BatchedBridge = require('BatchedBridge'); const EventEmitter = require('EventEmitter'); const Set = require('Set'); const TaskQueue = require('TaskQueue'); const infoLog = require('infoLog'); const invariant = require('fbjs/lib/invariant'); /* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error * found when Flow v0.54 was deployed. To see the error delete this comment and * run Flow. */ const keyMirror = require('fbjs/lib/keyMirror'); type Handle = number; import type {Task} from 'TaskQueue'; const _emitter = new EventEmitter(); const DEBUG_DELAY = 0; const DEBUG = false; /** * InteractionManager allows long-running work to be scheduled after any * interactions/animations have completed. In particular, this allows JavaScript * animations to run smoothly. * * Applications can schedule tasks to run after interactions with the following: * * ``` * InteractionManager.runAfterInteractions(() => { * // ...long-running synchronous task... * }); * ``` * * Compare this to other scheduling alternatives: * * - requestAnimationFrame(): for code that animates a view over time. * - setImmediate/setTimeout(): run code later, note this may delay animations. * - runAfterInteractions(): run code later, without delaying active animations. * * The touch handling system considers one or more active touches to be an * 'interaction' and will delay `runAfterInteractions()` callbacks until all * touches have ended or been cancelled. * * InteractionManager also allows applications to register animations by * creating an interaction 'handle' on animation start, and clearing it upon * completion: * * ``` * var handle = InteractionManager.createInteractionHandle(); * // run animation... (`runAfterInteractions` tasks are queued) * // later, on animation completion: * InteractionManager.clearInteractionHandle(handle); * // queued tasks run if all handles were cleared * ``` * * `runAfterInteractions` takes either a plain callback function, or a * `PromiseTask` object with a `gen` method that returns a `Promise`. If a * `PromiseTask` is supplied, then it is fully resolved (including asynchronous * dependencies that also schedule more tasks via `runAfterInteractions`) before * starting on the next task that might have been queued up synchronously * earlier. * * By default, queued tasks are executed together in a loop in one * `setImmediate` batch. If `setDeadline` is called with a positive number, then * tasks will only be executed until the deadline (in terms of js event loop run * time) approaches, at which point execution will yield via setTimeout, * allowing events such as touches to start interactions and block queued tasks * from executing, making apps more responsive. */ var InteractionManager = { Events: keyMirror({ interactionStart: true, interactionComplete: true, }), /** * Schedule a function to run after all interactions have completed. Returns a cancellable * "promise". */ runAfterInteractions(task: ?Task): {then: Function, done: Function, cancel: Function} { const tasks = []; const promise = new Promise(resolve => { _scheduleUpdate(); if (task) { tasks.push(task); } tasks.push({run: resolve, name: 'resolve ' + (task && task.name || '?')}); _taskQueue.enqueueTasks(tasks); }); return { then: promise.then.bind(promise), done: (...args) => { if (promise.done) { return promise.done(...args); } else { console.warn('Tried to call done when not supported by current Promise implementation.'); } }, cancel: function() { _taskQueue.cancelTasks(tasks); }, }; }, /** * Notify manager that an interaction has started. */ createInteractionHandle(): Handle { DEBUG && infoLog('create interaction handle'); _scheduleUpdate(); var handle = ++_inc; _addInteractionSet.add(handle); return handle; }, /** * Notify manager that an interaction has completed. */ clearInteractionHandle(handle: Handle) { DEBUG && infoLog('clear interaction handle'); invariant( !!handle, 'Must provide a handle to clear.' ); _scheduleUpdate(); _addInteractionSet.delete(handle); _deleteInteractionSet.add(handle); }, addListener: _emitter.addListener.bind(_emitter), /** * A positive number will use setTimeout to schedule any tasks after the * eventLoopRunningTime hits the deadline value, otherwise all tasks will be * executed in one setImmediate batch (default). */ setDeadline(deadline: number) { _deadline = deadline; }, }; const _interactionSet = new Set(); const _addInteractionSet = new Set(); const _deleteInteractionSet = new Set(); const _taskQueue = new TaskQueue({onMoreTasks: _scheduleUpdate}); let _nextUpdateHandle = 0; let _inc = 0; let _deadline = -1; declare function setImmediate(callback: any, ...args: Array<any>): number; /** * Schedule an asynchronous update to the interaction state. */ function _scheduleUpdate() { if (!_nextUpdateHandle) { if (_deadline > 0) { /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an * error found when Flow v0.63 was deployed. To see the error delete this * comment and run Flow. */ _nextUpdateHandle = setTimeout(_processUpdate, 0 + DEBUG_DELAY); } else { _nextUpdateHandle = setImmediate(_processUpdate); } } } /** * Notify listeners, process queue, etc */ function _processUpdate() { _nextUpdateHandle = 0; var interactionCount = _interactionSet.size; _addInteractionSet.forEach(handle => _interactionSet.add(handle) ); _deleteInteractionSet.forEach(handle => _interactionSet.delete(handle) ); var nextInteractionCount = _interactionSet.size; if (interactionCount !== 0 && nextInteractionCount === 0) { // transition from 1+ --> 0 interactions _emitter.emit(InteractionManager.Events.interactionComplete); } else if (interactionCount === 0 && nextInteractionCount !== 0) { // transition from 0 --> 1+ interactions _emitter.emit(InteractionManager.Events.interactionStart); } // process the queue regardless of a transition if (nextInteractionCount === 0) { while (_taskQueue.hasTasksToProcess()) { _taskQueue.processNext(); if (_deadline > 0 && BatchedBridge.getEventLoopRunningTime() >= _deadline) { // Hit deadline before processing all tasks, so process more later. _scheduleUpdate(); break; } } } _addInteractionSet.clear(); _deleteInteractionSet.clear(); } module.exports = InteractionManager;
{ "content_hash": "ca08ef4946fa95b0e6f78119850dd9d5", "timestamp": "", "source": "github", "line_count": 210, "max_line_length": 99, "avg_line_length": 32.076190476190476, "alnum_prop": 0.6879453681710214, "repo_name": "ptmt/react-native-macos", "id": "489c5de9148f5f6087e7fb5fef8665acfd9211ae", "size": "7094", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "Libraries/Interaction/InteractionManager.js", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "15392" }, { "name": "Batchfile", "bytes": "682" }, { "name": "C", "bytes": "44835" }, { "name": "C++", "bytes": "900849" }, { "name": "CSS", "bytes": "1116" }, { "name": "HTML", "bytes": "162528" }, { "name": "Java", "bytes": "2847888" }, { "name": "JavaScript", "bytes": "3661796" }, { "name": "Kotlin", "bytes": "698" }, { "name": "Makefile", "bytes": "7402" }, { "name": "Objective-C", "bytes": "1911883" }, { "name": "Objective-C++", "bytes": "317352" }, { "name": "Ruby", "bytes": "15240" }, { "name": "Shell", "bytes": "52222" }, { "name": "Starlark", "bytes": "108010" } ], "symlink_target": "" }
@interface ViewController () <UITableViewDataSource, UITableViewDelegate, StatusCellDelegate, UITextFieldDelegate, CommentToolBarDelegate> @property (nonatomic, strong) NSMutableArray<StatusFrameModel *> *frameModels; @property (nonatomic, weak) UITableView *tableView; @property (nonatomic, weak) CommentToolBar *commentToolBar; @property (nonatomic, assign, getter=isChangingKeyboardEmotion) BOOL changingKeyboardEmotion; @property (nonatomic, strong) NSIndexPath *currentCommentIndexPath; @property (nonatomic, strong) EmotionKeyboard *keyboardEmotion; @property (nonatomic, strong) BSEmotionKeyboard *keyboardEmotion_new; @end @implementation ViewController - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.navigationItem.title = @"朋友圈"; UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight) style:UITableViewStyleGrouped]; tableView.dataSource = self; tableView.delegate = self; [self.view addSubview:tableView]; self.tableView = tableView; CommentToolBar *commentToolBar = [CommentToolBar toolBar]; commentToolBar.frame = CGRectMake(0, kScreenHeight, kScreenWidth, 44); commentToolBar.textFileld.delegate = self; commentToolBar.delegate = self; [self.view addSubview:commentToolBar]; self.commentToolBar = commentToolBar; [self addNotificationObserver]; [self creatData]; [self.tableView reloadData]; } - (void)addNotificationObserver { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clickSmallPicture:) name:kEmotionKeyboardDidClickSmallPicture object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clickEmoji:) name:kEmotionKeyboardDidClickEmoji object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clickLargePicture:) name:kEmotionKeyboardDidClickLargePicture object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clickDeleteButton:) name:kEmotionKeyboardDidClickDeleteButton object:nil]; } - (void)keyboardWillShow:(NSNotification *)noti { // 键盘弹出需要的时间 CGFloat duration = [noti.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; // 动画 [UIView animateWithDuration:duration animations:^{ // 取出键盘高度 CGRect keyboardF = [noti.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; CGFloat keyboardH = keyboardF.size.height + 44; self.commentToolBar.transform = CGAffineTransformMakeTranslation(0, -keyboardH); // cell滚动到键盘上边 CGRect toolBarRect = [self.view convertRect:self.commentToolBar.frame toView:[UIApplication sharedApplication].keyWindow]; CGRect currentCellRect = [self.tableView convertRect:[self.tableView cellForRowAtIndexPath:self.currentCommentIndexPath].frame toView:[UIApplication sharedApplication].keyWindow]; CGFloat padding = toolBarRect.origin.y - (currentCellRect.origin.y + currentCellRect.size.height); [self.tableView setContentOffset:CGPointMake(0, self.tableView.contentOffset.y - padding)]; }]; } - (void)keyboardWillHide:(NSNotification *)noti { if (self.isChangingKeyboardEmotion) return; CGFloat duration = [noti.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; [UIView animateWithDuration:duration animations:^{ self.commentToolBar.transform = CGAffineTransformIdentity; }]; } - (void)clickSmallPicture:(NSNotification *)noti { BSEmotionSmallPicture *smallPicture = noti.object; NSLog(@"smallPicture=====%@", smallPicture.chs); } - (void)clickEmoji:(NSNotification *)noti { BSEmotionEmoji *emoji = noti.object; [self.commentToolBar.textFileld insertText:emoji.emojiString]; NSLog(@"emoji=====%@", self.commentToolBar.textFileld.text); } - (void)clickLargePicture:(NSNotification *)noti { BSEmotionLargePicture *largePicture = noti.object; NSLog(@"largePicture=====%@", largePicture.chs); } - (void)clickDeleteButton:(NSNotification *)noti { NSLog(@"delete emotion----%@", self.commentToolBar.textFileld.text); [self.commentToolBar.textFileld deleteBackward]; } - (void)creatData { NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Model" ofType:@"plist"]; NSArray *dataArr = [NSArray arrayWithContentsOfFile:filePath]; for (NSDictionary *dict in dataArr) { StatusModel *model = [StatusModel mj_objectWithKeyValues:dict]; StatusFrameModel *frameModel = [[StatusFrameModel alloc] init]; frameModel.model = model; [self.frameModels addObject:frameModel]; } } #pragma mark - Getter - (NSMutableArray<StatusFrameModel *> *)frameModels { if (_frameModels == nil) { _frameModels = [NSMutableArray array]; } return _frameModels; } - (EmotionKeyboard *)keyboardEmotion { if (_keyboardEmotion == nil) { _keyboardEmotion = [EmotionKeyboard emotionKeyboard]; _keyboardEmotion.bounds = CGRectMake(0, 0, kScreenWidth, kDIYKeyboardHeight); } return _keyboardEmotion; } - (BSEmotionKeyboard *)keyboardEmotion_new { if (_keyboardEmotion_new == nil) { [BSEmotionKeyboard setKeyboardHeight:216.0]; _keyboardEmotion_new = [BSEmotionKeyboard emotionKeyboard]; _keyboardEmotion_new.emotionModels = [self createEmotionData]; } return _keyboardEmotion_new; } - (NSArray<BSEmotionModel *> *)createEmotionData { NSMutableArray<BSEmotionModel *> *models = [NSMutableArray array]; BSEmotionModel *model0 = [[BSEmotionModel alloc] init]; model0.emotionType = BSEmotionType_SmallPicture; model0.plistDirectory = @"EmotionIcons/default/info.plist"; model0.directory = @"EmotionIcons/default"; PTToolbarItem *item0 = [[PTToolbarItem alloc] init]; item0.indexTextString = @"默认"; model0.toolbarItem = item0; [models addObject:model0]; BSEmotionModel *model1 = [[BSEmotionModel alloc] init]; model1.emotionType = BSEmotionType_Emoji; model1.plistDirectory = @"EmotionIcons/emoji/info.plist"; model1.directory = @"EmotionIcons/emoji"; PTToolbarItem *item1 = [[PTToolbarItem alloc] init]; item1.indexTextString = @"emoji"; model1.toolbarItem = item1; [models addObject:model1]; BSEmotionModel *model2 = [[BSEmotionModel alloc] init]; model2.emotionType = BSEmotionType_SmallPicture; model2.plistDirectory = @"EmotionIcons/lxh/info.plist"; model2.directory = @"EmotionIcons/lxh"; PTToolbarItem *item2 = [[PTToolbarItem alloc] init]; item2.indexTextString = @"浪小花"; model2.toolbarItem = item2; [models addObject:model2]; return models; } #pragma mark - UITableViewDataSource - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.frameModels.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { StatusCell *cell = [StatusCell cellWithTableView:tableView]; cell.currentIndexPath = indexPath; cell.delegate = self; cell.frameModel = self.frameModels[indexPath.row]; return cell; } #pragma mark - UITableViewDelegate - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [cell setSeparatorInset:UIEdgeInsetsZero]; } if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) { [cell setPreservesSuperviewLayoutMargins:NO]; } if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { [cell setLayoutMargins:UIEdgeInsetsZero]; } } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return self.frameModels[indexPath.row].cellHeight; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { } #pragma mark - CommentToolBarDelegate - (void)commentToolBar:(CommentToolBar *)commentToolBar didClickKeyboardChangeButton:(UIButton *)keyboardChangeButton { self.changingKeyboardEmotion = YES; if (commentToolBar.textFileld.inputView) { // 当前有自定义键盘 if (commentToolBar.textFileld.inputView == self.keyboardEmotion_new) { commentToolBar.textFileld.inputView = nil; commentToolBar.showEmotionButton = YES; } } else { // 当前为系统键盘,切换为自定义键盘 commentToolBar.textFileld.inputView = self.keyboardEmotion_new; commentToolBar.showEmotionButton = NO; } [commentToolBar.textFileld resignFirstResponder]; // 关闭键盘 self.changingKeyboardEmotion = NO; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [commentToolBar.textFileld becomeFirstResponder]; // 打开键盘 }); } #pragma mark - UITextFieldDelegate - (BOOL)textFieldShouldReturn:(UITextField *)textField { // 发评论 StatusFrameModel *frameModel = self.frameModels[self.currentCommentIndexPath.row]; StatusModel *model = frameModel.model; StatusComment *newComment = [[StatusComment alloc] init]; newComment.commentName = @"Bean"; newComment.commentDetail = textField.text; NSMutableArray<StatusComment *> *comments = [NSMutableArray arrayWithArray:model.comments]; [comments addObject:newComment]; model.comments = comments; StatusFrameModel *newFrameModel = [[StatusFrameModel alloc] init]; newFrameModel.model = model; [self.frameModels replaceObjectAtIndex:self.currentCommentIndexPath.row withObject:newFrameModel]; [self.tableView reloadRowsAtIndexPaths:@[self.currentCommentIndexPath] withRowAnimation:UITableViewRowAnimationNone]; textField.text = nil; [self.commentToolBar.textFileld resignFirstResponder]; return YES; } #pragma mark - StatusCellDelegate - (void)statusCell:(StatusCell *)statusCell didClickCommentButton:(UIButton *)commentButton tableViewIndexPath:(NSIndexPath *)indexPath { if (self.currentCommentIndexPath == indexPath) { if (self.commentToolBar.textFileld.isFirstResponder) return; [self.commentToolBar.textFileld becomeFirstResponder]; } else { self.currentCommentIndexPath = indexPath; if (self.commentToolBar.textFileld.isFirstResponder) { [self.commentToolBar.textFileld resignFirstResponder]; } [self.commentToolBar.textFileld becomeFirstResponder]; } } - (void)statusCell:(StatusCell *)statusCell comments:(NSArray<StatusComment *> *)comments deleteComment:(StatusComment *)comment tableViewIndexPath:(NSIndexPath *)indexPath { // 删评论 StatusFrameModel *frameModel = self.frameModels[indexPath.row]; StatusModel *model = frameModel.model; NSInteger index = [comments indexOfObject:comment]; NSMutableArray<StatusComment *> *newComments = [NSMutableArray arrayWithArray:comments]; [newComments removeObjectAtIndex:index]; model.comments = newComments; StatusFrameModel *newFrameModel = [[StatusFrameModel alloc] init]; newFrameModel.model = model; [self.frameModels replaceObjectAtIndex:indexPath.row withObject:newFrameModel]; [self.tableView reloadData]; } #pragma mark - UITextViewDelegate - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { [self.commentToolBar.textFileld resignFirstResponder]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end
{ "content_hash": "8b303867f270b2ddd40da4fa20547f32", "timestamp": "", "source": "github", "line_count": 329, "max_line_length": 187, "avg_line_length": 36.88449848024316, "alnum_prop": 0.7396786155747836, "repo_name": "wangbaoshan/iOS", "id": "6c324e492c5488b83473782821b4895a603857ca", "size": "12848", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Demo/CommentCell/CommentCell/ViewController.m", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "7105" }, { "name": "Objective-C", "bytes": "2642796" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>framework</display-name> <session-config> <session-timeout>30</session-timeout> </session-config> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:application-context.xml</param-value> </context-param> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:log4j.xml</param-value> </context-param> <context-param> <param-name>webAppRootKey</param-name> <param-value>framework</param-value> </context-param> <filter> <filter-name>Set Character Encoding</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>Set Character Encoding</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <!-- FilterDispatcher用来初始化struts 2并且处理所有的Web请求。 --> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
{ "content_hash": "bb83f5c5d7a8e60ef6d1ff54b0e59fda", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 166, "avg_line_length": 32.12903225806452, "alnum_prop": 0.7304216867469879, "repo_name": "ioplee/schoolv1.0", "id": "4407715aecbb532236f85cf2c02b335974942f62", "size": "2022", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/webapp/WEB-INF/web.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "232" }, { "name": "Java", "bytes": "118034" }, { "name": "Shell", "bytes": "253" } ], "symlink_target": "" }
DAVShare ======== WebDAV based file share solution ## Install $ wget https://raw.github.com/Tefx/DAVShare/master/install.sh $ chmod a+x ./install.sh $ sudo ./install.sh
{ "content_hash": "7c36103e12a8cdf570a850ef8bdb15c7", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 62, "avg_line_length": 15.909090909090908, "alnum_prop": 0.6857142857142857, "repo_name": "Tefx/DAVShare", "id": "8ef3133028b2b1c3f0cb45482c1f97c705edca56", "size": "175", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "9353" } ], "symlink_target": "" }
package org.wikidata.wdtk.datamodel.implementation; import com.fasterxml.jackson.annotation.JacksonInject; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.Validate; import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue; import org.wikidata.wdtk.datamodel.interfaces.Statement; import org.wikidata.wdtk.datamodel.interfaces.StatementDocument; import org.wikidata.wdtk.datamodel.interfaces.StatementGroup; import org.wikidata.wdtk.util.NestedIterator; import java.util.*; import java.util.Map.Entry; /** * Abstract Jackson implementation of {@link StatementDocument}. * You should not rely on it directly. * * @author Fredo Erxleben * @author Antonin Delpeuch * @author Thomas Pellissier Tanon * */ abstract class StatementDocumentImpl extends EntityDocumentImpl implements StatementDocument { /** * This is what is called <i>claim</i> in the JSON model. It corresponds to * the statement group in the WDTK model. */ protected final Map<String, List<Statement>> claims; /** * Statement groups. This member is initialized when statements are * accessed. */ private List<StatementGroup> statementGroups; /** * Constructor. * * @param id * the identifier of the subject of this document * @param claims * the statement groups contained in this document * @param revisionId * the id of the last revision of this document */ StatementDocumentImpl( EntityIdValue id, List<StatementGroup> claims, long revisionId) { super(id, revisionId); this.claims = new HashMap<>(); if(claims != null) { for(StatementGroup group : claims) { EntityIdValue otherId = group.getSubject(); otherId.getIri(); Validate.isTrue(group.getSubject().equals(id), "Subject for the statement group and the document are different: "+otherId.toString()+" vs "+id.toString()); this.claims.put(group.getProperty().getId(), group.getStatements()); } } } /** * Copy constructor. * * @param id * @param claims * @param revisionId */ protected StatementDocumentImpl( EntityIdValue id, Map<String, List<Statement>> claims, long revisionId) { super(id, revisionId); this.claims = claims; } /** * Constructor used for JSON deserialization with Jackson. */ StatementDocumentImpl( @JsonProperty("id") String jsonId, @JsonProperty("claims") Map<String, List<StatementImpl.PreStatement>> claims, @JsonProperty("lastrevid") long revisionId, @JacksonInject("siteIri") String siteIri) { super(jsonId, revisionId, siteIri); if (claims != null) { this.claims = new HashMap<>(); EntityIdValue subject = this.getEntityId(); for (Entry<String, List<StatementImpl.PreStatement>> entry : claims .entrySet()) { List<Statement> statements = new ArrayList<>(entry.getValue().size()); for (StatementImpl.PreStatement statement : entry.getValue()) { statements.add(statement.withSubject(subject)); } this.claims.put(entry.getKey(), statements); } } else { this.claims = Collections.emptyMap(); } } @JsonIgnore @Override public List<StatementGroup> getStatementGroups() { if (this.statementGroups == null) { this.statementGroups = new ArrayList<>(this.claims.size()); for (List<Statement> statements : this.claims.values()) { this.statementGroups .add(new StatementGroupImpl(statements)); } } return this.statementGroups; } /** * Find a statement group by its property id, without checking for * equality with the site IRI. More efficient implementation than * the default one. */ public StatementGroup findStatementGroup(String propertyIdValue) { if (this.claims.containsKey(propertyIdValue)) { return new StatementGroupImpl(this.claims.get(propertyIdValue)); } return null; } /** * Returns the "claims". Only used by Jackson. * <p> * JSON "claims" correspond to statement groups in the WDTK model. You * should use {@link ItemDocumentImpl#getStatementGroups()} to obtain * this data. * * @return map of statement groups */ @JsonProperty("claims") public Map<String, List<Statement>> getJsonClaims() { return this.claims; } @Override @JsonIgnore public Iterator<Statement> getAllStatements() { return new NestedIterator<>(getStatementGroups()); } /** * Adds a Statement to a given collection of statement groups. * If the statement id is not null and matches that of an existing statement, * this statement will be replaced. * * @param statement * @param claims * @return */ protected static Map<String, List<Statement>> addStatementToGroups(Statement statement, Map<String, List<Statement>> claims) { Map<String, List<Statement>> newGroups = new HashMap<>(claims); String pid = statement.getMainSnak().getPropertyId().getId(); if(newGroups.containsKey(pid)) { List<Statement> newGroup = new ArrayList<>(newGroups.get(pid).size()); boolean statementReplaced = false; for(Statement existingStatement : newGroups.get(pid)) { if(existingStatement.getStatementId().equals(statement.getStatementId()) && !existingStatement.getStatementId().isEmpty()) { statementReplaced = true; newGroup.add(statement); } else { newGroup.add(existingStatement); } } if(!statementReplaced) { newGroup.add(statement); } newGroups.put(pid, newGroup); } else { newGroups.put(pid, Collections.singletonList(statement)); } return newGroups; } /** * Removes statement ids from a collection of statement groups. * @param statementIds * @param claims * @return */ protected static Map<String, List<Statement>> removeStatements(Set<String> statementIds, Map<String, List<Statement>> claims) { Map<String, List<Statement>> newClaims = new HashMap<>(claims.size()); for(Entry<String, List<Statement>> entry : claims.entrySet()) { List<Statement> filteredStatements = new ArrayList<>(); for(Statement s : entry.getValue()) { if(!statementIds.contains(s.getStatementId())) { filteredStatements.add(s); } } if(!filteredStatements.isEmpty()) { newClaims.put(entry.getKey(), filteredStatements); } } return newClaims; } }
{ "content_hash": "a54369d446904866257372199b62d3a6", "timestamp": "", "source": "github", "line_count": 208, "max_line_length": 159, "avg_line_length": 30.048076923076923, "alnum_prop": 0.71184, "repo_name": "Wikidata/Wikidata-Toolkit", "id": "619081e9325658caba2f57875c82276c74f69fb1", "size": "6921", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/StatementDocumentImpl.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "40410" }, { "name": "Java", "bytes": "2450764" } ], "symlink_target": "" }
Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It also provides a test domain-specific language (Selenese) to write tests in a number of popular programming languages.
{ "content_hash": "13aeea8dc7bf3726746355e7540dfeb9", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 80, "avg_line_length": 78, "alnum_prop": 0.8333333333333334, "repo_name": "WPN-XM/software", "id": "8a0e018f5ffc3a78049b7c33e8f63483c0fd87c0", "size": "325", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "selenium/README.md", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "2148" }, { "name": "PHP", "bytes": "265925" }, { "name": "Shell", "bytes": "4387" } ], "symlink_target": "" }
require "test/test_helper" class Sky < ActiveRecord::Base connection.drop_table :skies if table_exists? connection.create_table :skies do |t| t.integer :height t.timestamps end named_scope :high, lambda { { :conditions=>"height >= 4" } } end context "ActiveRecord Metric" do test "record count" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky end RUBY end Vanity.playground.metrics Sky.create! assert_equal 1, Sky.count assert_equal 1, Vanity::Metric.data(metric(:sky_is_limit)).last.last end test "record sum" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky, :sum=>:height end RUBY end Vanity.playground.metrics Sky.create! :height=>4 Sky.create! :height=>2 assert_equal 6, Vanity::Metric.data(metric(:sky_is_limit)).last.last end test "record average" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky, :average=>:height end RUBY end Vanity.playground.metrics Sky.create! :height=>8 Sky.create! :height=>2 assert_equal 5, Vanity::Metric.data(metric(:sky_is_limit)).last.last end test "record minimum" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky, :minimum=>:height end RUBY end Vanity.playground.metrics Sky.create! :height=>4 Sky.create! :height=>2 assert_equal 2, Vanity::Metric.data(metric(:sky_is_limit)).last.last end test "record maximum" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky, :maximum=>:height end RUBY end Vanity.playground.metrics Sky.create! :height=>4 Sky.create! :height=>2 assert_equal 4, Vanity::Metric.data(metric(:sky_is_limit)).last.last end test "with conditions" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky, :sum=>:height, :conditions=>["height > 4"] end RUBY end Vanity.playground.metrics high_skies = 0 metric(:sky_is_limit).hook do |metric_id, timestamp, height| assert height > 4 high_skies += height end [nil,5,3,6].each do |height| Sky.create! :height=>height end assert_equal 11, Vanity::Metric.data(metric(:sky_is_limit)).sum(&:last) assert_equal 11, high_skies end test "with scope" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky.high end RUBY end Vanity.playground.metrics total = 0 metric(:sky_is_limit).hook do |metric_id, timestamp, count| total += count end Sky.create! :height=>4 Sky.create! :height=>2 assert_equal 1, Vanity::Metric.data(metric(:sky_is_limit)).last.last assert_equal 1, total end test "with timestamp" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky, :timestamp => :created_at end RUBY end Vanity.playground.metrics Sky.create! assert_equal 1, Sky.count assert_equal 1, Vanity::Metric.data(metric(:sky_is_limit)).last.last end test "with timestamp and table" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky, :timestamp => 'skies.created_at' end RUBY end Vanity.playground.metrics Sky.create! assert_equal 1, Sky.count assert_equal 1, Vanity::Metric.data(metric(:sky_is_limit)).last.last end test "hooks" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky, :sum=>:height end RUBY end Vanity.playground.metrics total = 0 metric(:sky_is_limit).hook do |metric_id, timestamp, count| assert_equal :sky_is_limit, metric_id assert_in_delta Time.now.to_i, timestamp.to_i, 1 total += count end Sky.create! :height=>4 assert_equal 4, total end test "no hooks when metrics disabled" do not_collecting! File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky, :sum=>:height end RUBY end Vanity.playground.metrics total = 0 metric(:sky_is_limit).hook do |metric_id, timestamp, count| total += count end Sky.create! :height=>4 assert_equal 0, total end test "after_create not after_save" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky end RUBY end Vanity.playground.metrics once = nil metric(:sky_is_limit).hook do fail "Metric tracked twice" if once once = true end Sky.create! Sky.last.update_attributes :height=>4 end test "with after_save" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky, :conditions=>["height > 3"] Sky.after_save { |sky| track! if sky.height_changed? && sky.height > 3 } end RUBY end Vanity.playground.metrics times = 0 metric(:sky_is_limit).hook do times += 1 end Sky.create! (1..5).each do |height| Sky.last.update_attributes! :height=>height end assert_equal 2, times end test "do it youself" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do Sky.after_save { |sky| track! if sky.height_changed? && sky.height > 3 } end RUBY end Vanity.playground.metrics (1..5).each do |height| Sky.create! :height=>height end Sky.first.update_attributes! :height=>4 assert_equal 3, Vanity::Metric.data(metric(:sky_is_limit)).last.last end test "last update for new metric" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky end RUBY end assert_nil metric(:sky_is_limit).last_update_at end test "last update with records" do File.open "tmp/experiments/metrics/sky_is_limit.rb", "w" do |f| f.write <<-RUBY metric "Sky is limit" do model Sky end RUBY end Sky.create! :height=>1 Timecop.freeze Time.now + 1.day do Sky.create! :height=>1 end assert_in_delta metric(:sky_is_limit).last_update_at.to_i, (Time.now + 1.day).to_i, 1 end teardown do Sky.delete_all Sky.after_create.clear Sky.after_save.clear end end
{ "content_hash": "0dc4de6fc7d039fef906b1d0ea47cd0b", "timestamp": "", "source": "github", "line_count": 277, "max_line_length": 89, "avg_line_length": 26.23465703971119, "alnum_prop": 0.6035502958579881, "repo_name": "Headlinerfm/vanity", "id": "35d616ad3bcc94698f0d59434273dce8ceda1aab", "size": "7267", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/metric/active_record_test.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5550" }, { "name": "JavaScript", "bytes": "4276" }, { "name": "Ruby", "bytes": "186567" } ], "symlink_target": "" }
namespace crashpad { //! \brief Ensures that a range, composed of a base and a size, does not //! overflow the pointer type of the process it describes a range in. //! //! This class checks bases of type WinVMAddress and sizes of type WinVMSize //! against a process whose pointer type is either 32 or 64 bits wide. //! //! Aside from varying the overall range on the basis of a process' pointer type //! width, this class functions very similarly to CheckedRange. using CheckedWinAddressRange = internal::CheckedAddressRangeGeneric<WinVMAddress, WinVMSize>; } // namespace crashpad #endif // CRASHPAD_UTIL_WIN_CHECKED_WIN_ADDRESS_RANGE_H_
{ "content_hash": "55494c3d766d46610fb4b03642e964de", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 80, "avg_line_length": 40.8125, "alnum_prop": 0.7503828483920367, "repo_name": "chromium/chromium", "id": "3e0eac14d82bd88ab74426b8e59df4108564e409", "size": "1447", "binary": false, "copies": "9", "ref": "refs/heads/main", "path": "third_party/crashpad/crashpad/util/win/checked_win_address_range.h", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
exports.up = (pgm) => { pgm.alterMaterializedView('mv', { storageParameters: { autovacuum_enabled: false, autovacuum_vacuum_threshold: 10, }, }) } exports.down = () => null
{ "content_hash": "8f1c81d5a2bf02f7c8c00ee39bf9f6f4", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 38, "avg_line_length": 19.8, "alnum_prop": 0.601010101010101, "repo_name": "salsita/node-pg-migrate", "id": "b0d5a363bcfa213e1de89dae5db2bb543b5468fc", "size": "198", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "test/migrations/067_materialized_view_alter.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "43557" }, { "name": "Shell", "bytes": "58" }, { "name": "TypeScript", "bytes": "189660" } ], "symlink_target": "" }
layout: post title: Respondent Driven Sampling language: English --- Respondent driven sampling is an example to use social networks to infer the size of a social group. The estimates do not come from naive sample proportions; instead, the sample is used to make inference about the underlying network connecting the population, and then used the inferred network information to estimate group proportion. RDS data collection begins when researchers select, in an ad hoc manner, typically 5–10 members of the target population to serve as ‘seeds’. Each seed is interviewed and provided a fixed number of coupons (usually three) that they use to **recruit other members of the target population**. These recruits are in turn provided with coupons that they use to recruit others. The idea to not take direct reported proportion is to avoid problems of non-random probabilities in the chain referral sampling methods. ## Design based inferences The design-based approach to inferring the population estimate of interest uses the probability of inclusion that is induced by the sampling selection plan designed beforehand. If the sample drawn from the population follows the design features, these features determine the value of the population estimator.. For instance, if $y$ as a binary outcome of interest. We want to estimate population mean $\mu = 1/N \sum_{i=1}^N y_i$. Population is $U$ with size $N$, and sample is $S$ with size $n$. - random sampling: the probability of inclusion is the same for each unit in the population: $\hat{\mu} = \sum_{i=1}^n y_i/n$ - stratified sampling: $\hat{\mu} = \sum_{j=1}^J \bar{y_j}/|J|$, where $J$ is each strata. (Little, Roderick J. 2004. “To Model or Not To Model? Competing Modes of Inference for Finite Population Sampling.” _Journal of the American Statistical Association_ 99 (466): 546–56.) - RDS: $\hat{\mu} = \frac{\sum_{i=1}^N S_i y_i/\hat{\pi_i}}{\sum_{i=1}^N S_i \hat{\pi_i}} = \frac{\sum_{i=1}^n y_i/\hat{\pi_i}}{\sum_{i=1}^n 1/\hat{\pi_i}}$. That is, the including probability $\pi$ also needs to be estimated, and then used in the inference process. (Gile, Krista J., and Mark S. Handcock. 2015. “Network Model-Assisted Inference from Respondent-Driven Sampling Data.” _Journal of the Royal Statistical Society: Series A (Statistics in Society)_ 178 (3): 619–39.) ​ ​ ​ ​ ## Model based inference of RDS samples ### Basics of model-based inference idea in survey sampling The idea of model-based inference is to treat population values $y_i$ are assumed to be generated by a stochastic model In contrast, design-based inference treat the population values of $y_i$ as unknown constants and the sample selected as the only source of randomness. For instance, in a simplest random sampling setting, the model is : - $y_i \sim Normal(\mu, \sigma^2)$, where $\mu, \sigma$ needs to be estimated. $\mu$ is the interested population mean, under this model. Some good references for comparing design and model based sampling: - (Gregoire 1998) - (Little 2004) ### Model-based estimators in RDS Shi, Yongren, Christopher J. Cameron, and Douglas D. Heckathorn. 2016. “Model-Based and Design-Based Inference.” *Sociological Methods & Research*, October. This paper claimed that Salganik and Heckathorn, 2004, is an example of model based estimator since "Because estimation is based on assumptions about the structure of the network linking the target popu- lation, this is an example of a model-based approach." However, Dennis's dissertation states that it uses a design-based estimator for the generalized scale-up estimators. (Feehan, Dennis M., and Matthew J. Salganik. 2016. “Generalizing the Network Scale-up Method A New Estimator for the Size of Hidden Populations.” *Sociological Methodology* 46 (1): 153–86.) It seems that Dennis and Yongren are using the similar types of estimators, that is based on the general idea that out-going ties equals the amount of in-going ties. So I am getting confused in this. ### people' statements about RDS membership - model-based - (Heckathorn 1997) - Salganik and Heckathorn, 2004 - Gile 2011/ Gile and Handcock, 2015/ (Handcock, Gile, and Mar 2015) - Model-Based Estimation with Link-Tracing Sampling Designs. - (Frank and Snijders 1994)( not very clear for now.) - (do depend on an assumed **model for the population or graph**., read (Thompson and Frank 2000) - Design-based: - Volz and Heckathorn 2008 ## RDS: matt's version 1. sampling problem: 1. non-duplication: people answer several times (since they are hidden so they do not want to revel their identity) 2. population verification: are the self-reported drug injector are really injectors? 3. ON Internet: hard to verify!! (circumvention 4. ​ 2. Assumptions: 1. participants recruit uniformly at random from networks: randomly select among drug users!!! not random over all friends. 1. recruit randomly: violate when I give coupons to people who more like it. 2. alters accept invitation at random 3. alters arrive at study to be interviewed at random (some interview sits only only on weekdays and full-time workers cannot attend) 2. The number of recruits per participant does not depend on individual traits 1. say, the recruiting are based on whether drug-injectors or not; the outcome measures is HIV-positive. 2. so, even if people are not drug-injector, you should let the recruitee to spread the coupons. 3. Violations: 1. equilibrium: 1. equilibrium: probability of selection on nodes. 2. equilibrium of sample compositions 2. Whether discarding the burn-in samples: 1. some people just do not thrown burn-in since they think that every piece of information matters . ## Directions: 1. attributes in the estimation of population characteristics. 4. ​
{ "content_hash": "22769ed27cc1f44e2810d8d973c3d0d9", "timestamp": "", "source": "github", "line_count": 152, "max_line_length": 480, "avg_line_length": 38.99342105263158, "alnum_prop": 0.7415218491648389, "repo_name": "philohistoria/philohistoria.github.com", "id": "c90ae03df862043b66bf1248f4834e500cd44450", "size": "5973", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2017-1-1-RDS.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "62905" }, { "name": "HTML", "bytes": "7350" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" PolicyId="urn:oasis:names:tc:xacml:2.0:conformance-test:IID314:policy" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:ordered-permit-overrides" Version="1.0" xsi:schemaLocation="urn:oasis:names:tc:xacml:3.0:policy:schema:os access_control-xacml-2.0-policy-schema-os.xsd"> <Description> Policy for Conformance Test IID314. Purpose: Case: Deny: RuleCombiningAlgorithm Ordered PermitOverrides </Description> <Target/> <Rule Effect="Deny" RuleId="urn:oasis:names:tc:xacml:2.0:conformance-test:IID314:rule1"> <Description> A subject whose name is J. Hibbert may not read Bart Simpson's medical record. NOTAPPLICABLE </Description> <Target> <AnyOf> <AllOf> <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">J. Hibbert</AttributeValue> <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/> </Match> </AllOf> </AnyOf> </Target> </Rule> <Rule Effect="Permit" RuleId="urn:oasis:names:tc:xacml:2.0:conformance-test:IID314:rule2"> <Description> A subject who is at least 55 years older than Bart Simpson may read Bart Simpson's medical record. NOT-APPLICABLE. </Description> <Condition> <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than-or-equal"> <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-subtract"> <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only"> <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:age" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="false"/> </Apply> <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only"> <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:bart-simpson-age" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment" DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="false"/> </Apply> </Apply> <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">55</AttributeValue> </Apply> </Condition> </Rule> </Policy>
{ "content_hash": "5629c069f0dd0a99b3d1e7b4466bdb2b", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 264, "avg_line_length": 61.458333333333336, "alnum_prop": 0.6566101694915254, "repo_name": "att/XACML", "id": "58608a571470c941945f501b7abe71fe30253eb1", "size": "2950", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "XACML-PDP/src/test/resources/testsets/conformance/xacml3.0-ct-v.0.4/IID314Policy.xml", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1492" }, { "name": "HTML", "bytes": "193016" }, { "name": "Java", "bytes": "4635186" }, { "name": "PLpgSQL", "bytes": "198552" }, { "name": "TSQL", "bytes": "568124" } ], "symlink_target": "" }
layout: post title: Doing What You Hate date: 2020-07-28 20:23 Tags: [ uncategorized, blog ] permalink: /hatebox/ author: Kevin Olega --- When I learned boxing, I had a lot of fun with the punching drills. I love punching the bag. I love practicing with the coach. I love sparring. My coach tells me I should spend time doing the following: 1. Jump rope. 2. Running. 3. Conditioning and ab workouts. I hated all three activities. I lose my breath with jump ropes, running, and I hate ab workouts. So I skip all these activities whenever possible. I have a good defense anyway. My coach throws a very light punch in my gut during sparring. I felt like I'm going to die. He tells me I can punch really hard. But it only takes one shot to put me down. I hate running, jump ropes, and ab workouts. I practice those more often now.
{ "content_hash": "41b64d04ed303c20613f9de3993e44f9", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 67, "avg_line_length": 21.125, "alnum_prop": 0.7455621301775148, "repo_name": "kevinolega/minimalchanges", "id": "4a33e46444823834175d6b68d5c5c707ade00aba", "size": "850", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2020-07-28-boxing-hate.md", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "10575" }, { "name": "Ruby", "bytes": "819" }, { "name": "SCSS", "bytes": "12541" }, { "name": "Shell", "bytes": "384" } ], "symlink_target": "" }