当前位置: 首页>>代码示例>>Java>>正文


Java IDateTime类代码示例

本文整理汇总了Java中net.opengis.IDateTime的典型用法代码示例。如果您正苦于以下问题:Java IDateTime类的具体用法?Java IDateTime怎么用?Java IDateTime使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IDateTime类属于net.opengis包,在下文中一共展示了IDateTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValue

import net.opengis.IDateTime; //导入依赖的package包/类
/**
 * Gets the value property
 */
@Override
public IDateTime getValue()
{
    if (dataBlock == null)
        return null;
    double val = dataBlock.getDoubleValue();
    return new DateTimeDouble(val);
}
 
开发者ID:sensiasoft,项目名称:lib-swe-common,代码行数:12,代码来源:TimeImpl.java

示例2: setValue

import net.opengis.IDateTime; //导入依赖的package包/类
/**
 * Sets the value property
 */
@Override
public void setValue(IDateTime dateTime)
{
    if (dataBlock == null)
        assignNewDataBlock();
    double val = dateTime.getAsDouble();
    dataBlock.setDoubleValue(val);
}
 
开发者ID:sensiasoft,项目名称:lib-swe-common,代码行数:12,代码来源:TimeImpl.java

示例3: getValue

import net.opengis.IDateTime; //导入依赖的package包/类
/**
 * Gets the value property
 */
@Override
public IDateTime[] getValue()
{
    if (dataBlock == null)
        return null;
    tmpValue[0] = new DateTimeDouble(dataBlock.getDoubleValue(0));
    tmpValue[1] = new DateTimeDouble(dataBlock.getDoubleValue(1));
    return tmpValue;
}
 
开发者ID:sensiasoft,项目名称:lib-swe-common,代码行数:13,代码来源:TimeRangeImpl.java

示例4: setValue

import net.opengis.IDateTime; //导入依赖的package包/类
/**
 * Sets the value property
 */
@Override
public void setValue(IDateTime[] value)
{
    Asserts.checkNotNull(value, "value");
    if (dataBlock == null)
        assignNewDataBlock();
    dataBlock.setDoubleValue(0, value[0].getAsDouble());
    dataBlock.setDoubleValue(1, value[1].getAsDouble());
}
 
开发者ID:sensiasoft,项目名称:lib-swe-common,代码行数:13,代码来源:TimeRangeImpl.java

示例5: validateData

import net.opengis.IDateTime; //导入依赖的package包/类
@Override
public void validateData(List<ValidationException> errorList)
{
    if (isSetConstraint())
    {
        AllowedTimesImpl constraint = (AllowedTimesImpl)getConstraint();
        IDateTime[] val = getValue();
        
        if (!constraint.isValid(val[0]) || !constraint.isValid(val[1]))
        {
            String minText, maxText;                
            if (isIsoTime())
            {
                DateTimeFormat isoFormat = new DateTimeFormat();
                minText = isoFormat.formatIso(dataBlock.getDoubleValue(0), 0);
                maxText = isoFormat.formatIso(dataBlock.getDoubleValue(1), 0);
            }
            else
            {
                minText = dataBlock.getStringValue(0);
                maxText = dataBlock.getStringValue(1);
            }
            
            errorList.add(new ValidationException(getName(), "Value '[" + minText + " " + maxText + "]" +
                    "' is not valid for component '" + getName() + "': " + constraint.getAssertionMessage()));
        }
    }        
}
 
开发者ID:sensiasoft,项目名称:lib-swe-common,代码行数:29,代码来源:TimeRangeImpl.java

示例6: copy

import net.opengis.IDateTime; //导入依赖的package包/类
@Override
public AllowedTimesImpl copy()
{
    AllowedTimesImpl newObj = new AllowedTimesImpl();
    for (IDateTime val: valueList)
        newObj.valueList.add(val);
    for (IDateTime[] interval: intervalList)
        newObj.intervalList.add(new IDateTime[]{interval[0], interval[1]});
    newObj.significantFigures = significantFigures;
    return newObj;
}
 
开发者ID:sensiasoft,项目名称:lib-swe-common,代码行数:12,代码来源:AllowedTimesImpl.java

示例7: isValid

import net.opengis.IDateTime; //导入依赖的package包/类
public boolean isValid(IDateTime value)
{
    for (IDateTime allowedValue: valueList)
        if (allowedValue.equals(value))
            return true;
    
    for (IDateTime[] allowedRange: intervalList)
        if (value.isAfter(allowedRange[0]) && value.isBefore(allowedRange[1]))
            return true;
    
    return false;
}
 
开发者ID:sensiasoft,项目名称:lib-swe-common,代码行数:13,代码来源:AllowedTimesImpl.java

示例8: readCIDateTypeElements

import net.opengis.IDateTime; //导入依赖的package包/类
/**
 * Reads elements of CIDateType complex type
 */
public void readCIDateTypeElements(XMLStreamReader reader, CIDate bean) throws XMLStreamException
{
    boolean found;
    
    // date
    found = checkElementName(reader, "date");
    if (found)
    {
        reader.nextTag();
        String localName = reader.getName().getLocalPart();
        
        if (localName.equals("DateTime"))
        {
            IDateTime date = ns1Bindings.readDateTime(reader);
            bean.setDate(date);
        }
        else
            throw new XMLStreamException(ERROR_INVALID_ELT + reader.getName() + errorLocationString(reader));
        
        reader.nextTag();
        reader.nextTag();
    }
    
    // dateType
    found = checkElementName(reader, "dateType");
    if (found)
    {
        reader.nextTag();
        CodeListValue dateType = this.readCIDateTypeCode(reader);
        if (dateType != null)
            bean.setDateType(dateType);
        
        reader.nextTag(); // end property tag
        reader.nextTag();
    }
}
 
开发者ID:sensiasoft,项目名称:lib-sensorml,代码行数:40,代码来源:XMLStreamBindings.java

示例9: readDateTime

import net.opengis.IDateTime; //导入依赖的package包/类
/**
 * Read method for Date elements
 */
public IDateTime readDateTime(XMLStreamReader reader) throws XMLStreamException
{
    boolean found = checkElementName(reader, "Date");
    if (!found)
        throw new XMLStreamException(ERROR_INVALID_ELT + reader.getName() + errorLocationString(reader));
    
    String val = reader.getElementText();
    return getDateTimeFromString(val);
}
 
开发者ID:sensiasoft,项目名称:lib-sensorml,代码行数:13,代码来源:XMLStreamBindings.java

示例10: writeDateTime

import net.opengis.IDateTime; //导入依赖的package包/类
/**
 * Write method for Date element
 */
public void writeDateTime(XMLStreamWriter writer, IDateTime bean) throws XMLStreamException
{
    writer.writeStartElement(NS_URI, "Date");
    this.writeNamespaces(writer);
    writer.writeCharacters(getStringValue(bean));
    writer.writeEndElement();
}
 
开发者ID:sensiasoft,项目名称:lib-sensorml,代码行数:11,代码来源:XMLStreamBindings.java

示例11: readTMPeriodDuration

import net.opengis.IDateTime; //导入依赖的package包/类
/**
 * Read method for GTS TM_PeriodDuration elements
 */
public IDateTime readTMPeriodDuration(XMLStreamReader reader) throws XMLStreamException
{
    boolean found = checkElementName(reader, "TM_PeriodDuration");
    if (!found)
        throw new XMLStreamException(ERROR_INVALID_ELT + reader.getName() + errorLocationString(reader));
    
    // TODO read xsd duration token for TM_PeriodDuration
    return null;
}
 
开发者ID:sensiasoft,项目名称:lib-sensorml,代码行数:13,代码来源:XMLStreamBindings.java

示例12: writeTMPeriodDuration

import net.opengis.IDateTime; //导入依赖的package包/类
/**
 * Write method for GTS TM_PeriodDuration element
 */
public void writeTMPeriodDuration(XMLStreamWriter writer, IDateTime bean) throws XMLStreamException
{
    writer.writeStartElement("http://www.isotc211.org/2005/gts", "TM_PeriodDuration");
    this.writeNamespaces(writer);
    // TODO write xsd duration token for TM_PeriodDuration
    writer.writeEndElement();
}
 
开发者ID:sensiasoft,项目名称:lib-sensorml,代码行数:11,代码来源:XMLStreamBindings.java

示例13: testStoreAndGetSensorMLByTime

import net.opengis.IDateTime; //导入依赖的package包/类
@Test
public void testStoreAndGetSensorMLByTime() throws Exception
{
    SMLUtils smlUtils = new SMLUtils(SMLUtils.V2_0);
    InputStream is;
            
    // load SensorML doc and set first validity period
    is = new BufferedInputStream(getClass().getResourceAsStream("/gamma2070_more.xml"));
    AbstractProcess smlIn1 = smlUtils.readProcess(is);
    IDateTime begin1 = new DateTimeDouble(new DateTimeFormat().parseIso("2010-05-15Z"));
    ((TimePeriod)smlIn1.getValidTimeList().get(0)).getBeginPosition().setDateTimeValue(begin1);
    IDateTime end1 = new DateTimeDouble(new DateTimeFormat().parseIso("2010-09-23Z"));
    ((TimePeriod)smlIn1.getValidTimeList().get(0)).getEndPosition().setDateTimeValue(end1);
    storage.storeDataSourceDescription(smlIn1);
    forceReadBackFromStorage();
    
    AbstractProcess smlOut = storage.getLatestDataSourceDescription();
    TestUtils.assertEquals(smlIn1, smlOut);
    
    smlOut = storage.getDataSourceDescriptionAtTime(begin1.getAsDouble());
    TestUtils.assertEquals(smlIn1, smlOut);
    
    smlOut = storage.getDataSourceDescriptionAtTime(end1.getAsDouble());
    TestUtils.assertEquals(smlIn1, smlOut);
    
    smlOut = storage.getDataSourceDescriptionAtTime(begin1.getAsDouble() + 3600*24*10);
    TestUtils.assertEquals(smlIn1, smlOut);
    
    // load SensorML doc another time and set with a different validity period
    is = new BufferedInputStream(getClass().getResourceAsStream("/gamma2070_more.xml"));
    AbstractProcess smlIn2 = smlUtils.readProcess(is);
    IDateTime begin2 = new DateTimeDouble(new DateTimeFormat().parseIso("2010-09-24Z"));
    ((TimePeriod)smlIn2.getValidTimeList().get(0)).getBeginPosition().setDateTimeValue(begin2);
    IDateTime end2 = new DateTimeDouble(new DateTimeFormat().parseIso("2010-12-08Z"));
    ((TimePeriod)smlIn2.getValidTimeList().get(0)).getEndPosition().setDateTimeValue(end2);
    storage.storeDataSourceDescription(smlIn2);        
    forceReadBackFromStorage();
    
    smlOut = storage.getDataSourceDescriptionAtTime(begin1.getAsDouble());
    TestUtils.assertEquals(smlIn1, smlOut);
    
    smlOut = storage.getDataSourceDescriptionAtTime(end1.getAsDouble());
    TestUtils.assertEquals(smlIn1, smlOut);
    
    smlOut = storage.getDataSourceDescriptionAtTime(begin1.getAsDouble() + 3600*24*10);
    TestUtils.assertEquals(smlIn1, smlOut);
    
    smlOut = storage.getDataSourceDescriptionAtTime(begin2.getAsDouble());
    TestUtils.assertEquals(smlIn2, smlOut);
    
    smlOut = storage.getDataSourceDescriptionAtTime(end2.getAsDouble());
    TestUtils.assertEquals(smlIn2, smlOut);
    
    smlOut = storage.getDataSourceDescriptionAtTime(begin2.getAsDouble() + 3600*24*10);
    TestUtils.assertEquals(smlIn2, smlOut);
}
 
开发者ID:sensiasoft,项目名称:sensorhub,代码行数:57,代码来源:AbstractTestBasicStorage.java

示例14: newTimePosition

import net.opengis.IDateTime; //导入依赖的package包/类
public final TimePosition newTimePosition(IDateTime dateTime)
{
    TimePosition timePos = newTimePosition();
    timePos.setDateTimeValue(dateTime);
    return timePos;
}
 
开发者ID:sensiasoft,项目名称:lib-swe-common,代码行数:7,代码来源:GMLFactory.java

示例15: getDateTimeValue

import net.opengis.IDateTime; //导入依赖的package包/类
@Override
public IDateTime getDateTimeValue()
{
    return dateTimeValue;
}
 
开发者ID:sensiasoft,项目名称:lib-swe-common,代码行数:6,代码来源:TimePositionImpl.java


注:本文中的net.opengis.IDateTime类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。