idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
144,600
@ SuppressWarnings ( "unchecked" ) private static Object resolveConflictWithResolver ( final ConflictHandler conflictResolver , final BsonValue documentId , final ChangeEvent localEvent , final ChangeEvent remoteEvent ) { return conflictResolver . resolveConflict ( documentId , localEvent , remoteEvent ) ; }
Returns the resolution of resolving the conflict between a local and remote event using the given conflict resolver .
69
20
144,601
public void addWatcher ( final MongoNamespace namespace , final Callback < ChangeEvent < BsonDocument > , Object > watcher ) { instanceChangeStreamListener . addWatcher ( namespace , watcher ) ; }
Queues up a callback to be removed and invoked on the next change event .
46
16
144,602
public Set < CoreDocumentSynchronizationConfig > getSynchronizedDocuments ( final MongoNamespace namespace ) { this . waitUntilInitialized ( ) ; try { ongoingOperationsGroup . enter ( ) ; return this . syncConfig . getSynchronizedDocuments ( namespace ) ; } finally { ongoingOperationsGroup . exit ( ) ; } }
Returns the set of synchronized documents in a namespace .
71
10
144,603
public Set < BsonValue > getPausedDocumentIds ( final MongoNamespace namespace ) { this . waitUntilInitialized ( ) ; try { ongoingOperationsGroup . enter ( ) ; final Set < BsonValue > pausedDocumentIds = new HashSet <> ( ) ; for ( final CoreDocumentSynchronizationConfig config : this . syncConfig . getSynchronizedDocuments ( namespace ) ) { if ( config . isPaused ( ) ) { pausedDocumentIds . add ( config . getDocumentId ( ) ) ; } } return pausedDocumentIds ; } finally { ongoingOperationsGroup . exit ( ) ; } }
Return the set of synchronized document _ids in a namespace that have been paused due to an irrecoverable error .
135
23
144,604
boolean resumeSyncForDocument ( final MongoNamespace namespace , final BsonValue documentId ) { if ( namespace == null || documentId == null ) { return false ; } final NamespaceSynchronizationConfig namespaceSynchronizationConfig ; final CoreDocumentSynchronizationConfig config ; if ( ( namespaceSynchronizationConfig = syncConfig . getNamespaceConfig ( namespace ) ) == null || ( config = namespaceSynchronizationConfig . getSynchronizedDocument ( documentId ) ) == null ) { return false ; } config . setPaused ( false ) ; return ! config . isPaused ( ) ; }
A document that is paused no longer has remote updates applied to it . Any local updates to this document cause it to be resumed . An example of pausing a document is when a conflict is being resolved for that document and the handler throws an exception .
129
50
144,605
void insertOne ( final MongoNamespace namespace , final BsonDocument document ) { this . waitUntilInitialized ( ) ; try { ongoingOperationsGroup . enter ( ) ; // Remove forbidden fields from the document before inserting it into the local collection. final BsonDocument docForStorage = sanitizeDocument ( document ) ; final NamespaceSynchronizationConfig nsConfig = this . syncConfig . getNamespaceConfig ( namespace ) ; final Lock lock = nsConfig . getLock ( ) . writeLock ( ) ; lock . lock ( ) ; final ChangeEvent < BsonDocument > event ; final BsonValue documentId ; try { getLocalCollection ( namespace ) . insertOne ( docForStorage ) ; documentId = BsonUtils . getDocumentId ( docForStorage ) ; event = ChangeEvents . changeEventForLocalInsert ( namespace , docForStorage , true ) ; final CoreDocumentSynchronizationConfig config = syncConfig . addAndGetSynchronizedDocument ( namespace , documentId ) ; config . setSomePendingWritesAndSave ( logicalT , event ) ; } finally { lock . unlock ( ) ; } checkAndInsertNamespaceListener ( namespace ) ; eventDispatcher . emitEvent ( nsConfig , event ) ; } finally { ongoingOperationsGroup . exit ( ) ; } }
Inserts a single document locally and being to synchronize it based on its _id . Inserting a document with the same _id twice will result in a duplicate key exception .
275
36
144,606
DeleteResult deleteMany ( final MongoNamespace namespace , final Bson filter ) { this . waitUntilInitialized ( ) ; try { ongoingOperationsGroup . enter ( ) ; final List < ChangeEvent < BsonDocument > > eventsToEmit = new ArrayList <> ( ) ; final DeleteResult result ; final NamespaceSynchronizationConfig nsConfig = this . syncConfig . getNamespaceConfig ( namespace ) ; final Lock lock = nsConfig . getLock ( ) . writeLock ( ) ; lock . lock ( ) ; try { final MongoCollection < BsonDocument > localCollection = getLocalCollection ( namespace ) ; final MongoCollection < BsonDocument > undoCollection = getUndoCollection ( namespace ) ; final Set < BsonValue > idsToDelete = localCollection . find ( filter ) . map ( new Function < BsonDocument , BsonValue > ( ) { @ Override @ NonNull public BsonValue apply ( @ NonNull final BsonDocument bsonDocument ) { undoCollection . insertOne ( bsonDocument ) ; return BsonUtils . getDocumentId ( bsonDocument ) ; } } ) . into ( new HashSet <> ( ) ) ; result = localCollection . deleteMany ( filter ) ; for ( final BsonValue documentId : idsToDelete ) { final CoreDocumentSynchronizationConfig config = syncConfig . getSynchronizedDocument ( namespace , documentId ) ; if ( config == null ) { continue ; } final ChangeEvent < BsonDocument > event = ChangeEvents . changeEventForLocalDelete ( namespace , documentId , true ) ; // this block is to trigger coalescence for a delete after insert if ( config . getLastUncommittedChangeEvent ( ) != null && config . getLastUncommittedChangeEvent ( ) . getOperationType ( ) == OperationType . INSERT ) { desyncDocumentsFromRemote ( nsConfig , config . getDocumentId ( ) ) . commitAndClear ( ) ; undoCollection . deleteOne ( getDocumentIdFilter ( documentId ) ) ; continue ; } config . setSomePendingWritesAndSave ( logicalT , event ) ; undoCollection . deleteOne ( getDocumentIdFilter ( documentId ) ) ; eventsToEmit . add ( event ) ; } checkAndDeleteNamespaceListener ( namespace ) ; } finally { lock . unlock ( ) ; } for ( final ChangeEvent < BsonDocument > event : eventsToEmit ) { eventDispatcher . emitEvent ( nsConfig , event ) ; } return result ; } finally { ongoingOperationsGroup . exit ( ) ; } }
Removes all documents from the collection that match the given query filter . If no documents match the collection is not modified .
549
24
144,607
MongoCollection < BsonDocument > getUndoCollection ( final MongoNamespace namespace ) { return localClient . getDatabase ( String . format ( "sync_undo_%s" , namespace . getDatabaseName ( ) ) ) . getCollection ( namespace . getCollectionName ( ) , BsonDocument . class ) . withCodecRegistry ( MongoClientSettings . getDefaultCodecRegistry ( ) ) ; }
Returns the undo collection representing the given namespace for recording documents that may need to be reverted after a system failure .
89
22
144,608
private < T > MongoCollection < T > getLocalCollection ( final MongoNamespace namespace , final Class < T > resultClass , final CodecRegistry codecRegistry ) { return localClient . getDatabase ( String . format ( "sync_user_%s" , namespace . getDatabaseName ( ) ) ) . getCollection ( namespace . getCollectionName ( ) , resultClass ) . withCodecRegistry ( codecRegistry ) ; }
Returns the local collection representing the given namespace .
93
9
144,609
MongoCollection < BsonDocument > getLocalCollection ( final MongoNamespace namespace ) { return getLocalCollection ( namespace , BsonDocument . class , MongoClientSettings . getDefaultCodecRegistry ( ) ) ; }
Returns the local collection representing the given namespace for raw document operations .
47
13
144,610
private < T > CoreRemoteMongoCollection < T > getRemoteCollection ( final MongoNamespace namespace , final Class < T > resultClass ) { return remoteClient . getDatabase ( namespace . getDatabaseName ( ) ) . getCollection ( namespace . getCollectionName ( ) , resultClass ) ; }
Returns the remote collection representing the given namespace .
63
9
144,611
static BsonDocument sanitizeDocument ( final BsonDocument document ) { if ( document == null ) { return null ; } if ( document . containsKey ( DOCUMENT_VERSION_FIELD ) ) { final BsonDocument clonedDoc = document . clone ( ) ; clonedDoc . remove ( DOCUMENT_VERSION_FIELD ) ; return clonedDoc ; } return document ; }
Given a BSON document remove any forbidden fields and return the document . If no changes are made the original document reference is returned . If changes are made a cloned copy of the document with the changes will be returned .
83
44
144,612
private static BsonDocument withNewVersion ( final BsonDocument document , final BsonDocument newVersion ) { final BsonDocument newDocument = BsonUtils . copyOfDocument ( document ) ; newDocument . put ( DOCUMENT_VERSION_FIELD , newVersion ) ; return newDocument ; }
Adds and returns a document with a new version to the given document .
64
14
144,613
public static void clearallLocalDBs ( ) { for ( final Map . Entry < MongoClient , Boolean > entry : localInstances . entrySet ( ) ) { for ( final String dbName : entry . getKey ( ) . listDatabaseNames ( ) ) { entry . getKey ( ) . getDatabase ( dbName ) . drop ( ) ; } } }
Helper function that drops all local databases for every client .
77
11
144,614
public StitchObjectMapper withCodecRegistry ( final CodecRegistry codecRegistry ) { // We can't detect if their codecRegistry has any duplicate providers. There's also a chance // that putting ours first may prevent decoding of some of their classes if for example they // have their own way of decoding an Integer. final CodecRegistry newReg = CodecRegistries . fromRegistries ( BsonUtils . DEFAULT_CODEC_REGISTRY , codecRegistry ) ; return new StitchObjectMapper ( this , newReg ) ; }
Applies the given codec registry to be used alongside the default codec registry .
119
15
144,615
public StitchEvent < T > nextEvent ( ) throws IOException { final Event nextEvent = eventStream . nextEvent ( ) ; if ( nextEvent == null ) { return null ; } return StitchEvent . fromEvent ( nextEvent , this . decoder ) ; }
Fetch the next event from a given stream
58
9
144,616
@ Nullable public StitchUserT getUser ( ) { authLock . readLock ( ) . lock ( ) ; try { return activeUser ; } finally { authLock . readLock ( ) . unlock ( ) ; } }
Returns the active logged in user .
48
7
144,617
private synchronized Response doAuthenticatedRequest ( final StitchAuthRequest stitchReq , final AuthInfo authInfo ) { try { return requestClient . doRequest ( prepareAuthRequest ( stitchReq , authInfo ) ) ; } catch ( final StitchServiceException ex ) { return handleAuthFailure ( ex , stitchReq ) ; } }
Internal method which performs the authenticated request by preparing the auth request with the provided auth info and request .
71
20
144,618
private void tryRefreshAccessToken ( final Long reqStartedAt ) { authLock . writeLock ( ) . lock ( ) ; try { if ( ! isLoggedIn ( ) ) { throw new StitchClientException ( StitchClientErrorCode . LOGGED_OUT_DURING_REQUEST ) ; } try { final Jwt jwt = Jwt . fromEncoded ( getAuthInfo ( ) . getAccessToken ( ) ) ; if ( jwt . getIssuedAt ( ) >= reqStartedAt ) { return ; } } catch ( final IOException e ) { // Swallow } // retry refreshAccessToken ( ) ; } finally { authLock . writeLock ( ) . unlock ( ) ; } }
prevent too many refreshes happening one after the other .
157
12
144,619
private StitchUserT doLogin ( final StitchCredential credential , final boolean asLinkRequest ) { final Response response = doLoginRequest ( credential , asLinkRequest ) ; final StitchUserT previousUser = activeUser ; final StitchUserT user = processLoginResponse ( credential , response , asLinkRequest ) ; if ( asLinkRequest ) { onUserLinked ( user ) ; } else { onUserLoggedIn ( user ) ; onActiveUserChanged ( activeUser , previousUser ) ; } return user ; }
callers of doLogin should be serialized before calling in .
113
13
144,620
private static Interval parseStartExtended ( CharSequence startStr , CharSequence endStr ) { Instant start = Instant . parse ( startStr ) ; if ( endStr . length ( ) > 0 ) { char c = endStr . charAt ( 0 ) ; if ( c == ' ' || c == ' ' ) { PeriodDuration amount = PeriodDuration . parse ( endStr ) ; // addition of PeriodDuration only supported by OffsetDateTime, // but to make that work need to move point being added to closer to EPOCH long move = start . isBefore ( Instant . EPOCH ) ? 1000 * 86400 : - 1000 * 86400 ; Instant end = start . plusSeconds ( move ) . atOffset ( ZoneOffset . UTC ) . plus ( amount ) . toInstant ( ) . minusSeconds ( move ) ; return Interval . of ( start , end ) ; } } // infer offset from start if not specified by end return parseEndDateTime ( start , ZoneOffset . UTC , endStr ) ; }
handle case where Instant is outside the bounds of OffsetDateTime
221
13
144,621
private static Interval parseEndDateTime ( Instant start , ZoneOffset offset , CharSequence endStr ) { try { TemporalAccessor temporal = DateTimeFormatter . ISO_DATE_TIME . parseBest ( endStr , OffsetDateTime :: from , LocalDateTime :: from ) ; if ( temporal instanceof OffsetDateTime ) { OffsetDateTime odt = ( OffsetDateTime ) temporal ; return Interval . of ( start , odt . toInstant ( ) ) ; } else { // infer offset from start if not specified by end LocalDateTime ldt = ( LocalDateTime ) temporal ; return Interval . of ( start , ldt . toInstant ( offset ) ) ; } } catch ( DateTimeParseException ex ) { Instant end = Instant . parse ( endStr ) ; return Interval . of ( start , end ) ; } }
parse when there are two date - times
186
8
144,622
@ Override public AccountingDate date ( int prolepticYear , int month , int dayOfMonth ) { return AccountingDate . of ( this , prolepticYear , month , dayOfMonth ) ; }
Obtains a local date in Accounting calendar system from the proleptic - year month - of - year and day - of - month fields .
44
29
144,623
@ Override public AccountingDate dateYearDay ( Era era , int yearOfEra , int dayOfYear ) { return dateYearDay ( prolepticYear ( era , yearOfEra ) , dayOfYear ) ; }
Obtains a local date in Accounting calendar system from the era year - of - era and day - of - year fields .
49
25
144,624
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoLocalDateTime < AccountingDate > localDateTime ( TemporalAccessor temporal ) { return ( ChronoLocalDateTime < AccountingDate > ) super . localDateTime ( temporal ) ; }
Obtains a Accounting local date - time from another date - time object .
58
15
144,625
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoZonedDateTime < AccountingDate > zonedDateTime ( TemporalAccessor temporal ) { return ( ChronoZonedDateTime < AccountingDate > ) super . zonedDateTime ( temporal ) ; }
Obtains a Accounting zoned date - time from another date - time object .
62
16
144,626
@ Override public CopticDate date ( int prolepticYear , int month , int dayOfMonth ) { return CopticDate . of ( prolepticYear , month , dayOfMonth ) ; }
Obtains a local date in Coptic calendar system from the proleptic - year month - of - year and day - of - month fields .
44
30
144,627
@ Override public CopticDate dateYearDay ( Era era , int yearOfEra , int dayOfYear ) { return dateYearDay ( prolepticYear ( era , yearOfEra ) , dayOfYear ) ; }
Obtains a local date in Coptic calendar system from the era year - of - era and day - of - year fields .
50
26
144,628
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoLocalDateTime < CopticDate > localDateTime ( TemporalAccessor temporal ) { return ( ChronoLocalDateTime < CopticDate > ) super . localDateTime ( temporal ) ; }
Obtains a Coptic local date - time from another date - time object .
60
16
144,629
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoZonedDateTime < CopticDate > zonedDateTime ( TemporalAccessor temporal ) { return ( ChronoZonedDateTime < CopticDate > ) super . zonedDateTime ( temporal ) ; }
Obtains a Coptic zoned date - time from another date - time object .
64
17
144,630
private YearQuarter with ( int newYear , Quarter newQuarter ) { if ( year == newYear && quarter == newQuarter ) { return this ; } return new YearQuarter ( newYear , newQuarter ) ; }
Returns a copy of this year - quarter with the new year and quarter checking to see if a new object is in fact required .
49
26
144,631
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoLocalDateTime < BritishCutoverDate > localDateTime ( TemporalAccessor temporal ) { return ( ChronoLocalDateTime < BritishCutoverDate > ) super . localDateTime ( temporal ) ; }
Obtains a British Cutover local date - time from another date - time object .
62
17
144,632
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoZonedDateTime < BritishCutoverDate > zonedDateTime ( TemporalAccessor temporal ) { return ( ChronoZonedDateTime < BritishCutoverDate > ) super . zonedDateTime ( temporal ) ; }
Obtains a British Cutover zoned date - time from another date - time object .
66
18
144,633
private static int weekRange ( int weekBasedYear ) { LocalDate date = LocalDate . of ( weekBasedYear , 1 , 1 ) ; // 53 weeks if year starts on Thursday, or Wed in a leap year if ( date . getDayOfWeek ( ) == THURSDAY || ( date . getDayOfWeek ( ) == WEDNESDAY && date . isLeapYear ( ) ) ) { return 53 ; } return 52 ; }
from IsoFields in ThreeTen - Backport
95
11
144,634
private YearWeek with ( int newYear , int newWeek ) { if ( year == newYear && week == newWeek ) { return this ; } return of ( newYear , newWeek ) ; }
Returns a copy of this year - week with the new year and week checking to see if a new object is in fact required .
42
26
144,635
void register ( long mjDay , int leapAdjustment ) { if ( leapAdjustment != - 1 && leapAdjustment != 1 ) { throw new IllegalArgumentException ( "Leap adjustment must be -1 or 1" ) ; } Data data = dataRef . get ( ) ; int pos = Arrays . binarySearch ( data . dates , mjDay ) ; int currentAdj = pos > 0 ? data . offsets [ pos ] - data . offsets [ pos - 1 ] : 0 ; if ( currentAdj == leapAdjustment ) { return ; // matches previous definition } if ( mjDay <= data . dates [ data . dates . length - 1 ] ) { throw new IllegalArgumentException ( "Date must be after the last configured leap second date" ) ; } long [ ] dates = Arrays . copyOf ( data . dates , data . dates . length + 1 ) ; int [ ] offsets = Arrays . copyOf ( data . offsets , data . offsets . length + 1 ) ; long [ ] taiSeconds = Arrays . copyOf ( data . taiSeconds , data . taiSeconds . length + 1 ) ; int offset = offsets [ offsets . length - 2 ] + leapAdjustment ; dates [ dates . length - 1 ] = mjDay ; offsets [ offsets . length - 1 ] = offset ; taiSeconds [ taiSeconds . length - 1 ] = tai ( mjDay , offset ) ; Data newData = new Data ( dates , offsets , taiSeconds ) ; if ( dataRef . compareAndSet ( data , newData ) == false ) { throw new ConcurrentModificationException ( "Unable to update leap second rules as they have already been updated" ) ; } }
Adds a new leap second to these rules .
374
9
144,636
private static Data loadLeapSeconds ( ) { Data bestData = null ; URL url = null ; try { // this is the new location of the file, working on Java 8, Java 9 class path and Java 9 module path Enumeration < URL > en = Thread . currentThread ( ) . getContextClassLoader ( ) . getResources ( "META-INF/" + LEAP_SECONDS_TXT ) ; while ( en . hasMoreElements ( ) ) { url = en . nextElement ( ) ; Data candidate = loadLeapSeconds ( url ) ; if ( bestData == null || candidate . getNewestDate ( ) > bestData . getNewestDate ( ) ) { bestData = candidate ; } } // this location does not work on Java 9 module path because the resource is encapsulated en = Thread . currentThread ( ) . getContextClassLoader ( ) . getResources ( LEAP_SECONDS_TXT ) ; while ( en . hasMoreElements ( ) ) { url = en . nextElement ( ) ; Data candidate = loadLeapSeconds ( url ) ; if ( bestData == null || candidate . getNewestDate ( ) > bestData . getNewestDate ( ) ) { bestData = candidate ; } } // this location is the canonical one, and class-based loading works on Java 9 module path url = SystemUtcRules . class . getResource ( "/" + LEAP_SECONDS_TXT ) ; if ( url != null ) { Data candidate = loadLeapSeconds ( url ) ; if ( bestData == null || candidate . getNewestDate ( ) > bestData . getNewestDate ( ) ) { bestData = candidate ; } } } catch ( Exception ex ) { throw new RuntimeException ( "Unable to load time-zone rule data: " + url , ex ) ; } if ( bestData == null ) { // no data on classpath, but we allow manual registration of leap seconds // setup basic known data - MJD 1972-01-01 is 41317L, where offset was 10 bestData = new Data ( new long [ ] { 41317L } , new int [ ] { 10 } , new long [ ] { tai ( 41317L , 10 ) } ) ; } return bestData ; }
Loads the rules from files in the class loader often jar files .
494
14
144,637
private static Data loadLeapSeconds ( URL url ) throws ClassNotFoundException , IOException { List < String > lines ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( url . openStream ( ) , StandardCharsets . UTF_8 ) ) ) { lines = reader . lines ( ) . collect ( Collectors . toList ( ) ) ; } List < Long > dates = new ArrayList <> ( ) ; List < Integer > offsets = new ArrayList <> ( ) ; for ( String line : lines ) { line = line . trim ( ) ; if ( line . isEmpty ( ) || line . startsWith ( "#" ) ) { continue ; } Matcher matcher = LEAP_FILE_FORMAT . matcher ( line ) ; if ( matcher . matches ( ) == false ) { throw new StreamCorruptedException ( "Invalid leap second file" ) ; } dates . add ( LocalDate . parse ( matcher . group ( 1 ) ) . getLong ( JulianFields . MODIFIED_JULIAN_DAY ) ) ; offsets . add ( Integer . valueOf ( matcher . group ( 2 ) ) ) ; } long [ ] datesData = new long [ dates . size ( ) ] ; int [ ] offsetsData = new int [ dates . size ( ) ] ; long [ ] taiData = new long [ dates . size ( ) ] ; for ( int i = 0 ; i < datesData . length ; i ++ ) { datesData [ i ] = dates . get ( i ) ; offsetsData [ i ] = offsets . get ( i ) ; taiData [ i ] = tai ( datesData [ i ] , offsetsData [ i ] ) ; } return new Data ( datesData , offsetsData , taiData ) ; }
Loads the leap second rules from a URL often in a jar file .
385
15
144,638
static InternationalFixedDate create ( int prolepticYear , int month , int dayOfMonth ) { YEAR_RANGE . checkValidValue ( prolepticYear , ChronoField . YEAR_OF_ERA ) ; MONTH_OF_YEAR_RANGE . checkValidValue ( month , ChronoField . MONTH_OF_YEAR ) ; DAY_OF_MONTH_RANGE . checkValidValue ( dayOfMonth , ChronoField . DAY_OF_MONTH ) ; if ( dayOfMonth == DAYS_IN_LONG_MONTH && month != 6 && month != MONTHS_IN_YEAR ) { throw new DateTimeException ( "Invalid date: " + prolepticYear + ' ' + month + ' ' + dayOfMonth ) ; } if ( month == 6 && dayOfMonth == DAYS_IN_LONG_MONTH && ! INSTANCE . isLeapYear ( prolepticYear ) ) { throw new DateTimeException ( "Invalid Leap Day as '" + prolepticYear + "' is not a leap year" ) ; } return new InternationalFixedDate ( prolepticYear , month , dayOfMonth ) ; }
Factory method validates the given triplet year month and dayOfMonth .
255
15
144,639
@ Override public JulianDate date ( int prolepticYear , int month , int dayOfMonth ) { return JulianDate . of ( prolepticYear , month , dayOfMonth ) ; }
Obtains a local date in Julian calendar system from the proleptic - year month - of - year and day - of - month fields .
42
29
144,640
@ Override public JulianDate dateYearDay ( Era era , int yearOfEra , int dayOfYear ) { return dateYearDay ( prolepticYear ( era , yearOfEra ) , dayOfYear ) ; }
Obtains a local date in Julian calendar system from the era year - of - era and day - of - year fields .
49
25
144,641
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoLocalDateTime < JulianDate > localDateTime ( TemporalAccessor temporal ) { return ( ChronoLocalDateTime < JulianDate > ) super . localDateTime ( temporal ) ; }
Obtains a Julian local date - time from another date - time object .
58
15
144,642
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoZonedDateTime < JulianDate > zonedDateTime ( TemporalAccessor temporal ) { return ( ChronoZonedDateTime < JulianDate > ) super . zonedDateTime ( temporal ) ; }
Obtains a Julian zoned date - time from another date - time object .
62
16
144,643
@ Override public Symmetry454Date date ( int prolepticYear , int month , int dayOfMonth ) { return Symmetry454Date . of ( prolepticYear , month , dayOfMonth ) ; }
Obtains a local date in Symmetry454 calendar system from the proleptic - year month - of - year and day - of - month fields .
48
32
144,644
@ Override public Symmetry454Date dateYearDay ( Era era , int yearOfEra , int dayOfYear ) { return dateYearDay ( prolepticYear ( era , yearOfEra ) , dayOfYear ) ; }
Obtains a local date in Symmetry454 calendar system from the era year - of - era and day - of - year fields .
52
28
144,645
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoLocalDateTime < Symmetry454Date > localDateTime ( TemporalAccessor temporal ) { return ( ChronoLocalDateTime < Symmetry454Date > ) super . localDateTime ( temporal ) ; }
Obtains a Symmetry454 local date - time from another date - time object .
64
18
144,646
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoZonedDateTime < Symmetry454Date > zonedDateTime ( TemporalAccessor temporal ) { return ( ChronoZonedDateTime < Symmetry454Date > ) super . zonedDateTime ( temporal ) ; }
Obtains a Symmetry454 zoned date - time from another date - time object .
68
19
144,647
@ Override public Symmetry010Date date ( int prolepticYear , int month , int dayOfMonth ) { return Symmetry010Date . of ( prolepticYear , month , dayOfMonth ) ; }
Obtains a local date in Symmetry010 calendar system from the proleptic - year month - of - year and day - of - month fields .
48
32
144,648
@ Override public Symmetry010Date dateYearDay ( Era era , int yearOfEra , int dayOfYear ) { return dateYearDay ( prolepticYear ( era , yearOfEra ) , dayOfYear ) ; }
Obtains a local date in Symmetry010 calendar system from the era year - of - era and day - of - year fields .
52
28
144,649
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoLocalDateTime < Symmetry010Date > localDateTime ( TemporalAccessor temporal ) { return ( ChronoLocalDateTime < Symmetry010Date > ) super . localDateTime ( temporal ) ; }
Obtains a Symmetry010 local date - time from another date - time object .
64
18
144,650
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoZonedDateTime < Symmetry010Date > zonedDateTime ( TemporalAccessor temporal ) { return ( ChronoZonedDateTime < Symmetry010Date > ) super . zonedDateTime ( temporal ) ; }
Obtains a Symmetry010 zoned date - time from another date - time object .
68
19
144,651
@ Override public PaxDate date ( int prolepticYear , int month , int dayOfMonth ) { return PaxDate . of ( prolepticYear , month , dayOfMonth ) ; }
Obtains a local date in Pax calendar system from the proleptic - year month - of - year and day - of - month fields .
42
29
144,652
@ Override public PaxDate dateYearDay ( Era era , int yearOfEra , int dayOfYear ) { return dateYearDay ( prolepticYear ( era , yearOfEra ) , dayOfYear ) ; }
Obtains a local date in Pax calendar system from the era year - of - era and day - of - year fields .
49
25
144,653
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoLocalDateTime < PaxDate > localDateTime ( TemporalAccessor temporal ) { return ( ChronoLocalDateTime < PaxDate > ) super . localDateTime ( temporal ) ; }
Obtains a Pax local date - time from another date - time object .
58
15
144,654
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoZonedDateTime < PaxDate > zonedDateTime ( TemporalAccessor temporal ) { return ( ChronoZonedDateTime < PaxDate > ) super . zonedDateTime ( temporal ) ; }
Obtains a Pax zoned date - time from another date - time object .
62
16
144,655
@ Override public EthiopicDate date ( Era era , int yearOfEra , int month , int dayOfMonth ) { return date ( prolepticYear ( era , yearOfEra ) , month , dayOfMonth ) ; }
Obtains a local date in Ethiopic calendar system from the era year - of - era month - of - year and day - of - month fields .
51
31
144,656
@ Override public EthiopicDate date ( int prolepticYear , int month , int dayOfMonth ) { return EthiopicDate . of ( prolepticYear , month , dayOfMonth ) ; }
Obtains a local date in Ethiopic calendar system from the proleptic - year month - of - year and day - of - month fields .
44
30
144,657
@ Override public EthiopicDate dateYearDay ( Era era , int yearOfEra , int dayOfYear ) { return dateYearDay ( prolepticYear ( era , yearOfEra ) , dayOfYear ) ; }
Obtains a local date in Ethiopic calendar system from the era year - of - era and day - of - year fields .
50
26
144,658
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoLocalDateTime < EthiopicDate > localDateTime ( TemporalAccessor temporal ) { return ( ChronoLocalDateTime < EthiopicDate > ) super . localDateTime ( temporal ) ; }
Obtains a Ethiopic local date - time from another date - time object .
60
16
144,659
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoZonedDateTime < EthiopicDate > zonedDateTime ( TemporalAccessor temporal ) { return ( ChronoZonedDateTime < EthiopicDate > ) super . zonedDateTime ( temporal ) ; }
Obtains a Ethiopic zoned date - time from another date - time object .
64
17
144,660
@ Override public DiscordianDate date ( int prolepticYear , int month , int dayOfMonth ) { return DiscordianDate . of ( prolepticYear , month , dayOfMonth ) ; }
Obtains a local date in Discordian calendar system from the proleptic - year month - of - year and day - of - month fields .
44
30
144,661
@ Override public DiscordianDate dateYearDay ( Era era , int yearOfEra , int dayOfYear ) { return dateYearDay ( prolepticYear ( era , yearOfEra ) , dayOfYear ) ; }
Obtains a local date in Discordian calendar system from the era year - of - era and day - of - year fields .
50
26
144,662
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoLocalDateTime < DiscordianDate > localDateTime ( TemporalAccessor temporal ) { return ( ChronoLocalDateTime < DiscordianDate > ) super . localDateTime ( temporal ) ; }
Obtains a Discordian local date - time from another date - time object .
60
16
144,663
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoZonedDateTime < DiscordianDate > zonedDateTime ( TemporalAccessor temporal ) { return ( ChronoZonedDateTime < DiscordianDate > ) super . zonedDateTime ( temporal ) ; }
Obtains a Discordian zoned date - time from another date - time object .
64
17
144,664
@ Override public InternationalFixedDate date ( int prolepticYear , int month , int dayOfMonth ) { return InternationalFixedDate . of ( prolepticYear , month , dayOfMonth ) ; }
Obtains a local date in International Fixed calendar system from the proleptic - year month - of - year and day - of - month fields .
44
30
144,665
@ Override public InternationalFixedDate dateYearDay ( Era era , int yearOfEra , int dayOfYear ) { return dateYearDay ( prolepticYear ( era , yearOfEra ) , dayOfYear ) ; }
Obtains a local date in International Fixed calendar system from the era year - of - era and day - of - year fields .
50
26
144,666
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoLocalDateTime < InternationalFixedDate > localDateTime ( TemporalAccessor temporal ) { return ( ChronoLocalDateTime < InternationalFixedDate > ) super . localDateTime ( temporal ) ; }
Obtains a International Fixed local date - time from another date - time object .
60
16
144,667
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoZonedDateTime < InternationalFixedDate > zonedDateTime ( TemporalAccessor temporal ) { return ( ChronoZonedDateTime < InternationalFixedDate > ) super . zonedDateTime ( temporal ) ; }
Obtains a International Fixed zoned date - time from another date - time object .
64
17
144,668
public final ReadOnlyObjectProperty < LatLongBounds > boundsProperty ( ) { if ( bounds == null ) { bounds = new ReadOnlyObjectWrapper <> ( getBounds ( ) ) ; addStateEventHandler ( MapStateEventType . idle , ( ) -> { bounds . set ( getBounds ( ) ) ; } ) ; } return bounds . getReadOnlyProperty ( ) ; }
A property tied to the map updated when the idle state event is fired .
84
15
144,669
public void addMarker ( Marker marker ) { if ( markers == null ) { markers = new HashSet <> ( ) ; } markers . add ( marker ) ; marker . setMap ( this ) ; }
Adds the supplied marker to the map .
45
8
144,670
public void removeMarker ( Marker marker ) { if ( markers != null && markers . contains ( marker ) ) { markers . remove ( marker ) ; } marker . setMap ( null ) ; }
Removes the supplied marker from the map .
42
9
144,671
public void clearMarkers ( ) { if ( markers != null && ! markers . isEmpty ( ) ) { markers . forEach ( ( m ) - > { m . setMap ( null ) ; } ) ; markers . clear ( ) ; }
Removes all of the markers from the map .
52
10
144,672
protected void setProperty ( String propertyName , JavascriptObject propertyValue ) { jsObject . setMember ( propertyName , propertyValue . getJSObject ( ) ) ; }
Sets a property on this Javascript object for which the value is a Javascript object itself .
35
18
144,673
protected void setProperty ( String propertyName , JavascriptEnum propertyValue ) { jsObject . setMember ( propertyName , propertyValue . getEnumValue ( ) ) ; }
Sets a property on this Javascript object for which the value is a JavascriptEnum
37
17
144,674
protected < T > T getProperty ( String key , Class < T > type ) { Object returnValue = getProperty ( key ) ; if ( returnValue != null ) { return ( T ) returnValue ; } else { return null ; } }
Gets the property and casts to the appropriate type
51
10
144,675
protected < T > T invokeJavascriptReturnValue ( String function , Class < T > returnType ) { Object returnObject = invokeJavascript ( function ) ; if ( returnObject instanceof JSObject ) { try { Constructor < T > constructor = returnType . getConstructor ( JSObject . class ) ; return constructor . newInstance ( ( JSObject ) returnObject ) ; } catch ( Exception ex ) { throw new IllegalStateException ( ex ) ; } } else { return ( T ) returnObject ; } }
Invokes a JavaScript function that takes no arguments .
108
10
144,676
protected Object checkUndefined ( Object val ) { if ( val instanceof String && ( ( String ) val ) . equals ( "undefined" ) ) { return null ; } return val ; }
JSObject will return the String undefined at certain times so we need to make sure we re not getting a value that looks valid but isn t .
41
29
144,677
protected Boolean checkBoolean ( Object val , Boolean def ) { return ( val == null ) ? def : ( Boolean ) val ; }
Checks a returned Javascript value where we expect a boolean but could get null .
28
16
144,678
public String registerHandler ( GFXEventHandler handler ) { String uuid = UUID . randomUUID ( ) . toString ( ) ; handlers . put ( uuid , handler ) ; return uuid ; }
Registers a handler and returns the callback key to be passed to Javascript .
45
15
144,679
public void handleStateEvent ( String callbackKey ) { if ( handlers . containsKey ( callbackKey ) && handlers . get ( callbackKey ) instanceof StateEventHandler ) { ( ( StateEventHandler ) handlers . get ( callbackKey ) ) . handle ( ) ; } else { System . err . println ( "Error in handle: " + callbackKey + " for state handler " ) ; } }
This method is called from Javascript passing in the previously created callback key . It uses that to find the correct handler and then passes on the call . State events in the Google Maps API don t pass any parameters .
83
42
144,680
public static final PolygonOptions buildClosedArc ( LatLong center , LatLong start , LatLong end , ArcType arcType ) { MVCArray res = buildArcPoints ( center , start , end ) ; if ( ArcType . ROUND . equals ( arcType ) ) { res . push ( center ) ; } return new PolygonOptions ( ) . paths ( res ) ; }
Builds the path for a closed arc returning a PolygonOptions that can be further customised before use .
82
22
144,681
public static final PolylineOptions buildOpenArc ( LatLong center , LatLong start , LatLong end ) { MVCArray res = buildArcPoints ( center , start , end ) ; return new PolylineOptions ( ) . path ( res ) ; }
Builds the path for an open arc based on a PolylineOptions .
53
15
144,682
public static final MVCArray buildArcPoints ( LatLong center , double startBearing , double endBearing , double radius ) { int points = DEFAULT_ARC_POINTS ; MVCArray res = new MVCArray ( ) ; if ( startBearing > endBearing ) { endBearing += 360.0 ; } double deltaBearing = endBearing - startBearing ; deltaBearing = deltaBearing / points ; for ( int i = 0 ; ( i < points + 1 ) ; i ++ ) { res . push ( center . getDestinationPoint ( startBearing + i * deltaBearing , radius ) ) ; } return res ; }
Generates the points for an arc based on two bearings from a centre point and a radius .
144
19
144,683
public LatLong getLocation ( ) { if ( location == null ) { location = new LatLong ( ( JSObject ) ( getJSObject ( ) . getMember ( "location" ) ) ) ; } return location ; }
The location for this elevation .
47
6
144,684
protected String getArgString ( Object arg ) { //if (arg instanceof LatLong) { // return ((LatLong) arg).getVariableName(); //} else if ( arg instanceof JavascriptObject ) { return ( ( JavascriptObject ) arg ) . getVariableName ( ) ; // return ((JavascriptObject) arg).getPropertiesAsString(); } else if ( arg instanceof JavascriptEnum ) { return ( ( JavascriptEnum ) arg ) . getEnumValue ( ) . toString ( ) ; } else { return arg . toString ( ) ; } }
Takes the specified object and converts the argument to a String .
121
13
144,685
private String registerEventHandler ( GFXEventHandler h ) { //checkInitialized(); if ( ! registeredOnJS ) { JSObject doc = ( JSObject ) runtime . execute ( "document" ) ; doc . setMember ( "jsHandlers" , jsHandlers ) ; registeredOnJS = true ; } return jsHandlers . registerHandler ( h ) ; }
Registers an event handler in the repository shared between Javascript and Java .
77
14
144,686
public void addUIEventHandler ( JavascriptObject obj , UIEventType type , UIEventHandler h ) { String key = registerEventHandler ( h ) ; String mcall = "google.maps.event.addListener(" + obj . getVariableName ( ) + ", '" + type . name ( ) + "', " + "function(event) {document.jsHandlers.handleUIEvent('" + key + "', event);});" ; //.latLng //System.out.println("addUIEventHandler mcall: " + mcall); runtime . execute ( mcall ) ; }
Adds a handler for a mouse type event on the map .
129
12
144,687
public double distanceFrom ( LatLong end ) { double dLat = ( end . getLatitude ( ) - getLatitude ( ) ) * Math . PI / 180 ; double dLon = ( end . getLongitude ( ) - getLongitude ( ) ) * Math . PI / 180 ; double a = Math . sin ( dLat / 2 ) * Math . sin ( dLat / 2 ) + Math . cos ( getLatitude ( ) * Math . PI / 180 ) * Math . cos ( end . getLatitude ( ) * Math . PI / 180 ) * Math . sin ( dLon / 2 ) * Math . sin ( dLon / 2 ) ; double c = 2.0 * Math . atan2 ( Math . sqrt ( a ) , Math . sqrt ( 1 - a ) ) ; double d = EarthRadiusMeters * c ; return d ; }
From v3_epoly . js calculates the distance between this LatLong point and another .
191
19
144,688
public LatLong getDestinationPoint ( double bearing , double distance ) { double brng = Math . toRadians ( bearing ) ; double lat1 = latToRadians ( ) ; double lon1 = longToRadians ( ) ; double lat2 = Math . asin ( Math . sin ( lat1 ) * Math . cos ( distance / EarthRadiusMeters ) + Math . cos ( lat1 ) * Math . sin ( distance / EarthRadiusMeters ) * Math . cos ( brng ) ) ; double lon2 = lon1 + Math . atan2 ( Math . sin ( brng ) * Math . sin ( distance / EarthRadiusMeters ) * Math . cos ( lat1 ) , Math . cos ( distance / EarthRadiusMeters ) - Math . sin ( lat1 ) * Math . sin ( lat2 ) ) ; return new LatLong ( Math . toDegrees ( lat2 ) , Math . toDegrees ( lon2 ) ) ; }
Calculates the LatLong position of the end point of a line the specified distance from this LatLong along the provided bearing where North is 0 East is 90 etc .
215
34
144,689
public double getBearing ( LatLong end ) { if ( this . equals ( end ) ) { return 0 ; } double lat1 = latToRadians ( ) ; double lon1 = longToRadians ( ) ; double lat2 = end . latToRadians ( ) ; double lon2 = end . longToRadians ( ) ; double angle = - Math . atan2 ( Math . sin ( lon1 - lon2 ) * Math . cos ( lat2 ) , Math . cos ( lat1 ) * Math . sin ( lat2 ) - Math . sin ( lat1 ) * Math . cos ( lat2 ) * Math . cos ( lon1 - lon2 ) ) ; if ( angle < 0.0 ) { angle += Math . PI * 2.0 ; } if ( angle > Math . PI ) { angle -= Math . PI * 2.0 ; } return Math . toDegrees ( angle ) ; }
Calculates the bearing in degrees of the end LatLong point from this LatLong point .
204
19
144,690
public void getElevationForLocations ( LocationElevationRequest req , ElevationServiceCallback callback ) { this . callback = callback ; JSObject doc = ( JSObject ) getJSObject ( ) . eval ( "document" ) ; doc . setMember ( getVariableName ( ) , this ) ; StringBuilder r = new StringBuilder ( getVariableName ( ) ) . append ( "." ) . append ( "getElevationForLocations(" ) . append ( req . getVariableName ( ) ) . append ( ", " ) . append ( "function(results, status) {alert('rec:'+status);\ndocument." ) . append ( getVariableName ( ) ) . append ( ".processResponse(results, status);});" ) ; LOG . trace ( "ElevationService direct call: " + r . toString ( ) ) ; getJSObject ( ) . eval ( r . toString ( ) ) ; }
Create a request for elevations for multiple locations .
201
10
144,691
public void getElevationAlongPath ( PathElevationRequest req , ElevationServiceCallback callback ) { this . callback = callback ; JSObject doc = ( JSObject ) getJSObject ( ) . eval ( "document" ) ; doc . setMember ( getVariableName ( ) , this ) ; StringBuilder r = new StringBuilder ( getVariableName ( ) ) . append ( "." ) . append ( "getElevationAlongPath(" ) . append ( req . getVariableName ( ) ) . append ( ", " ) . append ( "function(results, status) {document." ) . append ( getVariableName ( ) ) . append ( ".processResponse(results, status);});" ) ; getJSObject ( ) . eval ( r . toString ( ) ) ; }
Create a request for elevations for samples along a path .
168
12
144,692
public static double distance ( double lat1 , double lon1 , double lat2 , double lon2 ) { double dLat = Math . toRadians ( lat2 - lat1 ) ; double dLon = Math . toRadians ( lon2 - lon1 ) ; lat1 = Math . toRadians ( lat1 ) ; lat2 = Math . toRadians ( lat2 ) ; double a = Math . sin ( dLat / 2 ) * Math . sin ( dLat / 2 ) + Math . sin ( dLon / 2 ) * Math . sin ( dLon / 2 ) * Math . cos ( lat1 ) * Math . cos ( lat2 ) ; double c = 2 * Math . atan2 ( Math . sqrt ( a ) , Math . sqrt ( 1 - a ) ) ; return R * c ; }
Returns the distance between the two points in meters .
184
10
144,693
public static String soundex ( String str ) { if ( str . length ( ) < 1 ) return "" ; // no soundex key for the empty string (could use 000) char [ ] key = new char [ 4 ] ; key [ 0 ] = str . charAt ( 0 ) ; int pos = 1 ; char prev = ' ' ; for ( int ix = 1 ; ix < str . length ( ) && pos < 4 ; ix ++ ) { char ch = str . charAt ( ix ) ; int charno ; if ( ch >= ' ' && ch <= ' ' ) charno = ch - ' ' ; else if ( ch >= ' ' && ch <= ' ' ) charno = ch - ' ' ; else continue ; if ( number [ charno ] != ' ' && number [ charno ] != prev ) key [ pos ++ ] = number [ charno ] ; prev = number [ charno ] ; } for ( ; pos < 4 ; pos ++ ) key [ pos ] = ' 0 ' ; return new String ( key ) ; }
Produces the Soundex key for the given string .
225
11
144,694
private static char [ ] buildTable ( ) { char [ ] table = new char [ 26 ] ; for ( int ix = 0 ; ix < table . length ; ix ++ ) table [ ix ] = ' 0 ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; table [ ' ' - ' ' ] = ' ' ; return table ; }
Builds the mapping table .
270
6
144,695
private void addStatement ( RecordImpl record , String subject , String property , String object ) { Collection < Column > cols = columns . get ( property ) ; if ( cols == null ) { if ( property . equals ( RDF_TYPE ) && ! types . isEmpty ( ) ) addValue ( record , subject , property , object ) ; return ; } for ( Column col : cols ) { String cleaned = object ; if ( col . getCleaner ( ) != null ) cleaned = col . getCleaner ( ) . clean ( object ) ; if ( cleaned != null && ! cleaned . equals ( "" ) ) addValue ( record , subject , col . getProperty ( ) , cleaned ) ; } }
common utility method for adding a statement to a record
150
10
144,696
public Filter geoSearch ( String value ) { GeopositionComparator comp = ( GeopositionComparator ) prop . getComparator ( ) ; double dist = comp . getMaxDistance ( ) ; double degrees = DistanceUtils . dist2Degrees ( dist , DistanceUtils . EARTH_MEAN_RADIUS_KM * 1000.0 ) ; Shape circle = spatialctx . makeCircle ( parsePoint ( value ) , degrees ) ; SpatialArgs args = new SpatialArgs ( SpatialOperation . Intersects , circle ) ; return strategy . makeFilter ( args ) ; }
Returns a geoquery .
130
6
144,697
private Point parsePoint ( String point ) { int comma = point . indexOf ( ' ' ) ; if ( comma == - 1 ) return null ; float lat = Float . valueOf ( point . substring ( 0 , comma ) ) ; float lng = Float . valueOf ( point . substring ( comma + 1 ) ) ; return spatialctx . makePoint ( lng , lat ) ; }
Parses coordinates into a Spatial4j point shape .
84
13
144,698
public static Statement open ( String jndiPath ) { try { Context ctx = new InitialContext ( ) ; DataSource ds = ( DataSource ) ctx . lookup ( jndiPath ) ; Connection conn = ds . getConnection ( ) ; return conn . createStatement ( ) ; } catch ( NamingException e ) { throw new DukeException ( "No database configuration found via JNDI at " + jndiPath , e ) ; } catch ( SQLException e ) { throw new DukeException ( "Error connecting to database via " + jndiPath , e ) ; } }
Get a configured database connection via JNDI .
130
10
144,699
public static Statement open ( String driverklass , String jdbcuri , Properties props ) { try { Driver driver = ( Driver ) ObjectUtils . instantiate ( driverklass ) ; Connection conn = driver . connect ( jdbcuri , props ) ; if ( conn == null ) throw new DukeException ( "Couldn't connect to database at " + jdbcuri ) ; return conn . createStatement ( ) ; } catch ( SQLException e ) { throw new DukeException ( e ) ; } }
Opens a JDBC connection with the given parameters .
110
11