public Configuration(Operation operation, Constraints constraints = MathPractice.Constraints.None, Nullable<uint> leftDigits = null, Nullable<uint> rightDigits = null, bool skipVerticalPrompt = false, uint? numberOfQuestions = null) { Operation = operation; Constraints = constraints; LeftDigits = leftDigits; RightDigits = rightDigits; SkipVerticalPrompt = skipVerticalPrompt; NumberOfQuestions = numberOfQuestions; }
public FlowChartViewModel(DemoControl demo) { View = demo; //This command will get invoked when an item is added to the diagram. ItemAddedCommand = new DelegateCommand(args => OnItemAdded((ItemAddedEventArgs)args)); Constraints = Constraints.Remove(GraphConstraints.PageEditing, GraphConstraints.PanRails); //Initialize Context menu for diagram. Menu = null; // Initialize DataSourceSettings for SfDiagram DataSourceSettings = new FlowchartDataSourceSettings() { ParentId = "ParentId", Id = "Id", DataSource = GetData(), ConnectorTextMapping = "Label", ContentMapping = "Name", ShapeMapping = "_Shape", WidthMapping = "_Width", HeightMapping = "_Height" }; // Initialize LayoutSettings for SfDiagram LayoutManager = new LayoutManager() { Layout = new FlowchartLayout() { Orientation = FlowchartOrientation.TopToBottom, YesBranchValues = new List <string> { "Yes", "True", "Y", "s" }, YesBranchDirection = BranchDirection.LeftInFlow, NoBranchValues = new List <string> { "No", "N", "False", "no" }, NoBranchDirection = BranchDirection.RightInFlow, HorizontalSpacing = 50, VerticalSpacing = 50, }, }; }
public void Execute() { this.ExtensionSearchSymbolsByExtensionId = new Dictionary <string, IEnumerable <IntermediateSymbol> >(); this.OrderedSearchFacades = Array.Empty <ISearchFacade>(); var searchSymbols = this.Section.Symbols.OfType <WixSearchSymbol>().ToDictionary(t => t.Id.Id); if (searchSymbols.Count == 0) { // Nothing to do! return; } var constraints = new Constraints(); // Add relational info to our data... foreach (var searchRelationSymbol in this.Section.Symbols.OfType <WixSearchRelationSymbol>()) { constraints.AddConstraint(searchRelationSymbol.Id.Id, searchRelationSymbol.ParentSearchRef); } this.FindCircularReference(constraints); if (this.Messaging.EncounteredError) { return; } this.FlattenDependentReferences(constraints); // Reorder by topographical sort (http://en.wikipedia.org/wiki/Topological_sorting) // We use a variation of Kahn (1962) algorithm as described in // Wikipedia, with the additional criteria that start nodes are sorted // lexicographically at each step to ensure a deterministic ordering // based on 'after' dependencies and ID. var sorter = new TopologicalSort(); var sortedIds = sorter.Sort(searchSymbols.Keys, constraints); // Now, create the search facades with the searches in order... (var orderedSearchFacades, var extensionSearchSymbolsByExtensionId) = this.OrderSearches(sortedIds, searchSymbols); this.OrderedSearchFacades = orderedSearchFacades; this.ExtensionSearchSymbolsByExtensionId = extensionSearchSymbolsByExtensionId; }
private void Validate() { var errors = new List <ValidationFailure>(); foreach (var result in Variables.Select(variable => new VariableValidator <T>().Validate(variable)).Where(result => !result.IsValid)) { errors.AddRange(result.Errors.ToList()); } foreach (var result in Domains.Select(domain => new DomainValidator <T>().Validate(domain)).Where(result => !result.IsValid)) { errors.AddRange(result.Errors.ToList()); } foreach (var result in Relations.Select(relation => new RelationsValidator <T>().Validate(relation)).Where(result => !result.IsValid)) { errors.AddRange(result.Errors.ToList()); } foreach (var result in Constraints.Select(constraint => new ConstraintValidator <T>().Validate(constraint)).Where(result => !result.IsValid)) { errors.AddRange(result.Errors.ToList()); } if (errors.Any()) { throw new ArgumentException(errors.Select(e => e.ErrorMessage).Aggregate((a, b) => $"{a},{b}")); } if (Relations.Any(r => Variables.All(v => v.Key != r.Key))) { throw new ArgumentException("Relationships/Variables mismatch"); } if (Relations.Any(r => r.Values.Any(rv => Variables.All(v => v.Key != rv.Key)))) { throw new ArgumentException("Relationships/Variables mismatch"); } if (Domains.Any(d => !d.Values.Any())) { throw new ArgumentException("Domain start size cannot be zero"); } }
//-------------------------------------------------------------------------------------------------- public bool SetConstraintParameter(SketchConstraint constraint, double parameter) { if (!Constraints.Contains(constraint)) { return(false); } SaveUndo(ElementType.Constraint); constraint.Parameter = parameter; if (SolveConstraints(false)) { SolveConstraints(true); } RaisePropertyChanged(nameof(Constraints)); OnElementsChanged(ElementType.Constraint); return(true); }
/// <summary> /// Initializes a new instance of the <see cref="ODataRoute" /> class. /// </summary> /// <param name="routePrefix">The route prefix.</param> /// <param name="routeConstraint">The route constraint.</param> /// <param name="defaults">The default values for the route.</param> /// <param name="constraints">The route constraints.</param> /// <param name="dataTokens">The data tokens.</param> /// <param name="handler">The message handler for the route.</param> /// <remarks>This signature uses types that are AspNet-specific.</remarks> public ODataRoute( string routePrefix, IHttpRouteConstraint routeConstraint, HttpRouteValueDictionary defaults, HttpRouteValueDictionary constraints, HttpRouteValueDictionary dataTokens, HttpMessageHandler handler) : base(GetRouteTemplate(routePrefix), defaults, constraints, dataTokens, handler) { RouteConstraint = routeConstraint; Initialize(routePrefix, routeConstraint as ODataPathRouteConstraint); if (routeConstraint != null) { Constraints.Add(ODataRouteConstants.ConstraintName, routeConstraint); } Constraints.Add(ODataRouteConstants.VersionConstraintName, new ODataVersionConstraint()); }
//POST /media/connections で渡すJSON Objectのパラメータ作成 private CallParams _CreateCallParams(string targetId) { var videoRedirect = new Redirect(); videoRedirect.ip_v4 = "127.0.0.1"; videoRedirect.port = 7000; var redirectParams = new RedirectParams(); redirectParams.video = videoRedirect; var constraints = new Constraints(); var callParams = new CallParams(); callParams.peer_id = _peerId; callParams.token = _peerToken; callParams.target_id = targetId; callParams.constraints = constraints; callParams.redirect_params = redirectParams; return(callParams); }
private void AddPKConstraint() { DataTable dt = SQLSvrDbi.GetPKConstraint(SchemaName, TableName); StringBuilder constraint = new StringBuilder(); if (dt != null & dt.Rows.Count > 0) { constraint.AppendFormat("CONSTRAINT {0} PRIMARY KEY (", dt.Rows[0]["ConstraintName"].ToString()); foreach (DataRow row in dt.Rows) { constraint.AppendFormat("{0}, ", row["ColumnName"].ToString()); } constraint = constraint.Remove(constraint.Length - 2, 1).Append(") "); Constraints.Add(constraint.ToString()); } }
public EventsTable(EventGraph events) : base(new DbObjectName(events.DatabaseSchemaName, "mt_events")) { var stringIdType = events.GetStreamIdType(); AddPrimaryKey(new TableColumn("seq_id", "bigint")); AddColumn("id", "uuid", "NOT NULL"); AddColumn("stream_id", stringIdType, $"REFERENCES {events.DatabaseSchemaName}.mt_streams ON DELETE CASCADE"); AddColumn("version", "integer", "NOT NULL"); AddColumn("data", "jsonb", "NOT NULL"); AddColumn("type", "varchar(100)", "NOT NULL"); AddColumn("timestamp", "timestamptz", "default (now()) NOT NULL"); AddColumn <TenantIdColumn>(); AddColumn(new DotNetTypeColumn { Directive = "NULL" }); Constraints.Add("CONSTRAINT pk_mt_events_stream_and_version UNIQUE(stream_id, version)"); Constraints.Add("CONSTRAINT pk_mt_events_id_unique UNIQUE(id)"); }
protected void Button12_Click(object sender, EventArgs e) { if ((string)Session["TID"] != null) { List <string> seeds = getListBoxContent(ListBox1); StorageSystem.getInstance().setSeedList((string)Session["TID"], seeds); List <string> crawl = getListBoxContent(ListBox2); List <string> restrict = getListBoxContent(ListBox3); bool paramAllowed = false; if (DropDownList1.SelectedIndex == 1) { paramAllowed = true; } uint depth = Convert.ToUInt32(TextBox1.Text); Constraints constraints = new Constraints(depth, paramAllowed, restrict, crawl); StorageSystem.getInstance().setRestrictions((string)Session["TID"], constraints); } }
/// <inheritdoc/> public override int GetHashCode() { unchecked { int result = base.GetHashCode(); if (InterfaceUri != null) { result = (result * 397) ^ InterfaceUri.GetHashCode(); } result = (result * 397) ^ (int)OS; if (Versions != null) { result = (result * 397) ^ Versions.GetHashCode(); } result = (result * 397) ^ Constraints.GetUnsequencedHashCode(); result = (result * 397) ^ Distributions.GetUnsequencedHashCode(); return(result); } }
public EventsTable(EventGraph events) : base(new DbObjectName(events.DatabaseSchemaName, "mt_events")) { AddPrimaryKey(new EventTableColumn("seq_id", x => x.Sequence)); AddColumn(new EventTableColumn("id", x => x.Id) { Directive = "NOT NULL" }); AddColumn(new StreamIdColumn(events)); AddColumn(new EventTableColumn("version", x => x.Version) { Directive = "NOT NULL" }); AddColumn <EventJsonDataColumn>(); AddColumn <EventTypeColumn>(); AddColumn(new EventTableColumn("timestamp", x => x.Timestamp) { Directive = "default (now()) NOT NULL", Type = "timestamptz" }); AddColumn <TenantIdColumn>(); AddColumn(new DotNetTypeColumn { Directive = "NULL" }); AddIfActive(events.Metadata.CorrelationId); AddIfActive(events.Metadata.CausationId); AddIfActive(events.Metadata.Headers); if (events.TenancyStyle == TenancyStyle.Conjoined) { Constraints.Add( $"FOREIGN KEY(stream_id, {TenantIdColumn.Name}) REFERENCES {events.DatabaseSchemaName}.mt_streams(id, {TenantIdColumn.Name})"); Constraints.Add( $"CONSTRAINT pk_mt_events_stream_and_version UNIQUE(stream_id, {TenantIdColumn.Name}, version)"); } else { Constraints.Add("CONSTRAINT pk_mt_events_stream_and_version UNIQUE(stream_id, version)"); } Constraints.Add("CONSTRAINT pk_mt_events_id_unique UNIQUE(id)"); }
protected override void createColumns() { ALA_AssmblingIdColumn = new DataColumn("ALA_AssmblingId", typeof(String), null, MappingType.Attribute); Columns.Add(ALA_AssmblingIdColumn); ALA_AssmblingIdColumn.AllowDBNull = false; ALA_CreateDateColumn = new DataColumn("ALA_CreateDate", typeof(DateTime), null, MappingType.Attribute); Columns.Add(ALA_CreateDateColumn); ALA_CreatorIdColumn = new DataColumn("ALA_CreatorId", typeof(String), null, MappingType.Attribute); Columns.Add(ALA_CreatorIdColumn); ALA_CreatorName_XXColumn = new DataColumn("ALA_CreatorName_XX", typeof(String), null, MappingType.Attribute); Columns.Add(ALA_CreatorName_XXColumn); ALA_MCCodeColumn = new DataColumn("ALA_MCCode", typeof(String), null, MappingType.Attribute); Columns.Add(ALA_MCCodeColumn); ALA_MCIDColumn = new DataColumn("ALA_MCID", typeof(String), null, MappingType.Attribute); Columns.Add(ALA_MCIDColumn); ALA_MCNameColumn = new DataColumn("ALA_MCName", typeof(String), null, MappingType.Attribute); Columns.Add(ALA_MCNameColumn); ALA_SEQColColumn = new DataColumn("ALA_SEQCol", typeof(Int32), null, MappingType.Attribute); Columns.Add(ALA_SEQColColumn); ALA_SEQRowColumn = new DataColumn("ALA_SEQRow", typeof(Int32), null, MappingType.Attribute); Columns.Add(ALA_SEQRowColumn); ALA_UpdateDateColumn = new DataColumn("ALA_UpdateDate", typeof(DateTime), null, MappingType.Attribute); Columns.Add(ALA_UpdateDateColumn); ALA_UpdaterIdColumn = new DataColumn("ALA_UpdaterId", typeof(String), null, MappingType.Attribute); Columns.Add(ALA_UpdaterIdColumn); ALA_UpdaterName_XXColumn = new DataColumn("ALA_UpdaterName_XX", typeof(String), null, MappingType.Attribute); Columns.Add(ALA_UpdaterName_XXColumn); Constraints.Add(new UniqueConstraint("PrimaryKey", new DataColumn[] { ALA_AssmblingIdColumn }, true)); base.createColumns(); }
public RadialTree() { //Initialize Diagram Properties Constraints = Constraints.Remove(GraphConstraints.PageEditing); Constraints = Constraints.Add(GraphConstraints.Pannable, GraphConstraints.Zoomable); ScrollSettings = new ScrollSettings() { ScrollLimit = ScrollLimit.Diagram, }; PageSettings = new PageSettings() { PageBackground = new SolidColorBrush(Colors.White), PageBorderBrush = new SolidColorBrush(Colors.Transparent), }; // Initialize Layout Data Employees employee = new Employees(); GetData(employee); DataSourceSettings = new DataSourceSettings() { ParentId = "ParentId", Id = "EmpId", DataSource = employee, Root = "1", }; LayoutManager = new LayoutManager() { Layout = new RadialTreeLayout() { HorizontalSpacing = 10, VerticalSpacing = 30 } }; }
public void Test1() { Constraints constraintObj = new Constraints(4, true, "co.il gov uk", "com "); Filter testFilter = new Filter("http", constraintObj); char[] delimiters = { ' ' }; List <String> links = new List <string>("http://www.facebook.com http://www.sun.com http://www.ynet.co.il ".Split(delimiters)); links.Add("http://www.street.uk/something.asp"); links.Add("http://morfix.mako.com/default.aspx?q=check"); links.Add("http://www.walla.co.il"); links.Add("http://www.google.com/addon/mov/appear"); links.Add("www.adam.com"); links.Add("ftp://www.google.com/addon"); links.Add("http://www.google.com/addon/shape/mov/appear"); links.Add("http://www.yalla.gov"); List <String> filteredLinks = testFilter.filterLinks(links); List <String> checkLinks = new List <string>("http://www.facebook.com http://www.sun.com http://morfix.mako.com/default.aspx?q=check ".Split(delimiters, StringSplitOptions.RemoveEmptyEntries)); checkLinks.Add("http://www.google.com/addon/mov/appear"); checkLinks.Add("http://www.adam.com"); bool passed = true; foreach (String link in checkLinks) { if (!(filteredLinks.Contains(link))) { passed = false; } } if (passed) { Console.WriteLine("Filter.filterLinks(String links) PASSED"); } else { Console.WriteLine("Filter.filterLinks(String links) FAILED"); } }
/// <summary> /// Initializes a new instance of the <see cref="ODataRoute" /> class. /// </summary> /// <param name="routePrefix">The route prefix.</param> /// <param name="pathConstraint">The OData path constraint.</param> /// <param name="defaults">The default values for the route.</param> /// <param name="constraints">The route constraints.</param> /// <param name="dataTokens">The data tokens.</param> /// <param name="handler">The message handler for the route.</param> public ODataRoute( string routePrefix, ODataPathRouteConstraint pathConstraint, HttpRouteValueDictionary defaults, HttpRouteValueDictionary constraints, HttpRouteValueDictionary dataTokens, HttpMessageHandler handler) : base(GetRouteTemplate(routePrefix), defaults, constraints, dataTokens, handler) { RoutePrefix = routePrefix; // We can only use our fast-path for link generation if there are no open brackets in the route prefix // that need to be replaced. If there are, fall back to the slow path. _canGenerateDirectLink = routePrefix != null && RoutePrefix.IndexOf('{') == -1; if (pathConstraint != null) { Constraints.Add(ODataRouteConstants.ConstraintName, pathConstraint); } }
/// <summary> /// Default constructor that initializes preconditions, add/delete list and constraints /// </summary> public UnstackAction() { var param1 = new NamedParameter("param1"); var param2 = new NamedParameter("param2"); var goal1 = new Fact(Definitions.On, param1, param2); var goal2 = new Fact(Definitions.ArmHolds, new ValueParameter(null)); var goal3 = new Fact(Definitions.Clear, param1); Preconditions.Add(goal2); Preconditions.Add(goal1); Preconditions.Add(goal3); AddList.Add(new Fact(Definitions.ArmHolds, param1)); AddList.Add(new Fact(Definitions.Clear, param2)); DeleteList.Add(goal1); DeleteList.Add(goal2); DeleteList.Add(goal3); Constraints.Add(TypeCheck(typeof(Block), param1)); Constraints.Add(TypeCheck(typeof(Block), param2)); Constraints.Add(NotEqualsCheck(param1, param2)); }
protected override void SetConstraints(IPageStyle style) { base.SetConstraints(style); IFieldInfo mobile = GetFieldInfo("Mobile"); //IFieldInfo email = GetFieldInfo("Email"); var constraint = new MultipleNotEmptyConstraint(mobile, GetFieldInfo("Weixin")); Constraints.Add(constraint); //Constraints.Add(new EmailConstraint(email)); //Constraints.Add(new MobileConstraint(mobile)); Constraints.Add(new NotEmptyConstraint(GetFieldInfo("Name"))); IFieldInfo logonName = GetFieldInfo("UserLogonName"); Constraints.Add(new NotEmptyConstraint(logonName)); Constraints.Add(new SingleValueConstraint(logonName)); Constraints.Add(new RegexConstraint(logonName, logonName.DisplayName + "只能由字母和数字构成", "^[0-9a-zA-Z]+$")); }
private void InitClass() { ДатаColumn = new DataColumn("Дата", typeof(DateTime), null, MappingType.Element); Columns.Add(ДатаColumn); НазваниеColumn = new DataColumn("Название", typeof(string), null, MappingType.Element); Columns.Add(НазваниеColumn); абочийВыходнойColumn = new DataColumn("РабочийВыходной", typeof(byte), null, MappingType.Element); Columns.Add(абочийВыходнойColumn); ПраздникColumn = new DataColumn("Праздник", typeof(byte), null, MappingType.Element); Columns.Add(ПраздникColumn); Constraints.Add(new UniqueConstraint("HolidaysInfoDsKey1", new[] { ДатаColumn }, true)); ДатаColumn.AllowDBNull = false; ДатаColumn.Unique = true; НазваниеColumn.AllowDBNull = false; абочийВыходнойColumn.AllowDBNull = false; ПраздникColumn.AllowDBNull = false; }
public static void MainTest() { List <Category> categories = new List <Category>(); Constraints constraints = new Constraints(5, true, "", "www.facebook.com"); Initializer initializer = new Initializer(constraints, categories); Url task1 = new Url("http://www.facebook.com/admirer4", 34243432, 35, "http://www.facebook.com/", 34243432); //Url task2 = new Url("http://www.nana10.co.il/", 34223432, 35, "http://www.nana10.co.il/", 34223432); Queue <Url> taskQueue = new Queue <Url>(); taskQueue.Enqueue(task1); //taskQueue.Enqueue(task2); Queue <Url> feedBackQueue = new Queue <Url>(); Worker worker = new Worker(initializer, taskQueue, feedBackQueue); worker.run(); }
public Exit() { var arg = new DelegateInArgument <Exit>("constraintArg"); var ctx = new DelegateInArgument <ValidationContext>("validationContext"); Constraints.Add(new Constraint <Exit> { Body = new ActivityAction <Exit, ValidationContext> { Argument1 = arg, Argument2 = ctx, Handler = new ExitConstraint { ParentChain = new GetParentChain { ValidationContext = ctx } } } }); }
private bool MatchTypeMapping(string parameterName, string typeFullName, TypeMapping typeMapping) { parameterName = parameterName ?? Parameter.Name; var doesTypeNameMatch = typeFullName.StartsWith(typeMapping.WebApiTypeName); var doesAttributeMatch = typeMapping.TreatAsAttribute && Helpers.HasCustomAttribute(Parameter, $"{typeMapping.WebApiTypeName}Attribute"); var doesConstraintMatch = typeMapping.TreatAsConstraint && Constraints.Any(c => c == Helpers.ToCamelCaseFromPascalCase(typeMapping.WebApiTypeName)); var typeMatches = doesTypeNameMatch || doesAttributeMatch || doesConstraintMatch; var matchExists = !string.IsNullOrEmpty(typeMapping.Match); var doesPatternMatch = matchExists && new Regex(typeMapping.Match).IsMatch(parameterName); return((typeMatches && !matchExists) || (typeMatches && doesPatternMatch)); }
private Constraints GetColumnsPK(Table table) { Constraints cons = new Constraints(table); Boolean isFirst = true; using (SqlConnection conn = new SqlConnection(connectioString)) { using (SqlCommand command = new SqlCommand("select SI.indid, SI.name AS PKName, SC.colid, SC.Name,SI.indid from sysindexes SI INNER JOIN sysindexkeys SIK ON SI.indid = SIK.indid AND SIK.id = SI.ID INNER JOIN syscolumns SC ON SC.colid = SIK.colid AND SC.id = SI.ID WHERE (SI.status & 0x800) = 0x800 AND SI.id = " + table.Id.ToString() + " ORDER BY SIK.keyno", conn)) { conn.Open(); using (SqlDataReader reader = command.ExecuteReader()) { Constraint con = null; while (reader.Read()) { ConstraintColumn ccon = new ConstraintColumn(con); if (isFirst) { if (con != null) { cons.Add(con); } con = new Constraint(table); con.Name = reader["PKName"].ToString(); con.Type = Constraint.ConstraintType.PrimaryKey; con.Clustered = ((short)reader["indid"] == 1); /*Si el campo indid = 1, es clustered*/ isFirst = false; } ccon.Name = reader["Name"].ToString(); ((Database)table.Parent).Dependencies.Add(table.Id, (short)reader["colid"], table.Id, con); con.Columns.Add(ccon); } if (con != null) { cons.Add(con); } } } } return(cons); }
private Constraints GetColumnsUNIQUE(Table table) { Constraints cons = new Constraints(table); Boolean isFirst = true; using (SqlConnection conn = new SqlConnection(connectioString)) { using (SqlCommand command = new SqlCommand("SELECT SI.indid, SO.Name AS UniqueName,SCC.colid, SCC.Name from sysconstraints SC INNER JOIN sysobjects SO ON SC.constid = SO.ID INNER JOIN sysindexes SI ON SI.name = SO.Name INNER JOIN sysindexkeys SIK ON SIK.indid = SI.indid AND SC.ID = SIK.ID INNER JOIN syscolumns SCC ON SCC.colid = SIK.colid AND SCC.ID = SC.ID where SO.xtype = 'UQ' and SC.id = " + table.Id.ToString() + " ORDER BY SIK.keyno", conn)) { conn.Open(); using (SqlDataReader reader = command.ExecuteReader()) { Constraint con = null; while (reader.Read()) { ConstraintColumn ccon = new ConstraintColumn(con); if (isFirst) { if (con != null) { cons.Add(con); } con = new Constraint(table); con.Name = reader["UniqueName"].ToString(); con.Type = Constraint.ConstraintType.Unique; con.Clustered = (int.Parse(reader["indid"].ToString()) == 1); /*Si el campo indid = 1, es clustered*/ isFirst = false; } ccon.Name = reader["Name"].ToString(); ((Database)table.Parent).Dependencies.Add(table.Id, Int32.Parse(reader["colid"].ToString()), table.Id, con); con.Columns.Add(ccon); } if (con != null) { cons.Add(con); } } } } return(cons); }
protected override void createColumns() { EOUE_UserEventIdColumn = new DataColumn("EOUE_UserEventId", typeof(String), null, MappingType.Attribute); Columns.Add(EOUE_UserEventIdColumn); EOUE_UserEventIdColumn.AllowDBNull = false; EOUE_DescriptionColumn = new DataColumn("EOUE_Description", typeof(String), null, MappingType.Attribute); Columns.Add(EOUE_DescriptionColumn); EOUE_EventCodeColumn = new DataColumn("EOUE_EventCode", typeof(String), null, MappingType.Attribute); Columns.Add(EOUE_EventCodeColumn); EOUE_KindNameColumn = new DataColumn("EOUE_KindName", typeof(String), null, MappingType.Attribute); Columns.Add(EOUE_KindNameColumn); EOUE_ListOrderColumn = new DataColumn("EOUE_ListOrder", typeof(Int32), null, MappingType.Attribute); Columns.Add(EOUE_ListOrderColumn); Constraints.Add(new UniqueConstraint("PrimaryKey", new DataColumn[] { EOUE_UserEventIdColumn }, true)); base.createColumns(); }
private void OnThemeStyleIdChanged() { var info = this.Info as INodeInfo; if (Constraints.Contains(NodeConstraints.ThemeStyle) && info != null && info.Graph.Theme != null) { if (!string.IsNullOrEmpty(ShapeName) && !ShapeName.Equals("Line")) { DiagramItemStyle style = info.Graph.Theme.GetNodeStyle(ThemeStyleId); if (style != null) { foreach (TextAnnotationViewModel annotaiton in (this.Annotations as AnnotationCollection)) { annotaiton.Foreground = style.Foreground; annotaiton.FontSize = (int)style.FontSize; annotaiton.FontFamily = style.FontFamily; } } } } }
public void AddGridTest2() { SudokuPuzzleBase target = CreateSudokuPuzzleBase(); Keys <int> expected = new Keys <int>() { 67, 68, 69, 88, 89, 90, 109, 110, 111 }; int xOffset = 3; int yOffset = 3; int xSize = 3; int ySize = 3; int xWidth = 21; IConstraints <int> constraints = new Constraints <int>(); target.AddGrid(xOffset, yOffset, xSize, ySize, xWidth, constraints); Assert.AreEqual(1, constraints.Count, "Constraint not created"); Keys <int> keysOut = constraints.First().Keys; Assert.AreEqual(9, keysOut.Count, "Incorrect key count in grid"); Assert.IsTrue(keysOut.SetEquals(expected), "Set does not match"); }
/// <summary> /// Convert the column into JSON /// </summary> /// <param name="area">if null, everything, else columns having the restriction to the area</param> /// <param name="profile">if None, everything, else columns having the restriction to the profile</param> /// <returns></returns> public JObject ToJSON(string area, UserProfile.EUserProfile profile) { if (DSRestrictedAttribute.IsRestricted(Restriction, area, profile, null)) { return(null); } JObject result = new JObject { ["Field"] = Field, ["Property"] = Property.Name, ["Type"] = GetJSONTypeName(), ["DefaultValue"] = DefaultValue == null?JValue.CreateNull() : new JValue(DefaultValue), ["IsNullable"] = IsNullable, ["Formats"] = new JArray(Formats.Select(format => format.ToJSON()).ToArray()), ["Controls"] = new JArray(Controls.Select(control => control.ToJSON()).ToArray()), ["Constraints"] = new JArray(Constraints.Select(constraint => constraint.ToJSON()).ToArray()) }; return(result); }
internal void OnThemeStyleIdChanged() { var info = this.Info as INodeInfo; if (Constraints.Contains(NodeConstraints.ThemeStyle) && (this is Brainstorming.ViewModel.BrainstormingNodeVM) && info != null && info.Graph.Theme != null) { if (!(this as Brainstorming.ViewModel.BrainstormingNodeVM).ShapeName.Equals("Line")) { DiagramItemStyle style = info.Graph.Theme.GetNodeStyle(ThemeStyleId); if (style != null) { foreach (LabelVM annotaiton in (this.Annotations as List <IAnnotation>)) { annotaiton.LabelForeground = style.Foreground; annotaiton.FontSize = (int)style.FontSize; annotaiton.Font = style.FontFamily; } } } } }
public override void LayoutSubviews() { base.LayoutSubviews(); if (HeightConstraint == null) { // This is a height constraint on the accessory view. // We need to update this along with the frame height. HeightConstraint = Constraints.First(c => c.GetIdentifier() == "_UIKBAutolayoutHeightConstraint"); BackgroundColor = UIKit.UIColor.White; MessageArea = new MessageAreaView(UnsentMessage, UploadButtonAction, SendMessageHandler, SaveUnsentMessageAsync, () => { AdjustViewHeight(); }); AddSubview(MessageArea); MessageArea.SetupConstraints(this); } }
private bool isRoomCorrect(GameObject room, Constraints constraints) { if (constraints.leftDoor != -1 && constraints.leftDoor != room.GetComponent <RoomInfo>().DoorL) { return(false); } if (constraints.topDoor != -1 && constraints.topDoor != room.GetComponent <RoomInfo>().DoorT) { return(false); } if (constraints.rightDoor != -1 && constraints.rightDoor != room.GetComponent <RoomInfo>().DoorR) { return(false); } if (constraints.bottomDoor != -1 && constraints.bottomDoor != room.GetComponent <RoomInfo>().DoorB) { return(false); } return(true); }
public unsafe override Bitmap DrawBitmap(OrbitMap m, RenderOptions rp, CalculationOptions co, Constraints[] orbitConstraints) { Bitmap b = new Bitmap(rp.CanvasWidth, rp.CanvasHeight, PixelFormat.Format32bppRgb); BitmapData bd = b.LockBits(new Rectangle(0, 0, rp.CanvasWidth, rp.CanvasHeight), ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb); uint maxIter = m.Max(o => o.Iterations); uint* pixels = (uint*)bd.Scan0.ToPointer(); foreach (Orbit o in m) { if (o.X >= 0 && o.X < b.Width && o.Y >= 0 && o.Y < b.Height) { uint gray = ColorFunc(o.Iterations, co.IterationCount); pixels[o.Y * bd.Stride / 4 + o.X] = (gray << 24) | (gray << 16) | (gray << 8) | gray; } } b.UnlockBits(bd); return b; }
public override Bitmap DrawBitmap(OrbitMap m, RenderOptions rp, CalculationOptions co, Constraints[] orbitConstraints) { Bitmap b = new Bitmap(rp.CanvasWidth, rp.CanvasHeight, PixelFormat.Format32bppRgb); BitmapData bd = b.LockBits(new Rectangle(0, 0, rp.CanvasWidth, rp.CanvasHeight), ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb); uint maxIter = m.Max(o => o.Iterations); foreach (Orbit o in m) { if (o.X >= 0 && o.X < b.Width && o.Y >= 0 && o.Y < b.Height) { uint gray = ColorFunc(o.Iterations, co.IterationCount); Marshal.WriteInt32(bd.Scan0 + o.Y * bd.Stride + o.X * 4, unchecked((int)((gray << 24) | (gray << 16) | (gray << 8) | gray))); } } b.UnlockBits(bd); return b; }
public Optimisation(Constraints cons) { #region Fill DataSet: intialising the dataset to store key results.. con = cons; SimulationResults.Tables.Add(ForCurvetable); ForCurvetable.Columns.Add("Apr", typeof(double)); ForCurvetable.Columns.Add("May", typeof(double)); ForCurvetable.Columns.Add("Jun", typeof(double)); ForCurvetable.Columns.Add("Jul", typeof(double)); ForCurvetable.Columns.Add("Aug", typeof(double)); ForCurvetable.Columns.Add("Sept", typeof(double)); ForCurvetable.Columns.Add("Oct", typeof(double)); ForCurvetable.Columns.Add("Nov", typeof(double)); ForCurvetable.Columns.Add("Dec", typeof(double)); ForCurvetable.Columns.Add("Jan", typeof(double)); ForCurvetable.Columns.Add("Feb", typeof(double)); ForCurvetable.Columns.Add("Mar", typeof(double)); SimulationResults.Tables.Add(Withtable); Withtable.Columns.Add("Apr", typeof(double)); Withtable.Columns.Add("May", typeof(double)); Withtable.Columns.Add("Jun", typeof(double)); Withtable.Columns.Add("Jul", typeof(double)); Withtable.Columns.Add("Aug", typeof(double)); Withtable.Columns.Add("Sept", typeof(double)); Withtable.Columns.Add("Oct", typeof(double)); Withtable.Columns.Add("Nov", typeof(double)); Withtable.Columns.Add("Dec", typeof(double)); Withtable.Columns.Add("Jan", typeof(double)); Withtable.Columns.Add("Feb", typeof(double)); Withtable.Columns.Add("Mar", typeof(double)); SimulationResults.Tables.Add(Imptable); Imptable.Columns.Add("Apr", typeof(double)); Imptable.Columns.Add("May", typeof(double)); Imptable.Columns.Add("Jun", typeof(double)); Imptable.Columns.Add("Jul", typeof(double)); Imptable.Columns.Add("Aug", typeof(double)); Imptable.Columns.Add("Sept", typeof(double)); Imptable.Columns.Add("Oct", typeof(double)); Imptable.Columns.Add("Nov", typeof(double)); Imptable.Columns.Add("Dec", typeof(double)); Imptable.Columns.Add("Jan", typeof(double)); Imptable.Columns.Add("Feb", typeof(double)); Imptable.Columns.Add("Mar", typeof(double)); SimulationResults.Tables.Add(Positiontable); Positiontable.Columns.Add("Apr", typeof(double)); Positiontable.Columns.Add("May", typeof(double)); Positiontable.Columns.Add("Jun", typeof(double)); Positiontable.Columns.Add("Jul", typeof(double)); Positiontable.Columns.Add("Aug", typeof(double)); Positiontable.Columns.Add("Sept", typeof(double)); Positiontable.Columns.Add("Oct", typeof(double)); Positiontable.Columns.Add("Nov", typeof(double)); Positiontable.Columns.Add("Dec", typeof(double)); Positiontable.Columns.Add("Jan", typeof(double)); Positiontable.Columns.Add("Feb", typeof(double)); Positiontable.Columns.Add("Mar", typeof(double)); SimulationResults.Tables.Add(Proftable); Proftable.Columns.Add("Apr", typeof(double)); Proftable.Columns.Add("May", typeof(double)); Proftable.Columns.Add("Jun", typeof(double)); Proftable.Columns.Add("Jul", typeof(double)); Proftable.Columns.Add("Aug", typeof(double)); Proftable.Columns.Add("Sept", typeof(double)); Proftable.Columns.Add("Oct", typeof(double)); Proftable.Columns.Add("Nov", typeof(double)); Proftable.Columns.Add("Dec", typeof(double)); Proftable.Columns.Add("Jan", typeof(double)); Proftable.Columns.Add("Feb", typeof(double)); Proftable.Columns.Add("Mar", typeof(double)); Proftable.Columns.Add("Total", typeof(double)); #endregion }
void case_795() #line 5499 "cs-parser.jay" { Error_SyntaxError (yyToken); var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new Constraints (new SimpleMemberName (lt.Value, lt.Location), null, GetLocation (yyVals[-2+yyTop])); }
void case_794() #line 5493 "cs-parser.jay" { var lt = (LocatedToken) yyVals[-2+yyTop]; yyVal = new Constraints (new SimpleMemberName (lt.Value, lt.Location), (List<FullNamedExpression>) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); }
/** * This method tests the isUrlValid(string url) method. */ public void test5() { bool passed = true; String error = ""; //testing url when its depth is bigger depth than allowed(should return false) if ((testConstraints.isUrlValid("www://technion.co.il/ee/math/something/again"))) { passed = false; error = "Testing url when its depth is bigger failed"; } //testing url when its depth is smaller depth than allowed(should return true) if (!(testConstraints.isUrlValid("www://technion.co.il/again"))) { passed = false; error = "Testing url when its depth is smaller failed"; } //testing url containing ?(it should be allowed,should return true) if (!(testConstraints.isUrlValid("www://technion.co.il/again?"))) { passed = false; error = "Testing url containing ?,when it should be allowed failed"; } //testing url that does not contain "?"(it should be allowed,should return true) if (!(testConstraints.isUrlValid("www://technion.co.il/again"))) { passed = false; error = "Testing url that does not contain ? failed"; } //testing url that contains "?",when its not allowed(should return false) testConstraints = new Constraints(4, false, "technion ynet nana", " co.il org gov"); //testing url containing ?(it should not be allowed,should return false) if ((testConstraints.isUrlValid("www://technion.co.il/again?"))) { passed = false; error = "Testing url containing ? when its not allowed failed"; } //testing url that does not contain "?"(it should be allowed,should return true) if (!(testConstraints.isUrlValid("www://technionagain.co.il"))) { passed = false; error="Testing url that does not contain ?,when paramater is not allowed failed"; } //testing url that does not matches one of the crawl networks(should return false) if ((testConstraints.isUrlValid("www://technion.uk/again.ac.il"))) { passed = false; error = "Testing url that does not matches one of the crawl networks failed"; } //testing url that matches one of the restricted networks(should return false) if ((testConstraints.isUrlValid("www://technion/again.ynet"))) { passed = false; error = "testing url that matches one of the restricted networks failed"; } //chek if all tests passed if (passed) { Console.WriteLine("isUrlValid(string url) PASSED"); } else { Console.WriteLine("isUrlValid(string url) FAILED"); Console.WriteLine(error); } }
public void setConstraints(Constraints c) { constraints = c; }
public void SetControlConstraints(Control ctl, Constraints constraints) { _controlConstraints [ctl] = constraints; }
/// <summary> /// Initializes the solver /// </summary> /// <param name="_Dimension">Size of the dataset to solve against (i.e. amount of data points to fit against)</param> /// <param name="_ParametersCount">Size of the vector to solve for (i.e. amount of unknowns to fit)</param> /// <param name="_MaxIterations">Maximum amount of iterations to perform (20 iters significantly increases error vs. 100, a standard value is 45)</param> public void Init( int _Dimension, int _ParametersCount, int _MaxIterations ) { m_Dimension = _Dimension; m_ParametersCount = _ParametersCount; m_MaxIterations = _MaxIterations; m_Constraints = new Constraints( m_ParametersCount ); m_Delta = new Vector( m_Dimension ); m_Diagonal = new Vector( m_Dimension ); m_Jacobian = new Matrix( m_ParametersCount, m_Dimension ); m_JacobianEx = new Matrix( m_Dimension+m_ParametersCount, m_Dimension ); m_TempPoint = new Vector( m_Dimension ); }
public abstract Bitmap DrawBitmap(OrbitMap m, RenderOptions rp, CalculationOptions co, Constraints[] orbitConstraints);