public void UnionWithT4_UsesElseExpressionIfNoCase3Match()
 {
     var union = new Union<int, string, Colors, Animals>(Animals.Cow);
     var result = union.Match<bool>()
                       .Case1().Do(x => false).Case2().Do(x => false).Case3().Do(false).Else(true).Result();
     IsTrue(result);
 }
 public void UnionWithT3_UsesElseIfNoCase3Match()
 {
     var union = new Union<int, string, Colors, Animals>(Colors.Green);
     var result = union.Match<bool>()
                       .Case1().Do(x => false).Case2().Do(x => false).Case4().Do(false).Else(x => true).Result();
     IsTrue(result);
 }
 public static string YesNo123OrOtherIntMatcherExample(Union<int, bool> value) => 
     value.Match<string>()
          .Case1().Of(1).Or(2).Or(3).Do(i => $"{i} in range 1-3")
          .Case1().Do(i => $"int={i}")
          .Case2().Of(true).Do("Yes")
          .Case2().Of(false).Do("No")
          .Result();
 public void DifferentT3Values_ArentEqual()
 {
     var a = new Union<int, string, Colors, Animals>(Colors.Blue);
     var b = new Union<int, string, Colors, Animals>(Colors.Red);
     IsFalse(a.Equals(b));
     IsFalse(a == b);
 }
 public void DifferentT4Values_ArentEqual()
 {
     var a = new Union<int, string, Colors, Animals>(Animals.Cat);
     var b = new Union<int, string, Colors, Animals>(Animals.Cow);
     IsFalse(a.Equals(b));
     IsFalse(a == b);
 }
 public void UnionWithT1_MatchesBasicCase1CorrectlyWithExec()
 {
     var union = new Union<int, string>(2);
     var result = 0;
     union.Match().Case1().Do(x => result = x).Case2().Do(x => result = 3).Exec();
     AreEqual(2, result);
 }
 public static ReactStyle FontSize(Union<string, int> fontSize)
 {
     return new ReactStyle
     {
         FontSize = fontSize
     };
 }
 public void UnionWithT2_CaseOfExpressionSupported()
 {
     var union = new Union<int, string, Colors, Animals>("1");
     var result = union.Match<int>()
                       .Case1().Do(0).Case2().Of("1").Do(2).Case2().Do(1).Case3().Do(3).Case4().Do(4).Result();
     AreEqual(2, result);
 }
 public void ComparingT2ValueWithNull_ResultsInNotEqual()
 {
     var a = new Union<int, string>(null);
     IsFalse(a.Equals(null));
     IsTrue(a != null);
     IsTrue(null != a);
 }
 public void DifferentT2Values_ArentEqual()
 {
     var a = new Union<int, string>("a");
     var b = new Union<int, string>("b");
     IsFalse(a.Equals(b));
     IsTrue(a != b);
 }
 public void UnionWithT2_UsesCase2MatchOverElse()
 {
     var union = new Union<int, string, Colors, Animals>("x");
     var result = 0;
     union.Match().Case2().Do(_ => result = 1).Else(_ => result = 2).Exec();
     AreEqual(1, result);
 }
 public void UnionWithT1_UsesCase1MatchOverElse()
 {
     var union = new Union<int, string, Colors, Animals>(2);
     var result = 0;
     union.Match().Case1().Do(x => result = x).Else(_ => result = 1).Exec();
     AreEqual(2, result);
 }
 public void UnionWithT4_UsesCase4MatchOverElse()
 {
     var union = new Union<int, string, Colors, Animals>(Animals.Sheep);
     var result = 0;
     union.Match().Case4().Do(_ => result = 1).Else(_ => result = 3).Exec();
     AreEqual(1, result);
 }
 public void UnionWithT3_UsesCase3MatchOverElse()
 {
     var union = new Union<int, string, Colors, Animals>(Colors.Blue);
     var result = 0;
     union.Match().Case3().Do(_ => result = 1).Else(_ => result = 3).Exec();
     AreEqual(1, result);
 }
 public void UnionWithT1_UsesElseIfNoCase1MatchWithExec()
 {
     var union = new Union<int, string, Colors>(11);
     var result = 0;
     union.Match().Case2().Do(x => result = 1).Case3().Do(x => result = 3).Else(x => result = x.Case1).Exec();
     AreEqual(11, result);
 }
 public void UnionWithT2_UsesElseIfNoCase2MatchWithExec()
 {
     var union = new Union<int, string, Colors>("fred");
     var result = 0;
     union.Match().Case1().Do(x => result = 1).Case3().Do(x => result = 3).Else(x => result = 2).Exec();
     AreEqual(2, result);
 }
 public void DifferentT2Values_ArentEqual()
 {
     var a = new Union<int, string, Colors>("abc");
     var b = new Union<int, string, Colors>("def");
     IsFalse(a.Equals(b));
     IsTrue(a != b);
 }
Beispiel #18
0
        static void Main(string[] args)
        {
            string s = "123";
            int i;
            if (int.TryParse(s, out i))
            {
                Console.WriteLine("Parsed {0}", i);
            }
            else
            {
                Console.WriteLine("Unable to parse '{0}'", s);
            }

            s = "1234zr";
            s.ParseInt()
                .Match()
                .None()
                    .Do(() => Console.WriteLine($"Unable to parse '{s}'"))
                .Some()
                    .Do(value => Console.WriteLine($"Parsed {value}"))
                .Exec();

            var demoUnion = new Union<int, bool>(false);
            string matcherResult = demoUnion.Match<string>()
                 .Case1().Of(1).Or(2).Or(3).Do(ui => $"{ui} in range 1-3")
                 .Case1().Do(ui => $"int={ui}")
                 .Case2().Of(true).Do("Yes")
                 .Case2().Of(false).Do("No")
                 .Result();
            Console.WriteLine(matcherResult);
        }
 public void DifferentT3Values_ArentEqual()
 {
     var a = new Union<int, string, Colors>(Colors.Blue);
     var b = new Union<int, string, Colors>(Colors.Green);
     IsFalse(a.Equals(b));
     IsTrue(a != b);
 }
 public void UnionAActionA()
 {
     const int val = 111;
     Union<int> union = new Union<int>(val);
     union.Match(
         (int i) => Assert.AreEqual(val, i)
     );
 }
 public void UnionWithT1_CaseWhereExpressionSupported()
 {
     var union = new Union<int, string, Colors, Animals>(3);
     var result = union.Match<int>()
                       .Case1().Of(2).Do(0).Case1().Where(x => x == 3).Do(1)
                       .Case2().Do(2).Case3().Do(3).Case4().Do(4).Result();
     AreEqual(1, result);
 }
 public void UnionWithT2_CaseOfExpressionSupported()
 {
     var union = new Union<int, string, Colors, Animals>("1");
     var result = -1;
     union.Match().Case1().Do(_ => result = 0).Case2().Of("1").Do(_ => result = 2)
                  .Case2().Do(_ => result = 1).Case3().Do(_ => result = 3).Case4().Do(_ => result = 4).Exec();
     AreEqual(2, result);
 }
 public void UnionWithT3_SimpleCaseExpressionSupported()
 {
     var union = new Union<int, string, Colors, Animals>(Colors.Blue);
     var result = 0;
     union.Match().Case1().Do(_ => result = 1).Case2().Do(_ => result = 2)
                  .Case3().Do(_ => result = 3).Case4().Do(_ => result = 4).Exec();
     AreEqual(3, result);
 }
 public void SameT3Values_AreEqualAndHaveSameHashCode()
 {
     var a = new Union<int, string, Colors>(Colors.Blue);
     var b = new Union<int, string, Colors>(Colors.Blue);
     IsTrue(a.Equals(b));
     IsTrue(a == b);
     AreEqual(a.GetHashCode(), b.GetHashCode());
 }
 public void UnionWithT4_UsesElseIfNoCase4Match()
 {
     var union = new Union<int, string, Colors, Animals>(Animals.Dog);
     var result = false;
     union.Match().Case1().Do(_ => result = false).Case2().Do(_ => result = false)
                  .Case3().Do(_ => result = false).Else(_ => result = true).Exec();
     IsTrue(result);
 }
 public void UnionWithT1_CaseWhereExpressionSupported()
 {
     var union = new Union<int, string, Colors, Animals>(3);
     var result = -1;
     union.Match().Case1().Of(2).Do(_ => result = 0).Case1().Where(x => x == 3).Do(_ => result = 1)
                  .Case2().Do(_ => result = 2).Case3().Do(_ => result = 3).Case4().Do(_ => result = 4).Exec();
     AreEqual(1, result);
 }
 public void SameT2Values_AreEqualAndHaveSameHashCode()
 {
     var a = new Union<int, string>("1234");
     var b = new Union<int, string>("1234");
     IsTrue(a.Equals(b));
     IsTrue(a == b);
     AreEqual(a.GetHashCode(), b.GetHashCode());
 }
 public void DifferentT1T3Values_AreNotEqualAndHaveDifferentHashCodes()
 {
     var a = new Union<int, string, Colors>(0);
     var b = new Union<int, string, Colors>(Colors.Green);
     IsFalse(a.Equals(b));
     IsTrue(a != b);
     AreNotEqual(a.GetHashCode(), b.GetHashCode());
 }
 public static ReactStyle Margin(this ReactStyle style, Union<string, int> top, Union<string, int> right, Union<string, int> bottom, Union<string, int> left)
 {
     style.MarginTop = top;
     style.MarginLeft = left;
     style.MarginRight = right;
     style.MarginBottom = bottom;
     return style;
 }
 public void DifferentValues_AreNotEqualAndHaveDifferentHashCodes()
 {
     var a = new Union<int, string>(0);
     var b = new Union<int, string>("1234");
     IsFalse(a.Equals(b));
     IsTrue(a != b);
     AreNotEqual(a.GetHashCode(), b.GetHashCode());
 }
Beispiel #31
0
 /// <summary>
 /// Draws (fills) a given text at the given (x,y) position.
 /// </summary>
 /// <param name="text">
 /// The text to render using the current font, textAlign, textBaseline, and direction values.
 /// </param>
 /// <param name="x">The x axis of the coordinate for the text starting point.</param>
 /// <param name="y">The y axis of the coordinate for the text starting point.</param>
 /// <param name="maxWidth">
 /// The maximum width to draw. If specified, and the string is computed to be wider than
 /// this width, the font is adjusted to use a more horizontally condensed font (if one is
 /// available or if a reasonably readable one can be synthesized by scaling the current
 /// font horizontally) or a smaller font.
 /// </param>
 public virtual void FillText(string text, Union <uint, int> x, Union <uint, int> y, Union <uint?, int?> maxWidth)
 {
     return;
 }
Beispiel #32
0
 /// <summary>
 /// Sets the associated {@link #getShell shell}.
 /// </summary>
 /// <param name="oShell">ID of an element which becomes the new target of this shell association; alternatively, an element instance may be given</param>
 /// <returns>Reference to <code>this</code> in order to allow method chaining</returns>
 public extern virtual sap.ui.unified.ShellOverlay setShell(Union <sap.ui.core.ID, sap.ui.unified.ShellLayout> oShell);
Beispiel #33
0
 /// <summary>
 /// Creates a pattern using the specified image (a CanvasImageSource). It repeats the source in the
 /// directions specified by the repetition argument. This method returns a CanvasPattern.
 /// </summary>
 /// <param name="image">
 /// A CanvasImageSource to be used as image to repeat. It can either be a:
 /// • HTMLImageElement (&lt;img>),
 /// • HTMLVideoElement (&lt;video>),
 /// • HTMLCanvasElement (&lt;canvas>),
 /// • CanvasRenderingContext2D,
 /// • ImageBitmap (c# object for now),
 /// • ImageData, or a
 /// • Blob.
 /// </param>
 /// <param name="repetition"></param>
 /// <returns>An opaque CanvasPattern object describing a pattern.</returns>
 /// <remarks>
 /// At the time of implementation, ImageBitmap had no documentation and Bridge.NET did not have
 /// it defined inside.
 /// </remarks>
 public virtual extern CanvasPattern CreatePattern(
     Union <HTMLImageElement, HTMLVideoElement, HTMLCanvasElement, CanvasRenderingContext2D, object, ImageData, Blob> image,
     CanvasTypes.CanvasRepetitionTypes repetition);
Beispiel #34
0
 /// <summary>
 /// Removes an ariaLabelledBy from the association named {@link #getAriaLabelledBy ariaLabelledBy}.
 /// </summary>
 /// <param name="vAriaLabelledBy">The ariaLabelledBy to be removed or its index or ID</param>
 /// <returns>The removed ariaLabelledBy or <code>null</code></returns>
 public extern virtual sap.ui.core.ID removeAriaLabelledBy(Union <int, sap.ui.core.ID, sap.ui.core.Control> vAriaLabelledBy);
Beispiel #35
0
 /// <summary>
 /// Adds a scaling transformation to the canvas units by x horizontally and by y vertically.
 /// </summary>
 /// <param name="x">Scaling factor in the horizontal direction.</param>
 /// <param name="y">Scaling factor in the vertical direction.</param>
 public virtual void Scale(Union <int, double> x, Union <int, double> y)
 {
     return;
 }
 /// <summary>
 /// Removes a content from the aggregation {@link #getContent content}.
 /// </summary>
 /// <param name="vContent">The content to remove or its index or id</param>
 /// <returns>The removed content or <code>null</code></returns>
 public extern virtual sap.ui.core.Control removeContent(Union <int, string, sap.ui.core.Control> vContent);
        private HDInsightOnDemandLinkedServiceResponse(
            ImmutableArray <Outputs.LinkedServiceReferenceResponse> additionalLinkedServiceNames,

            ImmutableArray <object> annotations,

            object?clusterNamePrefix,

            Union <Outputs.AzureKeyVaultSecretReferenceResponse, Outputs.SecureStringResponse>?clusterPassword,

            object clusterResourceGroup,

            object clusterSize,

            Union <Outputs.AzureKeyVaultSecretReferenceResponse, Outputs.SecureStringResponse>?clusterSshPassword,

            object?clusterSshUserName,

            object?clusterType,

            object?clusterUserName,

            Outputs.IntegrationRuntimeReferenceResponse?connectVia,

            object?coreConfiguration,

            object?dataNodeSize,

            string?description,

            object?encryptedCredential,

            object?hBaseConfiguration,

            Outputs.LinkedServiceReferenceResponse?hcatalogLinkedServiceName,

            object?hdfsConfiguration,

            object?headNodeSize,

            object?hiveConfiguration,

            object hostSubscriptionId,

            Outputs.LinkedServiceReferenceResponse linkedServiceName,

            object?mapReduceConfiguration,

            object?oozieConfiguration,

            ImmutableDictionary <string, Outputs.ParameterSpecificationResponse>?parameters,

            ImmutableArray <Outputs.ScriptActionResponse> scriptActions,

            object?servicePrincipalId,

            Union <Outputs.AzureKeyVaultSecretReferenceResponse, Outputs.SecureStringResponse>?servicePrincipalKey,

            object?sparkVersion,

            object?stormConfiguration,

            object?subnetName,

            object tenant,

            object timeToLive,

            string type,

            object version,

            object?virtualNetworkId,

            object?yarnConfiguration,

            object?zookeeperNodeSize)
        {
            AdditionalLinkedServiceNames = additionalLinkedServiceNames;
            Annotations               = annotations;
            ClusterNamePrefix         = clusterNamePrefix;
            ClusterPassword           = clusterPassword;
            ClusterResourceGroup      = clusterResourceGroup;
            ClusterSize               = clusterSize;
            ClusterSshPassword        = clusterSshPassword;
            ClusterSshUserName        = clusterSshUserName;
            ClusterType               = clusterType;
            ClusterUserName           = clusterUserName;
            ConnectVia                = connectVia;
            CoreConfiguration         = coreConfiguration;
            DataNodeSize              = dataNodeSize;
            Description               = description;
            EncryptedCredential       = encryptedCredential;
            HBaseConfiguration        = hBaseConfiguration;
            HcatalogLinkedServiceName = hcatalogLinkedServiceName;
            HdfsConfiguration         = hdfsConfiguration;
            HeadNodeSize              = headNodeSize;
            HiveConfiguration         = hiveConfiguration;
            HostSubscriptionId        = hostSubscriptionId;
            LinkedServiceName         = linkedServiceName;
            MapReduceConfiguration    = mapReduceConfiguration;
            OozieConfiguration        = oozieConfiguration;
            Parameters                = parameters;
            ScriptActions             = scriptActions;
            ServicePrincipalId        = servicePrincipalId;
            ServicePrincipalKey       = servicePrincipalKey;
            SparkVersion              = sparkVersion;
            StormConfiguration        = stormConfiguration;
            SubnetName                = subnetName;
            Tenant            = tenant;
            TimeToLive        = timeToLive;
            Type              = type;
            Version           = version;
            VirtualNetworkId  = virtualNetworkId;
            YarnConfiguration = yarnConfiguration;
            ZookeeperNodeSize = zookeeperNodeSize;
        }
Beispiel #38
0
 /// <summary>
 /// Sets the current line dash pattern.
 /// </summary>
 /// <param name="segments">
 /// An Array. A list of numbers that specifies distances to alternately draw a line and a gap
 /// (in coordinate space units). If the number of elements in the array is odd, the elements
 /// of the array get copied and concatenated.
 /// For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25].
 /// </param>
 public virtual void SetLineDash(Union <double[], uint[], int[], IEnumerable <Union <double, uint, int> > > segments)
 {
     return;
 }
Beispiel #39
0
        // The following methods are provided for drawing text. See also the TextMetrics object for
        // text properties.

        #region Drawing Text

        /// <summary>
        /// Draws (fills) a given text at the given (x,y) position.
        /// </summary>
        /// <param name="text">
        /// The text to render using the current font, textAlign, textBaseline, and direction values.
        /// </param>
        /// <param name="x">The x axis of the coordinate for the text starting point.</param>
        /// <param name="y">The y axis of the coordinate for the text starting point.</param>
        public virtual void FillText(string text, Union <uint, int> x, Union <uint, int> y)
        {
            return;
        }
Beispiel #40
0
 /// <summary>
 /// Removes a tileContent from the aggregation {@link #getTileContent tileContent}.
 /// </summary>
 /// <param name="vTileContent">The tileContent to remove or its index or id</param>
 /// <returns>The removed tileContent or <code>null</code></returns>
 public extern virtual sap.m.TileContent removeTileContent(Union <int, string, sap.m.TileContent> vTileContent);
Beispiel #41
0
 private DataImportDetailsResponse(Union <Outputs.ManagedDiskDetailsResponse, Outputs.StorageAccountDetailsResponse> accountDetails)
 {
     AccountDetails = accountDetails;
 }
Beispiel #42
0
 /// <summary>
 /// Adds a translation transformation by moving the canvas and its origin x horizontally and
 /// y vertically on the grid.
 /// </summary>
 /// <param name="x">Distance to move in the horizontal direction.</param>
 /// <param name="y">Distance to move in the vertical direction.</param>
 public virtual void Translate(Union <int, double> x, Union <int, double> y)
 {
     return;
 }
Beispiel #43
0
 /// <summary>
 /// Paints a rectangle which has a starting point at (x, y) and has a w width and an h height
 /// onto the canvas, using the current stroke style.
 /// </summary>
 /// <param name="x">The x axis of the coordinate for the rectangle starting point.</param>
 /// <param name="y">The y axis of the coordinate for the rectangle starting point.</param>
 /// <param name="width">The rectangle's width.</param>
 /// <param name="height">The rectangle's height.</param>
 public virtual void StrokeRect(Union <uint, int> x, Union <uint, int> y, Union <uint, int> width, Union <uint, int> height)
 {
     return;
 }
Beispiel #44
0
 /// <summary>
 /// Reports whether or not the specified point is contained in the current path.
 /// </summary>
 /// <param name="path">A Path2D path to use.</param>
 /// <param name="x">The X coordinate of the point to check.</param>
 /// <param name="y">The Y coordinate of the point to check.</param>
 /// <param name="fillRule">
 /// The algorithm by which to determine if a point is inside a path or outside a path.
 /// </param>
 /// <returns>
 /// A Boolean, which is true if the specified point is contained in the current or specfied path,
 /// otherwise false.
 /// </returns>
 public virtual extern bool IsPointInPath(Path2D path, Union <uint, int, double> x, Union <uint, int, double> y,
                                          CanvasTypes.CanvasFillRule?fillRule);
Beispiel #45
0
 /// <summary>
 /// Creates a new Uint32Array of the specified length.
 /// </summary>
 /// <param name="length">Length of array to create</param>
 public Uint32Array(Union <int, uint> length)
 {
 }
Beispiel #46
0
 /// <summary>
 /// Adds some ariaLabelledBy into the association {@link #getAriaLabelledBy ariaLabelledBy}.
 /// </summary>
 /// <param name="vAriaLabelledBy">The ariaLabelledBy to add; if empty, nothing is inserted</param>
 /// <returns>Reference to <code>this</code> in order to allow method chaining</returns>
 public extern virtual sap.ui.unified.ShellOverlay addAriaLabelledBy(Union <sap.ui.core.ID, sap.ui.core.Control> vAriaLabelledBy);
Beispiel #47
0
 /// <summary>
 /// Reports whether or not the specified point is inside the area contained by the stroking of a path.
 /// </summary>
 /// <param name="path">A Path2D path to use.</param>
 /// <param name="x">The X coordinate of the point to check.</param>
 /// <param name="y">The Y coordinate of the point to check.</param>
 /// <returns>
 /// A Boolean, which is true if the point is inside the area contained by the stroking of a path,
 /// otherwise false.
 /// </returns>
 public virtual extern bool IsPointInStroke(Path2D path, Union <uint, int, double> x, Union <uint, int, double> y);
        public override void BuildChildNodes(ITreeBuilder treeBuilder, object dataObject)
        {
            CProject p = treeBuilder.GetParentDataItem(typeof(CProject), false) as CProject;

            if (p == null)
            {
                return;
            }

            ProjectInformation info = ProjectInformationManager.Instance.Get(p);

            Union thisUnion = (Union)dataObject;

            // Classes
            foreach (Class c in info.Classes)
            {
                if (c.Parent != null && c.Parent.Equals(thisUnion))
                {
                    treeBuilder.AddChild(c);
                }
            }

            // Structures
            foreach (Structure s in info.Structures)
            {
                if (s.Parent != null && s.Parent.Equals(thisUnion))
                {
                    treeBuilder.AddChild(s);
                }
            }

            // Unions
            foreach (Union u in info.Unions)
            {
                if (u.Parent != null && u.Parent.Equals(thisUnion))
                {
                    treeBuilder.AddChild(u);
                }
            }

            // Enumerations
            foreach (Enumeration e in info.Enumerations)
            {
                if (e.Parent != null && e.Parent.Equals(thisUnion))
                {
                    treeBuilder.AddChild(e);
                }
            }

            // Typedefs
            foreach (Typedef t in info.Typedefs)
            {
                if (t.Parent != null && t.Parent.Equals(thisUnion))
                {
                    treeBuilder.AddChild(t);
                }
            }

            // Functions
            foreach (Function f in info.Functions)
            {
                if (f.Parent != null && f.Parent.Equals(thisUnion))
                {
                    treeBuilder.AddChild(f);
                }
            }

            // Members
            foreach (Member m in info.Members)
            {
                if (m.Parent != null && m.Parent.Equals(thisUnion))
                {
                    treeBuilder.AddChild(m);
                }
            }
        }
Beispiel #49
0
 /// <summary>
 /// Reports whether or not the specified point is contained in the current path.
 /// </summary>
 /// <param name="x">The X coordinate of the point to check.</param>
 /// <param name="y">The Y coordinate of the point to check.</param>
 /// <returns>
 /// A Boolean, which is true if the specified point is contained in the current or specfied path,
 /// otherwise false.
 /// </returns>
 public virtual extern bool IsPointInPath(Union <uint, int, double> x, Union <uint, int, double> y);
Beispiel #50
0
        static void Main(string[] args)
        {
            #region Variable declaration
            // Variable declaration
            String[]          indexedDoc = File.ReadAllLines(Path.GetFullPath("C:\\Users\\priyaharish\\Google Drive\\UH\\Sem 1 Paper\\Data Mining\\Assignments\\Assignment2\\WebSearch_PriyaKumari_1446664\\docs.txt"));
            String[]          vocab      = File.ReadAllLines(Path.GetFullPath("C:\\Users\\priyaharish\\Google Drive\\UH\\Sem 1 Paper\\Data Mining\\Assignments\\Assignment2\\WebSearch_PriyaKumari_1446664\\vocab_map.txt"));
            List <int>        finalList  = new List <int>();
            CreatePostingList cr         = new CreatePostingList();
            List <int>        firstList  = new List <int>();
            List <int>        secondList = new List <int>();
            #endregion

            #region Accept Argument
            //Accepting Command Line Argument
            Console.WriteLine("Please enter query type");
            String qryType = Console.ReadLine();
            Console.WriteLine("Please enter query");
            String qry = Console.ReadLine();
            Console.WriteLine("Processing");
            #endregion

            #region Creating Posting List
            // Creating Posting List
            List <PostingList> returnedPostingList = new List <PostingList>();
            if (qryType.ToUpper() != "AND_NOT")
            {
                returnedPostingList = cr.CreatPostingList(indexedDoc, vocab, qryType, qry);
                if (returnedPostingList.Count > 0)
                {
                    if (returnedPostingList.Count == 1)
                    {
                        if (returnedPostingList[0].wordIndex == 1)
                        {
                            firstList = returnedPostingList[0].documentList;
                        }
                        if (returnedPostingList[0].wordIndex == 2)
                        {
                            secondList = returnedPostingList[0].documentList;
                        }
                    }

                    if (returnedPostingList.Count == 2)
                    {
                        firstList  = returnedPostingList[0].documentList;
                        secondList = returnedPostingList[1].documentList;
                    }
                }
            }
            #endregion

            #region PLIST
            if (qryType.ToUpper() == "PLIST")
            {
                if (returnedPostingList.Count > 0)
                {
                    finalList = returnedPostingList[0].documentList;
                }
            }
            #endregion

            #region AND
            if (qryType.ToUpper() == "AND")
            {
                Intersection andLogic = new Intersection();
                finalList = andLogic.evaluateAndQuery(firstList, secondList);
            }
            #endregion

            #region OR
            if (qryType.ToUpper() == "OR")
            {
                Union orLogic = new Union();
                finalList = orLogic.evaluateORQuery(firstList, secondList);
            }
            #endregion

            #region AND_NOT
            if (qryType.ToUpper() == "AND_NOT")
            {
                AndNot orLogic = new AndNot();
                finalList = orLogic.evaluateAndNOTQuery(indexedDoc, vocab, qryType, qry);
            }
            #endregion

            #region Print
            finalList.Sort();
            StringBuilder final = new StringBuilder();
            final.Append(qry).Append(" ->").Append(" [");
            foreach (int i in finalList)
            {
                final.Append(i).Append(", ");
            }
            if (finalList.Count > 0)
            {
                final.Remove(final.Length - 1, 1);
                final.Remove(final.Length - 1, 1);
            }
            final.Append("]");
            Console.WriteLine("Please enter output path");
            String outPath = Console.ReadLine();
            System.IO.StreamWriter file = new System.IO.StreamWriter(outPath.ToString());
            file.WriteLine(final);
            file.Dispose();

            #endregion
        }
Beispiel #51
0
 /// <summary>
 /// Creates a radial gradient along the line given by the coordinates represented by the parameters.
 /// </summary>
 /// <param name="x0">The x axis of the coordinate of the start circle.</param>
 /// <param name="y0">The y axis of the coordinate of the start circle.</param>
 /// <param name="r0">The radius of the start circle.</param>
 /// <param name="x1">The x axis of the coordinate of the end circle.</param>
 /// <param name="y1">The y axis of the coordinate of the end circle.</param>
 /// <param name="r1">The radius of the end circle.</param>
 /// <returns>A radial CanvasGradient initialized with the two specified circles.</returns>
 public virtual extern CanvasGradient CreateRadialGradient(
     Union <uint, int, double> x0, Union <uint, int, double> y0, Union <uint, int, double> r0,
     Union <uint, int, double> x1, Union <uint, int, double> y1, Union <uint, int, double> r1);
Beispiel #52
0
        // See also the ImageData object.

        #region Pixel Manipulation

        /// <summary>
        /// Creates a new, blank ImageData object with the specified dimensions. All of the pixels in the
        /// new object are transparent black.
        /// </summary>
        /// <param name="width">The width to give the new ImageData object.</param>
        /// <param name="height">The height to give the new ImageData object.</param>
        /// <returns>
        /// A new ImageData object with the specified width and height. The new object is filled with
        /// transparent black pixels.
        /// </returns>
        public virtual extern ImageData CreateImageData(Union <uint, int> width, Union <uint, int> height);
Beispiel #53
0
 /// <summary>
 /// Draws the specified image. This method is available in multiple formats, providing a great
 /// deal of flexibility in its use.
 /// </summary>
 /// <param name="image">
 /// An element to draw into the context. The specification permits any canvas image source.
 /// </param>
 /// <param name="dx">
 /// The X coordinate in the destination canvas at which to place the top-left corner of the source image.
 /// </param>
 /// <param name="dy">
 /// The Y coordinate in the destination canvas at which to place the top-left corner of the source image.
 /// </param>
 /// <param name="dWidth">
 /// The width to draw the image in the destination canvas. This allows scaling of the drawn image.
 /// If null, the image is not scaled in height when drawn.
 /// </param>
 /// <param name="dHeight">
 /// The height to draw the image in the destination canvas. This allows scaling of the drawn image.
 /// If null, the image is not scaled in height when drawn.
 /// </param>
 public virtual void DrawImage(Union <HTMLImageElement, HTMLVideoElement, HTMLCanvasElement, CanvasRenderingContext2D> image,
                               Union <int, uint, float, double> dx, Union <int, uint, float, double> dy,
                               Union <int?, uint?, float?, double?> dWidth, Union <int?, uint?, float?, double?> dHeight)
 {
     return;
 }
Beispiel #54
0
 /// <summary>
 /// Returns an ImageData object representing the underlying pixel data for the area of the canvas
 /// denoted by the rectangle which starts at (sx, sy) and has an sw width and sh height.
 /// </summary>
 /// <param name="sx">
 /// The x axis of the coordinate for the rectangle startpoint from which the ImageData will be extracted.
 /// </param>
 /// <param name="sy">
 /// The y axis of the coordinate for the rectangle endpoint from which the ImageData will be extracted.
 /// </param>
 /// <param name="sw">
 /// The width of the rectangle from which the ImageData will be extracted.
 /// </param>
 /// <param name="sh">
 /// The height of the rectangle from which the ImageData will be extracted.
 /// </param>
 /// <returns></returns>
 public virtual extern ImageData GetImageData(Union <uint, int> sx, Union <uint, int> sy, Union <uint, int> sw, Union <uint, int> sh);
Beispiel #55
0
 /// <summary>
 /// Creates a linear gradient along the line given by the coordinates represented by the parameters.
 /// </summary>
 /// <param name="x0">The x axis of the coordinate of the start point.</param>
 /// <param name="y0">The y axis of the coordinate of the start point.</param>
 /// <param name="x1">The x axis of the coordinate of the end point.</param>
 /// <param name="y1">The y axis of the coordinate of the end point.</param>
 /// <returns>A linear CanvasGradient initialized with the specified line.</returns>
 public virtual extern CanvasGradient CreateLinearGradient(Union <uint, int, double> x0, Union <uint, int, double> y0,
                                                           Union <uint, int, double> x1, Union <uint, int, double> y1);
Beispiel #56
0
 /// <summary>
 /// Resets the current transform to the identity matrix, and then invokes the transform()
 /// method with the same arguments.
 /// Matrix is described by a 3x3 [ a c e // b d f // 0 0 1 ] (// means a matrix line break).
 /// </summary>
 /// <param name="a">m11: Horizontal scaling.</param>
 /// <param name="b">m12: Horizontal skewing.</param>
 /// <param name="c">m21: Vertical skewing.</param>
 /// <param name="d">m22: Vertical scaling.</param>
 /// <param name="e">dx: Horizontal moving.</param>
 /// <param name="f">dy: Vertical moving.</param>
 public virtual void SetTransform(Union <int, double> a, Union <int, double> b, Union <int, double> c,
                                  Union <int, double> d, Union <int, double> e, Union <int, double> f)
 {
     return;
 }
Beispiel #57
0
 /// <summary>
 /// Removes a button from the aggregation {@link #getButtons buttons}.
 /// </summary>
 /// <param name="vButton">The button to remove or its index or id</param>
 /// <returns>The removed button or <code>null</code></returns>
 public extern virtual sap.ui.commons.Button removeButton(Union <int, string, sap.ui.commons.Button> vButton);
Beispiel #58
0
 /// <summary>
 /// Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided,
 /// only the pixels from that rectangle are painted.
 /// </summary>
 /// <param name="imagedata">An imageData object containing the array of pixel values.</param>
 /// <param name="dx">
 /// Position offset in the target canvas context of the rectangle to be painted, relative to the
 /// rectangle in the origin image data.
 /// </param>
 /// <param name="dy">
 /// Position offset in the target canvas context of the rectangle to be painted, relative to the
 /// rectangle in the origin image data.
 /// </param>
 /// <param name="dirtyX">
 /// Position of the top left point of the rectangle to be painted, in the origin image data.
 /// Defaults to the top left of the whole image data.
 /// </param>
 /// <param name="dirtyY">
 /// Position of the top left point of the rectangle to be painted, in the origin image data.
 /// Defaults to the top left of the whole image data.
 /// </param>
 /// <param name="dirtyWidth">
 /// Width of the rectangle to be painted, in the origin image data. Defaults to the width of the image data.
 /// </param>
 /// <param name="dirtyHeight">
 /// Height of the rectangle to be painted, in the origin image data. Defaults to the height of the image data.
 /// </param>
 public virtual void PutImageData(ImageData imagedata, int dx, int dy,
                                  Union <uint?, int?> dirtyX, Union <uint?, int?> dirtyY,
                                  Union <uint?, int?> dirtyWidth, Union <uint?, int?> dirtyHeight)
 {
     return;
 }
Beispiel #59
0
        /// <summary>
        /// Reads the JSON representation of the object.
        /// </summary>
        /// <param name="reader">The <see cref="JsonReader"/> to read from.</param>
        /// <param name="objectType">Type of the object.</param>
        /// <param name="existingValue">The existing value of object being read.</param>
        /// <param name="serializer">The calling serializer.</param>
        /// <returns>The object value.</returns>
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.Null)
            {
                return(null);
            }

            UnionCase caseInfo = null;
            string    caseName = null;
            JArray    fields   = null;

            // start object
            reader.ReadAndAssert();

            while (reader.TokenType == JsonToken.PropertyName)
            {
                string propertyName = reader.Value.ToString();
                if (string.Equals(propertyName, CasePropertyName, StringComparison.OrdinalIgnoreCase))
                {
                    reader.ReadAndAssert();

                    Union union = UnionCache.Get(objectType);

                    caseName = reader.Value.ToString();

                    caseInfo = union.Cases.SingleOrDefault(c => c.Name == caseName);

                    if (caseInfo == null)
                    {
                        throw JsonSerializationException.Create(reader, "No union type found with the name '{0}'.".FormatWith(CultureInfo.InvariantCulture, caseName));
                    }
                }
                else if (string.Equals(propertyName, FieldsPropertyName, StringComparison.OrdinalIgnoreCase))
                {
                    reader.ReadAndAssert();
                    if (reader.TokenType != JsonToken.StartArray)
                    {
                        throw JsonSerializationException.Create(reader, "Union fields must been an array.");
                    }

                    fields = (JArray)JToken.ReadFrom(reader);
                }
                else
                {
                    throw JsonSerializationException.Create(reader, "Unexpected property '{0}' found when reading union.".FormatWith(CultureInfo.InvariantCulture, propertyName));
                }

                reader.ReadAndAssert();
            }

            if (caseInfo == null)
            {
                throw JsonSerializationException.Create(reader, "No '{0}' property with union name found.".FormatWith(CultureInfo.InvariantCulture, CasePropertyName));
            }

            object[] typedFieldValues = new object[caseInfo.Fields.Length];

            if (caseInfo.Fields.Length > 0 && fields == null)
            {
                throw JsonSerializationException.Create(reader, "No '{0}' property with union fields found.".FormatWith(CultureInfo.InvariantCulture, FieldsPropertyName));
            }

            if (fields != null)
            {
                if (caseInfo.Fields.Length != fields.Count)
                {
                    throw JsonSerializationException.Create(reader, "The number of field values does not match the number of properties defined by union '{0}'.".FormatWith(CultureInfo.InvariantCulture, caseName));
                }

                for (int i = 0; i < fields.Count; i++)
                {
                    JToken       t             = fields[i];
                    PropertyInfo fieldProperty = caseInfo.Fields[i];

                    typedFieldValues[i] = t.ToObject(fieldProperty.PropertyType, serializer);
                }
            }

            object[] args = { typedFieldValues };

            return(caseInfo.Constructor.Invoke(args));
        }
Beispiel #60
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="valueToEncode">The string value you want to convert to Base64.</param>
 public Base64(Union <string, IntrinsicFunction> valueToEncode)
 {
     Token = new JObject(
         new JProperty(Name, valueToEncode.ToJson()));
 }