idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
12,600
public List < T > getAll ( int firstResult , int maxResults ) { return getDatabaseSupport ( ) . getAll ( getEntityClass ( ) , firstResult , maxResults ) ; }
Gets all of this DAO s entities .
12,601
protected List < T > getListAsc ( SingularAttribute < T , ? > attribute ) { EntityManager entityManager = this . getEntityManager ( ) ; CriteriaBuilder builder = entityManager . getCriteriaBuilder ( ) ; CriteriaQuery < T > criteriaQuery = builder . createQuery ( getEntityClass ( ) ) ; Root < T > root = criteriaQuery . from ( getEntityClass ( ) ) ; criteriaQuery . orderBy ( builder . asc ( root . get ( attribute ) ) ) ; return entityManager . createQuery ( criteriaQuery ) . getResultList ( ) ; }
Gets all of this DAO s entities ordered by the provided attribute in ascending order .
12,602
protected < Y > List < T > getListByAttribute ( SingularAttribute < T , Y > attribute , Y value ) { return getDatabaseSupport ( ) . getListByAttribute ( getEntityClass ( ) , attribute , value ) ; }
Gets the entities that have the target value of the specified attribute .
12,603
protected < Y > List < T > getListByAttributeIn ( SingularAttribute < T , Y > attribute , List < Y > values ) { return getDatabaseSupport ( ) . getListByAttributeIn ( getEntityClass ( ) , attribute , values ) ; }
Gets the entities that have any of the target values of the specified attribute .
12,604
public boolean the ( Condition condition , Ticker ticker ) { try { poll ( ticker , condition ) ; return true ; } catch ( PollTimeoutException ignored ) { return false ; } }
Report whether the condition is satisfied during a poll .
12,605
public < V > boolean the ( Sampler < V > variable , Ticker ticker , Matcher < ? super V > criteria ) { return the ( sampleOf ( variable , criteria ) , ticker ) ; }
Report whether a polled sample of the variable satisfies the criteria .
12,606
public < V > void waitUntil ( Sampler < V > variable , Matcher < ? super V > criteria ) { waitUntil ( variable , eventually ( ) , criteria ) ; }
Wait until a polled sample of the variable satisfies the criteria . Uses a default ticker .
12,607
public void waitUntil ( Sampler < Boolean > variable , Ticker ticker ) { waitUntil ( variable , ticker , isQuietlyTrue ( ) ) ; }
Wait until a polled sample of the variable is [
12,608
public < S , V > S when ( S subject , Feature < ? super S , V > feature , Matcher < ? super V > criteria ) { return when ( subject , feature , eventually ( ) , criteria ) ; }
Return the subject when a polled sample of the feature satisfies the criteria . Uses a default ticker .
12,609
public < S , V > void when ( S subject , Feature < ? super S , V > feature , Ticker ticker , Matcher < ? super V > criteria , Action < ? super S > action ) { waitUntil ( subject , feature , ticker , criteria ) ; action . actOn ( subject ) ; }
Act on the subject when a polled sample of the feature satisfies the criteria .
12,610
public void setLatitude ( final String latitude ) { if ( StringUtils . isBlank ( latitude ) ) { return ; } try { setLatitude ( Double . parseDouble ( latitude . trim ( ) ) ) ; } catch ( Exception e ) { } }
Set the latitude .
12,611
public void setLongitude ( final String longitude ) { if ( StringUtils . isBlank ( longitude ) ) { return ; } try { setLongitude ( Double . parseDouble ( longitude . trim ( ) ) ) ; } catch ( Exception e ) { } }
Set the longitude .
12,612
public void addSubtype ( String subtype ) { if ( ! StringUtils . isBlank ( subtype ) && ! subtypes . contains ( subtype . trim ( ) ) ) { subtypes . add ( subtype . trim ( ) ) ; } }
Set the disambiguated entity subType . SubTypes expose additional ontological mappings for a detected entity such as identification of a Person as a Politician or Athlete .
12,613
public void setWebsite ( String website ) { if ( website != null ) { website = website . trim ( ) ; } this . website = website ; }
Set the website associated with this concept tag .
12,614
public static Grammar translate ( Rule [ ] rules , StringArrayList symbolTable ) throws ActionException { int i ; Ebnf builder ; Grammar tmp ; Grammar buffer ; int firstHelper ; int lastHelper ; firstHelper = symbolTable . size ( ) ; buffer = new Grammar ( rules [ 0 ] . getLeft ( ) , symbolTable ) ; builder = new Ebnf ( firstHelper ) ; for ( i = 0 ; i < rules . length ; i ++ ) { tmp = ( Grammar ) rules [ i ] . getRight ( ) . visit ( builder ) ; buffer . addProduction ( new int [ ] { rules [ i ] . getLeft ( ) , tmp . getStart ( ) } ) ; buffer . addProductions ( tmp ) ; buffer . expandSymbol ( tmp . getStart ( ) ) ; buffer . removeProductions ( tmp . getStart ( ) ) ; } lastHelper = builder . getHelper ( ) - 1 ; buffer . removeDuplicateSymbols ( firstHelper , lastHelper ) ; buffer . removeDuplicateRules ( ) ; buffer . packSymbols ( firstHelper , lastHelper + 1 ) ; return buffer ; }
helper symbols are added without gaps starting with freeHelper .
12,615
public Mapper newInstance ( ) { Mapper mapper ; mapper = new Mapper ( name , parser . newInstance ( ) , oag . newInstance ( ) ) ; mapper . setLogging ( logParsing , logAttribution ) ; return mapper ; }
Creates a new mapper instance . Shares common data ( esp . scanner and parser table with this instance .
12,616
public synchronized String decryptText ( String text ) { try { cipher . init ( Cipher . DECRYPT_MODE , this . createDESSecretKey ( stringKey ) ) ; byte [ ] encodedByteText = new Base64 ( ) . decode ( text ) ; byte [ ] byteText = cipher . doFinal ( encodedByteText ) ; return new String ( byteText ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Methode de decryptage d un texte
12,617
public synchronized String encryptText ( String text ) { try { cipher . init ( Cipher . ENCRYPT_MODE , this . createDESSecretKey ( stringKey ) ) ; byte [ ] byteText = text . getBytes ( ) ; byte [ ] encodedByteText = cipher . doFinal ( byteText ) ; return new Base64 ( ) . encodeToString ( encodedByteText ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Methode d encryptage d un texte
12,618
public synchronized String hashText ( String text ) { return new Base64 ( ) . encodeToString ( digester . digest ( text . getBytes ( ) ) ) ; }
Methode de hachage d un texte
12,619
private SecretKey createDESSecretKey ( String keytext ) { try { DESKeySpec desKeySpec = new DESKeySpec ( keytext . getBytes ( ) ) ; return SecretKeyFactory . getInstance ( "DES" ) . generateSecret ( desKeySpec ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Methode de generation de cle prives sur la base d un mot de passe
12,620
void shutdown ( ) throws IOException { synchronized ( this ) { for ( BdbEnvironmentInfo envInfo : this . envInfos ) { try { envInfo . getClassCatalog ( ) . close ( ) ; } catch ( DatabaseException ignore ) { LOGGER . log ( Level . SEVERE , "Failure closing class catalog" , ignore ) ; } envInfo . closeAndRemoveAllDatabaseHandles ( ) ; try ( Environment env = envInfo . getEnvironment ( ) ) { if ( this . deleteOnExit ) { FileUtil . deleteDirectory ( env . getHome ( ) ) ; } } } this . envInfos . clear ( ) ; } }
Cleanly shuts down all databases in the provided environment .
12,621
public void run ( ) { try { shutdown ( ) ; } catch ( IOException ex ) { LOGGER . log ( Level . SEVERE , "Error during shutdown" , ex ) ; } }
Runs the shutdown hook .
12,622
public Connection getOrCreate ( ) throws SQLException { Connection con = DriverManager . getConnection ( this . url , this . user , this . password ) ; con . setAutoCommit ( isAutoCommitEnabled ( ) ) ; return con ; }
Creates a database connection or gets an existing connection with the JDBC URL username and password specified in the constructor .
12,623
public static void registerRequestHandler ( RequestHandler < ? extends Request > rh ) { if ( rh == null ) { throw new NullPointerException ( "rh is null" ) ; } if ( rh . handles ( ) == null ) { throw new NullPointerException ( "rh.handles() returns null" ) ; } if ( sRequestHandlers == null ) { initializeDefaultHandlers ( ) ; } if ( sRequestHandlers . containsKey ( rh . handles ( ) ) ) { throw new RuntimeException ( "RequestHandler already registered for " + rh . handles ( ) ) ; } sRequestHandlers . put ( rh . handles ( ) , rh ) ; }
Register a custom request handler .
12,624
public PropertyContainer add ( String property ) { if ( property != null && property . trim ( ) . length ( ) > 0 ) properties . add ( property ) ; return this ; }
Methode d ajour d une propriete
12,625
@ SuppressWarnings ( "unchecked" ) < K , E extends PoolableObject < V > > E initialize ( PoolKey < K > key , IKeyedObjectPool < ? , V > pool ) { this . key = key ; this . pool = pool ; return ( E ) this ; }
Initializes this Object when initially created by the Pool for allocation
12,626
@ SuppressWarnings ( "unchecked" ) < K , E extends PoolableObject < V > > E flagOwner ( ) { this . owner = Thread . currentThread ( ) ; return ( E ) this ; }
Flags the current thread as the new Owner of this Object
12,627
@ SuppressWarnings ( "unchecked" ) < K , E extends PoolableObject < V > > E releaseOwner ( ) { this . owner = null ; return ( E ) this ; }
Releases the current owning thread from this Object
12,628
public static List < Annotation > loadDAOGeneratorAnnotations ( Field field ) { List < Annotation > daoAnnotations = new ArrayList < Annotation > ( ) ; if ( field == null ) { return daoAnnotations ; } Annotation [ ] objectAnnotations = field . getDeclaredAnnotations ( ) ; if ( objectAnnotations == null || objectAnnotations . length == 0 ) { return daoAnnotations ; } for ( Annotation annotation : objectAnnotations ) { if ( isDAOGeneratorAnnotation ( annotation ) ) { daoAnnotations . add ( annotation ) ; } } return daoAnnotations ; }
Methode permettant de charger toutes les annotations DAO de generation sur la propriete
12,629
public static List < Annotation > loadDAOValidatorAnnotations ( Object object ) { List < Annotation > daoAnnotations = new ArrayList < Annotation > ( ) ; if ( object == null ) { return daoAnnotations ; } Annotation [ ] objectAnnotations = object . getClass ( ) . getAnnotations ( ) ; if ( objectAnnotations == null || objectAnnotations . length == 0 ) { return daoAnnotations ; } for ( Annotation annotation : objectAnnotations ) { if ( isDAOValidatorAnnotation ( annotation ) ) { daoAnnotations . add ( annotation ) ; } } return daoAnnotations ; }
Methode permettant de charger toutes les annotations DAO sur l objet pour un mode donne et un temps d evaluation donne
12,630
public static List < Class < ? extends IDAOValidator < ? extends Annotation > > > loadDAOValidatorClass ( Object object ) { List < Class < ? extends IDAOValidator < ? extends Annotation > > > result = new ArrayList < Class < ? extends IDAOValidator < ? extends Annotation > > > ( ) ; if ( object == null ) { return result ; } Annotation [ ] objectAnnotations = object . getClass ( ) . getAnnotations ( ) ; if ( objectAnnotations == null || objectAnnotations . length == 0 ) { return result ; } for ( Annotation annotation : objectAnnotations ) { if ( isDAOValidatorAnnotation ( annotation ) ) { DAOConstraint daoAnnotation = annotation . annotationType ( ) . getAnnotation ( DAOConstraint . class ) ; result . add ( daoAnnotation . validatedBy ( ) ) ; } } return result ; }
Methode permettant de charger toutes les Classes de validation de l Objet en fonction du Mode
12,631
public static Class < ? extends IDAOGeneratorManager < ? extends Annotation > > getGenerationLogicClass ( Annotation annotation ) { if ( annotation == null ) { return null ; } Class < ? extends IDAOGeneratorManager < ? extends Annotation > > mappedLogicClass = mGeneratorMapping . get ( annotation . annotationType ( ) . getName ( ) ) ; if ( mappedLogicClass != null ) return mappedLogicClass ; DAOGeneratorManager logicAnnotation = annotation . annotationType ( ) . getAnnotation ( DAOGeneratorManager . class ) ; return logicAnnotation . managerClass ( ) ; }
Methode permettant d obtenir la classe de gestion du generateur
12,632
public static Class < ? extends IDAOValidator < ? extends Annotation > > getValidationLogicClass ( Annotation annotation ) { if ( annotation == null ) { return null ; } Class < ? extends IDAOValidator < ? extends Annotation > > mappedLogicClass = mValidatorMapping . get ( annotation . annotationType ( ) . getName ( ) ) ; if ( mappedLogicClass != null ) return mappedLogicClass ; DAOConstraint logicAnnotation = annotation . annotationType ( ) . getAnnotation ( DAOConstraint . class ) ; return logicAnnotation . validatedBy ( ) ; }
Methode permettant d obtenir la classe d implementation de la logique de validation parametree sur l annotation
12,633
public static < T extends Object > boolean arraryContains ( T [ ] array , T value ) { if ( array == null || array . length == 0 ) { return false ; } if ( value == null ) { return false ; } boolean modeIn = false ; int index = 0 ; while ( index < array . length && ! modeIn ) { T tValue = array [ index ++ ] ; modeIn = tValue . equals ( value ) ; } return modeIn ; }
Methode permettant de savoir si un Objet de type T est contenu dans un Tableau d objet de type T
12,634
public static boolean isExpressionContainsENV ( String expression ) { if ( expression == null || expression . trim ( ) . length ( ) == 0 ) { return false ; } return isExpressionContainPattern ( expression , ENV_CHAIN_PATTERN ) ; }
Methode permettant de verifier si un chemin contient des variables d environnement
12,635
public static String resolveEnvironmentsParameters ( String expression ) { if ( expression == null || expression . trim ( ) . length ( ) == 0 ) { return null ; } while ( isExpressionContainPattern ( expression , ENV_CHAIN_PATTERN ) ) { String [ ] envs = extractToken ( expression , ENV_CHAIN_PATTERN ) ; for ( String env : envs ) { String cleanEnv = env . replace ( "${" , "" ) ; cleanEnv = cleanEnv . replace ( "}" , "" ) ; expression = expression . replace ( env , System . getProperty ( cleanEnv ) ) ; } } return expression ; }
Methode permettant de resoudre les variables d environnement dans une chemin
12,636
public static ExpressionModel computeExpression ( String expression ) { if ( expression == null || expression . trim ( ) . length ( ) == 0 ) { return null ; } ExpressionModel expressionModel = new ExpressionModel ( expression . trim ( ) ) ; int i = 0 ; if ( isExpressionContainPattern ( expression . trim ( ) , FUNC_CHAIN_PATTERN ) ) { String [ ] functions = extractToken ( expression , FUNC_CHAIN_PATTERN ) ; for ( String function : functions ) { String currentExpression = expressionModel . getComputedExpression ( ) ; String parameterName = "var" + i ++ ; currentExpression = currentExpression . replace ( function , ":" + parameterName ) ; expressionModel . setComputedExpression ( currentExpression ) ; expressionModel . addParameter ( parameterName , function ) ; } } while ( isExpressionContainPattern ( expressionModel . getComputedExpression ( ) , ENV_CHAIN_PATTERN ) ) { String [ ] envs = extractToken ( expressionModel . getComputedExpression ( ) , ENV_CHAIN_PATTERN ) ; for ( String env : envs ) { String currentExpression = expressionModel . getComputedExpression ( ) ; String parameterName = "var" + i ++ ; currentExpression = currentExpression . replace ( env , ":" + parameterName ) ; expressionModel . setComputedExpression ( currentExpression ) ; expressionModel . addParameter ( parameterName , env ) ; } } return expressionModel ; }
Methode de resolution d une Expression
12,637
public static String extractFunctionName ( String functionToken ) { if ( functionToken == null || functionToken . trim ( ) . length ( ) == 0 ) { return functionToken ; } int index0 = functionToken . indexOf ( SIMPLE_FUNCTION_LEFT_DELIMITER ) ; int index1 = functionToken . indexOf ( SIMPLE_FUNCTION_OPEN ) ; String fName = functionToken . substring ( index0 + SIMPLE_FUNCTION_LEFT_DELIMITER . length ( ) , index1 ) ; return fName ; }
Methode permettant d extraire le nom de la fonction
12,638
public static String [ ] extractToken ( String expression , String pattern ) { if ( expression == null || expression . trim ( ) . length ( ) == 0 ) { return null ; } if ( pattern == null ) { return null ; } String [ ] spacePlitted = expression . split ( SPLITTER_CHAIN ) ; StringBuffer aTokens = new StringBuffer ( ) ; int index = 0 ; for ( String spaceToken : spacePlitted ) { if ( isExpressionContainPattern ( spaceToken , pattern ) ) { if ( index ++ > 0 ) aTokens . append ( "@" ) ; aTokens . append ( spaceToken ) ; } } return aTokens . toString ( ) . split ( "@" ) ; }
Methode d extraction de toutes les sous - chaines respectant le pattern donne
12,639
public static boolean checkContainsInvalidCharacter ( String text , String invalidCharacters ) { if ( text == null || text . trim ( ) . length ( ) == 0 || invalidCharacters == null ) return false ; for ( char c : invalidCharacters . toCharArray ( ) ) { if ( text . indexOf ( new String ( new char [ ] { c } ) ) >= 0 ) return true ; } return false ; }
Methode qui teste si une chaine donnee contient un des caracteres d une liste
12,640
public static boolean isAlphaNumericString ( String text ) { Pattern pattern = Pattern . compile ( "\\w+" ) ; return ( text != null ) && ( text . trim ( ) . length ( ) > 0 ) && ( pattern . matcher ( text ) . matches ( ) ) ; }
Methode qui teste si une chaine ne contient que des caracteres alphanumeriques
12,641
public static List < Field > getAllFields ( Class < ? > type , boolean ignoreRoot ) { List < Field > fields = new ArrayList < Field > ( ) ; fields . addAll ( Arrays . asList ( type . getDeclaredFields ( ) ) ) ; Class < ? > superType = type . getSuperclass ( ) ; if ( superType != null && ! superType . equals ( Object . class ) ) fields . addAll ( getAllFields ( superType , ignoreRoot ) ) ; return fields ; }
Methode permettant d obtenir la liste de tous les champs d une classe
12,642
public static Grammar forProductions ( String ... prods ) { StringArrayList symbolTable ; Grammar grammar ; String s ; String [ ] stringProd ; int [ ] prod ; int idx ; grammar = new Grammar ( ) ; symbolTable = grammar . symbolTable ; idx = 0 ; for ( int p = 0 ; p < prods . length ; p ++ ) { stringProd = Strings . toArray ( Separator . SPACE . split ( prods [ p ] ) ) ; if ( stringProd . length == 0 ) { throw new IllegalArgumentException ( ) ; } prod = new int [ stringProd . length ] ; for ( int ofs = prod . length - 1 ; ofs >= 0 ; ofs -- ) { s = stringProd [ ofs ] ; idx = symbolTable . indexOf ( s ) ; if ( idx == - 1 ) { idx = symbolTable . size ( ) ; symbolTable . add ( s ) ; } prod [ ofs ] = idx ; } if ( p == 0 ) { grammar . start = idx ; } grammar . addProduction ( prod ) ; } return grammar ; }
start symbol is set to the subject of the first production .
12,643
public void packSymbols ( int first , int end ) { int src ; int dest ; boolean touched ; dest = first ; for ( src = first ; src < end ; src ++ ) { touched = renameSymbol ( src , dest ) ; if ( touched ) { dest ++ ; } else { } } }
pack helper symbols
12,644
public void expandSymbol ( int symbol ) { int prod , maxProd ; int ofs , maxOfs ; int ofs2 , maxOfs2 ; int i , j ; boolean found ; int count , nextCount ; IntArrayList next ; int [ ] [ ] expand ; List < int [ ] > expandLst ; int right ; maxProd = getProductionCount ( ) ; expandLst = new ArrayList < int [ ] > ( ) ; for ( prod = 0 ; prod < maxProd ; prod ++ ) { if ( getLeft ( prod ) == symbol ) { expandLst . add ( getProduction ( prod ) ) ; } } expand = new int [ expandLst . size ( ) ] [ ] ; expandLst . toArray ( expand ) ; for ( prod = maxProd - 1 ; prod >= 0 ; prod -- ) { maxOfs = getLength ( prod ) ; found = false ; nextCount = 1 ; for ( ofs = 0 ; ofs < maxOfs ; ofs ++ ) { if ( getRight ( prod , ofs ) == symbol ) { found = true ; nextCount *= expand . length ; } } if ( found ) { for ( i = 0 ; i < nextCount ; i ++ ) { count = i ; next = new IntArrayList ( ) ; next . add ( getLeft ( prod ) ) ; for ( ofs = 0 ; ofs < maxOfs ; ofs ++ ) { right = getRight ( prod , ofs ) ; if ( right == symbol ) { j = count % expand . length ; maxOfs2 = expand [ j ] . length ; for ( ofs2 = 1 ; ofs2 < maxOfs2 ; ofs2 ++ ) { next . add ( expand [ j ] [ ofs2 ] ) ; } count /= expand . length ; } else { next . add ( right ) ; } } if ( count != 0 ) { throw new RuntimeException ( ) ; } addProduction ( prod + 1 , next . toArray ( ) ) ; } removeProduction ( prod ) ; } } }
expansion is not performed recurively
12,645
public void addNullable ( IntBitSet result ) { IntBitSet remaining ; boolean modified ; int i ; int prod ; int max ; remaining = new IntBitSet ( ) ; remaining . addRange ( 0 , getProductionCount ( ) - 1 ) ; do { modified = false ; for ( prod = remaining . first ( ) ; prod != - 1 ; prod = remaining . next ( prod ) ) { if ( result . contains ( getLeft ( prod ) ) ) { remaining . remove ( prod ) ; } else { max = getLength ( prod ) ; for ( i = 0 ; i < max ; i ++ ) { if ( ! result . contains ( getRight ( prod , i ) ) ) { break ; } } if ( i == max ) { result . add ( getLeft ( prod ) ) ; modified = true ; } } } } while ( modified ) ; }
Returns a symbols that can derive the empty word . Also called removable symbols
12,646
private static int getValue ( String str , boolean getMaximumValue ) { int multiplier = 1 ; String upperOrLowerValue = null ; final String [ ] rangeUnit = splitRangeUnit ( str ) ; if ( rangeUnit . length == 2 ) { multiplier = getMultiplier ( rangeUnit [ 1 ] ) ; } String [ ] range = splitRange ( rangeUnit [ 0 ] ) ; upperOrLowerValue = range [ 0 ] ; if ( range . length == 2 ) { if ( getMaximumValue ) { upperOrLowerValue = range [ 1 ] ; } } return ( int ) ( convertStringToDouble ( upperOrLowerValue ) * multiplier ) ; }
Return the specified value from the string .
12,647
protected final String getValue ( final String propertyName , String defaultValue ) { String value = getValue ( propertyName ) ; if ( value == null ) { if ( defaultValue == null ) { LOGGER . warn ( "Property '{}' is not specified in " + getClass ( ) . getName ( ) + ", and no default is specified." , propertyName ) ; } value = defaultValue ; } return value ; }
Returns the String value of the given property name or the given default if the given property name does not exist .
12,648
protected final int getIntValue ( final String propertyName , int defaultValue ) { int result ; String property = this . properties . getProperty ( propertyName ) ; try { result = Integer . parseInt ( property ) ; } catch ( NumberFormatException e ) { LOGGER . warn ( "Invalid integer property in configuration: {}" , propertyName ) ; result = defaultValue ; } return result ; }
Utility method to get an int from the properties file .
12,649
private boolean compileCurrent ( ) throws IOException { Specification spec ; Mapper result ; output . normal ( currentJob . source + ":" ) ; if ( currentJob . listing != null ) { output . openListing ( currentJob . listing ) ; } spec = ( Specification ) mapperMapper . invoke ( currentJob . source ) ; if ( spec == null ) { return false ; } try { result = spec . translate ( currentJob . k , currentJob . threadCount , output ) ; compiler . run ( result , spec . getMapperName ( ) , currentJob . source , currentJob . outputPath ) ; } catch ( GenericException e ) { output . error ( currentJob . source . getName ( ) , e ) ; return false ; } catch ( IOException e ) { output . error ( currentJob . source . getName ( ) , e . getMessage ( ) ) ; return false ; } return true ; }
Helper for compile
12,650
public void verify ( String pkg , File path , Configuration conf ) { if ( ! path . isDirectory ( ) ) { throw new IllegalArgumentException ( path . getAbsolutePath ( ) . concat ( " is not a directory." ) ) ; } for ( File file : path . listFiles ( ) ) { if ( file . isDirectory ( ) ) { verify ( combine ( pkg , file . getName ( ) ) , file , conf ) ; } else { String fileName = file . getName ( ) ; int extensionSeparator = fileName . lastIndexOf ( '.' ) ; if ( extensionSeparator >= 0 ) { String extension = fileName . substring ( extensionSeparator + 1 ) ; if ( extension . equals ( "class" ) ) { String className = combine ( pkg , fileName . substring ( 0 , extensionSeparator ) ) ; try { byte [ ] digest = conf . getJobService ( ) . getClassDigest ( className ) ; if ( digest == null ) { System . out . print ( "? " ) ; System . out . println ( className ) ; } else if ( ! matches ( file , digest , conf ) ) { System . out . print ( "* " ) ; System . out . println ( className ) ; } else if ( conf . verbose ) { System . out . print ( "= " ) ; System . out . println ( className ) ; } } catch ( FileNotFoundException e ) { throw new UnexpectedException ( e ) ; } catch ( IOException e ) { System . out . print ( "E " ) ; System . out . println ( className ) ; } } } } } }
Reports classes in the specified directory tree which differ from those on the server or which do not exist on the server .
12,651
private boolean matches ( File file , byte [ ] digest , Configuration conf ) throws IOException { byte [ ] fileDigest = getDigest ( file , conf ) ; return Arrays . equals ( fileDigest , digest ) ; }
Determines whether the digest of the specified file matches the given digest .
12,652
private Collection < Directory > collectExistingRoots ( final Directory pNewRoot ) { final Path parentPath = pNewRoot . getPath ( ) ; final Collection < Directory > pathsToRebase = new LinkedList < > ( ) ; dirs . entrySet ( ) . forEach ( e -> { final Path childPath = e . getKey ( ) ; if ( childPath . startsWith ( parentPath ) && e . getValue ( ) . isRoot ( ) ) { pathsToRebase . add ( e . getValue ( ) ) ; } } ) ; return pathsToRebase ; }
Collects all existing root directories which are children of the new root directory specified specified .
12,653
void cancelAndRebaseDiscardedDirectory ( final Directory pDiscardedParent ) { pDiscardedParent . cancelKey ( ) ; dirs . remove ( pDiscardedParent . getPath ( ) ) ; final List < Directory > toBeConvertedIntoRoot = new LinkedList < > ( ) ; cancelDiscardedDirectories ( pDiscardedParent , toBeConvertedIntoRoot ) ; toBeConvertedIntoRoot . forEach ( d -> { final Directory root = d . toRootDirectory ( ) ; rebaseDirectSubDirectories ( root ) ; dirs . replace ( d . getPath ( ) , root ) ; } ) ; }
Cancels the watch - key of the discarded directory specified . Additionally cancels and removes any sub - directory which was not a root itself sometime in the past . Any sub - directory which was a root directory in the past will be converted back to a root - directory .
12,654
public void start ( @ OptionArgument ( "ncpus" ) int numberOfCpus , @ OptionArgument ( "host" ) final String host , @ OptionArgument ( "username" ) final String username , @ OptionArgument ( "password" ) final String password , @ OptionArgument ( value = "nodb" , shortKey = 'i' ) final boolean internal , @ OptionArgument ( "courtesy" ) final String courtesyCommand , @ OptionArgument ( value = "courtesyWorkingDirectory" , shortKey = 'W' ) File courtesyWorkingDirectory , @ OptionArgument ( value = "courtesyPollingInterval" , shortKey = 'P' ) long courtesyPollingInterval ) { int availableCpus = Runtime . getRuntime ( ) . availableProcessors ( ) ; if ( numberOfCpus <= 0 || numberOfCpus > availableCpus ) { numberOfCpus = availableCpus ; } System . out . println ( "Starting worker with " + Integer . toString ( numberOfCpus ) + " cpus" ) ; if ( worker != null ) { logger . info ( "Shutting down worker" ) ; worker . shutdown ( ) ; try { workerThread . join ( ) ; } catch ( InterruptedException e ) { } } logger . info ( "Starting worker" ) ; JobServiceFactory serviceFactory = new JobServiceFactory ( ) { public JobService connect ( ) { return waitForService ( host . equals ( "" ) ? "localhost" : host , username . equals ( "" ) ? "guest" : username , password , RECONNECT_INTERVAL ) ; } } ; CourtesyMonitor courtesyMonitor ; if ( ! courtesyCommand . equals ( "" ) ) { logger . info ( "Initializing courtesy monitor" ) ; if ( courtesyPollingInterval == 0 ) { courtesyPollingInterval = DEFAULT_COURTESY_POLLING_INTERVAL ; } ExecCourtesyMonitor exec = new ExecCourtesyMonitor ( courtesyCommand , courtesyWorkingDirectory ) ; exec . startPolling ( courtesyPollingInterval , TimeUnit . SECONDS ) ; courtesyMonitor = exec ; } else { courtesyMonitor = new UnconditionalCourtesyMonitor ( ) ; } ThreadFactory threadFactory = new BackgroundThreadFactory ( ) ; ProgressStateFactory monitorFactory = new ProgressStateFactory ( ) ; worker = new ThreadServiceWorker ( serviceFactory , threadFactory , monitorFactory , courtesyMonitor ) ; worker . setMaxWorkers ( numberOfCpus ) ; taskProgressStates = monitorFactory . getProgressStates ( ) ; if ( ! internal ) { logger . info ( "Preparing data source" ) ; EmbeddedDataSource ds = null ; try { Class . forName ( "org.apache.derby.jdbc.EmbeddedDriver" ) ; ds = new EmbeddedDataSource ( ) ; ds . setConnectionAttributes ( "create=true" ) ; ds . setDatabaseName ( "classes" ) ; worker . setDataSource ( ds ) ; } catch ( ClassNotFoundException e ) { logger . error ( "Could not locate database driver." , e ) ; } catch ( SQLException e ) { logger . error ( "Error occurred while initializing data source." , e ) ; } } workerThread = new Thread ( worker ) ; workerThread . start ( ) ; }
Starts the worker process .
12,655
public void stop ( ) { System . out . println ( "Stopping worker" ) ; worker . shutdown ( ) ; workerThread . interrupt ( ) ; try { workerThread . join ( ) ; } catch ( InterruptedException e ) { logger . warn ( "Joining to worker thread interrupted" , e ) ; } worker = null ; workerThread = null ; taskProgressStates = null ; }
Stops the worker process .
12,656
public ObjectNode toJson ( ) { ObjectMapper mapper = new ObjectMapper ( ) ; ObjectNode node = mapper . createObjectNode ( ) ; ObjectNode attributeNode = mapper . createObjectNode ( ) ; node . put ( attribute . getCode ( ) , attributeNode ) ; attributeNode . put ( "op" , operation . getOp ( ) ) ; return node ; }
Returns a JSON representation of this filter to send to the server . Used by the SDK internally .
12,657
public static RegExpr createKeyword ( String str ) { int i ; RegExpr [ ] chars ; if ( str . length ( ) == 1 ) { return new Range ( str . charAt ( 0 ) ) ; } else { chars = new RegExpr [ str . length ( ) ] ; for ( i = 0 ; i < chars . length ; i ++ ) { chars [ i ] = new Range ( str . charAt ( i ) ) ; } return new Sequence ( chars ) ; } }
returns a Range for strings of length 1
12,658
private Function findField ( String name ) { Selection slkt ; Function f ; if ( name . indexOf ( '.' ) == - 1 ) { name = type . getName ( ) + "." + name ; } slkt = Method . forName ( name ) ; if ( slkt . size ( ) == 0 ) { f = Field . forName ( name ) ; if ( f != null ) { slkt = slkt . add ( new Selection ( f ) ) ; } } slkt = slkt . restrictArgumentCount ( 1 ) ; slkt = slkt . restrictArgumentType ( 0 , type ) ; switch ( slkt . size ( ) ) { case 0 : throw new RuntimeException ( "no such field: " + name ) ; case 1 : return slkt . getFunction ( ) ; default : throw new RuntimeException ( "ambiguous field: " + name ) ; } }
helper method for constructor
12,659
private java . lang . reflect . Method findConstr ( String name ) { Selection slkt ; int i ; slkt = Method . forName ( name ) ; slkt = slkt . restrictArgumentCount ( fields . length ) ; for ( i = 0 ; i < fields . length ; i ++ ) { slkt . restrictArgumentType ( i , fields [ i ] . getReturnType ( ) ) ; } switch ( slkt . size ( ) ) { case 0 : throw new RuntimeException ( "no such constructor: " + name ) ; case 1 : return ( ( Method ) slkt . getFunction ( ) ) . getRaw ( ) ; default : throw new RuntimeException ( "constructor ambiguous: " + name ) ; } }
Helper method for the constructor .
12,660
public void resetEndOfs ( int ofs ) { if ( endPageIdx == 0 ) { end = ofs ; } else { endPageIdx = ofs / pageSize ; end = ofs % pageSize ; if ( end == 0 && pages . getLastNo ( ) == endPageIdx ) { end += pageSize ; endPageIdx -- ; } endPage = pages . get ( endPageIdx ) ; endFilled = pages . getFilled ( endPageIdx ) ; } }
Sets the current end ofs by to the specified value
12,661
public int read ( ) throws IOException { if ( end == endFilled ) { switch ( pages . read ( endPageIdx , endFilled ) ) { case - 1 : eof = true ; return Scanner . EOF ; case 0 : endFilled = pages . getFilled ( endPageIdx ) ; break ; case 1 : endPageIdx ++ ; end = 0 ; endPage = pages . get ( endPageIdx ) ; endFilled = pages . getFilled ( endPageIdx ) ; break ; default : throw new RuntimeException ( ) ; } } return endPage [ end ++ ] ; }
Advances the end and returns the character at this positio .
12,662
public void eat ( ) { int i ; if ( endPageIdx == 0 ) { position . update ( endPage , start , end ) ; start = end ; } else { position . update ( pages . get ( 0 ) , start , pageSize ) ; for ( i = 1 ; i < endPageIdx ; i ++ ) { position . update ( pages . get ( i ) , 0 , pageSize ) ; } pages . shrink ( endPageIdx ) ; endPageIdx = 0 ; endPage = pages . get ( 0 ) ; start = end ; position . update ( endPage , 0 , start ) ; } }
Move start forward to the current position .
12,663
public String createString ( ) { int i ; int count ; if ( endPageIdx == 0 ) { return new String ( endPage , start , end - start ) ; } else { char [ ] buffer ; buffer = new char [ endPageIdx * pageSize + end - start ] ; count = pageSize - start ; System . arraycopy ( pages . get ( 0 ) , start , buffer , 0 , count ) ; for ( i = 1 ; i < endPageIdx ; i ++ ) { System . arraycopy ( pages . get ( i ) , 0 , buffer , count , pageSize ) ; count += pageSize ; } System . arraycopy ( pages . get ( endPageIdx ) , 0 , buffer , count , end ) ; return new String ( buffer ) ; } }
Returns the string between start and the current position .
12,664
public static List < String > readResourceAsLines ( Class < ? > classObj , String resourceName ) throws IOException { InputStream in = getResourceAsStream ( resourceName , classObj ) ; try ( BufferedReader buffer = new BufferedReader ( new InputStreamReader ( in ) ) ) { List < String > lines = new ArrayList < > ( ) ; String line ; while ( ( line = buffer . readLine ( ) ) != null ) { lines . add ( line ) ; } return lines ; } }
Reads everything from a textual resource as lines using the default character set .
12,665
public static void readPropertiesFromResource ( Properties properties , Class < ? > classObj , String resourceName ) throws IOException { if ( classObj == null ) { throw new IllegalArgumentException ( "classObj cannot be null" ) ; } if ( resourceName != null ) { InputStream inputStream = classObj . getResourceAsStream ( resourceName ) ; if ( inputStream != null ) { try { properties . load ( inputStream ) ; } finally { inputStream . close ( ) ; } } else { throw new IOException ( resourceName + " not found." ) ; } } }
Loads properties from the given resource into the given properties object .
12,666
public static File resourceToFile ( String resourceName , String filePrefix , String fileSuffix ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( getResourceAsStream ( resourceName ) ) ) ; File outFile = File . createTempFile ( filePrefix , fileSuffix ) ; BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( outFile ) ) ) ; int c ; while ( ( c = reader . read ( ) ) != - 1 ) { writer . write ( c ) ; } reader . close ( ) ; writer . close ( ) ; outFile . deleteOnExit ( ) ; return outFile ; }
Converts a resource into a temporary file that can be read by objects that look up files by name . Returns the file that was created . The file will be deleted when the program exits .
12,667
public List < Method > isUnlockable ( Class < ? > interfaceClazz ) { List < Method > conflicts = new LinkedList < Method > ( ) ; for ( Method method : interfaceClazz . getDeclaredMethods ( ) ) { try { findInvocationHandler ( method ) ; } catch ( NoSuchMethodException e ) { conflicts . add ( method ) ; } } return conflicts ; }
collects all methods of the given interface conflicting with the wrapped object
12,668
public Iterator < T > iterator ( ) { return new Iterator < T > ( ) { private int cursor = 0 ; public boolean hasNext ( ) { return size == INFINITE_SIZE || cursor < size ; } public T next ( ) { if ( ! hasNext ( ) ) { throw new NoSuchElementException ( ) ; } cursor ++ ; return generator . next ( ) ; } public void remove ( ) { throw new UnsupportedOperationException ( "remove() operation is not supported" ) ; } } ; }
Provides iterator over this iterable
12,669
@ SuppressWarnings ( "unchecked" ) public < T > Map < Serializable , T > get ( Collection < ? extends Serializable > keys ) { Map < Serializable , T > result = Maps . newHashMapWithExpectedSize ( keys . size ( ) ) ; for ( Serializable key : keys ) { T value = ( T ) contents . getIfPresent ( key ) ; if ( value != null ) { result . put ( key , value ) ; } } if ( log . isDebugEnabled ( ) && ! result . isEmpty ( ) ) { log . debug ( "Level 1 cache multiple hit: {}" , result . keySet ( ) ) ; } return result ; }
Return the list of values from cache . Only entries with non - null value will be returned
12,670
private static Thread createRunner ( final String cmd , final JTextArea dest , final JDialog dialog , final JButton okButton ) { return new Thread ( ) { public void run ( ) { Process p ; StringBuffer exit ; Thread log1 ; Thread log2 ; exit = new StringBuffer ( ) ; try { try { p = Runtime . getRuntime ( ) . exec ( cmd ) ; } catch ( IOException e ) { dest . append ( "\nexecution failed: " + e . getMessage ( ) ) ; return ; } log1 = createLogger ( p . getInputStream ( ) , dest ) ; log2 = createLogger ( p . getErrorStream ( ) , dest ) ; log1 . start ( ) ; log2 . start ( ) ; System . out . println ( "waiting" ) ; try { log1 . join ( ) ; log2 . join ( ) ; exit . append ( "" + p . waitFor ( ) ) ; } catch ( InterruptedException e ) { exit . append ( "interrupted" ) ; } } finally { dest . append ( "\nfinished, exit= " + exit . toString ( ) ) ; okButton . setEnabled ( true ) ; System . out . println ( "launcher done" ) ; } } } ; }
Create a new thread to execute the specified command . Enables the specified button when done .
12,671
private boolean dropPidFile ( ) { LOG . trace ( "Entering dropPidFile()" ) ; if ( System . getProperty ( "os.name" ) . startsWith ( "Windows" ) ) { LOG . info ( "Pid file creation is unsupported on Windows... skipping" ) ; return true ; } try { final String [ ] cmd = { "bash" , "-o" , "noclobber" , "-c" , "echo $PPID > " + pidFilename } ; final Process p = Runtime . getRuntime ( ) . exec ( cmd ) ; if ( p . waitFor ( ) != 0 ) { LOG . error ( "Unable to drop PID file" ) ; return false ; } } catch ( final InterruptedException | IOException e ) { LOG . error ( "Unable to drop PID file: " + e . getMessage ( ) ) ; return false ; } new File ( pidFilename ) . deleteOnExit ( ) ; LOG . debug ( "Dropped PID file" ) ; LOG . trace ( "Exiting dropPIDFile()" ) ; return true ; }
Create a file with the current process id in it . This is a no - op on Windows . Prior copies of the file must be removed prior to launch .
12,672
public static String encode ( byte [ ] bytes , String indentation ) { int length = bytes . length ; if ( length == 0 ) return "" ; String encoded = Base64 . encodeBase64String ( bytes ) . replaceAll ( "\\s" , "" ) ; StringBuilder result = new StringBuilder ( ) ; if ( indentation != null ) result . append ( indentation ) ; result . append ( encoded . charAt ( 0 ) ) ; for ( int c = 1 ; c < encoded . length ( ) ; c ++ ) { if ( c % 80 == 0 ) { result . append ( "\n" ) ; if ( indentation != null ) result . append ( indentation ) ; } result . append ( encoded . charAt ( c ) ) ; } return result . toString ( ) ; }
This function encodes a byte array using base 64 with a specific indentation of new lines .
12,673
@ SuppressWarnings ( "unchecked" ) public < T > T features ( Class < T > interfaceClass ) { try { List < Class < ? > > todo = new ArrayList < Class < ? > > ( ) ; Set < Class < ? > > done = new HashSet < Class < ? > > ( ) ; todo . add ( interfaceClass ) ; while ( ! todo . isEmpty ( ) ) { Class < ? > currentClass = todo . remove ( 0 ) ; done . add ( currentClass ) ; for ( Method method : currentClass . getDeclaredMethods ( ) ) { if ( ! methods . containsKey ( method ) ) { methods . put ( method , findInvocationHandler ( method ) ) ; } for ( Class < ? > superInterfaceClazz : currentClass . getInterfaces ( ) ) { if ( ! done . contains ( superInterfaceClazz ) ) { todo . add ( superInterfaceClazz ) ; } } } } return ( T ) Proxy . newProxyInstance ( interfaceClass . getClassLoader ( ) , new Class [ ] { interfaceClass } , this ) ; } catch ( NoSuchMethodException e ) { throw new PicklockException ( "cannot resolve method/property " + e . getMessage ( ) + " on " + object . getClass ( ) ) ; } }
maps the given interface to the wrapped object
12,674
public static String flatten ( List lines , String sep ) { return flatten ( lines . toArray ( new Object [ lines . size ( ) ] ) , sep ) ; }
Flattens the list into a single long string . The separator string gets added between the objects but not after the last one .
12,675
static public String encode ( byte [ ] bytes , String indentation ) { StringBuilder result = new StringBuilder ( ) ; int length = bytes . length ; if ( length == 0 ) return "" ; if ( indentation != null ) result . append ( indentation ) ; encodeByte ( bytes , 0 , result ) ; for ( int i = 1 ; i < length ; i ++ ) { if ( i % 40 == 0 ) { result . append ( "\n" ) ; if ( indentation != null ) result . append ( indentation ) ; } encodeByte ( bytes , i , result ) ; } return result . toString ( ) ; }
This function encodes a byte array using base 16 with a specific indentation of new lines .
12,676
static public byte [ ] decode ( String base16 ) { String string = base16 . replaceAll ( "\\s" , "" ) ; int length = string . length ( ) ; byte [ ] bytes = new byte [ ( int ) Math . ceil ( length / 2.0 ) ] ; for ( int i = 0 ; i < bytes . length ; i ++ ) { decodeByte ( string , i , bytes ) ; } return bytes ; }
This function decodes a base 16 string into its corresponding byte array .
12,677
public static void main ( String [ ] args ) { ArgumentProcessor < Configuration > argProcessor = new ArgumentProcessor < Configuration > ( "" ) ; argProcessor . addOption ( "verbose" , 'V' , new BooleanFieldOption < Configuration > ( "verbose" ) ) ; argProcessor . addOption ( "host" , 'h' , new StringFieldOption < Configuration > ( "host" ) ) ; argProcessor . addOption ( "username" , 'u' , new StringFieldOption < Configuration > ( "username" ) ) ; argProcessor . addOption ( "password" , 'p' , new StringFieldOption < Configuration > ( "password" ) ) ; argProcessor . addCommand ( "verify" , new VerifyCommand ( ) ) ; argProcessor . addCommand ( "sync" , new SynchronizeCommand ( ) ) ; argProcessor . addCommand ( "idle" , new SetIdleTimeCommand ( ) ) ; argProcessor . addCommand ( "script" , new ScriptCommand ( ) ) ; argProcessor . addCommand ( "connect" , new ConnectCommand ( ) ) ; argProcessor . setDefaultCommand ( UnrecognizedCommand . getInstance ( ) ) ; argProcessor . process ( args , new Configuration ( ) ) ; }
Application entry point .
12,678
public String toCanonicalXml2 ( XMLReader parser , InputSource inputSource , boolean stripSpace ) throws Exception { mStrip = stripSpace ; mOut = new StringWriter ( ) ; parser . setContentHandler ( this ) ; parser . setErrorHandler ( this ) ; parser . parse ( inputSource ) ; return mOut . toString ( ) ; }
Create canonical XML silently throwing exceptions rather than displaying messages
12,679
public String toCanonicalXml3 ( TransformerFactory factory , XMLReader resultParser , String inxml , boolean stripSpace ) throws Exception { mStrip = stripSpace ; mOut = new StringWriter ( ) ; Transformer t = factory . newTransformer ( ) ; SAXSource ss = new SAXSource ( resultParser , new InputSource ( new StringReader ( inxml ) ) ) ; ss . setSystemId ( "http://localhost/string-input" ) ; t . setOutputProperty ( OutputKeys . METHOD , "xml" ) ; t . setOutputProperty ( OutputKeys . INDENT , "no" ) ; t . transform ( ss , new SAXResult ( this ) ) ; return mOut . toString ( ) ; }
Create canonical XML silently throwing exceptions rather than displaying messages . This version of the method uses the Saxon identityTransformer rather than parsing directly because for some reason we seem to be able to get XML 1 . 1 to work this way .
12,680
public String reason ( ) { Description description = new StringDescription ( ) ; condition . describeDissatisfactionTo ( description ) ; return description . toString ( ) ; }
The reason the condition was dissatisfied .
12,681
private void streamDirectoryAndForceInform ( final EventDispatcher pDispatcher ) { try ( final DirectoryStream < Path > stream = newDirectoryStream ( getPath ( ) , Files :: isRegularFile ) ) { stream . forEach ( p -> createKeys ( p ) . forEach ( k -> pDispatcher . modified ( k , p , emptyList ( ) ) ) ) ; } catch ( final IOException e ) { LOG . warn ( "Exception occurred while trying to inform single listeners!" , e ) ; } }
Iterates over all files contained by this directory and informs for each entry the currently focused listener . Only direct children will be considered sub - directories and non - regular files will be ignored .
12,682
public static boolean equal ( Iterator itr1 , Iterator itr2 ) { if ( itr1 == null || itr2 == null ) { return false ; } else { while ( itr1 . hasNext ( ) && itr2 . hasNext ( ) ) { Object i = itr1 . next ( ) ; Object i2 = itr2 . next ( ) ; if ( ( i == null && i2 != null ) || ! ( i . equals ( i2 ) ) ) { return false ; } } if ( itr1 . hasNext ( ) || itr2 . hasNext ( ) ) { return false ; } return true ; } }
Tests two iterators for equality meaning that they have the same elements enumerated in the same order .
12,683
public static < T > List < T > asList ( Iterator < T > itr ) { List < T > l = new ArrayList < > ( ) ; if ( itr != null ) { while ( itr . hasNext ( ) ) { l . add ( itr . next ( ) ) ; } } return l ; }
Returns an iterator as a list .
12,684
public static int hash ( int initialNonZeroOddNumber , int multiplierNonZeroOddNumber , Object ... objs ) { int result = initialNonZeroOddNumber ; for ( Object obj : objs ) { result = multiplierNonZeroOddNumber * result + ( obj != null ? obj . hashCode ( ) : 0 ) ; } return result ; }
Computes a hashCode given the input objects .
12,685
public AppleScriptBuilder withLines ( List < String > lines ) { for ( String line : lines ) { withLine ( line ) ; } return this ; }
Append lines to the script .
12,686
public ClassMetadata add ( Class < ? > clazz ) { ClassMetadata metadata = classMetadataFactory . createMetadata ( clazz ) ; log . debug ( "Adding persistent class " + metadata . getKind ( ) ) ; metadata . validate ( ) ; if ( metadataByKind . get ( metadata . getKind ( ) ) != null ) { throw new DuplicateException ( "Two entities found with kind='" + metadata . getKind ( ) + "': " + metadata . getPersistentClass ( ) . getName ( ) + " and " + metadataByKind . get ( metadata . getKind ( ) ) . getPersistentClass ( ) . getName ( ) ) ; } metadataByClass . put ( metadata . getPersistentClass ( ) , metadata ) ; metadataByKind . put ( metadata . getKind ( ) , metadata ) ; return metadata ; }
Adds a persistent class to the repository
12,687
public void remove ( Class < ? > clazz ) { ClassMetadata metadata = get ( clazz ) ; metadataByClass . remove ( clazz ) ; metadataByKind . remove ( metadata . getKind ( ) ) ; }
Removes a persistent class from the repository
12,688
public static void addRetSuccessors ( List < Jsr > jsrs , int idx , IntCollection result ) { int i , max ; max = jsrs . size ( ) ; for ( i = 0 ; i < max ; i ++ ) { ( ( Jsr ) jsrs . get ( i ) ) . addRetSuccessors ( idx , result ) ; } }
idx index of ret
12,689
public static Object serializeAndDeserialize ( Object o ) throws IOException , ClassNotFoundException { ByteArrayOutputStream bytes = new ByteArrayOutputStream ( ) ; ObjectOutputStream out = new ObjectOutputStream ( bytes ) ; try { out . writeObject ( o ) ; } finally { out . close ( ) ; } ObjectInputStream in = new ObjectInputStream ( new ByteArrayInputStream ( bytes . toByteArray ( ) ) ) ; try { Object result = in . readObject ( ) ; return result ; } finally { in . close ( ) ; } }
Serializes and deserializes the given object .
12,690
public < Y extends Comparable < ? super Y > > RestrictionsContainer addEq ( String property , Y value ) { restrictions . add ( new Eq < Y > ( property , value ) ) ; return this ; }
Methode d ajout de la restriction Eq
12,691
public < Y extends Comparable < ? super Y > > RestrictionsContainer addNotEq ( String property , Y value ) { restrictions . add ( new NotEq < Y > ( property , value ) ) ; return this ; }
Methode d ajout de la restriction NotEq
12,692
public < Y extends Comparable < ? super Y > > RestrictionsContainer addGe ( String property , Y value ) { restrictions . add ( new Ge < Y > ( property , value ) ) ; return this ; }
Methode d ajout de la restriction GE
12,693
public < Y extends Comparable < ? super Y > > RestrictionsContainer addGt ( String property , Y value ) { restrictions . add ( new Gt < Y > ( property , value ) ) ; return this ; }
Methode d ajout de la restriction GT
12,694
public < Y extends Comparable < ? super Y > > RestrictionsContainer addLt ( String property , Y value ) { restrictions . add ( new Lt < Y > ( property , value ) ) ; return this ; }
Methode d ajout de la restriction Lt
12,695
public RestrictionsContainer addLike ( String property , String value ) { restrictions . add ( new Like ( property , value ) ) ; return this ; }
Methode d ajout de la restriction Like
12,696
public RestrictionsContainer addNotLike ( String property , String value ) { restrictions . add ( new NotLike ( property , value ) ) ; return this ; }
Methode d ajout de la restriction NotLike
12,697
public < Y extends Comparable < ? super Y > > RestrictionsContainer addLe ( String property , Y value ) { restrictions . add ( new Le < Y > ( property , value ) ) ; return this ; }
Methode d ajout de la restriction Le
12,698
public void message_polling_is_working ( ) throws JMSException { testSender4 . send ( "HELLO" ) ; try { count . await ( 5 , TimeUnit . SECONDS ) ; Assertions . assertThat ( text ) . isEqualTo ( "HELLO" ) ; } catch ( InterruptedException e ) { fail ( "Thread interrupted" ) ; } }
TestSender4 and TestMessageListener4 .
12,699
public static List getDisconnected ( Collection leftCollection , Graph relation , Collection rightCollection ) { List disconnected ; Iterator iter ; Object left ; EdgeIterator relationIter ; disconnected = new ArrayList ( ) ; iter = leftCollection . iterator ( ) ; while ( iter . hasNext ( ) ) { left = iter . next ( ) ; relationIter = relation . edges ( ) ; while ( relationIter . step ( ) ) { if ( relationIter . left ( ) == left ) { if ( ! rightCollection . contains ( relationIter . right ( ) ) ) { relationIter = null ; break ; } } } if ( relationIter != null ) { disconnected . add ( left ) ; } } return disconnected ; }
Returns all objects from leftCollection whole images are a disjoin from rightCollection none of the resulting objects has an image in rightCollection . Compares objects using == . Note that lefts with no image show up in the result .