MCPcopy Create free account
hub / github.com/BaseXdb/basex / toTime

Method toTime

basex-core/src/main/java/org/basex/core/jobs/QueryJob.java:121–132  ·  view source on GitHub ↗

Converts the specified start/end time to an item. @param string start (integer, dayTimeDuration, dateTime, time); can be null @param info input info (can be null) @return item or null @throws QueryException query exception

(final String string, final InputInfo info)

Source from the content-addressed store, hash-verified

119 * @throws QueryException query exception
120 */
121 public static Item toTime(final String string, final InputInfo info) throws QueryException {
122 // undefined
123 if(string == null || string.isEmpty()) return null;
124 // integer
125 if(string.matches("^\\d+$")) return Itr.get(Itr.parse(token(string), info));
126 // dayTimeDuration
127 if(Dur.DTD.matcher(string).matches()) return new DTDur(token(string), info);
128 // time
129 if(ADate.TIME.matcher(string).matches()) return new Tim(token(string), info);
130 // dateTime
131 return new Dtm(token(string), BasicType.DATE_TIME, info);
132 }
133
134 /**
135 * Returns the bindings for a query.

Callers 1

QueryJobMethod · 0.95

Calls 6

getMethod · 0.95
parseMethod · 0.95
tokenMethod · 0.65
isEmptyMethod · 0.45
matchesMethod · 0.45
matcherMethod · 0.45

Tested by

no test coverage detected