idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
16,800
public static OpenCycUnsupportedFeatureException fromThrowable ( Throwable cause ) { return ( cause instanceof OpenCycUnsupportedFeatureException ) ? ( OpenCycUnsupportedFeatureException ) cause : new OpenCycUnsupportedFeatureException ( cause ) ; }
Converts a Throwable to a OpenCycUnsupportedFeatureException . If the Throwable is a OpenCycUnsupportedFeatureException it will be passed through unmodified ; otherwise it will be wrapped in a new OpenCycUnsupportedFeatureException .
16,801
public static OpenCycUnsupportedFeatureException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof OpenCycUnsupportedFeatureException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( OpenCycUnsupportedFeatureException ) cause : new OpenCycUnsupportedFeatureException ( message ...
Converts a Throwable to a OpenCycUnsupportedFeatureException with the specified detail message . If the Throwable is a OpenCycUnsupportedFeatureException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new OpenCycUnsuppo...
16,802
public static CreateException fromThrowable ( Throwable cause ) { return ( cause instanceof CreateException ) ? ( CreateException ) cause : new CreateException ( cause ) ; }
Converts a Throwable to a CreateException . If the Throwable is a CreateException it will be passed through unmodified ; otherwise it will be wrapped in a new CreateException .
16,803
public static CreateException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof CreateException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( CreateException ) cause : new CreateException ( message , cause ) ; }
Converts a Throwable to a CreateException with the specified detail message . If the Throwable is a CreateException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new CreateException with the detail message .
16,804
public static SessionManagerConfigurationException fromThrowable ( Throwable cause ) { return ( cause instanceof SessionManagerConfigurationException ) ? ( SessionManagerConfigurationException ) cause : new SessionManagerConfigurationException ( cause ) ; }
Converts a Throwable to a SessionManagerConfigurationException . If the Throwable is a SessionManagerConfigurationException it will be passed through unmodified ; otherwise it will be wrapped in a new SessionManagerConfigurationException .
16,805
public static SessionManagerConfigurationException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof SessionManagerConfigurationException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( SessionManagerConfigurationException ) cause : new SessionManagerConfigurationException ( ...
Converts a Throwable to a SessionManagerConfigurationException with the specified detail message . If the Throwable is a SessionManagerConfigurationException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new SessionMan...
16,806
private static boolean isAPortOffset ( int offset ) { return ( offset == STANDARD_ASCII_PORT_OFFSET ) || ( offset == STANDARD_HTTP_PORT_OFFSET ) || ( offset == STANDARD_SERVLET_PORT_OFFSET ) || ( offset == STANDARD_CFASL_PORT_OFFSET ) ; }
Tests whether an int is a known port offset .
16,807
public static SessionCommandException fromThrowable ( Throwable cause ) { return ( cause instanceof SessionCommandException ) ? ( SessionCommandException ) cause : new SessionCommandException ( cause ) ; }
Converts a Throwable to a SessionCommandException . If the Throwable is a SessionCommandException it will be passed through unmodified ; otherwise it will be wrapped in a new SessionCommandException .
16,808
public static SessionCommandException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof SessionCommandException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( SessionCommandException ) cause : new SessionCommandException ( message , cause ) ; }
Converts a Throwable to a SessionCommandException with the specified detail message . If the Throwable is a SessionCommandException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new SessionCommandException with the det...
16,809
public static UnsupportedCycOperationException fromThrowable ( Throwable cause ) { return ( cause instanceof UnsupportedCycOperationException ) ? ( UnsupportedCycOperationException ) cause : new UnsupportedCycOperationException ( cause ) ; }
Converts a Throwable to a UnsupportedCycOperationException . If the Throwable is a UnsupportedCycOperationException it will be passed through unmodified ; otherwise it will be wrapped in a new UnsupportedCycOperationException .
16,810
public static UnsupportedCycOperationException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof UnsupportedCycOperationException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( UnsupportedCycOperationException ) cause : new UnsupportedCycOperationException ( message , cause ...
Converts a Throwable to a UnsupportedCycOperationException with the specified detail message . If the Throwable is a UnsupportedCycOperationException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new UnsupportedCycOper...
16,811
public static void unregisterActivityLifecycleCallbacks ( Application application , ActivityLifecycleCallbacksCompat callback ) { if ( PRE_ICS ) { preIcsUnregisterActivityLifecycleCallbacks ( callback ) ; } else { postIcsUnregisterActivityLifecycleCallbacks ( application , callback ) ; } }
Unregisters a previously registered callback .
16,812
public static SessionRuntimeException fromThrowable ( Throwable cause ) { return ( cause instanceof SessionRuntimeException ) ? ( SessionRuntimeException ) cause : new SessionRuntimeException ( cause ) ; }
Converts a Throwable to a SessionRuntimeException . If the Throwable is a SessionRuntimeException it will be passed through unmodified ; otherwise it will be wrapped in a new SessionRuntimeException .
16,813
public static SessionRuntimeException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof SessionRuntimeException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( SessionRuntimeException ) cause : new SessionRuntimeException ( message , cause ) ; }
Converts a Throwable to a SessionRuntimeException with the specified detail message . If the Throwable is a SessionRuntimeException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new SessionRuntimeException with the det...
16,814
protected ByteSource stream ( final String resourceId ) { return new ByteSource ( ) { public InputStream openStream ( ) throws IOException { return loader . getResource ( resourceId ) . getInputStream ( ) ; } } ; }
Wouldn t it be nice if we wrote some tests?
16,815
public static QueryRuntimeException fromThrowable ( Throwable t ) { return ( t instanceof QueryRuntimeException ) ? ( QueryRuntimeException ) t : new QueryRuntimeException ( t ) ; }
Converts a Throwable to a QueryRuntimeException . If the Throwable is a QueryRuntimeException it will be passed through unmodified ; otherwise it will be wrapped in a new QueryRuntimeException .
16,816
public static QueryRuntimeException fromThrowable ( String message , Throwable t ) { return ( t instanceof QueryRuntimeException && Objects . equals ( message , t . getMessage ( ) ) ) ? ( QueryRuntimeException ) t : new QueryRuntimeException ( message , t ) ; }
Converts a Throwable to a QueryRuntimeException with the specified detail message . If the Throwable is a QueryRuntimeException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new QueryRuntimeException with the detail me...
16,817
public static ProofViewException fromThrowable ( Throwable cause ) { return ( cause instanceof ProofViewException ) ? ( ProofViewException ) cause : new ProofViewException ( cause ) ; }
Converts a Throwable to a ProofViewException . If the Throwable is a ProofViewException it will be passed through unmodified ; otherwise it will be wrapped in a new ProofViewException .
16,818
public static ProofViewException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof ProofViewException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( ProofViewException ) cause : new ProofViewException ( message , cause ) ; }
Converts a Throwable to a ProofViewException with the specified detail message . If the Throwable is a ProofViewException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new ProofViewException with the detail message .
16,819
public static KbException fromThrowable ( Throwable cause ) { return ( cause instanceof KbException ) ? ( KbException ) cause : new KbException ( cause ) ; }
Converts a Throwable to a KbException . If the Throwable is a KbException it will be passed through unmodified ; otherwise it will be wrapped in a new KbException .
16,820
public static KbException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof KbException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( KbException ) cause : new KbException ( message , cause ) ; }
Converts a Throwable to a KbException with the specified detail message . If the Throwable is a KbException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new KbException with the detail message .
16,821
public static DeleteException fromThrowable ( Throwable cause ) { return ( cause instanceof DeleteException ) ? ( DeleteException ) cause : new DeleteException ( cause ) ; }
Converts a Throwable to a DeleteException . If the Throwable is a DeleteException it will be passed through unmodified ; otherwise it will be wrapped in a new DeleteException .
16,822
public static DeleteException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof DeleteException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( DeleteException ) cause : new DeleteException ( message , cause ) ; }
Converts a Throwable to a DeleteException with the specified detail message . If the Throwable is a DeleteException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new DeleteException with the detail message .
16,823
public void initialize ( ) { if ( this . initializationState . setInitializing ( ) ) { if ( this . visibility == null ) { this . visibility = VisibilityModifier . PUBLIC ; } this . initializationState . setInitialized ( ) ; } }
This method initializes this class . It has to be called after construction and injection is completed .
16,824
public List < ModuleBuildFuture > getExtraBuilds ( ) { return extraBuilds == null ? Collections . < ModuleBuildFuture > emptyList ( ) : Collections . unmodifiableList ( extraBuilds ) ; }
Returns the list of additional futures that should be processed along with this build this future
16,825
public double getCoverDelta ( GrammarRuleRecord rule ) { int new_cover = 0 ; int overlapping_cover = 0 ; for ( RuleInterval i : rule . getRuleIntervals ( ) ) { int start = i . getStart ( ) ; int end = i . getEnd ( ) ; for ( int j = start ; j < end ; j ++ ) { if ( range [ j ] ) { overlapping_cover ++ ; } else { new_cove...
Computes the delta value for the suggested rule candidate .
16,826
private boolean isCompletelyCoveredBy ( int [ ] isCovered , List < RuleInterval > intervals ) { for ( RuleInterval i : intervals ) { for ( int j = i . getStart ( ) ; j < i . getEnd ( ) ; j ++ ) { if ( isCovered [ j ] == 0 ) { return false ; } } } return true ; }
Checks if the cover is complete .
16,827
public void expand ( ) { join ( p , r . first ( ) ) ; join ( r . last ( ) , n ) ; r . theGuard . r = null ; r . theGuard = null ; }
This symbol is the last reference to its rule . The contents of the rule are substituted in its place .
16,828
public void insert ( String str , int lineno , int colno ) { final String sourceMethod = "insert" ; if ( isTraceLogging ) { log . entering ( JSSource . class . getName ( ) , sourceMethod , new Object [ ] { str , lineno , colno } ) ; } PositionLocator locator = new PositionLocator ( lineno , colno ) ; locator . insert (...
Inserts the specified string into the source at the specified location
16,829
public void appendln ( String str ) { BufferedReader rdr = new BufferedReader ( new StringReader ( str ) ) ; while ( true ) { String line = null ; try { line = rdr . readLine ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } if ( line != null ) { lines . add ( new LineInfo ( line ) ) ; continue ; }...
Appends the lines in the specified string to the current source .
16,830
public void disposeAndValidate ( ) throws ObjectNotFoundException , ComposedException { List < NlsObject > errorList = this . duplicateIdErrors ; this . duplicateIdErrors = null ; for ( Resolver resolver : this . id2callableMap . values ( ) ) { if ( ! resolver . resolved ) { errorList . add ( this . bundle . errorObjec...
This method disposes this context and performs a validation that all IDs have been resolved .
16,831
public void setNamespace ( String prefix , String uri ) { this . prefix2namespace . put ( prefix , uri ) ; this . namespace2prefix . put ( uri , prefix ) ; }
This method is used to declare a namespace in this context .
16,832
private ChocoConstraint build ( Constraint cstr ) throws SchedulerException { ChocoMapper mapper = params . getMapper ( ) ; ChocoConstraint cc = mapper . get ( cstr ) ; if ( cc == null ) { throw new SchedulerModelingException ( origin , "No implementation mapped to '" + cstr . getClass ( ) . getSimpleName ( ) + "'" ) ;...
Build a sat constraint
16,833
private static void checkNodesExistence ( Model mo , Collection < Node > ns ) throws SchedulerModelingException { for ( Node node : ns ) { if ( ! mo . getMapping ( ) . contains ( node ) ) { throw new SchedulerModelingException ( mo , "Unknown node '" + node + "'" ) ; } } }
Check for the existence of nodes in a model
16,834
public SingleRunnerStatistics getStatistics ( ) { if ( rp != null ) { Measures m = rp . getSolver ( ) . getMeasures ( ) ; stats . setMetrics ( new Metrics ( m ) ) ; stats . setCompleted ( m . getSearchState ( ) . equals ( SearchState . TERMINATED ) || m . getSearchState ( ) . equals ( SearchState . NEW ) ) ; } return s...
Get the statistics about the solving process .
16,835
protected double calcDistTSAndPattern ( double [ ] ts , double [ ] pValue ) { double INF = 10000000000000000000f ; double bestDist = INF ; int patternLen = pValue . length ; int lastStartP = ts . length - pValue . length + 1 ; if ( lastStartP < 1 ) return bestDist ; Random rand = new Random ( ) ; int startP = rand . ne...
Calculating the distance between time series and pattern .
16,836
protected double eculideanDistNormEAbandon ( double [ ] ts1 , double [ ] ts2 , double bsfDist ) { double dist = 0 ; double tsLen = ts1 . length ; double bsf = Math . pow ( tsLen * bsfDist , 2 ) ; for ( int i = 0 ; i < ts1 . length ; i ++ ) { double diff = ts1 [ i ] - ts2 [ i ] ; dist += Math . pow ( diff , 2 ) ; if ( d...
Normalized early abandoned Euclidean distance .
16,837
protected double eculideanDistNorm ( double [ ] ts1 , double [ ] ts2 ) { double dist = 0 ; double tsLen = ts1 . length ; for ( int i = 0 ; i < ts1 . length ; i ++ ) { double diff = ts1 [ i ] - ts2 [ i ] ; dist += Math . pow ( diff , 2 ) ; } return Math . sqrt ( dist ) / tsLen ; }
Normalized Euclidean distance .
16,838
private static void toAbsoluteFreeResources ( TIntIntHashMap changes , int [ ] sortedMoments ) { for ( int i = 1 ; i < sortedMoments . length ; i ++ ) { int t = sortedMoments [ i ] ; int lastT = sortedMoments [ i - 1 ] ; int lastFree = changes . get ( lastT ) ; changes . put ( t , changes . get ( t ) + lastFree ) ; } }
Translation for a relatives resources changes to an absolute free resources .
16,839
private void addLinkConstraints ( ReconfigurationProblem rp ) { List < Task > tasksListUp = new ArrayList < > ( ) ; List < Task > tasksListDown = new ArrayList < > ( ) ; List < IntVar > heightsListUp = new ArrayList < > ( ) ; List < IntVar > heightsListDown = new ArrayList < > ( ) ; for ( Link l : net . getLinks ( ) ) ...
Add the cumulative constraints for each link .
16,840
public static void fill ( Mapping src , Mapping dst ) { for ( Node off : src . getOfflineNodes ( ) ) { dst . addOfflineNode ( off ) ; } for ( VM r : src . getReadyVMs ( ) ) { dst . addReadyVM ( r ) ; } for ( Node on : src . getOnlineNodes ( ) ) { dst . addOnlineNode ( on ) ; for ( VM r : src . getRunningVMs ( on ) ) { ...
Fill a destination mapping with all the elements in a source mapping
16,841
public String toRuleString ( ) { if ( 0 == this . ruleNumber ) { return this . grammar . r0String ; } return this . first . toString ( ) + SPACE + this . second . toString ( ) + SPACE ; }
Return the prefixed with R rule .
16,842
public int [ ] getOccurrences ( ) { int [ ] res = new int [ this . occurrences . size ( ) ] ; for ( int i = 0 ; i < this . occurrences . size ( ) ; i ++ ) { res [ i ] = this . occurrences . get ( i ) ; } return res ; }
Gets occurrences .
16,843
static public boolean isProvisional ( Iterable < ICacheKeyGenerator > keyGens ) { boolean provisional = false ; for ( ICacheKeyGenerator keyGen : keyGens ) { if ( keyGen . isProvisional ( ) ) { provisional = true ; break ; } } return provisional ; }
Return true if any of the cache key generators in the array is a provisional cache key generator .
16,844
public static < E > Collection < E > unionColl ( Collection < E > c1 , Collection < E > c2 ) { return new UColl < E > ( c1 , c2 ) ; }
Returns the immutable union of two collections .
16,845
protected void unfoldModulesHelper ( Object obj , String path , String [ ] aPrefixes , Map < Integer , String > modules ) throws IOException , JSONException { final String sourceMethod = "unfoldModulesHelper" ; if ( isTraceLogging ) { log . entering ( RequestedModuleNames . class . getName ( ) , sourceMethod , new Obje...
Helper routine to unfold folded module names
16,846
public static < K , V > MapFactory < K , V > cow ( MapFactory < K , V > underMapFact ) { throw new UnsupportedOperationException ( "Not implemented yet" ) ; }
Copy - on - write maps . UNIMPLEMENTED YET .
16,847
private void sealObject ( ScriptableObject obj ) { obj . sealObject ( ) ; Object [ ] ids = obj . getIds ( ) ; for ( Object id : ids ) { Object child = obj . get ( id ) ; if ( child instanceof ScriptableObject ) { sealObject ( ( ScriptableObject ) child ) ; } } }
Recursively seals the specified object and all the objects it contains .
16,848
protected String _resolve ( String name , Features features , Set < String > dependentFeatures , boolean resolveAliases , boolean evaluateHasPluginConditionals , int recursionCount , StringBuffer sb ) { final String sourceMethod = "_resolve" ; boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLo...
Resolves a module id by applying alias resolution and has! loader plugin resolution .
16,849
protected URI loadConfigUri ( ) throws URISyntaxException , FileNotFoundException { Collection < String > configNames = getAggregator ( ) . getInitParams ( ) . getValues ( InitParams . CONFIG_INITPARAM ) ; if ( configNames . size ( ) != 1 ) { throw new IllegalArgumentException ( InitParams . CONFIG_INITPARAM ) ; } Stri...
Initializes and returns the URI to the server - side config JavaScript
16,850
protected Location loadBaseURI ( Scriptable cfg ) throws URISyntaxException { Object baseObj = cfg . get ( BASEURL_CONFIGPARAM , cfg ) ; Location result ; if ( baseObj == Scriptable . NOT_FOUND ) { result = new Location ( getConfigUri ( ) . resolve ( "." ) ) ; } else { Location loc = loadLocation ( baseObj , true ) ; L...
Initializes and returns the base URI specified by the baseUrl property in the server - side config JavaScript
16,851
protected Scriptable loadConfig ( String configScript ) throws IOException { configScript = processConfig ( configScript ) ; Context cx = Context . enter ( ) ; Scriptable config ; try { sharedScope = cx . initStandardObjects ( null , true ) ; IOptions options = aggregator . getOptions ( ) ; if ( options != null ) { opt...
Loads the config JavaScript and returns the parsed config in a Map
16,852
protected Map < String , IPackage > loadPackages ( Scriptable cfg ) throws URISyntaxException { Object obj = cfg . get ( PACKAGES_CONFIGPARAM , cfg ) ; Map < String , IPackage > packages = new HashMap < String , IPackage > ( ) ; if ( obj instanceof Scriptable ) { for ( Object id : ( ( Scriptable ) obj ) . getIds ( ) ) ...
Initializes and returns the map of packages based on the information in the server - side config JavaScript
16,853
protected Map < String , Location > loadPaths ( Scriptable cfg ) throws URISyntaxException { Object pathlocs = cfg . get ( PATHS_CONFIGPARAM , cfg ) ; Map < String , Location > paths = new HashMap < String , Location > ( ) ; if ( pathlocs instanceof Scriptable ) { for ( Object key : ( ( Scriptable ) pathlocs ) . getIds...
Initializes and returns the map of paths based on the information in the server - side config JavaScript
16,854
protected List < IAlias > loadAliases ( Scriptable cfg ) throws IOException { Object aliasList = cfg . get ( ALIASES_CONFIGPARAM , cfg ) ; List < IAlias > aliases = new LinkedList < IAlias > ( ) ; if ( aliasList instanceof Scriptable ) { for ( Object id : ( ( Scriptable ) aliasList ) . getIds ( ) ) { if ( id instanceof...
Initializes and returns the list of aliases defined in the server - side config JavaScript
16,855
protected List < String > loadDeps ( Scriptable cfg ) { final String methodName = "loadDeps" ; Object depsList = cfg . get ( DEPS_CONFIGPARAM , cfg ) ; List < String > deps = new LinkedList < String > ( ) ; if ( depsList instanceof Scriptable ) { for ( Object id : ( ( Scriptable ) depsList ) . getIds ( ) ) { if ( id in...
Initializes and returns the list of module dependencies specified in the server - side config JavaScript .
16,856
protected int loadExpires ( Scriptable cfg ) { int expires = 0 ; Object oExpires = cfg . get ( EXPIRES_CONFIGPARAM , cfg ) ; if ( oExpires != Scriptable . NOT_FOUND ) { try { expires = Integer . parseInt ( toString ( oExpires ) ) ; } catch ( NumberFormatException ignore ) { throw new IllegalArgumentException ( EXPIRES_...
Initializes and returns the expires time from the server - side config JavaScript
16,857
protected boolean loadDepsIncludeBaseUrl ( Scriptable cfg ) { boolean result = false ; Object value = cfg . get ( DEPSINCLUDEBASEURL_CONFIGPARAM , cfg ) ; if ( value != Scriptable . NOT_FOUND ) { result = TypeUtil . asBoolean ( toString ( value ) , false ) ; } return result ; }
Initializes and returns the flag indicating if files and directories located under the base directory should be scanned for javascript files when building the module dependency mappings . The default is false .
16,858
protected boolean loadCoerceUndefinedToFalse ( Scriptable cfg ) { boolean result = false ; Object value = cfg . get ( COERCEUNDEFINEDTOFALSE_CONFIGPARAM , cfg ) ; if ( value != Scriptable . NOT_FOUND ) { result = TypeUtil . asBoolean ( toString ( value ) , false ) ; } return result ; }
Initializes and returns the flag indicating if features not specified in the feature set from the request should be treated as false when evaluating has conditionals in javascript code . The default is false .
16,859
protected Set < String > loadPluginDelegators ( Scriptable cfg , String name ) { Set < String > result = null ; Object delegators = cfg . get ( name , cfg ) ; if ( delegators != Scriptable . NOT_FOUND && delegators instanceof Scriptable ) { result = new HashSet < String > ( ) ; for ( Object id : ( ( Scriptable ) delega...
Common routine to load text or js plugin delegators
16,860
protected void callConfigModifiers ( Scriptable rawConfig ) { if ( aggregator . getPlatformServices ( ) != null ) { IServiceReference [ ] refs = null ; try { refs = aggregator . getPlatformServices ( ) . getServiceReferences ( IConfigModifier . class . getName ( ) , "(name=" + getAggregator ( ) . getName ( ) + ")" ) ; ...
Calls the registered config modifiers to give them an opportunity to modify the raw config before config properties are evaluated .
16,861
protected void callConfigScopeModifiers ( Scriptable scope ) { if ( aggregator . getPlatformServices ( ) != null ) { IServiceReference [ ] refs = null ; try { refs = aggregator . getPlatformServices ( ) . getServiceReferences ( IConfigScopeModifier . class . getName ( ) , "(name=" + getAggregator ( ) . getName ( ) + ")...
Calls the registered config scope modifiers to give them an opportunity to prepare the scope object prior to evaluating the config JavaScript
16,862
protected boolean isValidType ( Class < ? > type , Annotation [ ] classAnnotations ) { if ( type == null ) return false ; if ( annotated ) { return checkAnnotation ( type ) ; } else if ( scanpackages != null ) { String classPackage = type . getPackage ( ) . getName ( ) ; for ( String pkg : scanpackages ) { if ( classPa...
Check whether a class can be serialized or deserialized . It can check based on packages annotations on entities or explicit classes .
16,863
public void writeTo ( Object t , Class < ? > type , Type genericType , Annotation [ ] annotations , MediaType mediaType , MultivaluedMap < String , Object > httpHeaders , OutputStream entityStream ) throws IOException , WebApplicationException { SerializeFilter filter = null ; if ( pretty ) { if ( fastJsonConfig . seri...
Method that JAX - RS container calls to serialize given value .
16,864
public Object readFrom ( Class < Object > type , Type genericType , Annotation [ ] annotations , MediaType mediaType , MultivaluedMap < String , String > httpHeaders , InputStream entityStream ) throws IOException , WebApplicationException { String input = null ; try { input = IOUtils . inputStreamToString ( entityStre...
Method that JAX - RS container calls to deserialize given value .
16,865
public static ArrayList < SameLengthMotifs > performPruning ( double [ ] ts , GrammarRules grammarRules , double thresholdLength , double thresholdCom , double fractionTopDist ) { RuleOrganizer ro = new RuleOrganizer ( ) ; ArrayList < SameLengthMotifs > allClassifiedMotifs = ro . classifyMotifs ( thresholdLength , gram...
Performs clustering .
16,866
public static ArrayList < PackedRuleRecord > getPackedRule ( ArrayList < SameLengthMotifs > newAllClassifiedMotifs ) { ArrayList < PackedRuleRecord > arrPackedRuleRecords = new ArrayList < PackedRuleRecord > ( ) ; int i = 0 ; for ( SameLengthMotifs subsequencesInClass : newAllClassifiedMotifs ) { int classIndex = i ; i...
Gets packed rules set .
16,867
protected Dictionary < ? , ? > getBundleHeaders ( String bundleName ) throws NotFoundException { final String sourceMethod = "getBundleHeaders" ; boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( BundleVersionsHashBase . class . getName ( ) , sourceMethod , new Objec...
Returns the bundle headers for the specified bundle .
16,868
public boolean checkConformance ( BtrPlaceTree t , List < BtrpOperand > ops ) { if ( ops . size ( ) != getParameters ( ) . length ) { t . ignoreError ( "'" + pretty ( ops ) + "' cannot be casted to '" + getSignature ( ) + "'" ) ; return false ; } for ( int i = 0 ; i < ops . size ( ) ; i ++ ) { BtrpOperand o = ops . get...
Check if the provided parameters match the constraint signature
16,869
public Script build ( File f ) throws ScriptBuilderException { int k = f . getAbsolutePath ( ) . hashCode ( ) ; if ( dates . containsKey ( k ) && dates . get ( k ) == f . lastModified ( ) && cache . containsKey ( f . getPath ( ) ) ) { LOGGER . debug ( "get '" + f . getName ( ) + "' from the cache" ) ; return cache . ge...
Build a script from a file .
16,870
@ SuppressWarnings ( "squid:S1166" ) private Script build ( CharStream cs ) throws ScriptBuilderException { Script v = new Script ( ) ; ANTLRBtrplaceSL2Lexer lexer = new ANTLRBtrplaceSL2Lexer ( cs ) ; ErrorReporter errorReporter = errBuilder . build ( v ) ; lexer . setErrorReporter ( errorReporter ) ; CommonTokenStream...
Internal method to check a script from a stream .
16,871
public Graph generateRandomMMapGraph ( String graphName , int size , float dens ) { Graph graph = null ; String dir = "graphs/MMap/" + graphName ; SerializationUtils . deleteMMapGraph ( dir ) ; graph = new Graph ( new MMapGraphStructure ( dir ) ) ; Random rand = new Random ( ) ; for ( int i = 0 ; i < size ; i ++ ) grap...
Create a new Graph which has the given graphName size and dens .
16,872
public static Map < IntVar , VM > makePlacementMap ( ReconfigurationProblem rp ) { Map < IntVar , VM > m = new HashMap < > ( rp . getFutureRunningVMs ( ) . size ( ) ) ; for ( VM vm : rp . getFutureRunningVMs ( ) ) { IntVar v = rp . getVMAction ( vm ) . getDSlice ( ) . getHoster ( ) ; m . put ( v , vm ) ; } return m ; }
Map a map where keys are the placement variable of the future - running VMs and values are the VM identifier .
16,873
public final void validate ( StringBuilder source ) { int length = source . length ( ) ; source . append ( '/' ) ; source . append ( getSourceIdentifier ( ) ) ; doValidate ( source ) ; source . setLength ( length ) ; }
This method validates this segment recursively to ensure the correctness of the configured format .
16,874
public ShareableResource setConsumption ( VM vm , int val ) { if ( val < 0 ) { throw new IllegalArgumentException ( String . format ( "The '%s' consumption of VM '%s' must be >= 0" , rcId , vm ) ) ; } vmsConsumption . put ( vm , val ) ; return this ; }
Set the resource consumption of a VM .
16,875
public ShareableResource setConsumption ( int val , VM ... vms ) { Stream . of ( vms ) . forEach ( v -> setConsumption ( v , val ) ) ; return this ; }
Set the resource consumption of VMs .
16,876
public ShareableResource setCapacity ( Node n , int val ) { if ( val < 0 ) { throw new IllegalArgumentException ( String . format ( "The '%s' capacity of node '%s' must be >= 0" , rcId , n ) ) ; } nodesCapacity . put ( n , val ) ; return this ; }
Set the resource consumption of a node .
16,877
public ShareableResource setCapacity ( int val , Node ... nodes ) { Stream . of ( nodes ) . forEach ( n -> this . setCapacity ( n , val ) ) ; return this ; }
Set the resource consumption of nodes .
16,878
public int sumConsumptions ( Collection < VM > ids , boolean undef ) { int s = 0 ; for ( VM u : ids ) { if ( consumptionDefined ( u ) || undef ) { s += vmsConsumption . get ( u ) ; } } return s ; }
Get the cumulative VMs consumption .
16,879
public int sumCapacities ( Collection < Node > ids , boolean undef ) { int s = 0 ; for ( Node u : ids ) { if ( capacityDefined ( u ) || undef ) { s += nodesCapacity . get ( u ) ; } } return s ; }
Get the cumulative nodes capacity .
16,880
public static ShareableResource get ( Model mo , String id ) { return ( ShareableResource ) mo . getView ( VIEW_ID_BASE + id ) ; }
Get the view associated to a model if exists
16,881
public String getlocalName ( ) { if ( fqn . contains ( "." ) ) { return this . fqn . substring ( fqn . lastIndexOf ( '.' ) + 1 , this . fqn . length ( ) ) ; } return fqn ; }
Get the local name of the script .
16,882
public boolean add ( Collection < BtrpElement > elems ) { boolean ret = false ; for ( BtrpElement el : elems ) { ret |= add ( el ) ; } return ret ; }
Add a collection of nodes or elements .
16,883
public boolean add ( BtrpElement el ) { switch ( el . type ( ) ) { case VM : if ( ! this . vms . add ( ( VM ) el . getElement ( ) ) ) { return false ; } break ; case NODE : if ( ! this . nodes . add ( ( Node ) el . getElement ( ) ) ) { return false ; } break ; default : return false ; } return true ; }
Add a VM or a node to the script .
16,884
public List < BtrpOperand > getImportables ( String ns ) { List < BtrpOperand > importable = new ArrayList < > ( ) ; for ( String symbol : getExported ( ) ) { if ( canImport ( symbol , ns ) ) { importable . add ( getImportable ( symbol , ns ) ) ; } } return importable ; }
Get all the operand a given script can import
16,885
public BtrpOperand getImportable ( String label , String namespace ) { if ( canImport ( label , namespace ) ) { return exported . get ( label ) ; } return null ; }
Get the exported operand from its label .
16,886
public boolean canImport ( String label , String namespace ) { if ( ! exported . containsKey ( label ) ) { return false ; } Set < String > scopes = exportScopes . get ( label ) ; for ( String scope : scopes ) { if ( scope . equals ( namespace ) ) { return true ; } else if ( scope . endsWith ( "*" ) && namespace . start...
Indicates whether a namespace can import an exported variable or not . To be imported the label must point to an exported variable with no import restrictions or with a given namespace compatible with the restrictions .
16,887
public String fullyQualifiedSymbolName ( String name ) { if ( name . equals ( SymbolsTable . ME ) ) { return "$" . concat ( id ( ) ) ; } else if ( name . startsWith ( "$" ) ) { return "$" + id ( ) + '.' + name . substring ( 1 ) ; } return id ( ) + '.' + name ; }
Get the fully qualified name of a symbol .
16,888
public String prettyDependencies ( ) { StringBuilder b = new StringBuilder ( ) ; b . append ( id ( ) ) . append ( '\n' ) ; for ( Iterator < Script > ite = dependencies . iterator ( ) ; ite . hasNext ( ) ; ) { Script n = ite . next ( ) ; prettyDependencies ( b , ! ite . hasNext ( ) , 0 , n ) ; } return b . toString ( ) ...
Textual representation for the dependencies .
16,889
public void addNode ( Node n ) { try { structure . addNode ( n ) ; for ( NodeListener listener : nodeListeners ) listener . onInsert ( n ) ; } catch ( DuplicatedNodeException e ) { duplicatedNodesCounter ++ ; } }
Adds a new node to the graph given the Node object . If a node already exists with an id equal to the given node a DuplicatedNodeException is thrown .
16,890
public void addEdge ( Edge e ) { structure . addEdge ( e ) ; for ( EdgeListener listener : edgeListeners ) listener . onInsert ( e ) ; }
Adds a new edge to this graph given a new Edge object . It uses the GraphStructure attribute s addEdge method to add the new edge to this graph . If one of the node ids of the given Edge object does not exists in this graph a NodeNotFoundException is thrown . Otherwise the edge is successfully added to this graph .
16,891
public Iterator < Long > getNeighborhoodIterator ( final long id ) { return new Iterator < Long > ( ) { Iterator < Edge > iter = structure . getExistingOutEdgesIterator ( id ) ; public boolean hasNext ( ) { return iter . hasNext ( ) ; } public Long next ( ) { Edge e = iter . next ( ) ; return e . getFromNodeId ( ) == i...
Gets the neighborhood from a node represented by a given id . If the graph has any Node object with the given id this function returns an Iterator object representing all the neighboring Node objects to the given node . The neighboring nodes are given according to the outgoing edges of the Node object of the graph that...
16,892
public static JSONObject toJSON ( Attributes attributes ) { JSONObject res = new JSONObject ( ) ; JSONObject vms = new JSONObject ( ) ; JSONObject nodes = new JSONObject ( ) ; for ( Element e : attributes . getDefined ( ) ) { JSONObject el = new JSONObject ( ) ; for ( String k : attributes . getKeys ( e ) ) { el . put ...
Serialise attributes .
16,893
private void fullKnapsack ( ) throws ContradictionException { for ( int bin = 0 ; bin < prop . nbBins ; bin ++ ) { for ( int d = 0 ; d < prop . nbDims ; d ++ ) { knapsack ( bin , d ) ; } } }
Propagate a knapsack on every node and every dimension .
16,894
public void postInitialize ( ) throws ContradictionException { final int [ ] biggest = new int [ prop . nbDims ] ; for ( int i = 0 ; i < prop . bins . length ; i ++ ) { for ( int d = 0 ; d < prop . nbDims ; d ++ ) { biggest [ d ] = Math . max ( biggest [ d ] , prop . iSizes [ d ] [ i ] ) ; } if ( ! prop . bins [ i ] . ...
initialize the lists of candidates .
16,895
@ SuppressWarnings ( "squid:S3346" ) public void postRemoveItem ( int item , int bin ) { assert candidate . get ( bin ) . get ( item ) ; candidate . get ( bin ) . clear ( item ) ; }
update the candidate list of a bin when an item is removed
16,896
private void knapsack ( int bin , int d ) throws ContradictionException { final int maxLoad = prop . loads [ d ] [ bin ] . getUB ( ) ; final int free = maxLoad - prop . assignedLoad [ d ] [ bin ] . get ( ) ; if ( free >= dynBiggest [ d ] [ bin ] . get ( ) ) { return ; } if ( free > 0 ) { int newMax = - 1 ; for ( int i ...
Propagate a knapsack on a given dimension and bin . If the usage of an item exceeds the bin free capacity it is filtered out .
16,897
public void add ( Metrics m ) { timeCount += m . timeCount ; readingTimeCount += m . readingTimeCount ; nodes += m . nodes ; backtracks += m . backtracks ; fails += m . fails ; restarts += m . restarts ; }
Add metrics . All the metrics are aggregated to the current instance
16,898
protected String generateCacheKey ( HttpServletRequest request , Map < String , ICacheKeyGenerator > cacheKeyGenerators ) throws IOException { String cacheKey = null ; if ( cacheKeyGenerators != null ) { Map < String , ICacheKeyGenerator > gens = new TreeMap < String , ICacheKeyGenerator > ( ) ; for ( ICacheKeyGenerato...
Generates a cache key for the layer .
16,899
private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { in . defaultReadObject ( ) ; _validateLastModified = new AtomicBoolean ( true ) ; _cacheKeyGenMutex = new Semaphore ( 1 ) ; _isReportCacheInfo = false ; }
De - serialize this object from an ObjectInputStream