Beispiel #1
0
        /// <summary>
        /// Default implementation of <see cref="IsInformationSourceCredible"/> based on &quot;Aguilar/Spinelli test&quot;
        /// </summary>
        protected virtual bool DefaultIsInformationSourceCredible(ILegalPerson lp)
        {
            //assume the case when there is an actual warrant
            if (lp is IJudge)
            {
                AddReasonEntry($"{lp.GetLegalPersonTypeName()} {lp.Name}, is type {nameof(IJudge)}");
                return(true);
            }

            if (lp is ILawEnforcement)
            {
                AddReasonEntry($"{lp.GetLegalPersonTypeName()} {lp.Name}, is type {nameof(ILawEnforcement)}");
                return(true);
            }

            var informant = lp as IInformant;

            if (informant == null)
            {
                AddReasonEntry($"{lp.GetLegalPersonTypeName()} {lp.Name}, is not " +
                               $"of type {nameof(ILawEnforcement)} nor {nameof(IInformant)}");
                return(false);
            }

            return(informant.IsInformationSufficientlyReliable && informant.IsPersonSufficientlyCredible);
        }
Beispiel #2
0
        public static bool IsDateOfServiceValid(IProcessService serviceOfProcess, ILegalPerson person, out DateTime?dtOfService)
        {
            dtOfService = null;
            if (person == null)
            {
                return(false);
            }

            var defendantTitle = person.GetLegalPersonTypeName();

            dtOfService = serviceOfProcess.GetToDateOfService(person);

            if (dtOfService == null)
            {
                serviceOfProcess.AddReasonEntry($"{defendantTitle} {person.Name}, {nameof(GetToDateOfService)} returned nothing");
                return(false);
            }

            if (dtOfService.Value < new DateTime(1776, 7, 4)) //close enough
            {
                serviceOfProcess.AddReasonEntry($"{defendantTitle} {person.Name}, {nameof(GetToDateOfService)} " +
                                                $"returned invalid value of {dtOfService.Value}");
                return(false);
            }

            return(true);
        }
        public override decimal Calculate(ILegalPerson subj)
        {
            if (subj == null)
            {
                return(0m);
            }

            var title = subj.GetLegalPersonTypeName();

            if (IsMorallyWrong(subj))
            {
                AddReasonEntry($"{title} {subj.Name}, {nameof(IsMorallyWrong)} is true");
                return(-1m);
            }

            if (IsNegateExistingDuty(subj))
            {
                AddReasonEntry($"{title} {subj.Name}, {nameof(IsNegateExistingDuty)} is true");
                return(0m);
            }

            var lhfCalc = base.Calculate(subj);

            var methodCost = GetCostOfMethodology(subj);

            AddReasonEntry($"{title} {subj.Name}, {nameof(GetCostOfMethodology)} is {methodCost}");

            var result = lhfCalc - methodCost;

            return(result);
        }
Beispiel #4
0
        protected internal virtual bool IsVirtualContactConnectedToInjuryLocation(ILegalPerson defendant, ILegalPerson plaintiff,
                                                                                  string defendantTitle = null, string plaintiffTitle = null)
        {
            defendantTitle = defendantTitle ?? defendant.GetLegalPersonTypeName();
            plaintiffTitle = plaintiffTitle ?? plaintiff.GetLegalPersonTypeName();

            var injuryLocation = GetInjuryLocation(plaintiff);

            if (injuryLocation == null)
            {
                AddReasonEntry($"{plaintiffTitle} {plaintiff.Name}, {nameof(GetInjuryLocation)} returned nothing");
                return(false);
            }

            foreach (var voca in GetActiveVirtualContactLocation(defendant) ?? new IVoca[] { })
            {
                //defendant has active virtual contact here and it has a meaningful connection to plaintiff's claim
                var isVirtuallyEngaged = NamesEqual(Court, voca) && NamesEqual(Court, injuryLocation);
                if (!isVirtuallyEngaged)
                {
                    continue;
                }

                AddReasonEntry($"{plaintiffTitle} {plaintiff.Name}, {nameof(GetInjuryLocation)} returned '{injuryLocation.Name}'");
                AddReasonEntry($"'{injuryLocation.Name}' & {nameof(Court)} '{Court.Name}', {nameof(NamesEqual)} is true");
                AddReasonEntry($"{defendantTitle} {defendant.Name}, {nameof(GetActiveVirtualContactLocation)} returned '{voca.Name}'");
                AddReasonEntry($"'{voca.Name}' & {nameof(Court)} '{Court.Name}', {nameof(NamesEqual)} is true");
                return(true);
            }

            return(false);
        }
Beispiel #5
0
        public virtual decimal Calculate(ILegalPerson subj)
        {
            if (subj == null)
            {
                return(0m);
            }

            var title = subj.GetLegalPersonTypeName();

            var burden = GetCostOfPrecaution(subj);

            AddReasonEntry($"{title} {subj.Name}, {nameof(GetCostOfPrecaution)} is {burden}");

            var probability = GetRiskOfLoss(subj);

            AddReasonEntry($"{title} {subj.Name}, {nameof(GetRiskOfLoss)} is {probability}");

            var injury = GetCostOfLoss(subj);

            AddReasonEntry($"{title} {subj.Name}, {nameof(GetCostOfLoss)} is {injury}");

            var result = (double)burden - (probability * (double)injury);

            return(Convert.ToDecimal(result));
        }
Beispiel #6
0
        /// <summary>
        /// One of two ways in which an amendment is valid, depends on being
        /// filed in some limited timespan after service of process
        /// </summary>
        protected internal virtual bool IsValidAsMatterOfCourse(ILegalPerson[] persons, ILegalPerson subjectPerson)
        {
            var title = subjectPerson.GetLegalPersonTypeName();

            var serviceOfProcess = GetServiceOfProcess(subjectPerson);

            if (serviceOfProcess == null)
            {
                AddReasonEntry($"{title} {subjectPerson.Name}, {nameof(GetServiceOfProcess)} returned nothing");
                return(false);
            }

            if (!ProcessServiceBase.IsDateOfServiceValid(serviceOfProcess, subjectPerson, out var serviceDate))
            {
                AddReasonEntryRange(serviceOfProcess.GetReasonEntries());
                return(false);
            }

            var currentTime = CurrentTime ?? DateTime.UtcNow;

            var allowedTimeSpan = AllowedTimeSpanAfterServing(subjectPerson);
            var actualTimeSpan  = currentTime - serviceDate;

            if (actualTimeSpan > allowedTimeSpan)
            {
                AddReasonEntry($"{title} {subjectPerson.Name}, {nameof(AllowedTimeSpanAfterServing)} " +
                               $"is {allowedTimeSpan} is less-than actual of {actualTimeSpan}");
                return(false);
            }

            return(true);
        }
        protected internal virtual bool IsDiversityInDomicileLocations(ILegalPerson defendant, ILegalPerson plaintiff,
                                                                       string defendantTitle = null, string plaintiffTitle = null)
        {
            defendantTitle = defendantTitle ?? defendant.GetLegalPersonTypeName();
            plaintiffTitle = plaintiffTitle ?? plaintiff.GetLegalPersonTypeName();

            var plaintiffHome = GetDomicileLocation(plaintiff);

            if (plaintiffHome == null)
            {
                AddReasonEntry($"{plaintiffTitle} {plaintiff.Name}, " +
                               $"{nameof(GetDomicileLocation)} returned nothing");
                return(false);
            }

            var defendantHome = GetDomicileLocation(defendant);

            if (defendantHome == null)
            {
                AddReasonEntry($"{defendantTitle} {defendant.Name}, " +
                               $"{nameof(GetDomicileLocation)} returned nothing");
                return(false);
            }

            if (NamesEqual(plaintiffHome, defendantHome))
            {
                AddReasonEntry($"{defendantTitle} {defendant.Name}, {nameof(GetDomicileLocation)} returned '{defendantHome.Name}'");
                AddReasonEntry($"{plaintiffTitle} {plaintiff.Name}, {nameof(GetDomicileLocation)} returned '{plaintiffHome.Name}'");
                AddReasonEntry($"'{defendantHome.Name}' & '{plaintiffHome.Name}', {nameof(NamesEqual)} is true");
                return(false);
            }

            return(true);
        }
        protected override bool DefaultIsInformationSourceCredible(ILegalPerson lp)
        {
            if (lp is ILawEnforcement)
            {
                AddReasonEntry($"{lp.GetLegalPersonTypeName()} {lp.Name}, is type {nameof(ILawEnforcement)}");
                return(true);
            }

            var informant = lp as IInformant;

            if (informant == null)
            {
                AddReasonEntry($"{lp.GetLegalPersonTypeName()} {lp.Name}, is not " +
                               $"of type {nameof(ILawEnforcement)} nor {nameof(IInformant)}");
                return(false);
            }

            return(informant.IsInformationSufficientlyReliable);
        }
        protected Trademark GetDefendantProperty(ILegalPerson subj)
        {
            var title             = subj.GetLegalPersonTypeName();
            var defendantProperty = GetChoice(subj);

            if (defendantProperty == null)
            {
                AddReasonEntry($"{title} {subj.Name}, {nameof(GetChoice)} did not return a {nameof(Trademark)}");
                return(null);
            }

            return(defendantProperty);
        }
        protected virtual Trademark GetPlaintiffProperty(ILegalPerson plaintiff)
        {
            var pTitle            = plaintiff.GetLegalPersonTypeName();
            var plaintiffProperty = GetChoice(plaintiff);

            if (plaintiffProperty == null)
            {
                AddReasonEntry($"{pTitle} {plaintiff.Name}, {nameof(GetChoice)}  did not return a {nameof(Trademark)}");
                return(null);
            }

            return(plaintiffProperty);
        }
        protected internal virtual int GetContributionWithReasonEntry(ILegalPerson person)
        {
            if (person == null)
            {
                return(0);
            }

            var contribution = GetContribution(person)?.GetRank() ?? 0;

            AddReasonEntry($"{person.GetLegalPersonTypeName()} {person.Name}, " +
                           $"{nameof(GetContribution)} {nameof(IRankable.GetRank)} " +
                           $"return value of {contribution}");

            return(contribution);
        }
Beispiel #12
0
        protected internal bool ValidatePredicate(ILegalPerson lp, Predicate <ILegalPerson> p, string nameofP)
        {
            if (lp == null || p == null)
            {
                return(false);
            }

            if (!p(lp))
            {
                var title = lp.GetLegalPersonTypeName();
                AddReasonEntry($"{title} {lp.Name} {nameofP} is false");
                return(false);
            }

            return(true);
        }
        protected internal virtual bool IsEitherPartyForeigner(ILegalPerson defendant, ILegalPerson plaintiff,
                                                               string defendantTitle = null, string plaintiffTitle = null)
        {
            defendantTitle = defendantTitle ?? defendant.GetLegalPersonTypeName();
            plaintiffTitle = plaintiffTitle ?? plaintiff.GetLegalPersonTypeName();

            if (defendant is IForeigner)
            {
                AddReasonEntry($"{defendantTitle} {defendant.Name}, is type {nameof(IForeigner)}");
                return(true);
            }

            if (plaintiff is IForeigner)
            {
                AddReasonEntry($"{plaintiffTitle} {plaintiff.Name}, is type {nameof(IForeigner)}");
                return(true);
            }

            return(false);
        }
        protected internal virtual bool IsMinimumClaimSufficient(ILegalPerson plaintiff, string plaintiffTitle = null)
        {
            plaintiffTitle = plaintiffTitle ?? plaintiff.GetLegalPersonTypeName();

            var plaintiffClaim = GetInjuryClaimDollars(plaintiff);

            var currentTime = CurrentTime ?? DateTime.UtcNow;

            var currentMin = GetMinimumClaimDollars(currentTime);

            if (plaintiffClaim < currentMin)
            {
                AddReasonEntry($"{plaintiffTitle} {plaintiff.Name}, {nameof(GetInjuryClaimDollars)} returned ${plaintiffClaim}");
                AddReasonEntry($"{nameof(GetMinimumClaimDollars)} at {currentTime} returned ${currentMin}");
                AddReasonEntry($"${plaintiffClaim} is less than ${currentMin}");
                return(false);
            }

            return(true);
        }
Beispiel #15
0
        protected internal virtual bool TryGetCauseOfAction(ILegalPerson legalPerson, out ILegalConcept causeOfAction, bool addReason = true)
        {
            causeOfAction = null;

            if (legalPerson == null)
            {
                return(false);
            }

            causeOfAction = GetAssertion(legalPerson);

            var title = legalPerson.GetLegalPersonTypeName();

            if (causeOfAction == null && addReason)
            {
                AddReasonEntry($"{title} {legalPerson.Name}, {nameof(GetAssertion)} returned nothing");
                return(false);
            }

            return(true);
        }
Beispiel #16
0
        public static bool PropertyOwnerIsSubjectPerson(this IRationale lc, ILegalProperty property, ILegalPerson person)
        {
            if (person == null)
            {
                return(false);
            }
            var title = person.GetLegalPersonTypeName();

            if (property == null)
            {
                lc.AddReasonEntry($"{title} {person.Name}, {nameof(property)} is unassigned");
                return(false);
            }

            var isOwner = property.IsEntitledTo != null && property.IsEntitledTo(person);
            var isIsNot = isOwner ? "is owner" : "is not owner";

            lc.AddReasonEntry(
                $"{title} {person.Name}, {isIsNot} " +
                $"of {property.GetType().Name} " +
                $"named '{property.Name}'");

            return(isOwner);
        }
Beispiel #17
0
        public static bool PropertyOwnerIsInPossession(this IRationale lc, ILegalProperty SubjectProperty, ILegalPerson subj)
        {
            if (subj == null)
            {
                return(false);
            }
            var title = subj.GetLegalPersonTypeName();

            if (SubjectProperty == null)
            {
                lc.AddReasonEntry($"{title} {subj.Name}, {nameof(SubjectProperty)} is unassigned");
                return(false);
            }

            var hasPossession = SubjectProperty.IsInPossessionOf != null && SubjectProperty.IsInPossessionOf(subj);
            var isIsNot       = hasPossession ? "is in possession" : "is not in possession";

            lc.AddReasonEntry(
                $"{title} {subj.Name}, {isIsNot} " +
                $"of {SubjectProperty.GetType().Name} " +
                $"named '{SubjectProperty.Name}'");

            return(hasPossession);
        }