idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
4,100 | private void parseCacheConfig ( final Node node , final ConfigSettings config ) { String name ; Long lValue ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ;... | Parses the cache parameter section . |
4,101 | private void parseLoggingConfig ( final Node node , final ConfigSettings config ) { String name ; String value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ... | Parses the logging parameter section . |
4,102 | private void parseLoggerConfig ( final Node node , final ConfigSettings config , final ConfigurationKeys logPath , final ConfigurationKeys logLevel ) { String name , value ; Level level ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { ... | Parses the information for a logger . |
4,103 | private void parseDebugConfig ( final Node node , final ConfigSettings config ) { String name ; Boolean value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( )... | Parses the debug parameter section . |
4,104 | private void parseDebugOutputConfig ( final Node node , final ConfigSettings config ) { String name , value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ;... | Parses the debug output parameter subsection . |
4,105 | public NestedList getNestedList ( int i ) { if ( i < lists . size ( ) ) return lists . get ( i ) ; else return null ; } | Returns the NestedListContainer or NestedListElement at Positon i . |
4,106 | public void add ( final String word , final V value ) { char c = word . charAt ( 0 ) ; LetterNode < V > node = get ( c ) ; if ( node == null ) { node = new LetterNode < V > ( this . word + c ) ; } this . nodes . put ( c , node ) ; if ( word . length ( ) == 1 ) { node . isKeyword = true ; node . value = value ; return ;... | Adds a word and its related value . |
4,107 | public int compareTo ( final DiffBlock b ) { if ( ab ) { return this . revAStart - b . revAStart ; } else { return this . revBStart - b . revBStart ; } } | Compares the positions of both blocks . |
4,108 | public static ConfigurationManager getInstance ( ) throws ConfigurationException { if ( instance == null ) { throw ErrorFactory . createConfigurationException ( ErrorKeys . CONFIGURATION_CONFIGURATIONMANAGER_NOT_INITIALIZED ) ; } return instance ; } | Returns the reference to the instance of the ConfigurationManager . |
4,109 | public Object getConfigParameter ( final ConfigurationKeys configParameter ) throws ConfigurationException { Object o = this . config . getConfigParameter ( configParameter ) ; if ( o != null ) { return o ; } else if ( configParameter == ConfigurationKeys . LIMIT_SQL_ARCHIVE_SIZE ) { return Long . MAX_VALUE ; } else if... | Returns the value of the configuration parameter . |
4,110 | public static String outputNestedList ( NestedList nl , int depth ) { String result = "" ; if ( nl == null ) { return result ; } for ( int i = 0 ; i < depth ; i ++ ) { result += " " ; } if ( nl . getClass ( ) == NestedListElement . class ) { result += nl . getText ( ) ; } else { result += "---" ; for ( NestedList nl2 :... | Returns String with all elements of a NestedList |
4,111 | private void writeHeader ( ) throws SQLException { Statement query ; String [ ] revTableHeaderQueries ; revTableHeaderQueries = sqlEncoder . getTable ( ) ; for ( String revTableHeaderQuery : revTableHeaderQueries ) { query = connection . createStatement ( ) ; query . executeUpdate ( revTableHeaderQuery ) ; query . clos... | Retrieves the encoded sql orders and executes them . |
4,112 | public void compress ( String path ) { try { File fileToArchive = new File ( path ) ; BufferedInputStream input = new BufferedInputStream ( new FileInputStream ( fileToArchive ) ) ; File archivedFile = new File ( fileToArchive . getName ( ) + ".bz2" ) ; archivedFile . createNewFile ( ) ; FileOutputStream fos = new File... | Creates bz2 archive file from file in path |
4,113 | public OutputStream getCompressionStream ( String path ) throws IOException { File archivedFile = new File ( path ) ; archivedFile . createNewFile ( ) ; FileOutputStream fos = new FileOutputStream ( archivedFile ) ; BufferedOutputStream bufStr = new BufferedOutputStream ( fos ) ; fos . write ( "BZ" . getBytes ( ) ) ; C... | Creates stream for compression |
4,114 | public InputStreamReader getDecompressionStream ( String path , String encoding ) throws IOException { File fileToUncompress = new File ( path ) ; BufferedInputStream fileStream = new BufferedInputStream ( new FileInputStream ( fileToUncompress ) ) ; fileStream . read ( ) ; fileStream . read ( ) ; BufferedInputStream b... | Creates Stream for decompression |
4,115 | public void decompress ( String path ) throws IOException { File bzip2 = new File ( path ) ; File unarchived = new File ( bzip2 . getName ( ) . replace ( ".bz2" , "" ) ) ; unarchived . createNewFile ( ) ; BufferedInputStream inputStr = new BufferedInputStream ( new FileInputStream ( bzip2 ) ) ; inputStr . read ( ) ; in... | Uncompress bz2 file |
4,116 | public void add ( final int currentArticleID , final long startTime , final long endTime , final List < ArticleIndexData > infoList ) { if ( ! infoList . isEmpty ( ) ) { StringBuilder fullRevBuffer = new StringBuilder ( ) ; StringBuilder revCountBuffer = new StringBuilder ( ) ; boolean first = true ; ArticleIndexData i... | Adds the information for an new entry in the article index . |
4,117 | public static SectionContainer eliminateEmptyStructures ( SectionContainer sc ) { for ( int i = sc . nrOfSubSections ( ) - 1 ; i >= 0 ; i -- ) { Section ss = sc . getSubSection ( i ) ; if ( ss . getClass ( ) == SectionContainer . class ) { SectionContainer sci = ( SectionContainer ) ss ; eliminateEmptyStructures ( sci ... | Removes all empty Structures from a SectionContainer and all substructures . |
4,118 | public static SectionContent eliminateEmptyStructures ( SectionContent sc ) { for ( int i = sc . nrOfParagraphs ( ) - 1 ; i >= 0 ; i -- ) { Paragraph p = sc . getParagraph ( i ) ; if ( p . empty ( ) ) sc . removeParagraph ( p ) ; } for ( int i = sc . nrOfDefinitionLists ( ) - 1 ; i >= 0 ; i -- ) { DefinitionList dl = s... | Removes all empty Structures from a SectionContent and all substructures . |
4,119 | public static NestedListContainer eliminateEmptyStructures ( NestedListContainer nlc ) { for ( int i = nlc . size ( ) - 1 ; i >= 0 ; i -- ) { NestedList nl = nlc . getNestedList ( i ) ; if ( nl . getClass ( ) == NestedListContainer . class ) eliminateEmptyStructures ( ( NestedListContainer ) nl ) ; if ( nl . empty ( ) ... | Removes all empty Structures from a NestedListContainer and all substructures . |
4,120 | public static Table eliminateEmptyStructures ( Table t ) { for ( int i = t . nrOfTableElements ( ) - 1 ; i >= 0 ; i -- ) { TableElement te = t . getTableElement ( i ) ; eliminateEmptyStructures ( te ) ; if ( te . empty ( ) ) t . removeTableElement ( te ) ; } return t ; } | Removes all empty Structures from a Table and all substructures . |
4,121 | public static TableElement eliminateEmptyStructures ( TableElement te ) { for ( int i = te . nrOfSections ( ) - 1 ; i >= 0 ; i -- ) { Section s = te . getSection ( i ) ; if ( s . getClass ( ) == SectionContainer . class ) eliminateEmptyStructures ( ( SectionContainer ) s ) ; else if ( s . getClass ( ) == SectionContent... | Removes all empty Structures from a TableElement and all substructures . |
4,122 | public static DefinitionList eliminateEmptyStructures ( DefinitionList dl ) { ContentElement dt = dl . getDefinedTerm ( ) ; if ( dt != null && dt . empty ( ) ) dl . setDefinedTerm ( null ) ; for ( int i = dl . nrOfDefinitions ( ) - 1 ; i >= 0 ; i -- ) { ContentElement ce = dl . getDefinition ( i ) ; if ( ce . empty ( )... | Removes all empty Structures from a DefinitionList and all substructures . |
4,123 | private void initXMLKeys ( ) { this . keywords = new SingleKeywordTree < WikipediaXMLKeys > ( ) ; keywords . addKeyword ( WikipediaXMLKeys . KEY_START_PAGE . getKeyword ( ) , WikipediaXMLKeys . KEY_START_PAGE ) ; keywords . addKeyword ( WikipediaXMLKeys . KEY_END_PAGE . getKeyword ( ) , WikipediaXMLKeys . KEY_END_PAGE ... | Creates and initializes the xml keyword tree . |
4,124 | private void initNamespaces ( ) { Map < Integer , String > namespaceMap = new HashMap < Integer , String > ( ) ; try { int b = read ( ) ; this . keywords . reset ( ) ; StringBuilder buffer = null ; while ( b != - 1 ) { if ( buffer != null ) { buffer . append ( ( char ) b ) ; } if ( this . keywords . check ( ( char ) b ... | Reads the namespaces from the siteinfo section and processes them in order to initialize the ArticleFilter |
4,125 | protected boolean readHeader ( ) throws IOException , ArticleReaderException { this . taskHeader = new ArticleInformation ( ) ; int size , r = read ( ) ; StringBuilder buffer = null ; while ( r != - 1 ) { if ( buffer != null ) { buffer . append ( ( char ) r ) ; } if ( this . keywords . check ( ( char ) r ) ) { switch (... | Reads the header of an article . |
4,126 | protected void readContributor ( Revision rev , String str ) throws IOException , ArticleReaderException { char [ ] contrChars = str . toCharArray ( ) ; int size ; StringBuilder buffer = null ; this . keywords . reset ( ) ; for ( char curChar : contrChars ) { if ( buffer != null ) { buffer . append ( curChar ) ; } if (... | Parses the content within the contributor tags and adds the parsed info to the provided revision object . |
4,127 | private void extractTemplates ( ) throws WikiApiException { PageIterator pageIter = new PageIterator ( getWiki ( ) , true , pageBuffer ) ; RevisionApi revApi = new RevisionApi ( dbConf ) ; int pageCounter = 0 ; long revisionCounter = 0L ; while ( pageIter . hasNext ( ) ) { pageCounter ++ ; if ( pageCounter % VERBOSITY ... | Extracts templates from pages and revisions |
4,128 | private void processPages ( ) { PageIterator pageIter = new PageIterator ( getWiki ( ) , true , pageBuffer ) ; int pageCounter = 0 ; while ( pageIter . hasNext ( ) ) { pageCounter ++ ; if ( pageCounter % VERBOSITY == 0 ) { logger . info ( "{} pages processed ..." , pageCounter ) ; } Page curPage = pageIter . next ( ) ;... | Extracts templates from pages only |
4,129 | private void processRevisions ( ) { logger . info ( "Processing revisions, extracting template information ..." ) ; RevisionIterator revisionIter = null ; try { revisionIter = new RevisionIterator ( dbConf ) ; int revCounter = 0 ; while ( revisionIter . hasNext ( ) ) { revCounter ++ ; if ( revCounter % VERBOSITY == 0 )... | Processes only revision templates using the Revision Iterator |
4,130 | private void generateTemplateIndices ( WikipediaTemplateInfo info , Set < String > templateNames ) { try { for ( String name : templateNames ) { int id = info . checkTemplateId ( name ) ; if ( id != - 1 ) { tplNameToTplId . put ( name , id ) ; } } } catch ( WikiApiException e ) { } } | Loads existing ids into the map . If no id exists a template will get a new one in the dump writer |
4,131 | public void initialize ( InputStream inputStream , DumpTableEnum table ) throws IOException { unbufferedResult = new PipedInputStream ( ) ; decodedStream = new PipedOutputStream ( unbufferedResult ) ; result = new BufferedInputStream ( unbufferedResult , BUFFERSIZE ) ; xmlInputThread = new XMLDumpTableInputStreamThread... | Decorator for InputStream which allows to convert an XML input stream to SQL |
4,132 | protected void init ( InputStream inputStream ) throws IOException { stream = inputStream ; st = new StreamTokenizer ( new BufferedReader ( new InputStreamReader ( stream , ENCODING ) ) ) ; EOF_reached = false ; skipStatements ( ) ; } | Init the SQLFileParser with the input stream |
4,133 | private void validateSQLFields ( ) { boolean flag = controller . isEnableSQLDatabaseOutput ( ) ; enableSQLDatabaseConnection . setSelected ( flag ) ; sqlHostLabel . setEnabled ( flag ) ; sqlHostField . setEnabled ( flag ) ; sqlDatabaseLabel . setEnabled ( flag ) ; sqlDatabaseField . setEnabled ( flag ) ; sqlUserLabel .... | Validates the UNCOMPRESSED Settings . |
4,134 | public static void main ( final String [ ] args ) { if ( args . length != 1 ) { throw new IllegalArgumentException ( "Configuration File ist missing." ) ; } try { ConfigSettings config = readConfiguration ( args [ 0 ] ) ; new DiffToolThread ( config ) . run ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } | Starts the DiffTool application . |
4,135 | private static ConfigSettings readConfiguration ( final String path ) throws IOException , SAXException , ParserConfigurationException { ConfigurationReader reader = new ConfigurationReader ( path ) ; return reader . read ( ) ; } | Reads and parses the configuration file . |
4,136 | public static String capitalize ( String s ) { if ( Character . isLowerCase ( s . charAt ( 0 ) ) ) { return Character . toUpperCase ( s . charAt ( 0 ) ) + s . substring ( 1 ) ; } else { return s ; } } | Uppercases the first character of a string . |
4,137 | private void send ( ) throws IOException , SQLException { this . indexWriter . write ( articleIndex ) ; this . indexWriter . write ( revisionIndex ) ; this . indexWriter . write ( chronoIndex ) ; } | Checks whether the AbstractIndex classes have output available and forward them to the output writer . |
4,138 | public void index ( final Revision rev ) throws WikiApiException { int articleID = rev . getArticleID ( ) ; int fullRevisionID = rev . getFullRevisionID ( ) ; int revisionCounter = rev . getRevisionCounter ( ) ; if ( articleID != currentArticleID ) { if ( lastRev != null ) { info . setEndRevisionCount ( lastRev . getRe... | Processes the given revision . |
4,139 | public void close ( ) throws WikiApiException { try { this . revisionIndex . finalizeIndex ( ) ; this . chronoIndex . finalizeIndex ( ) ; info . setEndRevisionCount ( lastRev . getRevisionCounter ( ) ) ; this . infoList . add ( info ) ; this . articleIndex . add ( currentArticleID , startTime , endTime , infoList ) ; t... | Finalizes the indices and sends the rest of the data to the output . Afterwards the database connection will be closed . |
4,140 | private void applyConfig ( ) { this . components . applyConfig ( config ) ; switch ( config . getConfigType ( ) ) { case DEFAULT : break ; case IMPORT : this . archives . applyConfiguration ( config ) ; } repaint ( ) ; } | Applies the configuration file . |
4,141 | public boolean createConfigurationXML ( ) { errors = new ConfigVerification ( ) ; xmlConfig = new StringBuilder ( ) ; xmlConfig . append ( "<config>\r\n" ) ; components . toXML ( xmlConfig , errors ) ; xmlConfig . append ( "</config>\r\n" ) ; if ( errors . getRowCount ( ) != 0 ) { new ConfigDialog ( this ) . setVisible... | Creates the xml content representation of the currently used settings . |
4,142 | public void loadConfiguration ( ) { XMLFileChooser fc = new XMLFileChooser ( ) ; if ( fc . showOpenDialog ( new JPanel ( ) ) == XMLFileChooser . APPROVE_OPTION ) { this . loadConfig ( fc . getSelectedFile ( ) . getPath ( ) ) ; } } | Loads the configuration file . The path of the file will be chosen by displaying a FileChooser Dialog . |
4,143 | public void saveConfiguration ( ) { if ( this . createConfigurationXML ( ) ) { XMLFileChooser fc = new XMLFileChooser ( ) ; if ( fc . showSaveDialog ( new JPanel ( ) ) == XMLFileChooser . APPROVE_OPTION ) { String path = fc . getSelectedFile ( ) . getPath ( ) ; if ( path . indexOf ( '.' ) == - 1 ) { path += ".xml" ; } ... | Saves the configuration file . The path of the file will be chosen by displaying a FileChooser Dialog . |
4,144 | public boolean saveConfiguration ( final String path ) { if ( xmlConfig != null && ! errors . hasFailed ( ) ) { boolean success = true ; FileWriter writer = null ; try { writer = new FileWriter ( path ) ; writer . write ( xmlConfig . toString ( ) ) ; writer . flush ( ) ; } catch ( IOException ioe ) { ioe . printStackTr... | Save the configuration to a file . |
4,145 | public void setEnable7Zip ( final boolean enable7Zip ) { this . enable7Zip = enable7Zip ; if ( ! this . enable7Zip ) { if ( outputCompression == OutputCompressionEnum . SevenZip ) { outputCompression = OutputCompressionEnum . None ; } } } | Enables or disables the 7Zip support . |
4,146 | public void removeCycles ( ) throws WikiApiException { DefaultEdge edge = null ; while ( ( edge = findCycle ( ) ) != null ) { Category sourceCat = wiki . getCategory ( categoryGraph . getGraph ( ) . getEdgeSource ( edge ) ) ; Category targetCat = wiki . getCategory ( categoryGraph . getGraph ( ) . getEdgeTarget ( edge ... | Removes cycles from the graph that was used to construct the cycle handler . |
4,147 | private void loadExternal ( ) { Properties properties = new Properties ( ) ; try { properties . loadFromXML ( new FileInputStream ( PROPERTIES_PATH ) ) ; for ( String key : properties . stringPropertyNames ( ) ) { externalSupport . put ( key , properties . getProperty ( key ) ) ; } } catch ( IOException ignore ) { } } | Load the properties for external utilities from a XML file |
4,148 | private String getExtension ( String fileName ) { if ( fileName == null ) { return null ; } String ext = null ; int i = fileName . lastIndexOf ( '.' ) ; if ( i > 0 && i < fileName . length ( ) - 1 ) { ext = fileName . substring ( i + 1 ) . toLowerCase ( ) ; } return ext ; } | Return the extension of the filename |
4,149 | public boolean isSupported ( String fileName ) { String extension = getExtension ( fileName ) ; return isInternalSupported ( extension ) || isExternalSupported ( extension ) ; } | Check if the file is supported by the internal or external decompressor |
4,150 | private InputStream startExternal ( String fileName ) { InputStream result = null ; try { String extension = getExtension ( fileName ) ; String command = externalSupport . get ( extension ) . replace ( FILEPLACEHOLDER , fileName ) ; Process externalProcess = Runtime . getRuntime ( ) . exec ( command ) ; result = extern... | Start an external utility to unpack the the archive |
4,151 | private InputStream getDefault ( String fileName ) { InputStream result = null ; try { result = new BufferedInputStream ( new FileInputStream ( fileName ) ) ; } catch ( IOException ignore ) { } return result ; } | Get default InputStream to read the data from the file |
4,152 | private boolean isInWhiteList ( String tpl ) { if ( ( ! whiteList . isEmpty ( ) && whiteList . contains ( tpl ) ) || ( whiteList . isEmpty ( ) ) ) { return true ; } return false ; } | Checks if the input string is in white list |
4,153 | private boolean containsAllowedPrefix ( String tpl ) { if ( whitePrefixList . isEmpty ( ) ) return true ; for ( String i : whitePrefixList ) { if ( tpl . startsWith ( i ) ) return true ; } return false ; } | Checks if the input string contains prefixes from white list |
4,154 | private boolean containsRestrictedPrefix ( String tpl ) { for ( String i : blackPrefixList ) { if ( tpl . startsWith ( i ) ) return true ; } return false ; } | Checks if the input string contains prefixes from black list |
4,155 | public boolean acceptTemplate ( String tpl ) { if ( isInWhiteList ( tpl ) && ! isInBlackList ( tpl ) ) { if ( containsAllowedPrefix ( tpl ) && ! containsRestrictedPrefix ( tpl ) ) { return true ; } else { return false ; } } else { return false ; } } | Checks whether to include the template with the given name in the database or not . |
4,156 | public void add ( final int revisionID , final long revisionPrimaryKey , final long fullRevisionPrimaryKey ) { boolean sql = ! insertStatement . isEmpty ( ) ; if ( sql && buffer . length ( ) != insertStatement . length ( ) ) { this . buffer . append ( "," ) ; } this . buffer . append ( ( sql ? "(" : "" ) + revisionID +... | Adds the information for an new entry in the revision index . |
4,157 | public int getFirstRevisionPK ( final int articleID ) throws WikiApiException { try { if ( articleID < 1 ) { throw new IllegalArgumentException ( ) ; } PreparedStatement statement = null ; ResultSet result = null ; String firstRevPK ; try { statement = this . connection . prepareStatement ( "SELECT PrimaryKey " + "FROM... | Returns the PrimaryKey for the first revision of the given article |
4,158 | public int getNumberOfRevisions ( final int articleID ) throws WikiApiException { try { if ( articleID < 1 ) { throw new IllegalArgumentException ( ) ; } PreparedStatement statement = null ; ResultSet result = null ; String revCounters ; try { statement = this . connection . prepareStatement ( "SELECT RevisionCounter "... | Returns the number of revisions for the specified article . |
4,159 | public List < Timestamp > getRevisionTimestamps ( final int articleID ) throws WikiApiException { List < Timestamp > timestamps = new LinkedList < Timestamp > ( ) ; try { if ( articleID < 1 ) { throw new IllegalArgumentException ( ) ; } PreparedStatement statement = null ; ResultSet result = null ; try { if ( ! indexEx... | Returns the timestamps of all revisions connected to the specified article . |
4,160 | public int getNumberOfUniqueContributorsBeforeRevision ( final int revisionID , boolean onlyRegistered ) throws WikiApiException { try { if ( revisionID < 1 ) { throw new IllegalArgumentException ( ) ; } int articleID = getPageIdForRevisionId ( revisionID ) ; Timestamp ts = getRevision ( revisionID ) . getTimeStamp ( )... | Returns the number of unique contributors to an article that have contributed before the given revision . |
4,161 | public Map < String , Timestamp > getUserContributionMap ( final int articleID , String [ ] groupfilter ) throws WikiApiException { return getUserContributionMap ( articleID , groupfilter , false ) ; } | Returns a map of usernames mapped to the timestamps of their contributions . |
4,162 | public List < String > getUserGroups ( final int userID ) throws WikiApiException { List < String > groups = new LinkedList < String > ( ) ; try { if ( userID < 1 ) { throw new IllegalArgumentException ( ) ; } if ( ! tableExists ( "user_groups" ) ) { throw new WikiInitializationException ( "User group assignment data i... | Returns the group assignments of the specified user |
4,163 | public Map < Integer , List < Integer > > getUserRevisionIds ( int userid ) throws WikiApiException { Map < Integer , List < Integer > > revIds = new HashMap < Integer , List < Integer > > ( ) ; try { if ( userid < 1 ) { throw new IllegalArgumentException ( ) ; } if ( ! indexExists ( "revisions" , "userids" ) ) { Syste... | Returns the revisionids of all revisions created by given user |
4,164 | public Map < Timestamp , Collection < DiffPart > > getTimestampToRevisionMap ( final int articleID ) throws WikiApiException { Map < Timestamp , Collection < DiffPart > > tsDiffPartsMap = new HashMap < Timestamp , Collection < DiffPart > > ( ) ; try { if ( articleID < 1 ) { throw new IllegalArgumentException ( ) ; } Pr... | Returns a map of timestamps mapped on the corresponding DiffPart - Collections . Can be used to compile statistics over all changes that have been made in one article . |
4,165 | private Timestamp getDateOfAppearance ( final int articleID , final String firstOrLast ) throws WikiApiException { try { if ( articleID < 1 ) { throw new IllegalArgumentException ( ) ; } PreparedStatement statement = null ; ResultSet result = null ; long time ; try { statement = this . connection . prepareStatement ( "... | Returns the timestamp of the first or last revision connected to the specified article . |
4,166 | public Revision getRevision ( final int revisionID ) throws WikiApiException { try { if ( revisionID < 1 ) { throw new IllegalArgumentException ( ) ; } int fullRevPK = - 1 ; int limit = 1 ; PreparedStatement statement = null ; ResultSet result = null ; try { statement = this . connection . prepareStatement ( "SELECT Fu... | Returns the by the id specified revision . |
4,167 | public Revision getRevision ( final int articleID , final int revisionCounter ) throws WikiApiException { try { if ( articleID < 1 || revisionCounter < 1 ) { throw new IllegalArgumentException ( ) ; } int revisionIndex = checkMapping ( articleID , revisionCounter ) ; String fullRevisions , revCounters ; PreparedStateme... | Returns the by the article ID and revisionCounter specified revision . Note that this method returns the revision in chronological order . |
4,168 | public Revision getRevision ( final int articleID , final Timestamp time ) throws WikiApiException { try { PreparedStatement statement = null ; ResultSet result = null ; String fullRevisions ; String revisionCounters ; if ( articleID < 1 || time == null || time . getTime ( ) <= 0 ) { throw new IllegalArgumentException ... | Returns the by the article ID and timestamp specified revision . Note that the timestamp is not an unique identifier of a revision related to an article . The returned revision should be the first revision that can be found inside the database . |
4,169 | protected int checkMapping ( final int articleID , final int revisionCounter ) throws SQLException { PreparedStatement statement = null ; ResultSet result = null ; try { statement = this . connection . prepareStatement ( "SELECT Mapping " + "FROM index_chronological " + "WHERE ArticleID=? LIMIT 1" ) ; statement . setIn... | This method maps the chronological order to the revisionCounter . |
4,170 | private int getMapping ( final String mapping , final int revisionCounter ) { String tempA , tempB ; int length = 0 ; int revC = - 1 , mapC = - 1 ; int index , max = mapping . length ( ) ; while ( length < max && revC < revisionCounter ) { index = mapping . indexOf ( ' ' , length ) ; tempA = mapping . substring ( lengt... | This method returns the correct mapping of the given input . |
4,171 | private Revision getReferencedRevision ( final int articleID , final int revisionIndex , final String fullRevisions , final String revCounters ) throws WikiApiException { try { int fullRevPK = - 1 ; int limit = 1 ; String fullRev = null ; int revA = - 1 , revB = - 1 ; int lengthFR = 0 ; int lengthRC = 0 ; int index ; i... | This method identifies the correct full revision and retrieves the reference revision . |
4,172 | private boolean indexExists ( String table , String indexName ) throws SQLException { PreparedStatement statement = null ; ResultSet result = null ; try { statement = this . connection . prepareStatement ( "SHOW INDEX FROM " + table + " WHERE Key_name!= 'PRIMARY'" ) ; result = statement . executeQuery ( ) ; if ( result... | Checks if an index with a specific name exists in a given table . |
4,173 | public Map < Integer , Long > getIdMappingCategories ( ) { Map < Integer , Long > idMapping = new HashMap < Integer , Long > ( ) ; Session session = WikiHibernateUtil . getSessionFactory ( this . dbConfig ) . getCurrentSession ( ) ; session . beginTransaction ( ) ; Iterator results = session . createQuery ( "select cat... | Hibernate IDs are needed to load an object from the database . Internal references are via pageIDs . |
4,174 | private void init ( final Task < Revision > task ) { this . partCounter ++ ; this . result = new Task < Diff > ( task . getHeader ( ) , partCounter ) ; } | Initializes the processing of a RevisionTask using a new DiffTask . |
4,175 | protected void initNewTask ( final int taskID ) { this . articleID = taskID ; this . partCounter = 0 ; this . revisionCounter = 0 ; this . revPrevious = null ; this . revCurrent = null ; } | Initializes the processing of a new RevisionTask . |
4,176 | private Diff generateFullRevision ( final Revision revision ) throws UnsupportedEncodingException { Diff diff = new Diff ( ) ; RevisionCodecData codecData = new RevisionCodecData ( ) ; part = new DiffPart ( DiffAction . FULL_REVISION_UNCOMPRESSED ) ; text = revision . getRevisionText ( ) ; revCurrent = text . toCharArr... | Generates a FullRevision . |
4,177 | private void scan ( final char [ ] input , final int start , final int end ) { this . positions = new HashMap < Character , ArrayList < Integer > > ( ) ; ArrayList < Integer > list ; char c ; for ( int i = start ; i < end ; i ++ ) { c = input [ i ] ; list = positions . get ( c ) ; if ( list == null ) { list = new Array... | Scans the input and creates the character - > position mapping . |
4,178 | private boolean findLongestMatch ( final char [ ] revA , final ArrayList < Integer > list , final char [ ] revB , final int index ) { int match ; longestMatch_size = - 1 ; int size = list . size ( ) ; int revAsize = revA . length ; int revBsize = revB . length ; int start , end , count ; for ( int i = 0 ; i < size ; i ... | Searches the longest common substring |
4,179 | public boolean check ( final char c ) { current = current . get ( c ) ; if ( current == null ) { reset ( ) ; } return current . isKeyword ( ) ; } | Checks whether the character is related to the currently used node . If the comparison fails the keyword tree will be reseted to its root node otherwise the related node will replace the current node . |
4,180 | public void add ( final int articleID , final int revisionCounter , final long timestamp ) { if ( this . articleID != articleID ) { if ( list != null ) { addToBuffer ( ) ; } this . articleID = articleID ; this . list = new ArrayList < ChronoIndexData > ( ) ; } this . list . add ( new ChronoIndexData ( timestamp , revis... | Adds the information for an new entry in the chrono index . |
4,181 | private void addToBuffer ( ) { if ( list != null && ! list . isEmpty ( ) ) { ChronoIndexData info ; Collections . sort ( list ) ; StringBuilder reverseMapping = new StringBuilder ( ) ; int size = list . size ( ) ; for ( int i = 1 ; i <= size ; i ++ ) { info = list . get ( i - 1 ) ; if ( info . getRevisionCounter ( ) !=... | Creates the mapping and the reverse mapping . The generated information will be added to the query buffer . This list will be cleared afterwards . |
4,182 | private List < Integer > getPathToRoot ( int root , int node ) throws WikiApiException { List < Integer > pathToRoot = new LinkedList < Integer > ( ) ; List < Integer > shortestPath = new ArrayList < Integer > ( ) ; expandPath ( root , node , pathToRoot , shortestPath ) ; if ( shortestPath . size ( ) == 0 ) { return nu... | Returns the shortest path from node to root as a list of pageIds of the nodes on the path . Node and root are included in the path node list . |
4,183 | public int getPathLengthInEdges ( Category node1 , Category node2 ) { if ( this . graph . containsVertex ( node1 . getPageId ( ) ) && this . graph . containsVertex ( node2 . getPageId ( ) ) ) { if ( node1 . getPageId ( ) == node2 . getPageId ( ) ) { return 0 ; } List edgeList = DijkstraShortestPath . findPathBetween ( ... | Gets the path length between two category nodes - measured in edges . |
4,184 | public int getPathLengthInNodes ( Category node1 , Category node2 ) throws WikiApiException { int retValue = getPathLengthInEdges ( node1 , node2 ) ; if ( retValue == 0 ) { return 0 ; } else if ( retValue > 0 ) { return ( -- retValue ) ; } else if ( retValue == - 1 ) { return - 1 ; } else { throw new WikiApiException (... | Gets the path length between two category nodes - measured in nodes . |
4,185 | public void createRootPathMap ( ) throws WikiApiException { if ( rootPathMap != null ) { return ; } File rootPathFile = new File ( wiki . getWikipediaId ( ) + "_" + this . rootPathMapFilename ) ; if ( rootPathFile . exists ( ) ) { logger . info ( "Loading saved rootPathMap ..." ) ; rootPathMap = deserializeMap ( rootPa... | Computes the paths from each category node to the root . Computing n paths will take some time . Thus efficient computing is based on the assumption that all subpaths in the shortest path to the root are also shortest paths for the corresponding nodes . Starting with the leaf nodes gives the longest initial paths with ... |
4,186 | public void deleteRootPathMap ( ) throws WikiApiException { File rootPathFile = new File ( this . rootPathMapFilename + "_" + wiki . getLanguage ( ) + "_" + wiki . getMetaData ( ) . getVersion ( ) ) ; rootPathFile . delete ( ) ; } | Deleted the root path map file . |
4,187 | public Map < Integer , Integer > getDegreeDistribution ( ) { if ( degreeDistribution == null ) { logger . debug ( "Calling setGraphParameters" ) ; setGraphParameters ( ) ; } return degreeDistribution ; } | Computes the degree distribution . The degree of a node is the number of edges that it is connected with . The graph is treated as an undirected graph . Computing graph parameters requires touching all node pairs . Therefore if one is called the others are computed as well and stored for later retrieval . |
4,188 | private int getNumberOfNeighborConnections ( int node ) { int numberOfConnections = 0 ; Set < Integer > neighbors = getNeighbors ( node ) ; if ( neighbors . size ( ) > 0 ) { Object [ ] nodeArray = neighbors . toArray ( ) ; Arrays . sort ( nodeArray ) ; for ( int i = 0 ; i < neighbors . size ( ) ; i ++ ) { int outerNode... | Get the number of connections that exist between the neighbors of a node . |
4,189 | protected Set < Integer > getNeighbors ( int node ) { Set < Integer > neighbors = new HashSet < Integer > ( ) ; Set < DefaultEdge > edges = undirectedGraph . edgesOf ( node ) ; for ( DefaultEdge edge : edges ) { if ( undirectedGraph . getEdgeSource ( edge ) != node ) { neighbors . add ( undirectedGraph . getEdgeSource ... | Get the neighbors of a given node . The category graph is treated as an undirected graph . |
4,190 | private void setGraphParameters ( ) { double maxPathLength = 0.0 ; double shortestPathLengthSum = 0.0 ; double degreeSum = 0.0 ; double clusterCoefficientSum = 0.0 ; Set < Integer > nodes = undirectedGraph . vertexSet ( ) ; Set < Integer > wasSource = new HashSet < Integer > ( ) ; int progress = 0 ; for ( int node : no... | Computes and sets the diameter the average degree and the average shortest path length of the graph . Do not call this in the constructor . May run a while . It is called in the getters if parameters are not yet initialized when retrieved . |
4,191 | private double computeDepth ( ) throws WikiApiException { Category root = wiki . getMetaData ( ) . getMainCategory ( ) ; if ( root == null ) { logger . error ( "There is no root node for this wiki. Check the parameter that provides the name of the root node." ) ; return 0.0 ; } if ( ! graph . containsVertex ( root . ge... | Computes the depth of the category graph i . e . the maximum path length starting with the root node . |
4,192 | private void serializeMap ( Map < ? , ? > map , File file ) { try ( ObjectOutputStream os = new ObjectOutputStream ( new BufferedOutputStream ( new FileOutputStream ( file ) ) ) ) { os . writeObject ( map ) ; } catch ( Exception e ) { logger . error ( e . getLocalizedMessage ( ) , e ) ; } } | Serialize a Map . |
4,193 | private Map deserializeMap ( File file ) { Map < ? , ? > map ; try ( ObjectInputStream is = new ObjectInputStream ( new BufferedInputStream ( new FileInputStream ( file ) ) ) ) { map = ( Map < ? , ? > ) is . readObject ( ) ; } catch ( Exception e ) { logger . error ( e . getLocalizedMessage ( ) , e ) ; return null ; } ... | Deserialize a map |
4,194 | public void saveGraph ( String destination ) throws WikiApiException { try { GraphSerialization . saveGraph ( graph , destination ) ; } catch ( IOException e ) { throw new WikiApiException ( e ) ; } } | Serializes the graph to the given destination . |
4,195 | public void setSections ( List < Section > sections ) { for ( Section s : sections ) superSection . addSection ( s ) ; } | Sets the Sections of a ParsedPage . |
4,196 | public void validate ( ) { boolean flagA = ! controller . isEnableSQLDatabaseOutput ( ) ; boolean flagB = controller . isMultipleOutputFiles ( ) ; OutputCompressionEnum oce = controller . getOutputCompression ( ) ; enableZipEncodingCompression . setSelected ( controller . isZipCompressionEnabled ( ) ) ; disableOutputCo... | A call of this method should validate the status of the panels components . |
4,197 | private String copy ( final char [ ] array , final int start , final int end ) { StringBuilder text = new StringBuilder ( ) ; for ( int j = start ; j < end ; j ++ ) { text . append ( array [ j ] ) ; } return text . toString ( ) ; } | Copies the specified interval of characters for the array . |
4,198 | private void insert ( final char [ ] revB , final DiffBlock curB ) throws UnsupportedEncodingException { String text = copy ( revB , curB . getRevBStart ( ) , curB . getRevBEnd ( ) ) ; DiffPart action = new DiffPart ( DiffAction . INSERT ) ; action . setStart ( version . length ( ) ) ; codecData . checkBlocksizeS ( ver... | Creates an insert operation . |
4,199 | private void delete ( final DiffBlock curA ) { DiffPart action = new DiffPart ( DiffAction . DELETE ) ; action . setStart ( version . length ( ) ) ; codecData . checkBlocksizeS ( version . length ( ) ) ; action . setLength ( curA . getRevAEnd ( ) - curA . getRevAStart ( ) ) ; codecData . checkBlocksizeE ( action . getL... | Creates a delete operation . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.