internal static int Compare(long thisLong0, long thisLong1, long thisLong2, long thisLong3, long thatLong0, long thatLong1, long thatLong2, long thatLong3) { int compare = Long.compare(thisLong0, thatLong0); if (compare == 0) { compare = Integer.compare(( int )thisLong1, ( int )thatLong1); if (compare == 0 && TimeZones.validZoneOffset(( int )thisLong3) && TimeZones.validZoneOffset(( int )thatLong3)) { // In the rare case of comparing the same instant in different time zones, we settle for // mapping to values and comparing using the general values comparator. compare = Values.COMPARATOR.Compare(AsValue(thisLong0, thisLong1, thisLong2, thisLong3), AsValue(thatLong0, thatLong1, thatLong2, thatLong3)); } } return(compare); }
public long getLongValue() { if (value is long) { return((long)value); } if (value is decimal) { return(((decimal)value).longValue()); } if (value is string) { return(Long.valueOf((string)value)); } throw new InvalidConversionException("This value cannot be converted to a Long: " + toStringPretty()); }
private Color ShadeColor(Color color, double percent) { var hex = $"#{(0xFFFFFF & color):6x}"; var f = Long.ParseLong(hex.Substring(1), 16); double t = percent < 0 ? 0 : 255; var p = percent < 0 ? percent * -1 : percent; var r = f >> 16; var g = f >> 8 & 0x00FF; var b = f & 0x0000FF; var alpha = Color.GetAlphaComponent(color); var red = (int)(Math.Round((t - r) * p) + r); var green = (int)(Math.Round((t - g) * p) + g); var blue = (int)(Math.Round((t - b) * p) + b); return(Color.Argb(alpha, red, green, blue)); }
private void validateChecksum(DataInputStream dis, bool flag) { if (!flag) { return; } int num = (int)this.calculatedCheckSum; int num2 = this.readInt(dis); if (num2 != num) { string text = new StringBuilder().append("Invalid checksum ").append(Long.toHexString(this.calculatedCheckSum)).append(" must be ").append(Integer.toHexString(num2)).toString(); throw new IOException(text); } }
public static bool IsPhoneNumberValid(string phoneNumber) { var clean = GetCleansedPhoneNumber(phoneNumber); if (clean.Length == 7 || clean.Length == 10 || clean.Length == 11) { try { var l = Long.ParseLong(clean); return(true); } catch { } } return(false); }
/** * Parses a string to a long value if the string can be parsed as a long. Does not log a message if the string can * not be parsed as a long. * * @param s the string to parse. * * @return the long value parsed from the string, or null if the string cannot be parsed as a long. */ public static Long makeLong(String s) { if (WWUtil.isEmpty(s)) { return(null); } try { return(Long.valueOf(s)); } catch (NumberFormatException e) { return(null); } }
public void PerformSets_ShouldReturnCorrectMessage() { var set1 = new Short("Short"); var set2 = new Medium("Medium"); var set3 = new Long("Long"); this.stage.AddSet(set1); this.stage.AddSet(set2); this.stage.AddSet(set3); var perf1 = new Performer("Pesho", 23); perf1.AddInstrument(new Guitar()); var perf2 = new Performer("Ivan", 24); perf2.AddInstrument(new Drums()); var perf3 = new Performer("Gosho", 25); perf3.AddInstrument(new Microphone()); set3.AddPerformer(perf1); set3.AddPerformer(perf3); set2.AddPerformer(perf2); var song1 = new Song("Wave", new TimeSpan(0, 0, 01, 01)); var song2 = new Song("Fair", new TimeSpan(0, 0, 02, 02)); var song3 = new Song("Life", new TimeSpan(0, 0, 03, 03)); set3.AddSong(song1); set3.AddSong(song2); set3.AddSong(song3); var expected = new StringBuilder(); expected.AppendLine("1. Long:"); expected.AppendLine("-- 1. Wave (01:01)"); expected.AppendLine("-- 2. Fair (02:02)"); expected.AppendLine("-- 3. Life (03:03)"); expected.AppendLine("-- Set Successful"); expected.AppendLine("2. Medium:"); expected.AppendLine("-- Did not perform"); expected.AppendLine("3. Short:"); expected.AppendLine("-- Did not perform"); var result = this.controller.PerformSets(); Assert.AreEqual(expected.ToString().Trim(), result); }
public string ToString(int argWidth) { var keys = string.Join(", ", Long.Select(l => "--" + l).Concat(Short.Select(s => "-" + s))) + " "; var parms = string.Join(" ", Parameters.Select(p => "<" + p + ">")); if (!string.IsNullOrEmpty(parms)) { parms += " "; } var opts = OptionalGrouping ? "[" + (string.Join(" ", Optional)) + "] ..." : string.Join(" ", Optional.Select(o => "[" + o + "]")); return((" " + keys + parms + opts).PadRight(argWidth) + HelpText); }
void Analysize(object sender, EventHandler.BackTesting.Datum e) { if (GetCheckOnTime(e.Date)) { Short.Pop(); Long.Pop(); } Short.Push(EMA.Make(specify.Short, Short.Count, e.Price, Short.Peek())); Long.Push(EMA.Make(specify.Long, Long.Count, e.Price, Long.Peek())); double popShort = Short.Pop(), popLong = Long.Pop(); bt.Max(popShort - popLong - (Short.Peek() - Long.Peek()), specify); Short.Push(popShort); Long.Push(popLong); if (specify.Time == 1440) { if (GetCheckTime(e.Date.ToString())) { OnReceiveTrend(e.Volume); } var date = e.Date.ToString().Substring(6, 6); if (date.Equals(end)) { bt.SetStatisticalStorage(e.Date.ToString().Substring(0, 6), e.Price, RollOver); } if (uint.TryParse(date, out uint cme) && cme > 45958 && cme < 85959) { bt.SellOrder.Clear(); bt.BuyOrder.Clear(); } if (bt.SellOrder.Count > 0 && e.Volume > 0) { bt.SetSellConclusion(e.Date.ToString(), e.Price, e.Volume); } if (bt.BuyOrder.Count > 0 && e.Volume < 0) { bt.SetBuyConclusion(e.Date.ToString(), e.Price, e.Volume); } } bt.TradingJudge[specify.Time] = popShort; }
public override int GetHashCode() { unchecked { var hashCode = ID.GetHashCode(); hashCode = (hashCode * 397) ^ (StringDefault != null ? StringDefault.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Int; hashCode = (hashCode * 397) ^ Long.GetHashCode(); hashCode = (hashCode * 397) ^ Bool.GetHashCode(); hashCode = (hashCode * 397) ^ Float.GetHashCode(); hashCode = (hashCode * 397) ^ Double.GetHashCode(); hashCode = (hashCode * 397) ^ (IntArray != null ? IntArray.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (IntIList != null ? IntIList.GetHashCode() : 0); return(hashCode); } }
public static ULong BigMul(ULong first_lo, Long first_hi, ULong second_lo, Long second_hi, out ULong result_lo_hi, out ULong result_hi_lo, out Long result_hi_hi) { unchecked { var fl = first_lo; var fh = unchecked ((ULong)first_hi); var sl = second_lo; var sh = unchecked ((ULong)second_hi); var lll = BigMul(fl, sl, out ULong llh); var hhl = BigMul(fh, sh, out ULong hhh); var fm = unchecked (fh + fl); var sm = unchecked (sh + sl); var tl = AddUnchecked(hhl, hhh, lll, llh, out ULong th); var mml = BigMul(fm, sm, out ULong mmh); if (fm < fl) { mml = AddUnchecked(mml, mmh, 0, sm, out mmh); } if (sm < sl) { mml = AddUnchecked(mml, mmh, 0, fm, out mmh); } mml = SubtractUnchecked(mml, mmh, tl, th, out mmh); llh = unchecked (llh + mml); hhl = AddUnchecked(hhl, hhh, mmh, 0, out hhh); var m = unchecked (fm + sm); var n = (m >> 1) | (m < sm ? ((ULong)1) << (64 - 1) : 0); if (n < mmh) { unchecked { --hhh; } } if (0 > unchecked ((Long)fh)) { hhl = SubtractUnchecked(hhl, hhh, sl, sh, out hhh); } if (0 > unchecked ((Long)sh)) { hhl = SubtractUnchecked(hhl, hhh, fl, fh, out hhh); } result_hi_hi = unchecked ((Long)hhh); result_hi_lo = hhl; result_lo_hi = llh; return(lll); } }
/** * * Método que retorna o ID do cartão já convetido em Hexadecimal * * @return String = Id do cartão * * */ public string IdCartaoHexadecimal() { byte[] idCartao = mifareClassic.Tag.GetId(); long result = 0; if (idCartao == null) { return(""); } for (int i = idCartao.Length - 1; i >= 0; --i) { result <<= 8; result |= idCartao[i] & 0x0FF; } return(Long.ToString(result)); }
public virtual void Commit() { if (_changeCounter.value() == 0) { return; } IList <DirectRecordProxy> directRecordProxies = new List <DirectRecordProxy>(_batch.Values); directRecordProxies.sort((o1, o2) => Long.compare(-o1.Key, o2.Key)); foreach (DirectRecordProxy proxy in directRecordProxies) { proxy.Store(); } _changeCounter.clear(); _batch.Clear(); }
public override Item Plus(Item other) { switch (other) { case Integer number: return(New(Value + number.Value)); case Long number: return(Long.New(Value + number.Value)); case Float number: return(Float.New(Value + number.Value)); case Double number: return(Double.New(Value + number.Value)); case Object obj: return(Object.New(Value.ToString() + obj.Value)); default: return(base.Plus(other)); } }
internal static void PutCustomAttributes(this AnswersEvent answersEvent, Dictionary <string, object> customAttributes) { if (customAttributes == null) { return; } foreach (var customAttribute in customAttributes) { if (customAttribute.Value is int) { answersEvent.PutCustomAttribute(customAttribute.Key, Integer.ValueOf((int)customAttribute.Value)); } else if (customAttribute.Value is long) { answersEvent.PutCustomAttribute(customAttribute.Key, Long.ValueOf((long)customAttribute.Value)); } else if (customAttribute.Value is float) { answersEvent.PutCustomAttribute(customAttribute.Key, Float.ValueOf((float)customAttribute.Value)); } else if (customAttribute.Value is double) { answersEvent.PutCustomAttribute(customAttribute.Key, Double.ValueOf((double)customAttribute.Value)); } else if (customAttribute.Value is short) { answersEvent.PutCustomAttribute(customAttribute.Key, Short.ValueOf((short)customAttribute.Value)); } else if (customAttribute.Value is sbyte) { answersEvent.PutCustomAttribute(customAttribute.Key, Byte.ValueOf((sbyte)customAttribute.Value)); } else if (customAttribute.Value is decimal) { answersEvent.PutCustomAttribute(customAttribute.Key, new BigDecimal(customAttribute.Value.ToString())); } else { answersEvent.PutCustomAttribute(customAttribute.Key, customAttribute.Value?.ToString()); } } }
public void PerformSets_CanPerform_OrderedCorrectly() { IStage stage = new Stage(); ISet shortSet = new Short("short"); ISet mediumSet = new Medium("medium"); ISet longSet = new Long("long"); longSet.AddSong(new Song("s1", new TimeSpan(0, 2, 0))); mediumSet.AddSong(new Song("s2", new TimeSpan(0, 2, 0))); shortSet.AddSong(new Song("s3", new TimeSpan(0, 1, 0))); IPerformer medPerformer1 = new Performer("penka", 123); medPerformer1.AddInstrument(new Guitar()); IPerformer medPerformer2 = new Performer("ivan", 23); medPerformer2.AddInstrument(new Guitar()); medPerformer2.AddInstrument(new Drums()); IPerformer shortPerformer = new Performer("pesho", 32); shortPerformer.AddInstrument(new Microphone()); IPerformer longPerformer = new Performer("georgi", 211); longPerformer.AddInstrument(new Drums()); longSet.AddPerformer(longPerformer); mediumSet.AddPerformer(medPerformer1); mediumSet.AddPerformer(medPerformer2); shortSet.AddPerformer(shortPerformer); stage.AddSet(shortSet); stage.AddSet(longSet); stage.AddSet(mediumSet); ISetController setController = new SetController(stage); string actualResult = setController.PerformSets(); string expectedResult = "1. medium:\r\n-- 1. s2 (02:00)\r\n-- Set Successful\r\n2. long:\r\n-- 1. s1 (02:00)\r\n-- Set Successful\r\n3. short:\r\n-- 1. s3 (01:00)\r\n-- Set Successful"; Assert.That(actualResult, Is.EqualTo(expectedResult)); }
static Resolver() { Array = new Array(); Null = new Null(); Map = new Map(); String = new String(); Record = new Record(); Enum = new Enum(); Fixed = new Fixed(); Union = new Union(); Long = new Long(); Uuid = new Uuid(); Decimal = new Decimal(); Duration = new Duration(); TimestampMilliseconds = new TimestampMilliseconds(); TimestampMicroseconds = new TimestampMicroseconds(); }
//public decimal CurrentSpeed { get; set; } //private readonly FilterNearZero _filterNearZero = new FilterNearZero(); public override void Add(decimal value) { this.Short.Add(value); this.Long.Add(value); // CurrentSpeed = Derivative(value); if (!this.Signal.IsValid()) { var emaShort = Short.Calculate(); var emaLong = Long.Calculate(); var macd = emaShort - emaLong; Signal.Add(macd); } this.CurrentValue = Calculate(); Derivative.Add(this.CurrentValue); }
public int hashCode() { // Simplified rendition of the hashCode function automatically generated from the proto // compiler with java_generate_equals_and_hash set to true. We are happy with unset values to // be considered equal to their explicitly-set equivalents, so don't check if any value is // unknown. The only exception to this is the preferred domestic carrier code. int hash = 41; hash = (53 * hash) + getCountryCode(); hash = (53 * hash) + Long.valueOf(getNationalNumber()).hashCode(); hash = (53 * hash) + getExtension().hashCode(); hash = (53 * hash) + (isItalianLeadingZero() ? 1231 : 1237); hash = (53 * hash) + getRawInput().hashCode(); hash = (53 * hash) + getCountryCodeSource().hashCode(); hash = (53 * hash) + getPreferredDomesticCarrierCode().hashCode(); hash = (53 * hash) + (hasPreferredDomesticCarrierCode() ? 1231 : 1237); return(hash); }
private void SaveState() { string title = this.titleText.Text; string body = this.bodyText.Text; if (this.rowId == null) { long id = this.dbHelper.CreateNote(title, body); if (id > 0) { this.rowId = new Long(id); } } else { this.dbHelper.UpdateNote(this.rowId.LongValue(), title, body); } }
private void SaveState() { string name = this.nameText.Text; string detail = this.detailText.Text; if (this.rowId == null) { long id = this.dbHelper.CreateCust(name, detail); if (id > 0) { this.rowId = new Long(id); } } else { this.dbHelper.UpdateCust(this.rowId.LongValue(), name, detail); } }
public MTNeedResendMessage(long[] msgIds) { this.messages = new TLLongVector(); long[] numArray = msgIds; int length = numArray.Length; int index = 0; while (true) { if (index >= length) { break; } long num3 = numArray[index]; this.messages.add(Long.valueOf(num3)); index++; } }
// public RationalX(Long nominator, Long denominator) { if (nominator == 0) { sign = 0; rational = default(Rational); } else { sign = Utils.Sign(nominator) == Utils.Sign(denominator) ? 1 : -1; rational = new Rational( LongMath.Abs(nominator), LongMath.Abs(denominator) ); } }
////////////////////////////////////////////////////////////////////////// // Communication ////////////////////////////////////////////////////////////////////////// public UdpSocket bind(UdpSocket fan, IpAddr addr, Long port) { try { if (m_dotnet == null) { m_dotnet = createSocket(); } IPAddress dotnetAddr = (addr == null) ? IPAddress.Any : addr.m_peer.m_dotnet; int dotnetPort = (port == null) ? 0 : port.intValue(); m_dotnet.Bind(new IPEndPoint(dotnetAddr, dotnetPort)); return(fan); } catch (SocketException e) { throw IOErr.make(e).val; } }
private static int CompareLongAgainstRawType(long lhs, long rhsRawBits, sbyte rhsType) { if (rhsType == BYTE || rhsType == SHORT || rhsType == INT || rhsType == LONG) { return(Long.compare(lhs, rhsRawBits)); } else if (rhsType == FLOAT) { return(NumberValues.compareLongAgainstDouble(lhs, Float.intBitsToFloat(( int )rhsRawBits))); } else if (rhsType == DOUBLE) { return(NumberValues.compareLongAgainstDouble(lhs, Double.longBitsToDouble(rhsRawBits))); } // We can not throw here because we will visit this method inside a pageCursor.shouldRetry() block. // Just return a comparison that at least will be commutative. return(Long.compare(lhs, rhsRawBits)); }
public override int CompareValueTo(DurationIndexKey other) { int comparison = Long.compare(TotalAvgSeconds, other.TotalAvgSeconds); if (comparison == 0) { comparison = Integer.compare(NanosOfSecond, other.NanosOfSecond); if (comparison == 0) { comparison = Long.compare(Months, other.Months); if (comparison == 0) { comparison = Long.compare(Days, other.Days); } } } return(comparison); }
private static int CompareDoubleAgainstRawType(double lhsDouble, long rhsRawBits, sbyte rhsType) { if (rhsType == BYTE || rhsType == SHORT || rhsType == INT || rhsType == LONG) { return(NumberValues.compareDoubleAgainstLong(lhsDouble, rhsRawBits)); } else if (rhsType == FLOAT) { return(lhsDouble.CompareTo(Float.intBitsToFloat(( int )rhsRawBits))); } else if (rhsType == DOUBLE) { return(lhsDouble.CompareTo(Double.longBitsToDouble(rhsRawBits))); } // We can not throw here because we will visit this method inside a pageCursor.shouldRetry() block. // Just return a comparison that at least will be commutative. return(Long.compare(System.BitConverter.DoubleToInt64Bits(lhsDouble), rhsRawBits)); }
public override int GetHashCode() { unchecked { var hashCode = Byte.GetHashCode(); hashCode = (hashCode * 397) ^ Short.GetHashCode(); hashCode = (hashCode * 397) ^ ArrayReaderTestId; hashCode = (hashCode * 397) ^ Long.GetHashCode(); hashCode = (hashCode * 397) ^ Float.GetHashCode(); hashCode = (hashCode * 397) ^ Double.GetHashCode(); hashCode = (hashCode * 397) ^ Decimal.GetHashCode(); hashCode = (hashCode * 397) ^ Bool.GetHashCode(); hashCode = (hashCode * 397) ^ String.GetHashCode(); hashCode = (hashCode * 397) ^ Guid.GetHashCode(); hashCode = (hashCode * 397) ^ DateTime.GetHashCode(); return(hashCode); } }
internal static int Compare(long thisLong0, long thisLong1, long thisLong2, long thisLong3, long thatLong0, long thatLong1, long thatLong2, long thatLong3) { int comparison = Long.compare(thisLong0, thatLong0); if (comparison == 0) { comparison = Integer.compare(( int )thisLong1, ( int )thatLong1); if (comparison == 0) { comparison = Long.compare(thisLong2, thatLong2); if (comparison == 0) { comparison = Long.compare(thisLong3, thatLong3); } } } return(comparison); }
public void TestPerformSetsSetThrowsError() { ISet shortSet = new Short("shortSet"); ISet longSet = new Long("longSet"); ISet mediumSet = new Medium("mediumSet"); IInstrument drum = new Drums(); IInstrument guitar = new Guitar(); IInstrument microphone = new Microphone(); IPerformer nakov = new Performer("Nakov", 10); IPerformer vladi = new Performer("Vladi", 10); IPerformer bojo = new Performer("Bojo", 10); nakov.AddInstrument(drum); nakov.AddInstrument(guitar); nakov.AddInstrument(microphone); vladi.AddInstrument(guitar); vladi.AddInstrument(drum); bojo.AddInstrument(microphone); ISong song = new Song("NewSong", new TimeSpan(0, 5, 5)); ISong song2 = new Song("NewSong2", new TimeSpan(52, 7, 5)); ISong song3 = new Song("NewSong3", new TimeSpan(1, 1, 5)); ISong song4 = new Song("NewSong4", new TimeSpan(5, 5, 5)); shortSet.AddPerformer(bojo); shortSet.AddPerformer(nakov); shortSet.AddPerformer(vladi); mediumSet.AddPerformer(vladi); mediumSet.AddPerformer(nakov); mediumSet.AddPerformer(bojo); longSet.AddPerformer(vladi); longSet.AddPerformer(bojo); longSet.AddPerformer(nakov); shortSet.AddSong(song); Assert.Throws <InvalidOperationException>(() => { shortSet.AddSong(song2); }); }
public abstract Buf mmap(string mode, long pos, Long size);
public static Date FromBinary(Long dateData) { return null; }
public HashCode GenerateHashCodeForEnhance( RGBA rgba, Long zoom, HashCode parent ){ }
// Skip data in an input stream. private static void skip_input_data (ref jpeg_decompress_struct cinfo, Long num_bytes) { #if __CSCC__ jpeg_source_mgr *src = cinfo.src; int num = (int)num_bytes; if(num > 0) { while(num > (int)(src->bytes_in_buffer)) { num -= (int)(src->bytes_in_buffer); fill_input_buffer(ref cinfo); } src->next_input_byte = new IntPtr((src->next_input_byte.ToInt64()) + num); src->bytes_in_buffer = (size_t)(((int)(src->bytes_in_buffer)) - num); } #endif }
/// <summary> Returns a value indicating the sign of a 64-bit signed integer. </summary> /// <param name="value">A signed number.</param> /// <returns> /// A number that indicates the sign of value: /// -1: value is less than zero. /// 0: value is equal to zero. /// 1: value is greater than zero. /// </returns> public static Integer Sign(Long value) { return null; }
/// <summary> Returns the smaller of two 64-bit unsigned integers. </summary> /// <param name="val1">The first of two 64-bit unsigned integers to compare. </param> /// <param name="val2">The second of two 64-bit unsigned integers to compare. </param> /// <returns>Parameter val1 or val2, whichever is smaller.</returns> public static Long Min(Long val1, Long val2) { return null; }
/// <summary> Returns the absolute value of a 64-bit signed integer. </summary> /// <param name="value">A number that is greater than Long.MinValue, but less than or equal to Long.MaxValue.</param> /// <returns>A 64-bit signed integer, x, such that 0 <= x <= Long.MaxValue.</returns> /// <remarks>The absolute value of a number is its numeric value without its sign. For example, the absolute value of both 123 and -123 is 123.</remarks> public static Long Abs(Long value) { return null; }
static Long() { for (int i=0; i<intern.Length; i++) intern[i] = new Long(-100 + i); }
public abstract OutStream @out(bool append, Long bufSize);
public static Date FromFileTimeUtc(Long fileTime) { return null; }
public Date(Long ticks) { }
public abstract InStream @in(Long bufSize);
public Date AddTicks(Long value) { return null; }