idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
10,300 | private void filterMappingsOfSiblingsByRelation ( List < INode > source , List < INode > target , char semanticRelation ) { int sourceDepth = ( source . get ( 0 ) . getLevel ( ) - 1 ) ; int targetDepth = ( target . get ( 0 ) . getLevel ( ) - 1 ) ; int sourceSize = source . size ( ) ; int targetSize = target . size ( ) ; while ( sourceIndex . get ( sourceDepth ) < sourceSize && targetIndex . get ( targetDepth ) < targetSize ) { if ( isRelated ( source . get ( sourceIndex . get ( sourceDepth ) ) , target . get ( targetIndex . get ( targetDepth ) ) , semanticRelation ) ) { setStrongestMapping ( source . get ( sourceIndex . get ( sourceDepth ) ) , target . get ( targetIndex . get ( targetDepth ) ) ) ; filterMappingsOfChildren ( source . get ( sourceIndex . get ( sourceDepth ) ) , target . get ( targetIndex . get ( targetDepth ) ) , semanticRelation ) ; inc ( sourceIndex , sourceDepth ) ; inc ( targetIndex , targetDepth ) ; } else { int relatedIndex = getRelatedIndex ( source , target , semanticRelation ) ; if ( relatedIndex > sourceIndex . get ( sourceDepth ) ) { swapINodes ( target , targetIndex . get ( targetDepth ) , relatedIndex ) ; filterMappingsOfChildren ( source . get ( sourceIndex . get ( sourceDepth ) ) , target . get ( targetIndex . get ( targetDepth ) ) , semanticRelation ) ; inc ( sourceIndex , sourceDepth ) ; inc ( targetIndex , targetDepth ) ; } else { swapINodes ( source , sourceIndex . get ( sourceDepth ) , ( sourceSize - 1 ) ) ; sourceSize -- ; } } } } | Filters the mappings of two siblings node list for which the parents are also supposed to be related . Checks whether in the two given node list there is a pair of nodes related by the given relation and if so if deletes all the other relations for the given 2 nodes setting the current one as strongest . |
10,301 | private void swapINodes ( List < INode > listOfNodes , int source , int target ) { INode aux = listOfNodes . get ( source ) ; listOfNodes . set ( source , listOfNodes . get ( target ) ) ; listOfNodes . set ( target , aux ) ; } | Swaps the INodes in listOfNodes in the positions source and target . |
10,302 | private int getRelatedIndex ( List < INode > source , List < INode > target , char relation ) { int srcIndex = sourceIndex . get ( source . get ( 0 ) . getLevel ( ) - 1 ) ; int tgtIndex = targetIndex . get ( target . get ( 0 ) . getLevel ( ) - 1 ) ; int returnIndex = - 1 ; INode sourceNode = source . get ( srcIndex ) ; for ( int i = tgtIndex + 1 ; i < target . size ( ) ; i ++ ) { INode targetNode = target . get ( i ) ; if ( isRelated ( sourceNode , targetNode , relation ) ) { setStrongestMapping ( sourceNode , targetNode ) ; return i ; } } computeStrongestMappingForSource ( source . get ( srcIndex ) ) ; return returnIndex ; } | Looks for the related index for the source list at the position sourceIndex in the target list beginning at the targetIndex position for the defined relation . |
10,303 | private void inc ( ArrayList < Integer > array , int index ) { array . set ( index , array . get ( index ) + 1 ) ; } | Increments by 1 the Integer of the given list of integers at the index position . |
10,304 | private boolean isRelated ( final INode source , final INode target , final char relation ) { return relation == defautlMappings . getRelation ( source , target ) ; } | Checks if the given source and target elements are related considering the defined relation and the temp . |
10,305 | private void setStrongestMapping ( INode source , INode target ) { if ( isSameStructure ( source , target ) ) { spsmMapping . setRelation ( source , target , defautlMappings . getRelation ( source , target ) ) ; for ( INode node : defautlMappings . getTargetContext ( ) . getNodesList ( ) ) { if ( source != node && defautlMappings . getRelation ( source , node ) != IMappingElement . IDK && isPrecedent ( defautlMappings . getRelation ( source , target ) , defautlMappings . getRelation ( source , node ) ) ) { defautlMappings . setRelation ( source , node , IMappingElement . IDK ) ; } } for ( INode node : defautlMappings . getSourceContext ( ) . getNodesList ( ) ) { if ( target != node ) { defautlMappings . setRelation ( node , target , IMappingElement . IDK ) ; } } } else { computeStrongestMappingForSource ( source ) ; } } | Sets the relation between source and target as the strongest in the temp setting all the other relations for the same source as IDK if the relations are weaker . |
10,306 | private void computeStrongestMappingForSource ( INode source ) { INode strongetsRelationInTarget = null ; List < IMappingElement < INode > > strongest = new ArrayList < IMappingElement < INode > > ( ) ; for ( INode j : defautlMappings . getTargetContext ( ) . getNodesList ( ) ) { if ( isSameStructure ( source , j ) ) { if ( strongest . isEmpty ( ) && defautlMappings . getRelation ( source , j ) != IMappingElement . IDK && ! existsStrongerInColumn ( source , j ) ) { strongetsRelationInTarget = j ; strongest . add ( new MappingElement < INode > ( source , j , defautlMappings . getRelation ( source , j ) ) ) ; } else if ( defautlMappings . getRelation ( source , j ) != IMappingElement . IDK && ! strongest . isEmpty ( ) ) { int precedence = comparePrecedence ( strongest . get ( 0 ) . getRelation ( ) , defautlMappings . getRelation ( source , j ) ) ; if ( precedence == - 1 && ! existsStrongerInColumn ( source , j ) ) { strongetsRelationInTarget = j ; strongest . set ( 0 , new MappingElement < INode > ( source , j , defautlMappings . getRelation ( source , j ) ) ) ; } } } else { defautlMappings . setRelation ( source , j , IMappingElement . IDK ) ; } } if ( ! strongest . isEmpty ( ) && strongest . get ( 0 ) . getRelation ( ) != IMappingElement . IDK ) { for ( INode j : defautlMappings . getTargetContext ( ) . getNodesList ( ) ) { if ( j != strongetsRelationInTarget && defautlMappings . getRelation ( source , j ) != IMappingElement . IDK ) { int precedence = comparePrecedence ( strongest . get ( 0 ) . getRelation ( ) , defautlMappings . getRelation ( source , j ) ) ; if ( precedence == 1 ) { defautlMappings . setRelation ( source , j , IMappingElement . IDK ) ; } else if ( precedence == 0 ) { if ( isSameStructure ( source , j ) ) { strongest . add ( new MappingElement < INode > ( source , j , defautlMappings . getRelation ( source , j ) ) ) ; } } } } if ( strongest . size ( ) > 1 ) { resolveStrongestMappingConflicts ( source , strongest ) ; } else { for ( INode i : defautlMappings . getSourceContext ( ) . getNodesList ( ) ) { if ( i != source ) { defautlMappings . setRelation ( i , strongetsRelationInTarget , IMappingElement . IDK ) ; } } if ( strongest . get ( 0 ) . getRelation ( ) != IMappingElement . IDK ) { spsmMapping . add ( strongest . get ( 0 ) ) ; deleteRemainingRelationsFromMatrix ( strongest . get ( 0 ) ) ; } } } } | Looks for the strongest relation for the given source and sets to IDK all the other mappings existing for the same source if they are less precedent . |
10,307 | private void resolveStrongestMappingConflicts ( INode source , List < IMappingElement < INode > > strongest ) { int strongestIndex = - 1 ; String sourceString = source . getNodeData ( ) . getName ( ) . trim ( ) ; if ( log . isEnabledFor ( Level . DEBUG ) ) { StringBuilder strongRelations = new StringBuilder ( ) ; for ( IMappingElement < INode > aStrongest : strongest ) { strongRelations . append ( aStrongest . getTarget ( ) . toString ( ) ) . append ( "|" ) ; } log . debug ( "More than one strongest relation for " + sourceString + ": |" + strongRelations . toString ( ) ) ; } for ( int i = 0 ; i < strongest . size ( ) ; i ++ ) { String strongString = strongest . get ( i ) . getTarget ( ) . getNodeData ( ) . getName ( ) . trim ( ) ; if ( sourceString . equalsIgnoreCase ( strongString ) ) { strongestIndex = i ; break ; } } if ( strongestIndex == - 1 ) { strongestIndex = 0 ; } if ( strongest . get ( strongestIndex ) . getRelation ( ) != IMappingElement . IDK ) { spsmMapping . add ( strongest . get ( strongestIndex ) ) ; deleteRemainingRelationsFromMatrix ( strongest . get ( strongestIndex ) ) ; } } | Resolves conflicts in case there are more than one element with the strongest relation for a given source node . |
10,308 | private boolean isSameStructure ( INode source , INode target ) { boolean result = false ; if ( null != source && null != target ) { if ( source . getChildrenList ( ) != null && target . getChildrenList ( ) != null ) { int sourceChildren = source . getChildrenList ( ) . size ( ) ; int targetChildren = target . getChildrenList ( ) . size ( ) ; if ( sourceChildren == 0 && targetChildren == 0 ) { result = true ; } else if ( sourceChildren > 0 && targetChildren > 0 ) { result = true ; } } else if ( source . getChildrenList ( ) == null && target . getChildrenList ( ) == null ) { result = true ; } } else if ( null == source && null == target ) { result = true ; } return result ; } | Checks if source and target are structural preserving this is function to function and argument to argument match . |
10,309 | private boolean existsStrongerInColumn ( INode source , INode target ) { boolean result = false ; char current = defautlMappings . getRelation ( source , target ) ; for ( INode i : defautlMappings . getSourceContext ( ) . getNodesList ( ) ) { if ( i != source && defautlMappings . getRelation ( i , target ) != IMappingElement . IDK && isPrecedent ( defautlMappings . getRelation ( i , target ) , current ) ) { result = true ; break ; } } return result ; } | Checks if there is no other stronger relation in the same column . |
10,310 | private int getPrecedenceNumber ( char semanticRelation ) { int precedence = Integer . MAX_VALUE ; if ( semanticRelation == IMappingElement . EQUIVALENCE ) { precedence = 1 ; } else if ( semanticRelation == IMappingElement . MORE_GENERAL ) { precedence = 2 ; } else if ( semanticRelation == IMappingElement . LESS_GENERAL ) { precedence = 3 ; } else if ( semanticRelation == IMappingElement . DISJOINT ) { precedence = 4 ; } else if ( semanticRelation == IMappingElement . IDK ) { precedence = 5 ; } return precedence ; } | Gives the precedence order for the given semanticRelation defined in IMappingElement . EQUIVALENT_TO = 1 MORE_GENERAL = 2 LESS_GENERAL = 3 DISJOINT_FROM = 4 IDK = 5 |
10,311 | public ParsedPath append ( ParsedPath other ) { final List < String > composedPath = new ArrayList < > ( this . elements . size ( ) + other . elements . size ( ) ) ; composedPath . addAll ( this . elements ) ; composedPath . addAll ( other . elements ) ; return new ParsedPath ( startsWithDelimiter , composedPath ) ; } | Append the received path to this path . |
10,312 | void addSubAggs ( QueryConverter queryConverter , Aggregation agg , AggregationBuilder builder ) { Map < String , Aggregation > aggs = agg . getAggs ( ) ; for ( String key : aggs . keySet ( ) ) { Aggregation subAgg = aggs . get ( key ) ; AbstractAggregationBuilder subBuilder = queryConverter . converterAggregation ( subAgg ) ; if ( subBuilder != null ) { builder . subAggregation ( subBuilder ) ; } } } | add sub - aggs when building search request |
10,313 | private UninitializedMessageException newUninitializedMessageException ( MessageType message ) { if ( message instanceof AbstractMessageLite ) { return ( ( AbstractMessageLite ) message ) . newUninitializedMessageException ( ) ; } return new UninitializedMessageException ( message ) ; } | Creates an UninitializedMessageException for MessageType . |
10,314 | private MessageType checkMessageInitialized ( MessageType message ) throws InvalidProtocolBufferException { if ( message != null && ! message . isInitialized ( ) ) { throw newUninitializedMessageException ( message ) . asInvalidProtocolBufferException ( ) . setUnfinishedMessage ( message ) ; } return message ; } | Helper method to check if message is initialized . |
10,315 | public void readFromObject ( Object object ) { try { Method method = BeanUtils . getReadMethod ( object . getClass ( ) , getName ( ) ) ; if ( method != null ) { Object value = method . invoke ( object ) ; initializeValue ( value ) ; if ( value != null ) { for ( Property subProperty : subProperties ) { subProperty . readFromObject ( value ) ; } } } } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalArgumentException e ) { throw new RuntimeException ( e ) ; } catch ( InvocationTargetException e ) { throw new RuntimeException ( e ) ; } } | Reads the value of this Property from the given object . It uses reflection and looks for a method starting with is or get followed by the capitalized Property name . |
10,316 | public void writeToObject ( Object object ) { try { Method method = BeanUtils . getWriteMethod ( object . getClass ( ) , getName ( ) ) ; if ( method != null ) { method . invoke ( object , new Object [ ] { getValue ( ) } ) ; } } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalArgumentException e ) { throw new RuntimeException ( e ) ; } catch ( InvocationTargetException e ) { throw new RuntimeException ( e ) ; } } | Writes the value of the Property to the given object . It uses reflection and looks for a method starting with set followed by the capitalized Property name and with one parameter with the same type as the Property . |
10,317 | public Map < String , String > values ( Object context ) { if ( this . attributes . isEmpty ( ) ) { return Collections . emptyMap ( ) ; } Map < String , String > map = new HashMap < String , String > ( ) ; for ( KAttribute attribute : this . attributes ) { String value = attribute . value ( context ) ; if ( value != null ) { map . put ( attribute . getName ( ) , value ) ; } } return map ; } | Get the attribute values |
10,318 | public static String getUniqueId ( URI resourceUri , URI basePath ) { String result = null ; URI relativeUri = basePath . relativize ( resourceUri ) ; if ( ! relativeUri . isAbsolute ( ) ) { result = relativeUri . toASCIIString ( ) ; int slashIndex = result . indexOf ( '/' ) ; int hashIndex = result . indexOf ( '#' ) ; if ( slashIndex > - 1 ) { result = result . substring ( 0 , slashIndex ) ; } else if ( hashIndex > - 1 ) { result = result . substring ( 0 , hashIndex ) ; } } return result ; } | Given the URI of a resource it returns the Unique ID . In reality this obtains the first path element after the basePath . Checks for those that are local to the server only . Developed both for hash and slash URIs . |
10,319 | public static boolean isResourceLocalToServer ( URI resourceUri , URI serverUri ) { URI relativeUri = serverUri . relativize ( resourceUri ) ; return ! relativeUri . isAbsolute ( ) ; } | Figure out whether the URI is actually local to the server . That is it tells whether the resouce is controlled by the server . |
10,320 | private static Map < String , CellStyle > createStyles ( Workbook wb ) { Map < String , CellStyle > styles = new HashMap < String , CellStyle > ( ) ; CellStyle style ; Font headerFont = wb . createFont ( ) ; style = createBorderedStyle ( wb ) ; style . setAlignment ( CellStyle . ALIGN_CENTER ) ; style . setFillForegroundColor ( HSSFColor . LIGHT_CORNFLOWER_BLUE . index ) ; style . setFillPattern ( CellStyle . SOLID_FOREGROUND ) ; style . setFont ( headerFont ) ; styles . put ( "header" , style ) ; Font font1 = wb . createFont ( ) ; style = createBorderedStyle ( wb ) ; style . setAlignment ( CellStyle . ALIGN_LEFT ) ; style . setFont ( font1 ) ; styles . put ( "cell_b" , style ) ; return styles ; } | Cell styles used . |
10,321 | public void print ( String [ ] [ ] values ) throws IOException { if ( values == null || values . length == 0 ) { csvPrinter . println ( ) ; } else { for ( String [ ] value : values ) { csvPrinter . printRecords ( ( Object ) value ) ; } } csvPrinter . flush ( ) ; } | Print several lines of comma separated values . The values will be quoted if needed . Quotes and new line characters will be escaped . |
10,322 | private boolean isRedundant ( IContextMapping < INode > mapping , INode source , INode target , char R ) { switch ( R ) { case IMappingElement . LESS_GENERAL : { if ( verifyCondition1 ( mapping , source , target ) ) { return true ; } break ; } case IMappingElement . MORE_GENERAL : { if ( verifyCondition2 ( mapping , source , target ) ) { return true ; } break ; } case IMappingElement . DISJOINT : { if ( verifyCondition3 ( mapping , source , target ) ) { return true ; } break ; } case IMappingElement . EQUIVALENCE : { if ( verifyCondition1 ( mapping , source , target ) && verifyCondition2 ( mapping , source , target ) ) { return true ; } break ; } default : { return false ; } } return false ; } | Checks whether the relation between source and target is redundant or not for minimal mapping . |
10,323 | private boolean before ( ) throws IOException { if ( closed ) { throw new IOException ( "Attempted read from closed stream." ) ; } switch ( length ) { case EOF : return false ; case UNKNOWN : length = readLength ( ) ; pos = 0 ; if ( length == EOF ) { HeaderList . parse ( src ) ; return false ; } return true ; default : return true ; } } | Standard processing before reading data . |
10,324 | public BioCLocation getTotalLocation ( ) { checkArgument ( getLocationCount ( ) > 0 , "No location added" ) ; RangeSet < Integer > rangeSet = TreeRangeSet . create ( ) ; for ( BioCLocation location : getLocations ( ) ) { rangeSet . add ( Range . closedOpen ( location . getOffset ( ) , location . getOffset ( ) + location . getLength ( ) ) ) ; } Range < Integer > totalSpan = rangeSet . span ( ) ; return new BioCLocation ( totalSpan . lowerEndpoint ( ) , totalSpan . upperEndpoint ( ) - totalSpan . lowerEndpoint ( ) ) ; } | Returns the minimal range which encloses all locations in this annotation . |
10,325 | public static Set < String > getLanguages ( final ITextNode [ ] textNodes ) { SortedSet < String > languages = new TreeSet < String > ( ) ; for ( ITextNode textNode : textNodes ) { IValueNode [ ] valueNodes = textNode . getValueNodes ( ) ; for ( IValueNode valueNode : valueNodes ) { languages . add ( valueNode . getLanguage ( ) ) ; } } return languages ; } | Gets the languages of all value nodes whose parents are a given array of text nodes . |
10,326 | public static boolean containsStatus ( final Status status , final Status [ ] statusArray ) { if ( status == null ) { return false ; } for ( Status currentStatus : statusArray ) { if ( currentStatus == status ) { return true ; } } return false ; } | Checks whether a given status is contained in an array of status . |
10,327 | protected String getNodePathToRoot ( INode node ) { StringBuilder sb = new StringBuilder ( ) ; INode parent = node ; while ( null != parent ) { if ( parent . getNodeData ( ) . getName ( ) . contains ( "\\" ) ) { log . debug ( "source: replacing \\ in: " + parent . getNodeData ( ) . getName ( ) ) ; sb . insert ( 0 , "\\" + parent . getNodeData ( ) . getName ( ) . replaceAll ( "\\\\" , "/" ) ) ; } else { sb . insert ( 0 , "\\" + parent . getNodeData ( ) . getName ( ) ) ; } parent = parent . getParent ( ) ; } return sb . toString ( ) ; } | Gets the path of a node from root for hash mapping . |
10,328 | protected HashMap < String , INode > createHash ( IContext context ) { HashMap < String , INode > result = new HashMap < String , INode > ( ) ; int nodeCount = 0 ; for ( INode node : context . getNodesList ( ) ) { result . put ( getNodePathToRoot ( node ) , node ) ; nodeCount ++ ; } if ( log . isEnabledFor ( Level . INFO ) ) { log . info ( "Created hash for " + nodeCount + " nodes..." ) ; } return result ; } | Creates hash map for nodes which contains path from root to node for each node . |
10,329 | public String getMessage ( ) { StringBuilder msg = new StringBuilder ( "\n" ) ; msg . append ( super . getMessage ( ) ) ; if ( detail != null ) { msg . append ( "\n" ) ; msg . append ( detail . getMessage ( ) ) ; if ( detail . getCause ( ) != null ) { msg . append ( detail . getCause ( ) . getMessage ( ) ) ; } } return msg . toString ( ) ; } | Returns the detail message including the message from the nested exception if there is one . |
10,330 | public Dimension maximumLayoutSize ( Container parent ) { return new Dimension ( Integer . MAX_VALUE , Integer . MAX_VALUE ) ; } | Returns the maximum size of this component . |
10,331 | private char matchSuffix ( String str1 , String str2 ) { char rel = IMappingElement . IDK ; int spacePos1 = str1 . lastIndexOf ( ' ' ) ; String prefix = str1 . substring ( 0 , str1 . length ( ) - str2 . length ( ) ) ; if ( - 1 < spacePos1 && ! prefixes . containsKey ( prefix ) ) { if ( str1 . length ( ) == spacePos1 + str2 . length ( ) + 1 ) { rel = IMappingElement . LESS_GENERAL ; } else { String left = str1 . substring ( spacePos1 + 1 , str1 . length ( ) ) ; char secondRel = match ( left , str2 ) ; if ( IMappingElement . MORE_GENERAL == secondRel || IMappingElement . EQUIVALENCE == secondRel ) { rel = IMappingElement . LESS_GENERAL ; } else { rel = secondRel ; } } } else { if ( prefix . startsWith ( "-" ) ) { prefix = prefix . substring ( 1 ) ; } if ( prefix . endsWith ( "-" ) && ! prefixes . containsKey ( prefix = prefix . substring ( 0 , prefix . length ( ) - 1 ) ) ) { rel = IMappingElement . LESS_GENERAL ; } else { if ( prefixes . containsKey ( prefix ) ) { rel = prefixes . get ( prefix ) ; } else if ( suffixes . containsKey ( str2 ) ) { rel = suffixes . get ( str2 ) ; } } } return rel ; } | Computes the relation with suffix matcher . |
10,332 | public static String removeLeadingAndTrailingDelimiter ( String str , String delimiter ) { final int strLength = str . length ( ) ; final int delimiterLength = delimiter . length ( ) ; final boolean leadingDelimiter = str . startsWith ( delimiter ) ; final boolean trailingDelimiter = strLength > delimiterLength && str . endsWith ( delimiter ) ; if ( ! leadingDelimiter && ! trailingDelimiter ) { return str ; } else { final int startingDelimiterIndex = leadingDelimiter ? delimiterLength : 0 ; final int endingDelimiterIndex = trailingDelimiter ? Math . max ( strLength - delimiterLength , startingDelimiterIndex ) : strLength ; return str . substring ( startingDelimiterIndex , endingDelimiterIndex ) ; } } | Removes the leading and trailing delimiter from a string . |
10,333 | public static String removeTrailingDelimiter ( String str , String delimiter ) { if ( ! str . endsWith ( delimiter ) ) { return str ; } else { return str . substring ( 0 , str . length ( ) - delimiter . length ( ) ) ; } } | Removes the trailing delimiter from a string . |
10,334 | public static String removeLeadingDelimiter ( String str , String delimiter ) { if ( ! str . startsWith ( delimiter ) ) { return str ; } else { return str . substring ( delimiter . length ( ) , str . length ( ) ) ; } } | Removes the leading delimiter from a string . |
10,335 | public static String emptyToNull ( String str ) { return ( str != null && ! str . isEmpty ( ) ) ? str : null ; } | Transform an empty string into null . |
10,336 | public static < T > String join ( List < T > list , String delimiter ) { if ( list . isEmpty ( ) ) { return "" ; } final StringBuilder sb = new StringBuilder ( ) ; for ( T element : list ) { sb . append ( element ) ; sb . append ( delimiter ) ; } sb . delete ( sb . length ( ) - delimiter . length ( ) , sb . length ( ) ) ; return sb . toString ( ) ; } | Create a string out of the list s elements using the given delimiter . |
10,337 | protected static Object [ ] mkAxioms ( HashMap < IAtomicConceptOfLabel , String > hashConceptNumber , Map < INode , ArrayList < IAtomicConceptOfLabel > > nmtAcols , Map < String , IAtomicConceptOfLabel > sourceACoLs , Map < String , IAtomicConceptOfLabel > targetACoLs , IContextMapping < IAtomicConceptOfLabel > acolMapping , INode sourceNode , INode targetNode ) { StringBuilder axioms = new StringBuilder ( ) ; Integer numberOfClauses = 0 ; createVariables ( hashConceptNumber , nmtAcols , sourceACoLs , sourceNode ) ; createVariables ( hashConceptNumber , nmtAcols , targetACoLs , targetNode ) ; ArrayList < IAtomicConceptOfLabel > sourceACols = nmtAcols . get ( sourceNode ) ; ArrayList < IAtomicConceptOfLabel > targetACols = nmtAcols . get ( targetNode ) ; if ( null != sourceACols && null != targetACols ) { for ( IAtomicConceptOfLabel sourceACoL : sourceACols ) { for ( IAtomicConceptOfLabel targetACoL : targetACols ) { char relation = acolMapping . getRelation ( sourceACoL , targetACoL ) ; if ( IMappingElement . IDK != relation ) { String sourceVarNumber = hashConceptNumber . get ( sourceACoL ) ; String targetVarNumber = hashConceptNumber . get ( targetACoL ) ; if ( IMappingElement . LESS_GENERAL == relation ) { String tmp = "-" + sourceVarNumber + " " + targetVarNumber + " 0\n" ; if ( - 1 == axioms . indexOf ( tmp ) ) { axioms . append ( tmp ) ; numberOfClauses ++ ; } } else if ( IMappingElement . MORE_GENERAL == relation ) { String tmp = sourceVarNumber + " -" + targetVarNumber + " 0\n" ; if ( - 1 == axioms . indexOf ( tmp ) ) { axioms . append ( tmp ) ; numberOfClauses ++ ; } } else if ( IMappingElement . EQUIVALENCE == relation ) { if ( ! sourceVarNumber . equals ( targetVarNumber ) ) { String tmp = "-" + sourceVarNumber + " " + targetVarNumber + " 0\n" ; if ( - 1 == axioms . indexOf ( tmp ) ) { axioms . append ( tmp ) ; numberOfClauses ++ ; } tmp = sourceVarNumber + " -" + targetVarNumber + " 0\n" ; if ( - 1 == axioms . indexOf ( tmp ) ) { axioms . append ( tmp ) ; numberOfClauses ++ ; } } } else if ( IMappingElement . DISJOINT == relation ) { String tmp = "-" + sourceVarNumber + " -" + targetVarNumber + " 0\n" ; if ( - 1 == axioms . indexOf ( tmp ) ) { axioms . append ( tmp ) ; numberOfClauses ++ ; } } } } } } return new Object [ ] { axioms . toString ( ) , numberOfClauses } ; } | Makes axioms for a CNF formula out of relations between atomic concepts . |
10,338 | protected static String DIMACSfromList ( ArrayList < ArrayList < String > > formula ) { StringBuilder dimacs = new StringBuilder ( "" ) ; for ( List < String > conjClause : formula ) { for ( String disjClause : conjClause ) { dimacs . append ( disjClause ) . append ( " " ) ; } dimacs . append ( " 0\n" ) ; } return dimacs . toString ( ) ; } | Converts parsed formula into DIMACS format . |
10,339 | public static JFileChooser getFileChooser ( final String id ) { JFileChooser chooser = new JFileChooser ( ) ; track ( chooser , "FileChooser." + id + ".path" ) ; return chooser ; } | Gets the file chooser with the given id . Its current directory will be tracked and restored on subsequent calls . |
10,340 | public static JFileChooser getDirectoryChooser ( String id ) { JFileChooser chooser ; Class < ? > directoryChooserClass ; try { directoryChooserClass = Class . forName ( "com.l2fprod.common.swing.JDirectoryChooser" ) ; chooser = ( JFileChooser ) directoryChooserClass . newInstance ( ) ; } catch ( ClassNotFoundException ex ) { chooser = new JFileChooser ( ) ; chooser . setFileSelectionMode ( JFileChooser . DIRECTORIES_ONLY ) ; } catch ( InstantiationException ex ) { chooser = new JFileChooser ( ) ; chooser . setFileSelectionMode ( JFileChooser . DIRECTORIES_ONLY ) ; } catch ( IllegalAccessException ex ) { chooser = new JFileChooser ( ) ; chooser . setFileSelectionMode ( JFileChooser . DIRECTORIES_ONLY ) ; } track ( chooser , "DirectoryChooser." + id + ".path" ) ; return chooser ; } | Gets the directory chooser with the given id . Its current directory will be tracked and restored on subsequent calls . |
10,341 | public static void track ( Window window ) { Preferences prefs = node ( ) . node ( "Windows" ) ; String bounds = prefs . get ( window . getName ( ) + ".bounds" , null ) ; if ( bounds != null ) { Rectangle rect = ( Rectangle ) ConverterRegistry . instance ( ) . convert ( Rectangle . class , bounds ) ; window . setBounds ( rect ) ; } window . addComponentListener ( WINDOW_DIMENSIONS ) ; } | Restores the window size position and state if possible . Tracks the window size position and state . |
10,342 | public T parse ( String arg ) throws ParseException { if ( isNull ( arg ) ) { if ( nullable ) { return null ; } else { throw new ParseException ( ParseError . INVALID_PARAM , "Parameter doesn't take 'null' values: " + getName ( ) ) ; } } return parseNonNull ( arg ) ; } | Type specialization - subclasses must parse a value of type T . |
10,343 | public SingleFieldBuilder < MType , BType , IType > setMessage ( MType message ) { if ( message == null ) { throw new NullPointerException ( ) ; } this . message = message ; if ( builder != null ) { builder . dispose ( ) ; builder = null ; } onChanged ( ) ; return this ; } | Sets a message for the field replacing any existing value . |
10,344 | public SingleFieldBuilder < MType , BType , IType > mergeFrom ( MType value ) { if ( builder == null && message == message . getDefaultInstanceForType ( ) ) { message = value ; } else { getBuilder ( ) . mergeFrom ( value ) ; } onChanged ( ) ; return this ; } | Merges the field from another field . |
10,345 | public static FastForward setup ( InetAddress addr , int port ) throws SocketException { final DatagramSocket socket = new DatagramSocket ( ) ; return new FastForward ( addr , port , socket ) ; } | Initialization method for a FastForward client . |
10,346 | public boolean nodeDisjoint ( IContextMapping < IAtomicConceptOfLabel > acolMapping , Map < INode , ArrayList < IAtomicConceptOfLabel > > nmtAcols , Map < String , IAtomicConceptOfLabel > sourceACoLs , Map < String , IAtomicConceptOfLabel > targetACoLs , INode sourceNode , INode targetNode ) throws NodeMatcherException { boolean result = false ; String sourceCNodeFormula = sourceNode . getNodeData ( ) . getcNodeFormula ( ) ; String targetCNodeFormula = targetNode . getNodeData ( ) . getcNodeFormula ( ) ; String sourceCLabFormula = sourceNode . getNodeData ( ) . getcLabFormula ( ) ; String targetCLabFormula = targetNode . getNodeData ( ) . getcLabFormula ( ) ; if ( null != sourceCNodeFormula && null != targetCNodeFormula && ! sourceCNodeFormula . isEmpty ( ) && ! targetCNodeFormula . isEmpty ( ) && null != sourceCLabFormula && null != targetCLabFormula && ! sourceCLabFormula . isEmpty ( ) && ! targetCLabFormula . isEmpty ( ) ) { HashMap < IAtomicConceptOfLabel , String > hashConceptNumber = new HashMap < IAtomicConceptOfLabel , String > ( ) ; Object [ ] obj = mkAxioms ( hashConceptNumber , nmtAcols , sourceACoLs , targetACoLs , acolMapping , sourceNode , targetNode ) ; String axioms = ( String ) obj [ 0 ] ; int num_of_axiom_clauses = ( Integer ) obj [ 1 ] ; ArrayList < ArrayList < String > > contextA = parseFormula ( hashConceptNumber , sourceACoLs , sourceNode ) ; ArrayList < ArrayList < String > > contextB = parseFormula ( hashConceptNumber , targetACoLs , targetNode ) ; String contextAInDIMACSFormat = DIMACSfromList ( contextA ) ; String contextBInDIMACSFormat = DIMACSfromList ( contextB ) ; String satProblemInDIMACS = axioms + contextBInDIMACSFormat + contextAInDIMACSFormat ; int numberOfClauses = contextA . size ( ) + contextB . size ( ) + num_of_axiom_clauses ; int numberOfVariables = hashConceptNumber . size ( ) ; String DIMACSproblem = "p cnf " + numberOfVariables + " " + numberOfClauses + "\n" + satProblemInDIMACS ; result = isUnsatisfiable ( DIMACSproblem ) ; } return result ; } | Checks whether source node and target node are disjoint . |
10,347 | public char nodeMatch ( IContextMapping < IAtomicConceptOfLabel > acolMapping , Map < INode , ArrayList < IAtomicConceptOfLabel > > nmtAcols , Map < String , IAtomicConceptOfLabel > sourceACoLs , Map < String , IAtomicConceptOfLabel > targetACoLs , INode sourceNode , INode targetNode ) throws NodeMatcherException { throw new NodeMatcherException ( "Unsupported operation" ) ; } | stub to allow it to be created as node matcher . |
10,348 | private void initDefaultColors ( ) { this . categoryBackground = UIManager . getColor ( PANEL_BACKGROUND_COLOR_KEY ) ; this . categoryForeground = UIManager . getColor ( TABLE_FOREGROUND_COLOR_KEY ) . darker ( ) . darker ( ) . darker ( ) ; this . selectedCategoryBackground = categoryBackground . darker ( ) ; this . selectedCategoryForeground = categoryForeground ; this . propertyBackground = UIManager . getColor ( TABLE_BACKGROUND_COLOR_KEY ) ; this . propertyForeground = UIManager . getColor ( TABLE_FOREGROUND_COLOR_KEY ) ; this . selectedPropertyBackground = UIManager . getColor ( TABLE_SELECTED_BACKGROUND_COLOR_KEY ) ; this . selectedPropertyForeground = UIManager . getColor ( TABLE_SELECTED_FOREGROUND_COLOR_KEY ) ; setGridColor ( categoryBackground ) ; } | Initializes the default set of colors used by the PropertySheetTable . |
10,349 | public TableCellEditor getCellEditor ( int row , int column ) { if ( column == 0 ) { return null ; } Item item = getSheetModel ( ) . getPropertySheetElement ( row ) ; if ( ! item . isProperty ( ) ) { return null ; } TableCellEditor result = null ; Property propery = item . getProperty ( ) ; PropertyEditor editor = getEditorFactory ( ) . createPropertyEditor ( propery ) ; if ( editor != null ) { result = new CellEditorAdapter ( editor ) ; } return result ; } | Gets the CellEditor for the given row and column . It uses the editor registry to find a suitable editor for the property . |
10,350 | private TableCellRenderer getCellRenderer ( Class < ? > type ) { TableCellRenderer renderer = getRendererFactory ( ) . createTableCellRenderer ( type ) ; if ( renderer == null && type != null ) { renderer = getCellRenderer ( type . getSuperclass ( ) ) ; } if ( renderer == null ) { renderer = super . getDefaultRenderer ( Object . class ) ; } return renderer ; } | Helper method to lookup a cell renderer based on type . |
10,351 | public void setModel ( TableModel newModel ) { if ( ! ( newModel instanceof PropertySheetTableModel ) ) { throw new IllegalArgumentException ( "dataModel must be of type " + PropertySheetTableModel . class . getName ( ) ) ; } if ( cancelEditing == null ) { cancelEditing = new CancelEditing ( ) ; } TableModel oldModel = getModel ( ) ; if ( oldModel != null ) { oldModel . removeTableModelListener ( cancelEditing ) ; } super . setModel ( newModel ) ; newModel . addTableModelListener ( cancelEditing ) ; getColumnModel ( ) . getColumn ( 1 ) . setResizable ( false ) ; } | Overriden to register a listener on the model . This listener ensures editing is canceled when editing row is being changed . |
10,352 | static int getIndent ( PropertySheetTable table , Item item ) { int indent ; if ( item . isProperty ( ) ) { if ( ( item . getParent ( ) == null || ! item . getParent ( ) . isProperty ( ) ) && ! item . hasToggle ( ) ) { indent = table . getWantsExtraIndent ( ) ? HOTSPOT_SIZE : 0 ; } else { if ( item . hasToggle ( ) ) { indent = item . getDepth ( ) * HOTSPOT_SIZE ; } else { indent = ( item . getDepth ( ) + 1 ) * HOTSPOT_SIZE ; } } if ( table . getSheetModel ( ) . getMode ( ) == PropertySheet . VIEW_AS_CATEGORIES && table . getWantsExtraIndent ( ) ) { indent += HOTSPOT_SIZE ; } } else { indent = 0 ; } return indent ; } | Calculates the required left indent for a given item given its type and its hierarchy level . |
10,353 | public void process ( SshServer sshd ) throws ExtensionException { ParallelJURLKeyPairProvider urlKeyPairProvider = null ; ServiceLoader < ParallelJURLKeyPairProvider > loader = CacheableServiceLoader . INSTANCE . load ( ParallelJURLKeyPairProvider . class , ParallelJURLKeyPairProvider . class . getClassLoader ( ) ) ; if ( loader == null || loader . iterator ( ) == null || ! loader . iterator ( ) . hasNext ( ) ) { loader = CacheableServiceLoader . INSTANCE . load ( ParallelJURLKeyPairProvider . class , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; } for ( ParallelJURLKeyPairProvider currentURLKeyPairProvider : loader ) { urlKeyPairProvider = currentURLKeyPairProvider ; break ; } urlKeyPairProvider . setPrivateServerKey ( this . privateServerKey ) ; sshd . setKeyPairProvider ( urlKeyPairProvider ) ; List < NamedFactory < UserAuth > > userAuthFactories = new ArrayList < NamedFactory < UserAuth > > ( ) ; userAuthFactories . add ( new UserAuthPublicKey . Factory ( ) ) ; sshd . setUserAuthFactories ( userAuthFactories ) ; sshd . setPublickeyAuthenticator ( new URLPublicKeyAuthentificator ( this . authorizedServerKey ) ) ; } | Any others configurations for the sshd server can be done directly with the SshServer object from Apache mina SSHD |
10,354 | public String after ( String schemeSpecific , String separator ) { int idx ; idx = schemeSpecific . indexOf ( separator ) ; if ( idx == - 1 ) { return null ; } return schemeSpecific . substring ( idx + separator . length ( ) ) ; } | Helper Method for opaquePath implementations |
10,355 | public static synchronized Router getRouterFor ( ServletContext con ) { String contextPath = EldaRouterRestletSupport . flatContextPath ( con . getContextPath ( ) ) ; TimestampedRouter r = routers . get ( contextPath ) ; long timeNow = System . currentTimeMillis ( ) ; if ( r == null ) { log . info ( "creating router for '" + contextPath + "'" ) ; long interval = getRefreshInterval ( contextPath ) ; r = new TimestampedRouter ( EldaRouterRestletSupport . createRouterFor ( con ) , timeNow , interval ) ; routers . put ( contextPath , r ) ; } else if ( r . nextCheck < timeNow ) { long latestTime = EldaRouterRestletSupport . latestConfigTime ( con , contextPath ) ; if ( latestTime > r . timestamp ) { log . info ( "reloading router for '" + contextPath + "'" ) ; long interval = getRefreshInterval ( contextPath ) ; r = new TimestampedRouter ( EldaRouterRestletSupport . createRouterFor ( con ) , timeNow , interval ) ; DOMUtils . clearCache ( ) ; Cache . Registry . clearAll ( ) ; routers . put ( contextPath , r ) ; } else { r . deferCheck ( ) ; } } else { } return r . router ; } | Answer a router initialised with the URI templates appropriate to this context path . Such a router may already be in the routers table in which case it is used otherwise a new router is created initialised put in the table and returned . |
10,356 | private boolean notFormat ( Match m , String type ) { return m . getEndpoint ( ) . getRendererNamed ( type ) == null ; } | Answer true of m s endpoint has no formatter called type . |
10,357 | public void process ( CAS aCAS ) throws AnalysisEngineProcessException { try { JCas jcas = aCAS . getJCas ( ) ; ExperimentUUID experiment = ProcessingStepUtils . getCurrentExperiment ( jcas ) ; AnnotationIndex < Annotation > steps = jcas . getAnnotationIndex ( ProcessingStep . type ) ; String uuid = experiment . getUuid ( ) ; Trace trace = ProcessingStepUtils . getTrace ( steps ) ; Key key = new Key ( uuid , trace , experiment . getStageId ( ) ) ; experiments . add ( new ExperimentKey ( key . getExperiment ( ) , key . getStage ( ) ) ) ; for ( TraceListener listener : listeners ) { listener . process ( key , jcas ) ; } } catch ( Exception e ) { throw new AnalysisEngineProcessException ( e ) ; } } | Reads the results from the retrieval phase from the DOCUMENT and the DOCUEMNT_GS views of the JCAs and generates and evaluates them using the evaluate method from the FMeasureConsumer class . |
10,358 | private Class < ? > resolveResultJavaType ( Class < ? > resultType , String property , Class < ? > javaType ) { if ( javaType == null && property != null ) { try { MetaClass metaResultType = MetaClass . forClass ( resultType , REFLECTOR_FACTORY ) ; javaType = metaResultType . getSetterType ( property ) ; } catch ( Exception ignored ) { } } if ( javaType == null ) { javaType = Object . class ; } return javaType ; } | copy from mybatis sourceCode |
10,359 | public Object getNext ( KCall call ) { if ( map . get ( call . getProcedure ( ) . getId ( ) ) == null ) { Object context = call . getProcess ( ) . getContext ( ) ; Method readMethod = null ; try { readMethod = new PropertyDescriptor ( pipelineDataName , context . getClass ( ) ) . getReadMethod ( ) ; } catch ( IntrospectionException e ) { MessageKind . W0003 . format ( e ) ; } Object invoke = null ; try { invoke = readMethod . invoke ( context ) ; } catch ( IllegalArgumentException e ) { MessageKind . W0003 . format ( e ) ; } catch ( IllegalAccessException e ) { MessageKind . W0003 . format ( e ) ; } catch ( InvocationTargetException e ) { MessageKind . W0003 . format ( e ) ; } if ( invoke instanceof Iterable < ? > ) { Iterator newIterator = ( ( Iterable ) invoke ) . iterator ( ) ; this . add ( call . getProcedure ( ) . getId ( ) , newIterator ) ; } } Iterator iterator = map . get ( call . getProcedure ( ) . getId ( ) ) ; return iterator . next ( ) ; } | Based on KProcedure index for data it will return next value from list |
10,360 | public BeanInfo [ ] getAdditionalBeanInfo ( ) { ArrayList < BeanInfo > bi = new ArrayList < BeanInfo > ( ) ; BeanInfo [ ] biarr = null ; try { for ( Class < ? > cl = com . l2fprod . common . swing . JCollapsiblePane . class . getSuperclass ( ) ; ! cl . equals ( java . awt . Component . class . getSuperclass ( ) ) ; cl = cl . getSuperclass ( ) ) { bi . add ( Introspector . getBeanInfo ( cl ) ) ; } biarr = bi . toArray ( new BeanInfo [ ] { } ) ; } catch ( Exception e ) { } return biarr ; } | Gets the additionalBeanInfo . |
10,361 | public int getDefaultPropertyIndex ( ) { String defName = "" ; if ( "" . equals ( defName ) ) { return - 1 ; } PropertyDescriptor [ ] pd = getPropertyDescriptors ( ) ; for ( int i = 0 ; i < pd . length ; i ++ ) { if ( pd [ i ] . getName ( ) . equals ( defName ) ) { return i ; } } return - 1 ; } | Gets the defaultPropertyIndex . |
10,362 | public Image getIcon ( int type ) { if ( type == BeanInfo . ICON_COLOR_16x16 ) { return iconColor16 ; } if ( type == BeanInfo . ICON_MONO_16x16 ) { return iconMono16 ; } if ( type == BeanInfo . ICON_COLOR_32x32 ) { return iconColor32 ; } if ( type == BeanInfo . ICON_MONO_32x32 ) { return iconMono32 ; } return null ; } | Gets the icon . |
10,363 | public PropertyDescriptor [ ] getPropertyDescriptors ( ) { try { ArrayList < PropertyDescriptor > descriptors = new ArrayList < PropertyDescriptor > ( ) ; PropertyDescriptor descriptor ; try { descriptor = new PropertyDescriptor ( "animated" , com . l2fprod . common . swing . JCollapsiblePane . class ) ; } catch ( IntrospectionException e ) { descriptor = new PropertyDescriptor ( "animated" , com . l2fprod . common . swing . JCollapsiblePane . class , "getAnimated" , null ) ; } descriptor . setPreferred ( true ) ; descriptor . setBound ( true ) ; descriptors . add ( descriptor ) ; try { descriptor = new PropertyDescriptor ( "collapsed" , com . l2fprod . common . swing . JCollapsiblePane . class ) ; } catch ( IntrospectionException e ) { descriptor = new PropertyDescriptor ( "collapsed" , com . l2fprod . common . swing . JCollapsiblePane . class , "getCollapsed" , null ) ; } descriptor . setPreferred ( true ) ; descriptor . setBound ( true ) ; descriptors . add ( descriptor ) ; return ( PropertyDescriptor [ ] ) descriptors . toArray ( new PropertyDescriptor [ descriptors . size ( ) ] ) ; } catch ( Exception e ) { Logger . getLogger ( JCollapsiblePane . class . getName ( ) ) . log ( Level . SEVERE , null , e ) ; } return null ; } | Gets the Property Descriptors . |
10,364 | public char match ( ISense source , ISense target ) throws MatcherLibraryException { char result = IMappingElement . IDK ; try { String sSynset = source . getGloss ( ) ; String tLGExtendedGloss = getExtendedGloss ( target , 1 , IMappingElement . LESS_GENERAL ) ; char LGRel = getDominantRelation ( sSynset , tLGExtendedGloss ) ; char LGFinal = getRelationFromRels ( IMappingElement . LESS_GENERAL , LGRel ) ; String tMGExtendedGloss = getExtendedGloss ( target , 1 , IMappingElement . MORE_GENERAL ) ; char MGRel = getDominantRelation ( sSynset , tMGExtendedGloss ) ; char MGFinal = getRelationFromRels ( IMappingElement . MORE_GENERAL , MGRel ) ; if ( MGFinal == LGFinal ) { result = MGFinal ; } if ( MGFinal == IMappingElement . IDK ) { result = LGFinal ; } if ( LGFinal == IMappingElement . IDK ) { result = MGFinal ; } } catch ( LinguisticOracleException e ) { final String errMessage = e . getClass ( ) . getSimpleName ( ) + ": " + e . getMessage ( ) ; log . error ( errMessage , e ) ; throw new MatcherLibraryException ( errMessage , e ) ; } return result ; } | Computes the relation for extended semantic gloss matcher . |
10,365 | private char getDominantRelation ( String sExtendedGloss , String tExtendedGloss ) throws MatcherLibraryException { int Equals = 0 ; int moreGeneral = 0 ; int lessGeneral = 0 ; int Opposite = 0 ; StringTokenizer stSource = new StringTokenizer ( sExtendedGloss , " ,.\"'()" ) ; String lemmaS , lemmaT ; while ( stSource . hasMoreTokens ( ) ) { StringTokenizer stTarget = new StringTokenizer ( tExtendedGloss , " ,.\"'()" ) ; lemmaS = stSource . nextToken ( ) ; if ( ! meaninglessWords . contains ( lemmaS ) ) { while ( stTarget . hasMoreTokens ( ) ) { lemmaT = stTarget . nextToken ( ) ; if ( ! meaninglessWords . contains ( lemmaT ) ) { if ( isWordLessGeneral ( lemmaS , lemmaT ) ) { lessGeneral ++ ; } else if ( isWordMoreGeneral ( lemmaS , lemmaT ) ) { moreGeneral ++ ; } else if ( isWordSynonym ( lemmaS , lemmaT ) ) { Equals ++ ; } else if ( isWordOpposite ( lemmaS , lemmaT ) ) { Opposite ++ ; } } } } } return getRelationFromInts ( lessGeneral , moreGeneral , Equals , Opposite ) ; } | Gets Semantic relation occurring more frequently between words in two extended glosses . |
10,366 | private char getRelationFromInts ( int lg , int mg , int syn , int opp ) { if ( ( lg >= mg ) && ( lg >= syn ) && ( lg >= opp ) && ( lg > 0 ) ) { return IMappingElement . LESS_GENERAL ; } if ( ( mg >= lg ) && ( mg >= syn ) && ( mg >= opp ) && ( mg > 0 ) ) { return IMappingElement . MORE_GENERAL ; } if ( ( syn >= mg ) && ( syn >= lg ) && ( syn >= opp ) && ( syn > 0 ) ) { return IMappingElement . LESS_GENERAL ; } if ( ( opp >= mg ) && ( opp >= syn ) && ( opp >= lg ) && ( opp > 0 ) ) { return IMappingElement . LESS_GENERAL ; } return IMappingElement . IDK ; } | Decides which relation to return . |
10,367 | private char getRelationFromRels ( char builtForRel , char glossRel ) { if ( builtForRel == IMappingElement . EQUIVALENCE ) { return glossRel ; } if ( builtForRel == IMappingElement . LESS_GENERAL ) { if ( ( glossRel == IMappingElement . LESS_GENERAL ) || ( glossRel == IMappingElement . EQUIVALENCE ) ) { return IMappingElement . LESS_GENERAL ; } } if ( builtForRel == IMappingElement . MORE_GENERAL ) { if ( ( glossRel == IMappingElement . MORE_GENERAL ) || ( glossRel == IMappingElement . EQUIVALENCE ) ) { return IMappingElement . MORE_GENERAL ; } } return IMappingElement . IDK ; } | Decides which relation to return as a function of relation for which extended gloss was built . |
10,368 | public Map < ParsedPath , List < CommandDef > > processObject ( Object instance ) { final ClassContext context = new ClassContext ( ) ; doProcess ( instance , context ) ; return context . commandPaths ; } | Process the object s class and all declared inner classes and return all parsed commands with their paths . |
10,369 | protected void add ( String key , Status status , String masterValue , String value ) { textNodeMap . put ( key , new TextNode ( key , status , masterValue , value ) ) ; } | Adds a record to this CSV file . |
10,370 | private static List < INode > preorder ( INode root ) { ArrayList < INode > result = new ArrayList < INode > ( ) ; Deque < INode > stack = new ArrayDeque < INode > ( ) ; stack . push ( root ) ; while ( ! stack . isEmpty ( ) ) { INode c = stack . pop ( ) ; result . add ( c ) ; for ( int i = c . getChildCount ( ) - 1 ; i >= 0 ; i -- ) { stack . push ( c . getChildAt ( i ) ) ; } } return result ; } | Preorders the subtree rooted at the given node . |
10,371 | public void setContentPane ( Container contentPanel ) { if ( contentPanel == null ) { throw new IllegalArgumentException ( "Content pane can't be null" ) ; } if ( wrapper != null ) { super . remove ( wrapper ) ; } wrapper = new WrapperContainer ( contentPanel ) ; super . addImpl ( wrapper , BorderLayout . CENTER , - 1 ) ; } | Sets the content pane of this JCollapsiblePane . Components must be added to this content pane not to the JCollapsiblePane . |
10,372 | private void setAnimationParams ( AnimationParams params ) { if ( params == null ) { throw new IllegalArgumentException ( "params can't be null" ) ; } if ( animateTimer != null ) { animateTimer . stop ( ) ; } animationParams = params ; animateTimer = new Timer ( animationParams . waitTime , animator ) ; animateTimer . setInitialDelay ( 0 ) ; } | Sets the parameters controlling the animation . |
10,373 | public DateFuncSup subtract ( DateSeperator d ) { date . setTime ( date . getTime ( ) - d . parse ( ) ) ; return this ; } | subtract date on supported date |
10,374 | public DateFuncSup nextMonth ( int next ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; cal . add ( Calendar . MONTH , next ) ; date . setTime ( cal . getTimeInMillis ( ) ) ; return this ; } | set date to next months |
10,375 | public DateFuncSup nextYear ( int next ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; cal . add ( Calendar . YEAR , next ) ; date . setTime ( cal . getTimeInMillis ( ) ) ; return this ; } | set date to next years |
10,376 | public static String toCNF ( INode in , String formula ) throws ContextClassifierException { PEParser parser = new PEParser ( ) ; CNFTransformer transformer = new CNFTransformer ( ) ; String result = formula ; if ( ( formula . contains ( "&" ) && formula . contains ( "|" ) ) || formula . contains ( "~" ) ) { String tmpFormula = formula ; tmpFormula = tmpFormula . trim ( ) ; tmpFormula = tmpFormula . replace ( "&" , "AND" ) ; tmpFormula = tmpFormula . replace ( "|" , "OR" ) ; tmpFormula = tmpFormula . replace ( "~" , "NOT" ) ; tmpFormula = "(" + tmpFormula + ")" ; if ( ! tmpFormula . isEmpty ( ) ) { tmpFormula = tmpFormula . replace ( '.' , 'P' ) ; Sentence f = ( Sentence ) parser . parse ( tmpFormula ) ; Sentence cnf = transformer . transform ( f ) ; tmpFormula = cnf . toString ( ) ; tmpFormula = tmpFormula . replace ( "AND" , "&" ) ; tmpFormula = tmpFormula . replace ( "OR" , "|" ) ; tmpFormula = tmpFormula . replace ( "NOT" , "~" ) ; result = tmpFormula . replace ( 'P' , '.' ) ; } else { result = tmpFormula ; } } return result ; } | Converts the formula into CNF . |
10,377 | private String extractLanguage ( String columnHeading ) throws ParseException { int start = columnHeading . indexOf ( '(' ) ; int end = columnHeading . indexOf ( ')' ) ; if ( start == - 1 || end == - 1 || start >= end ) { throwWrongHeaderException ( ) ; } return columnHeading . substring ( start + 1 , end ) ; } | Extracts the language of the master language value and value column heading in the first line of the trema CSV file . |
10,378 | public final boolean registerMBean ( final Class < ? > clazz ) { if ( this . mbs != null && clazz != null ) { try { final String fqnName = clazz . getCanonicalName ( ) ; final String domain = fqnName . substring ( 0 , fqnName . lastIndexOf ( '.' ) ) ; final String type = fqnName . substring ( fqnName . lastIndexOf ( '.' ) + 1 ) ; final ObjectName objectName = new ObjectName ( String . format ( beanNameFormat , domain , type ) ) ; if ( ! mbs . isRegistered ( objectName ) ) { LaunchingMessageKind . IJMX0004 . format ( objectName ) ; mbs . registerMBean ( clazz . newInstance ( ) , objectName ) ; LaunchingMessageKind . IJMX0005 . format ( objectName ) ; } this . beanNames . add ( objectName ) ; } catch ( Exception e ) { LaunchingMessageKind . EJMX0004 . format ( clazz . getCanonicalName ( ) , e ) ; return false ; } } else { LaunchingMessageKind . EJMX0002 . format ( ) ; return false ; } return true ; } | Try to register standard MBean type in the JMX server |
10,379 | private void unRegisterMBeans ( ) { if ( beanNames != null ) { for ( ObjectName objectName : beanNames ) { try { mbs . unregisterMBean ( objectName ) ; LaunchingMessageKind . IJMX0006 . format ( objectName ) ; } catch ( MBeanRegistrationException e ) { } catch ( InstanceNotFoundException e ) { } } beanNames . clear ( ) ; } } | Unregister all registered MBeans in the JMX server . |
10,380 | private int numOfTabs ( String line ) { int i = 0 ; while ( i < line . length ( ) && '\t' == line . charAt ( i ) ) { i ++ ; } return i ; } | Counts the number of tabs in the line . |
10,381 | private void setArrayNodeID ( int index , ArrayList < INode > array , INode node ) { if ( index < array . size ( ) ) { array . set ( index , node ) ; } else { array . add ( index , node ) ; } } | Sets the node at a given position of the array . Changes the current value if there is one if there is no value adds a new one . |
10,382 | public void makeImmutable ( ) { if ( ! isImmutable ) { overflowEntries = overflowEntries . isEmpty ( ) ? Collections . < K , V > emptyMap ( ) : Collections . unmodifiableMap ( overflowEntries ) ; isImmutable = true ; } } | Make this map immutable from this point forward . |
10,383 | private void ensureEntryArrayMutable ( ) { checkMutable ( ) ; if ( entryList . isEmpty ( ) && ! ( entryList instanceof ArrayList ) ) { entryList = new ArrayList < Entry > ( maxArraySize ) ; } } | Lazily creates the entry list . Any code that adds to the list must first call this method . |
10,384 | public String displayConfiguration ( ) { StringBuffer result = new StringBuffer ( ) ; for ( ConfigurationManager confManager : ConfigurationService . getConfigurationService ( ) . getConfigurationManager ( ) . values ( ) ) { Object configuration = confManager . getConfiguration ( ) ; StringWriter writer = new StringWriter ( ) ; JAXB . marshal ( configuration , writer ) ; result . append ( writer . getBuffer ( ) ) ; result . append ( "\n" ) ; } ; return result . toString ( ) ; } | This method is used to display the configurations data loaded from all configuration files . |
10,385 | public byte [ ] readBytes ( ) throws IOException { Buffer buffer ; try ( InputStream src = newInputStream ( ) ) { buffer = getWorld ( ) . getBuffer ( ) ; synchronized ( buffer ) { return buffer . readBytes ( src ) ; } } } | Reads all bytes of the node . |
10,386 | public Properties readProperties ( ) throws IOException { Properties p ; try ( Reader src = newReader ( ) ) { p = new Properties ( ) ; p . load ( src ) ; } return p ; } | Reads properties with the encoding for this node |
10,387 | public T mkfile ( ) throws MkfileException { try { if ( exists ( ) ) { throw new MkfileException ( this ) ; } return writeBytes ( ) ; } catch ( IOException e ) { throw new MkfileException ( this , e ) ; } } | Fails if the file already exists . Features define whether this operation is atomic . This default implementation is not atomic . |
10,388 | public void copy ( Node dest ) throws NodeNotFoundException , CopyException { try { if ( isDirectory ( ) ) { dest . mkdirOpt ( ) ; copyDirectory ( dest ) ; } else { copyFile ( dest ) ; } } catch ( FileNotFoundException | CopyException e ) { throw e ; } catch ( IOException e ) { throw new CopyException ( this , dest , e ) ; } } | Copies this to dest . Overwrites existing file and adds to existing directories . |
10,389 | public Node copyFile ( Node dest ) throws FileNotFoundException , CopyException { try ( OutputStream out = dest . newOutputStream ( ) ) { copyFileTo ( out ) ; } catch ( FileNotFoundException e ) { throw e ; } catch ( IOException e ) { throw new CopyException ( this , dest , e ) ; } return this ; } | Overwrites dest if it already exists . |
10,390 | public List < Node > copyDirectory ( Node dest ) throws DirectoryNotFoundException , CopyException { return copyDirectory ( dest , new Filter ( ) . includeAll ( ) ) ; } | Convenience method for copy all files . Does not use default - excludes |
10,391 | public List < Node > copyDirectory ( Node destdir , Filter filter ) throws DirectoryNotFoundException , CopyException { return new Copy ( this , filter ) . directory ( destdir ) ; } | Throws an exception is this or dest is not a directory . Overwrites existing files in dest . |
10,392 | public Node move ( Node dest , boolean overwrite ) throws NodeNotFoundException , MoveException { try { if ( ! overwrite ) { dest . checkNotExists ( ) ; } copy ( dest ) ; deleteTree ( ) ; } catch ( FileNotFoundException e ) { throw e ; } catch ( IOException e ) { throw new MoveException ( this , dest , "move failed" , e ) ; } return dest ; } | Moves this file or directory to dest . Throws an exception if this does not exist or if dest already exists . This method is a default implementation with copy and delete derived classes should override it with a native implementation when available . |
10,393 | public T link ( T dest ) throws LinkException { if ( ! getClass ( ) . equals ( dest . getClass ( ) ) ) { throw new IllegalArgumentException ( this . getClass ( ) + " vs " + dest . getClass ( ) ) ; } try { checkExists ( ) ; } catch ( IOException e ) { throw new LinkException ( this , e ) ; } dest . mklink ( Filesystem . SEPARATOR_STRING + this . getPath ( ) ) ; return dest ; } | Creates an absolute link dest pointing to this . The signature of this method resembles the copy method . |
10,394 | public T resolveLink ( ) throws ReadLinkException { String path ; path = readLink ( ) ; if ( path . startsWith ( Filesystem . SEPARATOR_STRING ) ) { return getRoot ( ) . node ( path . substring ( 1 ) , null ) ; } else { return ( T ) getParent ( ) . join ( path ) ; } } | Throws an exception if this is not a link . |
10,395 | public List < T > find ( String ... includes ) throws IOException { return find ( getWorld ( ) . filter ( ) . include ( includes ) ) ; } | uses default excludes |
10,396 | private void truncateTempTables ( ) throws SQLException { Logger logger = I2b2ETLUtil . logger ( ) ; logger . log ( Level . INFO , "Truncating temp data tables for query {0}" , this . query . getName ( ) ) ; try ( final Connection conn = openDataDatabaseConnection ( ) ) { conn . setAutoCommit ( true ) ; String [ ] dataschemaTables = { tempPatientTableName ( ) , tempPatientMappingTableName ( ) , tempVisitTableName ( ) , tempEncounterMappingTableName ( ) , tempProviderTableName ( ) , tempConceptTableName ( ) , tempModifierTableName ( ) , tempObservationFactTableName ( ) , tempObservationFactCompleteTableName ( ) } ; for ( String tableName : dataschemaTables ) { truncateTable ( conn , tableName ) ; } logger . log ( Level . INFO , "Done truncating temp data tables for query {0}" , this . query . getName ( ) ) ; } } | Calls stored procedures to drop all of the temp tables created . |
10,397 | public int first ( ) { int val ; int i ; for ( i = 0 ; i < data . length ; i ++ ) { if ( data [ i ] != 0 ) { val = data [ i ] ; i <<= SHIFT ; while ( ( val & 1 ) == 0 ) { val >>>= 1 ; i ++ ; } return i ; } } return - 1 ; } | Gets the first element of the set . |
10,398 | public int last ( ) { int val ; int i ; for ( i = data . length - 1 ; i >= 0 ; i -- ) { if ( data [ i ] != 0 ) { val = data [ i ] >>> 1 ; i <<= SHIFT ; while ( val != 0 ) { val >>>= 1 ; i ++ ; } return i ; } } return - 1 ; } | Gets the last element of the set . |
10,399 | public int next ( int ele ) { int idx , bit , val ; idx = ele >> SHIFT ; bit = ele & MASK ; val = data [ idx ] >>> bit ; do { val >>>= 1 ; bit ++ ; if ( val == 0 ) { idx ++ ; if ( idx == data . length ) { return - 1 ; } val = data [ idx ] ; bit = 0 ; } } while ( ( val & 1 ) == 0 ) ; return ( idx << SHIFT ) + bit ; } | Gets the element following ele . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.