예제 #1
0
        public Provider(
            LocatedRef <string> name,
            LocatedVal <Guid> id,
            LocatedRef <string> symbol)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (symbol == null)
            {
                throw new ArgumentNullException(nameof(symbol));
            }

            Name   = name;
            Id     = id;
            Symbol = symbol;

            Channels     = new ChannelCollection(this);
            Levels       = new LevelCollection(this);
            Opcodes      = new OpcodeCollection(this);
            Tasks        = new TaskCollection(this);
            Keywords     = new KeywordCollection(this);
            Maps         = new MapCollection(this);
            NamedQueries = new PatternMapCollection(this);
            Filters      = new FilterCollection(this);
            Templates    = new TemplateCollection(this);
            Events       = new EventCollection(this);
        }
예제 #2
0
 public BitMapItem(
     BitMap map, LocatedVal <uint> value, LocatedRef <string> symbol,
     LocalizedString message)
     : base(value, message, symbol)
 {
     this.map = map ?? throw new ArgumentNullException(nameof(map));
 }
예제 #3
0
 public Keyword(LocatedRef <QName> name, LocatedVal <ulong> mask,
                LocatedRef <string> symbol, LocalizedString message)
     : this(name, mask)
 {
     Symbol  = symbol;
     Message = message;
 }
예제 #4
0
 public Opcode(
     LocatedRef <QName> name, LocatedVal <byte> value,
     LocatedRef <string> symbol, LocalizedString message)
     : this(name, value)
 {
     Symbol  = symbol;
     Message = message;
 }
예제 #5
0
 public Channel(LocatedRef <string> name, LocatedVal <ChannelType> type)
 {
     if (name == null)
     {
         throw new ArgumentNullException(nameof(name));
     }
     Name = name;
     Type = type;
 }
예제 #6
0
 public Provider(
     LocatedRef <string> name,
     LocatedVal <Guid> id,
     LocatedRef <string> symbol,
     LocalizedString message)
     : this(name, id, symbol)
 {
     Message = message;
 }
예제 #7
0
 public Level(LocatedRef <QName> name, LocatedVal <byte> value)
 {
     if (name == null)
     {
         throw new ArgumentNullException(nameof(name));
     }
     Name  = name;
     Value = value;
 }
예제 #8
0
 public static void ReportError <T, TProperty>(
     T entity,
     LocatedVal <TProperty> value,
     IDiagnostics diags,
     IUniqueConstraint <T> constraint)
     where TProperty : struct
 {
     diags.ReportError(value.Location, constraint.FormatMessage(entity));
 }
예제 #9
0
 public Keyword(LocatedRef <QName> name, LocatedVal <ulong> mask)
 {
     if (name == null)
     {
         throw new ArgumentNullException(nameof(name));
     }
     Name = name;
     Mask = mask;
 }
예제 #10
0
        public void Constructor()
        {
            var value    = new X();
            var location = new SourceLocation("z:\\foo", 23, 42);

            var located = new LocatedVal <X>(value, location);

            Assert.Equal(value, located.Value);
            Assert.Equal(location, located.Location);
        }
예제 #11
0
 public Task(
     LocatedRef <QName> name, LocatedVal <ushort> value,
     LocatedRef <string> symbol, LocatedNullable <Guid> guid,
     LocalizedString message)
     : this(name, value)
 {
     Symbol  = symbol;
     Guid    = guid;
     Message = message;
 }
예제 #12
0
        public void ImplicitConversion()
        {
            var value = new X();

            X convertedValue            = new LocatedVal <X>(value, new SourceLocation());
            LocatedVal <X> convertedVal = convertedValue;

            Assert.Equal(value, convertedValue);
            Assert.Equal(value, convertedVal.Value);
            Assert.Null(convertedVal.Location);
        }
예제 #13
0
 public Filter(
     LocatedRef <QName> name,
     LocatedVal <byte> value,
     LocatedVal <byte> version,
     LocatedRef <string> symbol,
     LocalizedString message)
     : this(name, value, version)
 {
     Symbol  = symbol;
     Message = message;
 }
예제 #14
0
 public Filter(
     LocatedRef <QName> name,
     LocatedVal <byte> value,
     LocatedVal <byte> version)
 {
     if (name == null)
     {
         throw new ArgumentNullException(nameof(name));
     }
     Name    = name;
     Value   = value;
     Version = version;
 }
예제 #15
0
        public void Equatable()
        {
            var sameValue     = new EquatableX(1);
            var equalValue    = new EquatableX(1);
            var notEqualValue = new EquatableX(3);
            var location      = new SourceLocation("a", 1, 1);
            var otherLocation = new SourceLocation("b", 2, 2);

            var located = new LocatedVal <EquatableX>(sameValue, location);

            var same     = new LocatedVal <EquatableX>(sameValue);
            var equal    = new LocatedVal <EquatableX>(equalValue);
            var notEqual = new LocatedVal <EquatableX>(notEqualValue);

            var sameWithLoc     = new LocatedVal <EquatableX>(sameValue, otherLocation);
            var equalWithLoc    = new LocatedVal <EquatableX>(equalValue, otherLocation);
            var notEqualWithLoc = new LocatedVal <EquatableX>(notEqualValue, otherLocation);

            Assert.True(located.Equals(located));
            Assert.True(located.Equals(same));
            Assert.True(located.Equals(equal));
            Assert.False(located.Equals(notEqual));

            Assert.True(located.Equals(sameWithLoc));
            Assert.True(located.Equals(equalWithLoc));
            Assert.False(located.Equals(notEqualWithLoc));

            Assert.True(located.Equals((object)same));
            Assert.True(located.Equals((object)equal));
            Assert.False(located.Equals((object)notEqual));

            Assert.True(located.Equals((object)sameWithLoc));
            Assert.True(located.Equals((object)equalWithLoc));
            Assert.False(located.Equals((object)notEqualWithLoc));

            Assert.True(located.Equals(sameValue));
            Assert.True(located.Equals(equalValue));
            Assert.False(located.Equals(notEqualValue));

            Assert.True(located.Equals((object)sameValue));
            Assert.True(located.Equals((object)equalValue));
            Assert.False(located.Equals((object)notEqualValue));

            Assert.True(located.Equals((object)sameValue.Value));
            Assert.True(located.Equals((object)equalValue.Value));
            Assert.False(located.Equals((object)notEqualValue.Value));
        }
예제 #16
0
        public void Comparable()
        {
            var sameValue     = new ComparableX(10);
            var equalValue    = new ComparableX(10);
            var smallerValue  = new ComparableX(9);
            var largerValue   = new ComparableX(11);
            var location      = new SourceLocation("a", 1, 1);
            var otherLocation = new SourceLocation("b", 2, 2);

            var located = new LocatedVal <ComparableX>(sameValue, location);

            var same    = new LocatedVal <ComparableX>(sameValue);
            var equal   = new LocatedVal <ComparableX>(equalValue);
            var smaller = new LocatedVal <ComparableX>(smallerValue);
            var larger  = new LocatedVal <ComparableX>(largerValue);

            var sameWithLoc    = new LocatedVal <ComparableX>(sameValue, otherLocation);
            var equalWithLoc   = new LocatedVal <ComparableX>(equalValue, otherLocation);
            var smallerWithLoc = new LocatedVal <ComparableX>(smallerValue, otherLocation);
            var largerWithLoc  = new LocatedVal <ComparableX>(largerValue, otherLocation);

            Assert.Equal(0, located.CompareTo(located));
            Assert.Equal(0, located.CompareTo(same));
            Assert.Equal(0, located.CompareTo(equal));
            Assert.Equal(1, located.CompareTo(smaller));
            Assert.Equal(-1, located.CompareTo(larger));

            Assert.Equal(0, located.CompareTo(sameWithLoc));
            Assert.Equal(0, located.CompareTo(equalWithLoc));
            Assert.Equal(1, located.CompareTo(smallerWithLoc));
            Assert.Equal(-1, located.CompareTo(largerWithLoc));

            Assert.Equal(0, located.CompareTo(sameValue));
            Assert.Equal(0, located.CompareTo(equalValue));
            Assert.Equal(1, located.CompareTo(smallerValue));
            Assert.Equal(-1, located.CompareTo(largerValue));
        }
예제 #17
0
 public Event(LocatedVal <uint> value, LocatedVal <byte> version)
 {
     Value   = value;
     Version = version;
 }
예제 #18
0
 public Event(LocatedVal <uint> value)
     : this(value, new LocatedVal <byte>(0))
 {
 }
예제 #19
0
 public Filter(
     LocatedRef <QName> name,
     LocatedVal <byte> value)
     : this(name, value, new LocatedVal <byte>(0))
 {
 }
예제 #20
0
 public Task(LocatedRef <QName> name, LocatedVal <ushort> value)
 {
     Name  = name ?? throw new ArgumentNullException(nameof(name));
     Value = value;
 }
예제 #21
0
 protected MapItem(LocatedVal <uint> value, LocalizedString message)
 {
     Value   = value;
     Message = message ?? throw new ArgumentNullException(nameof(message));
 }
예제 #22
0
 protected MapItem(LocatedVal <uint> value, LocalizedString message,
                   LocatedRef <string> symbol)
     : this(value, message)
 {
     Symbol = symbol;
 }
예제 #23
0
 public ValueMapItem(ValueMap map, LocatedVal <uint> value, LocalizedString message)
     : base(value, message)
 {
     Map = map ?? throw new ArgumentNullException(nameof(map));
 }
예제 #24
0
 public Opcode(LocatedRef <QName> name, LocatedVal <byte> value)
 {
     Name  = name ?? throw new ArgumentNullException(nameof(name));
     Value = value;
 }