Package java.sql

Examples of java.sql.Timestamp.compareTo()


        } // end for

        Date nastyTest = new Date();
        Timestamp theTimestamp = new Timestamp(TIME_ARRAY[1]);
        try {
            theTimestamp.compareTo(nastyTest);
            // It throws ClassCastException in JDK 1.5.0_06 but in 1.5.0_07 it
            // does not throw the expected exception.
            fail("testCompareToObject: Did not get expected ClassCastException");
        } catch (ClassCastException e) {
            // Should get here
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

        } // end for

        Timestamp timestamp = new Timestamp(1000000);
        Date date = new Date(1000000);
       
        assertEquals(0, timestamp.compareTo(date));
        timestamp.setNanos(10);
        assertEquals(1, timestamp.compareTo(date));
       
        long time = System.currentTimeMillis();
        Date date2 = new Date(time);
View Full Code Here

        Timestamp timestamp = new Timestamp(1000000);
        Date date = new Date(1000000);
       
        assertEquals(0, timestamp.compareTo(date));
        timestamp.setNanos(10);
        assertEquals(1, timestamp.compareTo(date));
       
        long time = System.currentTimeMillis();
        Date date2 = new Date(time);
        Timestamp timestamp2 = new Timestamp(date2.getTime());
        assertEquals(0, timestamp2.compareTo(date2));
View Full Code Here

        assertEquals(1, timestamp.compareTo(date));
       
        long time = System.currentTimeMillis();
        Date date2 = new Date(time);
        Timestamp timestamp2 = new Timestamp(date2.getTime());
        assertEquals(0, timestamp2.compareTo(date2));
    } // end method testcompareToObject

    /**
     * @tests serialization/deserialization compatibility.
     */
 
View Full Code Here

            minStartDate = startDate;
            for (int i = 0; i < childrenNodes.size(); i++) {
                BOMNode oneChildNode = (BOMNode)childrenNodes.get(i);
                if (oneChildNode != null) {
                    Timestamp childStartDate = oneChildNode.getStartDate(facilityId, startDate, false);
                    if (childStartDate.compareTo(minStartDate) < 0) {
                        minStartDate = childStartDate;
                    }
                }
            }
        }
View Full Code Here

                    Timestamp estimatedStartDate = workEffort.getTimestamp("estimatedStartDate");
                    Timestamp estimatedCompletionDate = workEffort.getTimestamp("estimatedCompletionDate");
           
                    if (estimatedStartDate == null || estimatedCompletionDate == null) continue;
                   
                    if (estimatedStartDate.compareTo(curPeriodEnd) < 0 && estimatedCompletionDate.compareTo(curPeriodStart) > 0) {
                        //Debug.logInfo("Task start: "+estimatedStartDate+" Task end: "+estimatedCompletionDate+" Period start: "+curPeriodStart+" Period end: "+curPeriodEnd, module);
                      
                        Map calEntry = new HashMap();
                        calEntry.put("workEffort",workEffort);
                                              
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.