cesiumlanguagewriter.YearMonthDay.compareTo()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中cesiumlanguagewriter.YearMonthDay.compareTo()方法的一些代码示例,展示了YearMonthDay.compareTo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonthDay.compareTo()方法的具体详情如下:
包路径:cesiumlanguagewriter.YearMonthDay
类名称:YearMonthDay
方法名:compareTo

YearMonthDay.compareTo介绍

[英]Compares this instance with another instance of the same type.
[中]将此实例与同类型的另一个实例进行比较。

代码示例

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. *
  3. Returns {@code true} if {@code left} is greater than or equal to {@code right}.
  4. * @param left The instance to compare to {@code right}.
  5. * @param right The instance to compare to {@code left}.
  6. * @return
  7. {@code true} if {@code left} is greater than or equal to {@code right}; otherwise, {@code false}.
  8. */
  9. @CS2JInfo("This method implements the functionality of the overloaded operator: 'System.Boolean >=(YearMonthDay,YearMonthDay)'")
  10. public static boolean greaterThanOrEqual(@Nonnull YearMonthDay left, @Nonnull YearMonthDay right) {
  11. return left.compareTo(right) >= 0;
  12. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. *
  3. Returns {@code true} if {@code left} is less than {@code right}.
  4. * @param left The instance to compare to {@code right}.
  5. * @param right The instance to compare to {@code left}.
  6. * @return
  7. {@code true} if {@code left} is less than {@code right}; otherwise, {@code false}.
  8. */
  9. @CS2JInfo("This method implements the functionality of the overloaded operator: 'System.Boolean <(YearMonthDay,YearMonthDay)'")
  10. public static boolean lessThan(@Nonnull YearMonthDay left, @Nonnull YearMonthDay right) {
  11. return left.compareTo(right) < 0;
  12. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. *
  3. Returns {@code true} if {@code left} is less than or equal to {@code right}.
  4. * @param left The instance to compare to {@code right}.
  5. * @param right The instance to compare to {@code left}.
  6. * @return
  7. {@code true} if {@code left} is less than or equal to {@code right}; otherwise, {@code false}.
  8. */
  9. @CS2JInfo("This method implements the functionality of the overloaded operator: 'System.Boolean <=(YearMonthDay,YearMonthDay)'")
  10. public static boolean lessThanOrEqual(@Nonnull YearMonthDay left, @Nonnull YearMonthDay right) {
  11. return left.compareTo(right) <= 0;
  12. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. *
  3. Returns {@code true} if {@code left} is greater than {@code right}.
  4. * @param left The instance to compare to {@code right}.
  5. * @param right The instance to compare to {@code left}.
  6. * @return
  7. {@code true} if {@code left} is greater than {@code right}; otherwise, {@code false}.
  8. */
  9. @CS2JInfo("This method implements the functionality of the overloaded operator: 'System.Boolean >(YearMonthDay,YearMonthDay)'")
  10. public static boolean greaterThan(@Nonnull YearMonthDay left, @Nonnull YearMonthDay right) {
  11. return left.compareTo(right) > 0;
  12. }

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. int result = m_yearMonthDay.compareTo(other.m_yearMonthDay);
  2. if (result != 0) {
  3. return result;

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. Assert.assertTrue(first.equalsType(second));
  2. Assert.assertTrue(second.equalsType(first));
  3. Assert.assertEquals((int) 0, (int) first.compareTo(second));
  4. Assert.assertEquals((int) 0, (int) second.compareTo(first));
  5. second = new YearMonthDay(2001, 1, 1);
  6. AssertHelper.assertNotEqual(first, second);
  7. Assert.assertFalse(first.equalsType(second));
  8. Assert.assertFalse(second.equalsType(first));
  9. AssertHelper.assertNotEqual(0, first.compareTo(second));
  10. AssertHelper.assertNotEqual(0, second.compareTo(first));
  11. second = new YearMonthDay(2000, 2, 1);
  12. AssertHelper.assertNotEqual(first, second);
  13. Assert.assertFalse(first.equalsType(second));
  14. Assert.assertFalse(second.equalsType(first));
  15. AssertHelper.assertNotEqual(0, first.compareTo(second));
  16. AssertHelper.assertNotEqual(0, second.compareTo(first));
  17. second = new YearMonthDay(2000, 1, 2);
  18. AssertHelper.assertNotEqual(first, second);
  19. Assert.assertFalse(first.equalsType(second));
  20. Assert.assertFalse(second.equalsType(first));
  21. AssertHelper.assertNotEqual(0, first.compareTo(second));
  22. AssertHelper.assertNotEqual(0, second.compareTo(first));
  23. AssertHelper.assertNotEqual(first, 5);

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

  1. /**
  2. *
  3. Tests the CompareTo methods and the comparison operators.
  4. */
  5. @Test
  6. public final void testComparisons() {
  7. YearMonthDay ymd1 = new YearMonthDay(2006, 3, 14);
  8. YearMonthDay ymd2 = new YearMonthDay(2006, 3, 14);
  9. YearMonthDay ymd3 = new YearMonthDay(2006, 5, 26);
  10. Object ymd4 = new YearMonthDay(2004, 2, 21);
  11. Assert.assertTrue(YearMonthDay.equals(ymd1, ymd2));
  12. Assert.assertTrue(YearMonthDay.equals(ymd2, ymd1));
  13. Assert.assertTrue(YearMonthDay.notEquals(ymd1, ymd3));
  14. Assert.assertTrue(YearMonthDay.greaterThanOrEqual(ymd1, ymd2));
  15. Assert.assertTrue(YearMonthDay.lessThanOrEqual(ymd1, ymd2));
  16. Assert.assertTrue(ymd1.compareTo(ymd2) == 0);
  17. Assert.assertTrue(YearMonthDay.lessThan(ymd2, ymd3));
  18. Assert.assertTrue(YearMonthDay.lessThanOrEqual(ymd2, ymd3));
  19. Assert.assertTrue(YearMonthDay.greaterThan(ymd3, ymd2));
  20. Assert.assertTrue(YearMonthDay.greaterThanOrEqual(ymd3, ymd2));
  21. AssertHelper.assertNotEqual(ymd1, ymd4);
  22. }

相关文章