idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
8,600
public void clearGeometries ( ) throws GeometryMergeException { if ( ! busy ) { throw new GeometryMergeException ( "Can't clear geometry list if no merging process is active." ) ; } for ( Geometry geometry : geometries ) { eventBus . fireEvent ( new GeometryMergeRemovedEvent ( geometry ) ) ; } geometries . clear ( ) ; ...
Clear the entire list of geometries for merging basically resetting the process .
8,601
public void stop ( final GeometryFunction callback ) throws GeometryMergeException { if ( ! busy ) { throw new GeometryMergeException ( "Can't stop the merging process since it is not activated." ) ; } if ( callback == null ) { cancel ( ) ; return ; } merge ( new GeometryFunction ( ) { public void execute ( Geometry ge...
End the merging process by effectively executing the merge operation and returning the result through a call - back .
8,602
protected Map < String , List < String > > getEffectiveAnnotationMap ( Map < String , List < String > > inheritedAnnotationMap , Map < String , List < String > > immediateAnnotationMap ) { Map < String , List < String > > effectiveAnnotationMap = new HashMap < String , List < String > > ( ) ; effectiveAnnotationMap . p...
Resolves the effective set of annotation by combining the inherited annotations with the immediate annotations associated with the statement or statement group . If an annotation existing in both the inherited map and the immediate map the immediate annotation overrides the inherited .
8,603
protected void writeAnnotations ( Map < String , List < String > > effectiveAnnotationMap , Map < String , List < String > > currentAnnotationMap , Writer writer ) throws IOException , BELRuntimeException { List < Map . Entry < String , List < String > > > entriesToSet = new ArrayList < Map . Entry < String , List < St...
Writes a series of BEL script control statements via the writer to match current annotations to the effective annotations . At the end of this function the content of currentAnnotationMap will be equivalent to the content of effectiveAnnotationMap .
8,604
public Span [ ] seqToSpans ( final String [ ] tokens ) { final Span [ ] origSpans = this . sequenceLabeler . tag ( tokens ) ; final Span [ ] seqSpans = SequenceLabelerME . dropOverlappingSpans ( origSpans ) ; return seqSpans ; }
Tag the current sentence .
8,605
public String [ ] lemmatize ( final String [ ] tokens ) { final Span [ ] origSpans = this . sequenceLabeler . tag ( tokens ) ; final Span [ ] seqSpans = SequenceLabelerME . dropOverlappingSpans ( origSpans ) ; final String [ ] decodedLemmas = StringUtils . decodeLemmas ( tokens , seqSpans ) ; return decodedLemmas ; }
Lemmatize the current sentence .
8,606
public void serialize ( final OutputStream out ) throws IOException { final Writer writer = new BufferedWriter ( new OutputStreamWriter ( out ) ) ; this . seqModel . serialize ( out ) ; writer . flush ( ) ; }
Serialize this model into the overall Sequence model .
8,607
public static void logWarn ( String message ) { GWT . log ( "WARNING: " + message ) ; LOG . warning ( message ) ; logServer ( LEVEL_WARN , message , null ) ; }
Log a warning .
8,608
public static void logError ( String message ) { GWT . log ( "ERROR: " + message ) ; LOG . severe ( message ) ; logServer ( LEVEL_ERROR , message , null ) ; }
Log an error .
8,609
public static void logDebug ( String message , Throwable t ) { logDebug ( message + SEP + getMessage ( t ) ) ; }
Debug logging with cause .
8,610
public static void logInfo ( String message , Throwable t ) { logInfo ( message + SEP + getMessage ( t ) ) ; }
Info logging with cause .
8,611
public static void logWarn ( String message , Throwable t ) { logWarn ( message + SEP + getMessage ( t ) ) ; }
Warning logging with cause .
8,612
public static void logError ( String message , Throwable t ) { logError ( message + SEP + getMessage ( t ) ) ; }
Error logging with cause .
8,613
public static void logServer ( int logLevel , String message , Throwable throwable ) { String logMessage = message ; if ( null == logMessage ) { logMessage = "" ; } if ( null != throwable ) { logMessage += "\n" + getMessage ( throwable ) ; } LogRequest logRequest = new LogRequest ( ) ; logRequest . setLevel ( logLevel ...
Log a message in the server log .
8,614
public void onMapTouchStart ( TouchEvent < ? > event ) { onDown ( event ) ; event . stopPropagation ( ) ; event . preventDefault ( ) ; }
Forward as mouse down and stop the event .
8,615
public void onMapTouchMove ( TouchEvent < ? > event ) { onDrag ( event ) ; event . stopPropagation ( ) ; event . preventDefault ( ) ; }
Forward as mouse move and stop the event .
8,616
public String asString ( ) { try { return EntityUtils . toString ( entity , PcsUtils . UTF8 . name ( ) ) ; } catch ( IOException e ) { throw new CStorageException ( "Can't get string from HTTP entity" , e ) ; } }
Extracts string from input stream
8,617
public JSONObject asJSONObject ( ) { if ( entity == null ) { return null ; } String str = asString ( ) ; try { return new JSONObject ( str ) ; } catch ( JSONException ex ) { throw new CStorageException ( "Error parsing the JSON response: " + str , ex ) ; } }
Get the response as a json object
8,618
public JSONArray asJSONArray ( ) { if ( entity == null ) { return null ; } String str = asString ( ) ; try { return new JSONArray ( str ) ; } catch ( JSONException ex ) { throw new CStorageException ( "Error parsing the JSON response: " + str , ex ) ; } }
Get the response as a json array
8,619
public InputStream openStream ( ) { if ( entity == null ) { return null ; } try { return entity . getContent ( ) ; } catch ( IOException ex ) { throw new CStorageException ( "Can't open stream" , ex ) ; } }
Open a raw stream on the response body .
8,620
public void setStyles ( String styles ) { this . styles = styles ; if ( eventBus != null && parentLayer != null ) { eventBus . fireEvent ( new LayerStyleChangedEvent ( parentLayer ) ) ; } }
Set the styles parameter to be used in the GetMap requests .
8,621
protected AjaxEventBehavior newAjaxEventBehavior ( final String event ) { return new AjaxEventBehavior ( event ) { private static final long serialVersionUID = 1L ; protected void onEvent ( final AjaxRequestTarget target ) { final RadioGroup < T > radioGroup = getGroup ( ) ; radioGroup . processInput ( ) ; onClick ( ta...
New ajax event behavior .
8,622
public static org . openbel . framework . common . model . Namespace convert ( final Namespace ws ) { return new org . openbel . framework . common . model . Namespace ( ws . getPrefix ( ) , ws . getResourceLocation ( ) ) ; }
Convert a WS namespace to a common namespace
8,623
private void afterLogin ( GwtCommand command , Deferred deferred ) { String token = notNull ( command . getUserToken ( ) ) ; if ( ! afterLoginCommands . containsKey ( token ) ) { afterLoginCommands . put ( token , new ArrayList < RetryCommand > ( ) ) ; } afterLoginCommands . get ( token ) . add ( new RetryCommand ( com...
Add a command and it s callbacks to the list of commands to retry after login .
8,624
public void setServiceEndPointUrl ( String url ) { ServiceDefTarget endpoint = ( ServiceDefTarget ) service ; endpoint . setServiceEntryPoint ( url ) ; }
Set the service end point URL to a different value . If pointing to a different context make sure the GeomajasController of that context supports this .
8,625
private void login ( final String oldToken ) { tokenRequestHandler . login ( new TokenChangedHandler ( ) { public void onTokenChanged ( TokenChangedEvent event ) { setToken ( event . getToken ( ) , event . getUserDetail ( ) , false ) ; List < RetryCommand > retryCommands = afterLoginCommands . remove ( oldToken ) ; if ...
Force request a new login the dangling commands for the previous token are retried when logged in .
8,626
private void setToken ( String userToken , UserDetail userDetail , boolean loginPending ) { boolean changed = ! isEqual ( this . userToken , userToken ) ; this . userToken = userToken ; if ( null == userDetail ) { userDetail = new UserDetail ( ) ; } this . userDetail = userDetail ; if ( changed ) { TokenChangedEvent ev...
Set the user token so it can be sent in every command . This is the internal version used by the token changed handler .
8,627
public void setUseLazyLoading ( boolean useLazyLoading ) { if ( useLazyLoading != this . useLazyLoading ) { if ( useLazyLoading ) { lazyFeatureIncludesDefault = GeomajasConstant . FEATURE_INCLUDE_STYLE + GeomajasConstant . FEATURE_INCLUDE_LABEL ; lazyFeatureIncludesSelect = GeomajasConstant . FEATURE_INCLUDE_ALL ; lazy...
Set lazy feature loading status .
8,628
private boolean isEqual ( Object o1 , Object o2 ) { return o1 == null ? o2 == null : o1 . equals ( o2 ) ; }
Checks whether 2 objects are equal . Null - safe 2 null objects are considered equal .
8,629
protected void onAfterRender ( final Component component ) { final Response response = component . getResponse ( ) ; response . write ( onWriteAfterRender ( ) ) ; }
Factory callback method to hook after render .
8,630
protected void onBeforeRender ( final Component component ) { final Response response = component . getResponse ( ) ; response . write ( onWriteBeforeRender ( ) ) ; }
Factory callback method to hook before render .
8,631
private String [ ] getSuffixes ( final String lex ) { final Integer start = Integer . parseInt ( this . attributes . get ( "sufBegin" ) ) ; final Integer end = Integer . parseInt ( this . attributes . get ( "sufEnd" ) ) ; final String [ ] suffs = new String [ end ] ; for ( int li = start , ll = end ; li < ll ; li ++ ) ...
Obtain suffixes for each token .
8,632
public void rearrangeTriangles ( int [ ] indices ) { assert indices . length % 3 == 0 ; for ( int off = 0 ; off < indices . length ; off += 3 ) { if ( ( indices [ off + 1 ] < indices [ off ] ) && ( indices [ off + 1 ] < indices [ off + 2 ] ) ) { int tmp = indices [ off ] ; indices [ off ] = indices [ off + 1 ] ; indice...
Re - arrange all triangles for optimal compression .
8,633
public String getDisplayValue ( final ResourceBundleKey resourceBundleKey ) { return ResourceModelFactory . newResourceModel ( getPropertiesKey ( resourceBundleKey . getKey ( ) ) , resourceBundleKey . getParameters ( ) , component , resourceBundleKey . getDefaultValue ( ) ) . getObject ( ) ; }
Gets the display value .
8,634
private ResourceReference getResourceReference ( ) { final Map < String , Object > map = new HashMap < > ( ) ; map . put ( "url" , WicketUrlExtensions . getUrlAsString ( pageClass ) ) ; final ResourceReference resourceReference = new TextTemplateResourceReference ( pageClass , this . filename , "text/javascript" , Mode...
Gets the resource reference .
8,635
public static void addCssFiles ( final IHeaderResponse response , final Class < ? > scope , final String ... cssFilenames ) { for ( final String cssFilename : cssFilenames ) { final HeaderItem item = CssHeaderItem . forReference ( new PackageResourceReference ( scope , cssFilename ) ) ; response . render ( item ) ; } }
Adds the given css files to the given response object in the given scope .
8,636
public static void addJsFiles ( final IHeaderResponse response , final Class < ? > scope , final String ... jsFilenames ) { for ( final String jsFilename : jsFilenames ) { final HeaderItem item = JavaScriptHeaderItem . forReference ( new PackageResourceReference ( scope , jsFilename ) ) ; response . render ( item ) ; }...
Adds the given javascript files to the given response object in the given scope .
8,637
private Set < PackageResourceReferenceWrapper > addFoundPackageResourceReferences ( Set < PackageResourceReferenceWrapper > packageResourceReferences , final Class < ? > iface ) { final Set < PackageResourceReferenceWrapper > prr = PackageResourceReferences . getInstance ( ) . getPackageResourceReferenceMap ( ) . get (...
Adds the found package resource references .
8,638
private Set < PackageResourceReferenceWrapper > addPackageResourceReferenceFromInterfaces ( Set < PackageResourceReferenceWrapper > packageResourceReferences , final Class < ? > searchClass ) { final Class < ? > [ ] interfaces = searchClass . getInterfaces ( ) ; for ( final Class < ? > iface : interfaces ) { packageRes...
Adds the package resource reference from interfaces .
8,639
public Set < PackageResourceReferenceWrapper > getPackageResourceReference ( final Class < ? > componentClass ) { Set < PackageResourceReferenceWrapper > packageResourceReference = PackageResourceReferences . getInstance ( ) . getPackageResourceReferenceMap ( ) . get ( componentClass ) ; packageResourceReference = addP...
Gets the package resource reference .
8,640
public void initializeResources ( final String packageName ) throws ClassNotFoundException , IOException , URISyntaxException { final Map < Class < ? > , ImportResource [ ] > resourcesMap = ImportResourcesExtensions . getImportResources ( packageName ) ; for ( final Entry < Class < ? > , ImportResource [ ] > entry : re...
Initialize resources from the given package .
8,641
private String doCompile ( String resourceLocation ) throws IndexingFailure , ResourceDownloadError { final ResolvedResource resolved = resourceCache . resolveResource ( NAMESPACES , resourceLocation ) ; final File resourceCopy = resolved . getCacheResourceCopy ( ) ; namespaceIndexerService . indexNamespace ( resourceL...
Do compilation of the namespace resource .
8,642
private Set < String > doSearch ( String resourceLocation , Pattern pattern ) { JDBMNamespaceLookup il = openNamespaces . get ( resourceLocation ) ; Set < String > results = new HashSet < String > ( ) ; for ( String value : il . getKeySet ( ) ) { if ( pattern . matcher ( value ) . matches ( ) ) { results . add ( value ...
Do a search on the values in namespace specified by the resource location
8,643
private void doVerify ( Parameter p ) throws NamespaceSyntaxWarning { if ( p . getValue ( ) == null ) { throw new InvalidArgument ( "parameter value is null" ) ; } Namespace ns = p . getNamespace ( ) ; String resourceLocation = ns . getResourceLocation ( ) ; if ( resourceLocation == null ) { throw new InvalidArgument (...
Do namespace value verification against a resource location . This implementation assumes the namespace has been open prior to execution .
8,644
public void copyProviderDataToBuilder ( TemplateBuilder builder , TemplateBuilderDataProvider templateBuilderDataProvider ) { PageSize size = templateBuilderDataProvider . getPageSize ( ) ; if ( templateBuilderDataProvider . isLandscape ( ) ) { builder . setPageHeight ( size . getWidth ( ) ) ; builder . setPageWidth ( ...
Fill the builder with information from the data provider . UTIL method .
8,645
protected Label newEmailLabel ( final String id , final String forId , final String resourceKey , final String defaultValue , final Component component ) { return ComponentFactory . newLabel ( id , forId , ResourceModelFactory . newResourceModel ( resourceKey , component , defaultValue ) ) ; }
Factory method for creating the Label . This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a Label .
8,646
protected Component newEmailTextField ( final String id , final IModel < PasswordForgottenModelBean > model ) { final IModel < String > labelModel = ResourceModelFactory . newResourceModel ( "password.forgotten.content.label" , this , "Give email in the Textfield" ) ; final IModel < String > placeholderModel = Resource...
Factory method for creating the EmailTextField for the email . This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a EmailTextField for the email .
8,647
private void addParseEvents ( final List < Event > parseEvents , Parse [ ] chunks ) { int ci = 0 ; while ( ci < chunks . length ) { final Parse c = chunks [ ci ] ; final Parse parent = c . getParent ( ) ; if ( parent != null ) { final String type = parent . getType ( ) ; String outcome ; if ( firstChild ( c , parent ) ...
Adds events for parsing ( post tagging and chunking to the specified list of events for the specified parse chunks .
8,648
private void showDialog ( String msg , String stack ) { ExceptionDialog warning = new ExceptionDialog ( msg , stack ) ; warning . show ( ) ; }
Makes a dialog box to show exception message and stack trace .
8,649
private String rawCreateFolder ( CPath path , String parentId ) { JSONObject body = new JSONObject ( ) ; body . put ( "title" , path . getBaseName ( ) ) ; body . put ( "mimeType" , MIME_TYPE_DIRECTORY ) ; JSONArray ids = new JSONArray ( ) ; JSONObject idObj = new JSONObject ( ) ; idObj . put ( "id" , parentId ) ; ids ....
Create a folder without creating any higher level intermediate folders and returned id of created folder .
8,650
public static void renderHeaderResponse ( final IHeaderResponse response , final Class < ? > componentClass ) { final Set < PackageResourceReferenceWrapper > headerContributors = PackageResourceReferences . getInstance ( ) . getPackageResourceReference ( componentClass ) ; if ( ( null != headerContributors ) && ! heade...
Render header response .
8,651
public static String getSignatureHexCode ( Context context , String targetPackageName ) { if ( TextUtils . isEmpty ( targetPackageName ) ) { return null ; } try { PackageInfo info = PackageManagerUtils . getSignaturePackageInfo ( context , targetPackageName ) ; if ( info . signatures . length != 1 ) { return null ; } S...
Obtains the signature hex code .
8,652
@ SuppressLint ( "NewApi" ) public static Point getDisplaySize ( WindowManager manager ) { Display display = manager . getDefaultDisplay ( ) ; if ( Build . VERSION . SDK_INT > Build . VERSION_CODES . HONEYCOMB_MR2 ) { Point size = new Point ( ) ; display . getSize ( size ) ; return size ; } else { Point size = new Poin...
Get the display width and height .
8,653
@ SuppressLint ( "NewApi" ) @ SuppressWarnings ( "deprecation" ) public static int getDisplayWidth ( WindowManager manager ) { Display display = manager . getDefaultDisplay ( ) ; if ( Build . VERSION . SDK_INT > Build . VERSION_CODES . HONEYCOMB_MR2 ) { Point size = new Point ( ) ; display . getSize ( size ) ; return s...
Get the display width .
8,654
void initialize ( ) { if ( initialized ) { throw new IllegalStateException ( "Dialect already initialized; re-initialization not allowed" ) ; } this . hashCode = new HashCodeBuilder ( ) . append ( geneNamespaces ) . append ( bpNamespaces ) . append ( chemNamespaces ) . append ( displayLongForm ) . append ( removeNamesp...
Initialize the dialect . Must be invoked post - mutation .
8,655
protected Parameter convert ( Parameter orig ) { if ( orig . getNamespace ( ) == null ) { return orig ; } NamespaceDomain domain = nsDomains . get ( orig . getNamespace ( ) . getPrefix ( ) ) ; if ( domain == null ) { return orig ; } List < Namespace > coll ; switch ( domain ) { case BiologicalProcess : coll = bpNamespa...
Convert a parameter to the preferred namespaces .
8,656
public static int dipToPixel ( Resources resources , int dip ) { final float scale = resources . getDisplayMetrics ( ) . density ; return ( int ) ( dip * scale + 0.5f ) ; }
Convert the dips to pixels based on density scale .
8,657
public static float pixelToDip ( WindowManager windowManager , int pixel ) { DisplayMetrics metrics = new DisplayMetrics ( ) ; windowManager . getDefaultDisplay ( ) . getMetrics ( metrics ) ; return metrics . scaledDensity * pixel ; }
Convert the pixels to dips based on density scale
8,658
public static float sipToPixel ( Resources resources , float sip ) { float density = resources . getDisplayMetrics ( ) . scaledDensity ; return sip * density ; }
Convert the sip to pixels based on density scale .
8,659
public static float pixelToSip ( Context context , float pixels ) { DisplayMetrics metrics = new DisplayMetrics ( ) ; float scaledDensity = metrics . scaledDensity ; if ( pixels == 0 || scaledDensity == 0 ) { return 1 ; } return pixels / scaledDensity ; }
Convert the pixels to sips based on density scale .
8,660
@ SuppressWarnings ( "unchecked" ) public static < V extends View > V findViewById ( View view , int id ) { return ( V ) view . findViewById ( id ) ; }
Find the specific view from the view as traversal root . Returning value type is bound to your variable type .
8,661
public ByteSource getByteSource ( ) { ByteSource bs = byteSource ; if ( progressListener != null ) { bs = new ProgressByteSource ( bs , progressListener ) ; } return bs ; }
If no progress listener has been set return the byte source set in constructor otherwise decorate it for progress .
8,662
public void addChildComponent ( final WicketField < ? > parent ) { if ( ( parent . getChildren ( ) != null ) && ! parent . getChildren ( ) . isEmpty ( ) ) { for ( final SimpleTag iterable_element : parent . getChildren ( ) ) { final WicketField < ? > field = ( WicketField < ? > ) iterable_element ; final Component c = ...
Adds recursive the child components .
8,663
public void start ( Geometry geometry ) { this . geometry = geometry ; splitLine = new Geometry ( Geometry . LINE_STRING , 0 , 0 ) ; service . start ( splitLine ) ; service . setEditingState ( GeometryEditState . INSERTING ) ; service . setInsertIndex ( service . getIndexService ( ) . create ( GeometryIndexType . TYPE_...
Start splitting the given geometry .
8,664
private void check ( String pathName ) { for ( char c : pathName . toCharArray ( ) ) { if ( c < 32 || FORBIDDEN_CHAR == c ) { throw new IllegalArgumentException ( "Pathname contains invalid char " + c + " : " + pathName ) ; } } for ( String comp : pathName . split ( "/" ) ) { if ( ! comp . trim ( ) . equals ( comp ) ) ...
Check pathname is valid
8,665
private void processOutputDirectory ( ) { final String outputPath = outputDirectory . getAbsolutePath ( ) ; final String [ ] args = getCommandLineArguments ( ) ; final PhaseThreeApplication p3App = new PhaseThreeApplication ( args ) ; String folder ; if ( p3App . isSkipped ( ) ) { folder = PhaseTwoApplication . DIR_ART...
Process output directory .
8,666
private void processFiles ( File protoNetwork ) { phaseOutput ( format ( "=== %s ===" , getApplicationName ( ) ) ) ; ProtoNetworkDescriptor pnd = new BinaryProtoNetworkDescriptor ( protoNetwork ) ; BinaryProtoNetworkExternalizer bpne = new BinaryProtoNetworkExternalizer ( ) ; ProtoNetwork gpn = null ; try { gpn = bpne ...
Starts phase four creation of KAM .
8,667
private void stage1 ( ProtoNetwork gpn ) { beginStage ( PHASE4_STAGE1_HDR , "1" , numPhases ) ; final StringBuilder bldr = new StringBuilder ( ) ; final String kamURL = sysconfig . getKamURL ( ) ; final String kamUser = sysconfig . getKamUser ( ) ; final String kamPass = sysconfig . getKamPassword ( ) ; DBConnection db...
Stage one connection to KAM store .
8,668
public static Cookie getCookie ( final String name ) { return ( ( WebRequest ) RequestCycle . get ( ) . getRequest ( ) ) . getCookie ( name ) ; }
Gets the cookie form the given name .
8,669
public static Cookie newCookie ( final String name , final String value , final String purpose , final String domain , final int maxAge , final String path , final boolean secure ) { final Cookie cookie = new Cookie ( name , value ) ; cookie . setComment ( purpose ) ; cookie . setDomain ( domain ) ; cookie . setMaxAge ...
Creates a new cookie .
8,670
private SnapshotElement newSnapshotElement ( String name , Handle handle , QType type ) throws IOException { return new DefaultSnapshotElement ( name , m_store . getLocation ( handle ) , type , handle . getIdentification ( ) ) ; }
Create a new SnapshotElement instance of name handle and type . Helper method .
8,671
protected RequiredTextField < String > newRequiredTextField ( final String id , final IModel < CaptchaModelBean > model ) { final RequiredTextField < String > captchaInput = new RequiredTextField < String > ( "captchaInput" , new PropertyModel < > ( model , "captchaInput" ) ) { private static final long serialVersionUI...
Factory method for creating a new RequiredTextField . This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a RequiredTextField .
8,672
public final void detailEvaluate ( ) throws IOException { final List < EvaluationMonitor < SequenceLabelSample > > listeners = new LinkedList < EvaluationMonitor < SequenceLabelSample > > ( ) ; final SequenceLabelerDetailedFMeasureListener detailedFListener = new SequenceLabelerDetailedFMeasureListener ( ) ; listeners ...
Evaluate and print the precision recall and F measure per sequence class .
8,673
public List < Annotation > getAllAnnotations ( ) { List < Annotation > ret = new ArrayList < Annotation > ( ) ; for ( StatementGroup sg : statementGroups ) { ret . addAll ( sg . getAllAnnotations ( ) ) ; } return ret ; }
Returns all annotations contained within the document .
8,674
public Set < Namespace > getAllNamespaces ( ) { if ( namespaceGroup == null ) { return emptySet ( ) ; } return new HashSet < Namespace > ( namespaceGroup . getAllNamespaces ( ) ) ; }
Returns the set of all namespaces contained within the document .
8,675
public Set < Term > getAllTerms ( ) { final Set < Term > ret = new HashSet < Term > ( ) ; for ( final StatementGroup sg : statementGroups ) { for ( final Statement stmt : sg . getAllStatements ( ) ) { ret . addAll ( stmt . getAllTerms ( ) ) ; } } return ret ; }
Returns the set of all terms contained within the document .
8,676
public Set < Parameter > getAllParameters ( ) { final Set < Parameter > ret = new HashSet < Parameter > ( ) ; for ( final Term term : getAllTerms ( ) ) { List < Parameter > params = term . getParameters ( ) ; if ( params == null ) { continue ; } ret . addAll ( params ) ; } return ret ; }
Returns the set of all parameters contained within the document .
8,677
public List < StatementGroup > getAllStatementGroups ( ) { final List < StatementGroup > ret = new ArrayList < StatementGroup > ( ) ; ret . addAll ( statementGroups ) ; for ( final StatementGroup sg : statementGroups ) { ret . addAll ( sg . getAllStatementGroups ( ) ) ; } return ret ; }
Returns a list of all statement groups contained within the document .
8,678
public List < Statement > getAllStatements ( ) { final List < Statement > ret = new LinkedList < Statement > ( ) ; for ( final StatementGroup sg : statementGroups ) { ret . addAll ( sg . getAllStatements ( ) ) ; } return ret ; }
Returns a list of all statements contained within the document .
8,679
public int getStatementCount ( ) { int ret = 0 ; for ( final StatementGroup sg : statementGroups ) { ret += sg . getAllStatements ( ) . size ( ) ; } return ret ; }
Returns the count of statements contained within the document .
8,680
public void resolveReferences ( ) { Map < String , AnnotationDefinition > defs = getDefinitionMap ( ) ; final List < Annotation > annos = new ArrayList < Annotation > ( ) ; for ( final StatementGroup sg : statementGroups ) { annos . addAll ( sg . getAllAnnotations ( ) ) ; } for ( final Annotation a : annos ) { Annotati...
Resolves any property references in use within the document to their corresponding instances .
8,681
protected IModel < String > newDescription ( ) { return ResourceModelFactory . newResourceModel ( ResourceBundleKey . builder ( ) . key ( "page.meta.description" ) . defaultValue ( "" ) . build ( ) , this ) ; }
Factory method that can be overwritten for new meta tag content for description .
8,682
public static WebTask sleepFor ( int seconds ) { return new BaseWebTask ( ) { public WebPage run ( WebPage initialPage ) { try { Thread . sleep ( seconds * 1000 ) ; } catch ( InterruptedException e ) { logger . warn ( "sleep interrupted" ) ; } return initialPage ; } } ; }
Task that sleeps for the given number of seconds and finally returns the very initial page .
8,683
private String buildUrl ( String methodPath , CPath path ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( END_POINT ) . append ( '/' ) . append ( methodPath ) ; if ( path != null ) { sb . append ( '/' ) . append ( scope ) . append ( path . getUrlEncoded ( ) ) ; } return sb . toString ( ) ; }
Url encodes object path and concatenate to API endpoint and method to get full URL
8,684
private String buildContentUrl ( String methodPath , CPath path ) { return CONTENT_END_POINT + '/' + methodPath + '/' + scope + path . getUrlEncoded ( ) ; }
Url encodes blob path and concatenate to content endpoint to get full URL
8,685
private CFile parseCFile ( JSONObject jObj ) { CFile cfile ; if ( jObj . optBoolean ( "is_dir" , false ) ) { cfile = new CFolder ( new CPath ( jObj . getString ( "path" ) ) ) ; } else { cfile = new CBlob ( new CPath ( jObj . getString ( "path" ) ) , jObj . getLong ( "bytes" ) , jObj . getString ( "mime_type" ) ) ; Stri...
Generates a CFile from its json representation
8,686
public static File resolveResource ( String resourceLocation , String localPath , String localFileName ) throws ResourceDownloadError { if ( nulls ( resourceLocation , localPath , localFileName ) ) { throw new InvalidArgument ( "null argument(s) provided" ) ; } createDirectories ( localPath ) ; StringBuilder builder = ...
Resolves a resource location to a local path .
8,687
public void addUrl ( String url ) { if ( url != null && ! url . isEmpty ( ) ) { renderer . addUrl ( url ) ; } }
Add an URL to the tile service .
8,688
private Collection < RequestMapperBean > initializeRequestMappers ( final Request request ) { final Set < RequestMapperBean > mapperBeans = new TreeSet < > ( getComparator ( ) ) ; for ( final IRequestMapper requestMapper : this . requestMappers ) { mapperBeans . add ( new RequestMapperBean ( requestMapper , requestMapp...
Initialize request mappers .
8,689
protected Comparator < RequestMapperBean > newComparator ( ) { return new Comparator < RequestMapperBean > ( ) { public int compare ( final RequestMapperBean o1 , final RequestMapperBean o2 ) { return o1 . getCompatibilityScore ( ) - o2 . getCompatibilityScore ( ) ; } } ; }
Factory method for creating a new Comparator for sort the compatibility score . This method is invoked in the method initializeRequestMappers and can be overridden so users can provide their own version of a Comparator .
8,690
public String buildMailtoContent ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( email ) ; if ( StringUtils . isNotEmpty ( subject ) ) { sb . append ( "?" ) . append ( "subject" ) . append ( "=" ) . append ( subject ) ; } if ( StringUtils . isNotEmpty ( body ) ) { sb . append ( StringUtils . isNotEmpty (...
Builds the mailto content .
8,691
private Headers headOrNull ( CPath path ) { try { String url = getObjectUrl ( path ) ; HttpHead request = new HttpHead ( url ) ; RequestInvoker < CResponse > ri = getBasicRequestInvoker ( request , path ) ; CResponse response = retryStrategy . invokeRetry ( ri ) ; return response . getHeaders ( ) ; } catch ( CFileNotFo...
Perform a quick HEAD request on the given object to check existence and type .
8,692
private void rawCreateFolder ( CPath path ) throws CStorageException { CResponse response = null ; try { String url = getObjectUrl ( path ) ; HttpPut request = new HttpPut ( url ) ; request . addHeader ( "Content-Type" , CONTENT_TYPE_DIRECTORY ) ; RequestInvoker < CResponse > ri = getApiRequestInvoker ( request , path ...
Create a folder without creating any higher level intermediate folders .
8,693
public CFile getFile ( CPath path ) { Headers headers = headOrNull ( path ) ; if ( headers == null ) { return null ; } if ( ! headers . contains ( "Content-Type" ) ) { LOGGER . warn ( "{} object has no content type ?!" , path ) ; return null ; } CFile file ; if ( ! CONTENT_TYPE_DIRECTORY . equals ( headers . getHeaderV...
Inquire details about object at given path .
8,694
public CFolderContent listFolder ( CPath path ) throws CStorageException { JSONArray array = listObjectsWithinFolder ( path , "/" ) ; CFile file ; if ( array == null || array . length ( ) == 0 ) { file = getFile ( path ) ; if ( file == null ) { return null ; } if ( file . isBlob ( ) ) { throw new CInvalidFileTypeExcept...
Return map of CFile in given folder . Key is file CPath
8,695
private String getObjectUrl ( CPath path ) { String containerUrl = getCurrentContainerUrl ( ) ; return containerUrl + path . getUrlEncoded ( ) ; }
Url encode object path and concatenate to current container URL to get full URL
8,696
public StorageBuilder setAppInfoRepository ( AppInfoRepository appInfoRepo , String appName ) { this . appInfoRepo = appInfoRepo ; this . appName = appName ; return this ; }
Set the app informations repository . This setter must always be called during the build
8,697
public StorageBuilder setUserCredentialsRepository ( UserCredentialsRepository userCredentialsRepo , String userId ) { this . userCredentialsRepo = userCredentialsRepo ; this . userId = userId ; return this ; }
Set the user credentials repository . This setter must always be called during the build
8,698
public IStorageProvider build ( ) { if ( appInfoRepo == null ) { throw new IllegalStateException ( "Undefined application information repository" ) ; } if ( userCredentialsRepo == null ) { throw new IllegalStateException ( "Undefined user credentials repository" ) ; } try { Constructor providerConstructor = providerCla...
Builds a provider - specific storage implementation by passing this builder in constructor . Each implementation gets its required information from builder .
8,699
@ SuppressWarnings ( "unchecked" ) protected List < ? extends Class < ? extends WebPage > > getAllPageClassesQuietly ( ) { final List < Class < ? extends WebPage > > pages = new ArrayList < > ( ) ; try { final Set < Class < ? > > set = AnnotationExtensions . getAllAnnotatedClasses ( getPackageName ( ) , MountPath . cla...
Gets the all page classes quietly .