Beispiel #1
0
        public static bool TryGetOppositionPerson(this ILinkedLegalConcept llc, ILegalPerson[] persons, ILegalPerson subjectPerson,
                                                  out ILegalPerson person)
        {
            person = null;
            if (subjectPerson == null || llc == null)
            {
                return(false);
            }

            var personsLessSubj = GetPersonsLessThisOne(llc, persons, subjectPerson);

            if (personsLessSubj == null || !personsLessSubj.Any())
            {
                return(false);
            }

            if (subjectPerson is IPlaintiff)
            {
                person = llc.Defendant(personsLessSubj);
            }
            if (subjectPerson is IDefendant)
            {
                person = llc.Plaintiff(personsLessSubj);
            }

            return(person != null);
        }
Beispiel #2
0
        public virtual bool IsFraudulent(ILegalPerson lp)
        {
            if (!IsAssertionToInduceAssent(lp))
            {
                return(false);
            }

            AddReasonEntry($"{lp?.Name} intends his/her assertion to " +
                           "induce a party to manifest assent");
            if (IsNotAssertionInAccord2Facts(lp))
            {
                AddReasonEntry($"and, {lp?.Name} knows or believes that the " +
                               "assertion is not in accord with the facts");
                return(true);
            }
            if (IsNotAssertionInConfidence2Truth(lp))
            {
                AddReasonEntry($"and, {lp?.Name} does not have the confidence " +
                               "that he/she states or implies in the truth of the assertion");
                return(true);
            }
            if (IsNotAssertionInBasis2ImpliedStatement(lp))
            {
                AddReasonEntry($"and, {lp?.Name} knows that he/she does not have " +
                               "the basis that he/she states or implies for the assertion");
                return(true);
            }

            return(false);
        }
Beispiel #3
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 #4
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 #6
0
        protected internal bool IsImproperByOne(ILegalPerson lp)
        {
            if (IsCrimeOrTort(lp))
            {
                AddReasonEntry($"{lp?.Name} is threatened with a crime or tort");
                return(true);
            }

            if (IsProsecutionAsCriminal(lp))
            {
                AddReasonEntry($"{lp?.Name} is threatened with criminal prosecution");
                return(true);
            }

            if (IsUseCivilProcessInBadFaith(lp))
            {
                AddReasonEntry($"{lp?.Name} is threatened with use of civil process in bad faith");
                return(true);
            }

            if (IsBreachOfGoodFaithDuty(lp))
            {
                AddReasonEntry($"{lp?.Name} is threatened with breach of duty in good faith");
                return(true);
            }

            return(false);
        }
Beispiel #7
0
        /// <summary>
        /// <![CDATA[Restatement (Second) of Contracts § 176(2)]]>
        /// </summary>
        protected internal bool IsImproperByTwo(ILegalPerson lp)
        {
            if (!IsUnfairTerms(lp))
            {
                return(false);
            }

            AddReasonEntry("the resulting exchange is not on fair terms");

            if (IsAllHarmNoBenefit(lp))
            {
                AddReasonEntry($"threatened act would harm the {lp?.Name} and " +
                               "would not significantly benefit the party making the threat");
                return(true);
            }

            if (IsSignificantViaPriorUnfairDeal(lp))
            {
                AddReasonEntry($"the effectiveness of the threat in inducing {lp?.Name}'s " +
                               "assent is significant by prior unfair dealing " +
                               "with the party");
                return(true);
            }

            if (IsUsePowerIllegitimateEnds(lp))
            {
                AddReasonEntry($"{lp.Name} is threatened with a use of power for " +
                               "illegitimate ends");
                return(true);
            }

            return(false);
        }
Beispiel #8
0
        /// <summary>
        /// Gets the symmetric difference of the terms between offeror and offeree
        /// </summary>
        public static ISet <Term <object> > GetAdditionalTerms(this IAssentTerms lc, ILegalPerson offeror,
                                                               ILegalPerson offeree)
        {
            if (lc == null)
            {
                return(new HashSet <Term <object> >());
            }

            var sorTerms = lc.TermsOfAgreement?.Invoke(offeror);

            if (sorTerms == null || !sorTerms.Any())
            {
                lc.AddReasonEntry($"{offeror.Name} has no terms");
                return(new HashSet <Term <object> >());
            }

            var seeTerms = lc.TermsOfAgreement(offeree);

            if (seeTerms == null || !seeTerms.Any())
            {
                lc.AddReasonEntry($"{offeree.Name} has no terms");
                return(new HashSet <Term <object> >());
            }
            var additionalTerms = Term <object> .GetAdditionalTerms(sorTerms, seeTerms);

            if (!additionalTerms.Any())
            {
                lc.AddReasonEntry("there are no additional terms between " +
                                  $" {offeror.Name} and {offeree.Name}");
            }
            return(additionalTerms);
        }
        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);
        }
Beispiel #10
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 #11
0
        /// <summary>
        /// Get the lower calculated value of two
        /// </summary>
        /// <param name="lp"></param>
        /// <returns></returns>
        protected internal override decimal CalcMoneyRemedy(ILegalPerson lp)
        {
            var dimVal  = CalcDiminutionInValue(lp);
            var perfVal = CalcPerformanceCost(lp);

            return(new[] { dimVal, perfVal }.Where(v => v > 0m).Min());
        }
Beispiel #12
0
        public static bool IsFactual(ILegalPerson lp)
        {
            var melissa = lp as MelissaEg2;

            if (melissa == null)
            {
                return(false);
            }
            return(!melissa.IsDogPresent);
        }
        public static bool IsAbandon(ILegalPerson lp)
        {
            var melissa = lp as MelissaEg3;

            if (melissa == null)
            {
                return(false);
            }
            return(melissa.IsAwwedOverByPuppy);
        }
Beispiel #14
0
        public static bool IsPremeditated(ILegalPerson lp)
        {
            var joannie = lp as JoanniePremedEg;

            if (joannie == null)
            {
                return(false);
            }
            return(joannie.IsDeliberate || joannie.IsPlanned || joannie.IsSpecificIntent);
        }
Beispiel #15
0
        public static bool IsLegal(ILegalPerson lp)
        {
            var melissa = lp as MelissaEg2;

            if (melissa == null)
            {
                return(false);
            }
            return(melissa.ItActuallyIsRatThatsBarking && melissa.IsRatAPest);
        }
Beispiel #16
0
        public static bool IsSolicitationToTraffic(ILegalPerson lp)
        {
            var pinson = lp as Pinson;

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

            return(!pinson.IsBuyer);
        }
Beispiel #17
0
 public static string GetSolicitation(ILegalPerson lp)
 {
     if (lp is Planter)
     {
         return("I'll do it");
     }
     if (lp is Government)
     {
         return("you do it");
     }
     return(null);
 }
Beispiel #18
0
        /// <summary>
        /// <![CDATA[
        /// Restatement (Second) of Contracts § 347 (a)+(b)-(c)-(limits)
        /// ]]>
        /// </summary>
        /// <param name="lp"></param>
        /// <returns></returns>
        private decimal GetSumByPerson(ILegalPerson lp)
        {
            var lpValue = CalcMoneyRemedy(lp)
                          + CalcLossOther(lp)
                          - CalcLossAvoided(lp)
                          - Limits.CalcMoneyRemedy(lp)
            ;

            lpValue = Rounding(lpValue);

            return(lpValue);
        }
Beispiel #19
0
        protected internal bool TestIsProportional(ILegalPerson defendant, ILegalPerson otherParty, T defendantContribution, T otherPartyContribution)
        {
            if (IsProportional(defendantContribution, otherPartyContribution))
            {
                return(true);
            }

            AddReasonEntry($"{nameof(IsProportional)} is false " +
                           $"for {defendant.Name}'s {defendantContribution.ToString()} " +
                           $"to {otherParty.Name}'s {otherPartyContribution.ToString()}");
            return(false);
        }
Beispiel #20
0
 public IVoca GetState(ILegalPerson lp)
 {
     if (lp is Austin)
     {
         return(new DomicileLocation("North Dakota", lps => lps.FirstOrDefault(l => l is Austin)));
     }
     if (lp is Healy)
     {
         return(new DomicileLocation("Minnesota", lps => lps.FirstOrDefault(l => l is Healy)));
     }
     return(null);
 }
 public int GetOrderCount(ILegalPerson lp)
 {
     if (lp is ComNetwork)
     {
         return(21);
     }
     if (lp is PurcellTire)
     {
         return(12);
     }
     return(0);
 }
        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);
        }
Beispiel #24
0
        public static bool IsJudyEgStealing(ILegalPerson lp)
        {
            var judy = lp as JudyEg;

            if (judy == null)
            {
                return(false);
            }
            return(judy.IsComm2Friends2Steal &&
                   judy.IsEnterBuildingAfterHours &&
                   judy.IsDeactivateSecurityCameras &&
                   judy.IsAttemptingEnterCombo
                   );
        }
Beispiel #25
0
        public static bool IsPremeditated(ILegalPerson lp)
        {
            var west = lp as West;

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

            return(west.IsConcealWeaponMeanPremeditation ||
                   west.IsPostEventCalmnessMeanPremeditation ||
                   west.IsWentBackToHouseMeanPremeditation
                   );
        }
        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 #27
0
        public static bool IsKevinRobbingArmoredCar(ILegalPerson lp)
        {
            var kevin = lp as KevinEg;

            if (kevin == null)
            {
                return(false);
            }
            return(kevin.IsCasingBank &&
                   kevin.IsWrittenPlan &&
                   kevin.IsCarryHiddenWeapon &&
                   kevin.IsWaitingInAlley &&
                   kevin.IsReachForDoor
                   );
        }
        public static bool IsSecondDegree(ILegalPerson lp)
        {
            var doug = lp as DougCrackheadEg;

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

            return(doug.IsInvolvedInAutoAccident &&
                   doug.IsDrunkDriving &&
                   doug.IsHighOnCrack &&
                   doug.IsTextDriving &&
                   doug.IsLeaveScene
                   );
        }
Beispiel #29
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);
        }
Beispiel #30
0
        public override ISet <Term <object> > GetAgreedTerms(ILegalPerson offeror, ILegalPerson offeree)
        {
            var agreedTerms = base.GetAgreedTerms(offeror, offeree);

            var offerorUqTerms = TermsOfAgreement(offeror).Where(t => agreedTerms.All(tt => !tt.EqualRefersTo(t))).ToList();
            var offereeUqTerms = TermsOfAgreement(offeree).Where(t => agreedTerms.All(tt => !tt.EqualRefersTo(t))).ToList();

            if (!offereeUqTerms.Any() && !offerorUqTerms.Any())
            {
                return(agreedTerms);
            }

            var isEitherExpresslyCond = offereeUqTerms.Any(t => ExpresslyConditionalTerm.Value.Equals(t)) ||
                                        offerorUqTerms.Any(t => ExpresslyConditionalTerm.Value.Equals(t));

            //terms of the same name but different meanings
            var knockoutTerms = offerorUqTerms
                                .Where(t => offereeUqTerms.Any(tt => t.Equals(tt) && !t.EqualRefersTo(tt))).ToList();

            if (knockoutTerms.Any())
            {
                foreach (var kn in knockoutTerms)
                {
                    AddReasonEntry($"the term-name '{kn.Name}' is used by both {offeror.Name} " +
                                   $"and {offeree.Name} with different semantic meanings, " +
                                   "so this term is 'knocked out'");
                }
                offerorUqTerms = offerorUqTerms.Where(t => knockoutTerms.Any(tt => !tt.Equals(t))).ToList();
                offereeUqTerms = offereeUqTerms.Where(t => knockoutTerms.Any(tt => !tt.Equals(t))).ToList();
            }

            //per UCC 2-207(1) additional terms become part of the contract when not expressly forbidden
            if (!isEitherExpresslyCond)
            {
                foreach (var offerorUqTerm in offerorUqTerms)
                {
                    agreedTerms.Add(offerorUqTerm);
                }

                foreach (var offereeUqTerm in offereeUqTerms)
                {
                    agreedTerms.Add(offereeUqTerm);
                }
            }
            return(agreedTerms);
        }