public bool IsEqual(Link link)
 {
     if (this.EndComponent.Guid.ToLower() != link.EndComponent.Guid.ToLower()) return false;
     if (this.StartComponent.Guid.ToLower() != link.StartComponent.Guid.ToLower()) return false;
     if (this.Type != link.Type) return false;
     return true;
 }
Beispiel #2
0
        public void Link_Created(string rel, string href, string title, string method, string type, string deprecation, string name, string profile, string hrefLang, bool isRelArray)
        {
            var link = new Link(
                rel: rel,
                href: href,
                title: title,
                method: method,
                isRelArray: isRelArray
            ) {
                Type = type,
                Deprecation = deprecation,
                Name = name,
                Profile = profile,
                HrefLang = hrefLang
            };

            Assert.Equal(rel, link.Rel);
            Assert.Equal(href, link.Href);
            Assert.Equal(method, link.Method);
            Assert.Equal(title, link.Title);
            Assert.Equal(type, link.Type);
            Assert.Equal(deprecation, link.Deprecation);
            Assert.Equal(name, link.Name);
            Assert.Equal(hrefLang, link.HrefLang);
            Assert.Equal(isRelArray, link.IsRelArray);
        }
        /// <summary>
        /// The create.
        /// </summary>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="link">
        /// The link.
        /// </param>
        /// <returns>
        /// The <see cref="Chain"/>.
        /// </returns>
        /// <exception cref="ArgumentException">
        /// Thrown if link is unacceptable.
        /// </exception>
        public static Chain Create(Chain source, Link link)
        {
            if (link != Link.Start && link != Link.End && link != Link.CycleEnd && link != Link.CycleStart)
            {
                throw new ArgumentException("Unknown link", "link");
            }

            var result = new Chain(source.GetLength());
            Alphabet sourceAlphabet = source.Alphabet;
            var entries = new int[sourceAlphabet.Cardinality];

            var intervals = new int[sourceAlphabet.Cardinality][];

            for (int j = 0; j < sourceAlphabet.Cardinality; j++)
            {
                var intervalsManager = new CongenericIntervalsManager(source.CongenericChain(j));
                intervals[j] = intervalsManager.GetIntervals(link);
            }

            for (int i = 0; i < source.GetLength(); i++)
            {
                var elementIndex = sourceAlphabet.IndexOf(source[i]);
                int entry = entries[elementIndex]++;
                var interval = intervals[elementIndex][entry];
                result.Set(new ValueInt(interval), i);
            }

            return result;
        }
Beispiel #4
0
        private void GenerateGrid()
        {
            CompositeLink composLink = new CompositeLink(new PrintingSystem());
            PrintableComponentLink pcLink1 = new PrintableComponentLink();
            Link linkMainReport = new Link();
            Link linkGrid1Report = new Link();
            linkGrid1Report.CreateDetailArea += new CreateAreaEventHandler(linkGrid1Report_CreateDetailArea);

            // Assign the controls to the printing links.
            pcLink1.Component = this.ThirdGridIncomeAnalysis;

            // Populate the collection of links in the composite link.
            // The order of operations corresponds to the document structure.
            composLink.Links.Add(linkGrid1Report);
            composLink.Links.Add(pcLink1);
            composLink.Links.Add(linkMainReport);

            // Create the report and show the preview window.
            //composLink.PrintingSystem.PreviewFormEx.AutoScale = true;
            composLink.PrintingSystem.PageSettings.Landscape = true;
            composLink.CreateDocument(printingSystem1);
            printingSystem1.PreviewFormEx.PrintingSystem.PageSettings.LeftMargin = 0;
            printingSystem1.PreviewFormEx.PrintingSystem.PageSettings.TopMargin = 30;
            //printingSystem1.PreviewFormEx.AutoScale = true;
            printingSystem1.PageSettings.Landscape = true;
            printingSystem1.PreviewFormEx.ForeColor = System.Drawing.Color.Black;
            printingSystem1.PreviewFormEx.Owner = this;
            printingSystem1.PreviewFormEx.PrintingSystem.Print();
        }
		public ILink DeserializeLink(IConnection connection, SerializationInfo info)
		{
			Link link = new Link();
			string sourceEmployeeId = string.Empty;
			string targeteEmployeeId = string.Empty;
			if (info["SourceEmployeeId"] != null)
				sourceEmployeeId = info["SourceEmployeeId"].ToString();
			if (info["TargetEmployeeId"] != null)
				targeteEmployeeId = info["TargetEmployeeId"].ToString();
			if (info["IsVisible"] != null)
				link.IsVisible = bool.Parse(info["IsVisible"].ToString());
			if (info["Text"] != null)
				link.Text = info["Text"].ToString();
			if (info["MainColor"] != null)
				link.MainColor = info["MainColor"].ToString();

			var sourceModel = this.deserializedEmployees.FirstOrDefault(x => x.GetId().Equals(sourceEmployeeId));
			if (sourceModel != null)
			{
				link.Source = sourceModel;
			}

			var targetModel = this.deserializedEmployees.FirstOrDefault(x => x.GetId().Equals(targeteEmployeeId));
			if (targetModel != null)
			{
				link.Target = targetModel;
			}

			return link;
		}
        public FileLogSettingsDlg( )
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent( );

            // initialize the grid
            ColumnHeader headerBehaviour = new ColumnHeader( false );
            FlatHeader headerVisual = new FlatHeader( true );
            EditorTextBoxButton textEditor = new EditorTextBoxButton( typeof ( String ) );
            EditorNumericUpDown numEditor = new EditorNumericUpDown( );

            grid.Redim( 3, 2 );

            grid[ 0, 0 ] = new SourceGrid2.Cells.Real.ColumnHeader( "Name", headerVisual, headerBehaviour );
            grid[ 0, 1 ] = new SourceGrid2.Cells.Real.ColumnHeader( "Value", headerVisual, headerBehaviour );

            grid[ 1, 0 ] = new Cell( "File", textEditor, headerVisual );
            grid[ 1, 0 ].ToolTipText = "The path and file name to log to";
            grid[ 1, 0 ].Invalidate( );
            // TODO: place the old file name here
            grid[ 1, 1 ] = new Link( @"c:\", new PositionEventHandler( this.OpenFile ) );

            grid[ 2, 0 ] = new Cell( "Size (Kb)", textEditor, headerVisual );
            grid[ 2, 0 ].ToolTipText = "The maximum size of the log file.";
            grid[ 2, 0 ].Invalidate( );

            grid[ 2, 1 ] = new Cell( 1024 * 100, numEditor );
            numEditor.Maximum = new decimal( 1024 * 1024 );
            numEditor.Minimum = new decimal( 0 );
            grid.AutoStretchColumnsToFitWidth = true;
            grid.StretchColumnsToFitWidth( );
        }
        /// <summary>
        /// Calculation method.
        /// </summary>
        /// <param name="chain">
        /// Source sequence.
        /// </param>
        /// <param name="link">
        /// Link of intervals in chain.
        /// </param>
        /// <returns>
        /// Average remoteness dispersion <see cref="double"/> value.
        /// </returns>
        public double Calculate(Chain chain, Link link)
        {
            List<int> intervals = new List<int>();
            for (int i = 0; i < chain.Alphabet.Cardinality; i++)
            {
                intervals.AddRange(chain.CongenericChain(i).GetIntervals(link).ToList());
            }

            List<int> uniqueIntervals = intervals.Distinct().ToList();

            List<int> intervalsCounts = new List<int>();

            for (int i = 0; i < uniqueIntervals.Count; i++)
            {
                var currentInterval = uniqueIntervals[i];
                intervalsCounts.Add(intervals.Count(interval => interval == currentInterval));
            }

            double result = 0;
            double gDelta = geometricMean.Calculate(chain, link);
            int n = (int)intervalsCount.Calculate(chain, link);

            for (int i = 0; i < uniqueIntervals.Count; i++)
            {
                int nk = intervalsCounts[i];
                double kDelta = uniqueIntervals[i];
                double centeredRemoteness = Math.Log(kDelta, 2) - Math.Log(gDelta, 2);
                result += nk == 0 ? 0 : centeredRemoteness * centeredRemoteness * nk / n;
            }

            return result;
        }
Beispiel #8
0
        /// <summary>
        /// Gets the Href property of an anchor tag from a link, ready for rendering
        /// </summary>
        /// <param name="link">Link object to extract the href from</param>
        /// <returns>A Cleaned and encoded href value for an anchor tag</returns>
        public static string GetLinkHref(Link link)
        {
            if (link == null || link.Url == null)
                return "#";

            if (link.Url.Contains("http://") || link.Url.Contains("https://"))
                return HttpUtility.HtmlEncode(link.Url);

            return HttpUtility.HtmlEncode(link.Url)
                   + "-"
                   + HttpUtility.HtmlEncode(LinkRenderer.GetLinkTitle(link)
                                                .Replace(" ", "-")
                                                .Replace("0", "")
                                                .Replace("1", "")
                                                .Replace("2", "")
                                                .Replace("3", "")
                                                .Replace("4", "")
                                                .Replace("5", "")
                                                .Replace("6", "")
                                                .Replace("7", "")
                                                .Replace("8", "")
                                                .Replace("9", "")
                                                .Replace("+", "")
                                                .Replace("&amp;", "")
                         );
        }
 /// <summary>
 /// Calculation method.
 /// </summary>
 /// <param name="firstChain">
 /// The first chain.
 /// </param>
 /// <param name="secondChain">
 /// The second chain.
 /// </param>
 /// <param name="link">
 /// The link.
 /// </param>
 /// <returns>
 /// The <see cref="double"/>.
 /// </returns>
 public double Calculate(CongenericChain firstChain, CongenericChain secondChain, Link link)
 {
     var partialAccordanceCalculator = new PartialComplianceDegree();
     var firstResult = partialAccordanceCalculator.Calculate(firstChain, secondChain, link);
     var secondResult = partialAccordanceCalculator.Calculate(secondChain, firstChain, link);
     return Math.Sqrt(firstResult * secondResult);
 }
Beispiel #10
0
 public Model(Location location, Orientation orientation, Scale scale, Link link)
 {
     this.location = location;
     this.orientation = orientation;
     this.scale = scale;
     this.link = link;
 }
Beispiel #11
0
			public Piece (int start, int length, string text, Link link)
			{
				this.start = start;
				this.length = length;
				this.text = text;
				this.link = link;
			}
        public void CanUseRegisterExtensionMethod()
        {
            var curie = new CuriesLink("aap", "http://www.helpt.com/{?rel}");

            var builder = Hypermedia.CreateBuilder();
            var selfLink = new Link<ProductRepresentation>("product", "http://www.product.com?id=1");
            var link2 = new Link("related", "http://www.related.com");
            var link3 = curie.CreateLink<CategoryRepresentation>("category", "http://www.category.com");
            
            builder.Register(selfLink, link2, link3);
            
            var config = builder.Build();

            // arrange
            var mediaFormatter = new JsonHalMediaTypeFormatter(config) { Indent = true };
            var content = new StringContent(string.Empty);
            var type = representation.GetType();

            // act
            using (var stream = new MemoryStream())
            {
                mediaFormatter.WriteToStreamAsync(type, representation, stream, content, null);
                stream.Seek(0, SeekOrigin.Begin);
                var serialisedResult = new StreamReader(stream).ReadToEnd();

                // assert
                Approvals.Verify(serialisedResult);
            }
        }
        public void CanUseRegisterExtensionMethod()
        {
            var curie = new CuriesLink("aap", "http://www.helpt.com/{?rel}");

            var builder = Hypermedia.CreateBuilder();
            var selfLink = new Link<ProductRepresentation>("product", "http://www.product.com?id=1");
            var link2 = new Link("related", "http://www.related.com");
            var link3 = curie.CreateLink<CategoryRepresentation>("category", "http://www.category.com");

            builder.Register(selfLink, link2, link3);

            var config = builder.Build();

            // arrange
            var mediaFormatter = new JsonHalOutputFormatter(config) { };
            var type = representation.GetType();
            var httpContext = new Mock<HttpContext>();
            var httpRequest = new DefaultHttpContext().Request;
            httpContext.SetupGet(o => o.Request).Returns(httpRequest);

            // act
            using (var stream = new MemoryStream())
            {
                mediaFormatter.WriteResponseBodyAsync(new OutputFormatterWriteContext(httpContext.Object,
                    (s,e)=> new HttpResponseStreamWriter(s, e), type, representation));
                //WriteToStreamAsync(type, representation, stream, content, null);
                stream.Seek(0, SeekOrigin.Begin);
                var serialisedResult = new StreamReader(stream).ReadToEnd();

                // assert
                Approvals.Verify(serialisedResult);
            }
        }
        /// <summary>
        /// Contructor for linklayer
        /// </summary>
        /// <param name="link">Link layer</param>
        public BPCommunicationModbus( Link link)
        {
            this.link = link;

            //Create Rtu modbus master using link port
            modbus = ModbusSerialMaster.CreateRtu((SerialPort)this.link.port);
        }
 private static void CutLink(Link n)
 {
     answer = n.Node1 + " " + n.Node2;
            found = true;
            links.RemoveAll(x=> x.Node1 == n.Node1 && x.Node2 == n.Node2);
            links.RemoveAll(x=> x.Node1 == n.Node2 && x.Node2 == n.Node1);
 }
        public string CreateATag(Link link)
        {
            var aTag = "";
            if (link.URL.Contains("PhotoAlbum.aspx") || link.URL.Contains("VideoFireworks.aspx") || link.URL.ToLower().Contains(".dailyez"))
                aTag = string.Format(
                    "<a style=\"{0}\" href=\"{1}\" {4} onclick=\"{2}\">{3}</a>",
                    GetStyle(link.Title),
                    HttpUtility.HtmlEncode(link.URL),
                    GetJSOpenNewWindow(link.URL),
                    FormatTitle(link.Title),
                    GetTitleBlock(link.Title));
            else if (link.URL.ToLower().Contains("http://") || link.URL.ToLower().Contains("https://"))
                aTag = string.Format(
                    "<a style=\"{0}\" href=\"{1}\" {4} target=\"{2}\">{3}</a>",
                    GetStyle(link.Title),
                    HttpUtility.HtmlEncode(link.URL),
                    GetTarget(link.Target),
                    FormatTitle(link.Title),
                    GetTitleBlock(link.Title));
            else
            {
                aTag = string.Format(
                  "<a style=\"{0}\" href=\"{1}\" {4} onclick=\"{2}\">{3}</a>",
                  GetStyle(link.Title),
                  "../" + HttpUtility.HtmlEncode(link.URL) + "-" + FormatTitle(link.Title).Replace(" ", "-"),
                  GetJSOpenSameWindow(link),
                  FormatTitle(link.Title),
                  GetTitleBlock(link.Title));
            }

            return aTag;
        }
    static void Main(string[] args)
    {
        string[] inputs = Console.ReadLine().Split(' ');
        int N = int.Parse(inputs[0]); // the total number of nodes in the level, including the gateways
        int L = int.Parse(inputs[1]); // the number of links
        int E = int.Parse(inputs[2]); // the number of exit gateways
        
        for (int i = 0; i < L; i++)
        {
            links.Add(new Link(Console.ReadLine().Split(' ')));
        }
        
        for (int i = 0; i < E; i++)
        {
            EditType(int.Parse(Console.ReadLine()), Type.EXIT);
        }

        // game loop
        while (true)
        {
            // The index of the node on which the Skynet agent is positioned this turn
            EditType(int.Parse(Console.ReadLine()), Type.SKY);
            // Write an action using Console.WriteLine()
            last = GetOne();
            Console.WriteLine(last.ToString()); // Example: 0 1 are the indices of the nodes you wish to sever the link between
        }
    }
Beispiel #18
0
	object Get0(Link a,int x) { 
		if (a==null || x<0)  // safety
			return null;
		if (x==0)
			return a.it;
		return Get0(a.next,x-1);
	}
        /// <summary>
        /// Calculation method.
        /// </summary>
        /// <param name="chain">
        /// Source sequence.
        /// </param>
        /// <param name="link">
        /// Link of intervals in chain.
        /// </param>
        /// <returns>
        /// Average remoteness <see cref="double"/> value.
        /// </returns>
        public double Calculate(Chain chain, Link link)
        {
            double depth = depthCalculator.Calculate(chain, link);
            int nj = (int)intervalsCount.Calculate(chain, link);

            return nj == 0 ? 0 : depth / nj;
        }
Beispiel #20
0
 public virtual bool Add(object o)
 {
     if (link != null)
     {
         IPersistent obj = (IPersistent) o;
         if (link.IndexOf(obj) >= 0)
         {
             return false;
         }
         if (link.Size == BTREE_THRESHOLD)
         {
             Set = Storage.CreateSet();
             for (int i = 0, n = link.Size; i < n; i++)
             {
                 Set.Add(link.GetRaw(i));
             }
             link = null;
             Modify();
             Set.Add(obj);
         }
         else
         {
             Modify();
             link.Add(obj);
         }
         return true;
     }
     else
     {
         return Set.Add(o);
     }
 }
        /// <summary>
        /// Calculation method.
        /// </summary>
        /// <param name="chain">
        /// Source sequence.
        /// </param>
        /// <param name="link">
        /// Redundant parameter, not used in calculations.
        /// </param>
        /// <returns>
        /// Frequency of element in congeneric chain as <see cref="double"/>.
        /// </returns>
        public double Calculate(CongenericChain chain, Link link)
        {
            var count = new ElementsCount();
            var length = new Length();

            return count.Calculate(chain, link) / length.Calculate(chain, link);
        }
		public ILink CreateLink(object source, object target)
		{
			var mindmapLink = new Link();
			var sourceNode = source as Node;
			var targetNode = target as Node;
			if (sourceNode != null && targetNode != null)
			{
				mindmapLink.Source = sourceNode;
				mindmapLink.Target = targetNode;
				targetNode.ShapeType = sourceNode.ShapeType == MindmapItemType.Root ? MindmapItemType.FirstLevelItem : MindmapItemType.SubItem;

				if (sourceNode.ShapeType == MindmapItemType.Root)
				{
					targetNode.MainColor = Colors[colorIndex];
					mindmapLink.MainColor = Colors[colorIndex];
					colorIndex++;
					colorIndex = colorIndex % Colors.Count;
				}
				else
				{
					targetNode.MainColor = sourceNode.MainColor;
					mindmapLink.MainColor = sourceNode.MainColor;
				}
			}
			return mindmapLink;
		}
Beispiel #23
0
        public List<Link> GetLinks()
        {
            List<Link> lstLinks = new List<Link>();
            DbCommand oDbCommand = DbProviderHelper.CreateCommand("SELECTLinks",CommandType.StoredProcedure);
            DbDataReader oDbDataReader = DbProviderHelper.ExecuteReader(oDbCommand);
            while (oDbDataReader.Read())
            {
                Link oLink = new Link();
                oLink.LinkId = Convert.ToInt32(oDbDataReader["LinkId"]);
                oLink.LinkGuid = (Guid) oDbDataReader["LinkGuid"];
                oLink.LinkName = Convert.ToString(oDbDataReader["LinkName"]);

                if(oDbDataReader["LinkUrl"] != DBNull.Value)
                    oLink.LinkUrl = Convert.ToString(oDbDataReader["LinkUrl"]);

                if(oDbDataReader["Remark"] != DBNull.Value)
                    oLink.Remark = Convert.ToString(oDbDataReader["Remark"]);

                if(oDbDataReader["Logo"] != DBNull.Value)
                    oLink.Logo = Convert.ToString(oDbDataReader["Logo"]);
                oLink.Rank = Convert.ToInt32(oDbDataReader["Rank"]);
                oLink.DateCreated = Convert.ToDateTime(oDbDataReader["DateCreated"]);
                lstLinks.Add(oLink);
            }
            oDbDataReader.Close();
            return lstLinks;
        }
Beispiel #24
0
 void Add0(Link a)
 {
     if (head==null)
         head = last = a;
     else
         last = last.next = a;
 }
Beispiel #25
0
        public Link GetLink(int LinkId)
        {
            Link oLink = new Link();
            DbCommand oDbCommand = DbProviderHelper.CreateCommand("SELECTLink",CommandType.StoredProcedure);
            oDbCommand.Parameters.Add(DbProviderHelper.CreateParameter("@LinkId",DbType.Int32,LinkId));
            DbDataReader oDbDataReader = DbProviderHelper.ExecuteReader(oDbCommand);
            while (oDbDataReader.Read())
            {
                oLink.LinkId = Convert.ToInt32(oDbDataReader["LinkId"]);
                oLink.LinkGuid = (Guid) oDbDataReader["LinkGuid"];
                oLink.LinkName = Convert.ToString(oDbDataReader["LinkName"]);

                if(oDbDataReader["LinkUrl"] != DBNull.Value)
                    oLink.LinkUrl = Convert.ToString(oDbDataReader["LinkUrl"]);

                if(oDbDataReader["Remark"] != DBNull.Value)
                    oLink.Remark = Convert.ToString(oDbDataReader["Remark"]);

                if(oDbDataReader["Logo"] != DBNull.Value)
                    oLink.Logo = Convert.ToString(oDbDataReader["Logo"]);
                oLink.Rank = Convert.ToInt32(oDbDataReader["Rank"]);
                oLink.DateCreated = Convert.ToDateTime(oDbDataReader["DateCreated"]);
            }
            oDbDataReader.Close();
            return oLink;
        }
Beispiel #26
0
        public void CreateBufferSizeChart(ZedGraphControl zgc, Link[] list)
        {
            GraphPane myPane = zgc.GraphPane;
            System.Drawing.Color[] GraphColors = { Color.Red, Color.Blue, Color.Green, Color.Orange, Color.Purple, Color.Brown };
            // Set the titles and axis labels
            myPane.Title.Text = "";
            myPane.XAxis.Title.Text = "Time, ms";
            myPane.YAxis.Title.Text = "Buffer size (packets)";

            /*myPane.Legend.Position = LegendPos.Float;
            myPane.Legend.Location = new Location(0.95, 0.15, CoordType.PaneFraction,
                                 AlignH.Right, AlignV.Top);
            myPane.Legend.FontSpec.Size = 10;*/
            myPane.Legend.Position = LegendPos.InsideTopLeft;
            // Add a curve
            for (int k = 0; k < list.Length; k++)
            {
                LineItem curve = myPane.AddCurve(list[k].name, list[k].buffer_size_list, GraphColors[k % 6], SymbolType.None);
                curve.Line.Width = 2.0F;
                curve.Line.IsAntiAlias = true;
                curve.Symbol.Fill = new Fill(Color.White);
                curve.Symbol.Size = 7;
            }
            // Fill the axis background with a gradient
            //myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, Color.ForestGreen), 45.0F);

            // Offset Y space between point and label
            // NOTE:  This offset is in Y scale units, so it depends on your actual data
            //const double offset = 1.0;
            // Leave some extra space on top for the labels to fit within the chart rect
            myPane.YAxis.Scale.MaxGrace = 0.2;

            // Calculate the Axis Scale Ranges
            zgc.AxisChange();
        }
Beispiel #27
0
 public ActionResult Save(Link links)
 {
     var data = GetData();
     data.Add(links);
     _pluginContentService.SavePluginData(PluginId, data);
     return RedirectToAction("Edit");
 }
        private void AddLinkText(SvgDocument document, Link link)
        {
            if (link.Label.Text.Trim() == "") return;

            Style style = new Style();

            //Set up text object
            PointF location = link.GetLabelLocation();
            location = OffsetPoint(location, link.Label.Offset);
            location = OffsetPoint(location, link.Rectangle.Location);

            Text text = new Text();
            text.Label = link.Label;
            text.LayoutRectangle = new RectangleF(location, new SizeF());

            //Get style
            string classId = null;
            classId = document.AddClass(text.GetStyle());

            //Create fragment and add to document
            XmlDocumentFragment frag = null;
            XmlNode newElementNode = null;

            frag = document.CreateDocumentFragment();
            frag.InnerXml = text.ExtractText(0, 0, link.Key + "Text");
            frag.FirstChild.Attributes.GetNamedItem("class").InnerText = classId;
            newElementNode = document.ContainerNode.AppendChild(frag);
        }
Beispiel #29
0
        public Artist(Link link, SessionBase session, bool browse = false)
        {
            this.Handle = libspotify.sp_link_as_artist(link.Handle);
            this._session = session;

            Init(browse);
        }
Beispiel #30
0
 public void Add(int value)
 {
     if (treeRoot == null)
     {
         treeRoot = new Link(value);
     }
     else
     {
         Link nodeNow = FindNode(value, treeRoot);
         if (value < nodeNow.element.Value)
         {
             nodeNow.element.Left = new Link(value);
         }
         else
         {
             if (value > nodeNow.element.Value)
             {
                 nodeNow.element.Right = new Link(value);
             }
             else
             {
                 throw new ArgumentException("This element already exists!");
             }
         }
     }
 }
        public static Folder ToFolder(this FolderInfoResult data, string home = null, Link link = null)
        {
            PatchEntryPath(data, home, link);

            var folder = new Folder(data.body.size, data.body.home ?? data.body.name, data.body.weblink)
            {
                Folders = data.body.list?
                    .Where(it => FolderKinds.Contains(it.kind))
                    .Select(item => item.ToFolder())
                    .ToList(),
                Files = data.body.list?
                    .Where(it => it.kind == "file")
                    .Select(item => item.ToFile())
                    .ToGroupedFiles()
                    .ToList()
            };

            return folder;
        }
 public void AddFag(Link link)
 {
     AddLink("f*g", link);
 }
 public void AddElevforhold(Link link)
 {
     AddLink("elevforhold", link);
 }
Beispiel #34
0
 public SelectedChangeEventArgs(RoutedEvent routedEvent, [CanBeNull] Link selectedLink) : base(routedEvent)
 {
     SelectedLink = selectedLink;
 }
Beispiel #35
0
    private static string GetShortestLink(string shortestLink)
    {
        Link shortLink = new Link();

        // look at each EXIT and
        for (int i = 0; i < positionExits.Length; i++)
        {
            int curExit = positionExits[i];
            // for begining find all NEAREST LINK
            shortLink = listAllLinks.Find(l => ((l.from == curExit && l.to == positionSkynet) || (l.to == curExit && l.from == positionSkynet)) && !l.alreadyCut);

            if (shortLink != null)
            {
                // cut
                shortLink.alreadyCut = true;
                shortestLink         = shortLink.from + " " + shortLink.to;

                if (shortLink != null)
                {
                    Console.Error.WriteLine("shortLink : " + shortLink.from + " - : " + shortLink.to);
                }
                return(shortestLink);
            }
        }


        foreach (Link impLink in listImportantLinks)
        {
            // just get first important link
            // ????????????????????????????????????????????????? BUT Here I have to check hat exactly link

            shortLink = listExitsLinks.Find(l =>
                                            (l.to == impLink.to && l.from == impLink.from) ||
                                            (l.to == impLink.from && l.from == impLink.to)
                                            );
            //shortLink = impLink;
            shortLink.alreadyCut = true;
            shortestLink         = shortLink.from + " " + shortLink.to;
            Console.Error.WriteLine(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " + shortestLink);
            return(shortestLink);
        }



        //but if we did not find any nearest we MUST TO CUT EXTRA  node which have a two exits
        for (int i = 0; i < positionSimpleNode.Length; i++)
        {
            List <Link> linksWith2exits =
                listExitsLinks.FindAll(le =>
                                       (le.from == positionSimpleNode[i] || le.to == positionSimpleNode[i]) &&
                                       !le.alreadyCut);
            if (linksWith2exits.Count > 1)
            {
                shortLink            = linksWith2exits[0];
                shortLink.alreadyCut = true;
                shortestLink         = shortLink.from + " " + shortLink.to;
                Console.Error.WriteLine(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ");
                return(shortestLink);
            }
        }



        return(shortestLink);
    }
Beispiel #36
0
 /// <summary>
 /// Returns the hash code of the ArticleViewModel, which is based on
 /// a string representation the Link value, using only the host and path.
 /// </summary>
 public override int GetHashCode()
 {
     return(Link.GetComponents(UriComponents.Host | UriComponents.Path, UriFormat.Unescaped).GetHashCode());
 }
Beispiel #37
0
 public LinkPortal(Link link, LinkSpriteFactory spriteFactory, LinkStateMachine linkStateMachine)
 {
     this.link             = link;
     this.spriteFactory    = spriteFactory;
     this.linkStateMachine = linkStateMachine;
 }
 /// <summary>
 /// Create a HasMany relational link to another entity
 /// </summary>
 ///
 /// <param name="publicName">The relationship name as exposed by the API</param>
 /// <param name="relationshipLinks">Which links are available. Defaults to <see cref="Link.All"/></param>
 /// <param name="canInclude">Whether or not this relationship can be included using the <c>?include=public-name</c> query string</param>
 /// <param name="mappedBy">The name of the entity mapped property, defaults to null</param>
 ///
 /// <example>
 ///
 /// <code>
 /// public class Author : Identifiable
 /// {
 ///     [HasMany("articles"]
 ///     public virtual List&lt;Articl&gt; Articles { get; set; }
 /// }
 /// </code>
 ///
 /// </example>
 public HasManyAttribute(string publicName = null, Link relationshipLinks = Link.All, bool canInclude = true, string mappedBy = null, string inverseNavigationProperty = null)
     : base(publicName, relationshipLinks, canInclude, mappedBy)
 {
     InverseNavigation = inverseNavigationProperty;
 }
 public PaymentMethodToPaymentMethodModelProfile()
 {
     CreateMap <PaymentMethod, PaymentMethodModel>()
     .ForMember(to => to.ImageUrl, opts => opts.MapFrom(from => Link.ImageUrl(from.ImageKey, null)));
 }
Beispiel #40
0
        public void GoSpanData_EndedSpan()
        {
            ISpan span =
                Span.StartSpan(
                    spanContext,
                    recordSpanOptions,
                    SPAN_NAME,
                    parentSpanId,
                    false,
                    TraceParams.Default,
                    startEndHandler,
                    timestampConverter,
                    testClock);

            span.PutAttribute(
                "MySingleStringAttributeKey",
                AttributeValue.StringAttributeValue("MySingleStringAttributeValue"));
            span.PutAttributes(attributes);
            testClock.AdvanceTime(Duration.Create(0, 100));
            span.AddAnnotation(Annotation.FromDescription(ANNOTATION_DESCRIPTION));
            testClock.AdvanceTime(Duration.Create(0, 100));
            span.AddAnnotation(ANNOTATION_DESCRIPTION, attributes);
            testClock.AdvanceTime(Duration.Create(0, 100));
            IMessageEvent networkEvent =
                MessageEvent.Builder(MessageEventType.Received, 1).SetUncompressedMessageSize(3).Build();

            span.AddMessageEvent(networkEvent);
            ILink link = Link.FromSpanContext(spanContext, LinkType.ChildLinkedSpan);

            span.AddLink(link);
            testClock.AdvanceTime(Duration.Create(0, 100));
            span.End(EndSpanOptions.Builder().SetStatus(Status.Cancelled).Build());

            ISpanData spanData = ((Span)span).ToSpanData();

            Assert.Equal(spanContext, spanData.Context);
            Assert.Equal(SPAN_NAME, spanData.Name);
            Assert.Equal(parentSpanId, spanData.ParentSpanId);
            Assert.False(spanData.HasRemoteParent);
            Assert.Equal(0, spanData.Attributes.DroppedAttributesCount);
            Assert.Equal(expectedAttributes, spanData.Attributes.AttributeMap);
            Assert.Equal(0, spanData.Annotations.DroppedEventsCount);
            Assert.Equal(2, spanData.Annotations.Events.Count());
            Assert.Equal(timestamp.AddNanos(100), spanData.Annotations.Events.ToList()[0].Timestamp);
            Assert.Equal(Annotation.FromDescription(ANNOTATION_DESCRIPTION), spanData.Annotations.Events.ToList()[0].Event);
            Assert.Equal(timestamp.AddNanos(200), spanData.Annotations.Events.ToList()[1].Timestamp);
            Assert.Equal(Annotation.FromDescriptionAndAttributes(ANNOTATION_DESCRIPTION, attributes), spanData.Annotations.Events.ToList()[1].Event);
            Assert.Equal(0, spanData.MessageEvents.DroppedEventsCount);
            Assert.Single(spanData.MessageEvents.Events);
            Assert.Equal(timestamp.AddNanos(300), spanData.MessageEvents.Events.First().Timestamp);
            Assert.Equal(networkEvent, spanData.MessageEvents.Events.First().Event);
            Assert.Equal(0, spanData.Links.DroppedLinksCount);
            Assert.Single(spanData.Links.Links);
            Assert.Equal(link, spanData.Links.Links.First());
            Assert.Equal(timestamp, spanData.StartTimestamp);
            Assert.Equal(Status.Cancelled, spanData.Status);
            Assert.Equal(timestamp.AddNanos(400), spanData.EndTimestamp);

            var startEndMock = Mock.Get <IStartEndHandler>(startEndHandler);
            var spanBase     = span as SpanBase;

            startEndMock.Verify(s => s.OnStart(spanBase), Times.Once);
            startEndMock.Verify(s => s.OnEnd(spanBase), Times.Once);
        }
Beispiel #41
0
 public void RegisterShapeForLink(Shape shape, Link link)
 {
     linksAndArrows.Add(link, shape);
     presentersManager.GetPresenterFor(link).Apply(shape);
 }
Beispiel #42
0
 public override void Convert(byte[] data)
 {
     byte[] l_bytes = new byte[4];
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 0];
     }
     this.m_File_id_0 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 4];
     }
     this.m_Level_id_4 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 8];
     }
     this.m_OFGA_link_8 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 12];
     }
     this.m_Unknown_C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 16];
     }
     this.m_OBAN_link_10 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 20];
     }
     this.m_Unknown_14 = (System.Single)BinaryDatReader.l_float(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 24];
     }
     this.m_Unknown_18 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 28];
     }
     this.m_Unknown_1C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 32];
     }
     this.m_Unknown_20 = (System.Single)BinaryDatReader.l_float(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 36];
     }
     this.m_Door_open_sound_24 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 68];
     }
     this.m_Door_close_sound_44 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 100];
     }
     this.m_Unknown_64 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 104];
     }
     this.m_Unknown_68 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4);
     for (int i = 0; i < 4; i++)
     {
         l_bytes[i] = data[i + 108];
     }
     this.m_Not_useed_6C = (System.Int32)BinaryDatReader.ConverterStub(l_bytes, 4);
 }
 public void AddAdministrativenhet(Link link)
 {
     AddLink("administrativenhet", link);
 }
Beispiel #44
0
 public IActionResult SetLink(Link link)
 {
     this._dbContext.Add(link);
     this._dbContext.SaveChanges();
     return(RedirectToAction("Index"));
 }
Beispiel #45
0
        /// <summary>
        /// Deletes the repository link identified by the object_id. The caller must authenticate as a user with administrative access to the repository.
        /// </summary>
        /// <param name="link">The link.</param>
        /// <returns></returns>
        public Link DeleteLink(Link link)
        {
            var overrideUrl = _baserUrl + "links/" + link.id + "/";

            return(_sharpBucketV1.Delete(link, overrideUrl));
        }
 public void AddArkivressurs(Link link)
 {
     AddLink("arkivressurs", link);
 }
 public void AddFravarstype(Link link)
 {
     AddLink("fravarstype", link);
 }
 public void AddTilgangsrestriksjon(Link link)
 {
     AddLink("tilgangsrestriksjon", link);
 }
 public void AddUndervisningsgruppe(Link link)
 {
     AddLink("undervisningsgruppe", link);
 }
Beispiel #50
0
        /// <summary>
        /// Creates a new link on the repository.
        /// </summary>
        /// <param name="link">The link.</param>
        /// <returns></returns>
        public Link PostLink(Link link)
        {
            var overrideUrl = _baserUrl + "links/";

            return(_sharpBucketV1.Post(link, overrideUrl));
        }
Beispiel #51
0
 private void EmailButton_OnClick(object sender, RoutedEventArgs e)
 {
     Link.OpenInBrowser("mailto://[email protected]");
 }
 public void AddEksamensgruppe(Link link)
 {
     AddLink("eksamensgruppe", link);
 }
Beispiel #53
0
 private void TwitterButton_OnClick(object sender, RoutedEventArgs e)
 {
     Link.OpenInBrowser("https://twitter.com/James_Willock");
 }
Beispiel #54
0
 private void DonateButton_OnClick(object sender, RoutedEventArgs e)
 {
     Link.OpenInBrowser("https://opencollective.com/materialdesigninxaml");
 }
        public void AdminSidebar()
        {
            User owner = ctx.owner.obj as User;

            set("owner.Name", owner.Name);
            set("owner.Pic", owner.PicSmall);

            set("owner.EditProfile", Link.To(owner, new UserProfileController().Profile));
            set("owner.EditContact", Link.To(owner, new UserProfileController().Contact));
            set("owner.EditInterest", Link.To(owner, new UserProfileController().Interest));
            set("owner.EditPic", Link.To(owner, new UserProfileController().Face));
            set("owner.EditPwd", Link.To(owner, new UserProfileController().Pwd));


            IList   userAppList = userAppService.GetByMember(ctx.owner.Id);
            Boolean isFrm       = true;

            bindUserAppList(userAppList, isFrm);

            set("shareLink", Link.To(ctx.owner.obj, new Users.Admin.ShareController().Index, -1));

            Boolean isUserAppAdminClose = Component.IsClose(typeof(UserAppAdmin));

            if (isUserAppAdminClose)
            {
                set("appAdminStyle", "display:none");
            }
            else
            {
                set("appAdminUrl", Link.To(ctx.owner.obj, new AppController().Index));
                set("appAdminStyle", "");
            }

            Boolean isUserMenuAdminClose = Component.IsClose(typeof(UserMenuAdmin));

            if (isUserMenuAdminClose)
            {
                set("menuAdminStyle", "display:none");
            }
            else
            {
                set("menuAdminUrl", Link.To(ctx.owner.obj, new MenuController().Index));
                set("menuAdminStyle", "");
            }

            Boolean isUserLinksClose = Component.IsClose(typeof(UserLinks));

            if (isUserLinksClose)
            {
                set("myUrlStyle", "display:none");
            }
            else
            {
                set("myUrlList", Link.To(ctx.owner.obj, new MyLinkController().Index));
                set("myUrlStyle", "");
            }

            if (Component.IsEnableGroup())
            {
                set("groupLink", Link.To(ctx.owner.obj, new MyGroupController().My));
                set("groupLinkStyle", "");
            }
            else
            {
                set("groupLinkStyle", "display:none");
            }
        }
Beispiel #56
0
 private void ChatButton_OnClick(object sender, RoutedEventArgs e)
 {
     Link.OpenInBrowser("https://gitter.im/ButchersBoy/MaterialDesignInXamlToolkit");
 }
 private bool IsHyperlink(Link item)
 {
     return(item is Hyperlink);
 }
Beispiel #58
0
 private void GitHubButton_OnClick(object sender, RoutedEventArgs e)
 {
     Link.OpenInBrowser(ConfigurationManager.AppSettings["GitHub"]);
 }
 private bool IsRelatedLink(Link item)
 {
     return(item is RelatedLink);
 }
Beispiel #60
0
 /// <summary>
 /// Creates an OperationsResponseLinks object type.
 /// </summary>
 /// <param name="effects">This endpoint represents effects that occurred as a result of a given operation.</param>
 /// <param name="precedes">This endpoint represents precedes that occurred as a result of a given operation.</param>
 /// <param name="self">This endpoint represents self that occurred as a result of a given operation.</param>
 /// <param name="succeeds">This endpoint represents succeeds that occurred as a result of a given operation.</param>
 /// <param name="transaction">This endpoint represents transaction that occurred as a result of a given operation.</param>
 public OperationResponseLinks(Link <Page <EffectResponse> > effects, Link <OperationResponse> precedes,
                               Link <OperationResponse> self, Link <OperationResponse> succeeds, Link <TransactionResponse> transaction)
 {
     Effects     = effects;
     Precedes    = precedes;
     Self        = self;
     Succeeds    = succeeds;
     Transaction = transaction;
 }