idx int64 0 69.7k | question stringlengths 12 26.4k | target stringlengths 15 2.3k |
|---|---|---|
200 | public boolean showJoinPartAndQuit ( ) { return preferences . getBoolean ( resources . getString ( R . string . key_show_joinpartquit ) , Boolean . parseBoolean ( resources . getString ( R . string . default_show_joinpartquit ) ) ) ; } | Should join, part and quit messages be displayed? |
201 | public void reset ( ) { lastMtd = null ; map . clear ( ) ; loadCnt . set ( 0 ) ; putCnt . set ( 0 ) ; putAllCnt . set ( 0 ) ; ts = System . currentTimeMillis ( ) ; txs . clear ( ) ; } | Resets the store to initial state. |
202 | public static Configuration load ( InputStream stream ) throws IOException { try { Properties properties = new Properties ( ) ; properties . load ( stream ) ; return from ( properties ) ; } finally { stream . close ( ) ; } } | Obtain a configuration instance by loading the Properties from the supplied stream. |
203 | private static String encode_base64 ( final byte d [ ] , final int len ) throws IllegalArgumentException { int off = 0 ; final StringBuffer rs = new StringBuffer ( ) ; int c1 , c2 ; if ( len <= 0 || len > d . length ) { throw new IllegalArgumentException ( "Invalid len" ) ; } while ( off < len ) { c1 = d [ off ++ ] & 0... | Encode a byte array using bcrypt's slightly-modified base64 encoding scheme. Note that this is *not* compatible with the standard MIME-base64 encoding. |
204 | protected byte readByteProtected ( DataInputStream istream ) throws java . io . IOException { while ( true ) { int nchars ; nchars = istream . read ( rcvBuffer , 0 , 1 ) ; if ( nchars > 0 ) { return rcvBuffer [ 0 ] ; } } } | Read a single byte, protecting against various timeouts, etc. <P> When a gnu.io port is set to have a receive timeout (via the enableReceiveTimeout() method), some will return zero bytes or an EOFException at the end of the timeout. In that case, the read should be repeated to get the next real character. |
205 | public JSONException ( Throwable cause ) { super ( cause . getMessage ( ) ) ; this . cause = cause ; } | Constructs a new JSONException with the specified cause. |
206 | public static PcRunner serializableInstance ( ) { return PcRunner . serializableInstance ( ) ; } | Generates a simple exemplar of this class to test serialization. |
207 | public void drawFigure ( Graphics2D g ) { AffineTransform savedTransform = null ; if ( get ( TRANSFORM ) != null ) { savedTransform = g . getTransform ( ) ; g . transform ( get ( TRANSFORM ) ) ; } Paint paint = SVGAttributeKeys . getFillPaint ( this ) ; if ( paint != null ) { g . setPaint ( paint ) ; drawFill ( g ) ; }... | This method is invoked before the rendered image of the figure is composited. |
208 | protected Object [ ] parseArguments ( final byte [ ] theBytes ) { Object [ ] myArguments = new Object [ 0 ] ; int myTagIndex = 0 ; int myIndex = 0 ; myArguments = new Object [ _myTypetag . length ] ; isArray = ( _myTypetag . length > 0 ) ? true : false ; while ( myTagIndex < _myTypetag . length ) { if ( myTagIndex == 0... | cast the arguments passed with the incoming osc message and store them in an object array. |
209 | private boolean hasNextPostponed ( ) { return ! postponedRoutes . isEmpty ( ) ; } | Returns true if there is another postponed route to try. |
210 | public static String decodeAttributeCode ( String attributeCode ) { return attributeCode . startsWith ( "+" ) ? attributeCode . substring ( 1 ) : attributeCode ; } | Remove dynamic attribute marker (+) from attribute code (if exists) |
211 | public boolean toBoolean ( Element el , String attributeName ) { return Caster . toBooleanValue ( el . getAttribute ( attributeName ) , false ) ; } | reads a XML Element Attribute ans cast it to a boolean value |
212 | private synchronized void rebuildJournal ( ) throws IOException { if ( journalWriter != null ) { journalWriter . close ( ) ; } Writer writer = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( journalFileTmp ) , Util . US_ASCII ) ) ; try { writer . write ( MAGIC ) ; writer . write ( "\n" ) ; writer .... | Creates a new journal that omits redundant information. This replaces the current journal if it exists. |
213 | void saveToStream ( DataOutputStream out ) throws IOException { out . writeUTF ( mUrl ) ; out . writeUTF ( mName ) ; out . writeUTF ( mValue ) ; out . writeUTF ( mDomain ) ; out . writeUTF ( mPath ) ; out . writeLong ( mCreation ) ; out . writeLong ( mExpiration ) ; out . writeLong ( mLastAccess ) ; out . writeBoolean ... | Serializes for saving to disk. Does not close the stream. It is up to the caller to do so. |
214 | public boolean delete ( File f ) { if ( f . isDirectory ( ) ) { for ( File child : f . listFiles ( ) ) { if ( ! delete ( child ) ) { return ( false ) ; } } } boolean result = f . delete ( ) ; MediaScannerConnection . scanFile ( this , new String [ ] { f . getAbsolutePath ( ) } , null , null ) ; return ( result ) ; } | Recursively deletes a directory and its contents. |
215 | public static void replaceHttpHeaderMapNodeSpecific ( Map < String , String > httpHeaderMap , Map < String , String > requestParameters ) { boolean needToReplaceVarInHttpHeader = false ; for ( String parameter : requestParameters . keySet ( ) ) { if ( parameter . contains ( PcConstants . NODE_REQUEST_PREFIX_REPLACE_VAR... | !!!! ASSUMPTION: all VAR exists in HTTP Header must of type: APIVARREPLACE_NAME_PREFIX_HTTP_HEADER 20140310 This may be costly (O(n^2)) of the updated related # of headers; # of parameters in the requests. Better to only do it when there are some replacement in the request Parameters. a prefix : TOBE tested |
216 | private void mapPut ( Map map , String name , Object preference ) throws IOException { isEmpty = false ; if ( ( name . length ( ) == 0 ) || ( name == null ) ) { throw new IOException ( "no name specified in preference" + " expression" ) ; } if ( map . put ( name , preference ) != null ) { throw new IOException ( "dupli... | Insert a preference expression and value into a given map. |
217 | public Builder withTags ( Map < String , String > tags ) { this . tags = Collections . unmodifiableMap ( tags ) ; return this ; } | Add these tags to all metrics. |
218 | public static Script createMultiSigInputScript ( List < TransactionSignature > signatures ) { List < byte [ ] > sigs = new ArrayList < byte [ ] > ( signatures . size ( ) ) ; for ( TransactionSignature signature : signatures ) sigs . add ( signature . encodeToBitcoin ( ) ) ; return createMultiSigInputScriptBytes ( sigs ... | Create a program that satisfies an OP_CHECKMULTISIG program. |
219 | @ Override public Object [ ] toArray ( ) { final ArrayList < Object > out = new ArrayList < Object > ( ) ; final Iterator < IGPO > gpos = iterator ( ) ; while ( gpos . hasNext ( ) ) { out . add ( gpos . next ( ) ) ; } return out . toArray ( ) ; } | Eagerly streams materialized objects into an array |
220 | public static Angle rhumbAzimuth ( LatLon p1 , LatLon p2 ) { if ( p1 == null || p2 == null ) { throw new IllegalArgumentException ( "LatLon Is Null" ) ; } double lat1 = p1 . getLatitude ( ) . radians ; double lon1 = p1 . getLongitude ( ) . radians ; double lat2 = p2 . getLatitude ( ) . radians ; double lon2 = p2 . getL... | Computes the azimuth angle (clockwise from North) of a rhumb line (a line of constant heading) between two locations. |
221 | public void takeColumnFamilySnapshot ( String keyspaceName , String columnFamilyName , String tag ) throws IOException { if ( keyspaceName == null ) throw new IOException ( "You must supply a keyspace name" ) ; if ( operationMode == Mode . JOINING ) throw new IOException ( "Cannot snapshot until bootstrap completes" ) ... | Takes the snapshot of a specific column family. A snapshot name must be specified. |
222 | public void clear ( ) { oredCriteria . clear ( ) ; orderByClause = null ; distinct = false ; } | This method was generated by MyBatis Generator. This method corresponds to the database table iteration_object |
223 | @ Override public Enumeration < Option > listOptions ( ) { Vector < Option > newVector = new Vector < Option > ( 6 ) ; newVector . addElement ( new Option ( "\tGenerate network (instead of instances)\n" , "B" , 0 , "-B" ) ) ; newVector . addElement ( new Option ( "\tNr of nodes\n" , "N" , 1 , "-N <integer>" ) ) ; newVe... | Returns an enumeration describing the available options |
224 | private void dialogChanged ( ) { String fileName = getFilename ( ) ; String set = getSetname ( ) ; if ( ( null == fileName ) || ( fileName . length ( ) < 1 ) ) { updateStatus ( "File name must be specified" ) ; return ; } if ( ( null == set ) || ( set . length ( ) < 1 ) ) { updateStatus ( "Set name must be specified" )... | Check data entered. File name and set name must be specified. |
225 | @ SuppressWarnings ( "unchecked" ) private void applyToGroupAndSubGroups ( final AST2BOpContext context , final QueryRoot queryRoot , final QueryHintScope scope , final GraphPatternGroup < IGroupMemberNode > group , final String name , final String value ) { for ( IGroupMemberNode child : group ) { _applyQueryHint ( co... | Apply the query hint to the group and, recursively, to any sub-groups. |
226 | @ Override public boolean equals ( Object otherRules ) { if ( this == otherRules ) { return true ; } if ( otherRules instanceof ZoneRules ) { ZoneRules other = ( ZoneRules ) otherRules ; return Arrays . equals ( standardTransitions , other . standardTransitions ) && Arrays . equals ( standardOffsets , other . standardO... | Checks if this set of rules equals another. <p> Two rule sets are equal if they will always result in the same output for any given input instant or local date-time. Rules from two different groups may return false even if they are in fact the same. <p> This definition should result in implementations comparing their ... |
227 | public static int readInt ( final JSONObject jsonObject , final String key , final boolean required , final boolean notNull ) throws JSONException { if ( required ) { return jsonObject . getInt ( key ) ; } if ( notNull && jsonObject . isNull ( key ) ) { throw new JSONException ( String . format ( Locale . US , NULL_VAL... | Reads the int value from the Json Object for specified tag. |
228 | public TimeTableXYDataset ( ) { this ( TimeZone . getDefault ( ) , Locale . getDefault ( ) ) ; } | Creates a new dataset. |
229 | protected void onPageScrolled ( int position , float offset , int offsetPixels ) { if ( mDecorChildCount > 0 ) { if ( mOrientation == Orientation . VERTICAL ) { final int scrollY = getScrollY ( ) ; int paddingTop = getPaddingTop ( ) ; int paddingBottom = getPaddingBottom ( ) ; final int height = getHeight ( ) ; final i... | This method will be invoked when the current page is scrolled, either as part of a programmatically initiated smooth scroll or a user initiated touch scroll. If you override this method you must call through to the superclass implementation (e.g. super.onPageScrolled(position, offset, offsetPixels)) before onPageScrol... |
230 | public void removeTmpStore ( IMXStore store ) { if ( null != store ) { mTmpStores . remove ( store ) ; } } | Remove the dedicated store from the tmp stores list. |
231 | public static List < AnnotationDto > transformToDto ( List < Annotation > annotations ) { if ( annotations == null ) { throw new WebApplicationException ( "Null entity object cannot be converted to Dto object." , Status . INTERNAL_SERVER_ERROR ) ; } List < AnnotationDto > result = new ArrayList < > ( ) ; for ( Annotati... | Converts list of alert entity objects to list of alertDto objects. |
232 | protected void enableButtons ( ) { m_M_Product_ID = - 1 ; m_ProductName = null ; m_Price = null ; int row = m_table . getSelectedRow ( ) ; boolean enabled = row != - 1 ; if ( enabled ) { Integer ID = m_table . getSelectedRowKey ( ) ; if ( ID != null ) { m_M_Product_ID = ID . intValue ( ) ; m_ProductName = ( String ) m_... | Enable/Set Buttons and set ID |
233 | public static Matrix random ( int m , int n ) { Matrix A = new Matrix ( m , n ) ; double [ ] [ ] X = A . getArray ( ) ; for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { X [ i ] [ j ] = Math . random ( ) ; } } return A ; } | Generate matrix with random elements |
234 | public static List < IAType > validatePartitioningExpressions ( ARecordType recType , ARecordType metaRecType , List < List < String > > partitioningExprs , List < Integer > keySourceIndicators , boolean autogenerated ) throws AsterixException { List < IAType > partitioningExprTypes = new ArrayList < IAType > ( partiti... | Validates the partitioning expression that will be used to partition a dataset and returns expression type. |
235 | public static void d ( String tag , String msg , Object ... args ) { if ( sLevel > LEVEL_DEBUG ) { return ; } if ( args . length > 0 ) { msg = String . format ( msg , args ) ; } Log . d ( tag , msg ) ; } | Send a DEBUG log message |
236 | public void start ( ) { managedPorts . add ( createPort ( ) ) ; fixNames ( ) ; ports . addObserver ( observer , false ) ; } | Creates an initial port and starts to listen. |
237 | public HessianDebugOutputStream ( OutputStream os , PrintWriter dbg ) { _os = os ; _state = new HessianDebugState ( dbg ) ; } | Creates an uninitialized Hessian input stream. |
238 | public Configurator fromFile ( File file ) { if ( ! file . exists ( ) ) { throw new FileNotFoundException ( file . getAbsolutePath ( ) + " does not exist." ) ; } return new Configurator ( file . getAbsolutePath ( ) , false ) ; } | Use a file as the pdf source |
239 | public synchronized void insertText ( String inputtype , String outputtype , String locale , String voice , String outputparams , String style , String effects , String inputtext , String outputtext ) throws SQLException { if ( inputtype == null || outputtype == null || locale == null || voice == null || inputtext == n... | Insert a record of a MARY request producing data of type text into the cache. If a record with the same lookup keys (i.e., all parameters everything except outputtext) exists already, this call does nothing. |
240 | public boolean isEmpty ( ) { return true ; } | Methods that need to be implemented from GeneralTaskRunnable. |
241 | public static boolean isNumericOrPunctuationOrSymbols ( String token ) { int len = token . length ( ) ; for ( int i = 0 ; i < len ; ++ i ) { char c = token . charAt ( i ) ; if ( ! ( Character . isDigit ( c ) || Characters . isPunctuation ( c ) || Characters . isSymbol ( c ) ) ) { return false ; } } return true ; } | Returns true if a string consists entirely of numbers, punctuation, and/or symbols. |
242 | @ Deprecated public DCCppMessage ( String s ) { setBinary ( false ) ; setRetries ( _nRetries ) ; setTimeout ( DCCppMessageTimeout ) ; myMessage = new StringBuilder ( s ) ; _nDataChars = myMessage . length ( ) ; _dataChars = new int [ _nDataChars ] ; } | Create a DCCppMessage from a String containing bytes. Since DCCppMessages are text, there is no Hex-to-byte conversion |
243 | @ Override public void start ( ) throws BaleenException { } | Will not start controllers. |
244 | public ObjectInstance ( ObjectName objectName , String className ) { if ( objectName . isPattern ( ) ) { final IllegalArgumentException iae = new IllegalArgumentException ( "Invalid name->" + objectName . toString ( ) ) ; throw new RuntimeOperationsException ( iae ) ; } this . name = objectName ; this . className = cla... | Allows an object instance to be created given an object name and the full class name, including the package name. |
245 | public static void flushEL ( Writer w ) { try { if ( w != null ) w . flush ( ) ; } catch ( Exception e ) { } } | flush OutputStream without a Exception |
246 | public Dimension maximumLayoutSize ( Container target ) { Dimension size ; synchronized ( this ) { checkContainer ( target ) ; checkRequests ( ) ; size = new Dimension ( xTotal . maximum , yTotal . maximum ) ; } Insets insets = target . getInsets ( ) ; size . width = ( int ) Math . min ( ( long ) size . width + ( long ... | Returns the maximum dimensions the target container can use to lay out the components it contains. |
247 | private void addGroupText ( FormEntryCaption [ ] groups ) { StringBuilder s = new StringBuilder ( "" ) ; String t = "" ; int i ; for ( FormEntryCaption g : groups ) { i = g . getMultiplicity ( ) + 1 ; t = g . getLongText ( ) ; if ( t != null ) { s . append ( t ) ; if ( g . repeats ( ) && i > 0 ) { s . append ( " (" + i... | // * Add a TextView containing the hierarchy of groups to which the question belongs. // |
248 | public static Number plus ( Number left , Character right ) { return NumberNumberPlus . plus ( left , Integer . valueOf ( right ) ) ; } | Add a Number and a Character. The ordinal value of the Character is used in the addition (the ordinal value is the unicode value which for simple character sets is the ASCII value). |
249 | public void addFlag ( OptionID optionid ) { parameters . add ( new ParameterPair ( optionid , Flag . SET ) ) ; } | Add a flag to the parameter list |
250 | public static ByteBuffer toBuffer ( String spacedHex ) { return ByteBuffer . wrap ( toByteArray ( spacedHex ) ) ; } | Convert the spaced hex form of a String into a ByteBuffer. |
251 | protected void print ( char v ) throws IOException { os . write ( v ) ; } | Prints a char to the stream. |
252 | public void runTest ( ) throws Throwable { Document doc ; NodeList elementList ; Node nameNode ; CharacterData child ; String childData ; doc = ( Document ) load ( "hc_staff" , true ) ; elementList = doc . getElementsByTagName ( "acronym" ) ; nameNode = elementList . item ( 0 ) ; child = ( CharacterData ) nameNode . ge... | Runs the test case. |
253 | public static boolean isRightTurn ( Point p1 , Point p2 , Point p3 ) { if ( p1 . equals ( p2 ) || p2 . equals ( p3 ) ) { return false ; } double val = ( p2 . x * p3 . y + p1 . x * p2 . y + p3 . x * p1 . y ) - ( p2 . x * p1 . y + p3 . x * p2 . y + p1 . x * p3 . y ) ; return val > 0 ; } | Returns true, if the three given points make a right turn. |
254 | private String convertLessThanOneThousand ( int number ) { String soFar ; if ( number % 100 < 20 ) { soFar = numNames [ number % 100 ] ; number /= 100 ; } else { soFar = numNames [ number % 10 ] ; number /= 10 ; String s = Double . toString ( number ) ; if ( s . endsWith ( "2" ) && ! soFar . equals ( "" ) ) soFar = " V... | Convert Less Than One Thousand |
255 | public boolean isRefreshTokenExpired ( ) { return refreshTokenExpiresAt . before ( new Date ( ) ) ; } | checks if the time the refresh access token will be valid are over |
256 | public static String encodeECC200 ( String codewords , SymbolInfo symbolInfo ) { if ( codewords . length ( ) != symbolInfo . getDataCapacity ( ) ) { throw new IllegalArgumentException ( "The number of codewords does not match the selected symbol" ) ; } StringBuilder sb = new StringBuilder ( symbolInfo . getDataCapacity... | Creates the ECC200 error correction for an encoded message. |
257 | public String toString ( ) { if ( m_FilteredInstances == null ) { return "RandomizableFilteredClassifier: No model built yet." ; } String result = "RandomizableFilteredClassifier using " + getClassifierSpec ( ) + " on data filtered through " + getFilterSpec ( ) + "\n\nFiltered Header\n" + m_FilteredInstances . toString... | Output a representation of this classifier |
258 | public void addSlide ( @ NonNull Fragment fragment ) { fragments . add ( fragment ) ; if ( isWizardMode ) { setOffScreenPageLimit ( fragments . size ( ) ) ; } mPagerAdapter . notifyDataSetChanged ( ) ; } | Adds a new slide |
259 | @ Bean public SpringProcessEngineConfiguration activitiProcessEngineConfiguration ( AsyncExecutor activitiAsyncExecutor ) { SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration ( ) ; configuration . setDataSource ( herdDataSource ) ; configuration . setTransactionManager ( herdTransacti... | Gets the Activiti Process Engine Configuration. |
260 | protected < T > void runTasksConcurrent ( final List < AbstractTask < T > > tasks ) throws InterruptedException { assert resourceManager . overflowTasksConcurrent >= 0 ; try { final List < Future < T > > futures = resourceManager . getConcurrencyManager ( ) . invokeAll ( tasks , resourceManager . overflowTimeout , Time... | Runs the overflow tasks in parallel, cancelling any tasks which have not completed if we run out of time. A dedicated thread pool is allocated for this purpose. Depending on the configuration, it will be either a cached thread pool (full parallelism) or a fixed thread pool (limited parallelism). |
261 | public void initComponents ( ) { setTitle ( Bundle . getMessage ( "WindowTitle" ) ) ; Container contentPane = getContentPane ( ) ; contentPane . setLayout ( new BoxLayout ( contentPane , BoxLayout . Y_AXIS ) ) ; contentPane . add ( initAddressPanel ( ) ) ; contentPane . add ( initNotesPanel ( ) ) ; contentPane . add ( ... | Initialize the config window |
262 | public void makeImmutable ( ) { if ( isMutable ) { isMutable = false ; } } | Makes this object immutable. |
263 | public void accumulate ( TaggedLogAPIEntity entity ) throws Exception { AggregateAPIEntity current = root ; for ( String groupby : groupbys ) { String tagv = locateGroupbyField ( groupby , entity ) ; if ( tagv == null || tagv . isEmpty ( ) ) { tagv = UNASSIGNED_GROUPBY_ROOT_FIELD_NAME ; } Map < String , AggregateAPIEnt... | currently only group by tags groupbys' first item always is site, which is a reserved field |
264 | private static double CallDoubleMethodV ( JNIEnvironment env , int objJREF , int methodID , Address argAddress ) throws Exception { if ( traceJNI ) VM . sysWrite ( "JNI called: CallDoubleMethodV \n" ) ; RuntimeEntrypoints . checkJNICountDownToGC ( ) ; try { Object obj = env . getJNIRef ( objJREF ) ; Object returnObj =... | CallDoubleMethodV: invoke a virtual method that returns a double value |
265 | private final int tradeBonus ( Position pos ) { final int wM = pos . wMtrl ; final int bM = pos . bMtrl ; final int wPawn = pos . wMtrlPawns ; final int bPawn = pos . bMtrlPawns ; final int deltaScore = wM - bM ; int pBonus = 0 ; pBonus += interpolate ( ( deltaScore > 0 ) ? wPawn : bPawn , 0 , - 30 * deltaScore / 100 ,... | Implement the "when ahead trade pieces, when behind trade pawns" rule. |
266 | private List < Vcenter > filterVcentersByTenant ( List < Vcenter > vcenters , URI tenantId ) { List < Vcenter > tenantVcenterList = new ArrayList < Vcenter > ( ) ; Iterator < Vcenter > vcenterIt = vcenters . iterator ( ) ; while ( vcenterIt . hasNext ( ) ) { Vcenter vcenter = vcenterIt . next ( ) ; if ( vcenter == null... | Filters the vCenters by the tenant. If the provided tenant is null or the tenant does not share the vCenter than the vCenters are filtered with the user's tenant. |
267 | public void updateVisiblityValue ( int referenceIndex ) { mCachedVisibleArea = mLayoutTab . computeVisibleArea ( ) ; mCachedIndexDistance = Math . abs ( mIndex - referenceIndex ) ; mOrderSortingValue = computeOrderSortingValue ( mCachedIndexDistance , mCacheStackVisibility ) ; mVisiblitySortingValue = computeVisibility... | Updates the cached visible area value to be used to sort tabs by visibility. |
268 | public boolean contains ( EventPoint ep ) { return events . contains ( ep ) ; } | Determine whether event point already exists within the queue. |
269 | public FacebookException ( String format , Object ... args ) { this ( String . format ( format , args ) ) ; } | Constructs a new FacebookException. |
270 | private List < String > convertByteArrayListToStringValueList ( List < byte [ ] > dictionaryByteArrayList ) { List < String > valueList = new ArrayList < > ( dictionaryByteArrayList . size ( ) ) ; for ( byte [ ] value : dictionaryByteArrayList ) { valueList . add ( new String ( value , Charset . forName ( CarbonCommonC... | This method will convert list of byte array to list of string |
271 | public static void main ( String [ ] args ) { Log . printLine ( "Starting NetworkExample2..." ) ; try { int num_user = 1 ; Calendar calendar = Calendar . getInstance ( ) ; boolean trace_flag = false ; CloudSim . init ( num_user , calendar , trace_flag ) ; Datacenter datacenter0 = createDatacenter ( "Datacenter_0" ) ; D... | Creates main() to run this example |
272 | private boolean isNanpaNumberWithNationalPrefix ( ) { return ( currentMetadata . getCountryCode ( ) == 1 ) && ( nationalNumber . charAt ( 0 ) == '1' ) && ( nationalNumber . charAt ( 1 ) != '0' ) && ( nationalNumber . charAt ( 1 ) != '1' ) ; } | Returns true if the current country is a NANPA country and the national number begins with the national prefix. |
273 | public static void zipFiles ( File zip , File ... files ) throws IOException { try ( BufferedOutputStream bufferedOut = new BufferedOutputStream ( new FileOutputStream ( zip ) ) ) { zipFiles ( bufferedOut , files ) ; } } | Create an output ZIP stream and add each file to that stream. Directory files are added recursively. The contents of the zip are written to the given file. |
274 | protected void processClientPom ( ) throws IOException { File pom = new File ( projectRoot , CLIENT_POM ) ; String pomContent = readFileContent ( pom ) ; String depString = GEN_START + String . format ( "<dependency>%n<groupId>%s</groupId>%n<artifactId>%s</artifactId>%n</dependency>%n" , mavenGroupId , mavenArtifactId ... | Insert dependency at the end of "dependencies" section. |
275 | private void push ( final int type ) { if ( outputStack == null ) { outputStack = new int [ 10 ] ; } int n = outputStack . length ; if ( outputStackTop >= n ) { int [ ] t = new int [ Math . max ( outputStackTop + 1 , 2 * n ) ] ; System . arraycopy ( outputStack , 0 , t , 0 , n ) ; outputStack = t ; } outputStack [ outp... | Pushes a new type onto the output frame stack. |
276 | public void put ( URI uri , byte [ ] bimg , BufferedImage img ) { synchronized ( bytemap ) { while ( bytesize > 1000 * 1000 * 50 ) { URI olduri = bytemapAccessQueue . removeFirst ( ) ; byte [ ] oldbimg = bytemap . remove ( olduri ) ; bytesize -= oldbimg . length ; log ( "removed 1 img from byte cache" ) ; } bytemap . p... | Put a tile image into the cache. This puts both a buffered image and array of bytes that make up the compressed image. |
277 | public static void overScrollBy ( final PullToRefreshBase < ? > view , final int deltaX , final int scrollX , final int deltaY , final int scrollY , final int scrollRange , final int fuzzyThreshold , final float scaleFactor , final boolean isTouchEvent ) { final int deltaValue , currentScrollValue , scrollValue ; switc... | Helper method for Overscrolling that encapsulates all of the necessary function. This is the advanced version of the call. |
278 | public static AttribKey forAttribute ( Namespaces inScope , ElKey el , String qname ) { Namespaces ns ; String localName ; int colon = qname . indexOf ( ':' ) ; if ( colon < 0 ) { ns = el . ns ; localName = qname ; } else { ns = inScope . forAttrName ( el . ns , qname ) ; if ( ns == null ) { return null ; } ns = inScop... | Looks up an attribute key by qualified name. |
279 | public void removeMapEventsListener ( MapEventsListener listener ) { if ( mapEventsListeners != null ) { mapEventsListeners . remove ( listener ) ; } } | Removes map event listener from the map. |
280 | @ RequestMapping ( value = { "/{cg}/{k}" , "{cg}/{k}/" } , method = RequestMethod . GET ) @ ResponseBody public RestWrapper listUsingKey ( @ PathVariable ( "cg" ) String configGroup , @ PathVariable ( "k" ) String key , Principal principal ) { RestWrapper restWrapper = null ; GetGeneralConfig getGeneralConfig = new Get... | This method calls proc GetGenConfigProperty and fetches a record from GeneralConfig table corresponding to Config group and key passed. |
281 | private ColorStateList applyTextAppearance ( Paint p , int resId ) { TextView tv = new TextView ( mContext ) ; if ( SUtils . isApi_23_OrHigher ( ) ) { tv . setTextAppearance ( resId ) ; } else { tv . setTextAppearance ( mContext , resId ) ; } p . setTypeface ( tv . getTypeface ( ) ) ; p . setTextSize ( tv . getTextSize... | Applies the specified text appearance resource to a paint, returning the text color if one is set in the text appearance. |
282 | public void removeDiscoveryListener ( DiscoveryListener l ) { synchronized ( registrars ) { if ( terminated ) { throw new IllegalStateException ( "discovery terminated" ) ; } listeners . remove ( l ) ; } } | Indicate that a listener is no longer interested in receiving DiscoveryEvent notifications. |
283 | public static void copyFile ( File in , File out ) throws IOException { FileInputStream fis = new FileInputStream ( in ) ; FileOutputStream fos = new FileOutputStream ( out ) ; try { copyStream ( fis , fos ) ; } finally { fis . close ( ) ; fos . close ( ) ; } } | Copy a file from one place to another |
284 | private boolean airAppTerminated ( ProcessListener pl ) { if ( pl != null ) { if ( pl . isAIRApp ( ) ) { if ( pl . isProcessDead ( ) ) { return true ; } } } return false ; } | Returns true if the passed-in process listener is for an AIR application that has terminated. This is used by accept() in order to detect that it should give up listening on the socket. The reason we can't do this for Flash player-based apps is that unlike AIR apps, the process that we launched sometimes acts as just ... |
285 | private int xToScreenCoords ( int mapCoord ) { return ( int ) ( mapCoord * map . getScale ( ) - map . getScrollX ( ) ) ; } | Transforms coordinate in map coordinate system to screen coordinate system |
286 | public Alias filter ( Map < String , Object > filter ) { if ( filter == null || filter . isEmpty ( ) ) { this . filter = null ; return this ; } try { XContentBuilder builder = XContentFactory . contentBuilder ( XContentType . JSON ) ; builder . map ( filter ) ; this . filter = builder . string ( ) ; return this ; } cat... | Associates a filter to the alias |
287 | public void connectToBeanContext ( BeanContext in_bc ) throws PropertyVetoException { if ( in_bc != null ) { in_bc . addBeanContextMembershipListener ( this ) ; beanContextChildSupport . setBeanContext ( in_bc ) ; } } | Layer method to just connect to the BeanContext, without grabbing the iterator as in setBeanContext(). Good for protected sub-layers where you want to optimize the calling of the findAndInit() method over them. |
288 | public static CertificateID createCertId ( BigInteger subjectSerialNumber , X509Certificate issuer ) throws Exception { return new CertificateID ( createDigestCalculator ( SHA1_ID ) , new X509CertificateHolder ( issuer . getEncoded ( ) ) , subjectSerialNumber ) ; } | Creates a new certificate ID instance (using SHA-1 digest calculator) for the specified subject certificate serial number and issuer certificate. |
289 | public static final String convertToText ( final String input , final boolean isXMLExtraction ) { final StringBuffer output_data ; if ( isXMLExtraction ) { final byte [ ] rawData = StringUtils . toBytes ( input ) ; final int length = rawData . length ; int ptr = 0 ; boolean inToken = false ; for ( int i = 0 ; i < lengt... | Strip out XML tags and put in a tab (do not use on Chinese text) |
290 | private int parseKey ( final byte [ ] b , final int off ) throws ParseException { final int bytesToParseLen = b . length - off ; if ( bytesToParseLen >= encryptedKeyLen_ ) { encryptedKey_ = Arrays . copyOfRange ( b , off , off + encryptedKeyLen_ ) ; return encryptedKeyLen_ ; } else { throw new ParseException ( "Not eno... | Parse the key in the provided bytes. It looks for bytes of size defined by the key length in the provided bytes starting at the specified off. <p> If successful, it returns the size of the parsed bytes which is the key length. On failure, it throws a parse exception. |
291 | private void calculateIntersectPoints ( ) { intersectPoints . clear ( ) ; if ( center . x - menuBounds . left < expandedRadius ) { int dy = ( int ) Math . sqrt ( Math . pow ( expandedRadius , 2 ) - Math . pow ( center . x - menuBounds . left , 2 ) ) ; if ( center . y - dy > menuBounds . top ) { intersectPoints . add ( ... | find all intersect points, and calculate menu items display area; |
292 | public static ReplyProcessor21 send ( Set recipients , DM dm , int prId , int bucketId , BucketProfile bp , boolean requireAck ) { if ( recipients . isEmpty ( ) ) { return null ; } ReplyProcessor21 rp = null ; int procId = 0 ; if ( requireAck ) { rp = new ReplyProcessor21 ( dm , recipients ) ; procId = rp . getProcesso... | Send a profile update to a set of members. |
293 | static boolean isCallerSensitive ( MemberName mem ) { if ( ! mem . isInvocable ( ) ) return false ; return mem . isCallerSensitive ( ) || canBeCalledVirtual ( mem ) ; } | Is this method a caller-sensitive method? I.e., does it call Reflection.getCallerClass or a similer method to ask about the identity of its caller? |
294 | public void stopSearch ( ) { mMatchedNode . clear ( ) ; mQueryText . setLength ( 0 ) ; mSearchOverlay . hide ( ) ; mActive = false ; } | Stop the current search. Hides the search overlay and clears the search query. |
295 | boolean persistManagedSchema ( boolean createOnly ) { if ( loader instanceof ZkSolrResourceLoader ) { return persistManagedSchemaToZooKeeper ( createOnly ) ; } File managedSchemaFile = new File ( loader . getConfigDir ( ) , managedSchemaResourceName ) ; OutputStreamWriter writer = null ; try { File parentDir = managedS... | Persist the schema to local storage or to ZooKeeper |
296 | public static String makeXmlSafe ( String text ) { if ( StringUtil . isNullOrEmpty ( text ) ) return "" ; text = text . replace ( ESC_AMPERSAND , "&" ) ; text = text . replace ( "\"" , ESC_QUOTE ) ; text = text . replace ( "&" , ESC_AMPERSAND ) ; text = text . replace ( "'" , ESC_APOSTROPHE ) ; text = text . replace ( ... | Takes in a string, and replaces all XML special characters with the approprate escape strings. |
297 | private static float strength ( final Collection < Unit > units , final boolean attacking , final boolean sea , final boolean transportsFirst ) { float strength = 0.0F ; if ( units . isEmpty ( ) ) { return strength ; } if ( attacking && Match . noneMatch ( units , Matches . unitHasAttackValueOfAtLeast ( 1 ) ) ) { retur... | Get a quick and dirty estimate of the strength of some units in a battle. |
298 | final public MutableString toUpperCase ( ) { int n = length ( ) ; final char [ ] a = array ; while ( n -- != 0 ) a [ n ] = Character . toUpperCase ( a [ n ] ) ; changed ( ) ; return this ; } | Converts all of the characters in this mutable string to upper case using the rules of the default locale. |
299 | @ Override public void handleMousePressed ( ChartCanvas canvas , MouseEvent e ) { this . mousePressedPoint = new Point2D . Double ( e . getX ( ) , e . getY ( ) ) ; } | Handles a mouse pressed event by recording the location of the mouse pointer (so that later we can check that the click isn't part of a drag). |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.