public static OpenZWaveDeviceValue Match(this IEnumerable <OpenZWaveDeviceValue> values, byte id, CommandClass commandClass, byte index, byte?instance = null)
        {
            var matcher = CompositeMatcher.Create(id, commandClass, index, instance);
            var result  = values.Match(matcher);

            return(result);
        }
示例#2
0
        private static IOpenZWaveDeviceValueMatcher CreateMatcher(OpenZWaveDevice device, IOpenZWaveDeviceValueMatcher unitsMatcher)
        {
            var result = new CompositeMatcher(
                new IdMatcher(device.Id),
                new CommandClassMatcher(CommandClass.SensorMultilevel),
                unitsMatcher
                );

            return(result);
        }
        public void Composite_matcher()
        {
            var matcher = new CompositeMatcher(
                new List <IContentMatcher>()
            {
                new RegexContentMatcher(".mkv|.png")
            });

            Assert.IsTrue(matcher.Match("some.mkv"));
            Assert.IsTrue(matcher.Match("fafa.png"));
            Assert.IsFalse(matcher.Match("fafa.bin"));

            matcher.Matches.Add(new RegexContentMatcher(".mkv"));
            Assert.IsFalse(matcher.Match("fafa.png"));
        }
示例#4
0
        public void TestAnySequence()
        {
            ITokenMatcher matcher = new CompositeMatcher(
                new AnyCharMatcher("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"),
                new SequenceOfAnyCharMatcher("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789")
                );

            ITokenMatcher alphaMatcher = new SequenceOfAnyCharMatcher("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789");

            Tokenizer tokenizer = new Tokenizer();

            tokenizer.AddTokenMatcher(matcher);
            tokenizer.AddTokenMatcher(new WhiteSpaceMatcher());
            tokenizer.AddTokenMatcher(new CharMatcher('.'));

            Token[] tokens = tokenizer.Tokenize("Math.Max");

            Assert.AreEqual(3, tokens.Length);
            Assert.AreEqual("Math", tokens[0].Text);
            Assert.AreEqual(".", tokens[1].Text);
            Assert.AreEqual("Max", tokens[2].Text);
        }
示例#5
0
 protected NodeDataEntry(OpenZWaveDevice device, CommandClass commandClass, byte?index = null, bool?initialValueIsValid = null)
     : this(device, CompositeMatcher.Create(device.Id, commandClass, index), initialValueIsValid)
 {
 }