Package java.sql

Examples of java.sql.Timestamp.compareTo()


        } else {
            histogram = histogramList.get(histogramList.size() - 1);
            Timestamp newestLabelTimestamp =
                getNewestLabelCreationTimestamp(repos);
            if ((newestLabelTimestamp != null)
                && (newestLabelTimestamp.compareTo(
                        Timestamp.valueOf(histogram.getAnalyzeTime())) > 0))
            {
                if (createNewHistogram) {
                    histogram = repos.newFemColumnHistogram();
                    histogram.setColumn(column);
View Full Code Here


        Timestamp newestTimestamp = null;
        for (FemLabel label : labels) {
            Timestamp timestamp =
                Timestamp.valueOf(label.getCreationTimestamp());
            if ((newestTimestamp == null)
                || (timestamp.compareTo(newestTimestamp) > 0))
            {
                newestTimestamp = timestamp;
            }
        }
        return newestTimestamp;
View Full Code Here

            int rc = referenceTimestamp.compareTo(labelTimestamp);

            // Find the newest label older than the reference label
            if ((rc > 0)
                && ((lowerBound == null)
                    || (labelTimestamp.compareTo(lowerBound) > 0)))
            {
                lowerBound = labelTimestamp;

                // Find the oldest label newer than the reference label
            } else if (
View Full Code Here

                // Find the oldest label newer than the reference label
            } else if (
                (rc < 0)
                && ((upperBound == null)
                    || (labelTimestamp.compareTo(upperBound) < 0)))
            {
                upperBound = labelTimestamp;
            }
        }
View Full Code Here

  public void testCompareTo() {
    Timestamp now = Timestamp.valueOf("2011-01-05 12:45:18.000000000");
    // add 1.5 << 31 so coercing the ms difference to int results in a
    // sign change
    Timestamp later = new Timestamp(now.getTime() + (3L << 30));
    assertTrue("later <= now", later.compareTo(now) > 0);
  }

  /**
   * Timestamps have some non-obvious comparison semantics when compared to
   * dates.
 
View Full Code Here

    t2.setNanos(1);

    assertFalse(t.equals(t2));
    assertTrue(t.compareTo(t2) < 0);
    assertTrue(t2.compareTo(t) > 0);
    assertTrue(t.before(t2));
    assertTrue(t2.after(t));
  }

  public void testNanosRange() {
View Full Code Here

    assertEquals("d2, t", d2, t);
    assertEquals("hashcode", d2.hashCode(), t.hashCode());
    assertFalse("t.equals(d2)", t.equals(d2));

    // t is later then d2 by some number of nanoseconds
    assertEquals(1, t.compareTo(d2));

    Timestamp t2 = new Timestamp(d.getTime());
    t2.setNanos(t.getNanos() + 1);

    assertFalse("t.equals(t2)", t.equals(t2));
View Full Code Here

        Timestamp t2 = new Timestamp(-1L);

        t1.setTime(Long.MIN_VALUE);
        t2.setDate(Integer.MIN_VALUE);
        assertEquals(1, t1.compareTo(t2));
        assertEquals(-1, t2.compareTo(t1));

        t1.setTime(Long.MAX_VALUE);
        t2.setTime(Long.MAX_VALUE - 1);
        assertEquals(1, t1.compareTo(t2));
        assertEquals(-1, t2.compareTo(t1));
View Full Code Here

        assertEquals(-1, t2.compareTo(t1));

        t1.setTime(Long.MAX_VALUE);
        t2.setTime(Long.MAX_VALUE - 1);
        assertEquals(1, t1.compareTo(t2));
        assertEquals(-1, t2.compareTo(t1));

        t1.setTime(Integer.MAX_VALUE);
        t2.setTime(Integer.MAX_VALUE);
        assertEquals(0, t1.compareTo(t2));
        assertEquals(0, t2.compareTo(t1));
View Full Code Here

        assertEquals(-1, t2.compareTo(t1));

        t1.setTime(Integer.MAX_VALUE);
        t2.setTime(Integer.MAX_VALUE);
        assertEquals(0, t1.compareTo(t2));
        assertEquals(0, t2.compareTo(t1));

    } // end method testcompareToTimestamp

    /**
     * @tests java.sql.Timestamp#compareTo(java.util.Date)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.