Beispiel #1
0
        public void NotSoSimpleNetTest()
        {
            // The notSoSimpleNet has 5 steps until finishing
            var allSteps = Runtime.allSteps(SampleNets.notSoSimpleNet);

            Assert.Equal(5, allSteps.Count());

            // The last state of the net should be of 3 places marked, p2 with
            // 1`() and p4 & p5 with 3`()
            var lastState        = allSteps.ElementAt(allSteps.Count() - 1);
            var lastStateMarking = CPNModule.netMarking(lastState);

            Assert.Equal(3, lastStateMarking.Count());

            // The marking of p2, p4 and p5 is emulated here
            var p2 = new Tuple <PlaceId, string>(PlaceId.NewP(2), "1`()");
            var p4 = new Tuple <PlaceId, string>(PlaceId.NewP(4), "3`()");
            var p5 = new Tuple <PlaceId, string>(PlaceId.NewP(5), "3`()");

            Assert.Equal(p2, lastStateMarking.ElementAt(0));
            Assert.Equal(p4, lastStateMarking.ElementAt(1));
            Assert.Equal(p5, lastStateMarking.ElementAt(2));

            // Given that F# is more succint and C# asserting of this data types
            // is really verbose, we could also check converting it to a string
            // for a shorter version.
            Assert.Equal("[(P 2, 1`()); (P 4, 3`()); (P 5, 3`())]",
                         lastStateMarking.ToString());
        }
Beispiel #2
0
 public DBObject GetDBObject()
 {
     if (PlaceId.IsValidEx())
     {
         return(PlaceId.Open(OpenMode.ForWrite, false, true) as Polyline);
     }
     return(null);
 }
 public override int GetHashCode()
 {
     unchecked {
         const int randomPrime = 397;
         int       hashCode    = Id.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ PlaceId.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ SynonymPlaceId.GetHashCode();
         return(hashCode);
     }
 }
        public override bool Equals(object o)
        {
            if (!(o is AddressAutocompletePrediction p))
            {
                return(false);
            }

            return(PlaceId != null && PlaceId.Equals(p.PlaceId) &&
                   PrimaryText != null && PrimaryText.Equals(p.PrimaryText) &&
                   SecondaryText != null && SecondaryText.Equals(p.SecondaryText));
        }
Beispiel #5
0
 /// <summary>
 /// Удаление площадки - очистка словаря и удаление визуализации
 /// </summary>
 public void Delete()
 {
     if (PlaceId.IsValidEx())
     {
         // Удаление словаря
         using (PlaceModel.Model.Doc.LockDocument())
         {
             this.DeleteDboDict();
         }
     }
     Dispose();
 }
Beispiel #6
0
 /// <summary>
 /// Gets the core filter from this model.
 /// </summary>
 /// <returns>Filter.</returns>
 public ActFilter GetFilter(ITextFilter filter)
 {
     return(new ActFilter
     {
         PageNumber = PageNumber,
         PageSize = PageSize,
         ArchiveId = ArchiveId.GetValueOrDefault(),
         BookId = BookId.GetValueOrDefault(),
         BookYearMin = BookYearMin.GetValueOrDefault(),
         BookYearMax = BookYearMax.GetValueOrDefault(),
         Description = filter.Apply(Description),
         ActTypeId = ActTypeId.GetValueOrDefault(),
         FamilyId = FamilyId.GetValueOrDefault(),
         CompanyId = CompanyId.GetValueOrDefault(),
         PlaceId = PlaceId.GetValueOrDefault(),
         Label = filter.Apply(Label),
         CategoryIds = ParseIds(CategoryIds),
         ProfessionIds = ParseIds(ProfessionIds),
         PartnerIds = ParseIds(PartnerIds)
     });
 }
Beispiel #7
0
 public override string ToString()
 {
     return(PlaceId.ToString());
 }
Beispiel #8
0
 /// <summary>
 /// Показать площадку на чертеже
 /// </summary>
 public void Show()
 {
     PlaceId.ShowEnt();
 }
Beispiel #9
0
 public override int GetHashCode()
 {
     return(string.IsNullOrWhiteSpace(PlaceId) ? base.GetHashCode() : PlaceId.GetHashCode());
 }
 public override int GetHashCode()
 => (PlaceId == null ? 0 : PlaceId.GetHashCode()) ^ (PrimaryText == null ? 0 : PrimaryText.GetHashCode()) ^ (SecondaryText == null ? 0 : SecondaryText.GetHashCode());