Exemplo n.º 1
0
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 3575610:         // type
                    this.type = (EtdExpiryType)newValue;
                    break;

                case 1792248507:         // dateCode
                    this.dateCode = (int?)newValue;
                    break;

                case -295448573:         // settlementType
                    this.settlementType = (EtdSettlementType)newValue;
                    break;

                case 1373587791:         // optionType
                    this.optionType = (EtdOptionType)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ImmutableConstructor private EtdVariant(EtdExpiryType type, System.Nullable<int> dateCode, EtdSettlementType settlementType, EtdOptionType optionType)
        private EtdVariant(EtdExpiryType type, int?dateCode, EtdSettlementType settlementType, EtdOptionType optionType)
        {
            this.type           = ArgChecker.notNull(type, "type");
            this.dateCode       = dateCode;
            this.settlementType = settlementType;
            this.optionType     = optionType;
            if (type == EtdExpiryType.MONTHLY)
            {
                ArgChecker.isTrue(dateCode == null, "Monthly variant must have no dateCode");
                ArgChecker.isTrue(settlementType == null, "Monthly variant must have no settlementType");
                ArgChecker.isTrue(optionType == null, "Monthly variant must have no optionType");
                this.code = "";
            }
            else if (type == EtdExpiryType.WEEKLY)
            {
                ArgChecker.notNull(dateCode, "dateCode");
                ArgChecker.isTrue(dateCode >= 1 && dateCode <= 5, "Week must be from 1 to 5");
                ArgChecker.isTrue(settlementType == null, "Weekly variant must have no settlementType");
                ArgChecker.isTrue(optionType == null, "Weekly variant must have no optionType");
                this.code = "W" + dateCode;
            }
            else
            {     // DAILY and Flex
                ArgChecker.notNull(dateCode, "dateCode");
                ArgChecker.isTrue(dateCode >= 1 && dateCode <= 31, "Day-of-week must be from 1 to 31");
                ArgChecker.isFalse(settlementType == null && optionType != null, "Flex Option must have both settlementType and optionType");
                string dateCodeStr    = dateCode < 10 ? "0" + dateCode : Convert.ToString(dateCode);
                string settlementCode = settlementType != null ? settlementType.Code : "";
                string optionCode     = optionType != null ? optionType.Code : "";
                this.code = dateCodeStr + settlementCode + optionCode;
            }
        }
Exemplo n.º 3
0
 public virtual void test_of_lookup_null()
 {
     assertThrows(() => EtdSettlementType.of(null), typeof(System.ArgumentException));
 }
Exemplo n.º 4
0
 public virtual void test_of_lookup_notFound()
 {
     assertThrows(() => EtdSettlementType.of("Rubbish"), typeof(System.ArgumentException));
 }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "name") public void test_of_lookup(EtdSettlementType convention, String name)
        public virtual void test_of_lookup(EtdSettlementType convention, string name)
        {
            assertEquals(EtdSettlementType.of(name), convention);
        }
Exemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "name") public void test_toString(EtdSettlementType convention, String name)
        public virtual void test_toString(EtdSettlementType convention, string name)
        {
            assertEquals(convention.ToString(), name);
        }
Exemplo n.º 7
0
 /// <summary>
 /// The standard monthly ETD.
 /// </summary>
 /// <param name="dayOfMonth">  the day-of-month </param>
 /// <param name="settlementType">  the settlement type </param>
 /// <param name="optionType">  the option type </param>
 /// <returns> the variant </returns>
 public static EtdVariant ofFlexOption(int dayOfMonth, EtdSettlementType settlementType, EtdOptionType optionType)
 {
     return(new EtdVariant(EtdExpiryType.DAILY, dayOfMonth, settlementType, optionType));
 }
Exemplo n.º 8
0
 /// <summary>
 /// The standard monthly ETD.
 /// </summary>
 /// <param name="dayOfMonth">  the day-of-month </param>
 /// <param name="settlementType">  the settlement type </param>
 /// <returns> the variant </returns>
 public static EtdVariant ofFlexFuture(int dayOfMonth, EtdSettlementType settlementType)
 {
     return(new EtdVariant(EtdExpiryType.DAILY, dayOfMonth, settlementType, null));
 }