idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
6,300
private void connectArcToPort ( SbgnPDNode lPort , Port vPort ) { for ( Object e : ( lPort . getEdges ( ) ) ) { if ( ( ( LEdge ) e ) . type . equals ( "rigid edge" ) ) continue ; Arc arc = idToArcs . get ( ( ( LEdge ) e ) . label ) ; if ( lPort . label . equals ( ( ( LEdge ) e ) . getSource ( ) . label ) ) { arc . setS...
This method connects the existing arcs to the newly created ports which are created by ChiLay and SBGNPD Layout .
6,301
private void populateCompartmentOccurencesMap ( Glyph targetGlyph , HashMap < String , Integer > compartmentIDandOccurenceMap ) { String rootID = "root" ; if ( targetGlyph . getCompartmentRef ( ) != null ) { Glyph containerCompartment = ( Glyph ) targetGlyph . getCompartmentRef ( ) ; String compartmentID = containerCom...
Updates a hashmap by incrementing the number of nodes in the compartment glyph that includes targetGlyph . It is assumed that given hashmap includes compartment ids as keys and number of nodes as values . This method is an utility method that will be used to populate a hashmap while determining the compartment node of ...
6,302
private void createVNodes ( VCompound parent , List < Glyph > glyphs ) { for ( Glyph glyph : glyphs ) { if ( ! glyphClazzOneOf ( glyph , GlyphClazz . UNIT_OF_INFORMATION , GlyphClazz . STATE_VARIABLE ) ) { if ( ! isChildless ( glyph ) ) { VCompound v = new VCompound ( glyph ) ; idToGLyph . put ( glyph . getId ( ) , gly...
Recursively creates VNodes from Glyphs of Sbgn .
6,303
private void createLEdges ( List < Arc > arcs ) { for ( Arc arc : arcs ) { LEdge lEdge = layout . newEdge ( null ) ; lEdge . type = arc . getClazz ( ) ; lEdge . label = arc . getId ( ) ; LNode sourceLNode = viewToLayout . get ( glyphToVNode . get ( arc . getSource ( ) ) ) ; LNode targetLNode = viewToLayout . get ( glyp...
Creates LNodes from Arcs of Sbgn and adds it to the passed layout object .
6,304
private void createLNode ( VNode vNode , VNode parent ) { LNode lNode = layout . newNode ( vNode ) ; lNode . type = vNode . glyph . getClazz ( ) ; lNode . label = vNode . glyph . getId ( ) ; LGraph rootLGraph = layout . getGraphManager ( ) . getRoot ( ) ; viewToLayout . put ( vNode , lNode ) ; layoutToView . put ( lNod...
Helper function for creating LNode objects from VNode objects and adds them to the given layout .
6,305
private void setCompartmentRefForComplexMembers ( final Glyph glyph , final Glyph compartment , final Set < Glyph > visited ) { if ( ! visited . add ( glyph ) ) return ; glyph . setCompartmentRef ( compartment ) ; if ( glyph . getGlyph ( ) . size ( ) > 0 ) { for ( Glyph g : glyph . getGlyph ( ) ) { setCompartmentRefFor...
Recursively sets compartmentRef fields of members of a complex glyph to the same value as complex s compartment .
6,306
private void removePortsFromArcs ( List < Arc > arcs ) { for ( Arc arc : arcs ) { if ( arc . getSource ( ) instanceof Port ) { Glyph source = portIDToOwnerGlyph . get ( ( ( Port ) arc . getSource ( ) ) . getId ( ) ) ; arc . setSource ( source ) ; } if ( arc . getTarget ( ) instanceof Port ) { Glyph target = portIDToOwn...
This method replaces ports of arc objects with their owners .
6,307
private void initPortIdToGlyphMap ( List < Glyph > glyphs ) { for ( Glyph glyph : glyphs ) { for ( Port p : glyph . getPort ( ) ) { portIDToOwnerGlyph . put ( p . getId ( ) , glyph ) ; } if ( glyph . getGlyph ( ) . size ( ) > 0 ) initPortIdToGlyphMap ( glyph . getGlyph ( ) ) ; } }
This method initializes map for glyphs and their respective ports .
6,308
public boolean isSafe ( Node node , Edge edge ) { initMaps ( ) ; setColor ( node , BLACK ) ; setLabel ( node , 0 ) ; setLabel ( edge , 0 ) ; labelEquivRecursive ( node , UPWARD , 0 , false , false ) ; labelEquivRecursive ( node , DOWNWARD , 0 , false , false ) ; Node neigh = edge . getTargetNode ( ) ; if ( getColor ( n...
Checks whether an edge is on an unwanted cycle .
6,309
protected boolean processNode2 ( Node current ) { return processEdges ( current , current . getDownstream ( ) ) || processEdges ( current , current . getUpstream ( ) ) ; }
Continue the search from the node . 2 is added because a name clash in the parent class .
6,310
private boolean processEdges ( Node current , Collection < Edge > edges ) { for ( Edge edge : edges ) { if ( ! result . contains ( edge ) ) continue ; setLabel ( edge , getLabel ( current ) ) ; Node neigh = edge . getSourceNode ( ) == current ? edge . getTargetNode ( ) : edge . getSourceNode ( ) ; if ( getColor ( neigh...
Continue evaluating the next edge .
6,311
protected void createAndAdd ( Model model , String id , String localName ) { BioPAXElement bpe = this . getFactory ( ) . create ( localName , id ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( "id:" + id + " " + localName + " : " + bpe ) ; } if ( bpe != null ) { model . add ( bpe ) ; } else { log . warn ( "null obj...
This method is called by the reader for each OWL instance in the OWL model . It creates a POJO instance with the given id and inserts it into the model . The inserted object is clean in the sense that its properties are not set yet .
6,312
protected Object resourceFixes ( BioPAXElement bpe , Object value ) { if ( this . isFixReusedPEPs ( ) && value instanceof physicalEntityParticipant ) { value = this . getReusedPEPHelper ( ) . fixReusedPEP ( ( physicalEntityParticipant ) value , bpe ) ; } return value ; }
This method currently only fixes reusedPEPs if the option is set . As L2 is becoming obsolete this method will be slated for deprecation .
6,313
protected void bindValue ( String valueString , PropertyEditor editor , BioPAXElement bpe , Model model ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Binding: " + bpe + '(' + bpe . getModelInterface ( ) + " has " + editor + ' ' + valueString ) ; } Object value = ( valueString == null ) ? null : valueString . tr...
This method binds the value to the bpe . Actual assignment is handled by the editor - but this method performs most of the workarounds and also error handling due to invalid parameters .
6,314
private boolean containsNull ( PhysicalEntity [ ] pes ) { for ( PhysicalEntity pe : pes ) { if ( pe == null ) return true ; } return false ; }
Checks if any element in the chain is null .
6,315
protected PhysicalEntity [ ] fillArray ( PhysicalEntity parent , PhysicalEntity target , int depth , int dir ) { if ( parent == target ) { PhysicalEntity [ ] pes = new PhysicalEntity [ depth ] ; pes [ 0 ] = target ; return pes ; } if ( parent instanceof Complex ) { for ( PhysicalEntity mem : ( ( Complex ) parent ) . ge...
Creates the chain that links the given endpoints .
6,316
public Set < String > getCellularLocations ( ) { Set < String > locs = new HashSet < String > ( ) ; for ( PhysicalEntity pe : pes ) { CellularLocationVocabulary voc = pe . getCellularLocation ( ) ; if ( voc != null ) { for ( String term : voc . getTerm ( ) ) { if ( term != null && term . length ( ) > 0 ) locs . add ( t...
Retrieves the cellular location of the PhysicalEntity .
6,317
public boolean intersects ( PhysicalEntityChain rpeh , boolean ignoreEndPoints ) { for ( PhysicalEntity pe1 : pes ) { for ( PhysicalEntity pe2 : rpeh . pes ) { if ( pe1 == pe2 ) { if ( ignoreEndPoints ) { if ( ( pes [ 0 ] == pe1 || pes [ pes . length - 1 ] == pe1 ) && ( rpeh . pes [ 0 ] == pe2 || rpeh . pes [ rpeh . pe...
Checks if two chains intersect .
6,318
public Activity checkActivityLabel ( ) { boolean active = false ; boolean inactive = false ; for ( PhysicalEntity pe : pes ) { for ( Object o : PE2TERM . getValueFromBean ( pe ) ) { String s = ( String ) o ; if ( s . contains ( "inactiv" ) ) inactive = true ; else if ( s . contains ( "activ" ) ) active = true ; } for (...
Checks if the chain has a member with an activity label .
6,319
public Set < ModificationFeature > getModifications ( ) { Set < ModificationFeature > set = new HashSet < ModificationFeature > ( ) ; for ( PhysicalEntity pe : pes ) { set . addAll ( PE2FEAT . getValueFromBean ( pe ) ) ; } return set ; }
Collects modifications from the elements of the chain .
6,320
public boolean satisfies ( Match match , int ... ind ) { Collection < BioPAXElement > set = con . generate ( match , ind ) ; switch ( type ) { case EQUAL : return set . size ( ) == size ; case GREATER : return set . size ( ) > size ; case GREATER_OR_EQUAL : return set . size ( ) >= size ; case LESS : return set . size ...
Checks if generated element size is in limits .
6,321
public void writeResult ( Map < BioPAXElement , List < Match > > matches , OutputStream out ) throws IOException { writeResultDetailed ( matches , out , 5 ) ; }
Writes the result as A modifications - of - A B gains - of - B loss - of - B where A and B are gene symbols and whitespace is tab . Modifications are comma separated .
6,322
public String getValue ( Match m , int col ) { switch ( col ) { case 0 : { return getGeneSymbol ( m , "controller ER" ) ; } case 1 : { return concat ( getModifications ( m , "controller simple PE" , "controller PE" ) , " " ) ; } case 2 : { return getGeneSymbol ( m , "changed ER" ) ; } case 3 : { return concat ( getDelt...
Creates values for the result file columns .
6,323
@ SuppressWarnings ( { "unchecked" } ) public static < T extends LocalizableResource > T get ( Class < T > cls , String locale ) { Map < String , LocalizableResource > localeCache = getLocaleCache ( cls ) ; T m = ( T ) localeCache . get ( locale ) ; if ( m != null ) { return m ; } synchronized ( cache ) { m = ( T ) loc...
Get localization object for the specified locale .
6,324
public static < T extends LocalizableResource > void put ( Class < T > cls , String locale , T m ) { Map < String , LocalizableResource > localeCache = getLocaleCache ( cls ) ; synchronized ( cache ) { localeCache . put ( locale , m ) ; } }
Populate localization object cache for the specified locale .
6,325
public Glyph . State createStateVar ( EntityFeature ef , ObjectFactory factory ) { if ( ef instanceof FragmentFeature ) { FragmentFeature ff = ( FragmentFeature ) ef ; SequenceLocation loc = ff . getFeatureLocation ( ) ; if ( loc instanceof SequenceInterval ) { SequenceInterval si = ( SequenceInterval ) loc ; SequenceS...
Creates State to represent the entity feature .
6,326
protected int [ ] translate ( int [ ] outer ) { int [ ] t = new int [ inds . length ] ; for ( int i = 0 ; i < t . length ; i ++ ) { t [ i ] = outer [ inds [ i ] ] ; } return t ; }
This methods translates the indexes of outer constraint to this inner constraint .
6,327
public Collection < BioPAXElement > generate ( Match match , int ... outer ) { return constr . generate ( match , translate ( outer ) ) ; }
Calls generate method of the constraint with index translation .
6,328
public boolean satisfies ( Match match , int ... ind ) { BioPAXElement ele0 = match . get ( ind [ 0 ] ) ; BioPAXElement ele1 = match . get ( ind [ 1 ] ) ; if ( ele1 == null ) return false ; Set vals = pa . getValueFromBean ( ele0 ) ; return vals . contains ( ele1 ) ; }
Checks if the PathAccessor is generating the second mapped element .
6,329
public Collection < BioPAXElement > generate ( Match match , int ... ind ) { BioPAXElement ele0 = match . get ( ind [ 0 ] ) ; if ( ele0 == null ) throw new RuntimeException ( "Constraint cannot generate based on null value" ) ; Set vals = pa . getValueFromBean ( ele0 ) ; List < BioPAXElement > list = new ArrayList < Bi...
Uses the encapsulated PAthAccessor to generate satisfying elements .
6,330
public boolean satisfies ( Match match , int ... ind ) { assert ind . length == 2 ; return ( match . get ( ind [ 0 ] ) == match . get ( ind [ 1 ] ) ) == equals ; }
Checks if the two elements are identical or not identical as desired .
6,331
protected void addValidValue ( String value ) { if ( value != null && ! value . isEmpty ( ) ) validValues . add ( value . toLowerCase ( ) ) ; }
Adds the given valid value to the set of valid values .
6,332
public boolean okToTraverse ( Level3Element ele ) { if ( validValues . isEmpty ( ) ) return true ; boolean empty = true ; boolean objectRelevant = false ; for ( PathAccessor acc : accessors . keySet ( ) ) { Class clazz = accessors . get ( acc ) ; if ( ! clazz . isAssignableFrom ( ele . getClass ( ) ) ) continue ; objec...
Checks if the related values of the object are among valid values . Returns true if none of the accessors is applicable to the given object .
6,333
public String getName ( SmallMoleculeReference smr ) { if ( map . containsKey ( smr ) ) return map . get ( smr ) . getDisplayName ( ) ; else return smr . getDisplayName ( ) ; }
Gets the standard name of the small molecule .
6,334
protected Map < EntityReference , Set < String > > extractModifNames ( Map mfMap ) { Map < EntityReference , Set < String > > map = new HashMap < EntityReference , Set < String > > ( ) ; for ( Object o : mfMap . keySet ( ) ) { EntityReference er = ( EntityReference ) o ; map . put ( er , extractModifNames ( ( Set ) mfM...
Extracts the modification terms from the moficiation features .
6,335
protected Set < String > extractModifNames ( Set mfSet ) { Set < String > set = new HashSet < String > ( ) ; for ( Object o : mfSet ) { ModificationFeature mf = ( ModificationFeature ) o ; if ( mf . getModificationType ( ) != null && ! mf . getModificationType ( ) . getTerm ( ) . isEmpty ( ) ) { set . add ( mf . getMod...
Extracts terms of the modification features .
6,336
public E get ( String uri ) { if ( map == empty ) return null ; synchronized ( map ) { return map . get ( uri ) ; } }
Gets a BioPAX element by URI .
6,337
public synchronized void replace ( final BioPAXElement existing , final BioPAXElement replacement ) { ModelUtils . replace ( this , Collections . singletonMap ( existing , replacement ) ) ; remove ( existing ) ; if ( replacement != null ) add ( replacement ) ; }
It does not automatically replace or clean up the old element s object properties therefore some child elements may become dangling if they were used by the replaced element only .
6,338
private int getMaxMemory ( ) { int total = 0 ; for ( MemoryPoolMXBean mpBean : ManagementFactory . getMemoryPoolMXBeans ( ) ) { if ( mpBean . getType ( ) == MemoryType . HEAP ) { total += mpBean . getUsage ( ) . getMax ( ) >> 20 ; } } return total ; }
Gets the maximum memory heap size for the application . This size can be modified by passing - Xmx option to the virtual machine like java - Xmx5G MyClass . java .
6,339
public void actionPerformed ( ActionEvent e ) { if ( e . getSource ( ) == pcRadio || e . getSource ( ) == customFileRadio || e . getSource ( ) == customURLRadio ) { pcCombo . setEnabled ( pcRadio . isSelected ( ) ) ; modelField . setEnabled ( customFileRadio . isSelected ( ) ) ; loadButton . setEnabled ( customFileRadi...
Performs interactive operations .
6,340
private void checkRunButton ( ) { runButton . setEnabled ( ( pcRadio . isSelected ( ) || ( customFileRadio . isSelected ( ) && ! modelField . getText ( ) . trim ( ) . isEmpty ( ) ) || ( customURLRadio . isSelected ( ) && ! urlField . getText ( ) . trim ( ) . isEmpty ( ) ) ) && ! outputField . getText ( ) . trim ( ) . i...
Checks if the run button should be enabled .
6,341
private Object [ ] getAvailablePatterns ( ) { List < Miner > minerList = new ArrayList < Miner > ( ) ; if ( miners != null && miners . length > 0 ) { minerList . addAll ( Arrays . asList ( miners ) ) ; } else { minerList . add ( new DirectedRelationMiner ( ) ) ; minerList . add ( new ControlsStateChangeOfMiner ( ) ) ; ...
Gets the available pattern miners . First lists the parameter miners then adds the known miners in the package .
6,342
public static ValidatorResponse unmarshal ( String xml ) throws JAXBException { JAXBContext jaxbContext = JAXBContext . newInstance ( "org.biopax.validator.jaxb" ) ; Unmarshaller un = jaxbContext . createUnmarshaller ( ) ; Source src = new StreamSource ( new StringReader ( xml ) ) ; ValidatorResponse resp = un . unmars...
Converts a biopax - validator XML response to the java object .
6,343
public static Set < ? extends BioPAXElement > getObjectBiopaxPropertyValues ( BioPAXElement bpe , String property ) { Set < BioPAXElement > values = new HashSet < BioPAXElement > ( ) ; EditorMap em = SimpleEditorMap . L3 ; @ SuppressWarnings ( "unchecked" ) PropertyEditor < BioPAXElement , BioPAXElement > editor = ( Pr...
Example 1 .
6,344
public static Set getBiopaxPropertyValues ( BioPAXElement bpe , String property ) { EditorMap em = SimpleEditorMap . L3 ; @ SuppressWarnings ( "unchecked" ) PropertyEditor < BioPAXElement , Object > editor = ( PropertyEditor < BioPAXElement , Object > ) em . getEditorForProperty ( property , bpe . getModelInterface ( )...
Example 2 .
6,345
public void handle ( RequestContext context ) throws SecurityProviderException , IOException { RedirectUtils . redirect ( context . getRequest ( ) , context . getResponse ( ) , getTargetUrl ( ) ) ; }
Redirects to the target URL .
6,346
public void addEnumValue ( final String enumName , final String enumValue ) { for ( MetadataEnum instance : enumList ) { if ( instance . getName ( ) . equals ( enumName ) && instance . getNamespace ( ) . equals ( getCurrentNamespace ( ) ) ) { instance . addValue ( enumValue ) ; return ; } } final MetadataEnum newEnum =...
Adds a enumeration value to the specified enumeration name . If no enumeration class is found then a new enumeration class will be created .
6,347
public void addGroupElement ( final String groupName , final MetadataElement groupElement ) { for ( MetadataItem item : groupList ) { if ( item . getName ( ) . equals ( groupName ) && item . getNamespace ( ) . equals ( getCurrentNamespace ( ) ) ) { item . getElements ( ) . add ( groupElement ) ; return ; } } final Meta...
Adds a new element to the specific group element class . If no group element class is found then a new group element class . will be created .
6,348
public void addGroupReference ( final String groupName , final MetadataElement groupReference ) { groupReference . setRef ( getNamespaceValue ( groupReference . getRef ( ) ) ) ; for ( MetadataItem item : groupList ) { if ( item . getName ( ) . equals ( groupName ) && item . getNamespace ( ) . equals ( getCurrentNamespa...
Adds a new reference to the specific group element class . If no group element class is found then a new group element class . will be created .
6,349
public void addClassElement ( final String className , final MetadataElement classElement ) { classElement . setType ( getNamespaceValue ( classElement . getType ( ) ) ) ; if ( classElement . getMaxOccurs ( ) != null && ! classElement . getMaxOccurs ( ) . equals ( "1" ) ) { classElement . setMaxOccurs ( "unbounded" ) ;...
Adds a new element to the specific element class . If no element class is found then a new element class . will be created .
6,350
public void addClassReference ( final String className , final MetadataElement classReference ) { classReference . setRef ( getNamespaceValue ( classReference . getRef ( ) ) ) ; for ( MetadataItem item : classList ) { if ( item . getName ( ) . equals ( className ) && item . getNamespace ( ) . equals ( getCurrentNamespa...
Adds a new reference to the specific element class . If no element class is found then a new element class . will be created .
6,351
public void preResolveDataTypes ( ) { for ( MetadataItem metadataClass : classList ) { preResolveDataTypeImpl ( metadataClass ) ; } for ( MetadataItem metadataClass : groupList ) { preResolveDataTypeImpl ( metadataClass ) ; } }
Replaces all data type occurrences found in the element types for all classes with the simple data type . This simplifies later the XSLT ddJavaAll step .
6,352
public final boolean isItemInsideView ( int position ) { float x = ( getXForItemAtPosition ( position ) + offsetX ) ; float y = ( getYForItemAtPosition ( position ) + offsetY ) ; float itemSize = getNoxItemSize ( ) ; int viewWidth = shapeConfig . getViewWidth ( ) ; boolean matchesHorizontally = x + itemSize >= 0 && x <...
Returns true if the view should be rendered inside the view window taking into account the offset applied by the scroll effect .
6,353
public int getNoxItemHit ( float x , float y ) { int noxItemPosition = - 1 ; for ( int i = 0 ; i < getNumberOfElements ( ) ; i ++ ) { float noxItemX = getXForItemAtPosition ( i ) + offsetX ; float noxItemY = getYForItemAtPosition ( i ) + offsetY ; float itemSize = getNoxItemSize ( ) ; boolean matchesHorizontally = x >=...
Returns the position of the NoxView if any of the previously configured NoxItem instances is hit . If there is no any NoxItem hit this method returns - 1 .
6,354
protected final void setNoxItemXPosition ( int position , float x ) { noxItemsXPositions [ position ] = x ; minX = ( int ) Math . min ( x , minX ) ; maxX = ( int ) Math . max ( x , maxX ) ; }
Configures the X position for a given NoxItem indicated with the item position . This method uses two counters to calculate the Shape minimum and maximum X position used to configure the Shape scroll .
6,355
protected final void setNoxItemYPosition ( int position , float y ) { noxItemsYPositions [ position ] = y ; minY = ( int ) Math . min ( y , minY ) ; maxY = ( int ) Math . max ( y , maxY ) ; }
Configures the Y position for a given NoxItem indicated with the item position . This method uses two counters to calculate the Shape minimum and maximum Y position used to configure the Shape scroll .
6,356
public static Optional < Class < ? > > getClassWithAnnotation ( final Class < ? > source , final Class < ? extends Annotation > annotationClass ) { Class < ? > nextSource = source ; while ( nextSource != Object . class ) { if ( nextSource . isAnnotationPresent ( annotationClass ) ) { return Optional . of ( nextSource )...
Class that returns if a class or any subclass is annotated with given annotation .
6,357
private String removeFinalSlash ( String path ) { if ( path != null && ! path . isEmpty ( ) && path . endsWith ( "/" ) ) { return path . substring ( 0 , path . length ( ) - 1 ) ; } return path ; }
Due a bug in Pact we need to remove final slash character on path
6,358
private String getDataType ( String [ ] items ) { for ( String item : items ) { if ( XsdDatatypeEnum . ENTITIES . isDataType ( item ) ) { return item ; } } return items [ 0 ] ; }
Returns first data type which is a standard xsd data type . If no such data type found then the first one will be returned .
6,359
public static String resolveHomeDirectory ( String path ) { if ( path . startsWith ( "~" ) ) { return path . replace ( "~" , System . getProperty ( "user.home" ) ) ; } return path ; }
Method that changes any string starting with ~ to user . home property .
6,360
public void handle ( RequestContext context , AuthenticationException e ) throws SecurityProviderException , IOException { saveRequest ( context ) ; String loginFormUrl = getLoginFormUrl ( ) ; if ( StringUtils . isNotEmpty ( loginFormUrl ) ) { RedirectUtils . redirect ( context . getRequest ( ) , context . getResponse ...
Saves the current request in the request cache and then redirects to the login form page .
6,361
public static void copyPackageInfo ( final MetadataParserPath path , final Metadata metadata , final boolean verbose ) throws IOException { for ( final MetadataDescriptor descriptor : metadata . getMetadataDescriptorList ( ) ) { if ( descriptor . getPathToPackageInfoApi ( ) != null ) { final File sourceFile = new File ...
Copies the optional packageInfo files into the packages .
6,362
public static void deleteExistingPackageInfo ( final String destDirectory , final boolean verbose ) { final File htmlFile = new File ( destDirectory + File . separatorChar + PACKAGE_HTML_NAME ) ; final File javaFile = new File ( destDirectory + File . separatorChar + PACKAGE_JAVA_NAME ) ; final Boolean isHtmlDeleted = ...
Deletes package . html or package - info . java from the given directory .
6,363
public void execute ( ) throws BuildException { if ( path == null ) throw new BuildException ( "Path isn't defined" ) ; if ( descriptors == null ) throw new BuildException ( "Descriptors isn't defined" ) ; if ( descriptors . getData ( ) == null ) throw new BuildException ( "No descriptor defined" ) ; ClassLoader oldCl ...
Execute Ant task
6,364
protected boolean excludeRequest ( HttpServletRequest request ) { if ( ArrayUtils . isNotEmpty ( urlsToExclude ) ) { for ( String pathPattern : urlsToExclude ) { if ( pathMatcher . match ( pathPattern , HttpUtils . getRequestUriWithoutContextPath ( request ) ) ) { return true ; } } } return false ; }
Returns trues if the request should be excluded from processing .
6,365
protected boolean includeRequest ( HttpServletRequest request ) { if ( ArrayUtils . isNotEmpty ( urlsToInclude ) ) { for ( String pathPattern : urlsToInclude ) { if ( pathMatcher . match ( pathPattern , HttpUtils . getRequestUriWithoutContextPath ( request ) ) ) { return true ; } } } return false ; }
Returns trues if the request should be included for processing .
6,366
public void setShape ( Shape shape ) { validateShape ( shape ) ; this . shape = shape ; this . shape . calculate ( ) ; initializeScroller ( ) ; resetScroll ( ) ; }
Changes the Shape used to the one passed as argument . This method will refresh the view .
6,367
public boolean onTouchEvent ( MotionEvent event ) { super . onTouchEvent ( event ) ; boolean clickCaptured = processTouchEvent ( event ) ; boolean scrollCaptured = scroller != null && scroller . onTouchEvent ( event ) ; boolean singleTapCaptured = getGestureDetectorCompat ( ) . onTouchEvent ( event ) ; return clickCapt...
Delegates touch events to the scroller instance initialized previously to implement the scroll effect . If the scroller does not handle the MotionEvent NoxView will check if any NoxItem has been clicked to notify a previously configured OnNoxItemClickListener .
6,368
protected void onVisibilityChanged ( View changedView , int visibility ) { super . onVisibilityChanged ( changedView , visibility ) ; if ( changedView != this ) { return ; } if ( visibility == View . VISIBLE ) { resume ( ) ; } else { pause ( ) ; } }
Controls visibility changes to pause or resume this custom view and avoid performance problems .
6,369
private void updateShapeOffset ( ) { int offsetX = scroller . getOffsetX ( ) ; int offsetY = scroller . getOffsetY ( ) ; shape . setOffset ( offsetX , offsetY ) ; }
Checks the X and Y scroll offset to update that values into the Shape configured previously .
6,370
private void drawNoxItem ( Canvas canvas , int position , float left , float top ) { if ( noxItemCatalog . isBitmapReady ( position ) ) { Bitmap bitmap = noxItemCatalog . getBitmap ( position ) ; canvas . drawBitmap ( bitmap , left , top , paint ) ; } else if ( noxItemCatalog . isDrawableReady ( position ) ) { Drawable...
Draws a NoxItem during the onDraw method .
6,371
private void drawNoxItemDrawable ( Canvas canvas , int left , int top , Drawable drawable ) { if ( drawable != null ) { int itemSize = ( int ) noxConfig . getNoxItemSize ( ) ; drawable . setBounds ( left , top , left + itemSize , top + itemSize ) ; drawable . draw ( canvas ) ; } }
Draws a NoxItem drawable during the onDraw method given a canvas object and all the information needed to draw the Drawable passed as parameter .
6,372
private void createShape ( ) { if ( shape == null ) { float firstItemMargin = noxConfig . getNoxItemMargin ( ) ; float firstItemSize = noxConfig . getNoxItemSize ( ) ; int viewHeight = getMeasuredHeight ( ) ; int viewWidth = getMeasuredWidth ( ) ; int numberOfElements = noxItemCatalog . size ( ) ; ShapeConfig shapeConf...
Initializes a Shape instance given the NoxView configuration provided programmatically or using XML styleable attributes .
6,373
private void initializeNoxViewConfig ( Context context , AttributeSet attrs , int defStyleAttr , int defStyleRes ) { noxConfig = new NoxConfig ( ) ; TypedArray attributes = context . getTheme ( ) . obtainStyledAttributes ( attrs , R . styleable . nox , defStyleAttr , defStyleRes ) ; initializeNoxItemSize ( attributes )...
Initializes a NoxConfig instance given the NoxView configuration provided programmatically or using XML styleable attributes .
6,374
private void initializeNoxItemSize ( TypedArray attributes ) { float noxItemSizeDefaultValue = getResources ( ) . getDimension ( R . dimen . default_nox_item_size ) ; float noxItemSize = attributes . getDimension ( R . styleable . nox_item_size , noxItemSizeDefaultValue ) ; noxConfig . setNoxItemSize ( noxItemSize ) ; ...
Configures the nox item default size used in NoxConfig Shape and NoxItemCatalog to draw nox item instances during the onDraw execution .
6,375
private void initializeNoxItemMargin ( TypedArray attributes ) { float noxItemMarginDefaultValue = getResources ( ) . getDimension ( R . dimen . default_nox_item_margin ) ; float noxItemMargin = attributes . getDimension ( R . styleable . nox_item_margin , noxItemMarginDefaultValue ) ; noxConfig . setNoxItemMargin ( no...
Configures the nox item default margin used in NoxConfig Shape and NoxItemCatalog to draw nox item instances during the onDraw execution .
6,376
private void initializeNoxItemPlaceholder ( TypedArray attributes ) { Drawable placeholder = attributes . getDrawable ( R . styleable . nox_item_placeholder ) ; if ( placeholder == null ) { placeholder = getContext ( ) . getResources ( ) . getDrawable ( R . drawable . ic_nox ) ; } noxConfig . setPlaceholder ( placehold...
Configures the placeholder used if there is no another placeholder configured in the NoxItem instances during the onDraw execution .
6,377
private void initializeShapeConfig ( TypedArray attributes ) { defaultShapeKey = attributes . getInteger ( R . styleable . nox_shape , ShapeFactory . FIXED_CIRCULAR_SHAPE_KEY ) ; }
Configures the Shape used to show the list of NoxItems .
6,378
private void initializeTransformationConfig ( TypedArray attributes ) { useCircularTransformation = attributes . getBoolean ( R . styleable . nox_use_circular_transformation , true ) ; }
Configures the visual transformation applied to the NoxItem resources loaded images downloaded from the internet and resources loaded from the system .
6,379
private GestureDetectorCompat getGestureDetectorCompat ( ) { if ( gestureDetector == null ) { GestureDetector . OnGestureListener gestureListener = new SimpleOnGestureListener ( ) { public boolean onSingleTapUp ( MotionEvent e ) { boolean handled = false ; int position = shape . getNoxItemHit ( e . getX ( ) , e . getY ...
Returns a GestureDetectorCompat lazy instantiated created to handle single tap events and detect if a NoxItem has been clicked to notify the previously configured listener .
6,380
public void traverseAndFilter ( final TreeWalker walker , final String indent , final Metadata metadata , final StringBuilder sb ) { final Node parend = walker . getCurrentNode ( ) ; final boolean isLogged = appendText ( indent , ( Element ) parend , sb ) ; for ( final Filter filter : filterList ) { if ( filter . filte...
Traverses the DOM and applies the filters for each visited node .
6,381
private boolean appendText ( final String text , final StringBuilder sb ) { if ( sb != null ) { if ( text != null && text . indexOf ( ":annotation" ) < 0 && text . indexOf ( ":documentation" ) < 0 ) { sb . append ( text ) ; return true ; } } return false ; }
Appends the given text .
6,382
private boolean appendText ( final String indent , final Element element , final StringBuilder sb ) { if ( sb != null ) { if ( element . getTagName ( ) . indexOf ( ":annotation" ) < 0 && element . getTagName ( ) . indexOf ( ":documentation" ) < 0 ) { sb . append ( String . format ( ELEMENT_LOG , indent , element . getT...
Appends the given element .
6,383
public static void addProviderProfileInfo ( Profile profile , UserProfile providerProfile ) { String email = providerProfile . getEmail ( ) ; if ( StringUtils . isEmpty ( email ) ) { throw new IllegalStateException ( "No email included in provider profile" ) ; } String username = providerProfile . getUsername ( ) ; if ...
Adds the info from the provider profile to the specified profile .
6,384
public static Profile createProfile ( Connection < ? > connection ) { Profile profile = new Profile ( ) ; UserProfile providerProfile = connection . fetchUserProfile ( ) ; String email = providerProfile . getEmail ( ) ; if ( StringUtils . isEmpty ( email ) ) { throw new IllegalStateException ( "No email included in pro...
Creates a profile from the specified connection .
6,385
public void handle ( RequestContext context , AccessDeniedException e ) throws SecurityProviderException , IOException { saveException ( context , e ) ; if ( StringUtils . isNotEmpty ( getErrorPageUrl ( ) ) ) { forwardToErrorPage ( context ) ; } else { sendError ( e , context ) ; } }
Forwards to the error page but if not error page was specified a 403 error is sent .
6,386
public void handle ( RequestContext context , AuthenticationException e ) throws SecurityProviderException , IOException { String targetUrl = getTargetUrl ( ) ; if ( StringUtils . isNotEmpty ( targetUrl ) ) { RedirectUtils . redirect ( context . getRequest ( ) , context . getResponse ( ) , targetUrl ) ; } else { sendEr...
Redirects the response to target URL if target URL is not empty . If not a 401 UNAUTHORIZED error is sent .
6,387
Bitmap getBitmap ( int position ) { return bitmaps [ position ] != null ? bitmaps [ position ] . get ( ) : null ; }
Returns the bitmap associated to a NoxItem instance given a position or null if the resource wasn t downloaded .
6,388
Drawable getPlaceholder ( int position ) { Drawable placeholder = placeholders [ position ] ; if ( placeholder == null && defaultPlaceholder != null ) { Drawable clone = defaultPlaceholder . getConstantState ( ) . newDrawable ( ) ; placeholders [ position ] = clone ; placeholder = clone ; } return placeholder ; }
Returns the defaultPlaceholder associated to a NoxItem instance given a position or null if the resource wasn t downloaded or previously configured .
6,389
void load ( int position , boolean useCircularTransformation ) { if ( isDownloading ( position ) ) { return ; } NoxItem noxItem = noxItems . get ( position ) ; if ( ( noxItem . hasUrl ( ) && ! isBitmapReady ( position ) ) || noxItem . hasResourceId ( ) && ! isDrawableReady ( position ) ) { loading [ position ] = true ;...
Given a position associated to a NoxItem starts the NoxItem resources download . This load will download the resources associated to the NoxItem only if wasn t previously downloaded or the download is not being performed .
6,390
public void recreate ( ) { int newSize = noxItems . size ( ) ; WeakReference < Bitmap > newBitmaps [ ] = new WeakReference [ newSize ] ; Drawable newDrawables [ ] = new Drawable [ newSize ] ; Drawable newPlaceholders [ ] = new Drawable [ newSize ] ; boolean newLoadings [ ] = new boolean [ newSize ] ; ImageLoader . List...
Regenerates all the internal data structures . This method should be called when the number of nox items in the catalog has changed externally .
6,391
private void loadNoxItem ( final int position , NoxItem noxItem , boolean useCircularTransformation ) { imageLoader . load ( noxItem . getUrl ( ) ) . load ( noxItem . getResourceId ( ) ) . withPlaceholder ( noxItem . getPlaceholderId ( ) ) . size ( noxItemSize ) . useCircularTransformation ( useCircularTransformation )...
Starts the resource download given a NoxItem instance and a given position .
6,392
private ImageLoader . Listener getImageLoaderListener ( final int position ) { if ( listeners [ position ] == null ) { listeners [ position ] = new NoxItemCatalogImageLoaderListener ( position , this ) ; } return listeners [ position ] ; }
Returns the ImageLoader . Listener associated to a NoxItem given a position . If the ImageLoader . Listener wasn t previously created creates a new instance .
6,393
private void checkArguments ( final MetadataParserPath path , final List < ? > confList ) { if ( path == null ) { throw new IllegalArgumentException ( "Invalid configuration. The 'path' element missing!" ) ; } else if ( confList == null ) { throw new IllegalArgumentException ( "Invalid configuration. At least one 'desc...
Validates the given arguments .
6,394
public static List < String > getTenantNames ( TenantService tenantService ) throws ProfileException { List < Tenant > tenants = tenantService . getAllTenants ( ) ; List < String > tenantNames = new ArrayList < > ( tenants . size ( ) ) ; if ( CollectionUtils . isNotEmpty ( tenants ) ) { for ( Tenant tenant : tenants ) ...
Returns a list with the names of all tenants .
6,395
public static String getCurrentTenantName ( ) { Profile profile = SecurityUtils . getCurrentProfile ( ) ; if ( profile != null ) { return profile . getTenant ( ) ; } else { return null ; } }
Returns the current tenant name which is the tenant of the currently authenticated profile .
6,396
public static String getAttributeValue ( final Element element , final String name ) { final Node node = element . getAttributes ( ) . getNamedItem ( name ) ; if ( node != null ) { return node . getNodeValue ( ) ; } return null ; }
Returns the attribute value for the given attribute name .
6,397
public static Node getNextParentNodeWithAttr ( final Node parent , final String attrName ) { Node parentNode = parent ; Element parendElement = ( Element ) parentNode ; Node valueNode = parendElement . getAttributes ( ) . getNamedItem ( attrName ) ; while ( valueNode == null ) { parentNode = parentNode . getParentNode ...
Returns the next parent node which has the specific attribute name defined .
6,398
public static boolean hasChildsOf ( final Element parentElement , XsdElementEnum child ) { NodeList nodeList = parentElement . getChildNodes ( ) ; for ( int i = 0 ; i < nodeList . getLength ( ) ; i ++ ) { final Node childNode = nodeList . item ( i ) ; if ( childNode . getNodeType ( ) == Node . ELEMENT_NODE ) { final El...
Checks the existence of a w3c child element .
6,399
public static boolean hasParentOf ( final Element parentElement , XsdElementEnum parentEnum ) { Node parent = parentElement . getParentNode ( ) ; while ( parent != null ) { if ( parent . getNodeType ( ) == Node . ELEMENT_NODE ) { final Element parentElm = ( Element ) parent ; if ( parentEnum . isTagNameEqual ( parentEl...
Checks for the first parent node occurrence of the a w3c parentEnum element .