1 11 package com.hp.hpl.jena.datatypes.xsd.impl; 12 13 import com.hp.hpl.jena.datatypes.xsd.AbstractDateTime; 14 import com.hp.hpl.jena.datatypes.xsd.XSDDateTime; 15 16 23 public class XSDYearType extends XSDAbstractDateTimeType { 24 25 28 public XSDYearType(String typename) { 29 super(typename); 30 } 31 32 37 public Object parseValidated(String str) { 38 int len = str.length(); 39 int[] date = new int[TOTAL_SIZE]; 40 int[] timeZone = new int[2]; 41 42 int start = 0; 44 if (str.charAt(0)=='-') { 45 start = 1; 46 } 47 int sign = findUTCSign(str, start, len); 48 if (sign == -1) { 49 date[CY]=parseIntYear(str, len); 50 } 51 else { 52 date[CY]=parseIntYear(str, sign); 53 getTimeZone (str, date, sign, len, timeZone); 54 } 55 56 date[M]=MONTH; 58 date[D]=1; 59 60 if ( date[utc]!=0 && date[utc]!='Z' ) { 61 AbstractDateTime.normalize(date, timeZone); 62 } 63 64 return new XSDDateTime(date, YEAR_MASK ); 65 } 66 67 } 68 69 70 71 100 | Popular Tags |