signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class AbstractPainter { /** * Sets the antialiasing setting . This is a bound property . * @ param value the new antialiasing setting */ public void setAntialiasing ( boolean value ) { } }
boolean old = isAntialiasing ( ) ; antialiasing = value ; if ( old != value ) setDirty ( true ) ; firePropertyChange ( "antialiasing" , old , isAntialiasing ( ) ) ;
public class BaseProfile { /** * generate multi mcf class code * @ param def Definition * @ param className class name * @ param num number of order */ void generateMultiMcfClassCode ( Definition def , String className , int num ) { } }
if ( className == null || className . equals ( "" ) ) return ; if ( num < 0 || num + 1 > def . getMcfDefs ( ) . size ( ) ) return ; try { String clazzName = this . getClass ( ) . getPackage ( ) . getName ( ) + ".code." + className + "CodeGen" ; String javaFile = McfDef . class . getMethod ( "get" + className + "Class" ) . invoke ( def . getMcfDefs ( ) . get ( num ) , ( Object [ ] ) null ) + ".java" ; FileWriter fw ; fw = Utils . createSrcFile ( javaFile , def . getRaPackage ( ) , def . getOutputDir ( ) ) ; Class < ? > clazz = Class . forName ( clazzName , true , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; AbstractCodeGen codeGen = ( AbstractCodeGen ) clazz . newInstance ( ) ; codeGen . setNumOfMcf ( num ) ; codeGen . generate ( def , fw ) ; fw . flush ( ) ; fw . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; }
public class BooleanOperation { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > less than or equal < / i > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > e . g . . . . valueOf ( n . property ( " age " ) ) . < b > LTE ( 25 ) < / b > < / i > < / div > * < br / > */ public < E > Concatenator LTE ( E value ) { } }
getBooleanOp ( ) . setOperator ( Operator . LTE ) ; return this . operateOn ( value ) ;
public class StringUtils { /** * Trim < i > all < / i > whitespace from the given { @ code String } : leading , trailing , and in between * characters . * @ param str the { @ code String } to check * @ return the trimmed { @ code String } * @ see java . lang . Character # isWhitespace */ public static String trimAllWhitespace ( final String str ) { } }
if ( ! StringUtils . hasLength ( str ) ) { return str ; } final int len = str . length ( ) ; final StringBuilder sb = new StringBuilder ( str . length ( ) ) ; for ( int i = 0 ; i < len ; i ++ ) { final char c = str . charAt ( i ) ; if ( ! Character . isWhitespace ( c ) ) { sb . append ( c ) ; } } return sb . toString ( ) ;
public class ProxyIterator { /** * Returns the current batch iterator or lazily fetches the next batch from the cluster . * @ return the next batch iterator */ private CompletableFuture < Iterator < T > > batch ( ) { } }
return batch . thenCompose ( iterator -> { if ( iterator != null && ! iterator . hasNext ( ) ) { batch = fetch ( iterator . position ( ) ) ; return batch . thenApply ( Function . identity ( ) ) ; } return CompletableFuture . completedFuture ( iterator ) ; } ) ;
public class DefaultPathMappingContext { /** * Returns a summary string of the given { @ link PathMappingContext } . */ static List < Object > generateSummary ( PathMappingContext mappingCtx ) { } }
requireNonNull ( mappingCtx , "mappingCtx" ) ; // 0 : VirtualHost // 1 : HttpMethod // 2 : Path // 3 : Content - Type // 4 ~ : Accept final List < Object > summary = new ArrayList < > ( 8 ) ; summary . add ( mappingCtx . virtualHost ( ) ) ; summary . add ( mappingCtx . method ( ) ) ; summary . add ( mappingCtx . path ( ) ) ; summary . add ( mappingCtx . consumeType ( ) ) ; final List < MediaType > produceTypes = mappingCtx . produceTypes ( ) ; if ( produceTypes != null ) { summary . addAll ( produceTypes ) ; } return summary ;
public class RaftContext { /** * Sets the state leader . * @ param leader The state leader . */ public void setLeader ( MemberId leader ) { } }
if ( ! Objects . equals ( this . leader , leader ) ) { if ( leader == null ) { this . leader = null ; } else { // If a valid leader ID was specified , it must be a member that ' s currently a member of the // ACTIVE members configuration . Note that we don ' t throw exceptions for unknown members . It ' s // possible that a failure following a configuration change could result in an unknown leader // sending AppendRequest to this server . Simply configure the leader if it ' s known . DefaultRaftMember member = cluster . getMember ( leader ) ; if ( member != null ) { this . leader = leader ; log . info ( "Found leader {}" , member . memberId ( ) ) ; electionListeners . forEach ( l -> l . accept ( member ) ) ; } } this . lastVotedFor = null ; meta . storeVote ( null ) ; }
public class CmsCmisTypeManager { /** * Creates the base types . * @ throws CmsException if something goes wrong */ void setup ( ) throws CmsException { } }
m_types = new HashMap < String , TypeDefinitionContainerImpl > ( ) ; m_typeList = new ArrayList < TypeDefinitionContainer > ( ) ; m_cmsPropertyDefinitions = m_adminCms . readAllPropertyDefinitions ( ) ; // folder type FolderTypeDefinitionImpl folderType = new FolderTypeDefinitionImpl ( ) ; folderType . setBaseTypeId ( BaseTypeId . CMIS_FOLDER ) ; folderType . setIsControllableAcl ( Boolean . TRUE ) ; folderType . setIsControllablePolicy ( Boolean . FALSE ) ; folderType . setIsCreatable ( Boolean . TRUE ) ; folderType . setDescription ( "Folder" ) ; folderType . setDisplayName ( "Folder" ) ; folderType . setIsFileable ( Boolean . TRUE ) ; folderType . setIsFulltextIndexed ( Boolean . FALSE ) ; folderType . setIsIncludedInSupertypeQuery ( Boolean . TRUE ) ; folderType . setLocalName ( "Folder" ) ; folderType . setLocalNamespace ( NAMESPACE ) ; folderType . setIsQueryable ( Boolean . TRUE ) ; folderType . setQueryName ( "cmis:folder" ) ; folderType . setId ( FOLDER_TYPE_ID ) ; addBasePropertyDefinitions ( folderType ) ; addFolderPropertyDefinitions ( folderType ) ; addCmsPropertyDefinitions ( folderType ) ; addProviderPropertyDefinitions ( folderType ) ; addTypeInternal ( folderType ) ; // document type DocumentTypeDefinitionImpl documentType = new DocumentTypeDefinitionImpl ( ) ; documentType . setBaseTypeId ( BaseTypeId . CMIS_DOCUMENT ) ; documentType . setIsControllableAcl ( Boolean . TRUE ) ; documentType . setIsControllablePolicy ( Boolean . FALSE ) ; documentType . setIsCreatable ( Boolean . TRUE ) ; documentType . setDescription ( "Document" ) ; documentType . setDisplayName ( "Document" ) ; documentType . setIsFileable ( Boolean . TRUE ) ; documentType . setIsFulltextIndexed ( Boolean . FALSE ) ; documentType . setIsIncludedInSupertypeQuery ( Boolean . TRUE ) ; documentType . setLocalName ( "Document" ) ; documentType . setLocalNamespace ( NAMESPACE ) ; documentType . setIsQueryable ( Boolean . TRUE ) ; documentType . setQueryName ( "cmis:document" ) ; documentType . setId ( DOCUMENT_TYPE_ID ) ; documentType . setIsVersionable ( Boolean . FALSE ) ; documentType . setContentStreamAllowed ( ContentStreamAllowed . REQUIRED ) ; addBasePropertyDefinitions ( documentType ) ; addDocumentPropertyDefinitions ( documentType ) ; addCmsPropertyDefinitions ( documentType ) ; addProviderPropertyDefinitions ( documentType ) ; addTypeInternal ( documentType ) ; // relationship types RelationshipTypeDefinitionImpl relationshipType = new RelationshipTypeDefinitionImpl ( ) ; relationshipType . setBaseTypeId ( BaseTypeId . CMIS_RELATIONSHIP ) ; relationshipType . setIsControllableAcl ( Boolean . FALSE ) ; relationshipType . setIsControllablePolicy ( Boolean . FALSE ) ; relationshipType . setIsCreatable ( Boolean . FALSE ) ; relationshipType . setDescription ( "Relationship" ) ; relationshipType . setDisplayName ( "Relationship" ) ; relationshipType . setIsFileable ( Boolean . FALSE ) ; relationshipType . setIsIncludedInSupertypeQuery ( Boolean . TRUE ) ; relationshipType . setLocalName ( "Relationship" ) ; relationshipType . setLocalNamespace ( NAMESPACE ) ; relationshipType . setIsQueryable ( Boolean . FALSE ) ; relationshipType . setQueryName ( "cmis:relationship" ) ; relationshipType . setId ( RELATIONSHIP_TYPE_ID ) ; List < String > typeList = new ArrayList < String > ( ) ; typeList . add ( "cmis:document" ) ; typeList . add ( "cmis:folder" ) ; relationshipType . setAllowedSourceTypes ( typeList ) ; relationshipType . setAllowedTargetTypes ( typeList ) ; addBasePropertyDefinitions ( relationshipType ) ; addRelationPropertyDefinitions ( relationshipType ) ; addTypeInternal ( relationshipType ) ; for ( CmsRelationType relType : CmsRelationType . getAll ( ) ) { createRelationshipType ( relType ) ; } m_lastUpdate = System . currentTimeMillis ( ) ;
public class ClassGenerator { /** * FieldDescr */ public ClassGenerator addField ( int access , String name , Class < ? > type ) { } }
return addField ( access , name , type , null , null ) ;
public class ExtensionManager { /** * Register a new plugin If < code > extension < / code > is null then a * < code > NullPointerException < / code > is thrown . * @ param extension The extension object to be registered * @ throws RemoteException * @ throws RuntimeFault either because of the web service itself , or because of the * service provider unable to handle the request . */ public void registerExtension ( Extension extension ) throws RuntimeFault , RemoteException { } }
if ( extension == null ) { throw new NullPointerException ( ) ; } encodeUrl ( extension ) ; getVimService ( ) . registerExtension ( getMOR ( ) , extension ) ;
public class TodoItem { /** * Returns if a MongoDB document is a todo item . */ public static boolean isTodoItem ( final Document todoItemDoc ) { } }
return todoItemDoc . containsKey ( ID_KEY ) && todoItemDoc . containsKey ( TASK_KEY ) && todoItemDoc . containsKey ( CHECKED_KEY ) ;
public class Promises { /** * Execute promises step by step * @ param queue queue of promises * @ param < T > type of promises * @ return promise */ public static < T > Promise traverse ( List < Supplier < Promise < T > > > queue ) { } }
if ( queue . size ( ) == 0 ) { return Promise . success ( null ) ; } return queue . remove ( 0 ) . get ( ) . flatMap ( v -> traverse ( queue ) ) ;
public class ClassReloadingStrategy { /** * Resets all classes to their original definition while using the first type ' s class loader as a class file locator . * @ param type The types to reset . * @ return This class reloading strategy . * @ throws IOException If a class file locator causes an IO exception . */ public ClassReloadingStrategy reset ( Class < ? > ... type ) throws IOException { } }
return type . length == 0 ? this : reset ( ClassFileLocator . ForClassLoader . of ( type [ 0 ] . getClassLoader ( ) ) , type ) ;
public class DeepLearning { /** * Cross - Validate a DeepLearning model by building new models on N train / test holdout splits * @ param splits Frames containing train / test splits * @ param cv _ preds Array of Frames to store the predictions for each cross - validation run * @ param offsets Array to store the offsets of starting row indices for each cross - validation run * @ param i Which fold of cross - validation to perform */ @ Override public void crossValidate ( Frame [ ] splits , Frame [ ] cv_preds , long [ ] offsets , int i ) { } }
// Train a clone with slightly modified parameters ( to account for cross - validation ) final DeepLearning cv = ( DeepLearning ) this . clone ( ) ; cv . genericCrossValidation ( splits , offsets , i ) ; cv_preds [ i ] = ( ( DeepLearningModel ) UKV . get ( cv . dest ( ) ) ) . score ( cv . validation ) ; new TAtomic < DeepLearningModel > ( ) { @ Override public DeepLearningModel atomic ( DeepLearningModel m ) { if ( ! keep_cross_validation_splits && /* paranoid */ cv . dest ( ) . toString ( ) . contains ( "xval" ) ) { m . get_params ( ) . source = null ; m . get_params ( ) . validation = null ; m . get_params ( ) . response = null ; } return m ; } } . invoke ( cv . dest ( ) ) ;
public class Table { /** * Reports a cell whose positioning has been decided back to the table * so that column bookkeeping can be done . ( Called from * < code > RowGroup < / code > - - not < code > TableChecker < / code > . ) * @ param cell a cell whose position has been calculated */ void cell ( Cell cell ) { } }
int left = cell . getLeft ( ) ; int right = cell . getRight ( ) ; // first see if we ' ve got a cell past the last col if ( right > realColumnCount ) { // are we past last col entirely ? if ( left == realColumnCount ) { // single col ? if ( left + 1 != right ) { appendColumnRange ( new ColumnRange ( cell . elementName ( ) , cell , left + 1 , right ) ) ; } realColumnCount = right ; return ; } else { // not past entirely appendColumnRange ( new ColumnRange ( cell . elementName ( ) , cell , realColumnCount , right ) ) ; realColumnCount = right ; } } while ( currentColRange != null ) { int hit = currentColRange . hits ( left ) ; if ( hit == 0 ) { ColumnRange newRange = currentColRange . removeColumn ( left ) ; if ( newRange == null ) { // zap a list item if ( previousColRange != null ) { previousColRange . setNext ( currentColRange . getNext ( ) ) ; } if ( first == currentColRange ) { first = currentColRange . getNext ( ) ; } if ( last == currentColRange ) { last = previousColRange ; } currentColRange = currentColRange . getNext ( ) ; } else { if ( last == currentColRange ) { last = newRange ; } currentColRange = newRange ; } return ; } else if ( hit == - 1 ) { return ; } else if ( hit == 1 ) { previousColRange = currentColRange ; currentColRange = currentColRange . getNext ( ) ; } }
public class SliceUtf8 { /** * Tries to get the UTF - 8 encoded code point at the { @ code position } . A positive * return value means the UTF - 8 sequence at the position is valid , and the result * is the code point . A negative return value means the UTF - 8 sequence at the * position is invalid , and the length of the invalid sequence is the absolute * value of the result . * @ return the code point or negative the number of bytes in the invalid UTF - 8 sequence . */ public static int tryGetCodePointAt ( Slice utf8 , int position ) { } }
// Process first byte byte firstByte = utf8 . getByte ( position ) ; int length = lengthOfCodePointFromStartByteSafe ( firstByte ) ; if ( length < 0 ) { return length ; } if ( length == 1 ) { // normal ASCII // 0xxx _ xxxx return firstByte ; } // Process second byte if ( position + 1 >= utf8 . length ( ) ) { return - 1 ; } byte secondByte = utf8 . getByteUnchecked ( position + 1 ) ; if ( ! isContinuationByte ( secondByte ) ) { return - 1 ; } if ( length == 2 ) { // 110x _ xxxx 10xx _ xxxx int codePoint = ( ( firstByte & 0b0001_1111 ) << 6 ) | ( secondByte & 0b0011_1111 ) ; // fail if overlong encoding return codePoint < 0x80 ? - 2 : codePoint ; } // Process third byte if ( position + 2 >= utf8 . length ( ) ) { return - 2 ; } byte thirdByte = utf8 . getByteUnchecked ( position + 2 ) ; if ( ! isContinuationByte ( thirdByte ) ) { return - 2 ; } if ( length == 3 ) { // 1110 _ xxxx 10xx _ xxxx 10xx _ xxxx int codePoint = ( ( firstByte & 0b0000_1111 ) << 12 ) | ( ( secondByte & 0b0011_1111 ) << 6 ) | ( thirdByte & 0b0011_1111 ) ; // surrogates are invalid if ( MIN_SURROGATE <= codePoint && codePoint <= MAX_SURROGATE ) { return - 3 ; } // fail if overlong encoding return codePoint < 0x800 ? - 3 : codePoint ; } // Process forth byte if ( position + 3 >= utf8 . length ( ) ) { return - 3 ; } byte forthByte = utf8 . getByteUnchecked ( position + 3 ) ; if ( ! isContinuationByte ( forthByte ) ) { return - 3 ; } if ( length == 4 ) { // 1111_0xxx 10xx _ xxxx 10xx _ xxxx 10xx _ xxxx int codePoint = ( ( firstByte & 0b0000_0111 ) << 18 ) | ( ( secondByte & 0b0011_1111 ) << 12 ) | ( ( thirdByte & 0b0011_1111 ) << 6 ) | ( forthByte & 0b0011_1111 ) ; // fail if overlong encoding or above upper bound of Unicode if ( codePoint < 0x11_0000 && codePoint >= 0x1_0000 ) { return codePoint ; } return - 4 ; } // Process fifth byte if ( position + 4 >= utf8 . length ( ) ) { return - 4 ; } byte fifthByte = utf8 . getByteUnchecked ( position + 4 ) ; if ( ! isContinuationByte ( fifthByte ) ) { return - 4 ; } if ( length == 5 ) { // Per RFC3629 , UTF - 8 is limited to 4 bytes , so more bytes are illegal return - 5 ; } // Process sixth byte if ( position + 5 >= utf8 . length ( ) ) { return - 5 ; } byte sixthByte = utf8 . getByteUnchecked ( position + 5 ) ; if ( ! isContinuationByte ( sixthByte ) ) { return - 5 ; } if ( length == 6 ) { // Per RFC3629 , UTF - 8 is limited to 4 bytes , so more bytes are illegal return - 6 ; } // for longer sequence , which can ' t happen return - 1 ;
public class OctetUtil { /** * Convert integer ( 4 octets ) value to bytes . * @ param value as 4 bytes representing integer in bytes . * @ return */ public static byte [ ] intToBytes ( int value ) { } }
byte [ ] result = new byte [ 4 ] ; result [ 0 ] = ( byte ) ( value >> 24 & 0xff ) ; result [ 1 ] = ( byte ) ( value >> 16 & 0xff ) ; result [ 2 ] = ( byte ) ( value >> 8 & 0xff ) ; result [ 3 ] = ( byte ) ( value & 0xff ) ; return result ;
public class Promise { /** * Called after success or failure * @ param afterHandler after handler * @ return this */ public Promise < T > after ( final ConsumerDouble < T , Exception > afterHandler ) { } }
then ( t -> afterHandler . apply ( t , null ) ) ; failure ( e -> afterHandler . apply ( null , e ) ) ; return this ;
public class StochasticGradientBoosting { /** * Sets the learning rate of the algorithm . The GB version uses a learning * rate of 1 . SGB uses a learning rate in ( 0,1 ) to avoid overfitting . The * learning rate is multiplied by the output of each weak learner to reduce * its contribution . * @ param learningRate the multiplier to apply to the weak learners * @ throws ArithmeticException if the learning rate is not in the range ( 0 , 1] */ public void setLearningRate ( double learningRate ) { } }
// + - Inf case captured in > 1 < = 0 case if ( learningRate > 1 || learningRate <= 0 || Double . isNaN ( learningRate ) ) throw new ArithmeticException ( "Invalid learning rate" ) ; this . learningRate = learningRate ;
public class Date { /** * Attempts to interpret the string < tt > s < / tt > as a representation * of a date and time . If the attempt is successful , the time * indicated is returned represented as the distance , measured in * milliseconds , of that time from the epoch ( 00:00:00 GMT on * January 1 , 1970 ) . If the attempt fails , an * < tt > IllegalArgumentException < / tt > is thrown . * It accepts many syntaxes ; in particular , it recognizes the IETF * standard date syntax : " Sat , 12 Aug 1995 13:30:00 GMT " . It also * understands the continental U . S . time - zone abbreviations , but for * general use , a time - zone offset should be used : " Sat , 12 Aug 1995 * 13:30:00 GMT + 0430 " ( 4 hours , 30 minutes west of the Greenwich * meridian ) . If no time zone is specified , the local time zone is * assumed . GMT and UTC are considered equivalent . * The string < tt > s < / tt > is processed from left to right , looking for * data of interest . Any material in < tt > s < / tt > that is within the * ASCII parenthesis characters < tt > ( < / tt > and < tt > ) < / tt > is ignored . * Parentheses may be nested . Otherwise , the only characters permitted * within < tt > s < / tt > are these ASCII characters : * < blockquote > < pre > * abcdefghijklmnopqrstuvwxyz * ABCDEFGHIJKLMNOPQRSTUVWXYZ * 0123456789 , + - : / < / pre > < / blockquote > * and whitespace characters . < p > * A consecutive sequence of decimal digits is treated as a decimal * number : < ul > * < li > If a number is preceded by < tt > + < / tt > or < tt > - < / tt > and a year * has already been recognized , then the number is a time - zone * offset . If the number is less than 24 , it is an offset measured * in hours . Otherwise , it is regarded as an offset in minutes , * expressed in 24 - hour time format without punctuation . A * preceding < tt > - < / tt > means a westward offset . Time zone offsets * are always relative to UTC ( Greenwich ) . Thus , for example , * < tt > - 5 < / tt > occurring in the string would mean " five hours west * of Greenwich " and < tt > + 0430 < / tt > would mean " four hours and * thirty minutes east of Greenwich . " It is permitted for the * string to specify < tt > GMT < / tt > , < tt > UT < / tt > , or < tt > UTC < / tt > * redundantly - for example , < tt > GMT - 5 < / tt > or < tt > utc + 0430 < / tt > . * < li > The number is regarded as a year number if one of the * following conditions is true : * < ul > * < li > The number is equal to or greater than 70 and followed by a * space , comma , slash , or end of string * < li > The number is less than 70 , and both a month and a day of * the month have already been recognized < / li > * < / ul > * If the recognized year number is less than 100 , it is * interpreted as an abbreviated year relative to a century of * which dates are within 80 years before and 19 years after * the time when the Date class is initialized . * After adjusting the year number , 1900 is subtracted from * it . For example , if the current year is 1999 then years in * the range 19 to 99 are assumed to mean 1919 to 1999 , while * years from 0 to 18 are assumed to mean 2000 to 2018 . Note * that this is slightly different from the interpretation of * years less than 100 that is used in { @ link java . text . SimpleDateFormat } . * < li > If the number is followed by a colon , it is regarded as an hour , * unless an hour has already been recognized , in which case it is * regarded as a minute . * < li > If the number is followed by a slash , it is regarded as a month * ( it is decreased by 1 to produce a number in the range < tt > 0 < / tt > * to < tt > 11 < / tt > ) , unless a month has already been recognized , in * which case it is regarded as a day of the month . * < li > If the number is followed by whitespace , a comma , a hyphen , or * end of string , then if an hour has been recognized but not a * minute , it is regarded as a minute ; otherwise , if a minute has * been recognized but not a second , it is regarded as a second ; * otherwise , it is regarded as a day of the month . < / ul > < p > * A consecutive sequence of letters is regarded as a word and treated * as follows : < ul > * < li > A word that matches < tt > AM < / tt > , ignoring case , is ignored ( but * the parse fails if an hour has not been recognized or is less * than < tt > 1 < / tt > or greater than < tt > 12 < / tt > ) . * < li > A word that matches < tt > PM < / tt > , ignoring case , adds < tt > 12 < / tt > * to the hour ( but the parse fails if an hour has not been * recognized or is less than < tt > 1 < / tt > or greater than < tt > 12 < / tt > ) . * < li > Any word that matches any prefix of < tt > SUNDAY , MONDAY , TUESDAY , * WEDNESDAY , THURSDAY , FRIDAY < / tt > , or < tt > SATURDAY < / tt > , ignoring * case , is ignored . For example , < tt > sat , Friday , TUE < / tt > , and * < tt > Thurs < / tt > are ignored . * < li > Otherwise , any word that matches any prefix of < tt > JANUARY , * FEBRUARY , MARCH , APRIL , MAY , JUNE , JULY , AUGUST , SEPTEMBER , * OCTOBER , NOVEMBER < / tt > , or < tt > DECEMBER < / tt > , ignoring case , and * considering them in the order given here , is recognized as * specifying a month and is converted to a number ( < tt > 0 < / tt > to * < tt > 11 < / tt > ) . For example , < tt > aug , Sept , april < / tt > , and * < tt > NOV < / tt > are recognized as months . So is < tt > Ma < / tt > , which * is recognized as < tt > MARCH < / tt > , not < tt > MAY < / tt > . * < li > Any word that matches < tt > GMT , UT < / tt > , or < tt > UTC < / tt > , ignoring * case , is treated as referring to UTC . * < li > Any word that matches < tt > EST , CST , MST < / tt > , or < tt > PST < / tt > , * ignoring case , is recognized as referring to the time zone in * North America that is five , six , seven , or eight hours west of * Greenwich , respectively . Any word that matches < tt > EDT , CDT , * MDT < / tt > , or < tt > PDT < / tt > , ignoring case , is recognized as * referring to the same time zone , respectively , during daylight * saving time . < / ul > < p > * Once the entire string s has been scanned , it is converted to a time * result in one of two ways . If a time zone or time - zone offset has been * recognized , then the year , month , day of month , hour , minute , and * second are interpreted in UTC and then the time - zone offset is * applied . Otherwise , the year , month , day of month , hour , minute , and * second are interpreted in the local time zone . * @ param s a string to be parsed as a date . * @ return the number of milliseconds since January 1 , 1970 , 00:00:00 GMT * represented by the string argument . * @ see java . text . DateFormat * @ deprecated As of JDK version 1.1, * replaced by < code > DateFormat . parse ( String s ) < / code > . */ @ Deprecated public static long parse ( String s ) { } }
int year = Integer . MIN_VALUE ; int mon = - 1 ; int mday = - 1 ; int hour = - 1 ; int min = - 1 ; int sec = - 1 ; int millis = - 1 ; int c = - 1 ; int i = 0 ; int n = - 1 ; int wst = - 1 ; int tzoffset = - 1 ; int prevc = 0 ; syntax : { if ( s == null ) break syntax ; int limit = s . length ( ) ; while ( i < limit ) { c = s . charAt ( i ) ; i ++ ; if ( c <= ' ' || c == ',' ) continue ; if ( c == '(' ) { // skip comments int depth = 1 ; while ( i < limit ) { c = s . charAt ( i ) ; i ++ ; if ( c == '(' ) depth ++ ; else if ( c == ')' ) if ( -- depth <= 0 ) break ; } continue ; } if ( '0' <= c && c <= '9' ) { n = c - '0' ; while ( i < limit && '0' <= ( c = s . charAt ( i ) ) && c <= '9' ) { n = n * 10 + c - '0' ; i ++ ; } if ( prevc == '+' || prevc == '-' && year != Integer . MIN_VALUE ) { // BEGIN Android - changed : Android specific time zone logic if ( tzoffset != 0 && tzoffset != - 1 ) break syntax ; // timezone offset if ( n < 24 ) { n = n * 60 ; // EG . " GMT - 3" // Support for Timezones of the form GMT - 3:30 . We look for an ' : " and // parse the number following it as loosely as the original hours // section ( i . e , no range or validity checks ) . int minutesPart = 0 ; if ( i < limit && ( s . charAt ( i ) == ':' ) ) { i ++ ; while ( i < limit && '0' <= ( c = s . charAt ( i ) ) && c <= '9' ) { minutesPart = ( minutesPart * 10 ) + ( c - '0' ) ; i ++ ; } } n += minutesPart ; } else { n = ( n % 100 ) + ( ( n / 100 ) * 60 ) ; // eg " GMT - 0430" } if ( prevc == '+' ) // plus means east of GMT n = - n ; // END Android - changed : Android specific time zone logic tzoffset = n ; } else if ( n >= 70 ) if ( year != Integer . MIN_VALUE ) break syntax ; else if ( c <= ' ' || c == ',' || c == '/' || i >= limit ) // year = n < 1900 ? n : n - 1900; year = n ; else break syntax ; else if ( c == ':' ) if ( hour < 0 ) hour = ( byte ) n ; else if ( min < 0 ) min = ( byte ) n ; else break syntax ; else if ( c == '/' ) if ( mon < 0 ) mon = ( byte ) ( n - 1 ) ; else if ( mday < 0 ) mday = ( byte ) n ; else break syntax ; else if ( i < limit && c != ',' && c > ' ' && c != '-' ) break syntax ; else if ( hour >= 0 && min < 0 ) min = ( byte ) n ; else if ( min >= 0 && sec < 0 ) sec = ( byte ) n ; else if ( mday < 0 ) mday = ( byte ) n ; // Handle two - digit years < 70 ( 70-99 handled above ) . else if ( year == Integer . MIN_VALUE && mon >= 0 && mday >= 0 ) year = n ; else break syntax ; prevc = 0 ; } else if ( c == '/' || c == ':' || c == '+' || c == '-' ) prevc = c ; else { int st = i - 1 ; while ( i < limit ) { c = s . charAt ( i ) ; if ( ! ( 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' ) ) break ; i ++ ; } if ( i <= st + 1 ) break syntax ; int k ; for ( k = wtb . length ; -- k >= 0 ; ) if ( wtb [ k ] . regionMatches ( true , 0 , s , st , i - st ) ) { int action = ttb [ k ] ; if ( action != 0 ) { if ( action == 1 ) { // pm if ( hour > 12 || hour < 1 ) break syntax ; else if ( hour < 12 ) hour += 12 ; } else if ( action == 14 ) { // am if ( hour > 12 || hour < 1 ) break syntax ; else if ( hour == 12 ) hour = 0 ; } else if ( action <= 13 ) { // month ! if ( mon < 0 ) mon = ( byte ) ( action - 2 ) ; else break syntax ; } else { tzoffset = action - 10000 ; } } break ; } if ( k < 0 ) break syntax ; prevc = 0 ; } } if ( year == Integer . MIN_VALUE || mon < 0 || mday < 0 ) break syntax ; // Parse 2 - digit years within the correct default century . if ( year < 100 ) { synchronized ( Date . class ) { if ( defaultCenturyStart == 0 ) { defaultCenturyStart = gcal . getCalendarDate ( ) . getYear ( ) - 80 ; } } year += ( defaultCenturyStart / 100 ) * 100 ; if ( year < defaultCenturyStart ) year += 100 ; } if ( sec < 0 ) sec = 0 ; if ( min < 0 ) min = 0 ; if ( hour < 0 ) hour = 0 ; BaseCalendar cal = getCalendarSystem ( year ) ; if ( tzoffset == - 1 ) { // no time zone specified , have to use local BaseCalendar . Date ldate = ( BaseCalendar . Date ) cal . newCalendarDate ( TimeZone . getDefaultRef ( ) ) ; ldate . setDate ( year , mon + 1 , mday ) ; ldate . setTimeOfDay ( hour , min , sec , 0 ) ; return cal . getTime ( ldate ) ; } BaseCalendar . Date udate = ( BaseCalendar . Date ) cal . newCalendarDate ( null ) ; // no time zone udate . setDate ( year , mon + 1 , mday ) ; udate . setTimeOfDay ( hour , min , sec , 0 ) ; return cal . getTime ( udate ) + tzoffset * ( 60 * 1000 ) ; } // syntax error throw new IllegalArgumentException ( ) ;
public class PackageManagerHelper { /** * Set up http client with credentials * @ return Http client */ public CloseableHttpClient getHttpClient ( ) { } }
try { URI crxUri = new URI ( props . getPackageManagerUrl ( ) ) ; final AuthScope authScope = new AuthScope ( crxUri . getHost ( ) , crxUri . getPort ( ) ) ; final Credentials credentials = new UsernamePasswordCredentials ( props . getUserId ( ) , props . getPassword ( ) ) ; final CredentialsProvider credsProvider = new BasicCredentialsProvider ( ) ; credsProvider . setCredentials ( authScope , credentials ) ; HttpClientBuilder httpClientBuilder = HttpClients . custom ( ) . setDefaultCredentialsProvider ( credsProvider ) . addInterceptorFirst ( new HttpRequestInterceptor ( ) { @ Override public void process ( HttpRequest request , HttpContext context ) throws HttpException , IOException { // enable preemptive authentication AuthState authState = ( AuthState ) context . getAttribute ( HttpClientContext . TARGET_AUTH_STATE ) ; authState . update ( new BasicScheme ( ) , credentials ) ; } } ) . setKeepAliveStrategy ( new ConnectionKeepAliveStrategy ( ) { @ Override public long getKeepAliveDuration ( HttpResponse response , HttpContext context ) { // keep reusing connections to a minimum - may conflict when instance is restarting and responds in unexpected manner return 1 ; } } ) ; // timeout settings httpClientBuilder . setDefaultRequestConfig ( HttpClientUtil . buildRequestConfig ( props ) ) ; // relaxed SSL check if ( props . isRelaxedSSLCheck ( ) ) { SSLContext sslContext = new SSLContextBuilder ( ) . loadTrustMaterial ( null , new TrustSelfSignedStrategy ( ) ) . build ( ) ; SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory ( sslContext , new NoopHostnameVerifier ( ) ) ; httpClientBuilder . setSSLSocketFactory ( sslsf ) ; } // proxy support Proxy proxy = getProxyForUrl ( props . getPackageManagerUrl ( ) ) ; if ( proxy != null ) { httpClientBuilder . setProxy ( new HttpHost ( proxy . getHost ( ) , proxy . getPort ( ) , proxy . getProtocol ( ) ) ) ; if ( proxy . useAuthentication ( ) ) { AuthScope proxyAuthScope = new AuthScope ( proxy . getHost ( ) , proxy . getPort ( ) ) ; Credentials proxyCredentials = new UsernamePasswordCredentials ( proxy . getUsername ( ) , proxy . getPassword ( ) ) ; credsProvider . setCredentials ( proxyAuthScope , proxyCredentials ) ; } } return httpClientBuilder . build ( ) ; } catch ( URISyntaxException ex ) { throw new PackageManagerException ( "Invalid url: " + props . getPackageManagerUrl ( ) , ex ) ; } catch ( KeyManagementException | KeyStoreException | NoSuchAlgorithmException ex ) { throw new PackageManagerException ( "Could not set relaxedSSLCheck" , ex ) ; }
public class AbstractStructuredRenderer { /** * Renders information about the components . * @ return a string builder ( never null ) * @ throws IOException */ private StringBuilder renderComponents ( ) throws IOException { } }
StringBuilder sb = new StringBuilder ( ) ; sb . append ( renderTitle1 ( this . messages . get ( "components" ) ) ) ; // $ NON - NLS - 1 $ sb . append ( renderParagraph ( this . messages . get ( "components.intro" ) ) ) ; // $ NON - NLS - 1 $ List < String > sectionNames = new ArrayList < > ( ) ; List < Component > allComponents = ComponentHelpers . findAllComponents ( this . applicationTemplate ) ; Collections . sort ( allComponents , new AbstractTypeComparator ( ) ) ; for ( Component comp : allComponents ) { // Start a new section final String sectionName = DocConstants . SECTION_COMPONENTS + comp . getName ( ) ; StringBuilder section = startSection ( sectionName ) ; // Overview section . append ( renderTitle2 ( comp . getName ( ) ) ) ; section . append ( renderTitle3 ( this . messages . get ( "overview" ) ) ) ; // $ NON - NLS - 1 $ String customInfo = readCustomInformation ( this . applicationDirectory , comp . getName ( ) , DocConstants . COMP_SUMMARY ) ; if ( Utils . isEmptyOrWhitespaces ( customInfo ) ) customInfo = this . typeAnnotations . get ( comp . getName ( ) ) ; if ( ! Utils . isEmptyOrWhitespaces ( customInfo ) ) section . append ( renderParagraph ( customInfo ) ) ; String installerName = Utils . capitalize ( ComponentHelpers . findComponentInstaller ( comp ) ) ; installerName = applyBoldStyle ( installerName , installerName ) ; String msg = MessageFormat . format ( this . messages . get ( "component.installer" ) , installerName ) ; // $ NON - NLS - 1 $ section . append ( renderParagraph ( msg ) ) ; // Facets Collection < Facet > facets = ComponentHelpers . findAllFacets ( comp ) ; if ( ! facets . isEmpty ( ) ) { section . append ( renderTitle3 ( this . messages . get ( "facets" ) ) ) ; // $ NON - NLS - 1 $ msg = MessageFormat . format ( this . messages . get ( "component.inherits.facets" ) , comp ) ; section . append ( renderParagraph ( msg ) ) ; section . append ( renderList ( ComponentHelpers . extractNames ( facets ) ) ) ; } // Inheritance List < Component > extendedComponents = ComponentHelpers . findAllExtendedComponents ( comp ) ; extendedComponents . remove ( comp ) ; Collection < Component > extendingComponents = ComponentHelpers . findAllExtendingComponents ( comp ) ; if ( ! extendedComponents . isEmpty ( ) || ! extendingComponents . isEmpty ( ) ) { section . append ( renderTitle3 ( this . messages . get ( "inheritance" ) ) ) ; // $ NON - NLS - 1 $ AbstractRoboconfTransformer transformer = new InheritanceTransformer ( comp , comp . getExtendedComponent ( ) , extendingComponents , 4 ) ; saveImage ( comp , DiagramType . INHERITANCE , transformer , section ) ; } if ( ! extendedComponents . isEmpty ( ) ) { msg = MessageFormat . format ( this . messages . get ( "component.inherits.properties" ) , comp ) ; // $ NON - NLS - 1 $ section . append ( renderParagraph ( msg ) ) ; section . append ( renderListAsLinks ( ComponentHelpers . extractNames ( extendedComponents ) ) ) ; } if ( ! extendingComponents . isEmpty ( ) ) { msg = MessageFormat . format ( this . messages . get ( "component.is.extended.by" ) , comp ) ; // $ NON - NLS - 1 $ section . append ( renderParagraph ( msg ) ) ; section . append ( renderListAsLinks ( ComponentHelpers . extractNames ( extendingComponents ) ) ) ; } // Exported variables Map < String , String > exportedVariables = ComponentHelpers . findAllExportedVariables ( comp ) ; section . append ( renderTitle3 ( this . messages . get ( "exports" ) ) ) ; // $ NON - NLS - 1 $ if ( exportedVariables . isEmpty ( ) ) { msg = MessageFormat . format ( this . messages . get ( "component.no.export" ) , comp ) ; // $ NON - NLS - 1 $ section . append ( renderParagraph ( msg ) ) ; } else { msg = MessageFormat . format ( this . messages . get ( "component.exports" ) , comp ) ; // $ NON - NLS - 1 $ section . append ( renderParagraph ( msg ) ) ; section . append ( renderList ( convertExports ( exportedVariables ) ) ) ; } // Hierarchy section . append ( renderTitle3 ( this . messages . get ( "hierarchy" ) ) ) ; // $ NON - NLS - 1 $ Collection < AbstractType > ancestors = new ArrayList < > ( ) ; ancestors . addAll ( ComponentHelpers . findAllAncestors ( comp ) ) ; Set < AbstractType > children = new HashSet < > ( ) ; ; children . addAll ( ComponentHelpers . findAllChildren ( comp ) ) ; // For recipes , ancestors and children should include facets if ( this . options . containsKey ( DocConstants . OPTION_RECIPE ) ) { for ( AbstractType type : comp . getAncestors ( ) ) { if ( type instanceof Facet ) { ancestors . add ( type ) ; ancestors . addAll ( ComponentHelpers . findAllExtendingFacets ( ( Facet ) type ) ) ; } } for ( AbstractType type : comp . getChildren ( ) ) { if ( type instanceof Facet ) { children . add ( type ) ; children . addAll ( ComponentHelpers . findAllExtendingFacets ( ( Facet ) type ) ) ; } } } if ( ! ancestors . isEmpty ( ) || ! children . isEmpty ( ) ) { AbstractRoboconfTransformer transformer = new HierarchicalTransformer ( comp , ancestors , children , 4 ) ; saveImage ( comp , DiagramType . HIERARCHY , transformer , section ) ; } if ( ancestors . isEmpty ( ) ) { msg = MessageFormat . format ( this . messages . get ( "component.is.root" ) , comp ) ; // $ NON - NLS - 1 $ section . append ( renderParagraph ( msg ) ) ; } else { msg = MessageFormat . format ( this . messages . get ( "component.over" ) , comp ) ; // $ NON - NLS - 1 $ section . append ( renderParagraph ( msg ) ) ; section . append ( renderListAsLinks ( ComponentHelpers . extractNames ( ancestors ) ) ) ; } if ( ! children . isEmpty ( ) ) { msg = MessageFormat . format ( this . messages . get ( "component.children" ) , comp ) ; // $ NON - NLS - 1 $ section . append ( renderParagraph ( msg ) ) ; section . append ( renderListAsLinks ( ComponentHelpers . extractNames ( children ) ) ) ; } // Runtime section . append ( renderTitle3 ( this . messages . get ( "runtime" ) ) ) ; // $ NON - NLS - 1 $ Collection < ImportedVariable > imports = ComponentHelpers . findAllImportedVariables ( comp ) . values ( ) ; if ( imports . isEmpty ( ) ) { msg = MessageFormat . format ( this . messages . get ( "component.no.dep" ) , comp ) ; // $ NON - NLS - 1 $ section . append ( renderParagraph ( msg ) ) ; } else { msg = MessageFormat . format ( this . messages . get ( "component.depends.on" ) , comp ) ; // $ NON - NLS - 1 $ section . append ( renderParagraph ( msg ) ) ; section . append ( renderList ( getImportComponents ( comp ) ) ) ; msg = MessageFormat . format ( this . messages . get ( "component.requires" ) , comp ) ; // $ NON - NLS - 1 $ section . append ( renderParagraph ( msg ) ) ; section . append ( renderList ( convertImports ( imports ) ) ) ; } // Extra String s = readCustomInformation ( this . applicationDirectory , comp . getName ( ) , DocConstants . COMP_EXTRA ) ; if ( ! Utils . isEmptyOrWhitespaces ( s ) ) { section . append ( renderTitle3 ( this . messages . get ( "extra" ) ) ) ; // $ NON - NLS - 1 $ section . append ( renderParagraph ( s ) ) ; } // End the section section = endSection ( sectionName , section ) ; sb . append ( section ) ; sectionNames . add ( sectionName ) ; } sb . append ( renderSections ( sectionNames ) ) ; return sb ;
public class IosApplicationBundle { /** * The list of device types on which this application can run . */ public List < String > deviceTypes ( ) { } }
Integer count = json ( ) . size ( DEVICE_FAMILIES ) ; List < String > deviceTypes = new ArrayList < String > ( count ) ; for ( int i = 0 ; i < count ; i ++ ) { String familyNumber = json ( ) . stringValue ( DEVICE_FAMILIES , i ) ; if ( familyNumber . equals ( "1" ) ) deviceTypes . add ( "iPhone" ) ; if ( familyNumber . equals ( "2" ) ) deviceTypes . add ( "iPad" ) ; } return deviceTypes ;
public class MultiplePermissionListenerThreadDecorator { /** * Decorates de permission listener execution with a given thread * @ param permissions The permissions that has been requested . Collections of values found in * { @ link android . Manifest . permission } * @ param token Token used to continue or cancel the permission request process . The permission * request process will remain blocked until one of the token methods is called */ @ Override public void onPermissionRationaleShouldBeShown ( final List < PermissionRequest > permissions , final PermissionToken token ) { } }
thread . execute ( new Runnable ( ) { @ Override public void run ( ) { listener . onPermissionRationaleShouldBeShown ( permissions , token ) ; } } ) ;
public class CacheEventDispatcherImpl { /** * { @ inheritDoc } */ @ Override @ SuppressWarnings ( "unchecked" ) public List < CacheConfigurationChangeListener > getConfigurationChangeListeners ( ) { } }
List < CacheConfigurationChangeListener > configurationChangeListenerList = new ArrayList < > ( ) ; configurationChangeListenerList . add ( event -> { if ( event . getProperty ( ) . equals ( CacheConfigurationProperty . ADD_LISTENER ) ) { registerCacheEventListener ( ( EventListenerWrapper < K , V > ) event . getNewValue ( ) ) ; } else if ( event . getProperty ( ) . equals ( CacheConfigurationProperty . REMOVE_LISTENER ) ) { CacheEventListener < ? super K , ? super V > oldListener = ( CacheEventListener < ? super K , ? super V > ) event . getOldValue ( ) ; deregisterCacheEventListener ( oldListener ) ; } } ) ; return configurationChangeListenerList ;
public class SimulatorSettings { /** * Set the Accessibility preferences . Overrides the values in ' com . apple . Accessibility . plist ' file . */ public void setAccessibilityOptions ( ) { } }
// Not enabling ApplicationAccessibility may cause intruments to fail with the error // ScriptAgent [ 1170:2f07 ] Failed to enable accessiblity , kAXErrorServerNotFound // The above error is more prominent in Xcode5.1.1 when tested under OSX 10.9.5 // Setting ApplicationAccessibilityEnabled for Xcode6.0 File folder = new File ( contentAndSettingsFolder + "/Library/Preferences/" ) ; File preferenceFile = new File ( folder , "com.apple.Accessibility.plist" ) ; try { JSONObject preferences = new JSONObject ( ) ; if ( instrumentsVersion . getMajor ( ) < 6 ) { // ex : < key > ApplicationAccessibilityEnabled < / key > < true / > preferences . put ( "ApplicationAccessibilityEnabled" , true ) ; } else { // Xcode6.0 has integer datatype for ApplicationAccessibilityEnabled // ex : < key > ApplicationAccessibilityEnabled < / key > < integer > 1 < / integer > preferences . put ( "ApplicationAccessibilityEnabled" , 1 ) ; } writeOnDisk ( preferences , preferenceFile ) ; } catch ( Exception e ) { throw new WebDriverException ( "cannot set options in " + preferenceFile . getAbsolutePath ( ) , e ) ; }
public class Precision { /** * Returns true if both arguments are equal or within the range of allowed * error ( inclusive ) . * Two float numbers are considered equal if there are { @ code ( maxUlps - 1 ) } * ( or fewer ) floating point numbers between them , i . e . two adjacent * floating point numbers are considered equal . * Adapted from < a * href = " http : / / randomascii . wordpress . com / 2012/02/25 / comparing - floating - point - numbers - 2012 - edition / " > * Bruce Dawson < / a > * @ param x first value * @ param y second value * @ param maxUlps { @ code ( maxUlps - 1 ) } is the number of floating point * values between { @ code x } and { @ code y } . * @ return { @ code true } if there are fewer than { @ code maxUlps } floating * point values between { @ code x } and { @ code y } . */ public static boolean isEquals ( final double x , final double y , final int maxUlps ) { } }
final long xInt = Double . doubleToRawLongBits ( x ) ; final long yInt = Double . doubleToRawLongBits ( y ) ; final boolean isEqual ; if ( ( ( xInt ^ yInt ) & SGN_MASK ) == 0L ) { // number have same sign , there is no risk of overflow isEqual = Math . abs ( xInt - yInt ) <= maxUlps ; } else { // number have opposite signs , take care of overflow final long deltaPlus ; final long deltaMinus ; if ( xInt < yInt ) { deltaPlus = yInt - POSITIVE_ZERO_DOUBLE_BITS ; deltaMinus = xInt - NEGATIVE_ZERO_DOUBLE_BITS ; } else { deltaPlus = xInt - POSITIVE_ZERO_DOUBLE_BITS ; deltaMinus = yInt - NEGATIVE_ZERO_DOUBLE_BITS ; } if ( deltaPlus > maxUlps ) { isEqual = false ; } else { isEqual = deltaMinus <= ( maxUlps - deltaPlus ) ; } } return isEqual && ! Double . isNaN ( x ) && ! Double . isNaN ( y ) ;
public class VersionSet { /** * Get the max range , the min range , and then return a range based on those * values . * UNLESS * there are only a limited number of ranges here , in which case * return them all . * @ see net . ossindex . version . IVersionRange # getSimplifiedRange ( ) */ @ Override public IVersionRange getSimplifiedRange ( ) { } }
if ( set . size ( ) < 5 ) { return this ; } IVersion max = null ; IVersion min = null ; for ( IVersion v : set ) { if ( max == null ) { max = v ; } else { if ( v . compareTo ( max ) > 0 ) { max = v ; } } if ( min == null ) { min = v ; } else { if ( v . compareTo ( min ) < 0 ) { min = v ; } } } return new BoundedVersionRange ( min , max ) ;
public class LoganSquare { /** * Serialize a parameterized object to an OutputStream . * @ param object The object to serialize . * @ param parameterizedType The ParameterizedType describing the object . Ex : LoganSquare . serialize ( object , new ParameterizedType & lt ; MyModel & lt ; OtherModel & gt ; & gt ; ( ) { } , os ) ; * @ param os The OutputStream being written to . */ @ SuppressWarnings ( "unchecked" ) public static < E > void serialize ( E object , ParameterizedType < E > parameterizedType , OutputStream os ) throws IOException { } }
mapperFor ( parameterizedType ) . serialize ( object , os ) ;
public class DeprecatedListWriter { /** * Generate the deprecated API list . * @ param deprapi list of deprecated API built already . * @ throws DocFileIOException if there is a problem writing the deprecated list */ protected void generateDeprecatedListFile ( DeprecatedAPIListBuilder deprapi ) throws DocFileIOException { } }
HtmlTree body = getHeader ( ) ; HtmlTree htmlTree = ( configuration . allowTag ( HtmlTag . MAIN ) ) ? HtmlTree . MAIN ( ) : body ; htmlTree . addContent ( getContentsList ( deprapi ) ) ; String memberTableSummary ; HtmlTree div = new HtmlTree ( HtmlTag . DIV ) ; div . addStyle ( HtmlStyle . contentContainer ) ; for ( DeprElementKind kind : DeprElementKind . values ( ) ) { if ( deprapi . hasDocumentation ( kind ) ) { addAnchor ( deprapi , kind , div ) ; memberTableSummary = resources . getText ( "doclet.Member_Table_Summary" , resources . getText ( getHeadingKey ( kind ) ) , resources . getText ( getSummaryKey ( kind ) ) ) ; List < String > memberTableHeader = new ArrayList < > ( ) ; memberTableHeader . add ( resources . getText ( getHeaderKey ( kind ) ) ) ; memberTableHeader . add ( resources . getText ( "doclet.Description" ) ) ; addDeprecatedAPI ( deprapi . getSet ( kind ) , getHeadingKey ( kind ) , memberTableSummary , memberTableHeader , div ) ; } } if ( configuration . allowTag ( HtmlTag . MAIN ) ) { htmlTree . addContent ( div ) ; body . addContent ( htmlTree ) ; } else { body . addContent ( div ) ; } htmlTree = ( configuration . allowTag ( HtmlTag . FOOTER ) ) ? HtmlTree . FOOTER ( ) : body ; addNavLinks ( false , htmlTree ) ; addBottom ( htmlTree ) ; if ( configuration . allowTag ( HtmlTag . FOOTER ) ) { body . addContent ( htmlTree ) ; } printHtmlDocument ( null , true , body ) ;
public class TypeSafeMatcher { /** * Method made final to prevent accidental override . * If you need to override this , there ' s no point on extending TypeSafeMatcher . * Instead , extend the { @ link BaseMatcher } . */ @ SuppressWarnings ( { } }
"unchecked" } ) public final boolean matches ( Object item ) { return item != null && expectedType . isInstance ( item ) && matchesSafely ( ( T ) item ) ;
public class Geometry { /** * Returns the NESW quadrant the point is in . The delta from the center * NE x > 0 , y < 0 * SE x > 0 , y > = 0 * SW x < = 0 , y > = 0 * NW x < = 0 , y < 0 * @ param cx * @ param cy * * @ param x0 * @ param y0 * @ return */ public static final Direction getQuadrant ( final double cx , final double cy , final double x0 , final double y0 ) { } }
if ( ( x0 > cx ) && ( y0 < cy ) ) { return Direction . NORTH_EAST ; } if ( ( x0 > cx ) && ( y0 >= cy ) ) { return Direction . SOUTH_EAST ; } if ( ( x0 <= cx ) && ( y0 >= cy ) ) { return Direction . SOUTH_WEST ; } // if ( x0 < = c . getX ( ) & & y0 < c . getY ( ) ) return Direction . NORTH_WEST ;
public class ModifyRawHelper { /** * ( non - Javadoc ) * @ see com . abubusoft . kripton . processor . sqlite . SqlModifyBuilder . * ModifyCodeGenerator # generate ( com . squareup . javapoet . TypeSpec . Builder , * com . squareup . javapoet . MethodSpec . Builder , boolean , * com . abubusoft . kripton . processor . sqlite . model . SQLiteModelMethod , * com . squareup . javapoet . TypeName ) */ @ Override public void generate ( TypeSpec . Builder classBuilder , MethodSpec . Builder methodBuilder , boolean updateMode , SQLiteModelMethod method , TypeName returnType ) { } }
SQLiteDaoDefinition daoDefinition = method . getParent ( ) ; SQLiteEntity entity = method . getEntity ( ) ; // separate params used for update bean and params used in // whereCondition // analyze whereCondition String whereCondition = extractWhereConditions ( updateMode , method ) ; // this method is invoked to check if every parameter is binded to an // method param SqlUtility . extractParametersFromString ( method . jql . value , method , entity ) ; Pair < String , List < Pair < String , TypeName > > > where = SqlUtility . extractParametersFromString ( whereCondition , method , entity ) ; // defines which parameter is used like update field and which is used // in where condition . List < Pair < String , TypeName > > methodParams = method . getParameters ( ) ; List < Pair < String , TypeName > > updateableParams = new ArrayList < Pair < String , TypeName > > ( ) ; List < Pair < String , TypeName > > whereParams = new ArrayList < Pair < String , TypeName > > ( ) ; String name ; for ( Pair < String , TypeName > param : methodParams ) { name = method . findParameterAliasByName ( param . value0 ) ; if ( method . isThisDynamicWhereConditionsName ( name ) ) { // skip for dynamic where continue ; } if ( method . isThisDynamicWhereArgsName ( name ) ) { // skip for dynamic where continue ; } if ( where . value1 . contains ( new Pair < > ( name , param . value1 ) ) ) { whereParams . add ( param ) ; } else { updateableParams . add ( param ) ; } } // clear contentValues if ( method . jql . hasDynamicParts ( ) || method . jql . containsSelectOperation ) { methodBuilder . addStatement ( "$T _contentValues=contentValuesForUpdate()" , KriptonContentValues . class ) ; } else { String psName = method . buildPreparedStatementName ( ) ; // generate SQL for insert classBuilder . addField ( FieldSpec . builder ( TypeName . get ( SQLiteStatement . class ) , psName , Modifier . PRIVATE , Modifier . STATIC ) . build ( ) ) ; methodBuilder . beginControlFlow ( "if ($L==null)" , psName ) ; SqlBuilderHelper . generateSQLForStaticQuery ( method , methodBuilder ) ; methodBuilder . addStatement ( "$L = $T.compile(_context, _sql)" , psName , KriptonDatabaseWrapper . class ) ; methodBuilder . endControlFlow ( ) ; methodBuilder . addStatement ( "$T _contentValues=contentValuesForUpdate($L)" , KriptonContentValues . class , psName ) ; } if ( method . jql . containsSelectOperation ) { generateJavaDoc ( method , methodBuilder , updateMode ) ; GenericSQLHelper . generateGenericExecSQL ( methodBuilder , method ) ; } else { // generate javadoc generateJavaDoc ( method , methodBuilder , updateMode , whereCondition , where , methodParams ) ; if ( updateMode ) { // AssertKripton . assertTrueOrInvalidMethodSignException ( updateableParams . size ( ) > 0 , method , " no column was selected for update " ) ; // order item for content values updateableParams = SqlBuilderHelper . orderContentValues ( method , updateableParams ) ; for ( Pair < String , TypeName > item : updateableParams ) { String resolvedParamName = method . findParameterAliasByName ( item . value0 ) ; SQLProperty property = entity . get ( resolvedParamName ) ; if ( property == null ) throw ( new PropertyNotFoundException ( method , resolvedParamName , item . value1 ) ) ; // check same type TypeUtility . checkTypeCompatibility ( method , item , property ) ; // boolean nullable = TypeUtility . isNullable ( method , item , // property ) & & ! property . hasTypeAdapter ( ) ; // if ( nullable ) { // methodBuilder . beginControlFlow ( " if ( $ L ! = null ) " , // item . value0 ) ; // here it needed raw parameter typeName if ( method . isLogEnabled ( ) ) { methodBuilder . addCode ( "_contentValues.put($S, " , property . columnName ) ; } else { methodBuilder . addCode ( "_contentValues.put(" ) ; } SQLTransformer . javaMethodParam2ContentValues ( methodBuilder , method , item . value0 , TypeUtility . typeName ( property . getElement ( ) ) , property ) ; methodBuilder . addCode ( ");\n" ) ; // if ( nullable ) { // methodBuilder . nextControlFlow ( " else " ) ; // if ( method . isLogEnabled ( ) ) { // methodBuilder . addStatement ( " _ contentValues . putNull ( $ S ) " , // property . columnName ) ; // } else { // methodBuilder . addStatement ( " _ contentValues . putNull ( ) " ) ; // methodBuilder . endControlFlow ( ) ; } methodBuilder . addCode ( "\n" ) ; } else { if ( updateableParams . size ( ) > 0 ) { String separator = "" ; StringBuilder buffer = new StringBuilder ( ) ; for ( Pair < String , TypeName > item : updateableParams ) { String resolvedParamName = method . findParameterAliasByName ( item . value0 ) ; buffer . append ( separator + resolvedParamName ) ; separator = ", " ; } // in DELETE can not be updated fields if ( updateableParams . size ( ) > 1 ) { throw ( new InvalidMethodSignException ( method , " parameters " + buffer . toString ( ) + " are not used in where conditions" ) ) ; } else { throw ( new InvalidMethodSignException ( method , " parameter " + buffer . toString ( ) + " is not used in where conditions" ) ) ; } } } // build where condition generateWhereCondition ( methodBuilder , method , where ) ; methodBuilder . addCode ( "\n" ) ; ModifyBeanHelper . generateModifyQueryCommonPart ( method , classBuilder , methodBuilder ) ; // support for livedata if ( daoDefinition . hasLiveData ( ) ) { methodBuilder . addComment ( "support for livedata" ) ; methodBuilder . addStatement ( BindDaoBuilder . METHOD_NAME_REGISTRY_EVENT + "(result)" ) ; } // return management // if true , field must be associate to ben attributes if ( returnType == TypeName . VOID ) { } else { if ( isIn ( returnType , Boolean . TYPE , Boolean . class ) ) { methodBuilder . addStatement ( "return result!=0" ) ; } else if ( isIn ( returnType , Long . TYPE , Long . class , Integer . TYPE , Integer . class , Short . TYPE , Short . class ) ) { methodBuilder . addStatement ( "return result" ) ; } else { // more than one listener found throw ( new InvalidMethodSignException ( method , "invalid return type" ) ) ; } } }
public class Base64 { /** * Decode the byte array . * @ param aEncodedBytes * The encoded byte array . * @ param nOfs * The offset of where to begin decoding * @ param nLen * The number of characters to decode * @ return < code > null < / code > if decoding failed . */ @ Nullable @ ReturnsMutableCopy public static byte [ ] safeDecode ( @ Nullable final byte [ ] aEncodedBytes , @ Nonnegative final int nOfs , @ Nonnegative final int nLen ) { } }
return safeDecode ( aEncodedBytes , nOfs , nLen , DONT_GUNZIP ) ;
public class FastMathCalc { /** * Multiply two numbers in split form . * @ param a first term of multiplication * @ param b second term of multiplication * @ param ans placeholder where to put the result */ private static void splitMult ( double a [ ] , double b [ ] , double ans [ ] ) { } }
ans [ 0 ] = a [ 0 ] * b [ 0 ] ; ans [ 1 ] = a [ 0 ] * b [ 1 ] + a [ 1 ] * b [ 0 ] + a [ 1 ] * b [ 1 ] ; /* Resplit */ resplit ( ans ) ;
public class FreeMarkerRequestHandler { /** * Creates the configuration for freemarker template processing . * @ return the configuration */ protected Configuration freemarkerConfig ( ) { } }
if ( fmConfig == null ) { fmConfig = new Configuration ( Configuration . VERSION_2_3_26 ) ; fmConfig . setClassLoaderForTemplateLoading ( contentLoader , contentPath ) ; fmConfig . setDefaultEncoding ( "utf-8" ) ; fmConfig . setTemplateExceptionHandler ( TemplateExceptionHandler . RETHROW_HANDLER ) ; fmConfig . setLogTemplateExceptions ( false ) ; } return fmConfig ;
public class JVnTextPro { /** * Do sentence segmentation . * @ param text text to have sentences segmented * @ return the string */ public String senSegment ( String text ) { } }
String ret = text ; // Segment sentences if ( vnSenSegmenter != null ) { ret = vnSenSegmenter . senSegment ( text ) ; } return ret . trim ( ) ;
public class AliasDestinationHandler { /** * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . impl . interfaces . DestinationHandler # getDefaultForwardRoutingPath ( ) */ @ Override public SIDestinationAddress [ ] getDefaultForwardRoutingPath ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getDefaultForwardRoutingPath" ) ; SibTr . exit ( tc , "getDefaultForwardRoutingPath" , _defaultFrp ) ; } return _defaultFrp ;
public class TrimWhiteSpaceTag { /** * Truncates whitespace from the given string . * @ todo Candidate for StringUtil ? */ private static String truncateWS ( String pStr ) { } }
char [ ] chars = pStr . toCharArray ( ) ; int count = 0 ; boolean lastWasWS = true ; // Avoids leading WS for ( int i = 0 ; i < chars . length ; i ++ ) { if ( ! Character . isWhitespace ( chars [ i ] ) ) { // if char is not WS , just store chars [ count ++ ] = chars [ i ] ; lastWasWS = false ; } else { // else , if char is WS , store first , skip the rest if ( ! lastWasWS ) { if ( chars [ i ] == 0x0d ) { chars [ count ++ ] = 0x0a ; // Always new line } else { chars [ count ++ ] = chars [ i ] ; } } lastWasWS = true ; } } // Return the trucated string return new String ( chars , 0 , count ) ;
public class PluginManager { /** * Returns in iterator over all available implementations of the given service interface ( SPI ) in all the plugins * known to this plugin manager instance . * @ param service the service interface ( SPI ) for which implementations are requested . * @ param < P > Type of the requested plugin service . * @ return Iterator over all implementations of the given service that could be loaded from all known plugins . */ public < P extends Plugin > Iterator < P > load ( Class < P > service ) { } }
ArrayList < Iterator < P > > combinedIterators = new ArrayList < > ( pluginDescriptors . size ( ) ) ; for ( PluginDescriptor pluginDescriptor : pluginDescriptors ) { PluginLoader pluginLoader = new PluginLoader ( pluginDescriptor , parentClassLoader ) ; combinedIterators . add ( pluginLoader . load ( service ) ) ; } return Iterators . concat ( combinedIterators . iterator ( ) ) ;
public class FactoryMultiView { /** * Used to refine three projective views . This is the same as refining a trifocal tensor . * @ return RefineThreeViewProjective */ public static RefineThreeViewProjective threeViewRefine ( @ Nullable ConfigThreeViewRefine config ) { } }
if ( config == null ) config = new ConfigThreeViewRefine ( ) ; switch ( config . which ) { case GEOMETRIC : RefineThreeViewProjectiveGeometric alg = new RefineThreeViewProjectiveGeometric ( ) ; alg . getConverge ( ) . set ( config . convergence ) ; alg . setScale ( config . normalizePixels ) ; return new WrapRefineThreeViewProjectiveGeometric ( alg ) ; } throw new IllegalArgumentException ( "Unknown algorithm " + config . which ) ;
public class QueryCriteriaUtil { /** * This method is contains the setup steps for creating and assembling { @ link Predicate } instances * from the information in a { @ link List } of { @ link QueryCriteria } instances . * The steps taken when assembling a { @ link Predicate } are the following : * < ol > * < li > Separate the given { @ link List } of { @ link QueryCriteria } into an intersection and disjunction ( union ) list . < / li > * < li > Combine separate " range " { @ link QueryCriteria } that apply to the same listId < / li > * < li > Call the { @ link # createPredicateFromCriteriaList ( CriteriaQuery , List , CriteriaBuilder , Class , boolean ) } * method on disjunction criteria list and on the intersection criteria list < / li > * < li > Take the result of the previous step and appropriately combine the returned { @ link Predicate } instances into a * final { @ link Predicate } instance that is then returned . < / li > * < / ol > * @ param query The { @ link CriteriaQuery } instance that we ' re assembling { @ link Predicate } instances for * @ param inputCriteriaList The list of { @ link QueryCriteria } instances that will be processed * @ param builder A { @ link CriteriaBuilder } instance to help us build { @ link Predicate } instances * @ param resultType The { @ link Class } ( type ) of the result , given so that later methods can use it * @ return A { @ link Predicate } instance based on the given { @ link QueryCriteria } list */ private < R , T > Predicate createPredicateFromCriteriaList ( CriteriaQuery < R > query , CriteriaBuilder builder , Class < T > resultType , List < QueryCriteria > inputCriteriaList , QueryWhere queryWhere ) { } }
Predicate queryPredicate = null ; if ( inputCriteriaList . size ( ) > 1 ) { List < Predicate > predicateList = new LinkedList < Predicate > ( ) ; QueryCriteria previousCriteria = null ; QueryCriteria firstCriteria = null ; List < QueryCriteria > currentIntersectingCriteriaList = new LinkedList < QueryCriteria > ( ) ; int i = 0 ; for ( QueryCriteria criteria : inputCriteriaList ) { assert i ++ != 0 || criteria . isFirst ( ) : "First criteria is not flagged as first!" ; if ( criteria . isFirst ( ) ) { firstCriteria = previousCriteria = criteria ; continue ; } else if ( firstCriteria != null ) { if ( criteria . isUnion ( ) ) { Predicate predicate = createPredicateFromSingleOrGroupCriteria ( query , builder , resultType , previousCriteria , queryWhere ) ; predicateList . add ( predicate ) ; } else { currentIntersectingCriteriaList . add ( firstCriteria ) ; } firstCriteria = null ; } if ( criteria . isUnion ( ) ) { // AND has precedence over OR : // If ' criteria ' is now OR and there was a list ( currentIntersectingCriteriaList ) of AND criteria before ' criteria ' // - create a predicate from the AND criteria if ( previousCriteria != null && ! previousCriteria . isUnion ( ) && ! currentIntersectingCriteriaList . isEmpty ( ) ) { Predicate predicate = createPredicateFromIntersectingCriteriaList ( query , builder , resultType , currentIntersectingCriteriaList , queryWhere ) ; assert predicate != null : "Null predicate when evaluating intersecting criteria [" + criteria . toString ( ) + "]" ; predicateList . add ( predicate ) ; // - new ( empty ) current intersecting criteria list currentIntersectingCriteriaList = new LinkedList < QueryCriteria > ( ) ; } // Process the current union criteria Predicate predicate = createPredicateFromSingleOrGroupCriteria ( query , builder , resultType , criteria , queryWhere ) ; assert predicate != null : "Null predicate when evaluating union criteria [" + criteria . toString ( ) + "]" ; predicateList . add ( predicate ) ; } else { currentIntersectingCriteriaList . add ( criteria ) ; } previousCriteria = criteria ; } if ( ! currentIntersectingCriteriaList . isEmpty ( ) ) { Predicate predicate = createPredicateFromIntersectingCriteriaList ( query , builder , resultType , currentIntersectingCriteriaList , queryWhere ) ; predicateList . add ( predicate ) ; } assert ! predicateList . isEmpty ( ) : "The predicate list should not (can not?) be empty here!" ; if ( predicateList . size ( ) == 1 ) { queryPredicate = predicateList . get ( 0 ) ; } else { Predicate [ ] predicates = predicateList . toArray ( new Predicate [ predicateList . size ( ) ] ) ; queryPredicate = builder . or ( predicates ) ; } } else if ( inputCriteriaList . size ( ) == 1 ) { QueryCriteria singleCriteria = inputCriteriaList . get ( 0 ) ; queryPredicate = createPredicateFromSingleOrGroupCriteria ( query , builder , resultType , singleCriteria , queryWhere ) ; } return queryPredicate ;
public class CaseRule { private boolean isPrevProbablyRelativePronoun ( AnalyzedTokenReadings [ ] tokens , int i ) { } }
return i >= 3 && tokens [ i - 1 ] . getToken ( ) . equals ( "das" ) && tokens [ i - 2 ] . getToken ( ) . equals ( "," ) && tokens [ i - 3 ] . matchesPosTagRegex ( "SUB:...:SIN:NEU" ) ;
public class WebSocketClientEndpointConfiguration { /** * Creates new client web socket handler by opening a new socket connection to server . * @ param url * @ return */ private CitrusWebSocketHandler getWebSocketClientHandler ( String url ) { } }
CitrusWebSocketHandler handler = new CitrusWebSocketHandler ( ) ; if ( webSocketHttpHeaders == null ) { webSocketHttpHeaders = new WebSocketHttpHeaders ( ) ; webSocketHttpHeaders . setSecWebSocketExtensions ( Collections . singletonList ( new StandardToWebSocketExtensionAdapter ( new JsrExtension ( new PerMessageDeflateExtension ( ) . getName ( ) ) ) ) ) ; } ListenableFuture < WebSocketSession > future = client . doHandshake ( handler , webSocketHttpHeaders , UriComponentsBuilder . fromUriString ( url ) . buildAndExpand ( ) . encode ( ) . toUri ( ) ) ; try { future . get ( ) ; } catch ( Exception e ) { String errMsg = String . format ( "Failed to connect to Web Socket server - '%s'" , url ) ; LOG . error ( errMsg ) ; throw new CitrusRuntimeException ( errMsg ) ; } return handler ;
public class Validate { /** * Checks if the given boolean expression evaluates to < code > false < / code > . * @ param expression The expression to evaluate . * @ throws ParameterException if the given expression does not evaluate to < code > false < / code > . */ public static void isFalse ( Boolean expression ) { } }
if ( ! validation ) return ; notNull ( expression ) ; if ( expression ) throw new ParameterException ( ErrorCode . CONSTRAINT ) ;
public class ValidationMatcherLibrary { /** * Does this library know a validationMatcher with the given name . * @ param validationMatcherName name to search for . * @ return boolean flag to mark existence . */ public boolean knowsValidationMatcher ( String validationMatcherName ) { } }
// custom libraries : if ( validationMatcherName . contains ( ":" ) ) { String validationMatcherPrefix = validationMatcherName . substring ( 0 , validationMatcherName . indexOf ( ':' ) + 1 ) ; if ( ! validationMatcherPrefix . equals ( prefix ) ) { return false ; } return members . containsKey ( validationMatcherName . substring ( validationMatcherName . indexOf ( ':' ) + 1 , validationMatcherName . indexOf ( '(' ) ) ) ; } else { // standard citrus - library without prefix : return members . containsKey ( validationMatcherName . substring ( 0 , validationMatcherName . indexOf ( '(' ) ) ) ; }
public class ClassReplicaCreator { /** * Create a class that is a replica of type { @ code T } . To allow for * partial mocking all calls to non - mocked methods will be delegated to the * { @ code delegator } . * @ param < T > The type of the replica class to be created . * @ param delegator The delegator object that will be invoked to allow for partial * mocking . * @ return A replica class that can be used to duck - type an instance . */ @ SuppressWarnings ( "unchecked" ) public < T > Class < T > createInstanceReplica ( T delegator ) { } }
if ( delegator == null ) { throw new IllegalArgumentException ( "delegator cannot be null" ) ; } final Class < T > clazz = ( Class < T > ) delegator . getClass ( ) ; ClassPool classpool = ClassPool . getDefault ( ) ; final String originalClassName = clazz . getName ( ) ; CtClass originalClassAsCtClass ; final CtClass newClass = classpool . makeClass ( generateReplicaClassName ( clazz ) ) ; try { originalClassAsCtClass = classpool . get ( originalClassName ) ; copyFields ( originalClassAsCtClass , newClass ) ; addDelegatorField ( delegator , newClass ) ; CtMethod [ ] declaredMethods = originalClassAsCtClass . getDeclaredMethods ( ) ; for ( CtMethod ctMethod : declaredMethods ) { @ SuppressWarnings ( "unused" ) final String code = getReplicaMethodDelegationCode ( delegator . getClass ( ) , ctMethod , POWERMOCK_INSTANCE_DELEGATOR_FIELD_NAME ) ; CtMethod make2 = CtNewMethod . copy ( ctMethod , newClass , null ) ; newClass . addMethod ( make2 ) ; } CtConstructor [ ] declaredConstructors = originalClassAsCtClass . getDeclaredConstructors ( ) ; for ( CtConstructor ctConstructor : declaredConstructors ) { CtConstructor copy = CtNewConstructor . copy ( ctConstructor , newClass , null ) ; newClass . addConstructor ( copy ) ; } return ( Class < T > ) newClass . toClass ( this . getClass ( ) . getClassLoader ( ) , this . getClass ( ) . getProtectionDomain ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class SalesforceRestWriter { /** * Retrieve access token , if needed , retrieve instance url , and set server host URL * { @ inheritDoc } * @ see org . apache . gobblin . writer . http . HttpWriter # onConnect ( org . apache . http . HttpHost ) */ @ Override public void onConnect ( URI serverHost ) throws IOException { } }
if ( ! StringUtils . isEmpty ( accessToken ) ) { return ; // No need to be called if accessToken is active . } try { getLog ( ) . info ( "Getting Oauth2 access token." ) ; OAuthClientRequest request = OAuthClientRequest . tokenLocation ( serverHost . toString ( ) ) . setGrantType ( GrantType . PASSWORD ) . setClientId ( clientId ) . setClientSecret ( clientSecret ) . setUsername ( userId ) . setPassword ( password + securityToken ) . buildQueryMessage ( ) ; OAuthClient client = new OAuthClient ( new URLConnectionClient ( ) ) ; OAuthJSONAccessTokenResponse response = client . accessToken ( request , OAuth . HttpMethod . POST ) ; accessToken = response . getAccessToken ( ) ; setCurServerHost ( new URI ( response . getParam ( "instance_url" ) ) ) ; } catch ( OAuthProblemException e ) { throw new NonTransientException ( "Error while authenticating with Oauth2" , e ) ; } catch ( OAuthSystemException e ) { throw new RuntimeException ( "Failed getting access token" , e ) ; } catch ( URISyntaxException e ) { throw new RuntimeException ( "Failed due to invalid instance url" , e ) ; }
public class NodeWriteTrx { /** * { @ inheritDoc } */ @ Override public long insertTextAsRightSibling ( final String pValue ) throws TTException { } }
checkState ( ! mDelegate . isClosed ( ) , "Transaction is already closed." ) ; checkNotNull ( pValue ) ; checkState ( mDelegate . getCurrentNode ( ) instanceof ElementNode , "Insert is not allowed if current node is not an ElementNode, but was %s" , mDelegate . getCurrentNode ( ) ) ; final byte [ ] value = TypedValue . getBytes ( pValue ) ; final long parentKey = mDelegate . getCurrentNode ( ) . getParentKey ( ) ; final long leftSibKey = mDelegate . getCurrentNode ( ) . getDataKey ( ) ; final long rightSibKey = ( ( ITreeStructData ) mDelegate . getCurrentNode ( ) ) . getRightSiblingKey ( ) ; final TextNode node = createTextNode ( parentKey , leftSibKey , rightSibKey , value ) ; mDelegate . setCurrentNode ( node ) ; adaptForInsert ( node , false ) ; adaptHashesWithAdd ( ) ; return node . getDataKey ( ) ;
public class MapView { /** * Deferred setting of the expected next map center computed by the Projection ' s constructor , * with no guarantee it will be 100 % respected . * < a href = " https : / / github . com / osmdroid / osmdroid / issues / 868 " > see issue 868 < / a > * @ since 6.0.3 */ public void setExpectedCenter ( final IGeoPoint pGeoPoint , final long pOffsetX , final long pOffsetY ) { } }
final GeoPoint before = getProjection ( ) . getCurrentCenter ( ) ; mCenter = ( GeoPoint ) pGeoPoint ; setMapScroll ( - pOffsetX , - pOffsetY ) ; resetProjection ( ) ; final GeoPoint after = getProjection ( ) . getCurrentCenter ( ) ; if ( ! after . equals ( before ) ) { ScrollEvent event = null ; for ( MapListener mapListener : mListners ) { mapListener . onScroll ( event != null ? event : ( event = new ScrollEvent ( this , 0 , 0 ) ) ) ; } } invalidate ( ) ;
public class DescribeAddressesRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeAddressesRequest describeAddressesRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeAddressesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeAddressesRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( describeAddressesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DrizzleStatement { /** * Executes an update . * @ param query the update query . * @ return update count * @ throws SQLException if the query could not be sent to server . */ public int executeUpdate ( final String query ) throws SQLException { } }
startTimer ( ) ; try { if ( queryResult != null ) { queryResult . close ( ) ; } warningsCleared = false ; if ( inputStream == null ) queryResult = protocol . executeQuery ( queryFactory . createQuery ( query ) ) ; else queryResult = protocol . executeQuery ( queryFactory . createQuery ( query ) , inputStream ) ; return ( int ) ( ( ModifyQueryResult ) queryResult ) . getUpdateCount ( ) ; } catch ( QueryException e ) { throw SQLExceptionMapper . get ( e ) ; } finally { stopTimer ( ) ; if ( inputStream != null ) { try { inputStream . close ( ) ; } catch ( IOException e ) { } inputStream = null ; } }
public class QueryBuilder { /** * Create a less than expression * @ param propertyName The propery name * @ param value The value * @ return The query expression */ public QueryExpression lt ( String propertyName , String value ) { } }
return new SimpleQueryExpression ( propertyName , ComparisonOperator . LESS_THAN , wrap ( value ) ) ;
public class YoloUtils { /** * Returns overlap between lines [ x1 , x2 ] and [ x3 . x4 ] . */ public static double overlap ( double x1 , double x2 , double x3 , double x4 ) { } }
if ( x3 < x1 ) { if ( x4 < x1 ) { return 0 ; } else { return Math . min ( x2 , x4 ) - x1 ; } } else { if ( x2 < x3 ) { return 0 ; } else { return Math . min ( x2 , x4 ) - x3 ; } }
public class Encoder { /** * get the value of that named property */ @ Override public Object getMember ( String name ) { } }
switch ( name ) { case "schema" : return F_schema ; case "clsTag" : return F_clsTag ; } return super . getMember ( name ) ;
public class NotificationEntry { /** * Set a action to be fired when this notification gets canceled . * @ param listener * @ param extra */ public void setCancelAction ( Action . OnActionListener listener , Bundle extra ) { } }
setCancelAction ( listener , null , null , null , extra ) ;
public class Rectangle { /** * Sets the rectangle to be an exact copy of the provided one . * @ param rectangle The rectangle to copy */ public void set ( Rectangle rectangle ) { } }
set ( rectangle . getX ( ) , rectangle . getY ( ) , rectangle . getWidth ( ) , rectangle . getHeight ( ) ) ;
public class SQLUtils { /** * 生成insert into ( . . . ) select ? , ? , ? from where not exists ( select 1 from where ) 语句 * @ param t * @ param values * @ param whereSql * @ return */ public static < T > String getInsertWhereNotExistSQL ( T t , List < Object > values , boolean isWithNullValue , String whereSql ) { } }
StringBuilder sql = new StringBuilder ( "INSERT INTO " ) ; Table table = DOInfoReader . getTable ( t . getClass ( ) ) ; List < Field > fields = DOInfoReader . getColumns ( t . getClass ( ) ) ; sql . append ( getTableName ( table ) ) . append ( " (" ) ; sql . append ( joinAndGetValue ( fields , "," , values , t , isWithNullValue ) ) ; sql . append ( ") select " ) ; sql . append ( join ( "?" , values . size ( ) , "," ) ) ; sql . append ( " from dual where not exists (select 1 from " ) ; if ( ! whereSql . trim ( ) . toUpperCase ( ) . startsWith ( "WHERE " ) ) { whereSql = "where " + whereSql ; } whereSql = autoSetSoftDeleted ( whereSql , t . getClass ( ) ) ; sql . append ( getTableName ( table ) ) . append ( " " ) . append ( whereSql ) . append ( " limit 1)" ) ; return sql . toString ( ) ;
public class ConicalGradientPaint { /** * Recalculates the fractions in the FRACTION _ LIST and their associated colors in the COLOR _ LIST with a given OFFSET . * Because the conical gradients always starts with 0 at the top and clockwise direction * you could rotate the defined conical gradient from - 180 to 180 degrees which equals values from - 0.5 to + 0.5 * @ param fractionList * @ param colorList * @ param OFFSET * @ return Hashmap that contains the recalculated fractions and colors after a given rotation */ private java . util . HashMap < Float , Color > recalculate ( final List < Float > fractionList , final List < Color > colorList , final float OFFSET ) { } }
// Recalculate the fractions and colors with the given offset final int MAX_FRACTIONS = fractionList . size ( ) ; final HashMap < Float , Color > fractionColors = new HashMap < Float , Color > ( MAX_FRACTIONS ) ; for ( int i = 0 ; i < MAX_FRACTIONS ; i ++ ) { // Add offset to fraction final float TMP_FRACTION = fractionList . get ( i ) + OFFSET ; // Color related to current fraction final Color TMP_COLOR = colorList . get ( i ) ; // Check each fraction for limits ( 0 . . . 1) if ( TMP_FRACTION <= 0 ) { fractionColors . put ( 1.0f + TMP_FRACTION + 0.0001f , TMP_COLOR ) ; final float NEXT_FRACTION ; final Color NEXT_COLOR ; if ( i < MAX_FRACTIONS - 1 ) { NEXT_FRACTION = fractionList . get ( i + 1 ) + OFFSET ; NEXT_COLOR = colorList . get ( i + 1 ) ; } else { NEXT_FRACTION = 1 - fractionList . get ( 0 ) + OFFSET ; NEXT_COLOR = colorList . get ( 0 ) ; } if ( NEXT_FRACTION > 0 ) { final Color NEW_FRACTION_COLOR = getColorFromFraction ( TMP_COLOR , NEXT_COLOR , ( int ) ( ( NEXT_FRACTION - TMP_FRACTION ) * 10000 ) , ( int ) ( ( - TMP_FRACTION ) * 10000 ) ) ; fractionColors . put ( 0.0f , NEW_FRACTION_COLOR ) ; fractionColors . put ( 1.0f , NEW_FRACTION_COLOR ) ; } } else if ( TMP_FRACTION >= 1 ) { fractionColors . put ( TMP_FRACTION - 1.0f - 0.0001f , TMP_COLOR ) ; final float PREVIOUS_FRACTION ; final Color PREVIOUS_COLOR ; if ( i > 0 ) { PREVIOUS_FRACTION = fractionList . get ( i - 1 ) + OFFSET ; PREVIOUS_COLOR = colorList . get ( i - 1 ) ; } else { PREVIOUS_FRACTION = fractionList . get ( MAX_FRACTIONS - 1 ) + OFFSET ; PREVIOUS_COLOR = colorList . get ( MAX_FRACTIONS - 1 ) ; } if ( PREVIOUS_FRACTION < 1 ) { final Color NEW_FRACTION_COLOR = getColorFromFraction ( TMP_COLOR , PREVIOUS_COLOR , ( int ) ( ( TMP_FRACTION - PREVIOUS_FRACTION ) * 10000 ) , ( int ) ( TMP_FRACTION - 1.0f ) * 10000 ) ; fractionColors . put ( 1.0f , NEW_FRACTION_COLOR ) ; fractionColors . put ( 0.0f , NEW_FRACTION_COLOR ) ; } } else { fractionColors . put ( TMP_FRACTION , TMP_COLOR ) ; } } // Clear the original FRACTION _ LIST and COLOR _ LIST fractionList . clear ( ) ; colorList . clear ( ) ; return fractionColors ;
public class IndexActionRepositoryDecorator { /** * Register index actions for the given entity for entity types with bidirectional attribute * values . * @ param entity entity to add or delete */ private void registerRefEntityIndexActions ( Entity entity ) { } }
// bidirectional attribute : register indexing actions for other side getEntityType ( ) . getMappedByAttributes ( ) . forEach ( mappedByAttr -> { EntityType mappedByAttrRefEntity = mappedByAttr . getRefEntity ( ) ; entity . getEntities ( mappedByAttr . getName ( ) ) . forEach ( refEntity -> indexActionRegisterService . register ( mappedByAttrRefEntity , refEntity . getIdValue ( ) ) ) ; } ) ; getEntityType ( ) . getInversedByAttributes ( ) . forEach ( inversedByAttr -> { Entity refEntity = entity . getEntity ( inversedByAttr . getName ( ) ) ; if ( refEntity != null ) { EntityType inversedByAttrRefEntity = inversedByAttr . getRefEntity ( ) ; indexActionRegisterService . register ( inversedByAttrRefEntity , refEntity . getIdValue ( ) ) ; } } ) ;
public class Strings { /** * Capitalize the given { @ link String } : " input " - > " Input " */ public static String capitalize ( final String input ) { } }
if ( ( input == null ) || ( input . length ( ) == 0 ) ) { return input ; } return input . substring ( 0 , 1 ) . toUpperCase ( ) + input . substring ( 1 ) ;
public class PodLocalImpl { /** * void addPod ( PodBartenderImpl pod ) * String name = pod . getId ( ) + ' . ' + pod . getClusterId ( ) ; * PodBartenderImpl oldPod = _ podMap . get ( name ) ; * if ( oldPod ! = null & & pod . getSequence ( ) < oldPod . getSequence ( ) ) { * return ; * _ podMap . put ( name , pod ) ; * PodBartenderProxy proxy = _ proxyMap . get ( name ) ; * if ( proxy ! = null ) { * proxy . setDelegate ( pod ) ; * _ updatePodSystem = new UpdatePodSystem ( _ podMap . values ( ) ) ; * _ heartbeatService . updatePod ( _ updatePodSystem ) ; * onUpdatePod ( pod ) ; */ ServerHeartbeat createServer ( String serverId ) { } }
int p = serverId . indexOf ( ':' ) ; String address = serverId . substring ( 0 , p ) ; int port = Integer . parseInt ( serverId . substring ( p + 1 ) ) ; boolean isSSL = false ; return _heartbeatService . createServer ( address , port , isSSL ) ;
public class SignUtil { /** * 将byte数组变为16进制对应的字符串 * @ param byteArray byte数组 * @ return 转换结果 */ private static String byteToStr ( byte [ ] byteArray ) { } }
int len = byteArray . length ; StringBuilder strDigest = new StringBuilder ( len * 2 ) ; for ( byte aByteArray : byteArray ) { strDigest . append ( byteToHexStr ( aByteArray ) ) ; } return strDigest . toString ( ) ;
public class FineUploader5Resume { /** * Sent with the first request of the resume with a value of true . * @ param sParamNameResuming * New value . May neither be < code > null < / code > nor empty . * @ return this for chaining */ @ Nonnull public FineUploader5Resume setParamNameResuming ( @ Nonnull @ Nonempty final String sParamNameResuming ) { } }
ValueEnforcer . notEmpty ( sParamNameResuming , "ParamNameResuming" ) ; m_sResumeParamNamesResuming = sParamNameResuming ; return this ;
public class ClusterSyncManager { /** * Called from ClusterSyncManagerLeaderListener * @ throws Exception */ public String initializedGroupStatus ( ) throws Exception { } }
String status = null ; if ( clusteringEnabled ) { initClusterNodeStatus ( ) ; status = updateNodeStatus ( ) ; } return status ;
public class ReactionSetManipulator { /** * Get all Reactions object containing a Molecule as a Reactant from a set * of Reactions . * @ param reactSet The set of reaction to inspect * @ param molecule The molecule to find as a reactant * @ return The IReactionSet */ public static IReactionSet getRelevantReactionsAsReactant ( IReactionSet reactSet , IAtomContainer molecule ) { } }
IReactionSet newReactSet = reactSet . getBuilder ( ) . newInstance ( IReactionSet . class ) ; for ( IReaction reaction : reactSet . reactions ( ) ) { for ( IAtomContainer atomContainer : reaction . getReactants ( ) . atomContainers ( ) ) if ( atomContainer . equals ( molecule ) ) newReactSet . addReaction ( reaction ) ; } return newReactSet ;
public class AuditUtils { /** * Creates an audit entry for the ' plan version updated ' event . * @ param bean the bean * @ param data the updated data * @ param securityContext the security context * @ return the audit entry */ public static AuditEntryBean planVersionUpdated ( PlanVersionBean bean , EntityUpdatedData data , ISecurityContext securityContext ) { } }
if ( data . getChanges ( ) . isEmpty ( ) ) { return null ; } AuditEntryBean entry = newEntry ( bean . getPlan ( ) . getOrganization ( ) . getId ( ) , AuditEntityType . Plan , securityContext ) ; entry . setEntityId ( bean . getPlan ( ) . getId ( ) ) ; entry . setEntityVersion ( bean . getVersion ( ) ) ; entry . setWhat ( AuditEntryType . Update ) ; entry . setData ( toJSON ( data ) ) ; return entry ;
public class OverrideConfiguration { /** * Config table ' s schema by TableNamingStrategy . < br > * @ see org . beangle . orm . hibernate . RailsNamingStrategy */ private void configSchema ( ) { } }
TableNamingStrategy namingStrategy = null ; if ( getNamingStrategy ( ) instanceof RailsNamingStrategy ) { namingStrategy = ( ( RailsNamingStrategy ) getNamingStrategy ( ) ) . getTableNamingStrategy ( ) ; } if ( null == namingStrategy ) return ; else { // Update SeqGenerator ' s static variable . // Because generator is init by hibernate , cannot inject namingStrategy . TableSeqGenerator . namingStrategy = namingStrategy ; } if ( namingStrategy . isMultiSchema ( ) ) { for ( PersistentClass clazz : classes . values ( ) ) { if ( Strings . isEmpty ( clazz . getTable ( ) . getSchema ( ) ) ) { String schema = namingStrategy . getSchema ( clazz . getEntityName ( ) ) ; if ( null != schema ) clazz . getTable ( ) . setSchema ( schema ) ; } } for ( Collection collection : collections . values ( ) ) { final Table table = collection . getCollectionTable ( ) ; if ( null == table ) continue ; if ( Strings . isBlank ( table . getSchema ( ) ) ) { String schema = namingStrategy . getSchema ( collection . getOwnerEntityName ( ) ) ; if ( null != schema ) table . setSchema ( schema ) ; } } }
public class ModelsImpl { /** * Gets information about the hierarchical entity models . * @ param appId The application ID . * @ param versionId The version ID . * @ param listHierarchicalEntitiesOptionalParameter the object representing the optional parameters to be set before calling this API * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the List & lt ; HierarchicalEntityExtractor & gt ; object */ public Observable < ServiceResponse < List < HierarchicalEntityExtractor > > > listHierarchicalEntitiesWithServiceResponseAsync ( UUID appId , String versionId , ListHierarchicalEntitiesOptionalParameter listHierarchicalEntitiesOptionalParameter ) { } }
if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( versionId == null ) { throw new IllegalArgumentException ( "Parameter versionId is required and cannot be null." ) ; } final Integer skip = listHierarchicalEntitiesOptionalParameter != null ? listHierarchicalEntitiesOptionalParameter . skip ( ) : null ; final Integer take = listHierarchicalEntitiesOptionalParameter != null ? listHierarchicalEntitiesOptionalParameter . take ( ) : null ; return listHierarchicalEntitiesWithServiceResponseAsync ( appId , versionId , skip , take ) ;
public class Jar { /** * Writes this JAR to a file . */ public Path write ( Path path ) throws IOException { } }
write ( Files . newOutputStream ( path ) ) ; return path ;
public class Token { /** * How many characters are needed ? */ final int getMinLength ( ) { } }
switch ( this . type ) { case CONCAT : int sum = 0 ; for ( int i = 0 ; i < this . size ( ) ; i ++ ) sum += this . getChild ( i ) . getMinLength ( ) ; return sum ; case CONDITION : case UNION : if ( this . size ( ) == 0 ) return 0 ; int ret = this . getChild ( 0 ) . getMinLength ( ) ; for ( int i = 1 ; i < this . size ( ) ; i ++ ) { int min = this . getChild ( i ) . getMinLength ( ) ; if ( min < ret ) ret = min ; } return ret ; case CLOSURE : case NONGREEDYCLOSURE : if ( this . getMin ( ) >= 0 ) return this . getMin ( ) * this . getChild ( 0 ) . getMinLength ( ) ; return 0 ; case EMPTY : case ANCHOR : return 0 ; case DOT : case CHAR : case RANGE : case NRANGE : return 1 ; case INDEPENDENT : case PAREN : case MODIFIERGROUP : return this . getChild ( 0 ) . getMinLength ( ) ; case BACKREFERENCE : return 0 ; case STRING : return this . getString ( ) . length ( ) ; case LOOKAHEAD : case NEGATIVELOOKAHEAD : case LOOKBEHIND : case NEGATIVELOOKBEHIND : return 0 ; // * * * * * Really ? default : throw new RuntimeException ( "Token#getMinLength(): Invalid Type: " + this . type ) ; }
public class AWSCognitoIdentityProviderClient { /** * Gets the user pool multi - factor authentication ( MFA ) configuration . * @ param getUserPoolMfaConfigRequest * @ return Result of the GetUserPoolMfaConfig operation returned by the service . * @ throws InvalidParameterException * This exception is thrown when the Amazon Cognito service encounters an invalid parameter . * @ throws TooManyRequestsException * This exception is thrown when the user has made too many requests for a given operation . * @ throws ResourceNotFoundException * This exception is thrown when the Amazon Cognito service cannot find the requested resource . * @ throws NotAuthorizedException * This exception is thrown when a user is not authorized . * @ throws InternalErrorException * This exception is thrown when Amazon Cognito encounters an internal error . * @ sample AWSCognitoIdentityProvider . GetUserPoolMfaConfig * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - idp - 2016-04-18 / GetUserPoolMfaConfig " * target = " _ top " > AWS API Documentation < / a > */ @ Override public GetUserPoolMfaConfigResult getUserPoolMfaConfig ( GetUserPoolMfaConfigRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetUserPoolMfaConfig ( request ) ;
public class AnnualDate { /** * / * [ deutsch ] * < p > Konvertiert das angegebene gregorianische Datum zu einem Jahrestag . < / p > * @ param date gregorian calendar date ( for example { @ code PlainDate } * @ return AnnualDate * @ throws IllegalArgumentException if given date is invalid * @ since 3.28/4.24 */ public static AnnualDate from ( GregorianDate date ) { } }
PlainDate iso = PlainDate . from ( date ) ; // includes validation return new AnnualDate ( iso . getMonth ( ) , iso . getDayOfMonth ( ) ) ;
public class GrammarConverter { /** * This method converts the token definitions to the token definition set . * @ throws GrammarException * @ throws TreeException */ private void convertTokenDefinitions ( ) throws GrammarException , TreeException { } }
tokenVisibility . clear ( ) ; Map < String , ParseTreeNode > helpers = getHelperTokens ( ) ; Map < String , ParseTreeNode > tokens = getTokens ( ) ; convertTokenDefinitions ( helpers , tokens ) ;
public class Eureka { /** * This is the entry point method . */ public void onModuleLoad ( ) { } }
DockPanel dock = new DockPanel ( ) ; dock . addStyleName ( "mainBackground" ) ; dock . setWidth ( "700px" ) ; dock . setHeight ( "300px" ) ; dock . setHorizontalAlignment ( HasHorizontalAlignment . ALIGN_CENTER ) ; dock . setVerticalAlignment ( HasVerticalAlignment . ALIGN_TOP ) ; dock . add ( createHeader ( ) , DockPanel . NORTH ) ; // Time Picker Examples dock . add ( createTimePicker ( ) , DockPanel . WEST ) ; // Time Picker Small Examples dock . add ( createSmallTimePicker ( ) , DockPanel . WEST ) ; // iOSButton Examples dock . add ( createIOSButton ( ) , DockPanel . WEST ) ; // DatePicker Examples dock . add ( createDatePicker ( ) , DockPanel . WEST ) ; RootPanel . get ( ) . add ( dock ) ;
public class CmsDriverManager { /** * Creates a new sibling of the source resource . < p > * @ param dbc the current database context * @ param source the resource to create a sibling for * @ param destination the name of the sibling to create with complete path * @ param properties the individual properties for the new sibling * @ return the new created sibling * @ throws CmsException if something goes wrong * @ see CmsObject # createSibling ( String , String , List ) * @ see I _ CmsResourceType # createSibling ( CmsObject , CmsSecurityManager , CmsResource , String , List ) */ public CmsResource createSibling ( CmsDbContext dbc , CmsResource source , String destination , List < CmsProperty > properties ) throws CmsException { } }
if ( source . isFolder ( ) ) { throw new CmsVfsException ( Messages . get ( ) . container ( Messages . ERR_VFS_FOLDERS_DONT_SUPPORT_SIBLINGS_0 ) ) ; } // determine destination folder and resource name String destinationFoldername = CmsResource . getParentFolder ( destination ) ; // read the destination folder ( will also check read permissions ) CmsFolder destinationFolder = readFolder ( dbc , destinationFoldername , CmsResourceFilter . IGNORE_EXPIRATION ) ; // no further permission check required here , will be done in createResource ( ) // check the resource flags int flags = source . getFlags ( ) ; if ( labelResource ( dbc , source , destination , 1 ) ) { // set " labeled " link flag for new resource flags |= CmsResource . FLAG_LABELED ; } // create the new resource CmsResource newResource = new CmsResource ( new CmsUUID ( ) , source . getResourceId ( ) , destination , source . getTypeId ( ) , source . isFolder ( ) , flags , dbc . currentProject ( ) . getUuid ( ) , CmsResource . STATE_KEEP , source . getDateCreated ( ) , // ensures current resource record remains untouched source . getUserCreated ( ) , source . getDateLastModified ( ) , source . getUserLastModified ( ) , source . getDateReleased ( ) , source . getDateExpired ( ) , source . getSiblingCount ( ) + 1 , source . getLength ( ) , source . getDateContent ( ) , source . getVersion ( ) ) ; // version number does not matter since it will be computed later // trigger " is touched " state on resource ( will ensure modification date is kept unchanged ) newResource . setDateLastModified ( newResource . getDateLastModified ( ) ) ; log ( dbc , new CmsLogEntry ( dbc , newResource . getStructureId ( ) , CmsLogEntryType . RESOURCE_CLONED , new String [ ] { newResource . getRootPath ( ) } ) , false ) ; // create the resource ( null content signals creation of sibling ) newResource = createResource ( dbc , destination , newResource , null , properties , false ) ; // copy relations copyRelations ( dbc , source , newResource ) ; // clear the caches m_monitor . clearAccessControlListCache ( ) ; List < CmsResource > modifiedResources = new ArrayList < CmsResource > ( ) ; modifiedResources . add ( source ) ; modifiedResources . add ( newResource ) ; modifiedResources . add ( destinationFolder ) ; OpenCms . fireCmsEvent ( new CmsEvent ( I_CmsEventListener . EVENT_RESOURCES_AND_PROPERTIES_MODIFIED , Collections . < String , Object > singletonMap ( I_CmsEventListener . KEY_RESOURCES , modifiedResources ) ) ) ; return newResource ;
public class ClientBlobStore { /** * Client facing API to set the metadata for a blob . * @ param key blob key name . * @ param meta contains ACL information . * @ throws AuthorizationException * @ throws KeyNotFoundException */ public final void setBlobMeta ( String key , SettableBlobMeta meta ) throws AuthorizationException , KeyNotFoundException { } }
setBlobMetaToExtend ( key , meta ) ;
public class ManagementXml_5 { /** * The users element defines users within the domain model , it is a simple authentication for some out of the box users . */ private void parseUsersAuthentication ( final XMLExtendedStreamReader reader , final ModelNode realmAddress , final List < ModelNode > list ) throws XMLStreamException { } }
final ModelNode usersAddress = realmAddress . clone ( ) . add ( AUTHENTICATION , USERS ) ; list . add ( Util . getEmptyOperation ( ADD , usersAddress ) ) ; while ( reader . hasNext ( ) && reader . nextTag ( ) != END_ELEMENT ) { requireNamespace ( reader , namespace ) ; final Element element = Element . forName ( reader . getLocalName ( ) ) ; switch ( element ) { case USER : { parseUser ( reader , usersAddress , list ) ; break ; } default : { throw unexpectedElement ( reader ) ; } } }
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcReinforcementBarProperties ( ) { } }
if ( ifcReinforcementBarPropertiesEClass == null ) { ifcReinforcementBarPropertiesEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 432 ) ; } return ifcReinforcementBarPropertiesEClass ;
public class ExtensionSessionManagement { /** * Gets the session management method type for a given identifier . * @ param id the id * @ return the session management method type for identifier */ public SessionManagementMethodType getSessionManagementMethodTypeForIdentifier ( int id ) { } }
for ( SessionManagementMethodType t : getSessionManagementMethodTypes ( ) ) if ( t . getUniqueIdentifier ( ) == id ) return t ; return null ;
public class BM25 { /** * 在构造时初始化自己的所有参数 */ private void init ( ) { } }
int index = 0 ; for ( List < String > sentence : docs ) { Map < String , Integer > tf = new TreeMap < String , Integer > ( ) ; for ( String word : sentence ) { Integer freq = tf . get ( word ) ; freq = ( freq == null ? 0 : freq ) + 1 ; tf . put ( word , freq ) ; } f [ index ] = tf ; for ( Map . Entry < String , Integer > entry : tf . entrySet ( ) ) { String word = entry . getKey ( ) ; Integer freq = df . get ( word ) ; freq = ( freq == null ? 0 : freq ) + 1 ; df . put ( word , freq ) ; } ++ index ; } for ( Map . Entry < String , Integer > entry : df . entrySet ( ) ) { String word = entry . getKey ( ) ; Integer freq = entry . getValue ( ) ; idf . put ( word , Math . log ( D - freq + 0.5 ) - Math . log ( freq + 0.5 ) ) ; }
public class DeleteAliasRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeleteAliasRequest deleteAliasRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( deleteAliasRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteAliasRequest . getAliasName ( ) , ALIASNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class JPEGLosslessDecoderWrapper { /** * Converts the decoded buffer into a BufferedImage . * precision : 16 bit , componentCount = 1 * @ param decoded data buffer * @ param precision * @ param width of the image * @ param height of the image @ return a BufferedImage . TYPE _ USHORT _ GRAY */ private BufferedImage to16Bit1ComponentGrayScale ( int [ ] [ ] decoded , int precision , int width , int height ) { } }
BufferedImage image ; if ( precision == 16 ) { image = new BufferedImage ( width , height , BufferedImage . TYPE_USHORT_GRAY ) ; } else { ColorModel colorModel = new ComponentColorModel ( ColorSpace . getInstance ( ColorSpace . CS_GRAY ) , new int [ ] { precision } , false , false , Transparency . OPAQUE , DataBuffer . TYPE_USHORT ) ; image = new BufferedImage ( colorModel , colorModel . createCompatibleWritableRaster ( width , height ) , colorModel . isAlphaPremultiplied ( ) , null ) ; } short [ ] imageBuffer = ( ( DataBufferUShort ) image . getRaster ( ) . getDataBuffer ( ) ) . getData ( ) ; for ( int i = 0 ; i < imageBuffer . length ; i ++ ) { imageBuffer [ i ] = ( short ) decoded [ 0 ] [ i ] ; } return image ;
public class OWLTransitiveObjectPropertyAxiomImpl_CustomFieldSerializer { /** * Deserializes the content of the object from the * { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } . * @ param streamReader the { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } to read the * object ' s content from * @ param instance the object instance to deserialize * @ throws com . google . gwt . user . client . rpc . SerializationException * if the deserialization operation is not * successful */ @ Override public void deserializeInstance ( SerializationStreamReader streamReader , OWLTransitiveObjectPropertyAxiomImpl instance ) throws SerializationException { } }
deserialize ( streamReader , instance ) ;
public class AmazonDynamoDBClient { /** * Adds or removes replicas in the specified global table . The global table must already exist to be able to use * this operation . Any replica to be added must be empty , must have the same name as the global table , must have the * same key schema , and must have DynamoDB Streams enabled and must have same provisioned and maximum write capacity * units . * < note > * Although you can use < code > UpdateGlobalTable < / code > to add replicas and remove replicas in a single request , for * simplicity we recommend that you issue separate requests for adding or removing replicas . * < / note > * If global secondary indexes are specified , then the following conditions must also be met : * < ul > * < li > * The global secondary indexes must have the same name . * < / li > * < li > * The global secondary indexes must have the same hash key and sort key ( if present ) . * < / li > * < li > * The global secondary indexes must have the same provisioned and maximum write capacity units . * < / li > * < / ul > * @ param updateGlobalTableRequest * @ return Result of the UpdateGlobalTable operation returned by the service . * @ throws InternalServerErrorException * An error occurred on the server side . * @ throws GlobalTableNotFoundException * The specified global table does not exist . * @ throws ReplicaAlreadyExistsException * The specified replica is already part of the global table . * @ throws ReplicaNotFoundException * The specified replica is no longer part of the global table . * @ throws TableNotFoundException * A source table with the name < code > TableName < / code > does not currently exist within the subscriber ' s * account . * @ sample AmazonDynamoDB . UpdateGlobalTable * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / dynamodb - 2012-08-10 / UpdateGlobalTable " target = " _ top " > AWS API * Documentation < / a > */ @ Override public UpdateGlobalTableResult updateGlobalTable ( UpdateGlobalTableRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeUpdateGlobalTable ( request ) ;
public class AlertPolicyServiceClient { /** * Creates a new alerting policy . * < p > Sample code : * < pre > < code > * try ( AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient . create ( ) ) { * ProjectName name = ProjectName . of ( " [ PROJECT ] " ) ; * AlertPolicy alertPolicy = AlertPolicy . newBuilder ( ) . build ( ) ; * AlertPolicy response = alertPolicyServiceClient . createAlertPolicy ( name , alertPolicy ) ; * < / code > < / pre > * @ param name The project in which to create the alerting policy . The format is * ` projects / [ PROJECT _ ID ] ` . * < p > Note that this field names the parent container in which the alerting policy will be * written , not the name of the created policy . The alerting policy that is returned will have * a name that contains a normalized representation of this name as a prefix but adds a suffix * of the form ` / alertPolicies / [ POLICY _ ID ] ` , identifying the policy in the container . * @ param alertPolicy The requested alerting policy . You should omit the ` name ` field in this * policy . The name will be returned in the new policy , including a new [ ALERT _ POLICY _ ID ] * value . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final AlertPolicy createAlertPolicy ( ProjectName name , AlertPolicy alertPolicy ) { } }
CreateAlertPolicyRequest request = CreateAlertPolicyRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . setAlertPolicy ( alertPolicy ) . build ( ) ; return createAlertPolicy ( request ) ;
public class AppsImpl { /** * Gets the application info . * @ param appId The application ID . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the ApplicationInfoResponse object */ public Observable < ApplicationInfoResponse > getAsync ( UUID appId ) { } }
return getWithServiceResponseAsync ( appId ) . map ( new Func1 < ServiceResponse < ApplicationInfoResponse > , ApplicationInfoResponse > ( ) { @ Override public ApplicationInfoResponse call ( ServiceResponse < ApplicationInfoResponse > response ) { return response . body ( ) ; } } ) ;
public class HostResource { /** * Returns a { @ link Resource } that describes a k8s container . * @ param hostname the hostname of the host . * @ param name the name of the host . * @ param id the unique host id ( instance id in Cloud ) . * @ param type the type of the host ( machine type ) . * @ return a { @ link Resource } that describes a k8s container . * @ since 0.20 */ public static Resource create ( String hostname , String name , String id , String type ) { } }
Map < String , String > labels = new LinkedHashMap < String , String > ( ) ; labels . put ( HOSTNAME_KEY , checkNotNull ( hostname , "hostname" ) ) ; labels . put ( NAME_KEY , checkNotNull ( name , "name" ) ) ; labels . put ( ID_KEY , checkNotNull ( id , "id" ) ) ; labels . put ( TYPE_KEY , checkNotNull ( type , "type" ) ) ; return Resource . create ( TYPE , labels ) ;
public class JesqueUtils { /** * Materializes a job by assuming the { @ link Job # getClassName ( ) } is a * fully - qualified Java type . * @ param job * the job to materialize * @ return the materialized job * @ throws ClassNotFoundException * if the class could not be found * @ throws Exception * if there was an exception creating the object */ public static Object materializeJob ( final Job job ) throws ClassNotFoundException , Exception { } }
final Class < ? > clazz = ReflectionUtils . forName ( job . getClassName ( ) ) ; // A bit redundant since we check when the job type is added . . . if ( ! Runnable . class . isAssignableFrom ( clazz ) && ! Callable . class . isAssignableFrom ( clazz ) ) { throw new ClassCastException ( "jobs must be a Runnable or a Callable: " + clazz . getName ( ) + " - " + job ) ; } return ReflectionUtils . createObject ( clazz , job . getArgs ( ) , job . getVars ( ) ) ;
public class AbstractFetcher { /** * Shortcut variant of { @ link # createPartitionStateHolders ( Map , int , SerializedValue , SerializedValue , ClassLoader ) } * that uses the same offset for all partitions when creating their state holders . */ private List < KafkaTopicPartitionState < KPH > > createPartitionStateHolders ( List < KafkaTopicPartition > partitions , long initialOffset , int timestampWatermarkMode , SerializedValue < AssignerWithPeriodicWatermarks < T > > watermarksPeriodic , SerializedValue < AssignerWithPunctuatedWatermarks < T > > watermarksPunctuated , ClassLoader userCodeClassLoader ) throws IOException , ClassNotFoundException { } }
Map < KafkaTopicPartition , Long > partitionsToInitialOffset = new HashMap < > ( partitions . size ( ) ) ; for ( KafkaTopicPartition partition : partitions ) { partitionsToInitialOffset . put ( partition , initialOffset ) ; } return createPartitionStateHolders ( partitionsToInitialOffset , timestampWatermarkMode , watermarksPeriodic , watermarksPunctuated , userCodeClassLoader ) ;
public class DbUtil { /** * Runs a SQL query that returns a single byte array value . * @ param stmt The < code > PreparedStatement < / code > to run . * @ param def The default value to return if the query returns no results . * @ return The value returned by the query , or < code > def < / code > if the * query returns no results . It is assumed that the query * returns a result set consisting of a single row and column , and * that this value is a byte array . Any additional rows or columns * returned will be ignored . * @ throws SQLException If an error occurs while attempting to communicate * with the database . */ public static byte [ ] queryBinary ( PreparedStatement stmt , byte [ ] def ) throws SQLException { } }
ResultSet rs = null ; try { rs = stmt . executeQuery ( ) ; return rs . next ( ) ? rs . getBytes ( 1 ) : def ; } finally { close ( rs ) ; }
public class AbstractAggarwalYuOutlier { /** * Method to calculate the sparsity coefficient of . * @ param setsize Size of subset * @ param dbsize Size of database * @ param k Dimensionality * @ param phi Phi parameter * @ return sparsity coefficient */ protected static double sparsity ( final int setsize , final int dbsize , final int k , final double phi ) { } }
// calculate sparsity c final double fK = MathUtil . powi ( 1. / phi , k ) ; return ( setsize - ( dbsize * fK ) ) / FastMath . sqrt ( dbsize * fK * ( 1 - fK ) ) ;
public class NodeManager { /** * Update the runnable status of a node based on resources available . * This checks both resources and slot availability . * @ param node The node */ private void updateRunnability ( ClusterNode node ) { } }
synchronized ( node ) { for ( Map . Entry < ResourceType , RunnableIndices > entry : typeToIndices . entrySet ( ) ) { ResourceType type = entry . getKey ( ) ; RunnableIndices r = entry . getValue ( ) ; ResourceRequest unitReq = Utilities . getUnitResourceRequest ( type ) ; boolean currentlyRunnable = r . hasRunnable ( node ) ; boolean shouldBeRunnable = node . checkForGrant ( unitReq , resourceLimit ) ; if ( currentlyRunnable && ! shouldBeRunnable ) { LOG . info ( "Node " + node . getName ( ) + " is no longer " + type + " runnable" ) ; r . deleteRunnable ( node ) ; } else if ( ! currentlyRunnable && shouldBeRunnable ) { LOG . info ( "Node " + node . getName ( ) + " is now " + type + " runnable" ) ; r . addRunnable ( node ) ; } } }
public class ListResolverEndpointsResult { /** * The resolver endpoints that were created by using the current AWS account , and that match the specified filters , * if any . * @ param resolverEndpoints * The resolver endpoints that were created by using the current AWS account , and that match the specified * filters , if any . */ public void setResolverEndpoints ( java . util . Collection < ResolverEndpoint > resolverEndpoints ) { } }
if ( resolverEndpoints == null ) { this . resolverEndpoints = null ; return ; } this . resolverEndpoints = new java . util . ArrayList < ResolverEndpoint > ( resolverEndpoints ) ;
public class Differential { /** * { @ inheritDoc } */ @ Override public DataBucket combineBuckets ( final DataBucket [ ] pBuckets ) { } }
// check to have only the newer version and the related fulldump to read on checkArgument ( pBuckets . length > 0 , "At least one Databucket must be provided" ) ; // create entire buckets . . final DataBucket returnVal = new DataBucket ( pBuckets [ 0 ] . getBucketKey ( ) , pBuckets [ 0 ] . getLastBucketPointer ( ) ) ; // . . . and for all datas . . . for ( int i = 0 ; i < pBuckets [ 0 ] . getDatas ( ) . length ; i ++ ) { // . . check if data exists in newer version , and if not . . . if ( pBuckets [ 0 ] . getDatas ( ) [ i ] != null ) { returnVal . setData ( i , pBuckets [ 0 ] . getData ( i ) ) ; } // . . . set the version from the last fulldump else if ( pBuckets . length > 1 ) { returnVal . setData ( i , pBuckets [ 1 ] . getData ( i ) ) ; } } return returnVal ;
public class UTCTimeBoxImplHtml4 { /** * styling */ @ Override public void validate ( ) { } }
boolean valid = true ; if ( hasValue ( ) ) { Long value = getValue ( ) ; if ( value != null ) { // scrub the value to format properly setText ( value2text ( value ) ) ; } else { // empty is ok and value ! = null ok , this is invalid valid = false ; } } setStyleName ( CLASSNAME_INVALID , ! valid ) ;
public class CompensationUtil { /** * Collect all compensate event subscriptions for scope of given execution . */ public static List < EventSubscriptionEntity > collectCompensateEventSubscriptionsForScope ( ActivityExecution execution ) { } }
final Map < ScopeImpl , PvmExecutionImpl > scopeExecutionMapping = execution . createActivityExecutionMapping ( ) ; ScopeImpl activity = ( ScopeImpl ) execution . getActivity ( ) ; // < LEGACY > : different flow scopes may have the same scope execution = > // collect subscriptions in a set final Set < EventSubscriptionEntity > subscriptions = new HashSet < EventSubscriptionEntity > ( ) ; TreeVisitor < ScopeImpl > eventSubscriptionCollector = new TreeVisitor < ScopeImpl > ( ) { @ Override public void visit ( ScopeImpl obj ) { PvmExecutionImpl execution = scopeExecutionMapping . get ( obj ) ; subscriptions . addAll ( ( ( ExecutionEntity ) execution ) . getCompensateEventSubscriptions ( ) ) ; } } ; new FlowScopeWalker ( activity ) . addPostVisitor ( eventSubscriptionCollector ) . walkUntil ( new ReferenceWalker . WalkCondition < ScopeImpl > ( ) { @ Override public boolean isFulfilled ( ScopeImpl element ) { Boolean consumesCompensationProperty = ( Boolean ) element . getProperty ( BpmnParse . PROPERTYNAME_CONSUMES_COMPENSATION ) ; return consumesCompensationProperty == null || consumesCompensationProperty == Boolean . TRUE ; } } ) ; return new ArrayList < EventSubscriptionEntity > ( subscriptions ) ;
public class URLParser { /** * Scan the data for various markers , including the provided session id * target . * @ param url * @ param target */ private void findMarkers ( String url , String target ) { } }
final char [ ] data = url . toCharArray ( ) ; // we only care about the last path segment so find that first int i = 0 ; int lastSlash = 0 ; for ( ; i < data . length ; i ++ ) { if ( '/' == data [ i ] ) { lastSlash = i ; } else if ( '?' == data [ i ] ) { this . queryMarker = i ; break ; // out of loop since query data is after the path } } // now check for the id marker and / or fragments for the last segment for ( i = lastSlash ; i < data . length ; i ++ ) { if ( i == this . queryMarker ) { // no fragments or segment parameters were found break ; } else if ( '#' == data [ i ] ) { // found a " # fragment " at the end of the path segment this . fragmentMarker = i ; break ; } else if ( ';' == data [ i ] ) { // found a segment parameter block ( would appear before the // optional fragment or query data ) this . paramMarker = i ; if ( url . regionMatches ( i , target , 0 , target . length ( ) ) ) { this . idMarker = i ; } } }
public class Modal { /** * Get the transparent modal panel * @ return { @ link ModalPanel } */ private ModalPanel getModalPanel ( ) { } }
if ( modalPanel == null ) { modalPanel = new ModalPanel ( ) ; modalPanel . setLayout ( new ModalLayout ( ) ) ; } return modalPanel ;
public class CassandraSchemaManager { /** * Update table . * @ param ksDef * the ks def * @ param tableInfo * the table info * @ throws Exception * the exception */ private void updateTable ( KsDef ksDef , TableInfo tableInfo ) throws Exception { } }
for ( CfDef cfDef : ksDef . getCf_defs ( ) ) { if ( cfDef . getName ( ) . equals ( tableInfo . getTableName ( ) ) && cfDef . getColumn_type ( ) . equals ( ColumnFamilyType . getInstanceOf ( tableInfo . getType ( ) ) . name ( ) ) ) { boolean toUpdate = false ; if ( cfDef . getColumn_type ( ) . equals ( STANDARDCOLUMNFAMILY ) ) { for ( ColumnInfo columnInfo : tableInfo . getColumnMetadatas ( ) ) { toUpdate = isCfDefUpdated ( columnInfo , cfDef , isCql3Enabled ( tableInfo ) , isCounterColumnType ( tableInfo , null ) , tableInfo ) ? true : toUpdate ; } } if ( toUpdate ) { cassandra_client . system_update_column_family ( cfDef ) ; } createIndexUsingThrift ( tableInfo , cfDef ) ; break ; } }