Exemplo n.º 1
0
 public static OneOrTwoUnitBuilder Get(
     BasicPeriodBuilderFactory.Settings settings_0)
 {
     if (settings_0 == null)
     {
         return(null);
     }
     return(new OneOrTwoUnitBuilder(settings_0));
 }
Exemplo n.º 2
0
 public static MultiUnitBuilder Get(int nPeriods_0,
                                    BasicPeriodBuilderFactory.Settings settings_1)
 {
     if (nPeriods_0 > 0 && settings_1 != null)
     {
         return(new MultiUnitBuilder(nPeriods_0, settings_1));
     }
     return(null);
 }
Exemplo n.º 3
0
 public static FixedUnitBuilder Get(TimeUnit unit_0,
                                    BasicPeriodBuilderFactory.Settings settings_1)
 {
     if (settings_1 != null &&
         (settings_1.EffectiveSet() & (1 << unit_0.ordinal)) != 0)
     {
         return(new FixedUnitBuilder(unit_0, settings_1));
     }
     return(null);
 }
Exemplo n.º 4
0
 internal BasicPeriodBuilderFactory.Settings  SetAllowMilliseconds(bool useMilliseconds_0)
 {
     if (this.useMilliseconds == useMilliseconds_0)
     {
         return(this);
     }
     BasicPeriodBuilderFactory.Settings result = (inUse) ? Copy() : this;
     result.useMilliseconds = useMilliseconds_0;
     return(result);
 }
Exemplo n.º 5
0
 internal BasicPeriodBuilderFactory.Settings  SetWeeksAloneOnly(bool weeksAlone)
 {
     if (this.weeksAloneOnly == weeksAlone)
     {
         return(this);
     }
     BasicPeriodBuilderFactory.Settings result = (inUse) ? Copy() : this;
     result.weeksAloneOnly = weeksAlone;
     return(result);
 }
Exemplo n.º 6
0
 internal BasicPeriodBuilderFactory.Settings  SetAllowZero(bool allow)
 {
     if (this.allowZero == allow)
     {
         return(this);
     }
     BasicPeriodBuilderFactory.Settings result = (inUse) ? Copy() : this;
     result.allowZero = allow;
     return(result);
 }
Exemplo n.º 7
0
 public virtual PeriodBuilder WithLocale(String localeName)
 {
     BasicPeriodBuilderFactory.Settings newSettings = settings
                                                      .SetLocale(localeName);
     if (newSettings != settings)
     {
         return(WithSettings(newSettings));
     }
     return(this);
 }
Exemplo n.º 8
0
            internal BasicPeriodBuilderFactory.Settings  SetMinLimit(float minLimit_0)
            {
                int val = (minLimit_0 <= 0) ? 0 : (int)(minLimit_0 * 1000);

                if (minLimit_0 == val)
                {
                    return(this);
                }
                BasicPeriodBuilderFactory.Settings result = (inUse) ? Copy() : this;
                result.minLimit = val;
                return(result);
            }
Exemplo n.º 9
0
 public BasicPeriodBuilderFactory.Settings  Copy()
 {
     BasicPeriodBuilderFactory.Settings result = new BasicPeriodBuilderFactory.Settings(outer_BasicPeriodBuilderFactory);
     result.inUse           = inUse;
     result.uset            = uset;
     result.maxUnit         = maxUnit;
     result.minUnit         = minUnit;
     result.maxLimit        = maxLimit;
     result.minLimit        = minLimit;
     result.allowZero       = allowZero;
     result.weeksAloneOnly  = weeksAloneOnly;
     result.useMilliseconds = useMilliseconds;
     return(result);
 }
Exemplo n.º 10
0
        public virtual PeriodBuilderFactory SetUnitIsAvailable(TimeUnit unit,
                                                               bool available)
        {
            int uset_0 = settings.uset;

            if (available)
            {
                uset_0 |= 1 << unit.ordinal;
            }
            else
            {
                uset_0 &= ~(1 << unit.ordinal);
            }
            settings = settings.SetUnits(uset_0);
            return(this);
        }
Exemplo n.º 11
0
        public virtual PeriodBuilderFactory SetAvailableUnitRange(TimeUnit minUnit_0,
                                                                  TimeUnit maxUnit_1)
        {
            int uset_2 = 0;

            for (int i = maxUnit_1.ordinal; i <= minUnit_0.ordinal; ++i)
            {
                uset_2 |= 1 << i;
            }
            if (uset_2 == 0)
            {
                throw new ArgumentException("range " + minUnit_0 + " to "
                                            + maxUnit_1 + " is empty");
            }
            settings = settings.SetUnits(uset_2);
            return(this);
        }
Exemplo n.º 12
0
            internal BasicPeriodBuilderFactory.Settings  SetUnits(int uset_0)
            {
                if (this.uset == uset_0)
                {
                    return(this);
                }
                BasicPeriodBuilderFactory.Settings result = (inUse) ? Copy() : this;

                result.uset = (short)uset_0;

                if ((uset_0 & IBM.ICU.Impl.Duration.BasicPeriodBuilderFactory.allBits) == IBM.ICU.Impl.Duration.BasicPeriodBuilderFactory.allBits)
                {
                    result.uset    = IBM.ICU.Impl.Duration.BasicPeriodBuilderFactory.allBits;
                    result.maxUnit = IBM.ICU.Impl.Duration.TimeUnit.YEAR;
                    result.minUnit = IBM.ICU.Impl.Duration.TimeUnit.MILLISECOND;
                }
                else
                {
                    int lastUnit = -1;
                    for (int i = 0; i < TimeUnit.units.Length; ++i)
                    {
                        if (0 != (uset_0 & (1 << i)))
                        {
                            if (lastUnit == -1)
                            {
                                result.maxUnit = IBM.ICU.Impl.Duration.TimeUnit.units[i];
                            }
                            lastUnit = i;
                        }
                    }
                    if (lastUnit == -1)
                    {
                        // currently empty, but this might be transient so no fail
                        result.minUnit = result.maxUnit = null;
                    }
                    else
                    {
                        result.minUnit = IBM.ICU.Impl.Duration.TimeUnit.units[lastUnit];
                    }
                }

                return(result);
            }
Exemplo n.º 13
0
 internal MultiUnitBuilder(int nPeriods_0, BasicPeriodBuilderFactory.Settings settings_1) : base(settings_1)
 {
     this.nPeriods = nPeriods_0;
 }
Exemplo n.º 14
0
 protected internal override PeriodBuilder WithSettings(
     BasicPeriodBuilderFactory.Settings settings_0)
 {
     return(OneOrTwoUnitBuilder.Get(settings_0));
 }
Exemplo n.º 15
0
 internal SingleUnitBuilder(BasicPeriodBuilderFactory.Settings settings_0) : base(settings_0)
 {
 }
Exemplo n.º 16
0
 internal OneOrTwoUnitBuilder(BasicPeriodBuilderFactory.Settings settings_0) : base(settings_0)
 {
 }
Exemplo n.º 17
0
 public virtual PeriodBuilderFactory SetWeeksAloneOnly(bool aloneOnly)
 {
     settings = settings.SetWeeksAloneOnly(aloneOnly);
     return(this);
 }
Exemplo n.º 18
0
 protected internal override PeriodBuilder WithSettings(
     BasicPeriodBuilderFactory.Settings settings_0)
 {
     return(Get(unit, settings_0));
 }
Exemplo n.º 19
0
 protected internal PeriodBuilderImpl(BasicPeriodBuilderFactory.Settings settings_0)
 {
     this.settings = settings_0;
 }
Exemplo n.º 20
0
 protected internal override PeriodBuilder WithSettings(
     BasicPeriodBuilderFactory.Settings settings_0)
 {
     return(MultiUnitBuilder.Get(nPeriods, settings_0));
 }
Exemplo n.º 21
0
 protected abstract internal PeriodBuilder WithSettings(
     BasicPeriodBuilderFactory.Settings settings_0);
Exemplo n.º 22
0
 public virtual PeriodBuilderFactory SetMinLimit(float minLimit_0)
 {
     settings = settings.SetMinLimit(minLimit_0);
     return(this);
 }
Exemplo n.º 23
0
 internal BasicPeriodBuilderFactory(PeriodFormatterDataService ds_0)
 {
     this.ds       = ds_0;
     this.settings = new BasicPeriodBuilderFactory.Settings(this);
 }
Exemplo n.º 24
0
 public virtual PeriodBuilderFactory SetLocale(String localeName)
 {
     settings = settings.SetLocale(localeName);
     return(this);
 }
Exemplo n.º 25
0
 public PeriodBuilderFactory SetAllowMilliseconds(bool useMilliseconds_0)
 {
     settings = settings.SetAllowMilliseconds(useMilliseconds_0);
     return(this);
 }
Exemplo n.º 26
0
 internal FixedUnitBuilder(TimeUnit unit_0, BasicPeriodBuilderFactory.Settings settings_1) : base(settings_1)
 {
     this.unit = unit_0;
 }
Exemplo n.º 27
0
 public virtual PeriodBuilderFactory SetAllowZero(bool allow)
 {
     settings = settings.SetAllowZero(allow);
     return(this);
 }