idx
int64
0
34.9k
question
stringlengths
12
26.4k
target
stringlengths
15
2.15k
200
public boolean showJoinPartAndQuit ( ) { return preferences . getBoolean ( resources . getString ( R . string . key_show_joinpartquit ) , Boolean . parseBoolean ( resources . getString ( R . string . default_show_joinpartquit ) ) ) ; }
Process an attribute string of type T_NUMBER into a double value.
201
public void reset ( ) { lastMtd = null ; map . clear ( ) ; loadCnt . set ( 0 ) ; putCnt . set ( 0 ) ; putAllCnt . set ( 0 ) ; ts = System . currentTimeMillis ( ) ; txs . clear ( ) ; }
Attempts to create an instance of junit's ComparisonFailure exception using reflection.
202
public static Configuration load ( InputStream stream ) throws IOException { try { Properties properties = new Properties ( ) ; properties . load ( stream ) ; return from ( properties ) ; } finally { stream . close ( ) ; } }
Pop the last stylesheet pushed, and return the stylesheet that this handler is constructing, and set the last popped stylesheet member. Also pop the stylesheet locator stack.
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 ++ ] & 0xff ; rs . append ( base64_code [ c1 > > 2 & 0x3f ] ) ; c1 = ( c1 & 0x03 ) << 4 ; if ( off >= len ) { rs . append ( base64_code [ c1 & 0x3f ] ) ; break ; } c2 = d [ off ++ ] & 0xff ; c1 |= c2 > > 4 & 0x0f ; rs . append ( base64_code [ c1 & 0x3f ] ) ; c1 = ( c2 & 0x0f ) << 2 ; if ( off >= len ) { rs . append ( base64_code [ c1 & 0x3f ] ) ; break ; } c2 = d [ off ++ ] & 0xff ; c1 |= c2 > > 6 & 0x03 ; rs . append ( base64_code [ c1 & 0x3f ] ) ; rs . append ( base64_code [ c2 & 0x3f ] ) ; } return rs . toString ( ) ; }
The client failed to login. If an invalid login record exists for that client, increment the error count of that record. If that record does nor exists, create new entry.
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 ] ; } } }
Create a new MemberCellRenderer.
205
public JSONException ( Throwable cause ) { super ( cause . getMessage ( ) ) ; this . cause = cause ; }
Ensures that two paths refer to the same host.
206
public static PcRunner serializableInstance ( ) { return PcRunner . serializableInstance ( ) ; }
Post process method to correct the start and end indices of BallNodes on the right of the node where the instance was added.
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 ) ; } paint = SVGAttributeKeys . getStrokePaint ( this ) ; if ( paint != null && get ( STROKE_WIDTH ) > 0 ) { g . setPaint ( paint ) ; g . setStroke ( SVGAttributeKeys . getStroke ( this ) ) ; drawStroke ( g ) ; } if ( get ( TRANSFORM ) != null ) { g . setTransform ( savedTransform ) ; } }
Determines a basis defining a subspace described by the specified alpha values.
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 ) { _myArrayType = _myTypetag [ myTagIndex ] ; } else { if ( _myTypetag [ myTagIndex ] != _myArrayType ) { isArray = false ; } } switch ( _myTypetag [ myTagIndex ] ) { case ( 0x63 ) : myArguments [ myTagIndex ] = ( new Character ( ( char ) ( Bytes . toInt ( Bytes . copy ( theBytes , myIndex , 4 ) ) ) ) ) ; myIndex += 4 ; break ; case ( 0x69 ) : myArguments [ myTagIndex ] = ( new Integer ( Bytes . toInt ( Bytes . copy ( theBytes , myIndex , 4 ) ) ) ) ; myIndex += 4 ; break ; case ( 0x66 ) : myArguments [ myTagIndex ] = ( new Float ( Bytes . toFloat ( Bytes . copy ( theBytes , myIndex , 4 ) ) ) ) ; myIndex += 4 ; break ; case ( 0x6c ) : case ( 0x68 ) : myArguments [ myTagIndex ] = ( new Long ( Bytes . toLong ( Bytes . copy ( theBytes , myIndex , 8 ) ) ) ) ; myIndex += 8 ; break ; case ( 0x64 ) : myArguments [ myTagIndex ] = ( new Double ( Bytes . toDouble ( Bytes . copy ( theBytes , myIndex , 8 ) ) ) ) ; myIndex += 8 ; break ; case ( 0x53 ) : case ( 0x73 ) : int newIndex = myIndex ; StringBuffer stringBuffer = new StringBuffer ( ) ; stringLoop : do { if ( theBytes [ newIndex ] == 0x00 ) { break stringLoop ; } else { stringBuffer . append ( ( char ) theBytes [ newIndex ] ) ; } newIndex ++ ; } while ( newIndex < theBytes . length ) ; myArguments [ myTagIndex ] = ( stringBuffer . toString ( ) ) ; myIndex = newIndex + align ( newIndex ) ; break ; case 0x62 : int myLen = Bytes . toInt ( Bytes . copy ( theBytes , myIndex , 4 ) ) ; myIndex += 4 ; myArguments [ myTagIndex ] = Bytes . copy ( theBytes , myIndex , myLen ) ; myIndex += myLen + ( align ( myLen ) % 4 ) ; break ; case 0x6d : myArguments [ myTagIndex ] = Bytes . copy ( theBytes , myIndex , 4 ) ; myIndex += 4 ; break ; } myTagIndex ++ ; } _myData = Bytes . copy ( _myData , 0 , myIndex ) ; return myArguments ; }
close the input stream, and ignore eventual errors.
209
private boolean hasNextPostponed ( ) { return ! postponedRoutes . isEmpty ( ) ; }
Build URL encoded query
210
public static String decodeAttributeCode ( String attributeCode ) { return attributeCode . startsWith ( "+" ) ? attributeCode . substring ( 1 ) : attributeCode ; }
Creates a list of prefix and suffix decorator components
211
public boolean toBoolean ( Element el , String attributeName ) { return Caster . toBooleanValue ( el . getAttribute ( attributeName ) , false ) ; }
Add two positive numbers of different length. The second is longer.
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 . write ( VERSION_1 ) ; writer . write ( "\n" ) ; writer . write ( Integer . toString ( appVersion ) ) ; writer . write ( "\n" ) ; writer . write ( Integer . toString ( valueCount ) ) ; writer . write ( "\n" ) ; writer . write ( "\n" ) ; for ( Entry entry : lruEntries . values ( ) ) { if ( entry . currentEditor != null ) { writer . write ( DIRTY + ' ' + entry . key + '\n' ) ; } else { writer . write ( CLEAN + ' ' + entry . key + entry . getLengths ( ) + '\n' ) ; } } } finally { writer . close ( ) ; } if ( journalFile . exists ( ) ) { renameTo ( journalFile , journalFileBackup , true ) ; } renameTo ( journalFileTmp , journalFile , false ) ; journalFileBackup . delete ( ) ; journalWriter = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( journalFile , true ) , Util . US_ASCII ) ) ; }
Add a fixed view to appear at the bottom of the list. If addFooterView is called more than once, the views will appear in the order they were added. Views added using this call can take focus if they want. <p> NOTE: Call this before calling setAdapter. This is so ListView can wrap the supplied cursor with one that will also account for header and footer views.
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 ( mSecure ) ; out . writeBoolean ( mHttpOnly ) ; out . writeBoolean ( mFirstPartyOnly ) ; out . writeInt ( mPriority ) ; }
Returns all known URLs which point to the specified resource.
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 ) ; }
Handle the supplied event that signals that mysqld has stopped.
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 ) ) { needToReplaceVarInHttpHeader = true ; break ; } } if ( ! needToReplaceVarInHttpHeader ) { logger . debug ( "No need to replace. Since there are no HTTP header variables. " ) ; return ; } for ( Entry < String , String > entry : httpHeaderMap . entrySet ( ) ) { String key = entry . getKey ( ) ; String valueOriginal = entry . getValue ( ) ; String valueUpdated = NodeReqResponse . replaceStrByMap ( requestParameters , valueOriginal ) ; httpHeaderMap . put ( key , valueUpdated ) ; } }
Returns a copy of the given node or subtree with this document as its owner.
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 ( "duplicate map entry: " + name ) ; } }
thenAcceptBoth result completes exceptionally if either source cancelled
217
public Builder withTags ( Map < String , String > tags ) { this . tags = Collections . unmodifiableMap ( tags ) ; return this ; }
Class Hierarchy is: Department(name : String, employees : Array[Person]) Person(name : String, department : Department, manager : Manager) Manager(subordinates : Array[Person]) extends Person <p/> Persons can have SecurityClearance(level : Int) clearance.
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 an instance of a class using the specified ClassLoader
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 ( ) ; }
Formats the given number to the given number of decimals, and returns the number as a string, maximum 35 characters.
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 . getLongitude ( ) . radians ; if ( lat1 == lat2 && lon1 == lon2 ) return Angle . ZERO ; double dLon = lon2 - lon1 ; double dPhi = Math . log ( Math . tan ( lat2 / 2.0 + Math . PI / 4.0 ) / Math . tan ( lat1 / 2.0 + Math . PI / 4.0 ) ) ; if ( Math . abs ( dLon ) > Math . PI ) { dLon = dLon > 0 ? - ( 2 * Math . PI - dLon ) : ( 2 * Math . PI + dLon ) ; } double azimuthRadians = Math . atan2 ( dLon , dPhi ) ; return Double . isNaN ( azimuthRadians ) ? Angle . ZERO : Angle . fromRadians ( azimuthRadians ) ; }
Extract parameters from a configuration map. Keys that are on the ignoreParams list are ignored.
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" ) ; if ( columnFamilyName == null ) throw new IOException ( "You must supply a table name" ) ; if ( columnFamilyName . contains ( "." ) ) throw new IllegalArgumentException ( "Cannot take a snapshot of a secondary index by itself. Run snapshot on the table that owns the index." ) ; if ( tag == null || tag . equals ( "" ) ) throw new IOException ( "You must supply a snapshot name." ) ; Keyspace keyspace = getValidKeyspace ( keyspaceName ) ; ColumnFamilyStore columnFamilyStore = keyspace . getColumnFamilyStore ( columnFamilyName ) ; if ( columnFamilyStore . snapshotExists ( tag ) ) throw new IOException ( "Snapshot " + tag + " already exists." ) ; columnFamilyStore . snapshot ( tag ) ; }
Adds a list of deleted integers to the current action. If possible, merges integerList with the list in the previous call to this method.
222
public void clear ( ) { oredCriteria . clear ( ) ; orderByClause = null ; distinct = false ; }
Gets OS JDK string.
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>" ) ) ; newVector . addElement ( new Option ( "\tNr of arcs\n" , "A" , 1 , "-A <integer>" ) ) ; newVector . addElement ( new Option ( "\tNr of instances\n" , "M" , 1 , "-M <integer>" ) ) ; newVector . addElement ( new Option ( "\tCardinality of the variables\n" , "C" , 1 , "-C <integer>" ) ) ; newVector . addElement ( new Option ( "\tSeed for random number generator\n" , "S" , 1 , "-S <integer>" ) ) ; newVector . addElement ( new Option ( "\tThe BIF file to obtain the structure from.\n" , "F" , 1 , "-F <file>" ) ) ; return newVector . elements ( ) ; }
Load values from a Properties instance. Current values are obliterated.
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" ) ; return ; } updateStatus ( null ) ; }
Abstract method for creating a specific resource in the sub-class
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 ( context , queryRoot , scope , ( ASTBase ) child , name , value ) ; if ( child instanceof GraphPatternGroup < ? > ) { applyToGroupAndSubGroups ( context , queryRoot , scope , ( GraphPatternGroup < IGroupMemberNode > ) child , name , value ) ; } } _applyQueryHint ( context , queryRoot , scope , ( ASTBase ) group , name , value ) ; }
Create costing for client. Handles Transaction if not in a transaction
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 . standardOffsets ) && Arrays . equals ( savingsInstantTransitions , other . savingsInstantTransitions ) && Arrays . equals ( wallOffsets , other . wallOffsets ) && Arrays . equals ( lastRules , other . lastRules ) ; } return false ; }
Determine whether or not given signature denotes a reference type.
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_VALUE_FORMAT_OBJECT , key ) ) ; } int value = 0 ; if ( ! jsonObject . isNull ( key ) ) { value = jsonObject . getInt ( key ) ; } return value ; }
Needed for standard java dynamic proxy.
228
public TimeTableXYDataset ( ) { this ( TimeZone . getDefault ( ) , Locale . getDefault ( ) ) ; }
Finishes the activity when the up button is pressed on the action bar.
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 int childCount = getChildCount ( ) ; for ( int i = 0 ; i < childCount ; i ++ ) { final View child = getChildAt ( i ) ; final LayoutParams lp = ( LayoutParams ) child . getLayoutParams ( ) ; if ( ! lp . isDecor ) continue ; final int vgrav = lp . gravity & Gravity . VERTICAL_GRAVITY_MASK ; int childTop = 0 ; switch ( vgrav ) { default : childTop = paddingTop ; break ; case Gravity . TOP : childTop = paddingTop ; paddingTop += child . getHeight ( ) ; break ; case Gravity . CENTER_VERTICAL : childTop = Math . max ( ( height - child . getMeasuredHeight ( ) ) / 2 , paddingTop ) ; break ; case Gravity . BOTTOM : childTop = height - paddingBottom - child . getMeasuredHeight ( ) ; paddingBottom += child . getMeasuredHeight ( ) ; break ; } childTop += scrollY ; final int childOffset = childTop - child . getTop ( ) ; if ( childOffset != 0 ) { child . offsetTopAndBottom ( childOffset ) ; } } } else { final int scrollX = getScrollX ( ) ; int paddingLeft = getPaddingLeft ( ) ; int paddingRight = getPaddingRight ( ) ; final int width = getWidth ( ) ; final int childCount = getChildCount ( ) ; for ( int i = 0 ; i < childCount ; i ++ ) { final View child = getChildAt ( i ) ; final LayoutParams lp = ( LayoutParams ) child . getLayoutParams ( ) ; if ( ! lp . isDecor ) continue ; final int hgrav = lp . gravity & Gravity . HORIZONTAL_GRAVITY_MASK ; int childLeft = 0 ; switch ( hgrav ) { default : childLeft = paddingLeft ; break ; case Gravity . LEFT : childLeft = paddingLeft ; paddingLeft += child . getWidth ( ) ; break ; case Gravity . CENTER_HORIZONTAL : childLeft = Math . max ( ( width - child . getMeasuredWidth ( ) ) / 2 , paddingLeft ) ; break ; case Gravity . RIGHT : childLeft = width - paddingRight - child . getMeasuredWidth ( ) ; paddingRight += child . getMeasuredWidth ( ) ; break ; } childLeft += scrollX ; final int childOffset = childLeft - child . getLeft ( ) ; if ( childOffset != 0 ) { child . offsetLeftAndRight ( childOffset ) ; } } } } if ( mOnPageChangeListener != null ) { mOnPageChangeListener . onPageScrolled ( position , offset , offsetPixels ) ; } if ( mInternalPageChangeListener != null ) { mInternalPageChangeListener . onPageScrolled ( position , offset , offsetPixels ) ; } if ( mPageTransformer != null ) { final int scroll = ( mOrientation == Orientation . VERTICAL ) ? getScrollY ( ) : getScrollX ( ) ; final int childCount = getChildCount ( ) ; for ( int i = 0 ; i < childCount ; i ++ ) { final View child = getChildAt ( i ) ; final LayoutParams lp = ( LayoutParams ) child . getLayoutParams ( ) ; if ( lp . isDecor ) continue ; final float transformPos = ( float ) ( ( ( mOrientation == Orientation . VERTICAL ) ? child . getTop ( ) : child . getLeft ( ) ) - scroll ) / getClientSize ( ) ; mPageTransformer . transformPage ( child , transformPos ) ; } } mCalledSuper = true ; }
Sorts the specified array into ascending numerical order.
230
public void removeTmpStore ( IMXStore store ) { if ( null != store ) { mTmpStores . remove ( store ) ; } }
Add all the elements into the adapter if they're not already there
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 ( Annotation annotation : annotations ) { result . add ( transformToDto ( annotation ) ) ; } return result ; }
Initializing default values for tuple separator, stream expiry, rotation windows
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_table . getValueAt ( row , 2 ) ; m_Price = ( BigDecimal ) m_table . getValueAt ( row , 7 ) ; } } f_ok . setEnabled ( enabled ) ; log . fine ( "M_Product_ID=" + m_M_Product_ID + " - " + m_ProductName + " - " + m_Price ) ; }
Construct a sided plane from a pair of vectors describing points, and including origin, plus a point p which describes the side.
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 ; }
Test's same eventId being same for the Instantiators at all clients & servers
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 > ( partitioningExprs . size ( ) ) ; if ( autogenerated ) { if ( partitioningExprs . size ( ) > 1 ) { throw new AsterixException ( "Cannot autogenerate a composite primary key" ) ; } List < String > fieldName = partitioningExprs . get ( 0 ) ; IAType fieldType = recType . getSubFieldType ( fieldName ) ; partitioningExprTypes . add ( fieldType ) ; ATypeTag pkTypeTag = fieldType . getTypeTag ( ) ; if ( pkTypeTag != ATypeTag . UUID ) { throw new AsterixException ( "Cannot autogenerate a primary key for type " + pkTypeTag + ". Autogenerated primary keys must be of type " + ATypeTag . UUID + "." ) ; } } else { partitioningExprTypes = KeyFieldTypeUtils . getKeyTypes ( recType , metaRecType , partitioningExprs , keySourceIndicators ) ; for ( int fidx = 0 ; fidx < partitioningExprTypes . size ( ) ; ++ fidx ) { IAType fieldType = partitioningExprTypes . get ( fidx ) ; if ( fieldType == null ) { throw new AsterixException ( "Type not found for partitioning key " + partitioningExprs . get ( fidx ) ) ; } switch ( fieldType . getTypeTag ( ) ) { case INT8 : case INT16 : case INT32 : case INT64 : case FLOAT : case DOUBLE : case STRING : case BINARY : case DATE : case TIME : case UUID : case DATETIME : case YEARMONTHDURATION : case DAYTIMEDURATION : break ; case UNION : throw new AsterixException ( "The partitioning key " + partitioningExprs . get ( fidx ) + " cannot be nullable" ) ; default : throw new AsterixException ( "The partitioning key " + partitioningExprs . get ( fidx ) + " cannot be of type " + fieldType . getTypeTag ( ) + "." ) ; } } } return partitioningExprTypes ; }
Rolls back pending events for a particular task.
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 ) ; }
This is called from the Java Plug-in to print an Applet's contents as EPS to a postscript stream provided by the browser.
236
public void start ( ) { managedPorts . add ( createPort ( ) ) ; fixNames ( ) ; ports . addObserver ( observer , false ) ; }
Adds bytes to the buffer
237
public HessianDebugOutputStream ( OutputStream os , PrintWriter dbg ) { _os = os ; _state = new HessianDebugState ( dbg ) ; }
Adds the argument to the end of the receiver's list.
238
public Configurator fromFile ( File file ) { if ( ! file . exists ( ) ) { throw new FileNotFoundException ( file . getAbsolutePath ( ) + " does not exist." ) ; } return new Configurator ( file . getAbsolutePath ( ) , false ) ; }
Writes a String to a file creating the file if it does not exist using the default encoding for the VM.
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 == null || outputtext == null ) { throw new NullPointerException ( "Null argument" ) ; } if ( lookupText ( inputtype , outputtype , locale , voice , outputparams , style , effects , inputtext ) != null ) { return ; } String query = "INSERT INTO MARYCACHE (inputtype, outputtype, locale, voice, outputparams, style, effects, inputtext, outputtext) VALUES ('" + inputtype + "','" + outputtype + "','" + locale + "','" + voice + "','" + outputparams + "','" + style + "','" + effects + "',?,?)" ; PreparedStatement st = connection . prepareStatement ( query ) ; st . setString ( 1 , inputtext ) ; st . setString ( 2 , outputtext ) ; st . executeUpdate ( ) ; st . close ( ) ; }
this method will test the functionality of writing and reading one dictionary chunk
240
public boolean isEmpty ( ) { return true ; }
Returns a CRC of the remaining bytes in the stream.
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 ; }
get hop distance of one GeneralName from another in links where the names need not have an ancestor/descendant relationship. For example, the hop distance from ou=D,ou=C,o=B,c=US to ou=F,ou=E,ou=C,o=B,c=US is 3: D->C, C->E, E->F. The hop distance from ou=C,o=B,c=US to ou=D,ou=C,o=B,c=US is -1: C->D
242
@ Deprecated public DCCppMessage ( String s ) { setBinary ( false ) ; setRetries ( _nRetries ) ; setTimeout ( DCCppMessageTimeout ) ; myMessage = new StringBuilder ( s ) ; _nDataChars = myMessage . length ( ) ; _dataChars = new int [ _nDataChars ] ; }
Install core extensions (that the IPT is configured to use).
243
@ Override public void start ( ) throws BaleenException { }
Remove all the element from the db og this <T> instance.
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 = className ; }
Stores kth nearest elements (if there are more than one).
245
public static void flushEL ( Writer w ) { try { if ( w != null ) w . flush ( ) ; } catch ( Exception e ) { } }
Handles the deselection of all rows in the library table, disabling all necessary buttons and menu items.
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 ) insets . left + ( long ) insets . right , Integer . MAX_VALUE ) ; size . height = ( int ) Math . min ( ( long ) size . height + ( long ) insets . top + ( long ) insets . bottom , Integer . MAX_VALUE ) ; return size ; }
Get the URI as a string specification. See RFC 2396 Section 5.2.
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 + ")" ) ; } s . append ( " > " ) ; } } if ( s . length ( ) > 0 ) { TextView tv = new TextView ( getContext ( ) ) ; tv . setText ( s . substring ( 0 , s . length ( ) - 3 ) ) ; int questionFontsize = Collect . getQuestionFontsize ( ) ; tv . setTextSize ( TypedValue . COMPLEX_UNIT_DIP , questionFontsize - 4 ) ; tv . setPadding ( 0 , 0 , 0 , 5 ) ; mView . addView ( tv , mLayout ) ; } }
Used when key is put into a Map to look up the monitor
248
public static Number plus ( Number left , Character right ) { return NumberNumberPlus . plus ( left , Integer . valueOf ( right ) ) ; }
Query by HBase rowkey.
249
public void addFlag ( OptionID optionid ) { parameters . add ( new ParameterPair ( optionid , Flag . SET ) ) ; }
Creates a new dialog.
250
public static ByteBuffer toBuffer ( String spacedHex ) { return ByteBuffer . wrap ( toByteArray ( spacedHex ) ) ; }
Left pad a String with a specified string. Pad to a size of n.
251
protected void print ( char v ) throws IOException { os . write ( v ) ; }
Called when the Writer should be opened again - eg when replication replaces all of the index files.
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 . getFirstChild ( ) ; child . deleteData ( 30 , 5 ) ; childData = child . getData ( ) ; assertEquals ( "characterdataDeleteDataEndAssert" , "1230 North Ave. Dallas, Texas " , childData ) ; }
Generates the instructions for a switch statement.
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 ; }
Sorts the provided list by time, most recent first
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 = " Vinte e " + soFar . trim ( ) ; else if ( soFar . equals ( "" ) ) soFar = tensNames [ number % 10 ] + " e" + soFar ; else soFar = tensNames [ number % 10 ] + " e" + soFar ; number /= 10 ; } if ( number == 0 ) return tensNames [ number % 10 ] + soFar ; if ( number > 1 ) soFar = "s e" + soFar ; if ( number == 1 && ! soFar . equals ( "" ) ) number = 0 ; soFar = " e" + soFar ; return numNames [ number ] + " Cento" + soFar ; }
Add an associated table name into the list to clear.
255
public boolean isRefreshTokenExpired ( ) { return refreshTokenExpiresAt . before ( new Date ( ) ) ; }
Returns a list of the names in this object in document order. The returned list is backed by this object and will reflect subsequent changes. It cannot be used to modify this object. Attempts to modify the returned list will result in an exception.
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 ( ) + symbolInfo . getErrorCodewords ( ) ) ; sb . append ( codewords ) ; int blockCount = symbolInfo . getInterleavedBlockCount ( ) ; if ( blockCount == 1 ) { String ecc = createECCBlock ( codewords , symbolInfo . getErrorCodewords ( ) ) ; sb . append ( ecc ) ; } else { sb . setLength ( sb . capacity ( ) ) ; int [ ] dataSizes = new int [ blockCount ] ; int [ ] errorSizes = new int [ blockCount ] ; int [ ] startPos = new int [ blockCount ] ; for ( int i = 0 ; i < blockCount ; i ++ ) { dataSizes [ i ] = symbolInfo . getDataLengthForInterleavedBlock ( i + 1 ) ; errorSizes [ i ] = symbolInfo . getErrorLengthForInterleavedBlock ( i + 1 ) ; startPos [ i ] = 0 ; if ( i > 0 ) { startPos [ i ] = startPos [ i - 1 ] + dataSizes [ i ] ; } } for ( int block = 0 ; block < blockCount ; block ++ ) { StringBuilder temp = new StringBuilder ( dataSizes [ block ] ) ; for ( int d = block ; d < symbolInfo . getDataCapacity ( ) ; d += blockCount ) { temp . append ( codewords . charAt ( d ) ) ; } String ecc = createECCBlock ( temp . toString ( ) , errorSizes [ block ] ) ; int pos = 0 ; for ( int e = block ; e < errorSizes [ block ] * blockCount ; e += blockCount ) { sb . setCharAt ( symbolInfo . getDataCapacity ( ) + e , ecc . charAt ( pos ++ ) ) ; } } } return sb . toString ( ) ; }
Check all nodes agree to power off Work flow: Each node publishes NOTICED, then wait to see if all other nodes got the NOTICED. If true, continue to publish ACKNOWLEDGED; if false, return false immediately. Poweroff will fail. Same for ACKNOWLEDGED. After a node see others have the ACKNOWLEDGED published, it can power off. If we let the node which first succeeded to see all ACKNOWLEDGED to power off first, other nodes may fail to see the ACKNOWLEDGED signal since the 1st node is shutting down. So we defined an extra STATE.POWEROFF state, which won't check the count of control nodes. Nodes in POWEROFF state are free to poweroff.
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 ( ) + "\n\nClassifier Model\n" + m_Classifier . toString ( ) ; return result ; }
True if a CharSequence only contains whitespace characters.
258
public void addSlide ( @ NonNull Fragment fragment ) { fragments . add ( fragment ) ; if ( isWizardMode ) { setOffScreenPageLimit ( fragments . size ( ) ) ; } mPagerAdapter . notifyDataSetChanged ( ) ; }
Multiply two numbers of different length and different signs. The first is positive. The first is longer.
259
@ Bean public SpringProcessEngineConfiguration activitiProcessEngineConfiguration ( AsyncExecutor activitiAsyncExecutor ) { SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration ( ) ; configuration . setDataSource ( herdDataSource ) ; configuration . setTransactionManager ( herdTransactionManager ) ; configuration . setDatabaseSchemaUpdate ( getActivitiDbSchemaUpdateParamBeanName ( ) ) ; configuration . setAsyncExecutorActivate ( true ) ; configuration . setAsyncExecutorEnabled ( true ) ; configuration . setAsyncExecutor ( activitiAsyncExecutor ) ; configuration . setBeans ( new HashMap < > ( ) ) ; configuration . setDelegateInterceptor ( herdDelegateInterceptor ) ; configuration . setCommandInvoker ( herdCommandInvoker ) ; initScriptingEngines ( configuration ) ; configuration . setMailServerDefaultFrom ( configurationHelper . getProperty ( ConfigurationValue . ACTIVITI_DEFAULT_MAIL_FROM ) ) ; List < ProcessEngineConfigurator > herdConfigurators = new ArrayList < > ( ) ; herdConfigurators . add ( herdProcessEngineConfigurator ) ; configuration . setConfigurators ( herdConfigurators ) ; return configuration ; }
Produce a string from a double. The string "null" will be returned if the number is not finite.
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 , TimeUnit . MILLISECONDS ) ; final Iterator < AbstractTask < T > > titr = tasks . iterator ( ) ; for ( Future < ? extends Object > f : futures ) { final AbstractTask < T > task = titr . next ( ) ; getFutureForTask ( f , task , 0L , TimeUnit . NANOSECONDS ) ; } } finally { } }
Print a new content tag with no attributes, consisting of an open tag, content text, and a closing tag, all on one line.
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 ( initButtonPanel ( ) ) ; pack ( ) ; }
Test Method results in a segmentation fault
262
public void makeImmutable ( ) { if ( isMutable ) { isMutable = false ; } }
Multiple solutions where an empty solution appears in the middle of the sequence.
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 , AggregateAPIEntity > children = current . getEntityList ( ) ; if ( children . get ( tagv ) == null ) { children . put ( tagv , factory . create ( ) ) ; current . setNumDirectDescendants ( current . getNumDirectDescendants ( ) + 1 ) ; } AggregateAPIEntity child = children . get ( tagv ) ; if ( counting ) count ( child ) ; for ( String sumFunctionField : sumFunctionFields ) { sum ( child , entity , sumFunctionField ) ; } current = child ; } }
set drawable if any thing goes wrong and app don't able to display the particular its display this drawable
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 = JNIHelpers . invokeWithVarArg ( obj , methodID , argAddress , TypeReference . Double , false ) ; return Reflection . unwrapDouble ( returnObj ) ; } catch ( Throwable unexpected ) { if ( traceJNI ) unexpected . printStackTrace ( System . err ) ; env . recordException ( unexpected ) ; return 0 ; } }
Test verifies that the checksum of the buffer is being computed correctly.
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 , 6 * pV , 0 ) ; pBonus += interpolate ( ( deltaScore > 0 ) ? bM : wM , 0 , 30 * deltaScore / 100 , qV + 2 * rV + 2 * bV + 2 * nV , 0 ) ; return pBonus ; }
Adjust the column widths of a table based on the table contents.
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 ) { continue ; } Set < URI > tenantUris = _permissionsHelper . getUsageURIsFromAcls ( vcenter . getAcls ( ) ) ; if ( CollectionUtils . isEmpty ( tenantUris ) ) { continue ; } if ( ! NullColumnValueGetter . isNullURI ( tenantId ) && ! tenantUris . contains ( tenantId ) ) { continue ; } Iterator < URI > tenantUriIt = tenantUris . iterator ( ) ; while ( tenantUriIt . hasNext ( ) ) { if ( verifyAuthorizedInTenantOrg ( tenantUriIt . next ( ) ) ) { tenantVcenterList . add ( vcenter ) ; } } } return tenantVcenterList ; }
Calculates the time it should take to scroll the given distance (in pixels)
267
public void updateVisiblityValue ( int referenceIndex ) { mCachedVisibleArea = mLayoutTab . computeVisibleArea ( ) ; mCachedIndexDistance = Math . abs ( mIndex - referenceIndex ) ; mOrderSortingValue = computeOrderSortingValue ( mCachedIndexDistance , mCacheStackVisibility ) ; mVisiblitySortingValue = computeVisibilitySortingValue ( mCachedVisibleArea , mOrderSortingValue , mCacheStackVisibility ) ; }
Runs the test case.
268
public boolean contains ( EventPoint ep ) { return events . contains ( ep ) ; }
Sends the given message back in the http response.
269
public FacebookException ( String format , Object ... args ) { this ( String . format ( format , args ) ) ; }
Cancel this packet from sending
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 ( CarbonCommonConstants . DEFAULT_CHARSET ) ) ) ; } return valueList ; }
Compute new maxServiceLease and maxEventLease values. This needs to be called whenever the number of services (#S) or number of events (#E) changes, or whenever any of the configuration parameters change. The two base equations driving the computation are: #S/maxServiceLease + #E/maxEventLease <= 1/minRenewalInterval maxServiceLease/maxEventLease = minMaxServiceLease/minMaxEventLease
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" ) ; Datacenter datacenter1 = createDatacenter ( "Datacenter_1" ) ; DatacenterBroker broker = createBroker ( ) ; int brokerId = broker . getId ( ) ; vmlist = new ArrayList < Vm > ( ) ; int vmid = 0 ; int mips = 250 ; long size = 10000 ; int ram = 512 ; long bw = 1000 ; int pesNumber = 1 ; String vmm = "Xen" ; Vm vm1 = new Vm ( vmid , brokerId , mips , pesNumber , ram , bw , size , vmm , new CloudletSchedulerTimeShared ( ) ) ; vmid ++ ; Vm vm2 = new Vm ( vmid , brokerId , mips , pesNumber , ram , bw , size , vmm , new CloudletSchedulerTimeShared ( ) ) ; vmlist . add ( vm1 ) ; vmlist . add ( vm2 ) ; broker . submitVmList ( vmlist ) ; cloudletList = new ArrayList < Cloudlet > ( ) ; int id = 0 ; long length = 40000 ; long fileSize = 300 ; long outputSize = 300 ; UtilizationModel utilizationModel = new UtilizationModelFull ( ) ; Cloudlet cloudlet1 = new Cloudlet ( id , length , pesNumber , fileSize , outputSize , utilizationModel , utilizationModel , utilizationModel ) ; cloudlet1 . setUserId ( brokerId ) ; id ++ ; Cloudlet cloudlet2 = new Cloudlet ( id , length , pesNumber , fileSize , outputSize , utilizationModel , utilizationModel , utilizationModel ) ; cloudlet2 . setUserId ( brokerId ) ; cloudletList . add ( cloudlet1 ) ; cloudletList . add ( cloudlet2 ) ; broker . submitCloudletList ( cloudletList ) ; broker . bindCloudletToVm ( cloudlet1 . getCloudletId ( ) , vm1 . getId ( ) ) ; broker . bindCloudletToVm ( cloudlet2 . getCloudletId ( ) , vm2 . getId ( ) ) ; NetworkTopology . buildNetworkTopology ( "topology.brite" ) ; int briteNode = 0 ; NetworkTopology . mapNode ( datacenter0 . getId ( ) , briteNode ) ; briteNode = 2 ; NetworkTopology . mapNode ( datacenter1 . getId ( ) , briteNode ) ; briteNode = 3 ; NetworkTopology . mapNode ( broker . getId ( ) , briteNode ) ; CloudSim . startSimulation ( ) ; List < Cloudlet > newList = broker . getCloudletReceivedList ( ) ; CloudSim . stopSimulation ( ) ; printCloudletList ( newList ) ; Log . printLine ( "NetworkExample2 finished!" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; Log . printLine ( "The simulation has been terminated due to an unexpected error" ) ; } }
Returns an approximate number of words based on number of whitespace blocks.
272
private boolean isNanpaNumberWithNationalPrefix ( ) { return ( currentMetadata . getCountryCode ( ) == 1 ) && ( nationalNumber . charAt ( 0 ) == '1' ) && ( nationalNumber . charAt ( 1 ) != '0' ) && ( nationalNumber . charAt ( 1 ) != '1' ) ; }
Format this string by performing the variable replacements.
273
public static void zipFiles ( File zip , File ... files ) throws IOException { try ( BufferedOutputStream bufferedOut = new BufferedOutputStream ( new FileOutputStream ( zip ) ) ) { zipFiles ( bufferedOut , files ) ; } }
Write part of a byte string.
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 ) + GEN_END ; if ( ! pomContent . contains ( DEP_END_TAG ) ) { throw new IOException ( String . format ( "File '%s' doesn't contain '%s'. Can't process file." , CLIENT_POM , DEP_END_TAG ) ) ; } pomContent = pomContent . replace ( DEP_END_TAG , depString + DEP_END_TAG ) ; writeFileContent ( pomContent , pom ) ; }
Paints a graphical representation of the object. It just prints the format.
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 [ outputStackTop ++ ] = type ; int top = owner . inputStackTop + outputStackTop ; if ( top > owner . outputStackMax ) { owner . outputStackMax = top ; } }
This method writes data to the in buffer.
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 . put ( uri , bimg ) ; bytesize += bimg . length ; bytemapAccessQueue . addLast ( uri ) ; } addToImageCache ( uri , img ) ; }
Adds a parameters to the method invocation.
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 ; switch ( view . getPullToRefreshScrollDirection ( ) ) { case HORIZONTAL : deltaValue = deltaX ; scrollValue = scrollX ; currentScrollValue = view . getScrollX ( ) ; break ; case VERTICAL : default : deltaValue = deltaY ; scrollValue = scrollY ; currentScrollValue = view . getScrollY ( ) ; break ; } if ( view . isPullToRefreshOverScrollEnabled ( ) && ! view . isRefreshing ( ) ) { final Mode mode = view . getMode ( ) ; if ( mode . permitsPullToRefresh ( ) && ! isTouchEvent && deltaValue != 0 ) { final int newScrollValue = ( deltaValue + scrollValue ) ; if ( PullToRefreshBase . DEBUG ) { Log . d ( LOG_TAG , "OverScroll. DeltaX: " + deltaX + ", ScrollX: " + scrollX + ", DeltaY: " + deltaY + ", ScrollY: " + scrollY + ", NewY: " + newScrollValue + ", ScrollRange: " + scrollRange + ", CurrentScroll: " + currentScrollValue ) ; } if ( newScrollValue < ( 0 - fuzzyThreshold ) ) { if ( mode . showHeaderLoadingLayout ( ) ) { if ( currentScrollValue == 0 ) { view . setState ( State . OVERSCROLLING ) ; } view . setHeaderScroll ( ( int ) ( scaleFactor * ( currentScrollValue + newScrollValue ) ) ) ; } } else if ( newScrollValue > ( scrollRange + fuzzyThreshold ) ) { if ( mode . showFooterLoadingLayout ( ) ) { if ( currentScrollValue == 0 ) { view . setState ( State . OVERSCROLLING ) ; } view . setHeaderScroll ( ( int ) ( scaleFactor * ( currentScrollValue + newScrollValue - scrollRange ) ) ) ; } } else if ( Math . abs ( newScrollValue ) <= fuzzyThreshold || Math . abs ( newScrollValue - scrollRange ) <= fuzzyThreshold ) { view . setState ( State . RESET ) ; } } else if ( isTouchEvent && State . OVERSCROLLING == view . getState ( ) ) { view . setState ( State . RESET ) ; } } }
Populates fcandSafeNNZ with all <functionKey,hopID> pairs where it is safe to propagate nnz into the function.
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 = inScope . forUri ( ns . uri ) ; localName = qname . substring ( colon + 1 ) ; } return new AttribKey ( el , ns , localName ) ; }
adds a node event to the cache.
279
public void removeMapEventsListener ( MapEventsListener listener ) { if ( mapEventsListeners != null ) { mapEventsListeners . remove ( listener ) ; } }
Create a list from passed objX parameters
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 GetGeneralConfig ( ) ; GeneralConfig generalConfig = getGeneralConfig . byConigGroupAndKey ( configGroup , key ) ; if ( generalConfig . getRequired ( ) == 2 ) { restWrapper = new RestWrapper ( "Object with specified config_group and key not found" , RestWrapper . ERROR ) ; } else { restWrapper = new RestWrapper ( generalConfig , RestWrapper . OK ) ; LOGGER . info ( "Record with config group: " + configGroup + " and key:" + key + "selected from General Config by User:" + principal . getName ( ) ) ; } return restWrapper ; }
Returns a location URI from a source and table name.
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 ( ) ) ; final ColorStateList textColor = tv . getTextColors ( ) ; if ( textColor != null ) { final int enabledColor = textColor . getColorForState ( ENABLED_STATE_SET , 0 ) ; p . setColor ( enabledColor ) ; } return textColor ; }
Selects the given object in the stepping control, if the object is currently in the combo-box.
282
public void removeDiscoveryListener ( DiscoveryListener l ) { synchronized ( registrars ) { if ( terminated ) { throw new IllegalStateException ( "discovery terminated" ) ; } listeners . remove ( l ) ; } }
This method changes image scale (animating zoom for given duration), related to given center (x,y).
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 ( ) ; } }
Converts the given integer (given as String or Integer object) to a localized String version.
284
private boolean airAppTerminated ( ProcessListener pl ) { if ( pl != null ) { if ( pl . isAIRApp ( ) ) { if ( pl . isProcessDead ( ) ) { return true ; } } } return false ; }
Returns a new iterator that treats the mapped data as big-endian.
285
private int xToScreenCoords ( int mapCoord ) { return ( int ) ( mapCoord * map . getScale ( ) - map . getScrollX ( ) ) ; }
Changes the program and arguments of this process builder.
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 ; } catch ( IOException e ) { throw new ElasticsearchGenerationException ( "Failed to generate [" + filter + "]" , e ) ; } }
Copy NodeList members into this nodelist, adding in document order. Null references are not added.
287
public void connectToBeanContext ( BeanContext in_bc ) throws PropertyVetoException { if ( in_bc != null ) { in_bc . addBeanContextMembershipListener ( this ) ; beanContextChildSupport . setBeanContext ( in_bc ) ; } }
Print the matrix to the output stream. Line the elements up in columns. Use the format object, and right justify within columns of width characters. Note that is the matrix is to be read back in, you probably will want to use a NumberFormat that is set to US Locale.
288
public static CertificateID createCertId ( BigInteger subjectSerialNumber , X509Certificate issuer ) throws Exception { return new CertificateID ( createDigestCalculator ( SHA1_ID ) , new X509CertificateHolder ( issuer . getEncoded ( ) ) , subjectSerialNumber ) ; }
Generate children for specified root element from delphi node
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 < length ; i ++ ) { if ( rawData [ i ] == '<' ) { inToken = true ; if ( rawData [ i + 1 ] == 'S' && rawData [ i + 2 ] == 'p' && rawData [ i + 3 ] == 'a' && rawData [ i + 4 ] == 'c' && rawData [ i + 5 ] == 'e' ) { rawData [ ptr ] = '\t' ; ptr ++ ; } } else if ( rawData [ i ] == '>' ) { inToken = false ; } else if ( ! inToken ) { rawData [ ptr ] = rawData [ i ] ; ptr ++ ; } } final byte [ ] cleanedString = new byte [ ptr ] ; System . arraycopy ( rawData , 0 , cleanedString , 0 , ptr ) ; output_data = new StringBuffer ( new String ( cleanedString ) ) ; } else { output_data = new StringBuffer ( input ) ; } return output_data . toString ( ) ; }
Add a DropTarget to the list of potential places to receive drop events.
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 enough bytes to parse key" ) ; } }
Asserts if the provided text is part of some text, ignoring any uppercase characters
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 ( new Point ( menuBounds . left , center . y - dy ) ) ; } if ( center . y + dy < menuBounds . bottom ) { intersectPoints . add ( new Point ( menuBounds . left , center . y + dy ) ) ; } } if ( center . y - menuBounds . top < expandedRadius ) { int dx = ( int ) Math . sqrt ( Math . pow ( expandedRadius , 2 ) - Math . pow ( center . y - menuBounds . top , 2 ) ) ; if ( center . x + dx < menuBounds . right ) { intersectPoints . add ( new Point ( center . x + dx , menuBounds . top ) ) ; } if ( center . x - dx > menuBounds . left ) { intersectPoints . add ( new Point ( center . x - dx , menuBounds . top ) ) ; } } if ( menuBounds . right - center . x < expandedRadius ) { int dy = ( int ) Math . sqrt ( Math . pow ( expandedRadius , 2 ) - Math . pow ( menuBounds . right - center . x , 2 ) ) ; if ( center . y - dy > menuBounds . top ) { intersectPoints . add ( new Point ( menuBounds . right , center . y - dy ) ) ; } if ( center . y + dy < menuBounds . bottom ) { intersectPoints . add ( new Point ( menuBounds . right , center . y + dy ) ) ; } } if ( menuBounds . bottom - center . y < expandedRadius ) { int dx = ( int ) Math . sqrt ( Math . pow ( expandedRadius , 2 ) - Math . pow ( menuBounds . bottom - center . y , 2 ) ) ; if ( center . x + dx < menuBounds . right ) { intersectPoints . add ( new Point ( center . x + dx , menuBounds . bottom ) ) ; } if ( center . x - dx > menuBounds . left ) { intersectPoints . add ( new Point ( center . x - dx , menuBounds . bottom ) ) ; } } int size = intersectPoints . size ( ) ; if ( size == 0 ) { fromAngle = 0 ; toAngle = 360 ; return ; } int indexA = size - 1 ; double maxAngle = arcAngle ( center , intersectPoints . get ( 0 ) , intersectPoints . get ( indexA ) , menuBounds , expandedRadius ) ; for ( int i = 0 ; i < size - 1 ; i ++ ) { Point a = intersectPoints . get ( i ) ; Point b = intersectPoints . get ( i + 1 ) ; double angle = arcAngle ( center , a , b , menuBounds , expandedRadius ) ; Point midnormalPoint = findMidnormalPoint ( center , a , b , menuBounds , expandedRadius ) ; int pointerIndex = i ; int endIndex = indexA + 1 ; if ( ! isClockwise ( center , a , midnormalPoint ) ) { int tmpIndex = pointerIndex ; pointerIndex = endIndex ; endIndex = tmpIndex ; } if ( pointerIndex == intersectPoints . size ( ) - 1 ) { pointerIndex = 0 ; } else { pointerIndex ++ ; } if ( pointerIndex == endIndex && angle > maxAngle ) { indexA = i ; maxAngle = angle ; } } Point a = intersectPoints . get ( indexA ) ; Point b = intersectPoints . get ( indexA + 1 >= size ? 0 : indexA + 1 ) ; Point midnormalPoint = findMidnormalPoint ( center , a , b , menuBounds , expandedRadius ) ; Point x = new Point ( menuBounds . right , center . y ) ; if ( ! isClockwise ( center , a , midnormalPoint ) ) { Point tmp = a ; a = b ; b = tmp ; } fromAngle = pointAngleOnCircle ( center , a , x ) ; toAngle = pointAngleOnCircle ( center , b , x ) ; toAngle = toAngle <= fromAngle ? 360 + toAngle : toAngle ; }
Generates a title of a content String (reads fist linew which is not empty)
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 . getProcessorId ( ) ; } BucketProfileUpdateMessage m = new BucketProfileUpdateMessage ( recipients , prId , procId , bucketId , bp ) ; dm . putOutgoing ( m ) ; return rp ; }
Returns true if the two sets intersect
293
static boolean isCallerSensitive ( MemberName mem ) { if ( ! mem . isInvocable ( ) ) return false ; return mem . isCallerSensitive ( ) || canBeCalledVirtual ( mem ) ; }
Execute a Http Command with a given read Timeout
294
public void stopSearch ( ) { mMatchedNode . clear ( ) ; mQueryText . setLength ( 0 ) ; mSearchOverlay . hide ( ) ; mActive = false ; }
Stop all audio players and recorders on navigate.
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 = managedSchemaFile . getParentFile ( ) ; if ( ! parentDir . isDirectory ( ) ) { if ( ! parentDir . mkdirs ( ) ) { final String msg = "Can't create managed schema directory " + parentDir . getAbsolutePath ( ) ; log . error ( msg ) ; throw new SolrException ( ErrorCode . SERVER_ERROR , msg ) ; } } final FileOutputStream out = new FileOutputStream ( managedSchemaFile ) ; writer = new OutputStreamWriter ( out , StandardCharsets . UTF_8 ) ; persist ( writer ) ; log . info ( "Upgraded to managed schema at " + managedSchemaFile . getPath ( ) ) ; } catch ( IOException e ) { final String msg = "Error persisting managed schema " + managedSchemaFile ; log . error ( msg , e ) ; throw new SolrException ( ErrorCode . SERVER_ERROR , msg , e ) ; } finally { IOUtils . closeQuietly ( writer ) ; try { FileUtils . sync ( managedSchemaFile ) ; } catch ( IOException e ) { final String msg = "Error syncing the managed schema file " + managedSchemaFile ; log . error ( msg , e ) ; } } return true ; }
Save lyric to local app directory
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 ( "<" , ESC_LESS_THAN ) ; text = text . replace ( ">" , ESC_GREATER_THAN ) ; text = text . replace ( "" , " " ) ; return text ; }
Calculate the current burn rate, given a list of datapoints from Amazon AWS.
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 ) ) ) { return strength ; } else if ( ! attacking && Match . noneMatch ( units , Matches . unitHasDefendValueOfAtLeast ( 1 ) ) ) { return strength ; } for ( final Unit u : units ) { final UnitAttachment unitAttachment = UnitAttachment . get ( u . getType ( ) ) ; if ( unitAttachment . getIsInfrastructure ( ) ) { continue ; } else if ( unitAttachment . getIsSea ( ) == sea ) { final int unitAttack = unitAttachment . getAttack ( u . getOwner ( ) ) ; strength += 1.00F ; if ( attacking ) { strength += unitAttack * unitAttachment . getHitPoints ( ) ; } else { strength += unitAttachment . getDefense ( u . getOwner ( ) ) * unitAttachment . getHitPoints ( ) ; } if ( attacking ) { if ( unitAttack == 0 ) { strength -= 0.50F ; } } if ( unitAttack == 0 && unitAttachment . getTransportCapacity ( ) > 0 && ! transportsFirst ) { strength -= 0.50F ; } } else if ( unitAttachment . getIsAir ( ) == sea ) { strength += 1.00F ; if ( attacking ) { strength += unitAttachment . getAttack ( u . getOwner ( ) ) * unitAttachment . getAttackRolls ( u . getOwner ( ) ) ; } else { strength += unitAttachment . getDefense ( u . getOwner ( ) ) ; } } } if ( attacking && ! sea ) { final int art = Match . countMatches ( units , Matches . UnitIsArtillery ) ; final int artSupport = Match . countMatches ( units , Matches . UnitIsArtillerySupportable ) ; strength += Math . min ( art , artSupport ) ; } return strength ; }
Adds fill components to empty cells in the first row and first column of the grid. This ensures that the grid spacing will be the same as shown in the designer.
298
final public MutableString toUpperCase ( ) { int n = length ( ) ; final char [ ] a = array ; while ( n -- != 0 ) a [ n ] = Character . toUpperCase ( a [ n ] ) ; changed ( ) ; return this ; }
Check the nullability of the column definitions for the ResultSet matches the expected values.
299
@ Override public void handleMousePressed ( ChartCanvas canvas , MouseEvent e ) { this . mousePressedPoint = new Point2D . Double ( e . getX ( ) , e . getY ( ) ) ; }
this function converts between the string passed into the client property and the internal representation (currently and int)