當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。