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


Java XMLGregorianCalendar.toGregorianCalendar方法代码示例

本文整理汇总了Java中javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar方法的典型用法代码示例。如果您正苦于以下问题:Java XMLGregorianCalendar.toGregorianCalendar方法的具体用法?Java XMLGregorianCalendar.toGregorianCalendar怎么用?Java XMLGregorianCalendar.toGregorianCalendar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.datatype.XMLGregorianCalendar的用法示例。


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

示例1: insertPlanes

import javax.xml.datatype.XMLGregorianCalendar; //导入方法依赖的package包/类
public static void insertPlanes(int id,String entidad_responsable, String nombre, String descripcion, String detalle, XMLGregorianCalendar fecha_inicio,XMLGregorianCalendar fecha_fin){
 	 Connection conect=conectar();
 String query = " insert into plan (id,entidad_responsable,nombre,descripcion,detalle,fecha_inicio,fecha_fin)"
	        + " values (?,?,?,?,?,?,?)";
try {
	java.sql.Date dtsini=null;
	java.sql.Date dtsfin=null;
	if (fecha_inicio!=null){GregorianCalendar dtini = fecha_inicio.toGregorianCalendar();  dtsini = new java.sql.Date(dtini.getTime().getTime());}
	if (fecha_inicio!=null){GregorianCalendar dtfin = fecha_fin.toGregorianCalendar(); dtsfin = new java.sql.Date(dtfin.getTime().getTime());}
	PreparedStatement preparedStmt;
	preparedStmt = conect.prepareStatement(query);
	preparedStmt.setInt (1, id);
	preparedStmt.setString (2, entidad_responsable);
	preparedStmt.setString (3, nombre);
	preparedStmt.setString (4, descripcion);
	preparedStmt.setString (5, detalle);
	preparedStmt.setDate (6, dtsini);
	preparedStmt.setDate (7, dtsfin);
    preparedStmt.execute();
    conect.close();
} catch (SQLException e) {e.printStackTrace();}
 }
 
开发者ID:stppy,项目名称:spr,代码行数:23,代码来源:SqlHelper.java

示例2: test

import javax.xml.datatype.XMLGregorianCalendar; //导入方法依赖的package包/类
@Test
public void test() throws DatatypeConfigurationException {
    XMLGregorianCalendar xmlCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(1970, 1, 1, 0, 0, 0, 0, 0);
    GregorianCalendar calendar = xmlCalendar.toGregorianCalendar();
    int firstDayOfWeek = calendar.getFirstDayOfWeek();
    Calendar defaultCalendar = Calendar.getInstance();
    int defaultFirstDayOfWeek = defaultCalendar.getFirstDayOfWeek();
    if (firstDayOfWeek != defaultFirstDayOfWeek) {
        Assert.fail("Failed firstDayOfWeek=" + firstDayOfWeek + " != defaultFirstDayOfWeek=" + defaultFirstDayOfWeek);
    } else {
        System.out.println("Success firstDayOfWeek=" + firstDayOfWeek + " == defaultFirstDayOfWeek=" + defaultFirstDayOfWeek);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:Bug7042647Test.java

示例3: initMetaData

import javax.xml.datatype.XMLGregorianCalendar; //导入方法依赖的package包/类
/**
 * 
 */
public void initMetaData(){
	try {
		super.type="S1";
		super.antennaPointing="Right";
		super.setPixelTimeOrderingAscending(true);//IS K in the matlab code!!
		
		
		ImageInformationType imgInformation =annotationReader.getImageInformation();
		
		XMLGregorianCalendar  firstLineUtc=imgInformation.getProductFirstLineUtcTime();
		XMLGregorianCalendar  lastLineUtc=imgInformation.getProductLastLineUtcTime();
		
		this.productType=annotationReader.getHeader().getProductType().name();

		//pixel size in range and azimuth direction 
		super.samplePixelSpacing=imgInformation.getRangePixelSpacing().getValue();
		super.azimuthPixelSpacing=imgInformation.getAzimuthPixelSpacing().getValue();
		
		super.mode=annotationReader.getHeader().getMode().name();
		linesPerBurst=annotationReader.getBurstInformation().getLinePerBust();
		azimuthTimeInterval= imgInformation.getAzimuthTimeInterval().getValue();
		
		zeroDopplerTimeFirstLineSeconds=firstLineUtc.toGregorianCalendar();
		zeroDopplerTimeLastLineSeconds=lastLineUtc.toGregorianCalendar();
		
		nLines=imgInformation.getNumberOfLines().getValue().intValue();
		
		List<OrbitType>  orbits=annotationReader.getOrbits();
		
		orbitStatePosVelox=new ArrayList<S1Metadata.OrbitStatePosVelox>();
		
		for(OrbitType ot:orbits){
			OrbitStatePosVelox pv=new OrbitStatePosVelox();
			pv.px=ot.getPosition().getX().getValue();
			pv.py=ot.getPosition().getY().getValue();
			pv.pz=ot.getPosition().getZ().getValue();
			
			pv.vx=ot.getVelocity().getX().getValue();
			pv.vy=ot.getVelocity().getY().getValue();
			pv.vz=ot.getVelocity().getZ().getValue();
			
			GregorianCalendar gc=ot.getTime().toGregorianCalendar();
			pv.time=gc.getTimeInMillis()/1000.0;
			pv.timeStampInitSeconds=getSecondInDay(gc);//minutes*60+gc.get(GregorianCalendar.SECOND)+(gc.get(GregorianCalendar.MILLISECOND)/1000.0);
			orbitStatePosVelox.add(pv);
		}
		
		List<CoordinateConversionType> cConversion=annotationReader.getCoordinateConversionData();
		coordinateConversion=new S1Metadata.CoordinateConversion[cConversion.size()];
		int i=0; 
		for(CoordinateConversionType ccType:cConversion){
			CoordinateConversion cc=new CoordinateConversion();
			String[] vals=ccType.getGrsrCoefficients().getValue().split(" ");
			cc.groundToSlantRangeCoefficients=convertFromStringArray(vals);
			cc.groundToSlantRangeOrigin=ccType.getGr0().getValue();
			
			vals=ccType.getSrgrCoefficients().getValue().split(" ");
			cc.slantToGroundRangeCoefficients=convertFromStringArray(vals);
			cc.groundToSlantRangeOrigin=ccType.getSr0().getValue();
			coordinateConversion[i]=cc;
			XMLGregorianCalendar xmlGc=ccType.getAzimuthTime();
			cc.azimuthTime=xmlGc.toGregorianCalendar().getTimeInMillis();
			cc.groundToSlantRangePolyTimesSeconds=getSecondInDay(xmlGc.toGregorianCalendar());//minutes*60+xmlGc.getSecond()+(xmlGc.getMillisecond()/1000.0);
			i++;
		}
		//PRF and PRF mean
		//List<DownlinkInformationType> links=annotationReader.getDownLinkInformationList();
		/*for(DownlinkInformationType info:links){
			samplingf+=info.getPrf().getValue();
		}
		samplingf=samplingf/links.size();*/
		samplingf=7000/annotationReader.getImageInformation().getAzimuthPixelSpacing().getValue();
		numberOfSamplesPerLine=annotationReader.getImageInformation().getNumberOfSamples().getValue().doubleValue();
	} catch (Exception e) {
		e.printStackTrace();
	}	
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:81,代码来源:S1Metadata.java

示例4: checkToGregorianCalendar02

import javax.xml.datatype.XMLGregorianCalendar; //导入方法依赖的package包/类
@Test
public void checkToGregorianCalendar02() {

    XMLGregorianCalendar calendar = datatypeFactory.newXMLGregorianCalendar("2004-05-19T12:00:00+06:00");
    calendar.toGregorianCalendar(TimeZone.getDefault(), Locale.getDefault(), null);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:XMLGregorianCalendarTest.java

示例5: checkToGregorianCalendar01

import javax.xml.datatype.XMLGregorianCalendar; //导入方法依赖的package包/类
@Test
public void checkToGregorianCalendar01() {

    XMLGregorianCalendar time_16_17_18 = datatypeFactory.newXMLGregorianCalendar("16:17:18");
    XMLGregorianCalendar date_2001_02_03 = datatypeFactory.newXMLGregorianCalendar("2001-02-03");
    GregorianCalendar calendar = date_2001_02_03.toGregorianCalendar(null, null, time_16_17_18);

    int year = calendar.get(YEAR);
    int minute = calendar.get(MINUTE);

    assertTrue((year == 2001 && minute == 17), " expecting year == 2001, minute == 17" + ", result is year == " + year + ", minute == " + minute);


    calendar = time_16_17_18.toGregorianCalendar(null, null, date_2001_02_03);

    year = calendar.get(YEAR);
    minute = calendar.get(MINUTE);

    assertTrue((year == 2001 && minute == 17), " expecting year == 2001, minute == 17" + ", result is year == " + year + ", minute == " + minute);


    date_2001_02_03.setMinute(3);
    date_2001_02_03.setYear(null);

    XMLGregorianCalendar date_time = datatypeFactory.newXMLGregorianCalendar("2003-04-11T02:13:01Z");

    calendar = date_2001_02_03.toGregorianCalendar(null, null, date_time);

    year = calendar.get(YEAR);
    minute = calendar.get(MINUTE);
    int hour = calendar.get(HOUR);

    assertTrue((year == 2003 && hour == 2 && minute == 3), " expecting year == 2003, hour == 2, minute == 3" + ", result is year == " + year + ", hour == " + hour + ", minute == " + minute);


}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:XMLGregorianCalendarTest.java


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