當前位置: 首頁>>代碼示例>>Java>>正文


Java CalendarFactory.modify方法代碼示例

本文整理匯總了Java中com.obdobion.calendar.CalendarFactory.modify方法的典型用法代碼示例。如果您正苦於以下問題:Java CalendarFactory.modify方法的具體用法?Java CalendarFactory.modify怎麽用?Java CalendarFactory.modify使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.obdobion.calendar.CalendarFactory的用法示例。


在下文中一共展示了CalendarFactory.modify方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: resolve

import com.obdobion.calendar.CalendarFactory; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public void resolve(final ValueStack values) throws Exception
{
    if (values.size() < 1)
        throw new Exception("missing operands for " + toString());

    try
    {
        String adjustments = "";
        if (getParameterCount() == 2)
            adjustments = values.popString();

        final Object dateInputObject = values.popWhatever();
        LocalDate convertedInputDate = null;

        if (dateInputObject instanceof String)
            convertedInputDate = TemporalHelper.parseWithPredefinedParsers((String) dateInputObject).toLocalDate();
        else

        if (dateInputObject instanceof TokVariable)
            throw new Exception("unresolved variable: " + ((TokVariable) dateInputObject).getName());
        else if (dateInputObject instanceof Long)
            convertedInputDate = CalendarFactory.at((Long) dateInputObject).toLocalDate();
        else if (dateInputObject instanceof Double)
            convertedInputDate = CalendarFactory.at(((Double) dateInputObject).longValue()).toLocalDate();
        else
            convertedInputDate = ((LocalDateTime) dateInputObject).toLocalDate();

        final LocalDateTime adjLdt = CalendarFactory.modify(convertedInputDate, adjustments);
        if (adjLdt.toLocalTime() != LocalTime.MIN)
            throw new ParseException("Adjustments to time are not allowed", 0);
        values.push(adjLdt);

    } catch (final ParseException e)
    {
        e.fillInStackTrace();
        throw new Exception(toString() + "; " + e.getMessage(), e);
    }
}
 
開發者ID:fedups,項目名稱:com.obdobion.algebrain,代碼行數:41,代碼來源:FuncDate.java

示例2: resolve

import com.obdobion.calendar.CalendarFactory; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public void resolve(final ValueStack values) throws Exception
{
    if (values.size() < 1)
        throw new Exception("missing operands for " + toString());

    try
    {
        String adjustments = "";
        if (getParameterCount() == 2)
            adjustments = values.popString();

        final Object dateInputObject = values.popWhatever();
        LocalTime convertedInputDate = null;

        if (dateInputObject instanceof String)
            convertedInputDate = TemporalHelper.parseWithPredefinedParsers((String) dateInputObject).toLocalTime();
        else

        if (dateInputObject instanceof TokVariable)
            throw new Exception("unresolved variable: " + ((TokVariable) dateInputObject).getName());
        else if (dateInputObject instanceof Long)
            convertedInputDate = CalendarFactory.at((Long) dateInputObject).toLocalTime();
        else if (dateInputObject instanceof Double)
            convertedInputDate = CalendarFactory.at(((Double) dateInputObject).longValue()).toLocalTime();
        else
            convertedInputDate = ((LocalDateTime) dateInputObject).toLocalTime();

        final LocalDateTime adjLdt = CalendarFactory.modify(convertedInputDate, adjustments);
        if (adjLdt.toLocalDate() != LocalDate.MIN)
            throw new ParseException("Adjustments to date are not allowed", 0);
        values.push(adjLdt);

    } catch (final ParseException e)
    {
        e.fillInStackTrace();
        throw new Exception(toString() + "; " + e.getMessage(), e);
    }
}
 
開發者ID:fedups,項目名稱:com.obdobion.algebrain,代碼行數:41,代碼來源:FuncTime.java

示例3: resolve

import com.obdobion.calendar.CalendarFactory; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public void resolve(final ValueStack values) throws Exception
{
    if (values.size() < 2)
        throw new Exception("missing operands for " + toString());

    try
    {
        String adjustments = "";

        if (getParameterCount() == 3)
            adjustments = values.popString();

        final DateTimeFormatter dtf = DateTimeFormatter.ofPattern(values.popString());

        final String dateInputObject = values.popString();
        final LocalTime convertedInputDate = LocalTime.parse(dateInputObject, dtf);

        final LocalDateTime adjLdt = CalendarFactory.modify(convertedInputDate, adjustments);
        if (adjLdt.toLocalDate() != LocalDate.MIN)
            throw new ParseException("Adjustments to date are not allowed", 0);
        values.push(adjLdt);

    } catch (final ParseException e)
    {
        e.fillInStackTrace();
        throw new Exception(toString() + "; " + e.getMessage(), e);
    }
}
 
開發者ID:fedups,項目名稱:com.obdobion.algebrain,代碼行數:31,代碼來源:FuncTimeFmt.java

示例4: resolve

import com.obdobion.calendar.CalendarFactory; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public void resolve(final ValueStack values) throws Exception
{
    if (values.size() < 2)
        throw new Exception("missing operands for " + toString());

    try
    {
        String adjustments = "";

        if (getParameterCount() == 3)
            adjustments = values.popString();

        final DateTimeFormatter dtf = DateTimeFormatter.ofPattern(values.popString());

        final String dateInputObject = values.popString();
        final LocalDate convertedInputDate = LocalDate.parse(dateInputObject, dtf);

        final LocalDateTime adjLdt = CalendarFactory.modify(convertedInputDate, adjustments);
        if (adjLdt.toLocalTime() != LocalTime.MIN)
            throw new ParseException("Adjustments to time are not allowed", 0);
        values.push(adjLdt);

    } catch (final ParseException e)
    {
        e.fillInStackTrace();
        throw new Exception(toString() + "; " + e.getMessage(), e);
    }
}
 
開發者ID:fedups,項目名稱:com.obdobion.algebrain,代碼行數:31,代碼來源:FuncDateFmt.java


注:本文中的com.obdobion.calendar.CalendarFactory.modify方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。