signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class XbaseSyntacticSequencer { /** * Syntax : ' ( ' * */ @ Override protected void emit_XParenthesizedExpression_LeftParenthesisKeyword_0_a ( EObject semanticObject , ISynNavigable transition , List < INode > nodes ) { } }
Keyword kw = grammarAccess . getXParenthesizedExpressionAccess ( ) . getLeftParenthesisKeyword_0 ( ) ; if ( nodes == null ) { if ( semanticObject instanceof XIfExpression || semanticObject instanceof XTryCatchFinallyExpression ) { EObject cnt = semanticObject . eContainer ( ) ; if ( cnt instanceof XExpression && ! ( cnt instanceof XBlockExpression ) && ! ( cnt instanceof XForLoopExpression ) ) acceptUnassignedKeyword ( kw , kw . getValue ( ) , null ) ; } if ( semanticObject instanceof XConstructorCall ) { XConstructorCall call = ( XConstructorCall ) semanticObject ; if ( ! call . isExplicitConstructorCall ( ) && call . getArguments ( ) . isEmpty ( ) ) { acceptUnassignedKeyword ( kw , kw . getValue ( ) , null ) ; } } } acceptNodes ( transition , nodes ) ;
public class CreateProtectionRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CreateProtectionRequest createProtectionRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( createProtectionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createProtectionRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createProtectionRequest . getResourceArn ( ) , RESOURCEARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CommerceDiscountPersistenceImpl { /** * Returns the last commerce discount in the ordered set where groupId = & # 63 ; and couponCode = & # 63 ; . * @ param groupId the group ID * @ param couponCode the coupon code * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching commerce discount , or < code > null < / code > if a matching commerce discount could not be found */ @ Override public CommerceDiscount fetchByG_C_Last ( long groupId , String couponCode , OrderByComparator < CommerceDiscount > orderByComparator ) { } }
int count = countByG_C ( groupId , couponCode ) ; if ( count == 0 ) { return null ; } List < CommerceDiscount > list = findByG_C ( groupId , couponCode , count - 1 , count , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ;
public class AbstractLog { /** * Ensure message is not larger than requested maximum length . If message length is larger than allowed size shorten * it and append ellipsis . This method guarantee maximum length is not exceed also when ellipsis is appended . * This method returns given < code > message < / code > argument if smaller that requested maximum length or a new created * string with trailing ellipsis if larger . * @ param message message string , possible null , * @ param maxLength maximum allowed space . * @ return given < code > message < / code > argument if smaller that requested maximum length or new created string with * trailing ellipsis . */ protected static String ellipsis ( String message , int maxLength ) { } }
if ( message == null ) { return "null" ; } return message . length ( ) < maxLength ? message : message . substring ( 0 , maxLength - ELLIPSIS . length ( ) ) + ELLIPSIS ;
public class WordBasedSegment { private static void checkDateElements ( List < Vertex > linkedArray ) { } }
if ( linkedArray . size ( ) < 2 ) return ; ListIterator < Vertex > listIterator = linkedArray . listIterator ( ) ; Vertex next = listIterator . next ( ) ; Vertex current = next ; while ( listIterator . hasNext ( ) ) { next = listIterator . next ( ) ; if ( TextUtility . isAllNum ( current . realWord ) || TextUtility . isAllChineseNum ( current . realWord ) ) { // = = = = = 1 、 如果当前词是数字 , 下一个词是 “ 月 、 日 、 时 、 分 、 秒 、 月份 ” 中的一个 , 则合并且当前词词性是时间 String nextWord = next . realWord ; if ( ( nextWord . length ( ) == 1 && "月日时分秒" . contains ( nextWord ) ) || ( nextWord . length ( ) == 2 && nextWord . equals ( "月份" ) ) ) { mergeDate ( listIterator , next , current ) ; } // = = = = = 2 、 如果当前词是可以作为年份的数字 , 下一个词是 “ 年 ” , 则合并 , 词性为时间 , 否则为数字 。 else if ( nextWord . equals ( "年" ) ) { if ( TextUtility . isYearTime ( current . realWord ) ) { mergeDate ( listIterator , next , current ) ; } // = = = = = 否则当前词就是数字了 = = = = = else { current . confirmNature ( Nature . m ) ; } } else { // = = = = = 3 、 如果最后一个汉字是 " 点 " , 则认为当前数字是时间 if ( current . realWord . endsWith ( "点" ) ) { current . confirmNature ( Nature . t , true ) ; } else { char [ ] tmpCharArray = current . realWord . toCharArray ( ) ; String lastChar = String . valueOf ( tmpCharArray [ tmpCharArray . length - 1 ] ) ; // = = = = = 4 、 如果当前串最后一个汉字不是 " ∶ · . / " 和半角的 ' . ' ' / ' , 那么是数 if ( ! "∶·././" . contains ( lastChar ) ) { current . confirmNature ( Nature . m , true ) ; } // = = = = = 5 、 当前串最后一个汉字是 " ∶ · . / " 和半角的 ' . ' ' / ' , 且长度大于1 , 那么去掉最后一个字符 。 例如 " 1 . " else if ( current . realWord . length ( ) > 1 ) { char last = current . realWord . charAt ( current . realWord . length ( ) - 1 ) ; current = Vertex . newNumberInstance ( current . realWord . substring ( 0 , current . realWord . length ( ) - 1 ) ) ; listIterator . previous ( ) ; listIterator . previous ( ) ; listIterator . set ( current ) ; listIterator . next ( ) ; listIterator . add ( Vertex . newPunctuationInstance ( String . valueOf ( last ) ) ) ; } } } } current = next ; } // logger . trace ( " 日期识别后 : " + Graph . parseResult ( linkedArray ) ) ;
public class JVnSenSegmenter { /** * Segment sentences . * @ param infile the infile * @ param outfile the outfile * @ param senSegmenter the sen segmenter */ private static void senSegmentFile ( String infile , String outfile , JVnSenSegmenter senSegmenter ) { } }
try { BufferedReader in = new BufferedReader ( new InputStreamReader ( new FileInputStream ( infile ) , "UTF-8" ) ) ; BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( outfile ) , "UTF-8" ) ) ; String para = "" , line = "" , text = "" ; while ( ( line = in . readLine ( ) ) != null ) { if ( ! line . equals ( "" ) ) { if ( line . charAt ( 0 ) == '#' ) { // skip comment line text += line + "\n" ; continue ; } para = senSegmenter . senSegment ( line ) . trim ( ) ; text += para . trim ( ) + "\n\n" ; } else { // blank line text += "\n" ; } } text = text . trim ( ) ; out . write ( text ) ; out . newLine ( ) ; in . close ( ) ; out . close ( ) ; } catch ( Exception e ) { System . out . println ( "Error in sensegment file " + infile ) ; }
public class AudioCodecSettingsMarshaller { /** * Marshall the given parameter object . */ public void marshall ( AudioCodecSettings audioCodecSettings , ProtocolMarshaller protocolMarshaller ) { } }
if ( audioCodecSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( audioCodecSettings . getAacSettings ( ) , AACSETTINGS_BINDING ) ; protocolMarshaller . marshall ( audioCodecSettings . getAc3Settings ( ) , AC3SETTINGS_BINDING ) ; protocolMarshaller . marshall ( audioCodecSettings . getEac3Settings ( ) , EAC3SETTINGS_BINDING ) ; protocolMarshaller . marshall ( audioCodecSettings . getMp2Settings ( ) , MP2SETTINGS_BINDING ) ; protocolMarshaller . marshall ( audioCodecSettings . getPassThroughSettings ( ) , PASSTHROUGHSETTINGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class BigIntegerExtensions { /** * The binary < code > plus < / code > operator . * @ param a * a BigInteger . May not be < code > null < / code > . * @ param b * a BigInteger . May not be < code > null < / code > . * @ return < code > a . add ( b ) < / code > * @ throws NullPointerException * if { @ code a } or { @ code b } is < code > null < / code > . */ @ Inline ( value = "$1.add($2)" ) @ Pure public static BigInteger operator_plus ( BigInteger a , BigInteger b ) { } }
return a . add ( b ) ;
public class MHtmlEncoder { /** * Retourne une chaine encodée . * @ return String Chaine encodée * @ param s * String Chaine à encoder */ public static String encodeString ( final String s ) { } }
if ( s != null ) { final StringBuilder sb = new StringBuilder ( s . length ( ) + s . length ( ) / 4 ) ; encodeString ( sb , s ) ; return sb . toString ( ) ; } return "" ;
public class FileWatcher { /** * Remove a watcher from the list of listeners . * @ param watcher The watcher to be removed . * @ return True if the watcher was removed from the list . */ public boolean removeWatcher ( Listener watcher ) { } }
if ( watcher == null ) { throw new IllegalArgumentException ( "Null watcher removed" ) ; } synchronized ( mutex ) { AtomicBoolean removed = new AtomicBoolean ( removeFromListeners ( watchers , watcher ) ) ; watchedFiles . forEach ( ( path , suppliers ) -> { if ( removeFromListeners ( suppliers , watcher ) ) { removed . set ( true ) ; } } ) ; return removed . get ( ) ; }
public class KerasSimpleRnn { /** * Set weights for layer . * @ param weights Simple RNN weights * @ throws InvalidKerasConfigurationException Invalid Keras configuration exception */ @ Override public void setWeights ( Map < String , INDArray > weights ) throws InvalidKerasConfigurationException { } }
this . weights = new HashMap < > ( ) ; INDArray W ; if ( weights . containsKey ( conf . getKERAS_PARAM_NAME_W ( ) ) ) W = weights . get ( conf . getKERAS_PARAM_NAME_W ( ) ) ; else throw new InvalidKerasConfigurationException ( "Keras SimpleRNN layer does not contain parameter " + conf . getKERAS_PARAM_NAME_W ( ) ) ; this . weights . put ( SimpleRnnParamInitializer . WEIGHT_KEY , W ) ; INDArray RW ; if ( weights . containsKey ( conf . getKERAS_PARAM_NAME_RW ( ) ) ) RW = weights . get ( conf . getKERAS_PARAM_NAME_RW ( ) ) ; else throw new InvalidKerasConfigurationException ( "Keras SimpleRNN layer does not contain parameter " + conf . getKERAS_PARAM_NAME_RW ( ) ) ; this . weights . put ( SimpleRnnParamInitializer . RECURRENT_WEIGHT_KEY , RW ) ; INDArray b ; if ( weights . containsKey ( conf . getKERAS_PARAM_NAME_B ( ) ) ) b = weights . get ( conf . getKERAS_PARAM_NAME_B ( ) ) ; else throw new InvalidKerasConfigurationException ( "Keras SimpleRNN layer does not contain parameter " + conf . getKERAS_PARAM_NAME_B ( ) ) ; this . weights . put ( SimpleRnnParamInitializer . BIAS_KEY , b ) ; if ( weights . size ( ) > NUM_TRAINABLE_PARAMS ) { Set < String > paramNames = weights . keySet ( ) ; paramNames . remove ( conf . getKERAS_PARAM_NAME_B ( ) ) ; paramNames . remove ( conf . getKERAS_PARAM_NAME_W ( ) ) ; paramNames . remove ( conf . getKERAS_PARAM_NAME_RW ( ) ) ; String unknownParamNames = paramNames . toString ( ) ; log . warn ( "Attemping to set weights for unknown parameters: " + unknownParamNames . substring ( 1 , unknownParamNames . length ( ) - 1 ) ) ; }
public class ParameterUtil { /** * Get parameter value from a string represenation * @ param parameterClass parameter class * @ param value string value representation * @ return parameter value from string representation * @ throws Exception if string value cannot be parse */ public static Object getParameterValueFromString ( String parameterClass , String value ) throws Exception { } }
return getParameterValueFromString ( parameterClass , value , null ) ;
public class RedisClient { /** * Get the bytes representing the given serialized object . */ protected byte [ ] jsonSerialize ( Object o ) { } }
byte [ ] res = null ; try { res = JsonUtils . toJson ( o ) . getBytes ( "utf-8" ) ; } catch ( UnsupportedEncodingException e ) { logger . error ( "JsonSerialize object fail " , e ) ; } return res ;
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1026:1 : switchBlockStatementGroup : switchLabel ( blockStatement ) * ; */ public final void switchBlockStatementGroup ( ) throws RecognitionException { } }
int switchBlockStatementGroup_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 97 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1027:5 : ( switchLabel ( blockStatement ) * ) // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1027:7 : switchLabel ( blockStatement ) * { pushFollow ( FOLLOW_switchLabel_in_switchBlockStatementGroup4430 ) ; switchLabel ( ) ; state . _fsp -- ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1027:19 : ( blockStatement ) * loop129 : while ( true ) { int alt129 = 2 ; alt129 = dfa129 . predict ( input ) ; switch ( alt129 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1027:19 : blockStatement { pushFollow ( FOLLOW_blockStatement_in_switchBlockStatementGroup4432 ) ; blockStatement ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; default : break loop129 ; } } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving if ( state . backtracking > 0 ) { memoize ( input , 97 , switchBlockStatementGroup_StartIndex ) ; } }
public class AbstractQueryRunner { /** * { @ inheritDoc } */ public QueryRunnerService overrideOnce ( String operation , Object value ) { } }
this . overrider . overrideOnce ( operation , value ) ; return this ;
public class GeometryTools { /** * Gets the coordinates of two points ( that represent a bond ) and calculates * for each the coordinates of two new points that have the given distance * vertical to the bond . * @ param coords The coordinates of the two given points of the bond like this * [ point1x , point1y , point2x , point2y ] * @ param dist The vertical distance between the given points and those to * be calculated * @ return The coordinates of the calculated four points */ public static int [ ] distanceCalculator ( int [ ] coords , double dist ) { } }
double angle ; if ( ( coords [ 2 ] - coords [ 0 ] ) == 0 ) { angle = Math . PI / 2 ; } else { angle = Math . atan ( ( ( double ) coords [ 3 ] - ( double ) coords [ 1 ] ) / ( ( double ) coords [ 2 ] - ( double ) coords [ 0 ] ) ) ; } int begin1X = ( int ) ( Math . cos ( angle + Math . PI / 2 ) * dist + coords [ 0 ] ) ; int begin1Y = ( int ) ( Math . sin ( angle + Math . PI / 2 ) * dist + coords [ 1 ] ) ; int begin2X = ( int ) ( Math . cos ( angle - Math . PI / 2 ) * dist + coords [ 0 ] ) ; int begin2Y = ( int ) ( Math . sin ( angle - Math . PI / 2 ) * dist + coords [ 1 ] ) ; int end1X = ( int ) ( Math . cos ( angle - Math . PI / 2 ) * dist + coords [ 2 ] ) ; int end1Y = ( int ) ( Math . sin ( angle - Math . PI / 2 ) * dist + coords [ 3 ] ) ; int end2X = ( int ) ( Math . cos ( angle + Math . PI / 2 ) * dist + coords [ 2 ] ) ; int end2Y = ( int ) ( Math . sin ( angle + Math . PI / 2 ) * dist + coords [ 3 ] ) ; return new int [ ] { begin1X , begin1Y , begin2X , begin2Y , end1X , end1Y , end2X , end2Y } ;
public class PaginationAction { /** * Convenience method to retrieve an amount of entities from this pagination action . * < br > This also includes already cached entities similar to { @ link # forEachAsync ( Procedure ) } . * @ param amount * The maximum amount to retrieve * @ return { @ link net . dv8tion . jda . core . requests . RequestFuture RequestFuture } - Type : { @ link java . util . List List } * @ see # forEachAsync ( Procedure ) */ public RequestFuture < List < T > > takeAsync ( int amount ) { } }
return takeAsync0 ( amount , ( task , list ) -> forEachAsync ( val -> { list . add ( val ) ; return list . size ( ) < amount ; } , task :: completeExceptionally ) ) ;
public class DistanceStatisticsWithClasses { /** * Compute the exact maximum and minimum . * @ param relation Relation to process * @ param distFunc Distance function * @ return Exact maximum and minimum */ private DoubleMinMax exactMinMax ( Relation < O > relation , DistanceQuery < O > distFunc ) { } }
final FiniteProgress progress = LOG . isVerbose ( ) ? new FiniteProgress ( "Exact fitting distance computations" , relation . size ( ) , LOG ) : null ; DoubleMinMax minmax = new DoubleMinMax ( ) ; // find exact minimum and maximum first . for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { for ( DBIDIter iditer2 = relation . iterDBIDs ( ) ; iditer2 . valid ( ) ; iditer2 . advance ( ) ) { // skip the point itself . if ( DBIDUtil . equal ( iditer , iditer2 ) ) { continue ; } double d = distFunc . distance ( iditer , iditer2 ) ; minmax . put ( d ) ; } LOG . incrementProcessed ( progress ) ; } LOG . ensureCompleted ( progress ) ; return minmax ;
public class Form { /** * Returns the page object received as response to the form submit action . */ @ SuppressWarnings ( "unchecked" ) private < T extends Resource > T submit ( Form form , Parameters parameters ) { } }
RequestBuilder < Resource > request = doRequest ( form . getUri ( ) ) . set ( parameters ) ; boolean doPost = form . isDoPost ( ) ; boolean multiPart = form . isMultiPart ( ) ; if ( doPost && multiPart ) { request . multiPart ( ) ; addFiles ( request , form ) ; } return ( T ) ( doPost ? request . post ( ) : request . get ( ) ) ;
public class SourceIterator { /** * Returns the next token from the enclosed Source . * The EOF token is never returned by the iterator . * @ throws IllegalStateException if the Source * throws a LexerException or IOException */ @ Override public Token next ( ) { } }
if ( ! hasNext ( ) ) throw new NoSuchElementException ( ) ; Token t = this . tok ; this . tok = null ; return t ;
public class Product { /** * Gets the productType value for this Product . * @ return productType * The type of { @ code Product } . This will always be { @ link ProductType # DFP } * for programmatic * guaranteed products . * < span class = " constraint ReadOnly " > This attribute is * read - only when : < ul > < li > using programmatic guaranteed , using sales * management . < / li > < li > not using programmatic , using sales management . < / li > < / ul > < / span > */ public com . google . api . ads . admanager . axis . v201805 . ProductType getProductType ( ) { } }
return productType ;
public class Simple1DOFCamera { /** * Unproject a screen coordinate ( at depth 0 ) to 3D model coordinates . * @ param x X * @ param y Y * @ param z Z * @ return model coordinates */ public double [ ] unproject ( double x , double y , double z ) { } }
double [ ] out = new double [ 3 ] ; unproject ( x , y , z , out ) ; return out ;
public class CPDefinitionGroupedEntryUtil { /** * Returns a range of all the cp definition grouped entries where CPDefinitionId = & # 63 ; . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CPDefinitionGroupedEntryModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order . * @ param CPDefinitionId the cp definition ID * @ param start the lower bound of the range of cp definition grouped entries * @ param end the upper bound of the range of cp definition grouped entries ( not inclusive ) * @ return the range of matching cp definition grouped entries */ public static List < CPDefinitionGroupedEntry > findByCPDefinitionId ( long CPDefinitionId , int start , int end ) { } }
return getPersistence ( ) . findByCPDefinitionId ( CPDefinitionId , start , end ) ;
public class TileSetInfo100 { @ Override protected void parse ( Node node ) { } }
NamedNodeMap attributes = node . getAttributes ( ) ; order = getValueRecursiveAsInteger ( attributes . getNamedItem ( "order" ) ) ; unitsPerPixel = getValueRecursiveAsDouble ( attributes . getNamedItem ( "units-per-pixel" ) ) ; href = getValueRecursive ( attributes . getNamedItem ( "href" ) ) ; setParsed ( true ) ;
public class AdamicAdar { /** * Implementation notes : * The requirement that " K extends CopyableValue < K > " can be removed when * Flink has a self - join which performs the skew distribution handled by * GenerateGroupSpans / GenerateGroups / GenerateGroupPairs . */ @ Override public DataSet < Result < K > > runInternal ( Graph < K , VV , EV > input ) throws Exception { } }
// s , d ( s ) , 1 / log ( d ( s ) ) DataSet < Tuple3 < K , LongValue , FloatValue > > inverseLogDegree = input . run ( new VertexDegree < K , VV , EV > ( ) . setParallelism ( parallelism ) ) . map ( new VertexInverseLogDegree < > ( ) ) . setParallelism ( parallelism ) . name ( "Vertex score" ) ; // s , t , 1 / log ( d ( s ) ) DataSet < Tuple3 < K , K , FloatValue > > sourceInverseLogDegree = input . getEdges ( ) . join ( inverseLogDegree , JoinHint . REPARTITION_HASH_SECOND ) . where ( 0 ) . equalTo ( 0 ) . projectFirst ( 0 , 1 ) . < Tuple3 < K , K , FloatValue > > projectSecond ( 2 ) . setParallelism ( parallelism ) . name ( "Edge score" ) ; // group span , s , t , 1 / log ( d ( s ) ) DataSet < Tuple4 < IntValue , K , K , FloatValue > > groupSpans = sourceInverseLogDegree . groupBy ( 0 ) . sortGroup ( 1 , Order . ASCENDING ) . reduceGroup ( new GenerateGroupSpans < > ( ) ) . setParallelism ( parallelism ) . name ( "Generate group spans" ) ; // group , s , t , 1 / log ( d ( s ) ) DataSet < Tuple4 < IntValue , K , K , FloatValue > > groups = groupSpans . rebalance ( ) . setParallelism ( parallelism ) . name ( "Rebalance" ) . flatMap ( new GenerateGroups < > ( ) ) . setParallelism ( parallelism ) . name ( "Generate groups" ) ; // t , u , 1 / log ( d ( s ) ) where ( s , t ) and ( s , u ) are edges in graph DataSet < Tuple3 < K , K , FloatValue > > twoPaths = groups . groupBy ( 0 , 1 ) . sortGroup ( 2 , Order . ASCENDING ) . reduceGroup ( new GenerateGroupPairs < > ( ) ) . name ( "Generate group pairs" ) ; // t , u , adamic - adar score GroupReduceOperator < Tuple3 < K , K , FloatValue > , Result < K > > scores = twoPaths . groupBy ( 0 , 1 ) . reduceGroup ( new ComputeScores < > ( minimumScore , minimumRatio ) ) . name ( "Compute scores" ) ; if ( minimumRatio > 0.0f ) { // total score , number of pairs of neighbors DataSet < Tuple2 < FloatValue , LongValue > > sumOfScoresAndNumberOfNeighborPairs = inverseLogDegree . map ( new ComputeScoreFromVertex < > ( ) ) . setParallelism ( parallelism ) . name ( "Average score" ) . sum ( 0 ) . andSum ( 1 ) ; scores . withBroadcastSet ( sumOfScoresAndNumberOfNeighborPairs , SUM_OF_SCORES_AND_NUMBER_OF_NEIGHBOR_PAIRS ) ; } if ( mirrorResults ) { return scores . flatMap ( new MirrorResult < > ( ) ) . name ( "Mirror results" ) ; } else { return scores ; }
public class Solo { /** * Returns a localized String matching the specified resource id . * @ param id the R . id of the String * @ return the localized String */ public String getString ( int id ) { } }
if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "getString(" + id + ")" ) ; } return getter . getString ( id ) ;
public class FeatureScopes { /** * Creates a scope for the static features that are exposed by a type that was used , e . g . * { @ code java . lang . String . valueOf ( 1 ) } where { @ code valueOf ( 1 ) } is to be linked . * @ param featureCall the feature call that is currently processed by the scoping infrastructure * @ param receiver an optionally available receiver expression * @ param receiverType the type of the receiver . It may be available even if the receiver itself is null , which indicates an implicit receiver . * @ param receiverBucket the types that contribute the static features . * @ param parent the parent scope . Is never null . * @ param session the currently known scope session . Is never null . */ protected IScope createStaticFeatureOnTypeLiteralScope ( EObject featureCall , XExpression receiver , LightweightTypeReference receiverType , TypeBucket receiverBucket , IScope parent , IFeatureScopeSession session ) { } }
return new StaticFeatureOnTypeLiteralScope ( parent , session , asAbstractFeatureCall ( featureCall ) , receiver , receiverType , receiverBucket , operatorMapping ) ;
public class IabHelper { /** * Asynchronous wrapper for inventory query . This will perform an inventory * query as described in { @ link # queryInventory } , but will do so asynchronously * and call back the specified listener upon completion . This method is safe to * call from a UI thread . * @ param querySkuDetails as in { @ link # queryInventory } * @ param moreSkus as in { @ link # queryInventory } * @ param listener The listener to notify when the refresh operation completes . */ public void queryInventoryAsync ( final boolean querySkuDetails , final List < String > moreSkus , final QueryInventoryFinishedListener listener ) { } }
final Handler handler = new Handler ( ) ; checkNotDisposed ( ) ; checkSetupDone ( "queryInventory" ) ; flagStartAsync ( "refresh inventory" ) ; ( new Thread ( new Runnable ( ) { public void run ( ) { IabResult result = new IabResult ( BILLING_RESPONSE_RESULT_OK , "Inventory refresh successful." ) ; Inventory inv = null ; try { inv = queryInventory ( querySkuDetails , moreSkus ) ; } catch ( IabException ex ) { result = ex . getResult ( ) ; } flagEndAsync ( ) ; final IabResult result_f = result ; final Inventory inv_f = inv ; if ( ! mDisposed && listener != null ) { handler . post ( new Runnable ( ) { public void run ( ) { listener . onQueryInventoryFinished ( result_f , inv_f ) ; } } ) ; } } } ) ) . start ( ) ;
public class Cron4jJob { public synchronized void registerNeighborConcurrent ( String groupName , NeighborConcurrentGroup neighborConcurrentGroup ) { } }
verifyCanScheduleState ( ) ; if ( neighborConcurrentGroupMap == null ) { neighborConcurrentGroupMap = new ConcurrentHashMap < String , NeighborConcurrentGroup > ( ) ; // just in case neighborConcurrentGroupList = new CopyOnWriteArrayList < NeighborConcurrentGroup > ( ) ; // just in case } neighborConcurrentGroupMap . put ( groupName , neighborConcurrentGroup ) ; neighborConcurrentGroupList . add ( neighborConcurrentGroup ) ;
public class AdminSearchlogAction { @ Execute public HtmlResponse details ( final int crudMode , final String logType , final String id ) { } }
verifyCrudMode ( crudMode , CrudMode . DETAILS ) ; saveToken ( ) ; return asDetailsHtml ( ) . useForm ( EditForm . class , op -> { op . setup ( form -> { form . id = id ; form . logType = logType ; form . crudMode = crudMode ; } ) ; } ) . renderWith ( data -> { RenderDataUtil . register ( data , "logParamItems" , searchLogService . getSearchLogMap ( logType , id ) ) ; } ) ;
public class BaseJsonBo { /** * Get a sub - attribute using d - path . * @ param attrName * @ param dPath * @ return * @ see DPathUtils */ public JsonNode getSubAttr ( String attrName , String dPath ) { } }
Lock lock = lockForRead ( ) ; try { return JacksonUtils . getValue ( getAttribute ( attrName ) , dPath ) ; } finally { lock . unlock ( ) ; }
public class CSSDeclaration { /** * Set the property of this CSS value ( e . g . < code > background - color < / code > ) . * @ param sProperty * The CSS property name to set . May neither be < code > null < / code > nor * empty . The property value is automatically lowercased ! * @ return this * @ since 3.7.4 */ @ Nonnull public CSSDeclaration setProperty ( @ Nonnull @ Nonempty final String sProperty ) { } }
ValueEnforcer . notEmpty ( sProperty , "Property" ) ; m_sProperty = _unifyProperty ( sProperty ) ; return this ;
public class Graphics { /** * Sets the diffuse color for No . i light . */ public void setLightDiffuse ( int i , Color color ) { } }
float [ ] tmpColor = { ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) color . getAlpha ( ) } ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_DIFFUSE , tmpColor , 0 ) ;
public class XMLMapHandler { /** * Read a mapping from the passed input stream . * @ param aIS * The input stream to read from . May not be < code > null < / code > . * @ param aTargetMap * The target map to be filled . * @ return { @ link ESuccess # SUCCESS } if the stream could be opened , if it could * be read as XML and if the root element was correct . * { @ link ESuccess # FAILURE } otherwise . */ @ Nonnull public static ESuccess readMap ( @ Nonnull @ WillClose final InputStream aIS , @ Nonnull final Map < String , String > aTargetMap ) { } }
ValueEnforcer . notNull ( aIS , "InputStream" ) ; ValueEnforcer . notNull ( aTargetMap , "TargetMap" ) ; try ( final InputStream aCloseMe = aIS ) { // open file final IMicroDocument aDoc = MicroReader . readMicroXML ( aIS ) ; if ( aDoc != null ) { readMap ( aDoc . getDocumentElement ( ) , aTargetMap ) ; return ESuccess . SUCCESS ; } } catch ( final Exception ex ) { if ( LOGGER . isWarnEnabled ( ) ) LOGGER . warn ( "Failed to read mapping resource '" + aIS + "'" , ex ) ; } return ESuccess . FAILURE ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EEnum getIfcCableSegmentTypeEnum ( ) { } }
if ( ifcCableSegmentTypeEnumEEnum == null ) { ifcCableSegmentTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 931 ) ; } return ifcCableSegmentTypeEnumEEnum ;
public class UtlInvBase { /** * < p > Makes invoice totals include taxes lines * cause line inserted / changed / deleted . < / p > * @ param < T > invoice type * @ param < L > invoice line type * @ param < TL > invoice tax line type * @ param pReqVars request scoped vars * @ param pLine affected line * @ param pAs Accounting Settings * @ param pTxRules NULL if not taxable * @ param pInvTxMeth tax method code / data for purchase / sales invoice * @ throws Exception - an exception . */ public final < T extends IInvoice , L extends IInvoiceLine < T > , TL extends AInvTxLn < T > > void makeTotals ( final Map < String , Object > pReqVars , final L pLine , final AccSettings pAs , final TaxDestination pTxRules , final IInvTxMeth < T , TL > pInvTxMeth ) throws Exception { } }
// all tax lines will be redone : pReqVars . put ( pInvTxMeth . getInvTxLnCl ( ) . getSimpleName ( ) + "itsOwnerdeepLevel" , 1 ) ; List < TL > invTxLns = getSrvOrm ( ) . retrieveListWithConditions ( pReqVars , pInvTxMeth . getInvTxLnCl ( ) , "where ITSOWNER=" + pLine . getItsOwner ( ) . getItsId ( ) ) ; pReqVars . remove ( pInvTxMeth . getInvTxLnCl ( ) . getSimpleName ( ) + "itsOwnerdeepLevel" ) ; for ( TL tl : invTxLns ) { tl . setTax ( null ) ; tl . setTaxableInvBas ( BigDecimal . ZERO ) ; tl . setTaxableInvBasFc ( BigDecimal . ZERO ) ; tl . setItsTotal ( BigDecimal . ZERO ) ; tl . setForeignTotalTaxes ( BigDecimal . ZERO ) ; } if ( pTxRules != null ) { DataTx dtTx = retrieveDataTx ( pReqVars , pLine , pAs , pTxRules , pInvTxMeth ) ; if ( ! pTxRules . getSalTaxUseAggregItBas ( ) && ! ( pTxRules . getSalTaxIsInvoiceBase ( ) && pLine . getItsOwner ( ) . getPriceIncTax ( ) ) ) { // non - aggregate except invoice basis with included taxes : for ( int i = 0 ; i < dtTx . getTxs ( ) . size ( ) ; i ++ ) { TL tl = findCreateTaxLine ( pReqVars , pLine . getItsOwner ( ) , invTxLns , dtTx . getTxs ( ) . get ( i ) , false , pInvTxMeth . getFctInvTxLn ( ) ) ; Double txTotd ; Double txTotdFc = 0.0 ; if ( ! pTxRules . getSalTaxIsInvoiceBase ( ) ) { // item basis , taxes excluded / included : txTotd = dtTx . getTxTotTaxb ( ) . get ( i ) ; txTotdFc = dtTx . getTxTotTaxbFc ( ) . get ( i ) ; } else { // invoice basis , taxes excluded : txTotd = dtTx . getTxTotTaxb ( ) . get ( i ) * dtTx . getTxPerc ( ) . get ( i ) / 100.0 ; tl . setTaxableInvBas ( BigDecimal . valueOf ( dtTx . getTxTotTaxb ( ) . get ( i ) ) ) ; if ( pLine . getItsOwner ( ) . getForeignCurrency ( ) != null ) { txTotdFc = dtTx . getTxTotTaxbFc ( ) . get ( i ) * dtTx . getTxPerc ( ) . get ( i ) / 100.0 ; tl . setTaxableInvBasFc ( BigDecimal . valueOf ( dtTx . getTxTotTaxbFc ( ) . get ( i ) ) ) ; } } tl . setItsTotal ( BigDecimal . valueOf ( txTotd ) . setScale ( pAs . getPricePrecision ( ) , pTxRules . getSalTaxRoundMode ( ) ) ) ; tl . setForeignTotalTaxes ( BigDecimal . valueOf ( txTotdFc ) . setScale ( pAs . getPricePrecision ( ) , pTxRules . getSalTaxRoundMode ( ) ) ) ; if ( tl . getIsNew ( ) ) { getSrvOrm ( ) . insertEntity ( pReqVars , tl ) ; tl . setIsNew ( false ) ; } else { getSrvOrm ( ) . updateEntity ( pReqVars , tl ) ; } } } else { // non - aggregate invoice basis with included taxes // and aggregate for others : BigDecimal bd100 = new BigDecimal ( "100.00" ) ; Comparator < InvItemTaxCategoryLine > cmpr = Collections . reverseOrder ( new CmprTaxCatLnRate ( ) ) ; for ( SalesInvoiceServiceLine txdLn : dtTx . getTxdLns ( ) ) { int ti = 0 ; // aggregate rate line scoped storages : BigDecimal taxAggegated = null ; BigDecimal taxAggrAccum = BigDecimal . ZERO ; BigDecimal taxAggegatedFc = BigDecimal . ZERO ; BigDecimal taxAggrAccumFc = BigDecimal . ZERO ; Collections . sort ( txdLn . getTaxCategory ( ) . getTaxes ( ) , cmpr ) ; for ( InvItemTaxCategoryLine itcl : txdLn . getTaxCategory ( ) . getTaxes ( ) ) { ti ++ ; if ( taxAggegated == null ) { if ( pTxRules . getSalTaxIsInvoiceBase ( ) ) { // invoice basis : if ( pLine . getItsOwner ( ) . getPriceIncTax ( ) ) { taxAggegated = txdLn . getItsTotal ( ) . subtract ( txdLn . getItsTotal ( ) . divide ( BigDecimal . ONE . add ( txdLn . getTaxCategory ( ) . getAggrOnlyPercent ( ) . divide ( bd100 ) ) , pAs . getPricePrecision ( ) , pTxRules . getSalTaxRoundMode ( ) ) ) ; if ( pLine . getItsOwner ( ) . getForeignCurrency ( ) != null ) { taxAggegatedFc = txdLn . getForeignTotal ( ) . subtract ( txdLn . getForeignTotal ( ) . divide ( BigDecimal . ONE . add ( txdLn . getTaxCategory ( ) . getAggrOnlyPercent ( ) . divide ( bd100 ) ) , pAs . getPricePrecision ( ) , pTxRules . getSalTaxRoundMode ( ) ) ) ; } } else { taxAggegated = txdLn . getSubtotal ( ) . multiply ( txdLn . getTaxCategory ( ) . getAggrOnlyPercent ( ) ) . divide ( bd100 , pAs . getPricePrecision ( ) , pTxRules . getSalTaxRoundMode ( ) ) ; if ( pLine . getItsOwner ( ) . getForeignCurrency ( ) != null ) { taxAggegatedFc = txdLn . getForeignSubtotal ( ) . multiply ( txdLn . getTaxCategory ( ) . getAggrOnlyPercent ( ) ) . divide ( bd100 , pAs . getPricePrecision ( ) , pTxRules . getSalTaxRoundMode ( ) ) ; } } } else { // item basis , taxes included / excluded taxAggegated = txdLn . getTotalTaxes ( ) ; taxAggegatedFc = txdLn . getForeignTotalTaxes ( ) ; } } // here total taxes mean total for current tax : if ( ti < txdLn . getTaxCategory ( ) . getTaxes ( ) . size ( ) ) { txdLn . setTotalTaxes ( taxAggegated . multiply ( itcl . getItsPercentage ( ) ) . divide ( txdLn . getTaxCategory ( ) . getAggrOnlyPercent ( ) , pAs . getPricePrecision ( ) , pTxRules . getSalTaxRoundMode ( ) ) ) ; taxAggrAccum = taxAggrAccum . add ( txdLn . getTotalTaxes ( ) ) ; if ( pLine . getItsOwner ( ) . getForeignCurrency ( ) != null ) { txdLn . setForeignTotalTaxes ( taxAggegatedFc . multiply ( itcl . getItsPercentage ( ) ) . divide ( txdLn . getTaxCategory ( ) . getAggrOnlyPercent ( ) , pAs . getPricePrecision ( ) , pTxRules . getSalTaxRoundMode ( ) ) ) ; taxAggrAccumFc = taxAggrAccumFc . add ( txdLn . getForeignTotalTaxes ( ) ) ; } } else { // the rest or only tax : txdLn . setTotalTaxes ( taxAggegated . subtract ( taxAggrAccum ) ) ; if ( pLine . getItsOwner ( ) . getForeignCurrency ( ) != null ) { txdLn . setForeignTotalTaxes ( taxAggegatedFc . subtract ( taxAggrAccumFc ) ) ; } } TL tl = findCreateTaxLine ( pReqVars , pLine . getItsOwner ( ) , invTxLns , itcl . getTax ( ) , true , pInvTxMeth . getFctInvTxLn ( ) ) ; tl . setItsTotal ( tl . getItsTotal ( ) . add ( txdLn . getTotalTaxes ( ) ) ) ; if ( pLine . getItsOwner ( ) . getForeignCurrency ( ) != null ) { tl . setForeignTotalTaxes ( tl . getForeignTotalTaxes ( ) . add ( txdLn . getForeignTotalTaxes ( ) ) ) ; } if ( pTxRules . getSalTaxIsInvoiceBase ( ) ) { if ( ti == txdLn . getTaxCategory ( ) . getTaxes ( ) . size ( ) ) { // total line taxes for farther invoice adjusting : txdLn . setTotalTaxes ( taxAggegated ) ; txdLn . setTotalTaxes ( taxAggegatedFc ) ; } if ( ! pLine . getItsOwner ( ) . getPriceIncTax ( ) ) { tl . setTaxableInvBas ( tl . getTaxableInvBas ( ) . add ( txdLn . getSubtotal ( ) ) ) ; if ( pLine . getItsOwner ( ) . getForeignCurrency ( ) != null ) { tl . setTaxableInvBasFc ( tl . getTaxableInvBasFc ( ) . add ( txdLn . getForeignSubtotal ( ) ) ) ; } } else { tl . setTaxableInvBas ( tl . getTaxableInvBas ( ) . add ( txdLn . getItsTotal ( ) ) ) ; if ( pLine . getItsOwner ( ) . getForeignCurrency ( ) != null ) { tl . setTaxableInvBasFc ( tl . getTaxableInvBasFc ( ) . add ( txdLn . getForeignTotal ( ) ) ) ; } } } if ( tl . getIsNew ( ) ) { getSrvOrm ( ) . insertEntity ( pReqVars , tl ) ; tl . setIsNew ( false ) ; } else { getSrvOrm ( ) . updateEntity ( pReqVars , tl ) ; } } } } if ( pTxRules . getSalTaxIsInvoiceBase ( ) ) { adjustInvoiceLns ( pReqVars , pLine . getItsOwner ( ) , dtTx . getTxdLns ( ) , pAs , pInvTxMeth ) ; } } // delete tax lines with zero tax : for ( TL tl : invTxLns ) { if ( tl . getTax ( ) == null ) { getSrvOrm ( ) . deleteEntity ( pReqVars , tl ) ; } } if ( pTxRules != null && ! pTxRules . getSalTaxUseAggregItBas ( ) && pLine . getItsOwner ( ) . getPriceIncTax ( ) ) { String watr = "TTR without aggregate! " ; if ( pLine . getItsOwner ( ) . getDescription ( ) == null ) { pLine . getItsOwner ( ) . setDescription ( watr ) ; } else if ( ! pLine . getItsOwner ( ) . getDescription ( ) . contains ( watr ) ) { pLine . getItsOwner ( ) . setDescription ( watr + pLine . getItsOwner ( ) . getDescription ( ) ) ; } } updInvTots ( pReqVars , pLine . getItsOwner ( ) , pAs , pInvTxMeth ) ;
import java . util . * ; class Main { /** * The function determines the count of hexadecimal numbers within a given range . * > > > hex _ numbers _ counter ( 10 , 15) * > > > hex _ numbers _ counter ( 2 , 4) * > > > hex _ numbers _ counter ( 15 , 16) */ public static int hexNumbersCounter ( int start , int end ) { } }
int hexCount = 0 ; for ( int number = start ; number <= end ; number ++ ) { if ( 10 <= number && number <= 15 ) { hexCount += 1 ; } else if ( number > 15 ) { int tempNumber = number ; while ( tempNumber != 0 ) { if ( tempNumber % 16 >= 10 ) { hexCount += 1 ; } tempNumber /= 16 ; } } } return hexCount ;
public class NumberFormat { /** * Adjusts the minimum and maximum fraction digits to values that * are reasonable for the currency ' s default fraction digits . */ private static void adjustForCurrencyDefaultFractionDigits ( DecimalFormat format , DecimalFormatSymbols symbols ) { } }
Currency currency = symbols . getCurrency ( ) ; if ( currency == null ) { try { currency = Currency . getInstance ( symbols . getInternationalCurrencySymbol ( ) ) ; } catch ( IllegalArgumentException e ) { } } if ( currency != null ) { int digits = currency . getDefaultFractionDigits ( ) ; if ( digits != - 1 ) { int oldMinDigits = format . getMinimumFractionDigits ( ) ; // Common patterns are " # . # # " , " # . 00 " , " # " . // Try to adjust all of them in a reasonable way . if ( oldMinDigits == format . getMaximumFractionDigits ( ) ) { format . setMinimumFractionDigits ( digits ) ; format . setMaximumFractionDigits ( digits ) ; } else { format . setMinimumFractionDigits ( Math . min ( digits , oldMinDigits ) ) ; format . setMaximumFractionDigits ( digits ) ; } } }
public class TicketAPI { /** * 获取 ticket * @ param access _ token access _ token * @ param type jsapi or wx _ card * @ return ticket */ public static Ticket ticketGetticket ( String access_token , String type ) { } }
HttpUriRequest httpUriRequest = RequestBuilder . get ( ) . setUri ( BASE_URI + "/cgi-bin/ticket/getticket" ) . addParameter ( PARAM_ACCESS_TOKEN , API . accessToken ( access_token ) ) . addParameter ( "type" , type ) . build ( ) ; return LocalHttpClient . executeJsonResult ( httpUriRequest , Ticket . class ) ;
public class ScriptExpression { /** * Deserialize this object from a POF stream . * @ param reader POF reader to use * @ throws IOException if an error occurs during deserialization */ public void readExternal ( PofReader reader ) throws IOException { } }
super . readExternal ( reader ) ; language = reader . readString ( 10 ) ; init ( ) ;
public class DockerClient { /** * Create an image by importing the given stream of a tar file . * @ param repository the repository to import to * @ param tag any tag for this image * @ param imageStream the InputStream of the tar file * @ return an { @ link ImageCreateResponse } containing the id of the imported image * @ throws DockerException if the import fails for some reason . */ public ImageCreateResponse importImage ( String repository , String tag , InputStream imageStream ) throws DockerException { } }
Preconditions . checkNotNull ( repository , "Repository was not specified" ) ; Preconditions . checkNotNull ( imageStream , "imageStream was not provided" ) ; MultivaluedMap < String , String > params = new MultivaluedMapImpl ( ) ; params . add ( "repo" , repository ) ; params . add ( "tag" , tag ) ; params . add ( "fromSrc" , "-" ) ; WebResource webResource = client . resource ( restEndpointUrl + "/images/create" ) . queryParams ( params ) ; try { LOGGER . trace ( "POST: {}" , webResource ) ; return webResource . accept ( MediaType . APPLICATION_OCTET_STREAM_TYPE ) . post ( ImageCreateResponse . class , imageStream ) ; } catch ( UniformInterfaceException exception ) { if ( exception . getResponse ( ) . getStatus ( ) == 500 ) { throw new DockerException ( "Server error." , exception ) ; } else { throw new DockerException ( exception ) ; } }
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getSBI ( ) { } }
if ( sbiEClass == null ) { sbiEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 334 ) ; } return sbiEClass ;
public class ArchetypeValidator { /** * Check if information model entity referenced by archetype * has right name or type */ void checkRmModelConformance ( ) { } }
final AmVisitor < AmObject , AmConstraintContext > visitor = AmVisitors . preorder ( new ConformanceVisitor ( ) ) ; ArchetypeWalker . walkConstraints ( visitor , archetype , new AmConstraintContext ( ) ) ;
public class TCPMemcachedNodeImpl { /** * ( non - Javadoc ) * @ see net . spy . memcached . MemcachedNode # fillWriteBuffer ( boolean ) */ public final void fillWriteBuffer ( boolean shouldOptimize ) { } }
if ( toWrite == 0 && readQ . remainingCapacity ( ) > 0 ) { getWbuf ( ) . clear ( ) ; Operation o = getNextWritableOp ( ) ; while ( o != null && toWrite < getWbuf ( ) . capacity ( ) ) { synchronized ( o ) { assert o . getState ( ) == OperationState . WRITING ; ByteBuffer obuf = o . getBuffer ( ) ; assert obuf != null : "Didn't get a write buffer from " + o ; int bytesToCopy = Math . min ( getWbuf ( ) . remaining ( ) , obuf . remaining ( ) ) ; byte [ ] b = new byte [ bytesToCopy ] ; obuf . get ( b ) ; getWbuf ( ) . put ( b ) ; getLogger ( ) . debug ( "After copying stuff from %s: %s" , o , getWbuf ( ) ) ; if ( ! o . getBuffer ( ) . hasRemaining ( ) ) { o . writeComplete ( ) ; transitionWriteItem ( ) ; preparePending ( ) ; if ( shouldOptimize ) { optimize ( ) ; } o = getNextWritableOp ( ) ; } toWrite += bytesToCopy ; } } getWbuf ( ) . flip ( ) ; assert toWrite <= getWbuf ( ) . capacity ( ) : "toWrite exceeded capacity: " + this ; assert toWrite == getWbuf ( ) . remaining ( ) : "Expected " + toWrite + " remaining, got " + getWbuf ( ) . remaining ( ) ; } else { getLogger ( ) . debug ( "Buffer is full, skipping" ) ; }
public class WhiteboxImpl { /** * Set the values of multiple instance fields defined in a context using * reflection . The values in the context will be assigned to values on the * { @ code instance } . This method will traverse the class hierarchy when * searching for the fields . Example usage : * Given : * < pre > * public class MyContext { * private String myString = & quot ; myString & quot ; ; * protected int myInt = 9; * public class MyInstance { * private String myInstanceString ; * private int myInstanceInt ; * < / pre > * then * < pre > * Whitebox . setInternalStateFromContext ( new MyInstance ( ) , new MyContext ( ) ) ; * < / pre > * will set the instance variables of { @ code myInstance } to the values * specified in { @ code MyContext } . * @ param object the object * @ param context The context where the fields are defined . * @ param additionalContexts Optionally more additional contexts . */ public static void setInternalStateFromContext ( Object object , Object context , Object [ ] additionalContexts ) { } }
setInternalStateFromContext ( object , context , FieldMatchingStrategy . MATCHING ) ; if ( additionalContexts != null && additionalContexts . length > 0 ) { for ( Object additionContext : additionalContexts ) { setInternalStateFromContext ( object , additionContext , FieldMatchingStrategy . MATCHING ) ; } }
public class Futures { /** * Creates a new CompletableFuture that will timeout after the given amount of time . * @ param timeout The timeout for the future . * @ param tag A tag ( identifier ) to be used as a parameter to the TimeoutException . * @ param executorService An ExecutorService that will be used to invoke the timeout on . * @ param < T > The Type argument for the CompletableFuture to create . * @ return The result . */ public static < T > CompletableFuture < T > futureWithTimeout ( Duration timeout , String tag , ScheduledExecutorService executorService ) { } }
CompletableFuture < T > result = new CompletableFuture < > ( ) ; ScheduledFuture < Boolean > sf = executorService . schedule ( ( ) -> result . completeExceptionally ( new TimeoutException ( tag ) ) , timeout . toMillis ( ) , TimeUnit . MILLISECONDS ) ; result . whenComplete ( ( r , ex ) -> sf . cancel ( true ) ) ; return result ;
public class AbstractExtractionCondition { /** * { @ inheritDoc } * @ see jp . co . future . uroborosql . fluent . ExtractionCondition # where ( java . lang . CharSequence ) */ @ SuppressWarnings ( "unchecked" ) @ Override public T where ( final CharSequence rawString ) { } }
this . rawStrings . add ( rawString ) ; this . useOperator = true ; return ( T ) this ;
public class AbcGrammar { /** * field - key : : = % x4B . 3A * WSP key header - eol < p > * < tt > K : < / tt > */ Rule FieldKey ( ) { } }
return Sequence ( String ( "K:" ) , ZeroOrMore ( WSP ( ) ) . suppressNode ( ) , Key ( ) , HeaderEol ( ) ) . label ( FieldKey ) ;
public class FmtLocalDate { /** * { @ inheritDoc } */ @ Override protected String format ( final LocalDate jodaType , final DateTimeFormatter formatter ) { } }
return jodaType . toString ( formatter ) ;
public class MathMLConverter { /** * Should consolidate onto the default MathML namespace . * @ param mathNode root element of the document * @ return return the root element of a new document * @ throws MathConverterException namespace consolidation failed */ Element consolidateMathMLNamespace ( Element mathNode ) throws MathConverterException { } }
try { Document tempDoc ; if ( isNsAware ( mathNode ) ) { tempDoc = mathNode . getOwnerDocument ( ) ; } else { tempDoc = XMLHelper . string2Doc ( XMLHelper . printDocument ( mathNode ) , true ) ; } // rename namespaces and set a new default namespace new XmlNamespaceTranslator ( ) . setDefaultNamespace ( DEFAULT_NAMESPACE ) . addTranslation ( "m" , "http://www.w3.org/1998/Math/MathML" ) . addTranslation ( "mml" , "http://www.w3.org/1998/Math/MathML" ) . translateNamespaces ( tempDoc , "" ) ; Element root = ( Element ) tempDoc . getFirstChild ( ) ; removeAttribute ( root , "xmlns:mml" ) ; removeAttribute ( root , "xmlns:m" ) ; return root ; } catch ( Exception e ) { logger . error ( "namespace consolidation failed" , e ) ; throw new MathConverterException ( "namespace consolidation failed" ) ; }
public class Snappy { /** * Reads the length varint ( a series of bytes , where the lower 7 bits * are data and the upper bit is a flag to indicate more bytes to be * read ) . * @ param in The input buffer to read the preamble from * @ return The calculated length based on the input buffer , or 0 if * no preamble is able to be calculated */ private static int readPreamble ( ByteBuf in ) { } }
int length = 0 ; int byteIndex = 0 ; while ( in . isReadable ( ) ) { int current = in . readUnsignedByte ( ) ; length |= ( current & 0x7f ) << byteIndex ++ * 7 ; if ( ( current & 0x80 ) == 0 ) { return length ; } if ( byteIndex >= 4 ) { throw new DecompressionException ( "Preamble is greater than 4 bytes" ) ; } } return 0 ;
public class Entry { /** * Sets the value of { @ link # recurrenceRuleProperty ( ) } . * @ param rec the new recurrence rule */ public final void setRecurrenceRule ( String rec ) { } }
if ( recurrenceRule == null && rec == null ) { // no unnecessary property creation if everything is null return ; } recurrenceRuleProperty ( ) . set ( rec ) ;
public class PooledEngine { /** * Retrieves a new { @ link Component } from the { @ link Engine } pool . It will be placed back in the pool whenever it ' s removed * from an { @ link Entity } or the { @ link Entity } itself it ' s removed . * Overrides the default implementation of Engine ( creating a new Object ) */ @ Override public < T extends Component > T createComponent ( Class < T > componentType ) { } }
return componentPools . obtain ( componentType ) ;
public class Classes { /** * Variant for { @ link # invokeSetter ( Object , String , String ) } but no exception if setter not found . * @ param object object instance , * @ param name setter name , * @ param value value to set . * @ throws Exception if invocation fail for whatever reason including method logic . */ public static void invokeOptionalSetter ( Object object , String name , String value ) throws Exception { } }
String setterName = Strings . getMethodAccessor ( "set" , name ) ; Class < ? > clazz = object . getClass ( ) ; Method method = null ; try { method = findMethod ( clazz , setterName ) ; } catch ( NoSuchMethodException e ) { log . debug ( "Setter |%s| not found in class |%s| or its super hierarchy." , setterName , clazz ) ; return ; } Class < ? > [ ] parameterTypes = method . getParameterTypes ( ) ; if ( parameterTypes . length != 1 ) { log . debug ( "Setter |%s#%s(%s)| with invalid parameters number." , method . getDeclaringClass ( ) , method . getName ( ) , Strings . join ( parameterTypes , ',' ) ) ; return ; } invoke ( object , method , ConverterRegistry . getConverter ( ) . asObject ( ( String ) value , parameterTypes [ 0 ] ) ) ;
public class MemorySegment { /** * Writes the given long value ( 64bit , 8 bytes ) to the given position in little endian * byte order . This method ' s speed depends on the system ' s native byte order , and it * is possibly slower than { @ link # putLong ( int , long ) } . For most cases ( such as * transient storage in memory or serialization for I / O and network ) , * it suffices to know that the byte order in which the value is written is the same as the * one in which it is read , and { @ link # putLong ( int , long ) } is the preferable choice . * @ param index The position at which the value will be written . * @ param value The long value to be written . * @ throws IndexOutOfBoundsException Thrown , if the index is negative , or larger than the segment * size minus 8. */ public final void putLongLittleEndian ( int index , long value ) { } }
if ( LITTLE_ENDIAN ) { putLong ( index , value ) ; } else { putLong ( index , Long . reverseBytes ( value ) ) ; }
public class CmsExport { /** * Cuts leading and trailing ' / ' from the given resource name . < p > * @ param resourceName the absolute path of a resource * @ return the trimmed resource name */ protected String trimResourceName ( String resourceName ) { } }
if ( resourceName . startsWith ( "/" ) ) { resourceName = resourceName . substring ( 1 ) ; } if ( resourceName . endsWith ( "/" ) ) { resourceName = resourceName . substring ( 0 , resourceName . length ( ) - 1 ) ; } return resourceName ;
public class JSJQueryHelper { /** * Create a JS anonymous function that can be used as a callback to the * jQuery . ajax success callback . Note : this can only be used with extended HTML * responses ! * @ param aHandlerBeforeInclude * The JS expression that must resolve to a JS function that takes 3 * arguments . See jQuery . ajax success callback for details . Note : this * should not be in an invocation but an invokable ! This handler is * invoked BEFORE the inclusions take place . * @ param aHandlerAfterInclude * The JS expression that must resolve to a JS function that takes 3 * arguments . See jQuery . ajax success callback for details . Note : this * should not be in an invocation but an invokable ! This handler is * invoked AFTER the inclusions take place . * @ return Never < code > null < / code > . */ @ Nonnull public static JSAnonymousFunction jqueryAjaxSuccessHandler ( @ Nullable final IJSExpression aHandlerBeforeInclude , @ Nullable final IJSExpression aHandlerAfterInclude ) { } }
final JSAnonymousFunction ret = new JSAnonymousFunction ( ) ; final JSVar aData = ret . param ( "a" ) ; final JSVar aTextStatus = ret . param ( "b" ) ; final JSVar aXHR = ret . param ( "c" ) ; ret . body ( ) . invoke ( "jqph" , "jqueryAjaxSuccessHandler" ) . arg ( aData ) . arg ( aTextStatus ) . arg ( aXHR ) . arg ( aHandlerBeforeInclude != null ? aHandlerBeforeInclude : JSExpr . NULL ) . arg ( aHandlerAfterInclude != null ? aHandlerAfterInclude : JSExpr . NULL ) ; return ret ;
public class CloseableIterators { /** * Returns a closeable iterator that applies { @ code function } to each element of { @ code * fromIterator } . */ public static < F , T > CloseableIterator < T > transform ( CloseableIterator < F > iterator , Function < F , T > function ) { } }
return wrap ( Iterators . transform ( iterator , function :: apply ) , iterator ) ;
public class EJSContainer { /** * F743-29185 */ public boolean removeStatefulBean ( Object bean ) throws RemoteException , RemoveException { } }
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "removeStatefulBean : " + Util . identity ( bean ) ) ; // Determine whether the parameter is a normal wrapper ( business or // component interface ) or a No - Interface reference , and if No - Interface // then extract the normal wrapper from it . EJSWrapperBase wrapper = null ; if ( bean instanceof EJSWrapperBase ) { wrapper = ( EJSWrapperBase ) bean ; } else if ( bean instanceof LocalBeanWrapper ) { wrapper = EJSWrapperCommon . getLocalBeanWrapperBase ( ( LocalBeanWrapper ) bean ) ; } else { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "removeStatefulBean : RemoveException:" + Util . identity ( bean ) ) ; throw new RemoveException ( "Object to remove is not an enterprise bean reference : " + Util . identity ( bean ) ) ; } // Confirm that the bean is a stateful bean , per method contract . if ( ! isStatefulSessionBean ( wrapper . beanId ) ) { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "removeStatefulBean : RemoveException:not stateful : " + wrapper . beanId ) ; throw new RemoveException ( "Object to remove is not a stateful bean reference : " + wrapper . beanId ) ; } // Actually remove the bean , reporting true for success , false for does // not exist , and propagating other exceptions . // Note that this must go through a ' normal ' pre / post invoke cycle , to // activate the bean and insure it is in a proper state for removal . // This will perform normal lifecycle removal and update pmi statistics . try { removeBean ( wrapper ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "removeStatefulBean : true" ) ; return true ; } catch ( NoSuchEJBException ex ) { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "removeStatefulBean : false (NoSuchEJBException)" ) ; return false ; } catch ( NoSuchObjectLocalException ex ) { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "removeStatefulBean : false (NoSuchObjectLocalException)" ) ; return false ; } catch ( OBJECT_NOT_EXIST ex ) { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "removeStatefulBean : false (OBJECT_NOT_EXIST)" ) ; return false ; } catch ( EJBException ex ) { // The RemoveException is considered ' checked ' and should not be // wrapped in an EJBException . d661827 if ( ex . getCause ( ) instanceof RemoveException ) { RemoveException rex = ( RemoveException ) ex . getCause ( ) ; throw rex ; } throw ex ; }
public class CircularView { /** * Set the degree that will trigger highlighting a marker . You can also set { @ link # HIGHLIGHT _ NONE } to not highlight any degree . * See R . styleable # CircularView _ highlightedDegree * @ param highlightedDegree Value in degrees . */ public void setHighlightedDegree ( final float highlightedDegree ) { } }
this . mHighlightedDegree = highlightedDegree ; mHighlightedMarker = null ; mHighlightedMarkerPosition = - 1 ; // Loop through all markers to see if any of them are highlighted . if ( mMarkerList != null ) { final int size = mMarkerList . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { final Marker marker = mMarkerList . get ( i ) ; // Only check the marker if the visibility is not " gone " if ( marker . getVisibility ( ) != View . GONE ) { final boolean markerIsHighlighted = mHighlightedDegree != HIGHLIGHT_NONE && marker . hasInSection ( mHighlightedDegree % 360 ) ; marker . setHighlighted ( markerIsHighlighted ) ; if ( markerIsHighlighted ) { // Marker is highlighted ! mHighlightedMarker = marker ; mHighlightedMarkerPosition = i ; final boolean highlightAnimationAndAnimateMarker = mIsAnimating && mAnimateMarkersOnHighlightAnimation ; final boolean stillAndAnimateMarker = ! mIsAnimating && mAnimateMarkersOnStillHighlight ; final boolean wantsToAnimateMarker = highlightAnimationAndAnimateMarker || stillAndAnimateMarker ; // Animate only if necessary if ( wantsToAnimateMarker && ! marker . isAnimating ( ) ) { marker . animateBounce ( ) ; } } } // Continue looping through the rest to reset other markers . } } postInvalidate ( ) ;
public class ChannelListController { /** * Original , pre - 4.3 version of this API . Always returns the entire contents of the Portlet * Registry , including uncategorized portlets , to which the user has access . Access is based on * the SUBSCRIBE permission . */ @ RequestMapping ( value = "/portletList" , method = RequestMethod . GET ) public ModelAndView listChannels ( WebRequest webRequest , HttpServletRequest request , @ RequestParam ( value = "type" , required = false ) String type ) { } }
if ( TYPE_MANAGE . equals ( type ) ) { throw new UnsupportedOperationException ( "Moved to PortletRESTController under /api/portlets.json" ) ; } final IPerson user = personManager . getPerson ( request ) ; final Map < String , SortedSet < ? > > registry = getRegistryOriginal ( webRequest , user ) ; // Since type = manage was deprecated channels is always empty but retained for backwards // compatibility registry . put ( "channels" , new TreeSet < ChannelBean > ( ) ) ; return new ModelAndView ( "jsonView" , "registry" , registry ) ;
public class Avicenna { /** * Whenever this method is called , all objects in input argument are searched for * annotated fields . Then , the fields are injected by dependency objects . * @ param objects List of objects which they should be injected . */ public static void inject ( Object ... objects ) { } }
try { for ( Object object : objects ) { Class clazz = object . getClass ( ) ; for ( Field field : ReflectionHelper . getFields ( clazz ) ) { if ( field . isAnnotationPresent ( InjectHere . class ) ) { qualifiers . clear ( ) ; for ( Annotation annotation : field . getAnnotations ( ) ) { if ( annotation . annotationType ( ) . isAnnotationPresent ( Qualifier . class ) ) { qualifiers . add ( annotation . annotationType ( ) . getCanonicalName ( ) ) ; } } field . setAccessible ( true ) ; field . set ( object , dependencyContainer . get ( DependencyIdentifier . getDependencyIdentifierForClass ( field , qualifiers ) ) ) ; } } } } catch ( Exception e ) { throw new AvicennaRuntimeException ( e ) ; }
public class StringExpression { /** * Create a { @ code this . length ( ) } expression * < p > Return the length of this String < / p > * @ return this . length ( ) * @ see java . lang . String # length ( ) */ public NumberExpression < Integer > length ( ) { } }
if ( length == null ) { length = Expressions . numberOperation ( Integer . class , Ops . STRING_LENGTH , mixin ) ; } return length ;
public class SelectResultSet { /** * Close resultSet . */ public void close ( ) throws SQLException { } }
isClosed = true ; if ( ! isEof ) { lock . lock ( ) ; try { while ( ! isEof ) { dataSize = 0 ; // to avoid storing data readNextValue ( ) ; } } catch ( SQLException queryException ) { throw ExceptionMapper . getException ( queryException , null , this . statement , false ) ; } catch ( IOException ioe ) { throw handleIoException ( ioe ) ; } finally { resetVariables ( ) ; lock . unlock ( ) ; } } resetVariables ( ) ; // keep garbage easy for ( int i = 0 ; i < data . length ; i ++ ) { data [ i ] = null ; } if ( statement != null ) { statement . checkCloseOnCompletion ( this ) ; statement = null ; }
public class GetDateVisitor { /** * Visit a Person . This is the primary focus of the visitation . From * here , interesting information is gathered from the attributes . Once a * date string is found , quit . * @ see GedObjectVisitor # visit ( Person ) */ @ Override public void visit ( final Person person ) { } }
for ( final GedObject gob : person . getAttributes ( ) ) { gob . accept ( this ) ; if ( ! dateString . isEmpty ( ) ) { break ; } }
public class PGgeometryConverter { /** * to geolatte */ public static Geometry convert ( org . postgis . Geometry geometry ) { } }
switch ( geometry . getType ( ) ) { case org . postgis . Geometry . POINT : return convert ( ( org . postgis . Point ) geometry ) ; case org . postgis . Geometry . LINESTRING : return convert ( ( org . postgis . LineString ) geometry ) ; case org . postgis . Geometry . LINEARRING : return convert ( ( org . postgis . LinearRing ) geometry ) ; case org . postgis . Geometry . POLYGON : return convert ( ( org . postgis . Polygon ) geometry ) ; case org . postgis . Geometry . MULTILINESTRING : return convert ( ( org . postgis . MultiLineString ) geometry ) ; case org . postgis . Geometry . MULTIPOINT : return convert ( ( org . postgis . MultiPoint ) geometry ) ; case org . postgis . Geometry . MULTIPOLYGON : return convert ( ( org . postgis . MultiPolygon ) geometry ) ; case org . postgis . Geometry . GEOMETRYCOLLECTION : return convert ( ( org . postgis . GeometryCollection ) geometry ) ; } throw new IllegalArgumentException ( geometry . toString ( ) ) ;
public class IonWriterSystem { /** * Sets { @ link # _ symbol _ table } and clears { @ link # _ initial _ ivm _ handling } . * Subclasses should override to generate output . */ final void writeIonVersionMarker ( SymbolTable systemSymtab ) throws IOException { } }
if ( getDepth ( ) != 0 ) { String message = "Ion Version Markers are only valid at the top level of a " + "data stream" ; throw new IllegalStateException ( message ) ; } assert systemSymtab . isSystemTable ( ) ; if ( ! SystemSymbols . ION_1_0 . equals ( systemSymtab . getIonVersionId ( ) ) ) { String message = "This library only supports Ion 1.0" ; throw new UnsupportedOperationException ( message ) ; } if ( shouldWriteIvm ( ) ) { _initial_ivm_handling = null ; writeIonVersionMarkerAsIs ( systemSymtab ) ; _previous_value_was_ivm = true ; } _symbol_table = systemSymtab ;
public class VariantNormalizer { /** * Calculates the start , end , reference and alternate of an SNV / MNV / INDEL where the * reference and the alternate are not empty . * This task comprises 2 steps : removing the trailing bases that are * identical in both alleles , then the leading identical bases . * @ param position Input starting position * @ param reference Input reference allele * @ param alt Input alternate allele * @ return The new start , end , reference and alternate alleles */ protected VariantKeyFields createVariantsFromNoEmptyRefAlt ( int position , String reference , String alt ) { } }
int indexOfDifference ; // Remove the trailing bases indexOfDifference = reverseIndexOfDifference ( reference , alt ) ; // VariantKeyFields startReferenceBlock = null ; final VariantKeyFields keyFields ; // VariantKeyFields endReferenceBlock = null ; // if ( generateReferenceBlocks ) { // if ( indexOfDifference > 0 ) { // / / Generate a reference block from the trailing bases // String blockRef = reference . substring ( reference . length ( ) - indexOfDifference , reference . length ( ) - indexOfDifference + 1 ) ; // int blockStart = position + reference . length ( ) - indexOfDifference ; // int blockEnd = position + reference . length ( ) - 1 ; / / Base - 1 ending // endReferenceBlock = new VariantKeyFields ( blockStart , blockEnd , blockRef , " " ) // . setReferenceBlock ( true ) ; // } else if ( indexOfDifference < 0 ) { // / / Reference and alternate are equals ! Generate a single reference block // String blockRef = reference . substring ( 0 , 1 ) ; // int blockStart = position ; // int blockEnd = position + reference . length ( ) - 1 ; / / Base - 1 ending // VariantKeyFields referenceBlock = new VariantKeyFields ( blockStart , blockEnd , blockRef , " " ) // . setReferenceBlock ( true ) ; // return Collections . singletonList ( referenceBlock ) ; reference = reference . substring ( 0 , reference . length ( ) - indexOfDifference ) ; alt = alt . substring ( 0 , alt . length ( ) - indexOfDifference ) ; // Remove the leading bases indexOfDifference = StringUtils . indexOfDifference ( reference , alt ) ; if ( indexOfDifference < 0 ) { // There reference and the alternate are the same return null ; } else if ( indexOfDifference == 0 ) { keyFields = new VariantKeyFields ( position , position + reference . length ( ) - 1 , reference , alt ) ; // if ( reference . length ( ) > alt . length ( ) ) { / / Deletion // keyFields = new VariantKeyFields ( position , position + reference . length ( ) - 1 , reference , alt ) ; // } else { / / Insertion // keyFields = new VariantKeyFields ( position , position + alt . length ( ) - 1 , reference , alt ) ; } else { // if ( generateReferenceBlocks ) { // String blockRef = reference . substring ( 0 , 1 ) ; // int blockStart = position ; // int blockEnd = position + indexOfDifference - 1 ; / / Base - 1 ending // startReferenceBlock = new VariantKeyFields ( blockStart , blockEnd , blockRef , " " ) // . setReferenceBlock ( true ) ; int start = position + indexOfDifference ; String ref = reference . substring ( indexOfDifference ) ; String inAlt = alt . substring ( indexOfDifference ) ; // int end = reference . length ( ) > alt . length ( ) // ? position + reference . length ( ) - 1 // : position + alt . length ( ) - 1; int end = position + reference . length ( ) - 1 ; keyFields = new VariantKeyFields ( start , end , ref , inAlt ) ; } // if ( ! generateReferenceBlocks ) { // return Collections . singletonList ( keyFields ) ; // } else { // List < VariantKeyFields > list = new ArrayList < > ( 1 + ( startReferenceBlock = = null ? 0 : 1 ) + ( endReferenceBlock = = null ? 0 : 1 ) ) ; // if ( startReferenceBlock ! = null ) { // list . add ( startReferenceBlock ) ; // list . add ( keyFields ) ; // if ( endReferenceBlock ! = null ) { // list . add ( endReferenceBlock ) ; // return list ; return keyFields ;
public class MonetaryFormat { /** * Set rounding mode to use when it becomes necessary . */ public MonetaryFormat roundingMode ( RoundingMode roundingMode ) { } }
if ( roundingMode == this . roundingMode ) return this ; else return new MonetaryFormat ( negativeSign , positiveSign , zeroDigit , decimalMark , minDecimals , decimalGroups , shift , roundingMode , codes , codeSeparator , codePrefixed ) ;
public class MolaDbClient { /** * Get the table details from moladb * @ param tableName Name of table to be get from Moladb . * @ return The responseContent from the Get table service method , as returned by * Moladb . * @ throws BceClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the responseContent . For example * if a network connection is not available . * @ throws BceServiceException * If an error responseContent is returned by Moladb indicating * either a problem with the data in the request , or a server side issue . */ public GetTableResponse getTable ( String tableName ) { } }
checkNotNull ( tableName , "request should not be null." ) ; InternalRequest httpRequest = createRequestUnderInstance ( HttpMethodName . GET , MolaDbConstants . URI_TABLE , tableName ) ; GetTableResponse ret = this . invokeHttpClient ( httpRequest , GetTableResponse . class ) ; return ret ;
public class StringInterpolatorDemoToDoItems { /** * region > newToDo ( action ) */ @ MemberOrder ( sequence = "40" ) public StringInterpolatorDemoToDoItem newToDo ( @ ParameterLayout ( named = "Description" ) @ Parameter ( regexPattern = "\\w[@&:\\-\\,\\.\\+ \\w]*" ) final String description , @ ParameterLayout ( named = "Documentation page" ) final String documentationPage ) { } }
final StringInterpolatorDemoToDoItem toDoItem = container . newTransientInstance ( StringInterpolatorDemoToDoItem . class ) ; toDoItem . setDescription ( description ) ; toDoItem . setDocumentationPage ( documentationPage ) ; container . persist ( toDoItem ) ; container . flush ( ) ; return toDoItem ;
public class SimpleFileIO { /** * Get the content of the file as a byte array . * @ param aFile * The file to read . May be < code > null < / code > . * @ return < code > null < / code > if the passed file is < code > null < / code > or if the * passed file does not exist . */ @ Nullable public static byte [ ] getAllFileBytes ( @ Nullable final File aFile ) { } }
return aFile == null ? null : StreamHelper . getAllBytes ( FileHelper . getInputStream ( aFile ) ) ;
public class AbstractTextSequencer { /** * Creates an instance of the { @ link # getRowFactoryClassName ( ) row factory } configured for this sequencer . * @ return an implementation of the named class ; never null * @ throws ClassNotFoundException if the the named row factory class cannot be located * @ throws IllegalAccessException if the row factory class or its null constructor is not accessible . * @ throws InstantiationException if the row factory represents an abstract class , an interface , an array class , a primitive * type , or void ; or if the class has no null constructor ; or if the instantiation fails for some other reason . */ private RowFactory createRowFactory ( ) throws ClassNotFoundException , IllegalAccessException , InstantiationException { } }
if ( this . rowFactoryClassName == null ) { return new DefaultRowFactory ( ) ; } Class < ? > rowFactoryClass = Class . forName ( this . rowFactoryClassName ) ; return ( RowFactory ) rowFactoryClass . newInstance ( ) ;
public class BarChart { /** * Calculates the bar boundaries based on the bar width and bar margin . * @ param _ Width Calculated bar width * @ param _ Margin Calculated bar margin */ protected void calculateBounds ( float _Width , float _Margin ) { } }
float maxValue = 0 ; int last = 0 ; for ( BarModel model : mData ) { if ( model . getValue ( ) > maxValue ) { maxValue = model . getValue ( ) ; } } int valuePadding = mShowValues ? ( int ) mValuePaint . getTextSize ( ) + mValueDistance : 0 ; float heightMultiplier = ( mGraphHeight - valuePadding ) / maxValue ; for ( BarModel model : mData ) { float height = model . getValue ( ) * heightMultiplier ; last += _Margin / 2 ; model . setBarBounds ( new RectF ( last , mGraphHeight - height , last + _Width , mGraphHeight ) ) ; model . setLegendBounds ( new RectF ( last , 0 , last + _Width , mLegendHeight ) ) ; last += _Width + ( _Margin / 2 ) ; } Utils . calculateLegendInformation ( mData , 0 , mContentRect . width ( ) , mLegendPaint ) ;
public class HibernateQueryModelDAO { @ Override public void save ( T object , AccessControlContext accessControlContext ) throws OptimisticLockException , AccessControlException , JeppettoException { } }
ensureAccessControlEnabled ( ) ; try { AccessControlContextOverride . set ( accessControlContext ) ; getCurrentSession ( ) . saveOrUpdate ( object ) ; // flush ( ) here because we want the AccessControlInterceptor to perform its onSave ( ) / onFlushDirty ( ) // checks while the override is in place . flush ( ) ; } catch ( org . hibernate . OptimisticLockException e ) { throw new OptimisticLockException ( e ) ; } catch ( HibernateException e ) { throw new JeppettoException ( e ) ; } finally { AccessControlContextOverride . clear ( ) ; }
public class ProtoType { /** * Returns the enclosing type , or null if this type is not nested in another type . */ public String enclosingTypeOrPackage ( ) { } }
int dot = string . lastIndexOf ( '.' ) ; return dot == - 1 ? null : string . substring ( 0 , dot ) ;
public class RBACDecorator { /** * Prepares list of operation signatures to pass to { @ link JMXSecurityMBean # canInvoke ( Map ) } * @ param ops * @ return */ @ SuppressWarnings ( "unchecked" ) private List < String > operations ( Map < String , Object > ops ) { } }
List < String > result = new LinkedList < > ( ) ; for ( String operation : ops . keySet ( ) ) { Object operationOrListOfOperations = ops . get ( operation ) ; List < Map < String , Object > > toStringify ; if ( operationOrListOfOperations instanceof List ) { toStringify = ( List < Map < String , Object > > ) operationOrListOfOperations ; } else { toStringify = Collections . singletonList ( ( Map < String , Object > ) operationOrListOfOperations ) ; } for ( Map < String , Object > op : toStringify ) { List < Map < String , String > > args = ( List < Map < String , String > > ) op . get ( "args" ) ; result . add ( operation + "(" + argsToString ( args ) + ")" ) ; } } return result ;
public class AccumulatorRepository { /** * Reads the config and creates configured accumulators . For now this method is only executed on startup . */ private void readConfig ( ) { } }
AccumulatorsConfig config = MoskitoConfigurationHolder . getConfiguration ( ) . getAccumulatorsConfig ( ) ; AccumulatorConfig [ ] acs = config . getAccumulators ( ) ; if ( acs != null && acs . length > 0 ) { for ( AccumulatorConfig ac : acs ) { AccumulatorDefinition ad = new AccumulatorDefinition ( ) ; ad . setName ( ac . getName ( ) ) ; ad . setIntervalName ( ac . getIntervalName ( ) ) ; ad . setProducerName ( ac . getProducerName ( ) ) ; ad . setStatName ( ac . getStatName ( ) ) ; ad . setTimeUnit ( TimeUnit . valueOf ( ac . getTimeUnit ( ) ) ) ; ad . setValueName ( ac . getValueName ( ) ) ; Accumulator acc = createAccumulator ( ad ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Created accumulator " + acc ) ; } } } AutoAccumulatorConfig [ ] autoAccumulatorConfigs = config . getAutoAccumulators ( ) ; if ( autoAccumulatorConfigs != null && autoAccumulatorConfigs . length > 0 ) { for ( AutoAccumulatorConfig aac : autoAccumulatorConfigs ) { AutoAccumulatorDefinition aad = new AutoAccumulatorDefinition ( ) ; aad . setNamePattern ( aac . getNamePattern ( ) ) ; aad . setProducerNamePattern ( aac . getProducerNamePattern ( ) ) ; aad . setIntervalName ( aac . getIntervalName ( ) ) ; aad . setValueName ( aac . getValueName ( ) ) ; aad . setStatName ( aac . getStatName ( ) ) ; aad . setTimeUnit ( TimeUnit . fromString ( aac . getTimeUnit ( ) ) ) ; aad . setAccumulationAmount ( aac . getAccumulationAmount ( ) ) ; autoAccumulatorDefinitions . add ( aad ) ; } }
public class Unchecked { /** * Wrap a { @ link CheckedConsumer } in a { @ link Consumer } . * Example : * < code > < pre > * Arrays . asList ( " a " , " b " ) . stream ( ) . forEach ( Unchecked . consumer ( s - > { * if ( s . length ( ) > 10) * throw new Exception ( " Only short strings allowed " ) ; * < / pre > < / code > */ public static < T > Consumer < T > consumer ( CheckedConsumer < T > consumer ) { } }
return consumer ( consumer , THROWABLE_TO_RUNTIME_EXCEPTION ) ;
public class PieChart { /** * Kicks off an animation that will result in the pointer being centered in the * pie slice of the currently selected item . */ private void centerOnCurrentItem ( ) { } }
if ( ! mPieData . isEmpty ( ) ) { PieModel current = mPieData . get ( getCurrentItem ( ) ) ; int targetAngle ; if ( mOpenClockwise ) { targetAngle = ( mIndicatorAngle - current . getStartAngle ( ) ) - ( ( current . getEndAngle ( ) - current . getStartAngle ( ) ) / 2 ) ; if ( targetAngle < 0 && mPieRotation > 0 ) targetAngle += 360 ; } else { targetAngle = current . getStartAngle ( ) + ( current . getEndAngle ( ) - current . getStartAngle ( ) ) / 2 ; targetAngle += mIndicatorAngle ; if ( targetAngle > 270 && mPieRotation < 90 ) targetAngle -= 360 ; } mAutoCenterAnimator . setIntValues ( targetAngle ) ; mAutoCenterAnimator . setDuration ( AUTOCENTER_ANIM_DURATION ) . start ( ) ; }
public class CloudControlClientSupport { /** * instantiateWebClient . * @ param targetUrl * a { @ link java . lang . String } object . * @ return a { @ link org . apache . cxf . jaxrs . client . WebClient } object . */ protected WebClient instantiateWebClient ( String targetUrl ) { } }
WebClient webClient = WebClient . create ( targetUrl ) . type ( "application/x-www-form-urlencoded" ) . accept ( MediaType . TEXT_PLAIN ) . accept ( MediaType . APPLICATION_JSON ) ; webClient = Header . setHeader ( webClient ) ; HTTPConduit conduit = WebClient . getConfig ( webClient ) . getHttpConduit ( ) ; TLSClientParameters params = conduit . getTlsClientParameters ( ) ; if ( params == null ) { params = new TLSClientParameters ( ) ; conduit . setTlsClientParameters ( params ) ; } params . setTrustManagers ( new TrustManager [ ] { new DumbX509TrustManager ( ) } ) ; params . setDisableCNCheck ( true ) ; HTTPClientPolicy policy = new HTTPClientPolicy ( ) ; policy . setConnectionTimeout ( 600000 ) ; policy . setReceiveTimeout ( 600000 ) ; policy . setAllowChunking ( false ) ; conduit . setClient ( policy ) ; return webClient ;
public class Configs { /** * < p > Set self define system configs . < / p > * Can use self system configs path or self class extends { @ link OneProperties } . * @ param systemConfigAbsoluteClassPath self system configs absolute class path . * Can be null , if null means use * default path " { @ value # DEFAULT _ SYSTEM _ CONFIG _ ABSOLUTE _ CLASS _ PATH } " * @ param systemConfigsObj self class extends { @ link OneProperties } . * Can be null , if null means not use self class . * @ see OneProperties */ public static void setSystemConfigs ( String systemConfigAbsoluteClassPath , OneProperties systemConfigsObj ) { } }
if ( systemConfigsObj != null ) { Configs . systemConfigs = systemConfigsObj ; } if ( systemConfigAbsoluteClassPath != null ) { Configs . systemConfigAbsoluteClassPath = systemConfigAbsoluteClassPath ; Configs . systemConfigs . initConfigs ( Configs . systemConfigAbsoluteClassPath ) ; } else if ( systemConfigsObj != null ) { // use new systemConfigs , need initConfigs . Configs . systemConfigs . initConfigs ( Configs . systemConfigAbsoluteClassPath ) ; }
public class BaseCasRegisteredServiceStreamPublisher { /** * Publish internal . * @ param service the service * @ param event the event */ protected void publishInternal ( final RegisteredService service , final ApplicationEvent event ) { } }
if ( event instanceof CasRegisteredServiceDeletedEvent ) { handleCasRegisteredServiceDeletedEvent ( service , event ) ; return ; } if ( event instanceof CasRegisteredServiceSavedEvent || event instanceof CasRegisteredServiceLoadedEvent ) { handleCasRegisteredServiceUpdateEvents ( service , event ) ; return ; } LOGGER . warn ( "Unsupported event [{}} for service replication" , event ) ;
public class Reflect { /** * Note : Two methods which are equally specific should not be allowed by * the Java compiler . In this case BeanShell currently chooses the first * one it finds . We could add a test for this case here ( I believe ) by * adding another isSignatureAssignable ( ) in the other direction between * the target and " best " match . If the assignment works both ways then * neither is more specific and they are ambiguous . I ' ll leave this test * out for now because I ' m not sure how much another test would impact * performance . Method selection is now cached at a high level , so a few * friendly extraneous tests shouldn ' t be a problem . */ static int findMostSpecificSignature ( Class < ? > [ ] idealMatch , Class < ? > [ ] [ ] candidates ) { } }
for ( int round = Types . FIRST_ROUND_ASSIGNABLE ; round <= Types . LAST_ROUND_ASSIGNABLE ; round ++ ) { Class < ? > [ ] bestMatch = null ; int bestMatchIndex = - 1 ; for ( int i = 0 ; i < candidates . length ; i ++ ) { Class < ? > [ ] targetMatch = candidates [ i ] ; if ( null != bestMatch && Types . areSignaturesEqual ( targetMatch , bestMatch ) ) // overridden keep first continue ; // If idealMatch fits targetMatch and this is the first match // or targetMatch is more specific than the best match , make it // the new best match . if ( Types . isSignatureAssignable ( idealMatch , targetMatch , round ) && ( bestMatch == null || Types . areSignaturesEqual ( idealMatch , targetMatch ) || ( Types . isSignatureAssignable ( targetMatch , bestMatch , Types . JAVA_BASE_ASSIGNABLE ) && ! Types . areSignaturesEqual ( idealMatch , bestMatch ) ) ) ) { bestMatch = targetMatch ; bestMatchIndex = i ; } } if ( bestMatch != null ) return bestMatchIndex ; } return - 1 ;
public class LoopBarView { /** * You can setup { @ code { @ link LoopBarView # mOuterAdapter } } through { @ link ViewPager } adapter . * Your { @ link ViewPager } adapter must implement { @ link ILoopBarPagerAdapter } otherwise - the icons will not be shown * @ param viewPager - viewPager , which must have { @ link ILoopBarPagerAdapter } */ public void setupWithViewPager ( @ NonNull ViewPager viewPager ) { } }
PagerAdapter pagerAdapter = viewPager . getAdapter ( ) ; List < ICategoryItem > categoryItems = new ArrayList < > ( pagerAdapter . getCount ( ) ) ; ILoopBarPagerAdapter loopBarPagerAdapter = pagerAdapter instanceof ILoopBarPagerAdapter ? ( ILoopBarPagerAdapter ) pagerAdapter : null ; for ( int i = 0 , size = pagerAdapter . getCount ( ) ; i < size ; i ++ ) { categoryItems . add ( new CategoryItem ( loopBarPagerAdapter != null ? loopBarPagerAdapter . getPageDrawable ( i ) : null , String . valueOf ( pagerAdapter . getPageTitle ( i ) ) ) ) ; } setCategoriesAdapter ( new SimpleCategoriesAdapter ( categoryItems ) ) ;
public class DefaultGroupManager { /** * Lists objects in the group . */ private void doList ( final Message < JsonObject > message ) { } }
String type = message . body ( ) . getString ( "type" ) ; if ( type != null ) { switch ( type ) { case "node" : doListNode ( message ) ; break ; default : message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "Invalid type specified." ) ) ; break ; } } else { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No type specified." ) ) ; }
public class GeneratedDConnectionDaoImpl { /** * query - by method for field userRoles * @ param userRoles the specified attribute * @ return an Iterable of DConnections for the specified userRoles */ public Iterable < DConnection > queryByUserRoles ( java . lang . String userRoles ) { } }
return queryByField ( null , DConnectionMapper . Field . USERROLES . getFieldName ( ) , userRoles ) ;
public class ClassWriterImpl { /** * Get summary links for navigation bar . * @ return the content tree for the navigation summary links */ protected Content getNavSummaryLinks ( ) throws Exception { } }
Content li = HtmlTree . LI ( summaryLabel ) ; li . addContent ( getSpace ( ) ) ; Content ulNav = HtmlTree . UL ( HtmlStyle . subNavList , li ) ; MemberSummaryBuilder memberSummaryBuilder = ( MemberSummaryBuilder ) configuration . getBuilderFactory ( ) . getMemberSummaryBuilder ( this ) ; String [ ] navLinkLabels = new String [ ] { "doclet.navNested" , "doclet.navEnum" , "doclet.navField" , "doclet.navConstructor" , "doclet.navMethod" } ; for ( int i = 0 ; i < navLinkLabels . length ; i ++ ) { Content liNav = new HtmlTree ( HtmlTag . LI ) ; if ( i == VisibleMemberMap . ENUM_CONSTANTS && ! classDoc . isEnum ( ) ) { continue ; } if ( i == VisibleMemberMap . CONSTRUCTORS && classDoc . isEnum ( ) ) { continue ; } AbstractMemberWriter writer = ( ( AbstractMemberWriter ) memberSummaryBuilder . getMemberSummaryWriter ( i ) ) ; if ( writer == null ) { liNav . addContent ( getResource ( navLinkLabels [ i ] ) ) ; } else { writer . addNavSummaryLink ( memberSummaryBuilder . members ( i ) , memberSummaryBuilder . getVisibleMemberMap ( i ) , liNav ) ; } if ( i < navLinkLabels . length - 1 ) { addNavGap ( liNav ) ; } ulNav . addContent ( liNav ) ; } return ulNav ;
public class EntryListenerConfig { /** * This method provides a workaround by converting a MapListener to EntryListener * when it is added via EntryListenerConfig object . * With this method , we are trying to fix two problems : * First , if we do not introduce the conversion in this method , { @ link EntryListenerConfig # getImplementation } * will give { @ link ClassCastException } with a MapListener implementation . * Second goal of the conversion is to preserve backward compatibility . */ private static EventListener toEntryListener ( Object implementation ) { } }
if ( implementation instanceof EntryListener ) { return ( EventListener ) implementation ; } if ( implementation instanceof MapListener ) { return new MapListenerToEntryListenerAdapter ( ( MapListener ) implementation ) ; } throw new IllegalArgumentException ( implementation + " is not an expected EventListener implementation." + " A valid one has to be an implementation of EntryListener or MapListener" ) ;
public class OpsAgent { /** * Send the final response stored in the PendingOpsRequest to the client which initiated the * action . Will be called automagically after aggregating cluster - wide responses , but may * be called directly by subclasses if necessary . */ protected void sendClientResponse ( PendingOpsRequest request ) { } }
byte statusCode = ClientResponse . SUCCESS ; String statusString = null ; /* * It is possible not to receive a table response if a feature is not enabled */ // All of the null / empty table handling / detecting / generation sucks . Just making it // work for now , not making it pretty . - - izzy VoltTable responseTables [ ] = request . aggregateTables ; if ( responseTables == null || responseTables . length == 0 ) { responseTables = new VoltTable [ 0 ] ; statusCode = ClientResponse . GRACEFUL_FAILURE ; statusString = "Requested info \"" + request . subselector + "\" is not yet available or not supported in the current configuration." ; } ClientResponseImpl response = new ClientResponseImpl ( statusCode , ClientResponse . UNINITIALIZED_APP_STATUS_CODE , null , responseTables , statusString ) ; response . setClientHandle ( request . clientData ) ; ByteBuffer buf = ByteBuffer . allocate ( response . getSerializedSize ( ) + 4 ) ; buf . putInt ( buf . capacity ( ) - 4 ) ; response . flattenToBuffer ( buf ) . flip ( ) ; request . c . writeStream ( ) . enqueue ( buf ) ;
public class NameIndentConverter { /** * GetString Method . */ public String getString ( ) { } }
String string = super . getString ( ) ; int iIndent = ( int ) m_convIndent . getValue ( ) ; string = gstrSpaces . substring ( 0 , iIndent * m_iIndentAmount ) + string ; return string ;
public class KeyValueAuthHandler { /** * Once the channel is marked as active , the SASL negotiation is started . * @ param ctx the handler context . * @ throws Exception if something goes wrong during negotiation . */ @ Override public void channelActive ( final ChannelHandlerContext ctx ) throws Exception { } }
this . ctx = ctx ; ctx . writeAndFlush ( new DefaultBinaryMemcacheRequest ( ) . setOpcode ( SASL_LIST_MECHS_OPCODE ) ) ;
public class OAuth1 { /** * Generates a base URI from a given URL . The base URI consists of the * protocol , the host , and also the port if its not the default port * for the given protocol . * @ param url the URL from which the URI should be generated * @ return the base URI */ private static String makeBaseUri ( URL url ) { } }
String r = url . getProtocol ( ) . toLowerCase ( ) + "://" + url . getHost ( ) . toLowerCase ( ) ; if ( ( url . getProtocol ( ) . equalsIgnoreCase ( "http" ) && url . getPort ( ) != - 1 && url . getPort ( ) != 80 ) || ( url . getProtocol ( ) . equalsIgnoreCase ( "https" ) && url . getPort ( ) != - 1 && url . getPort ( ) != 443 ) ) { r += ":" + url . getPort ( ) ; } return r ;
public class ClusterChain { /** * Sets the length of this { @ code ClusterChain } in bytes . Because a * { @ code ClusterChain } can only contain full clusters , the new size * will always be a multiple of the cluster size . * @ param size the desired number of bytes the can be stored in * this { @ code ClusterChain } * @ return the true number of bytes this { @ code ClusterChain } can contain * @ throws IOException on error setting the new size * @ see # setChainLength ( int ) */ public long setSize ( long size ) throws IOException { } }
final long nrClusters = ( ( size + clusterSize - 1 ) / clusterSize ) ; if ( nrClusters > Integer . MAX_VALUE ) throw new IOException ( "too many clusters" ) ; setChainLength ( ( int ) nrClusters ) ; return clusterSize * nrClusters ;
public class AWSMediaLiveClient { /** * Purchase an offering and create a reservation . * @ param purchaseOfferingRequest * Placeholder documentation for PurchaseOfferingRequest * @ return Result of the PurchaseOffering operation returned by the service . * @ throws BadRequestException * This request was invalid * @ throws InternalServerErrorException * Internal service error * @ throws ForbiddenException * You do not have permission to purchase the offering * @ throws BadGatewayException * Bad gateway error * @ throws NotFoundException * Offering you ' re attempting to purchase does not exist * @ throws GatewayTimeoutException * Gateway timeout error * @ throws TooManyRequestsException * Request limit exceeded on purchase offering request * @ throws ConflictException * Offering purchase prevented by service resource issue * @ sample AWSMediaLive . PurchaseOffering * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / medialive - 2017-10-14 / PurchaseOffering " target = " _ top " > AWS API * Documentation < / a > */ @ Override public PurchaseOfferingResult purchaseOffering ( PurchaseOfferingRequest request ) { } }
request = beforeClientExecution ( request ) ; return executePurchaseOffering ( request ) ;
public class BufferedReader { /** * Fills the input buffer , taking the mark into account if it is valid . */ private void fill ( ) throws IOException { } }
int dst ; if ( markedChar <= UNMARKED ) { /* No mark */ dst = 0 ; } else { /* Marked */ int delta = nextChar - markedChar ; if ( delta >= readAheadLimit ) { /* Gone past read - ahead limit : Invalidate mark */ markedChar = INVALIDATED ; readAheadLimit = 0 ; dst = 0 ; } else { if ( readAheadLimit <= cb . length ) { /* Shuffle in the current buffer */ System . arraycopy ( cb , markedChar , cb , 0 , delta ) ; markedChar = 0 ; dst = delta ; } else { /* Reallocate buffer to accommodate read - ahead limit */ // Android - changed : Use the same strategy as BufferedInputStream , // i . e , double the size of the buffer on each fill . Do not directly // size the buffer to the readAheadLimit . // char ncb [ ] = new char [ readAheadLimit ] ; int nlength = cb . length * 2 ; if ( nlength > readAheadLimit ) { nlength = readAheadLimit ; } char ncb [ ] = new char [ nlength ] ; System . arraycopy ( cb , markedChar , ncb , 0 , delta ) ; cb = ncb ; markedChar = 0 ; dst = delta ; } nextChar = nChars = delta ; } } int n ; do { n = in . read ( cb , dst , cb . length - dst ) ; } while ( n == 0 ) ; if ( n > 0 ) { nChars = dst + n ; nextChar = dst ; }
public class SjavacServer { /** * Acquire the port file . Synchronized since several threads inside an smart javac wrapper client acquires the same port file at the same time . */ public static synchronized PortFile getPortFile ( String filename ) { } }
if ( allPortFiles == null ) { allPortFiles = new HashMap < > ( ) ; } PortFile pf = allPortFiles . get ( filename ) ; // Port file known . Does it still exist ? if ( pf != null ) { try { if ( ! pf . exists ( ) ) pf = null ; } catch ( IOException ioex ) { ioex . printStackTrace ( ) ; } } if ( pf == null ) { pf = new PortFile ( filename ) ; allPortFiles . put ( filename , pf ) ; } return pf ;
public class FractionNumber { /** * 分母の最大値を指定した分数を作成する 。 * @ param value * @ param maxDenom 分母の最大値 。 * @ param wholeType ' true ' のとき帯分数として作成する 。 ' false ' のとき仮分数として作成する 。 * @ return */ public static FractionNumber createMaxDenominator ( final double value , int maxDenom , boolean wholeType ) { } }
final FractionNumber fractionNumber = new FractionNumber ( value ) ; fractionNumber . wholeType = wholeType ; final SimpleFraction fraction = SimpleFraction . createFractionMaxDenominator ( Math . abs ( value ) , maxDenom ) ; setupFractionPart ( fraction , fractionNumber ) ; return fractionNumber ;
public class AnnotationsUtils { /** * Retrieve the name * If the item is a reference and name attribute is not specified then returns the simple name of the reference . * @ param annotation item * @ return name of the item */ public static String getNameOfReferenceableItem ( Object annotation ) { } }
if ( annotation == null ) { return "" ; } String name = "" , ref = "" ; if ( annotation instanceof org . eclipse . microprofile . openapi . annotations . headers . Header ) { name = ( ( org . eclipse . microprofile . openapi . annotations . headers . Header ) annotation ) . name ( ) ; ref = ( ( org . eclipse . microprofile . openapi . annotations . headers . Header ) annotation ) . ref ( ) ; } else if ( annotation instanceof ExampleObject ) { name = ( ( ExampleObject ) annotation ) . name ( ) ; ref = ( ( ExampleObject ) annotation ) . ref ( ) ; } else if ( annotation instanceof org . eclipse . microprofile . openapi . annotations . links . Link ) { name = ( ( org . eclipse . microprofile . openapi . annotations . links . Link ) annotation ) . name ( ) ; ref = ( ( org . eclipse . microprofile . openapi . annotations . links . Link ) annotation ) . ref ( ) ; } else if ( annotation instanceof Callback ) { name = ( ( Callback ) annotation ) . name ( ) ; ref = ( ( Callback ) annotation ) . ref ( ) ; } if ( StringUtils . isBlank ( name ) ) { if ( StringUtils . isNotBlank ( ref ) ) { // If the item is a reference then use the simple name of reference as the name int index = ref . lastIndexOf ( '/' ) ; return index == - 1 ? ref : ref . substring ( index + 1 ) ; } } return name ;
public class LayerFailureMarshaller { /** * Marshall the given parameter object . */ public void marshall ( LayerFailure layerFailure , ProtocolMarshaller protocolMarshaller ) { } }
if ( layerFailure == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( layerFailure . getLayerDigest ( ) , LAYERDIGEST_BINDING ) ; protocolMarshaller . marshall ( layerFailure . getFailureCode ( ) , FAILURECODE_BINDING ) ; protocolMarshaller . marshall ( layerFailure . getFailureReason ( ) , FAILUREREASON_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }