Example usage for java.util Calendar compareTo

List of usage examples for java.util Calendar compareTo

Introduction

In this page you can find the example usage for java.util Calendar compareTo.

Prototype

private int compareTo(long t) 

Source Link

Usage

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrm.CFCrmHPKey.java

public int compareTo(Object obj) {
    if (obj == null) {
        return (-1);
    } else if (obj instanceof CFCrmHPKey) {
        CFCrmHPKey rhs = (CFCrmHPKey) obj;
        {/*from  ww  w. j  a  v a  2  s  . co m*/
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        return (0);
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "compareTo", "obj",
                obj, "CFCrmHPKey");
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternet.CFInternetHPKey.java

public int compareTo(Object obj) {
    if (obj == null) {
        return (-1);
    } else if (obj instanceof CFInternetHPKey) {
        CFInternetHPKey rhs = (CFInternetHPKey) obj;
        {/* ww w  .  j  a  v  a  2  s  .  c  om*/
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        return (0);
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "compareTo", "obj",
                obj, "CFInternetHPKey");
    }
}

From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurity.CFSecurityHPKey.java

public int compareTo(Object obj) {
    if (obj == null) {
        return (-1);
    } else if (obj instanceof CFSecurityHPKey) {
        CFSecurityHPKey rhs = (CFSecurityHPKey) obj;
        {//from   ww  w .  j a v a  2 s  .  co m
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        return (0);
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "compareTo", "obj",
                obj, "CFSecurityHPKey");
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAcc.CFAccHPKey.java

public int compareTo(Object obj) {
    if (obj == null) {
        return (-1);
    } else if (obj instanceof CFAccHPKey) {
        CFAccHPKey rhs = (CFAccHPKey) obj;
        {/*from   w  w w .  java2s .  c  o m*/
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        return (0);
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "compareTo", "obj",
                obj, "CFAccHPKey");
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAst.CFAstHPKey.java

public int compareTo(Object obj) {
    if (obj == null) {
        return (-1);
    } else if (obj instanceof CFAstHPKey) {
        CFAstHPKey rhs = (CFAstHPKey) obj;
        {//from  ww  w .  j  a  v a  2 s  .  c  o m
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        return (0);
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "compareTo", "obj",
                obj, "CFAstHPKey");
    }
}

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKb.CFGenKbHPKey.java

public int compareTo(Object obj) {
    if (obj == null) {
        return (-1);
    } else if (obj instanceof CFGenKbHPKey) {
        CFGenKbHPKey rhs = (CFGenKbHPKey) obj;
        {/*  w ww.ja va  2s  . c o  m*/
            long lhsAuditClusterId = getAuditClusterId();
            long rhsAuditClusterId = rhs.getAuditClusterId();
            if (lhsAuditClusterId < rhsAuditClusterId) {
                return (-1);
            } else if (lhsAuditClusterId > rhsAuditClusterId) {
                return (1);
            }
        }
        {
            Calendar lhsAuditStamp = getAuditStamp();
            Calendar rhsAuditStamp = rhs.getAuditStamp();
            if (lhsAuditStamp == null) {
                if (rhsAuditStamp != null) {
                    return (-1);
                }
            } else if (rhsAuditStamp == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        {
            short lhsAuditActionId = getAuditActionId();
            short rhsAuditActionId = rhs.getAuditActionId();
            if (lhsAuditActionId < rhsAuditActionId) {
                return (-1);
            } else if (lhsAuditActionId > rhsAuditActionId) {
                return (1);
            }
        }
        {
            int lhsRequiredRevision = getRequiredRevision();
            int rhsRequiredRevision = rhs.getRequiredRevision();
            if (lhsRequiredRevision < rhsRequiredRevision) {
                return (-1);
            } else if (lhsRequiredRevision > rhsRequiredRevision) {
                return (1);
            }
        }
        {
            UUID lhsAuditSessionId = getAuditSessionId();
            UUID rhsAuditSessionId = rhs.getAuditSessionId();
            if (lhsAuditSessionId == null) {
                if (rhsAuditSessionId != null) {
                    return (-1);
                }
            } else if (rhsAuditSessionId == null) {
                return (1);
            } else {
                int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
                if (cmpstat != 0) {
                    return (cmpstat);
                }
            }
        }
        return (0);
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "compareTo", "obj",
                obj, "CFGenKbHPKey");
    }
}

From source file:nz.co.jsrsolutions.ds3.command.UpdateExchangeSymbolQuotesCommand.java

public boolean execute(Context context) throws Exception {

    logger.info("Executing: updateexchangesymbolquotes");

    EodDataProvider eodDataProvider = (EodDataProvider) context.get(CommandContext.EODDATAPROVIDER_KEY);
    EodDataSink eodDataSink = (EodDataSink) context.get(CommandContext.EODDATASINK_KEY);
    String exchange = (String) context.get(CommandContext.EXCHANGE_KEY);
    String symbol = (String) context.get(CommandContext.SYMBOL_KEY);

    if (exchange == null) {
        throw new CommandException("Must supply --exchange [exchangecode]");
    }/*from  w  ww  .  j  a  va  2 s. c  o  m*/

    if (symbol == null) {
        throw new CommandException("Must supply --symbol [symbolcode]");
    }

    final int availableMonths = eodDataProvider.getExchangeMonths(exchange);
    final Calendar firstAvailableDateTime = Calendar.getInstance();

    if (availableMonths > 0) {
        firstAvailableDateTime.add(Calendar.MONTH, -1 * availableMonths);
        firstAvailableDateTime.add(Calendar.DATE, 1);
    }

    final Calendar today = Calendar.getInstance();
    final Range<Calendar> sinkRange = eodDataSink.readExchangeSymbolDateRange(exchange, symbol);
    final ArrayList<Range<Calendar>> requestRangesList = new ArrayList<Range<Calendar>>(2);

    if (sinkRange != null) {

        if (firstAvailableDateTime.compareTo(sinkRange.getLower()) < 0) {

            final Calendar upper = (Calendar) sinkRange.getLower().clone();
            upper.add(Calendar.DATE, -1);

            requestRangesList.add(new Range<Calendar>(firstAvailableDateTime, upper));
        }

        if (today.compareTo(sinkRange.getUpper()) > 0) {

            final Calendar lower = (Calendar) sinkRange.getUpper().clone();
            lower.add(Calendar.DATE, 1);

            requestRangesList.add(new Range<Calendar>(lower, today));

        }

    } else {
        requestRangesList.add(new Range<Calendar>(firstAvailableDateTime, today));
    }

    for (Range<Calendar> requestRange : requestRangesList) {

        if (logger.isInfoEnabled()) {

            final StringBuffer logMessageBuffer = new StringBuffer();
            logMessageBuffer.append(" Attempting to retrieve quotes on [ ");
            logMessageBuffer.append(exchange);
            logMessageBuffer.append(" ] for [ ");
            logMessageBuffer.append(symbol);
            logMessageBuffer.append(" ] between [ ");
            logMessageBuffer.append(requestRange.getLower().getTime().toString());
            logMessageBuffer.append(" ] and [ ");
            logMessageBuffer.append(requestRange.getUpper().getTime().toString());
            logMessageBuffer.append(" ] ");
            logger.info(logMessageBuffer.toString());

        }

        final QUOTE[] quotes = eodDataProvider.getQuotes(exchange, symbol, requestRange.getLower(),
                requestRange.getUpper(), DEFAULT_FREQUENCY);

        if (quotes == null || quotes.length == 0) {
            logger.info("Quote array from provider was empty!");
            return false;
        }

        eodDataSink.updateExchangeSymbolQuotes(exchange, symbol, quotes);

    }

    return false;

}

From source file:org.kuali.coeus.common.committee.impl.service.impl.CommitteeServiceImplBase.java

/**
 * Is the member available for the given schedule meeting date?
 * The member must have a role for that date.
 * @param member the member/*from   w  ww .j av a  2  s.  com*/
 * @param scheduledDate the date of the meeting
 * @return true if the member will be at the meeting; otherwise false
 * TODO: This method calls member.isActive() and then carries out date checking that has 
 *  already been performed in member.isActive()? Perhaps this method should be removed and 
 *  its invocation in getAvailableMembers() above should be replaced by a single 
 *  call to member.isActive(schedule.getScheduledDate())
 */
protected boolean isMemberAvailable(CommitteeMembershipBase member, Date scheduledDate) {
    java.sql.Date sqlDate = new java.sql.Date(scheduledDate.getTime());
    if (member.isActive(sqlDate)) {
        Calendar scheduleCalendar = getCalendar(scheduledDate);
        List<CommitteeMembershipRole> roles = member.getMembershipRoles();
        for (CommitteeMembershipRole role : roles) {
            Calendar startCalendar = getCalendar(role.getStartDate());
            Calendar endCalendar = getCalendar(role.getEndDate());
            if (scheduleCalendar.compareTo(startCalendar) >= 0
                    && scheduleCalendar.compareTo(endCalendar) <= 0) {
                return true;
            }
        }
    }
    return false;
}

From source file:hsa.awp.campaign.facade.CampaignFacade.java

@Transactional
@Override/*from w  w w  .jav a2  s.c  om*/
public List<Campaign> findActiveCampaignSince(Calendar since) {

    if (since == null) {
        return campaignDao.findActive();
    }

    if (since.compareTo(Calendar.getInstance()) > 0) {
        throw new IllegalArgumentException("since data has to be before now.");
    }
    return campaignDao.findActiveSince(since);
}