idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
21,700
protected void initializeAttributeIndices ( ) { m_ActiveIndices = new boolean [ m_Data . numAttributes ( ) ] ; for ( int i = 0 ; i < m_ActiveIndices . length ; i ++ ) m_ActiveIndices [ i ] = true ; }
initializes the attribute indices .
21,701
protected double norm ( double x , int i ) { if ( Double . isNaN ( m_Ranges [ i ] [ R_MIN ] ) || ( m_Ranges [ i ] [ R_MAX ] == m_Ranges [ i ] [ R_MIN ] ) ) return 0 ; else return ( x - m_Ranges [ i ] [ R_MIN ] ) / ( m_Ranges [ i ] [ R_WIDTH ] ) ; }
Normalizes a given value of a numeric attribute .
21,702
protected double difference ( int index , double val1 , double val2 ) { if ( m_Data . attribute ( index ) . isNominal ( ) == true ) { if ( isMissingValue ( val1 ) || isMissingValue ( val2 ) || ( ( int ) val1 != ( int ) val2 ) ) { return 1 ; } else { return 0 ; } } else { if ( isMissingValue ( val1 ) || isMissingValue (...
Computes the difference between two given attribute values .
21,703
public double [ ] [ ] initializeRanges ( ) { if ( m_Data == null ) { m_Ranges = null ; return m_Ranges ; } int numAtt = m_Data . numAttributes ( ) ; double [ ] [ ] ranges = new double [ numAtt ] [ 3 ] ; if ( m_Data . numInstances ( ) <= 0 ) { initializeRangesEmpty ( numAtt , ranges ) ; m_Ranges = ranges ; return m_Rang...
Initializes the ranges using all instances of the dataset . Sets m_Ranges .
21,704
public void updateRangesFirst ( Instance instance , int numAtt , double [ ] [ ] ranges ) { for ( int j = 0 ; j < numAtt ; j ++ ) { if ( ! instance . isMissing ( j ) ) { ranges [ j ] [ R_MIN ] = instance . value ( j ) ; ranges [ j ] [ R_MAX ] = instance . value ( j ) ; ranges [ j ] [ R_WIDTH ] = 0.0 ; } else { ranges [ ...
Used to initialize the ranges . For this the values of the first instance is used to save time . Sets low and high to the values of the first instance and width to zero .
21,705
public void initializeRangesEmpty ( int numAtt , double [ ] [ ] ranges ) { for ( int j = 0 ; j < numAtt ; j ++ ) { ranges [ j ] [ R_MIN ] = Double . POSITIVE_INFINITY ; ranges [ j ] [ R_MAX ] = - Double . POSITIVE_INFINITY ; ranges [ j ] [ R_WIDTH ] = Double . POSITIVE_INFINITY ; } }
Used to initialize the ranges .
21,706
public double [ ] [ ] updateRanges ( Instance instance , double [ ] [ ] ranges ) { for ( int j = 0 ; j < ranges . length ; j ++ ) { double value = instance . value ( j ) ; if ( ! instance . isMissing ( j ) ) { if ( value < ranges [ j ] [ R_MIN ] ) { ranges [ j ] [ R_MIN ] = value ; ranges [ j ] [ R_WIDTH ] = ranges [ j...
Updates the ranges given a new instance .
21,707
public double [ ] [ ] initializeRanges ( int [ ] instList ) throws Exception { if ( m_Data == null ) throw new Exception ( "No instances supplied." ) ; int numAtt = m_Data . numAttributes ( ) ; double [ ] [ ] ranges = new double [ numAtt ] [ 3 ] ; if ( m_Data . numInstances ( ) <= 0 ) { initializeRangesEmpty ( numAtt ,...
Initializes the ranges of a subset of the instances of this dataset . Therefore m_Ranges is not set .
21,708
public boolean inRanges ( Instance instance , double [ ] [ ] ranges ) { boolean isIn = true ; for ( int j = 0 ; isIn && ( j < ranges . length ) ; j ++ ) { if ( ! instance . isMissing ( j ) ) { double value = instance . value ( j ) ; isIn = value <= ranges [ j ] [ R_MAX ] ; if ( isIn ) isIn = value >= ranges [ j ] [ R_M...
Test if an instance is within the given ranges .
21,709
public static void setURLStreamHandlerFactory ( URLStreamHandlerFactory factory ) { synchronized ( PROTOCOL_HANDLERS ) { if ( Handler . factory != null ) { throw new IllegalStateException ( "URLStreamHandlerFactory already set." ) ; } PROTOCOL_HANDLERS . clear ( ) ; Handler . factory = factory ; } }
Sets the URL stream handler factory for the environment . This allows specification of the factory used in creating underlying stream handlers . This can be called once per JVM instance .
21,710
public void bind ( ) throws DcerpcException , IOException { synchronized ( this ) { try { this . state = 1 ; DcerpcMessage bind = new DcerpcBind ( this . binding , this ) ; sendrecv ( bind ) ; } catch ( IOException ioe ) { this . state = 0 ; throw ioe ; } } }
Bind the handle
21,711
public String [ ] list ( ) throws SmbException { return SmbEnumerationUtil . list ( this , "*" , ATTR_DIRECTORY | ATTR_HIDDEN | ATTR_SYSTEM , null , null ) ; }
List the contents of this SMB resource . The list returned by this method will be ;
21,712
public void update ( byte [ ] input , int offset , int len ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "update: " + this . updates + " " + offset + ":" + len ) ; log . trace ( Hexdump . toHexString ( input , offset , Math . min ( len , 256 ) ) ) ; } if ( len == 0 ) { return ; } this . digest . update ( input , ...
Update digest with data
21,713
public void setupMIC ( byte [ ] type1 , byte [ ] type2 ) throws GeneralSecurityException , IOException { byte [ ] sk = this . masterKey ; if ( sk == null ) { return ; } MessageDigest mac = Crypto . getHMACT64 ( sk ) ; mac . update ( type1 ) ; mac . update ( type2 ) ; byte [ ] type3 = toByteArray ( ) ; mac . update ( ty...
Sets the MIC
21,714
public static int getDefaultFlags ( CIFSContext tc ) { return NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_VERSION | ( tc . getConfig ( ) . isUseUnicode ( ) ? NTLMSSP_NEGOTIATE_UNICODE : NTLMSSP_NEGOTIATE_OEM ) ; }
Returns the default flags for a generic Type - 3 message in the current environment .
21,715
public static List < AvPair > decode ( byte [ ] data ) throws CIFSException { List < AvPair > pairs = new LinkedList < > ( ) ; int pos = 0 ; boolean foundEnd = false ; while ( pos + 4 <= data . length ) { int avId = SMBUtil . readInt2 ( data , pos ) ; int avLen = SMBUtil . readInt2 ( data , pos + 2 ) ; pos += 4 ; if ( ...
Decode a list of AvPairs
21,716
public static void remove ( List < AvPair > pairs , int type ) { Iterator < AvPair > it = pairs . iterator ( ) ; while ( it . hasNext ( ) ) { AvPair p = it . next ( ) ; if ( p . getType ( ) == type ) { it . remove ( ) ; } } }
Remove all occurances of the given type
21,717
public static void replace ( List < AvPair > pairs , AvPair rep ) { remove ( pairs , rep . getType ( ) ) ; pairs . add ( rep ) ; }
Replace all occurances of the given type
21,718
public void close ( ) throws IOException { try { if ( this . handle . isValid ( ) ) { this . handle . close ( ) ; } } finally { this . file . clearAttributeCache ( ) ; this . tmp = null ; } }
Closes this output stream and releases any system resources associated with it .
21,719
public void treeConnectLogon ( ) throws SmbException { String logonShare = getContext ( ) . getConfig ( ) . getLogonShare ( ) ; if ( logonShare == null || logonShare . isEmpty ( ) ) { throw new SmbException ( "Logon share is not defined" ) ; } try ( SmbTreeImpl t = getSmbTree ( logonShare , null ) ) { t . treeConnect (...
Establish a tree connection with the configured logon share
21,720
public static int readn ( InputStream in , byte [ ] b , int off , int len ) throws IOException { int i = 0 , n = - 5 ; if ( off + len > b . length ) { throw new IOException ( "Buffer too short, bufsize " + b . length + " read " + len ) ; } while ( i < len ) { n = in . read ( b , off + i , len - i ) ; if ( n <= 0 ) { br...
Read bytes from the input stream into a buffer
21,721
public < T extends Response > T sendrecv ( Request request , T response , Set < RequestParam > params ) throws IOException { if ( isDisconnected ( ) && this . state != 5 ) { throw new TransportException ( "Transport is disconnected " + this . name ) ; } try { long timeout = ! params . contains ( RequestParam . NO_TIMEO...
Send a request message and recieve response
21,722
public synchronized boolean disconnect ( boolean hard , boolean inUse ) throws IOException { IOException ioe = null ; switch ( this . state ) { case 0 : case 5 : case 6 : return false ; case 2 : hard = true ; case 3 : if ( this . response_map . size ( ) != 0 && ! hard && inUse ) { break ; } try { this . state = 5 ; boo...
Disconnect the transport
21,723
protected void doRecv ( Response response ) throws IOException { CommonServerMessageBlock resp = ( CommonServerMessageBlock ) response ; this . negotiated . setupResponse ( response ) ; try { if ( this . smb2 ) { doRecvSMB2 ( resp ) ; } else { doRecvSMB1 ( resp ) ; } } catch ( Exception e ) { log . warn ( "Failure deco...
must be synchronized with peekKey
21,724
public static boolean isDotQuadIP ( String hostname ) { if ( Character . isDigit ( hostname . charAt ( 0 ) ) ) { int i , len , dots ; char [ ] data ; i = dots = 0 ; len = hostname . length ( ) ; data = hostname . toCharArray ( ) ; while ( i < len && Character . isDigit ( data [ i ++ ] ) ) { if ( i == len && dots == 3 )...
Check whether a hostname is actually an ip address
21,725
public static synchronized final void init ( Properties props ) throws CIFSException { if ( INSTANCE != null ) { throw new CIFSException ( "Singleton context is already initialized" ) ; } Properties p = new Properties ( ) ; try { String filename = System . getProperty ( "jcifs.properties" ) ; if ( filename != null && f...
Initialize singleton context using custom properties
21,726
public static synchronized final SingletonContext getInstance ( ) { if ( INSTANCE == null ) { try { log . debug ( "Initializing singleton context" ) ; init ( null ) ; } catch ( CIFSException e ) { log . error ( "Failed to create singleton JCIFS context" , e ) ; } } return INSTANCE ; }
Get singleton context
21,727
public static int getPowerOf2 ( long value ) { Preconditions . checkArgument ( isPowerOf2 ( value ) ) ; return Long . SIZE - ( Long . numberOfLeadingZeros ( value ) + 1 ) ; }
Returns an integer X such that 2^X = value . Throws an exception if value is not a power of 2 .
21,728
public void rollback ( ) throws BackendException { Throwable excep = null ; for ( IndexTransaction itx : indexTx . values ( ) ) { try { itx . rollback ( ) ; } catch ( Throwable e ) { excep = e ; } } storeTx . rollback ( ) ; if ( excep != null ) { if ( excep instanceof BackendException ) throw ( BackendException ) excep...
Rolls back all transactions and makes sure that this does not get cut short by exceptions . If exceptions occur the storage exception takes priority on re - throw .
21,729
public boolean contains ( int partitionId ) { if ( lowerID < upperID ) { return lowerID <= partitionId && upperID > partitionId ; } else { return ( lowerID <= partitionId && partitionId < idUpperBound ) || ( upperID > partitionId && partitionId >= 0 ) ; } }
Returns true of the given partitionId lies within this partition id range else false .
21,730
public int getRandomID ( ) { int partitionWidth ; if ( lowerID < upperID ) partitionWidth = upperID - lowerID ; else partitionWidth = ( idUpperBound - lowerID ) + upperID ; Preconditions . checkArgument ( partitionWidth > 0 , partitionWidth ) ; return ( random . nextInt ( partitionWidth ) + lowerID ) % idUpperBound ; }
Returns a random partition id that lies within this partition id range .
21,731
public double incBy ( K o , double inc ) { Counter c = countMap . get ( o ) ; if ( c == null ) { c = new Counter ( ) ; countMap . put ( o , c ) ; } c . count += inc ; return c . count ; }
Increases the count of object o by inc and returns the new count value
21,732
public File getHomeDirectory ( ) { if ( ! configuration . has ( STORAGE_DIRECTORY ) ) throw new UnsupportedOperationException ( "No home directory specified" ) ; File dir = new File ( configuration . get ( STORAGE_DIRECTORY ) ) ; Preconditions . checkArgument ( dir . isDirectory ( ) , "Not a directory" ) ; return dir ;...
Returns the home directory for the graph database initialized in this configuration
21,733
public synchronized void close ( ) throws BackendException { if ( ! isOpen ) return ; this . isOpen = false ; if ( readExecutor != null ) readExecutor . shutdown ( ) ; if ( sendThread != null ) sendThread . close ( CLOSE_DOWN_WAIT ) ; if ( readExecutor != null ) { try { readExecutor . awaitTermination ( 1 , TimeUnit . ...
Closes the log by terminating all threads and waiting for their termination .
21,734
private void sendMessages ( final List < MessageEnvelope > msgEnvelopes ) { try { boolean success = BackendOperation . execute ( new BackendOperation . Transactional < Boolean > ( ) { public Boolean call ( StoreTransaction txh ) throws BackendException { ListMultimap < StaticBuffer , Entry > mutations = ArrayListMultim...
Sends a batch of messages by persisting them to the storage backend .
21,735
public void addition ( E entry ) { if ( additions == null ) additions = new ArrayList < E > ( ) ; additions . add ( entry ) ; }
Adds a new entry as an addition to this mutation
21,736
public void deletion ( K key ) { if ( deletions == null ) deletions = new ArrayList < K > ( ) ; deletions . add ( key ) ; }
Adds a new key as a deletion to this mutation
21,737
public void merge ( Mutation < E , K > m ) { Preconditions . checkNotNull ( m ) ; if ( null != m . additions ) { if ( null == additions ) additions = m . additions ; else additions . addAll ( m . additions ) ; } if ( null != m . deletions ) { if ( null == deletions ) deletions = m . deletions ; else deletions . addAll ...
Merges another mutation into this mutation . Ensures that all additions and deletions are added to this mutation . Does not remove duplicates if such exist - this needs to be ensured by the caller .
21,738
public CTConnection makeRawConnection ( ) throws TTransportException { final Config cfg = cfgRef . get ( ) ; String hostname = cfg . getRandomHost ( ) ; log . debug ( "Creating TSocket({}, {}, {}, {}, {})" , hostname , cfg . port , cfg . username , cfg . password , cfg . timeoutMS ) ; TSocket socket ; if ( null != cfg ...
Create a Cassandra - Thrift connection but do not attempt to set a keyspace on the connection .
21,739
public Q profiler ( QueryProfiler profiler ) { Preconditions . checkNotNull ( profiler ) ; this . profiler = profiler ; return getThis ( ) ; }
Sets the query profiler to observe this query . Must be set before the query is executed to take effect .
21,740
public static final Geoshape point ( final float latitude , final float longitude ) { Preconditions . checkArgument ( isValidCoordinate ( latitude , longitude ) , "Invalid coordinate provided" ) ; return new Geoshape ( new float [ ] [ ] { new float [ ] { latitude } , new float [ ] { longitude } } ) ; }
Constructs a point from its latitude and longitude information
21,741
public static final Geoshape circle ( final float latitude , final float longitude , final float radiusInKM ) { Preconditions . checkArgument ( isValidCoordinate ( latitude , longitude ) , "Invalid coordinate provided" ) ; Preconditions . checkArgument ( radiusInKM > 0 , "Invalid radius provided [%s]" , radiusInKM ) ; ...
Constructs a circle from a given center point and a radius in kilometer
21,742
public static void awaitGraphIndexUpdate ( TitanGraph g , String indexName , long time , TemporalUnit unit ) { awaitIndexUpdate ( g , indexName , null , time , unit ) ; }
This method blocks and waits until the provided index has been updated across the entire Titan cluster and reached a stable state . This method will wait for the given period of time and throw an exception if the index did not reach a final state within that time . The method simply returns when the index has reached t...
21,743
public static final void clear ( TitanGraph graph ) { Preconditions . checkNotNull ( graph ) ; Preconditions . checkArgument ( graph instanceof StandardTitanGraph , "Invalid graph instance detected: %s" , graph . getClass ( ) ) ; StandardTitanGraph g = ( StandardTitanGraph ) graph ; Preconditions . checkArgument ( ! g ...
Clears out the entire graph . This will delete ALL of the data stored in this graph and the data will NOT be recoverable . This method is intended only for development and testing use .
21,744
public static void attachProperties ( final TitanVertex vertex , final Object ... propertyKeyValues ) { if ( null == vertex ) throw Graph . Exceptions . argumentCanNotBeNull ( "vertex" ) ; for ( int i = 0 ; i < propertyKeyValues . length ; i = i + 2 ) { if ( ! propertyKeyValues [ i ] . equals ( T . id ) && ! propertyKe...
This is essentially an adjusted copy&paste from TinkerPop s ElementHelper class . The reason for copying it is so that we can determine the cardinality of a property key based on Titan s schema which is tied to this particular transaction and not the graph .
21,745
public boolean hasCommonOrder ( ) { Order lastOrder = null ; for ( OrderEntry oe : list ) { if ( lastOrder == null ) lastOrder = oe . order ; else if ( lastOrder != oe . order ) return false ; } return true ; }
Whether all individual orders are the same
21,746
public synchronized Instant getStartTime ( TimestampProvider times ) { if ( startTime == null ) { startTime = times . getTime ( ) ; } return startTime ; }
Returns the start time of this marker if such has been defined or the current time if not
21,747
private static final String [ ] deduplicateKeys ( String [ ] keys ) { synchronized ( KEY_CACHE ) { KEY_HULL . setKeys ( keys ) ; KeyContainer retrieved = KEY_CACHE . get ( KEY_HULL ) ; if ( retrieved == null ) { retrieved = new KeyContainer ( keys ) ; KEY_CACHE . put ( retrieved , retrieved ) ; } return retrieved . get...
Deduplicates keys arrays to keep the memory footprint on CompactMap to a minimum .
21,748
public static StaticBuffer get ( KeyColumnValueStore store , StaticBuffer key , StaticBuffer column , StoreTransaction txh ) throws BackendException { KeySliceQuery query = new KeySliceQuery ( key , column , BufferUtil . nextBiggerBuffer ( column ) ) . setLimit ( 2 ) ; List < Entry > result = store . getSlice ( query ,...
Retrieves the value for the specified column and key under the given transaction from the store if such exists otherwise returns NULL
21,749
public static boolean containsKeyColumn ( KeyColumnValueStore store , StaticBuffer key , StaticBuffer column , StoreTransaction txh ) throws BackendException { return get ( store , key , column , txh ) != null ; }
Returns true if the specified key - column pair exists in the store .
21,750
public < O > O get ( final String key , final Class < O > datatype ) { StaticBuffer column = string2StaticBuffer ( key ) ; final KeySliceQuery query = new KeySliceQuery ( rowKey , column , BufferUtil . nextBiggerBuffer ( column ) ) ; StaticBuffer result = BackendOperation . execute ( new BackendOperation . Transactiona...
Reads the configuration property for this StoreManager
21,751
public < O > void set ( String key , O value ) { set ( key , value , null , false ) ; }
Sets a configuration property for this StoreManager .
21,752
private Map < StaticBuffer , Pair < Put , Delete > > convertToCommands ( Map < String , Map < StaticBuffer , KCVMutation > > mutations , final long putTimestamp , final long delTimestamp ) throws PermanentBackendException { Map < StaticBuffer , Pair < Put , Delete > > commandsPerKey = new HashMap < StaticBuffer , Pair ...
Convert Titan internal Mutation representation into HBase native commands .
21,753
protected void validateIndexStatus ( ) { TitanSchemaVertex schemaVertex = mgmt . getSchemaVertex ( index ) ; Set < SchemaStatus > acceptableStatuses = SchemaAction . REINDEX . getApplicableStatus ( ) ; boolean isValidIndex = true ; String invalidIndexHint ; if ( index instanceof RelationTypeIndex || ( index instanceof ...
Check that our target index is in either the ENABLED or REGISTERED state .
21,754
public void register ( String store , String key , KeyInformation information , BaseTransaction tx ) throws BackendException { if ( mode == Mode . CLOUD ) { CloudSolrClient client = ( CloudSolrClient ) solrClient ; try { createCollectionIfNotExists ( client , configuration , store ) ; } catch ( IOException e ) { throw ...
Unlike the ElasticSearch Index which is schema free Solr requires a schema to support searching . This means that you will need to modify the solr schema with the appropriate field definitions in order to work properly . If you have a running instance of Solr and you modify its schema with new fields don t forget to re...
21,755
private static boolean checkIfCollectionExists ( CloudSolrClient server , String collection ) throws KeeperException , InterruptedException { ZkStateReader zkStateReader = server . getZkStateReader ( ) ; zkStateReader . updateClusterState ( true ) ; ClusterState clusterState = zkStateReader . getClusterState ( ) ; retu...
Checks if the collection has already been created in Solr .
21,756
private static void waitForRecoveriesToFinish ( CloudSolrClient server , String collection ) throws KeeperException , InterruptedException { ZkStateReader zkStateReader = server . getZkStateReader ( ) ; try { boolean cont = true ; while ( cont ) { boolean sawLiveRecovering = false ; zkStateReader . updateClusterState (...
Wait for all the collection shards to be ready .
21,757
protected String [ ] parseCommandlineArgs ( ) throws MojoExecutionException { if ( commandlineArgs == null ) { return null ; } else { try { return CommandLineUtils . translateCommandline ( commandlineArgs ) ; } catch ( Exception e ) { throw new MojoExecutionException ( e . getMessage ( ) ) ; } } }
Parses the argument string given by the user . Strings are recognized as everything between STRING_WRAPPER . PARAMETER_DELIMITER is ignored inside a string . STRING_WRAPPER and PARAMETER_DELIMITER can be escaped using ESCAPE_CHAR .
21,758
protected void registerSourceRoots ( ) { if ( sourceRoot != null ) { getLog ( ) . info ( "Registering compile source root " + sourceRoot ) ; project . addCompileSourceRoot ( sourceRoot . toString ( ) ) ; } if ( testSourceRoot != null ) { getLog ( ) . info ( "Registering compile test source root " + testSourceRoot ) ; p...
Register compile and compile tests source roots if necessary
21,759
private void genImportCode ( ) { Set < String > imports = new HashSet < String > ( ) ; imports . add ( "java.util.*" ) ; imports . add ( "java.io.IOException" ) ; imports . add ( "java.lang.reflect.*" ) ; imports . add ( "com.baidu.bjf.remoting.protobuf.code.*" ) ; imports . add ( "com.baidu.bjf.remoting.protobuf.utils...
Gen import code .
21,760
public void reset ( ) { if ( varValuesTab == null ) { varValuesTab = new String [ mtp . varTabCnt ] ; } else { for ( int varNo = 0 ; varNo < mtp . varTabCnt ; varNo ++ ) { varValuesTab [ varNo ] = null ; } } if ( blockDynTab == null ) { blockDynTab = new BlockDynTabRec [ mtp . blockTabCnt ] ; } for ( int blockNo = 0 ; ...
Resets the MiniTemplator object to the initial state . All variable values are cleared and all added block instances are deleted . This method can be used to produce another HTML page with the same template . It is faster than creating another MiniTemplator object because the template does not have to be read and parse...
21,761
public Map < String , String > getVariables ( ) { HashMap < String , String > map = new HashMap < String , String > ( mtp . varTabCnt ) ; for ( int varNo = 0 ; varNo < mtp . varTabCnt ; varNo ++ ) map . put ( mtp . varTab [ varNo ] , varValuesTab [ varNo ] ) ; return map ; }
Returns a map with the names and current values of the template variables .
21,762
private int registerBlockInstance ( ) { int blockInstNo = blockInstTabCnt ++ ; if ( blockInstTab == null ) { blockInstTab = new BlockInstTabRec [ 64 ] ; } if ( blockInstTabCnt > blockInstTab . length ) { blockInstTab = ( BlockInstTabRec [ ] ) MiniTemplatorParser . resizeArray ( blockInstTab , 2 * blockInstTabCnt ) ; } ...
Returns the block instance number .
21,763
public void generateOutput ( String outputFileName ) throws IOException { FileOutputStream stream = null ; OutputStreamWriter writer = null ; try { stream = new FileOutputStream ( outputFileName ) ; writer = new OutputStreamWriter ( stream , charset ) ; generateOutput ( writer ) ; } finally { if ( writer != null ) { wr...
Generates the HTML page and writes it into a file .
21,764
public void generateOutput ( Writer outputWriter ) throws IOException { String s = generateOutput ( ) ; outputWriter . write ( s ) ; }
Generates the HTML page and writes it to a character stream .
21,765
public String generateOutput ( ) { if ( blockDynTab [ 0 ] . instances == 0 ) { addBlockByNo ( 0 ) ; } for ( int blockNo = 0 ; blockNo < mtp . blockTabCnt ; blockNo ++ ) { BlockDynTabRec bdtr = blockDynTab [ blockNo ] ; bdtr . currBlockInstNo = bdtr . firstBlockInstNo ; } StringBuilder out = new StringBuilder ( ) ; writ...
Generates the HTML page and returns it as a string .
21,766
private void writeBlockInstances ( StringBuilder out , int blockNo , int parentInstLevel ) { BlockDynTabRec bdtr = blockDynTab [ blockNo ] ; while ( true ) { int blockInstNo = bdtr . currBlockInstNo ; if ( blockInstNo == - 1 ) { break ; } BlockInstTabRec bitr = blockInstTab [ blockInstNo ] ; if ( bitr . parentInstLevel...
Called recursively .
21,767
private void beginMainBlock ( ) { int blockNo = registerBlock ( null ) ; BlockTabRec btr = blockTab [ blockNo ] ; btr . tPosBegin = 0 ; btr . tPosContentsBegin = 0 ; openBlocksTab [ currentNestingLevel ] = blockNo ; currentNestingLevel ++ ; }
The main block is an implicitly defined block that covers the whole template .
21,768
private void endMainBlock ( ) { BlockTabRec btr = blockTab [ 0 ] ; btr . tPosContentsEnd = templateText . length ( ) ; btr . tPosEnd = templateText . length ( ) ; btr . definitionIsOpen = false ; currentNestingLevel -- ; }
Completes the main block registration .
21,769
private boolean processTemplateCommand ( String cmdLine , int cmdTPosBegin , int cmdTPosEnd ) throws MiniTemplator . TemplateSyntaxException { int p0 = skipBlanks ( cmdLine , 0 ) ; if ( p0 >= cmdLine . length ( ) ) { return false ; } int p = skipNonBlanks ( cmdLine , p0 ) ; String cmd = cmdLine . substring ( p0 , p ) ;...
Returns false if the command should be treatet as normal template text .
21,770
private boolean processShortFormTemplateCommand ( String cmdLine , int cmdTPosBegin , int cmdTPosEnd ) throws MiniTemplator . TemplateSyntaxException { int p0 = skipBlanks ( cmdLine , 0 ) ; if ( p0 >= cmdLine . length ( ) ) { return false ; } int p = p0 ; char cmd1 = cmdLine . charAt ( p ++ ) ; if ( cmd1 == '/' && p < ...
Returns false if the command is not recognized and should be treatet as normal temlate text .
21,771
private int registerBlock ( String blockName ) { int blockNo = blockTabCnt ++ ; if ( blockTabCnt > blockTab . length ) { blockTab = ( BlockTabRec [ ] ) resizeArray ( blockTab , 2 * blockTabCnt ) ; } BlockTabRec btr = new BlockTabRec ( ) ; blockTab [ blockNo ] = btr ; btr . blockName = blockName ; if ( blockName != null...
Returns the block number of the newly registered block .
21,772
private void excludeTemplateRange ( int tPosBegin , int tPosEnd ) { if ( blockTabCnt > 0 ) { BlockTabRec btr = blockTab [ blockTabCnt - 1 ] ; if ( btr . dummy && btr . tPosEnd == tPosBegin ) { btr . tPosContentsEnd = tPosEnd ; btr . tPosEnd = tPosEnd ; return ; } } int blockNo = registerBlock ( null ) ; BlockTabRec btr...
Registers a dummy block to exclude a range within the template text .
21,773
private void checkBlockDefinitionsComplete ( ) throws MiniTemplator . TemplateSyntaxException { for ( int blockNo = 0 ; blockNo < blockTabCnt ; blockNo ++ ) { BlockTabRec btr = blockTab [ blockNo ] ; if ( btr . definitionIsOpen ) { throw new MiniTemplator . TemplateSyntaxException ( "Missing $EndBlock command in templa...
Checks that all block definitions are closed .
21,774
private boolean conditionalExclude ( int tPosBegin , int tPosEnd ) { if ( isCondEnabled ( condLevel ) ) { return false ; } excludeTemplateRange ( tPosBegin , tPosEnd ) ; return true ; }
Otherwise nothing is done and false is returned .
21,775
private boolean evaluateConditionFlags ( String flags ) { int p = 0 ; while ( true ) { p = skipBlanks ( flags , p ) ; if ( p >= flags . length ( ) ) { break ; } boolean complement = false ; if ( flags . charAt ( p ) == '!' ) { complement = true ; p ++ ; } p = skipBlanks ( flags , p ) ; if ( p >= flags . length ( ) ) { ...
Returns true the condition is met .
21,776
private void associateVariablesWithBlocks ( ) { int varRefNo = 0 ; int activeBlockNo = 0 ; int nextBlockNo = 1 ; while ( varRefNo < varRefTabCnt ) { VarRefTabRec vrtr = varRefTab [ varRefNo ] ; int varRefTPos = vrtr . tPosBegin ; int varNo = vrtr . varNo ; if ( varRefTPos >= blockTab [ activeBlockNo ] . tPosEnd ) { act...
Associates variable references with blocks .
21,777
private int registerVariable ( String varName ) { int varNo = varTabCnt ++ ; if ( varTabCnt > varTab . length ) { varTab = ( String [ ] ) resizeArray ( varTab , 2 * varTabCnt ) ; } varTab [ varNo ] = varName ; varNameToNoMap . put ( varName . toUpperCase ( ) , new Integer ( varNo ) ) ; return varNo ; }
Returns the variable number of the newly registered variable .
21,778
public int lookupVariableName ( String varName ) { Integer varNoWrapper = varNameToNoMap . get ( varName . toUpperCase ( ) ) ; if ( varNoWrapper == null ) { return - 1 ; } int varNo = varNoWrapper . intValue ( ) ; return varNo ; }
Returns - 1 if the variable name is not found .
21,779
public int lookupBlockName ( String blockName ) { Integer blockNoWrapper = blockNameToNoMap . get ( blockName . toUpperCase ( ) ) ; if ( blockNoWrapper == null ) { return - 1 ; } int blockNo = blockNoWrapper . intValue ( ) ; return blockNo ; }
Returns - 1 if the block name is not found .
21,780
protected void initEncodeMethodTemplateVariable ( ) { Set < Integer > orders = new HashSet < Integer > ( ) ; for ( FieldInfo field : fields ) { boolean isList = field . isList ( ) ; if ( ! isList ) { checkType ( field . getFieldType ( ) , field . getField ( ) ) ; } if ( orders . contains ( field . getOrder ( ) ) ) { th...
Inits the encode method template variable .
21,781
public static String getWriteValueToField ( FieldType type , String express , boolean isList ) { if ( ( type == FieldType . STRING || type == FieldType . BYTES ) && ! isList ) { String method = "copyFromUtf8" ; if ( type == FieldType . BYTES ) { method = "copyFrom" ; } return "com.google.protobuf.ByteString." + method ...
Gets the write value to field .
21,782
public static String getRequiredCheck ( int order , Field field ) { String fieldName = getFieldName ( order ) ; String code = "if (" + fieldName + "== null) {\n" ; code += "throw new UninitializedMessageException(CodedConstant.asList(\"" + field . getName ( ) + "\"))" + ClassCode . JAVA_LINE_BREAK ; code += "}\n" ; ret...
get required field check java expression .
21,783
public static String getEnumName ( Enum [ ] e , int value ) { if ( e != null ) { int toCompareValue ; for ( Enum en : e ) { if ( en instanceof EnumReadable ) { toCompareValue = ( ( EnumReadable ) en ) . value ( ) ; } else { toCompareValue = en . ordinal ( ) ; } if ( value == toCompareValue ) { return en . name ( ) ; } ...
Gets the enum name .
21,784
public static < T extends Enum < T > > T getEnumValue ( Class < T > enumType , String name ) { if ( StringUtils . isEmpty ( name ) ) { return null ; } try { T v = Enum . valueOf ( enumType , name ) ; return v ; } catch ( IllegalArgumentException e ) { return null ; } }
Gets the enumeration value .
21,785
private static List < Integer > convertList ( List < String > list ) { if ( list == null ) { return null ; } List < Integer > ret = new ArrayList < Integer > ( list . size ( ) ) ; for ( String v : list ) { ret . add ( StringUtils . toInt ( v ) ) ; } return ret ; }
Convert list .
21,786
private static boolean isStartWith ( String testString , String [ ] targetStrings ) { for ( String s : targetStrings ) { if ( testString . startsWith ( s ) ) { return true ; } } return false ; }
Checks if is start with .
21,787
private static Class getByClass ( String name ) { try { return Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( name ) ; } catch ( Throwable e ) { } return null ; }
Gets the by class .
21,788
public static < K , V > MapEntryLite < K , V > newDefaultInstance ( WireFormat . FieldType keyType , K defaultKey , WireFormat . FieldType valueType , V defaultValue ) { return new MapEntryLite < K , V > ( keyType , defaultKey , valueType , defaultValue ) ; }
Creates a default MapEntryLite message instance .
21,789
static < K , V > void writeTo ( CodedOutputStream output , Metadata < K , V > metadata , K key , V value ) throws IOException { CodedConstant . writeElement ( output , metadata . keyType , KEY_FIELD_NUMBER , key ) ; CodedConstant . writeElement ( output , metadata . valueType , VALUE_FIELD_NUMBER , value ) ; }
Write to .
21,790
static < K , V > int computeSerializedSize ( Metadata < K , V > metadata , K key , V value ) { return CodedConstant . computeElementSize ( metadata . keyType , KEY_FIELD_NUMBER , key ) + CodedConstant . computeElementSize ( metadata . valueType , VALUE_FIELD_NUMBER , value ) ; }
Compute serialized size .
21,791
@ SuppressWarnings ( "unchecked" ) static < T > T parseField ( CodedInputStream input , ExtensionRegistryLite extensionRegistry , WireFormat . FieldType type , T value ) throws IOException { switch ( type ) { case MESSAGE : int length = input . readRawVarint32 ( ) ; final int oldLimit = input . pushLimit ( length ) ; C...
Parses the field .
21,792
static < K , V > Map . Entry < K , V > parseEntry ( CodedInputStream input , Metadata < K , V > metadata , ExtensionRegistryLite extensionRegistry ) throws IOException { K key = metadata . defaultKey ; V value = metadata . defaultValue ; while ( true ) { int tag = input . readTag ( ) ; if ( tag == 0 ) { break ; } if ( ...
Parses the entry .
21,793
public IDLProxyObject newInstnace ( ) { try { Object object = cls . newInstance ( ) ; return new IDLProxyObject ( codec , object , cls ) ; } catch ( Exception e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; } }
New instnace .
21,794
private IDLProxyObject doSetFieldValue ( String fullField , String field , Object value , Object object , boolean useCache , Map < String , ReflectInfo > cachedFields ) { Field f ; if ( useCache ) { ReflectInfo info = cachedFields . get ( fullField ) ; if ( info != null ) { setField ( value , info . target , info . fie...
Do set field value .
21,795
private void setSystemProperties ( ) { if ( systemProperties != null ) { originalSystemProperties = System . getProperties ( ) ; for ( Property systemProperty : systemProperties ) { String value = systemProperty . getValue ( ) ; System . setProperty ( systemProperty . getKey ( ) , value == null ? "" : value ) ; } } }
Pass any given system properties to the java system properties .
21,796
private Artifact getExecutablePomArtifact ( Artifact executableArtifact ) { return this . artifactFactory . createBuildArtifact ( executableArtifact . getGroupId ( ) , executableArtifact . getArtifactId ( ) , executableArtifact . getVersion ( ) , "pom" ) ; }
Get the artifact which refers to the POM of the executable artifact .
21,797
private void waitFor ( long millis ) { Object lock = new Object ( ) ; synchronized ( lock ) { try { lock . wait ( millis ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; getLog ( ) . warn ( "Spuriously interrupted while waiting for " + millis + "ms" , e ) ; } } }
Stop program execution for nn millis .
21,798
private static List < Class < ? > > createMessageClass ( ProtoFile protoFile , boolean multi , boolean debug , boolean generateSouceOnly , File sourceOutputDir , List < CodeDependent > cds , Set < String > compiledClass , Set < String > enumNames , Set < String > packages , Map < String , String > mappedUniName , boole...
Creates the message class .
21,799
private static Map < String , IDLProxyObject > doCreate ( ProtoFile protoFile , boolean multi , boolean debug , File path , boolean generateSouceOnly , File sourceOutputDir , List < CodeDependent > cds , Map < String , String > uniMappedName , boolean isUniName ) throws IOException { return doCreatePro ( Arrays . asLis...
Do create .