idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
142,400
static boolean isRight ( final Fastq fastq ) { checkNotNull ( fastq ) ; return RIGHT . matcher ( fastq . getDescription ( ) ) . matches ( ) ; }
Return true if the specified fastq is the right or second read of a paired end read .
40
19
142,401
static String prefix ( final Fastq fastq ) { checkNotNull ( fastq ) ; Matcher m = PREFIX . matcher ( fastq . getDescription ( ) ) ; if ( ! m . matches ( ) ) { throw new PairedEndFastqReaderException ( "could not parse prefix from description " + fastq . getDescription ( ) ) ; } return m . group ( 1 ) ; }
Return the prefix of the paired end read name of the specified fastq .
86
15
142,402
public static GapPenalties create ( final int match , final int replace , final int insert , final int delete , final int extend ) { return new GapPenalties ( ( short ) match , ( short ) replace , ( short ) insert , ( short ) delete , ( short ) extend ) ; }
Create and return a new gap penalties with the specified penalties .
61
12
142,403
public static MozuUrl getAvailablePickupFulfillmentActionsUrl ( String orderId , String pickupId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/orders/{orderId}/pickups/{pickupId}/actions" ) ; formatter . formatUrl ( "orderId" , orderId ) ; formatter . formatUrl ( "pickupId" , pickupId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetAvailablePickupFulfillmentActions
127
15
142,404
public static MozuUrl getPickupUrl ( String orderId , String pickupId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/orders/{orderId}/pickups/{pickupId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "orderId" , orderId ) ; formatter . formatUrl ( "pickupId" , pickupId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetPickup
148
8
142,405
public void setParameter ( final String name , final String filename , final InputStream is ) throws IOException { boundary ( ) ; writeName ( name ) ; write ( "; filename=\"" ) ; write ( filename ) ; write ( ' ' ) ; newline ( ) ; write ( "Content-Type: " ) ; String type = URLConnection . guessContentTypeFromName ( filename ) ; if ( type == null ) { type = "application/octet-stream" ; } writeln ( type ) ; newline ( ) ; pipe ( is , os ) ; newline ( ) ; }
Adds a file parameter to the request
125
7
142,406
public static MozuUrl getTransactionsUrl ( Integer accountId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/accounts/{accountId}/transactions" ) ; formatter . formatUrl ( "accountId" , accountId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetTransactions
96
8
142,407
public static MozuUrl removeTransactionUrl ( Integer accountId , String transactionId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/accounts/{accountId}/transactions/{transactionId}" ) ; formatter . formatUrl ( "accountId" , accountId ) ; formatter . formatUrl ( "transactionId" , transactionId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for RemoveTransaction
120
7
142,408
public void send ( final Message msg ) throws MailException { Transport transport = null ; try { if ( log . isDebugEnabled ( ) ) { log . debug ( "Sending mail message [subject={}, recipients={}]" , msg . getSubject ( ) , on ( ", " ) . join ( msg . getAllRecipients ( ) ) ) ; } transport = sessionProvider . get ( ) . getTransport ( ) ; transport . connect ( ) ; transport . sendMessage ( msg , msg . getAllRecipients ( ) ) ; } catch ( MessagingException ex ) { throw new MailException ( "Error sending mail message" , ex ) ; } finally { try { transport . close ( ) ; } catch ( MessagingException ex ) { log . error ( ex . getMessage ( ) , ex ) ; } } }
Sends the specified message .
176
6
142,409
public static MozuUrl getQuoteByNameUrl ( Integer customerAccountId , String quoteName , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/quotes/customers/{customerAccountId}/{quoteName}?responseFields={responseFields}" ) ; formatter . formatUrl ( "customerAccountId" , customerAccountId ) ; formatter . formatUrl ( "quoteName" , quoteName ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetQuoteByName
154
9
142,410
public static MozuUrl deleteQuoteUrl ( String quoteId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/quotes/{quoteId}" ) ; formatter . formatUrl ( "quoteId" , quoteId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteQuote
88
7
142,411
public static MozuUrl getDBValueUrl ( String dbEntryQuery , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/tenantdata/{dbEntryQuery}?responseFields={responseFields}" ) ; formatter . formatUrl ( "dbEntryQuery" , dbEntryQuery ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetDBValue
125
8
142,412
public static MozuUrl createDBValueUrl ( String dbEntryQuery ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/tenantdata/{dbEntryQuery}" ) ; formatter . formatUrl ( "dbEntryQuery" , dbEntryQuery ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for CreateDBValue
94
8
142,413
public static List < String > normalizeTagsForUpload ( List < String > list ) { if ( isNullOrEmpty ( list ) ) { return null ; } List < String > tmp = new ArrayList < String > ( ) ; for ( String s : list ) { if ( s . contains ( " " ) ) { tmp . add ( "\"" + s + "\"" ) ; } else { tmp . add ( s ) ; } } return tmp ; }
Normalize tags for uploads .
99
7
142,414
public static Integer memberTypeToMemberTypeId ( JinxConstants . MemberType memberType ) { if ( memberType == null ) { return null ; } Integer type ; switch ( memberType ) { case narwhal : type = 1 ; break ; case member : type = 2 ; break ; case moderator : type = 3 ; break ; case admin : type = 4 ; break ; default : type = null ; break ; } return type ; }
Convert a MemberType enum to the numeric Flickr member type id .
93
14
142,415
public static JinxConstants . MemberType typeIdToMemberType ( Integer typeId ) { if ( typeId == null ) { return null ; } JinxConstants . MemberType memberType ; switch ( typeId ) { case 1 : memberType = JinxConstants . MemberType . narwhal ; break ; case 2 : memberType = JinxConstants . MemberType . member ; break ; case 3 : memberType = JinxConstants . MemberType . moderator ; break ; case 4 : memberType = JinxConstants . MemberType . admin ; break ; default : memberType = null ; break ; } return memberType ; }
Convert a numeric Flickr member type id to a MemberType enum value .
137
15
142,416
public static Integer groupPrivacyEnumToPrivacyId ( JinxConstants . GroupPrivacy privacy ) { if ( privacy == null ) { return null ; } Integer id ; switch ( privacy ) { case group_private : id = 1 ; break ; case group_invite_only_public : id = 2 ; break ; case group_open_public : id = 3 ; break ; default : id = null ; break ; } return id ; }
Convert a GroupPrivacy enum value to the corresponding Flickr numeric identifier .
93
14
142,417
public static JinxConstants . GroupPrivacy privacyIdToGroupPrivacyEnum ( Integer id ) { if ( id == null ) { return null ; } JinxConstants . GroupPrivacy privacy ; switch ( id ) { case 1 : privacy = JinxConstants . GroupPrivacy . group_private ; break ; case 2 : privacy = JinxConstants . GroupPrivacy . group_invite_only_public ; break ; case 3 : privacy = JinxConstants . GroupPrivacy . group_open_public ; break ; default : privacy = null ; break ; } return privacy ; }
Convert a Flickr group privacy numeric identifier to the corresponding GroupPrivacy enum value .
123
16
142,418
public static Integer suggestionStatusToFlickrSuggestionStatusId ( JinxConstants . SuggestionStatus status ) { if ( status == null ) { return null ; } Integer id ; switch ( status ) { case pending : id = 0 ; break ; case approved : id = 1 ; break ; case rejected : id = 2 ; break ; default : id = null ; break ; } return id ; }
Convert a suggestion status to the corresponding Flickr suggestion status id .
82
13
142,419
public static JinxConstants . SuggestionStatus suggestionStatusIdToSuggestionStatusEnum ( Integer id ) { if ( id == null ) { return null ; } JinxConstants . SuggestionStatus status ; switch ( id ) { case 0 : status = JinxConstants . SuggestionStatus . pending ; break ; case 1 : status = JinxConstants . SuggestionStatus . approved ; break ; case 2 : status = JinxConstants . SuggestionStatus . rejected ; break ; default : status = null ; break ; } return status ; }
Convert a Flickr suggestion status id to the corresponding SuggestionStatus value .
117
15
142,420
public PhotosetInfo getInfo ( String photosetId ) throws JinxException { JinxUtils . validateParams ( photosetId ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.photosets.getInfo" ) ; params . put ( "photoset_id" , photosetId ) ; return jinx . flickrGet ( params , PhotosetInfo . class ) ; }
Gets information about a photoset . This method does not require authentication .
101
15
142,421
public Domains getCollectionDomains ( Date date , String collectionId , Integer perPage , Integer page ) throws JinxException { JinxUtils . validateParams ( date ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.stats.getCollectionDomains" ) ; params . put ( "date" , JinxUtils . formatDateAsYMD ( date ) ) ; if ( ! JinxUtils . isNullOrEmpty ( collectionId ) ) { params . put ( "collection_id" , collectionId ) ; } if ( perPage != null ) { params . put ( "per_page" , perPage . toString ( ) ) ; } if ( page != null ) { params . put ( "page" , page . toString ( ) ) ; } return jinx . flickrGet ( params , Domains . class ) ; }
Get a list of referring domains for a collection
201
9
142,422
public Stats getPhotosetStats ( Date date , String photosetId ) throws JinxException { JinxUtils . validateParams ( date , photosetId ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.stats.getPhotosetStats" ) ; params . put ( "date" , JinxUtils . formatDateAsYMD ( date ) ) ; params . put ( "photoset_id" , photosetId ) ; return jinx . flickrGet ( params , Stats . class ) ; }
Get the number of views on a photoset for a given date .
128
14
142,423
public Photos getPopularPhotos ( Date date , JinxConstants . PopularPhotoSort sort , Integer perPage , Integer page ) throws JinxException { Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.stats.getPopularPhotos" ) ; if ( date != null ) { params . put ( "date" , JinxUtils . formatDateAsYMD ( date ) ) ; } if ( sort != null ) { params . put ( "sort" , sort . toString ( ) ) ; } if ( perPage != null ) { params . put ( "per_page" , perPage . toString ( ) ) ; } if ( page != null ) { params . put ( "page" , page . toString ( ) ) ; } return jinx . flickrGet ( params , Photos . class ) ; }
List the photos with the most views comments or favorites
192
10
142,424
public GroupUrls getGroup ( String groupId ) throws JinxException { JinxUtils . validateParams ( groupId ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.urls.getGroup" ) ; params . put ( "group_id" , groupId ) ; return jinx . flickrGet ( params , GroupUrls . class , false ) ; }
Returns the url to a group s page .
99
9
142,425
public UserUrls getUserPhotos ( String userId ) throws JinxException { Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.urls.getUserPhotos" ) ; if ( ! JinxUtils . isNullOrEmpty ( userId ) ) { params . put ( "user_id" , userId ) ; } return jinx . flickrGet ( params , UserUrls . class ) ; }
Returns the url to a user s photos .
105
9
142,426
public GalleryInfo lookupGallery ( String url ) throws JinxException { JinxUtils . validateParams ( url ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.urls.lookupGallery" ) ; params . put ( "url" , url ) ; return jinx . flickrGet ( params , GalleryInfo . class ) ; }
Returns gallery info by url .
91
6
142,427
public GroupUrls lookupGroup ( String url ) throws JinxException { JinxUtils . validateParams ( url ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.urls.lookupGroup" ) ; params . put ( "url" , url ) ; return jinx . flickrGet ( params , GroupUrls . class , false ) ; }
Returns a group NSID given the url to a group s page or photo pool .
95
17
142,428
public UserUrls lookupUser ( String url ) throws JinxException { JinxUtils . validateParams ( url ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.urls.lookupUser" ) ; params . put ( "url" , url ) ; return jinx . flickrGet ( params , UserUrls . class ) ; }
Returns a user NSID given the url to a user s photos or profile .
93
16
142,429
public synchronized void storeToXML ( OutputStream os , String comment ) throws IOException { if ( os == null ) throw new NullPointerException ( ) ; storeToXML ( os , comment , "UTF-8" ) ; }
Emits an XML document representing all of the properties contained in this table .
51
15
142,430
public void list ( PrintStream out ) { out . println ( "-- listing properties --" ) ; Hashtable h = new Hashtable ( ) ; enumerate ( h ) ; for ( Enumeration e = h . keys ( ) ; e . hasMoreElements ( ) ; ) { String key = ( String ) e . nextElement ( ) ; String val = ( String ) h . get ( key ) ; if ( val . length ( ) > 40 ) { val = val . substring ( 0 , 37 ) + "..." ; } out . println ( key + "=" + val ) ; } }
Prints this property list out to the specified output stream . This method is useful for debugging .
128
19
142,431
@ Deprecated public Response browse ( String categoryId ) throws JinxException { Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.groups.browse" ) ; return jinx . flickrGet ( params , Response . class ) ; }
This is a legacy method and will not return anything useful .
67
12
142,432
public void setoAuthAccessToken ( OAuthAccessToken oAuthAccessToken ) { this . oAuthAccessToken = oAuthAccessToken ; this . accessToken = new Token ( oAuthAccessToken . getOauthToken ( ) , oAuthAccessToken . getOauthTokenSecret ( ) ) ; }
Set the oauth access token .
65
7
142,433
public static void setDecodeHintAllowedLengths ( Intent intent , int [ ] lengths ) { intent . putExtra ( DecodeHintType . ALLOWED_LENGTHS . name ( ) , lengths ) ; }
Set allowed lengths of encoded data .
49
7
142,434
public PlaceInfo getInfo ( String placeId , String woeId ) throws JinxException { if ( JinxUtils . isNullOrEmpty ( placeId ) ) { JinxUtils . validateParams ( woeId ) ; } Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.places.getInfo" ) ; if ( JinxUtils . isNullOrEmpty ( placeId ) ) { params . put ( "woe_id" , woeId ) ; } else { params . put ( "place_id" , placeId ) ; } return jinx . flickrGet ( params , PlaceInfo . class , false ) ; }
Get information about a place . Authentication This method does not require authentication . You must provide a valid placesId or woeId . If you provide both the placesId will be used .
157
37
142,435
public Places getPlacesForBoundingBox ( String boundingBox , JinxConstants . PlaceTypeId placeTypeId ) throws JinxException { JinxUtils . validateParams ( boundingBox , placeTypeId ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.places.placesForBoundingBox" ) ; params . put ( "bbox" , boundingBox ) ; params . put ( "place_type_id" , placeTypeId . getTypeId ( ) . toString ( ) ) ; return jinx . flickrGet ( params , Places . class , false ) ; }
Return all the locations of a matching place type for a bounding box .
148
15
142,436
public Places getPlacesForContacts ( JinxConstants . PlaceTypeId placeTypeId , String placeId , String woeId , Integer threshold , JinxConstants . Contacts contacts , Date minimumUploadDate , Date maximumUploadDate , Date minimumTakenDate , Date maximumTakenDate ) throws JinxException { JinxUtils . validateParams ( placeTypeId ) ; if ( JinxUtils . isNullOrEmpty ( placeId ) ) { JinxUtils . validateParams ( woeId ) ; } Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.places.placesForContacts" ) ; params . put ( "place_type_id" , placeTypeId . getTypeId ( ) . toString ( ) ) ; if ( JinxUtils . isNullOrEmpty ( placeId ) ) { params . put ( "woe_id" , woeId ) ; } else { params . put ( "place_id" , placeId ) ; } if ( threshold != null ) { params . put ( "threshold" , threshold . toString ( ) ) ; } if ( contacts != null ) { params . put ( "contacts" , contacts . toString ( ) ) ; } if ( minimumUploadDate != null ) { params . put ( "min_upload_date" , JinxUtils . formatDateAsUnixTimestamp ( minimumUploadDate ) ) ; } if ( maximumUploadDate != null ) { params . put ( "max_upload_date" , JinxUtils . formatDateAsUnixTimestamp ( maximumUploadDate ) ) ; } if ( minimumTakenDate != null ) { params . put ( "min_taken_date" , JinxUtils . formatDateAsMySqlTimestamp ( minimumTakenDate ) ) ; } if ( maximumTakenDate != null ) { params . put ( "max_taken_date" , JinxUtils . formatDateAsMySqlTimestamp ( maximumTakenDate ) ) ; } return jinx . flickrGet ( params , Places . class ) ; }
Return a list of the top 100 unique places clustered by a given placetype for a user s contacts .
467
22
142,437
public Methods getMethods ( ) throws JinxException { Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.reflection.getMethods" ) ; return jinx . flickrGet ( params , Methods . class , false ) ; }
Returns a list of available Flickr API methods .
65
9
142,438
public MethodInfo getMethodInfo ( String methodName ) throws JinxException { JinxUtils . validateParams ( methodName ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.reflection.getMethodInfo" ) ; params . put ( "method_name" , methodName ) ; return jinx . flickrGet ( params , MethodInfo . class , false ) ; }
Returns information for a given Flickr API method .
99
9
142,439
public Clusters getClusters ( String tag ) throws JinxException { JinxUtils . validateParams ( tag ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.tags.getClusters" ) ; params . put ( "tag" , tag ) ; return jinx . flickrGet ( params , Clusters . class , false ) ; }
Gives you a list of tag clusters for the given tag .
93
13
142,440
public PhotoTagList getListPhoto ( String photoId ) throws JinxException { JinxUtils . validateParams ( photoId ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.tags.getListPhoto" ) ; params . put ( "photo_id" , photoId ) ; return jinx . flickrGet ( params , PhotoTagList . class , false ) ; }
Get the tag list for a given photo .
100
9
142,441
public TagsForUser getMostFrequentlyUsed ( ) throws JinxException { Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.tags.getMostFrequentlyUsed" ) ; return jinx . flickrGet ( params , TagsForUser . class ) ; }
Returns a list of most frequently used tags for a user .
72
12
142,442
public RelatedTags getRelated ( String tag ) throws JinxException { JinxUtils . validateParams ( tag ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.tags.getRelated" ) ; params . put ( "tag" , tag ) ; return jinx . flickrGet ( params , RelatedTags . class ) ; }
Returns a list of tags related to the given tag based on clustered usage analysis .
89
16
142,443
public String getPhotosFirstDateTaken ( ) { return ( person == null || person . photos == null || person . photos . firstDateTaken == null ) ? null : person . photos . firstDateTaken . _content ; }
Get the mysql datetime of the first photo taken by the user .
50
14
142,444
public String getPhotosFirstDate ( ) { return ( person == null || person . photos == null || person . photos . firstDate == null ) ? null : person . photos . firstDate . _content ; }
Get the unix timestamp of the first photo uploaded by the user .
44
14
142,445
public CameraModels getBrandModels ( String brandId ) throws JinxException { JinxUtils . validateParams ( brandId ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.cameras.getBrandModels" ) ; params . put ( "brand" , brandId ) ; return jinx . flickrGet ( params , CameraModels . class , false ) ; }
Retrieve all the models for a given camera brand . This method does not require authentication .
102
18
142,446
public static String generateAuthorizeUrl ( String oAuthUri , String clientId , String [ ] scope ) { StringBuilder sb = new StringBuilder ( oAuthUri ) ; sb . append ( "/oauth/authorize?response_type=code" ) ; sb . append ( "&client_id=" + clientId ) ; if ( scope != null ) { sb . append ( "&scope=" ) ; for ( int i = 0 ; i < scope . length ; i ++ ) { if ( i > 0 ) { sb . append ( "%20" ) ; } sb . append ( scope [ i ] ) ; } } return sb . toString ( ) ; }
Generates the initial url for the OAuth authorization flow
151
11
142,447
public Response correctLocation ( String photoId , String placeId , String woeId , String foursquareId ) throws JinxException { JinxUtils . validateParams ( photoId ) ; if ( JinxUtils . isNullOrEmpty ( placeId ) ) { JinxUtils . validateParams ( woeId ) ; } Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.photos.geo.correctLocation" ) ; params . put ( "photo_id" , photoId ) ; if ( ! JinxUtils . isNullOrEmpty ( placeId ) ) { params . put ( "place_id" , placeId ) ; } if ( ! JinxUtils . isNullOrEmpty ( woeId ) ) { params . put ( "woe_id" , woeId ) ; } if ( ! JinxUtils . isNullOrEmpty ( foursquareId ) ) { params . put ( "foursquare_id" , foursquareId ) ; } return jinx . flickrPost ( params , Response . class ) ; }
This method requires authentication with write permission .
248
8
142,448
public GalleryInfo galleryInfo ( String galleryId ) throws JinxException { JinxUtils . validateParams ( galleryId ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.galleries.getInfo" ) ; params . put ( "gallery_id" , galleryId ) ; return jinx . flickrPost ( params , GalleryInfo . class ) ; }
This method does not require authentication .
95
7
142,449
public Subscriptions getSubscriptions ( ) throws JinxException { Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.push.getSubscriptions" ) ; return jinx . flickrGet ( params , Subscriptions . class ) ; }
Returns a list of the subscriptions for the logged - in user .
70
13
142,450
public Topics getTopics ( ) throws JinxException { Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.push.getTopics" ) ; return jinx . flickrGet ( params , Topics . class ) ; }
Get all available push topics .
62
6
142,451
public Response subscribe ( String topic , String callbackUrl , JinxConstants . VerificationMode mode , String verificationToken , Integer leaseSeconds , Integer woeIds , List < String > placeIds , Float latitude , Float longitude , Integer radius , JinxConstants . RadiusUnits radiusUnits , Integer accuracy , List < String > commonsNSIDs , List < String > tags ) throws JinxException { JinxUtils . validateParams ( topic , callbackUrl , mode ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.push.subscribe" ) ; params . put ( "topic" , topic ) ; params . put ( "callback" , callbackUrl ) ; params . put ( "verify" , mode . toString ( ) ) ; if ( ! JinxUtils . isNullOrEmpty ( verificationToken ) ) { params . put ( "verify_token" , verificationToken ) ; } if ( leaseSeconds != null && leaseSeconds > 59 ) { params . put ( "lease_seconds" , leaseSeconds . toString ( ) ) ; } if ( woeIds != null ) { params . put ( "woe_ids" , woeIds . toString ( ) ) ; } if ( ! JinxUtils . isNullOrEmpty ( placeIds ) ) { params . put ( "place_ids" , JinxUtils . buildCommaDelimitedList ( placeIds ) ) ; } if ( latitude != null ) { params . put ( "lat" , latitude . toString ( ) ) ; } if ( longitude != null ) { params . put ( "lon" , longitude . toString ( ) ) ; } if ( radius != null ) { params . put ( "radius" , radius . toString ( ) ) ; } if ( radiusUnits != null ) { params . put ( "radius_units" , radiusUnits . toString ( ) ) ; } if ( accuracy != null ) { params . put ( "accuracy" , accuracy . toString ( ) ) ; } if ( ! JinxUtils . isNullOrEmpty ( commonsNSIDs ) ) { params . put ( "nsids" , JinxUtils . buildCommaDelimitedList ( commonsNSIDs ) ) ; } if ( ! JinxUtils . isNullOrEmpty ( tags ) ) { params . put ( "tags" , JinxUtils . buildCommaDelimitedList ( tags ) ) ; } return jinx . flickrGet ( params , Response . class ) ; }
Subscribe to a push feed .
568
6
142,452
public Response unsubscribe ( String topic , String callbackUrl , JinxConstants . VerificationMode mode , String verificationToken ) throws JinxException { JinxUtils . validateParams ( topic , callbackUrl , mode ) ; Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.push.unsubscribe" ) ; params . put ( "topic" , topic ) ; params . put ( "callback" , callbackUrl ) ; params . put ( "verify" , mode . toString ( ) ) ; if ( ! JinxUtils . isNullOrEmpty ( verificationToken ) ) { params . put ( "verify_token" , verificationToken ) ; } return jinx . flickrGet ( params , Response . class ) ; }
Unsubscribe from a push feed .
174
8
142,453
public void log ( String message , Throwable t ) { System . out . println ( message ) ; System . out . println ( getStackTrace ( t ) ) ; }
Log message to stdout along with exception information .
37
10
142,454
public synchronized void stopPreview ( ) { if ( autoFocusManager != null ) { autoFocusManager . stop ( ) ; autoFocusManager = null ; } if ( camera != null && previewing ) { camera . stopPreview ( ) ; previewCallback . setHandler ( null , 0 ) ; previewing = false ; } }
Tells the camera to stop drawing preview frames .
67
10
142,455
public Integer getPerPage ( ) { int ret = 0 ; if ( photos != null ) { int pp ; if ( photos . perpage == null ) { pp = 0 ; } else { pp = photos . perpage ; } int pP ; if ( photos . perPage == null ) { pP = 0 ; } else { pP = photos . perPage ; } if ( pp > pP ) { ret = pp ; } else { ret = pP ; } } return ret ; }
Get the number of photos per page . This value is returned by flickr as per_page and perpage depending on the method that was called . This class can parse either value and will return whichever one was found .
105
44
142,456
public String getComment ( String key ) { String raw = getRawComment ( key ) ; return cookComment ( raw ) ; }
Returns the comment for the specified key or null if there is none . Any embedded newline sequences will be replaced by \ n characters .
27
27
142,457
public static BufferedImage getImageForSize ( JinxConstants . PhotoSize size , Photo photo ) throws JinxException { if ( photo == null || size == null ) { throw new JinxException ( "Cannot look up null photo or size." ) ; } BufferedImage image ; try { image = ImageIO . read ( getUrlForSize ( size , photo ) ) ; } catch ( JinxException je ) { throw je ; } catch ( Exception e ) { throw new JinxException ( "Unable to get image for size " + size . toString ( ) , e ) ; } return image ; }
Get an image for a photo at a specific size .
132
11
142,458
public static BufferedImage getImageForSize ( JinxConstants . PhotoSize size , PhotoInfo info ) throws JinxException { if ( info == null || size == null ) { throw new JinxException ( "Cannot look up null photo or size." ) ; } BufferedImage image ; try { image = ImageIO . read ( getUrlForSize ( size , info ) ) ; } catch ( JinxException je ) { throw je ; } catch ( Exception e ) { throw new JinxException ( "Unable to get image for size " + size . toString ( ) , e ) ; } return image ; }
Get an image for photo info at a specific size .
133
11
142,459
public static URL getUrlForSize ( JinxConstants . PhotoSize size , String photoId , String secret , String farm , String server , String originalFormat , String originalSecret ) throws JinxException { JinxUtils . validateParams ( photoId , size , farm , server ) ; if ( size == JinxConstants . PhotoSize . SIZE_ORIGINAL ) { JinxUtils . validateParams ( originalFormat , originalSecret ) ; } else { JinxUtils . validateParams ( secret ) ; } StringBuilder sb = new StringBuilder ( "https://farm" ) ; sb . append ( farm ) ; sb . append ( ".static.flickr.com/" ) ; sb . append ( server ) . append ( "/" ) ; sb . append ( photoId ) . append ( ' ' ) ; switch ( size ) { case SIZE_SMALL_SQUARE : sb . append ( secret ) . append ( "_s.jpg" ) ; break ; case SIZE_LARGE_SQUARE : sb . append ( secret ) . append ( "_q.jpg" ) ; break ; case SIZE_THUMBNAIL : sb . append ( secret ) . append ( "_t.jpg" ) ; break ; case SIZE_SMALL : sb . append ( secret ) . append ( "_m.jpg" ) ; break ; case SIZE_SMALL_320 : sb . append ( secret ) . append ( "_n.jpg" ) ; break ; case SIZE_MEDIUM : sb . append ( secret ) . append ( ".jpg" ) ; break ; case SIZE_MEDIUM_640 : sb . append ( secret ) . append ( "_z.jpg" ) ; break ; case SIZE_MEDIUM_800 : sb . append ( secret ) . append ( "_c.jpg" ) ; break ; case SIZE_LARGE : sb . append ( secret ) . append ( "_b.jpg" ) ; break ; case SIZE_LARGE_1600 : sb . append ( secret ) . append ( "_h.jpg" ) ; break ; case SIZE_LARGE_2048 : sb . append ( secret ) . append ( "_k.jpg" ) ; break ; case SIZE_ORIGINAL : sb . append ( originalSecret ) . append ( "_o" ) ; sb . append ( ' ' ) . append ( originalFormat ) ; break ; default : throw new JinxException ( "Undefined size: " + size ) ; } try { return new URL ( sb . toString ( ) ) ; } catch ( Exception e ) { throw new JinxException ( "Could not create URL from string " + sb . toString ( ) ) ; } }
Get the URL for a specific size of photo .
605
10
142,460
public Person getContentType ( ) throws JinxException { Map < String , String > params = new TreeMap <> ( ) ; params . put ( "method" , "flickr.prefs.getContentType" ) ; return jinx . flickrGet ( params , Person . class ) ; }
Returns the default content type preference for the user .
65
10
142,461
public boolean cancelJob ( String slaveJobId ) { final AnalysisResultFuture resultFuture = _runningJobs . remove ( slaveJobId ) ; if ( resultFuture != null ) { resultFuture . cancel ( ) ; return true ; } return false ; }
Cancels a slave job referred by it s id .
53
12
142,462
protected final boolean entityExists ( final String entityName ) { final Set < EntityType < ? > > entityTypes = getEm ( ) . getMetamodel ( ) . getEntities ( ) ; for ( final EntityType < ? > entityType : entityTypes ) { if ( entityType . getName ( ) . equals ( entityName ) ) { return true ; } } return false ; }
Returns if an entity with agiven name exists .
85
10
142,463
protected final String createJpqlStreamSelect ( final StreamId streamId ) { if ( streamId . isProjection ( ) ) { throw new IllegalArgumentException ( "Projections do not have a stream table : " + streamId ) ; } final List < KeyValue > params = new ArrayList <> ( streamId . getParameters ( ) ) ; if ( params . size ( ) == 0 ) { // NoParamsStream params . add ( new KeyValue ( "streamName" , streamId . getName ( ) ) ) ; } final StringBuilder sb = new StringBuilder ( "SELECT t FROM " + streamEntityName ( streamId ) + " t" ) ; sb . append ( " WHERE " ) ; for ( int i = 0 ; i < params . size ( ) ; i ++ ) { final KeyValue param = params . get ( i ) ; if ( i > 0 ) { sb . append ( " AND " ) ; } sb . append ( "t." + param . getKey ( ) + "=:" + param . getKey ( ) ) ; } return sb . toString ( ) ; }
Creates the JPQL to select the stream itself .
243
11
142,464
@ NotNull protected final JpaStream findStream ( @ NotNull final StreamId streamId ) { Contract . requireArgNotNull ( "streamId" , streamId ) ; verifyStreamEntityExists ( streamId ) ; final String sql = createJpqlStreamSelect ( streamId ) ; final TypedQuery < JpaStream > query = getEm ( ) . createQuery ( sql , JpaStream . class ) ; setJpqlParameters ( query , streamId ) ; final List < JpaStream > streams = query . getResultList ( ) ; if ( streams . size ( ) == 0 ) { throw new StreamNotFoundException ( streamId ) ; } final JpaStream stream = streams . get ( 0 ) ; if ( stream . getState ( ) == StreamState . SOFT_DELETED ) { // TODO Remove after event store has a way to distinguish between // never-existing and soft deleted // streams throw new StreamNotFoundException ( streamId ) ; } return stream ; }
Reads the stream with the given identifier from the DB and returns it .
213
15
142,465
private final String createNativeSqlEventSelect ( final StreamId streamId , final List < NativeSqlCondition > conditions ) { final StringBuilder sb = new StringBuilder ( "SELECT " + JPA_EVENT_PREFIX + ".* FROM " + JpaEvent . TABLE_NAME + " " + JPA_EVENT_PREFIX + ", " + nativeEventsTableName ( streamId ) + " " + JPA_STREAM_EVENT_PREFIX + " WHERE " + JPA_EVENT_PREFIX + "." + JpaEvent . COLUMN_ID + "=" + JPA_STREAM_EVENT_PREFIX + "." + JpaStreamEvent . COLUMN_EVENTS_ID ) ; for ( final NativeSqlCondition condition : conditions ) { sb . append ( " AND " ) ; sb . append ( condition . asWhereConditionWithParam ( ) ) ; } return sb . toString ( ) ; }
Creates a native SQL select using the parameters from the stream identifier and optional other arguments .
215
18
142,466
public void delete ( final boolean hardDelete ) { if ( hardDelete ) { this . state = StreamState . HARD_DELETED . dbValue ( ) ; } else { this . state = StreamState . SOFT_DELETED . dbValue ( ) ; } }
Marks the stream as deleted .
59
7
142,467
public boolean removeDatastore ( final String datastoreName ) { final Element datastoreCatalogElement = getDatastoreCatalogElement ( ) ; final NodeList childNodes = datastoreCatalogElement . getChildNodes ( ) ; final int length = childNodes . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { final Node node = childNodes . item ( i ) ; if ( node instanceof Element ) { final Element element = ( Element ) node ; final Attr [ ] attributes = XmlDomDataContext . getAttributes ( element ) ; for ( Attr attr : attributes ) { if ( "name" . equals ( attr . getName ( ) ) ) { final String value = attr . getValue ( ) ; if ( datastoreName . equals ( value ) ) { // we have a match datastoreCatalogElement . removeChild ( element ) ; onDocumentChanged ( getDocument ( ) ) ; return true ; } } } } } return false ; }
Removes a datastore by it s name if it exists and is recognizeable by the externalizer .
221
22
142,468
public final void add ( @ NotNull final SerializedDataType type , final String contentType , @ NotNull final SerDeserializer serDeserializer ) { this . addSerializer ( type , serDeserializer ) ; this . addDeserializer ( type , contentType , serDeserializer ) ; }
Convenience method that adds both a new serializer and deserializer to the registry .
67
19
142,469
public final void addDeserializer ( @ NotNull final SerializedDataType type , final String contentType , @ NotNull final Deserializer deserializer ) { Contract . requireArgNotNull ( "type" , type ) ; Contract . requireArgNotNull ( "contentType" , contentType ) ; Contract . requireArgNotNull ( "deserializer" , deserializer ) ; final Key key = new Key ( type , contentType ) ; desMap . put ( key , deserializer ) ; }
Adds a new deserializer to the registry .
109
10
142,470
public final void setDefaultContentType ( @ NotNull final SerializedDataType type , final EnhancedMimeType contentType ) { Contract . requireArgNotNull ( "type" , type ) ; Contract . requireArgNotNull ( "contentType" , contentType ) ; contentTypes . put ( type , contentType ) ; }
Sets the default content type to use if no content type is given .
69
15
142,471
public final void addSerializer ( @ NotNull final SerializedDataType type , @ NotNull final Serializer serializer ) { Contract . requireArgNotNull ( "type" , type ) ; Contract . requireArgNotNull ( "serializer" , serializer ) ; serMap . put ( type , serializer ) ; }
Adds a new serializer to the registry .
69
9
142,472
public void compileProgram ( ) { program . inputs ( ) . forEach ( var -> var . calculateFuzzySpace ( ) ) ; program . outputs ( ) . forEach ( var -> var . calculateFuzzySpace ( ) ) ; program . rules ( ) . forEach ( rule -> { updateMemberReferenceCount ( rule . getCondition ( ) ) ; rule . assignmentMembers ( ) . forEach ( member -> member . incrReferenceCount ( ) ) ; } ) ; }
Compile the program
102
4
142,473
public MutableInputColumn < ? > getOutputColumnByName ( String name ) { if ( StringUtils . isNullOrEmpty ( name ) ) { return null ; } final List < MutableInputColumn < ? > > outputColumns = getOutputColumns ( ) ; for ( MutableInputColumn < ? > inputColumn : outputColumns ) { if ( name . equals ( inputColumn . getName ( ) ) ) { return inputColumn ; } } return null ; }
Gets an output column by name .
102
8
142,474
public static InvalidEntityKanbaneryException mostSpecializedException ( String response ) { //todo refactor this!!! if ( response == null || "" . equals ( response ) ) { return new InvalidEntityKanbaneryException ( response ) ; } else if ( TaskAlreadyInFirstColumnException . isBestExceptionFor ( response ) ) { return new TaskAlreadyInFirstColumnException ( response ) ; } else if ( TaskAlreadyInLastColumnException . isBestExceptionFor ( response ) ) { return new TaskAlreadyInLastColumnException ( response ) ; } else if ( PositionExceedsNumberOfTasksInColumnException . isBestExceptionFor ( response ) ) { return new PositionExceedsNumberOfTasksInColumnException ( response ) ; } else if ( CanOnlyIceBoxTaskFromFirstColumnException . isBestExceptionFor ( response ) ) { return new CanOnlyIceBoxTaskFromFirstColumnException ( response ) ; } else if ( CanOnlyArchiveFromLastColumnException . isBestExceptionFor ( response ) ) { return new CanOnlyArchiveFromLastColumnException ( response ) ; } else if ( NotFixedColumnCannotBeFirstException . isBestExceptionFor ( response ) ) { return new NotFixedColumnCannotBeFirstException ( response ) ; } else if ( BodyMustNotBeBlankException . isBestExceptionFor ( response ) ) { return new BodyMustNotBeBlankException ( response ) ; } else if ( MaximumNumbersOfCollaboratorsReachedException . isBestExceptionFor ( response ) ) { return new MaximumNumbersOfCollaboratorsReachedException ( response ) ; } else if ( UserAlreadyAssignedToThisProjectException . isBestExceptionFor ( response ) ) { return new UserAlreadyAssignedToThisProjectException ( response ) ; } else if ( ProjectOwnerCanNotBeGivenProjectMembership . isBestExceptionFor ( response ) ) { return new ProjectOwnerCanNotBeGivenProjectMembership ( response ) ; } else if ( CanNotDeleteColumnThatContainsTasksException . isBestExceptionFor ( response ) ) { return new CanNotDeleteColumnThatContainsTasksException ( response ) ; } else { return new InvalidEntityKanbaneryException ( response ) ; } }
May be used as Exception factory to determine the best exception to be thrown for such JSON response . For example we may throw TaskAlreadyInFirstColumnException if the JSON contains a message informing us about this .
472
41
142,475
@ Initialize public void init ( ) { logger . info ( "Initializing dictionary: {}" , this ) ; Datastore datastore = getDatastore ( ) ; DatastoreConnection dataContextProvider = datastore . openConnection ( ) ; getDatastoreConnections ( ) . add ( dataContextProvider ) ; }
Initializes a DatastoreConnection which will keep the connection open
72
13
142,476
public static ClassLoader getParentClassLoader ( ) { logger . debug ( "getParentClassLoader() invoked, web start mode: {}" , IS_WEB_START ) ; if ( IS_WEB_START ) { return Thread . currentThread ( ) . getContextClassLoader ( ) ; } else { return ClassLoaderUtils . class . getClassLoader ( ) ; } }
Gets an appropriate classloader for usage when performing classpath lookups and scanning .
84
17
142,477
protected Crosstab < Serializable > createMasterCrosstab ( Collection < ? extends R > results ) { final R firstResult = results . iterator ( ) . next ( ) ; final Crosstab < ? > firstCrosstab = firstResult . getCrosstab ( ) ; final Class < ? > valueClass = firstCrosstab . getValueClass ( ) ; final CrosstabDimension dimension1 = firstCrosstab . getDimension ( 0 ) ; final CrosstabDimension dimension2 = firstCrosstab . getDimension ( 1 ) ; @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) final Crosstab < Serializable > masterCrosstab = new Crosstab ( valueClass , dimension1 , dimension2 ) ; return masterCrosstab ; }
Builds the master crosstab including all dimensions and categories that will be included in the final result .
169
21
142,478
public void startFragment ( Fragment fragment , String tag , boolean canAddToBackstack ) { FragmentTransaction transaction = getSupportFragmentManager ( ) . beginTransaction ( ) . replace ( R . id . fragmentContainer , fragment ) ; if ( canAddToBackstack ) { transaction . addToBackStack ( tag ) ; } transaction . commit ( ) ; }
Start given Fragment
78
4
142,479
public void calculateFuzzySpace ( ) { double start = getFrom ( ) . doubleValue ( ) ; double stop = getTo ( ) . doubleValue ( ) ; double step = getStep ( ) . doubleValue ( ) ; // enumerate the variable range members ( ) . forEach ( member -> { if ( member . haveFunctionCall ( ) ) { for ( double i = start ; i <= stop ; i += step ) { member . calculateFunctionAt ( i ) ; } } else { member . calculateEndPoints ( start , stop ) ; for ( double i = start ; i <= stop ; i += step ) { member . calculateValueAt ( i ) ; } } } ) ; // find the max over all members double yMax = Double . MIN_VALUE ; for ( Member member : members ( ) ) { double memberMax = member . findMax ( ) ; yMax = memberMax > yMax ? memberMax : yMax ; } // normalize exploded values into a byte range for ( Member member : members ( ) ) { member . normalizeY ( yMax , 255 ) ; totalSteps = Math . max ( totalSteps , member . normalized ( ) . size ( ) ) ; } this . calculated = true ; }
Calculate the full fuzzy space for this variable .
262
11
142,480
static void accessFailed ( ) throws Throwable { String controllerClassName = getControllerClass ( ) . getName ( ) ; Logger . debug ( "Deadbolt: Access failure on [%s]" , controllerClassName ) ; String responseFormat = null ; if ( getActionAnnotation ( JSON . class ) != null ) { responseFormat = "json" ; } else if ( getActionAnnotation ( XML . class ) != null ) { responseFormat = "xml" ; } else if ( getControllerAnnotation ( JSON . class ) != null ) { responseFormat = "json" ; } else if ( getControllerAnnotation ( XML . class ) != null ) { responseFormat = "xml" ; } else { String defaultResponseFormat = Play . configuration . getProperty ( DEFAULT_RESPONSE_FORMAT ) ; if ( ! isEmpty ( defaultResponseFormat ) ) { responseFormat = defaultResponseFormat ; } } if ( ! isEmpty ( responseFormat ) ) { request . format = responseFormat ; } DEADBOLT_HANDLER . onAccessFailure ( controllerClassName ) ; }
Generic access failure forwarding point .
235
6
142,481
public static boolean hasAllRoles ( RoleHolder roleHolder , String [ ] roleNames ) { boolean hasRole = false ; if ( roleHolder != null ) { List < ? extends Role > roles = roleHolder . getRoles ( ) ; if ( roles != null ) { List < String > heldRoles = new ArrayList < String > ( ) ; for ( Role role : roles ) { if ( role != null ) { heldRoles . add ( role . getRoleName ( ) ) ; } } boolean roleCheckResult = true ; for ( int i = 0 ; roleCheckResult && i < roleNames . length ; i ++ ) { boolean invert = false ; String roleName = roleNames [ i ] ; if ( roleName . startsWith ( "!" ) ) { invert = true ; roleName = roleName . substring ( 1 ) ; } roleCheckResult = heldRoles . contains ( roleName ) ; if ( invert ) { roleCheckResult = ! roleCheckResult ; } } hasRole = roleCheckResult ; } } return hasRole ; }
Checks if the current user has all of the specified roles .
232
13
142,482
public static boolean hasRoles ( List < String > roleNames ) throws Throwable { DEADBOLT_HANDLER . beforeRoleCheck ( ) ; RoleHolder roleHolder = getRoleHolder ( ) ; return roleHolder != null && roleHolder . getRoles ( ) != null && hasAllRoles ( roleHolder , roleNames . toArray ( new String [ roleNames . size ( ) ] ) ) ; }
Checks if the current user has the specified role .
95
11
142,483
public void put ( E value , boolean createCategories ) throws IllegalArgumentException , NullPointerException { if ( createCategories ) { for ( int i = 0 ; i < categories . length ; i ++ ) { String category = categories [ i ] ; CrosstabDimension dimension = crosstab . getDimension ( i ) ; dimension . addCategory ( category ) ; } } crosstab . putValue ( value , categories ) ; }
Puts the given value to the navigated position in the crosstab .
95
16
142,484
protected String getHeaderValue ( HtmlRenderingContext context , int col , String columnName ) { return context . escapeHtml ( columnName ) ; }
Overrideable method for defining the literal HTML table header of a particular column .
34
15
142,485
public final String asWhereConditionWithParam ( ) { if ( table == null ) { return column + operator + ":" + column ; } return table + "." + column + operator + ":" + column ; }
Returns the where condition with a parameter .
45
8
142,486
public static List < RowProcessingConsumer > sortConsumers ( List < RowProcessingConsumer > consumers ) { final RowProcessingConsumerSorter sorter = new RowProcessingConsumerSorter ( consumers ) ; final List < RowProcessingConsumer > sortedConsumers = sorter . createProcessOrderedConsumerList ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Row processing order ({} consumers):" , sortedConsumers . size ( ) ) ; int i = 1 ; for ( RowProcessingConsumer rowProcessingConsumer : sortedConsumers ) { logger . debug ( " {}) {}" , i , rowProcessingConsumer ) ; i ++ ; } } return sortedConsumers ; }
Sorts a list of consumers into their execution order
152
10
142,487
public void processRows ( RowProcessingMetrics rowProcessingMetrics ) { final RowProcessingQueryOptimizer queryOptimizer = getQueryOptimizer ( ) ; final Query finalQuery = queryOptimizer . getOptimizedQuery ( ) ; final RowIdGenerator idGenerator ; if ( finalQuery . getFirstRow ( ) == null ) { idGenerator = new SimpleRowIdGenerator ( ) ; } else { idGenerator = new SimpleRowIdGenerator ( finalQuery . getFirstRow ( ) ) ; } final AnalysisJob analysisJob = _publishers . getAnalysisJob ( ) ; final AnalysisListener analysisListener = _publishers . getAnalysisListener ( ) ; final TaskRunner taskRunner = _publishers . getTaskRunner ( ) ; for ( RowProcessingConsumer rowProcessingConsumer : _consumers ) { if ( rowProcessingConsumer instanceof AnalyzerConsumer ) { final AnalyzerConsumer analyzerConsumer = ( AnalyzerConsumer ) rowProcessingConsumer ; final AnalyzerJob analyzerJob = analyzerConsumer . getComponentJob ( ) ; final AnalyzerMetrics metrics = rowProcessingMetrics . getAnalysisJobMetrics ( ) . getAnalyzerMetrics ( analyzerJob ) ; analysisListener . analyzerBegin ( analysisJob , analyzerJob , metrics ) ; } if ( rowProcessingConsumer instanceof TransformerConsumer ) { ( ( TransformerConsumer ) rowProcessingConsumer ) . setRowIdGenerator ( idGenerator ) ; } } final List < RowProcessingConsumer > consumers = queryOptimizer . getOptimizedConsumers ( ) ; final Collection < ? extends FilterOutcome > availableOutcomes = queryOptimizer . getOptimizedAvailableOutcomes ( ) ; analysisListener . rowProcessingBegin ( analysisJob , rowProcessingMetrics ) ; final RowConsumerTaskListener taskListener = new RowConsumerTaskListener ( analysisJob , analysisListener , taskRunner ) ; final Datastore datastore = _publishers . getDatastore ( ) ; try ( final DatastoreConnection con = datastore . openConnection ( ) ) { final DataContext dataContext = con . getDataContext ( ) ; if ( logger . isDebugEnabled ( ) ) { final String queryString ; if ( dataContext instanceof JdbcDataContext ) { final JdbcDataContext jdbcDataContext = ( JdbcDataContext ) dataContext ; queryString = jdbcDataContext . getQueryRewriter ( ) . rewriteQuery ( finalQuery ) ; } else { queryString = finalQuery . toSql ( ) ; } logger . debug ( "Final query: {}" , queryString ) ; logger . debug ( "Final query firstRow={}, maxRows={}" , finalQuery . getFirstRow ( ) , finalQuery . getMaxRows ( ) ) ; } // represents the distinct count of rows as well as the number of // tasks to execute int numTasks = 0 ; try ( final DataSet dataSet = dataContext . executeQuery ( finalQuery ) ) { final ConsumeRowHandler consumeRowHandler = new ConsumeRowHandler ( consumers , availableOutcomes ) ; while ( dataSet . next ( ) ) { if ( taskListener . isErrornous ( ) ) { break ; } numTasks ++ ; final Row metaModelRow = dataSet . getRow ( ) ; final int rowId = idGenerator . nextPhysicalRowId ( ) ; final MetaModelInputRow inputRow = new MetaModelInputRow ( rowId , metaModelRow ) ; final ConsumeRowTask task = new ConsumeRowTask ( consumeRowHandler , rowProcessingMetrics , inputRow , analysisListener , numTasks ) ; taskRunner . run ( task , taskListener ) ; } } taskListener . awaitTasks ( numTasks ) ; } if ( taskListener . isErrornous ( ) ) { _successful . set ( false ) ; return ; } analysisListener . rowProcessingSuccess ( analysisJob , rowProcessingMetrics ) ; }
Fires the actual row processing . This method assumes that consumers have been initialized and the publisher is ready to start processing .
865
24
142,488
public AbstractDatastoreType createPojoDatastore ( final Datastore datastore , final Set < Column > columns , final int maxRowsToQuery ) { final PojoDatastoreType datastoreType = new PojoDatastoreType ( ) ; datastoreType . setName ( datastore . getName ( ) ) ; datastoreType . setDescription ( datastore . getDescription ( ) ) ; try ( final DatastoreConnection con = datastore . openConnection ( ) ) { final DataContext dataContext = con . getDataContext ( ) ; final Schema schema ; final Table [ ] tables ; if ( columns == null || columns . isEmpty ( ) ) { schema = dataContext . getDefaultSchema ( ) ; tables = schema . getTables ( ) ; } else { tables = MetaModelHelper . getTables ( columns ) ; // TODO: There's a possibility that tables span multiple // schemas, but we cannot currently support that in a // PojoDatastore, so we just pick the first and cross our // fingers. schema = tables [ 0 ] . getSchema ( ) ; } datastoreType . setSchemaName ( schema . getName ( ) ) ; for ( final Table table : tables ) { final Column [ ] usedColumns ; if ( columns == null || columns . isEmpty ( ) ) { usedColumns = table . getColumns ( ) ; } else { usedColumns = MetaModelHelper . getTableColumns ( table , columns ) ; } final PojoTableType tableType = createPojoTable ( dataContext , table , usedColumns , maxRowsToQuery ) ; datastoreType . getTable ( ) . add ( tableType ) ; } } return datastoreType ; }
Creates a serialized POJO copy of a datastore .
385
14
142,489
public static Data valueOf ( final String type , final Object obj ) { return new Data ( type , mimeType ( obj ) , content ( obj ) ) ; }
Creates a new instance from a given object .
35
10
142,490
public void run ( R row , String value , int distinctCount ) { final List < Token > tokens ; boolean match = false ; try { tokens = _tokenizer . tokenize ( value ) ; } catch ( RuntimeException e ) { throw new IllegalStateException ( "Error occurred while tokenizing value: " + value , e ) ; } final String patternCode = getPatternCode ( tokens ) ; Set < TokenPattern > patterns ; synchronized ( this ) { patterns = _patterns . get ( patternCode ) ; if ( patterns == null ) { patterns = new HashSet < TokenPattern > ( ) ; _patterns . put ( patternCode , patterns ) ; } for ( TokenPattern pattern : patterns ) { if ( pattern . match ( tokens ) ) { storeMatch ( pattern , row , value , distinctCount ) ; match = true ; } } if ( ! match ) { final TokenPattern pattern ; try { pattern = new TokenPatternImpl ( value , tokens , _configuration ) ; } catch ( RuntimeException e ) { throw new IllegalStateException ( "Error occurred while creating pattern for: " + tokens , e ) ; } storeNewPattern ( pattern , row , value , distinctCount ) ; patterns . add ( pattern ) ; } } }
This method should be invoked by the user of the PatternFinder . Invoke it for each value in your dataset . Repeated values are handled correctly but if available it is more effecient to handle only the distinct values and their corresponding distinct counts .
260
51
142,491
public String map ( String name ) { String mapped = super . get ( name ) ; if ( mapped == null ) { mapped = String . format ( "%s%03d" , BASENAME , count . incrementAndGet ( ) ) ; super . put ( name , mapped ) ; } return mapped ; }
Map a variable name
65
4
142,492
public static KAFDocument createFromFile ( File file ) throws IOException { KAFDocument kaf = null ; try { kaf = ReadWriteManager . load ( file ) ; } catch ( JDOMException e ) { e . printStackTrace ( ) ; } return kaf ; }
Creates a new KAFDocument and loads the contents of the file passed as argument
62
17
142,493
public static KAFDocument createFromStream ( Reader stream ) throws IOException , JDOMException { KAFDocument kaf = null ; kaf = ReadWriteManager . load ( stream ) ; return kaf ; }
Creates a new KAFDocument loading the content read from the reader given on argument .
45
18
142,494
public LinguisticProcessor addLinguisticProcessor ( String layer , String name ) { LinguisticProcessor lp = new LinguisticProcessor ( name , layer ) ; //lp.setBeginTimestamp(timestamp); // no default timestamp List < LinguisticProcessor > layerLps = lps . get ( layer ) ; if ( layerLps == null ) { layerLps = new ArrayList < LinguisticProcessor > ( ) ; lps . put ( layer , layerLps ) ; } layerLps . add ( lp ) ; return lp ; }
Adds a linguistic processor to the document header . The timestamp is added implicitly .
129
15
142,495
public boolean linguisticProcessorExists ( String layer , String name , String version ) { List < LinguisticProcessor > layerLPs = lps . get ( layer ) ; if ( layerLPs == null ) { return false ; } for ( LinguisticProcessor lp : layerLPs ) { if ( lp . version == null ) { return false ; } else if ( lp . name . equals ( name ) && lp . version . equals ( version ) ) { return true ; } } return false ; }
Returns wether the given linguistic processor is already defined or not . Both name and version must be exactly the same .
113
23
142,496
public Term newTerm ( String id , Span < WF > span ) { idManager . updateCounter ( AnnotationType . TERM , id ) ; Term newTerm = new Term ( id , span , false ) ; annotationContainer . add ( newTerm , Layer . TERMS , AnnotationType . TERM ) ; addToWfTermIndex ( newTerm . getSpan ( ) . getTargets ( ) , newTerm ) ; // Rodrirekin hitz egin hau kentzeko return newTerm ; }
Creates a Term object to load an existing term . It receives the ID as an argument . The Term is added to the document object .
114
28
142,497
public Dep newDep ( Term from , Term to , String rfunc ) { Dep newDep = new Dep ( from , to , rfunc ) ; annotationContainer . add ( newDep , Layer . DEPS , AnnotationType . DEP ) ; return newDep ; }
Creates a new dependency . The Dep is added to the document object .
57
15
142,498
public Chunk newChunk ( String id , String phrase , Span < Term > span ) { idManager . updateCounter ( AnnotationType . CHUNK , id ) ; Chunk newChunk = new Chunk ( id , span ) ; newChunk . setPhrase ( phrase ) ; annotationContainer . add ( newChunk , Layer . CHUNKS , AnnotationType . CHUNK ) ; return newChunk ; }
Creates a chunk object to load an existing chunk . It receives it s ID as an argument . The Chunk is added to the document object .
93
30
142,499
public Chunk newChunk ( String phrase , Span < Term > span ) { String newId = idManager . getNextId ( AnnotationType . CHUNK ) ; Chunk newChunk = new Chunk ( newId , span ) ; newChunk . setPhrase ( phrase ) ; annotationContainer . add ( newChunk , Layer . CHUNKS , AnnotationType . CHUNK ) ; return newChunk ; }
Creates a new chunk . It assigns an appropriate ID to it . The Chunk is added to the document object .
94
24