idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
140,600 | public Tree putObject ( String path , Object value ) { return putObjectInternal ( path , getNodeValue ( value ) , false ) ; } | Puts a node with the specified value into the specified path . |
140,601 | public static Instance readInstance ( File f ) { try ( Reader in = makeIn ( f ) ) { return readInstance ( in ) ; } catch ( IOException e ) { throw new IllegalArgumentException ( e ) ; } } | Read an instance from a file . A file ending with . gz is uncompressed first |
140,602 | public static Instance readInstance ( Reader r ) { try { InstanceConverter c = new InstanceConverter ( ) ; return c . fromJSON ( r ) ; } catch ( JSONConverterException e ) { throw new IllegalArgumentException ( e ) ; } } | Read an instance . |
140,603 | public static void write ( Instance instance , File f ) { try ( OutputStreamWriter out = makeOut ( f ) ) { write ( instance , out ) ; } catch ( IOException e ) { throw new IllegalArgumentException ( e ) ; } } | Write an instance . |
140,604 | public static void write ( Instance instance , Appendable a ) { try { InstanceConverter c = new InstanceConverter ( ) ; c . toJSON ( instance ) . writeJSONString ( a ) ; } catch ( IOException | JSONConverterException e ) { throw new IllegalArgumentException ( e ) ; } } | Write an instance |
140,605 | public static ReconfigurationPlan readReconfigurationPlan ( File f ) { try ( Reader in = makeIn ( f ) ) { return readReconfigurationPlan ( in ) ; } catch ( IOException e ) { throw new IllegalArgumentException ( e ) ; } } | Read a reconfiguration plan from a file . A file ending with . gz is uncompressed first |
140,606 | public static ReconfigurationPlan readReconfigurationPlan ( Reader r ) { try { ReconfigurationPlanConverter c = new ReconfigurationPlanConverter ( ) ; return c . fromJSON ( r ) ; } catch ( JSONConverterException e ) { throw new IllegalArgumentException ( e ) ; } } | Read a plan . |
140,607 | public Collection < Node > getAssociatedPGroup ( Node u ) { for ( Collection < Node > pGrp : pGroups ) { if ( pGrp . contains ( u ) ) { return pGrp ; } } return Collections . emptySet ( ) ; } | Get the group of nodes associated to a given node . |
140,608 | static public Collection < URI > removeRedundantPaths ( Collection < URI > uris ) { List < URI > result = new ArrayList < URI > ( ) ; for ( URI uri : uris ) { String path = uri . getPath ( ) ; if ( ! path . endsWith ( "/" ) ) { path += "/" ; } boolean addIt = true ; for ( int i = 0 ; i < result . size ( ) ; i ++ ) { UR... | Removes URIs containing duplicate and non - orthogonal paths so that the collection contains only unique and non - overlapping paths . |
140,609 | static Object convert ( Object object , Class < ? > otherType ) { if ( otherType == BigDecimal . class ) { if ( object instanceof BigInteger ) { return new BigDecimal ( ( BigInteger ) object ) ; } else if ( object instanceof Number ) { return BigDecimal . valueOf ( ( ( Number ) object ) . doubleValue ( ) ) ; } } else i... | This method converts the given value to a more common type . |
140,610 | public InputStream getInputStream ( HttpServletRequest request , MutableObject < byte [ ] > sourceMapResult ) throws IOException { byte [ ] bytes = this . bytes ; byte [ ] sourceMap = this . sourceMap ; String filename = this . filename ; InputStream result = null ; if ( bytes != null ) { result = new ByteArrayInputStr... | Return an input stream to the layer . Has side effect of setting the appropriate Content - Type Content - Length and Content - Encoding headers in the response . |
140,611 | public InputStream tryGetInputStream ( HttpServletRequest request , MutableObject < byte [ ] > sourceMapResult ) throws IOException { InputStream result = null ; if ( bytes != null || filename != null ) { try { result = getInputStream ( request , sourceMapResult ) ; } catch ( Exception e ) { if ( LayerImpl . log . isLo... | Can fail by returning null but won t throw an exception . |
140,612 | public void setData ( byte [ ] bytes , byte [ ] sourceMap ) { this . sourceMap = sourceMap ; sourceMapSize = sourceMap != null ? sourceMap . length : 0 ; setBytes ( bytes ) ; } | Sets the contents of the cache entry with source map info . |
140,613 | public synchronized void delete ( final ICacheManager mgr ) { delete = true ; if ( filename != null ) { mgr . deleteFileDelayed ( filename ) ; } } | Delete the cached build after the specified delay in minues |
140,614 | public void persist ( final ICacheManager mgr ) throws IOException { if ( delete ) return ; if ( sourceMapSize == 0 ) { mgr . createCacheFileAsync ( "layer." , new ByteArrayInputStream ( bytes ) , new CreateCompletionCallback ( mgr ) ) ; } else { Object data = new CacheData ( bytes , sourceMap ) ; mgr . externalizeCach... | Asynchronously write the layer build content to disk and set filename to the name of the cache files when done . |
140,615 | public void register ( ConstraintConverter < ? extends Constraint > c ) { java2json . put ( c . getSupportedConstraint ( ) , c ) ; json2java . put ( c . getJSONId ( ) , c ) ; } | Register a converter for a specific constraint . |
140,616 | public Constraint fromJSON ( Model mo , JSONObject in ) throws JSONConverterException { checkKeys ( in , "id" ) ; Object id = in . get ( "id" ) ; ConstraintConverter < ? extends Constraint > c = json2java . get ( id . toString ( ) ) ; if ( c == null ) { throw new JSONConverterException ( "No converter available for a c... | Convert a json - encoded constraint . |
140,617 | public JSONObject toJSON ( Constraint o ) throws JSONConverterException { ConstraintConverter c = java2json . get ( o . getClass ( ) ) ; if ( c == null ) { throw new JSONConverterException ( "No converter available for a constraint with the '" + o . getClass ( ) + "' className" ) ; } return c . toJSON ( o ) ; } | Serialise a constraint . |
140,618 | public List < SatConstraint > listFromJSON ( Model mo , JSONArray in ) throws JSONConverterException { List < SatConstraint > l = new ArrayList < > ( in . size ( ) ) ; for ( Object o : in ) { if ( ! ( o instanceof JSONObject ) ) { throw new JSONConverterException ( "Expected an array of JSONObject but got an array of "... | Convert a list of json - encoded sat - constraints . |
140,619 | public JSONArray toJSON ( Collection < SatConstraint > e ) throws JSONConverterException { JSONArray arr = new JSONArray ( ) ; for ( SatConstraint cstr : e ) { arr . add ( toJSON ( cstr ) ) ; } return arr ; } | Serialise a list of sat - constraints . |
140,620 | public synchronized void clear ( ) { _layerCache . clear ( ) ; _moduleCache . clear ( ) ; _gzipCache . clear ( ) ; for ( IGenericCache cache : _namedCaches . values ( ) ) { cache . clear ( ) ; } } | Help out the GC by clearing out the cache maps . |
140,621 | public String toGrammarRules ( ) { StringBuffer sb = new StringBuffer ( ) ; System . out . println ( "R0 -> " + this . r0String ) ; for ( int i = 1 ; i <= this . theRules . size ( ) ; i ++ ) { RePairRule r = this . theRules . get ( i ) ; sb . append ( THE_R ) . append ( r . ruleNumber ) . append ( " -> " ) . append ( r... | Prints out the grammar as text . |
140,622 | public GrammarRules toGrammarRulesData ( ) { GrammarRules res = new GrammarRules ( ) ; GrammarRuleRecord r0 = new GrammarRuleRecord ( ) ; r0 . setRuleNumber ( 0 ) ; r0 . setRuleString ( this . r0String ) ; r0 . setExpandedRuleString ( this . r0ExpandedString ) ; r0 . setOccurrences ( new int [ ] { 0 } ) ; r0 . setMeanL... | Build a grammarviz - portable grammar object . |
140,623 | public void buildIntervals ( SAXRecords records , double [ ] originalTimeSeries , int slidingWindowSize ) { records . buildIndex ( ) ; for ( int ruleIdx = 1 ; ruleIdx <= this . theRules . size ( ) ; ruleIdx ++ ) { RePairRule rr = this . theRules . get ( ruleIdx ) ; String [ ] split = rr . expandedRuleString . split ( "... | Builds a table of intervals corresponding to the grammar rules . |
140,624 | private static Class < ? > fromPrimitive ( Class < ? > clazz ) { Class < ? > clazz2 = PRIMITIVE_TO_CLASS . get ( clazz ) ; return clazz2 == null ? clazz : clazz2 ; } | Converts and returns the specified class if it represents a primitive to the associated non - primitive class or else returns the specified class if it is not a primitive . |
140,625 | private static DiagnosticGroup findNamedDiagnosticGroup ( String name ) { final String sourceMethod = "findNamedDiagnosticGroup" ; final boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( sourceClass , sourceMethod , new Object [ ] { name } ) ; } DiagnosticGroup resul... | Tries to match the provided name with a named Diagnostic group defined in the DiagnosticGroups class . |
140,626 | protected String postcss ( HttpServletRequest request , String css , IResource res ) throws IOException { if ( threadScopes == null ) { return css ; } Context cx = Context . enter ( ) ; Scriptable threadScope = null ; String result = null ; try { threadScope = threadScopes . poll ( SCOPE_POOL_TIMEOUT_SECONDS , TimeUnit... | Runs given CSS through PostCSS processor for minification and any other processing by configured plugins . |
140,627 | protected Scriptable createThreadScope ( Context cx , Scriptable protoScope ) { Scriptable scope = cx . newObject ( protoScope ) ; scope . setPrototype ( protoScope ) ; scope . setParentScope ( null ) ; scope . put ( "global" , scope , scope ) ; postcssJsScript . exec ( cx , scope ) ; NativeArray plugins = ( NativeArra... | Creates a thread scope for the PostCSS processor and it s plugins . Thread scopes allow PostCSS to process multiple CSS modules concurrently each executing in a separate thread without interfering with each other . |
140,628 | public String dequote ( String in ) { String result = in . trim ( ) ; if ( result . charAt ( 0 ) == '"' && result . charAt ( result . length ( ) - 1 ) == '"' ) { return result . substring ( 1 , result . length ( ) - 1 ) ; } if ( result . charAt ( 0 ) == '\'' && result . charAt ( result . length ( ) - 1 ) == '\'' ) { re... | Removes single or double quotes from a quoted string . The entire string is expected to be quoted with possible leading or trailing whitespace . If the string is not quoted then it is returned unmodified . |
140,629 | public tr tr ( int index ) { while ( trList . size ( ) <= index ) { trList . add ( new tr ( ) ) ; } return trList . get ( index ) ; } | Get tr of specified index . If there no tr at the specified index new tr will be created . |
140,630 | public tr addTr ( Map < String , Object > attrMap ) { tr tr = new tr ( ) ; tr . setAttr ( attrMap ) ; trList . add ( tr ) ; return tr ; } | add new tr having specified attributes . |
140,631 | public < T extends AbstractJaxb > TableBuilder addTr ( List < Object > tdList ) throws TagTypeUnmatchException { return addTr ( tdList , null ) ; } | add new tr having td tags that has content of each value of list . |
140,632 | @ SuppressWarnings ( "unchecked" ) public < T extends AbstractJaxb > TableBuilder addTr ( List < Object > tdList , Map < String , Object > attrMap ) throws TagTypeUnmatchException { tr tr = new tr ( ) ; tr . setAttr ( attrMap ) ; for ( Object obj : tdList ) { if ( obj instanceof String ) { tr . addTd ( ( String ) obj )... | add new tr having td tags that has content of each value of list . The new tr tag have specifed attributes . |
140,633 | public tbody tbody ( int index ) { while ( tbodyList . size ( ) <= index ) { tbodyList . add ( new tbody ( ) ) ; } return tbodyList . get ( index ) ; } | Get tbody at specified index |
140,634 | public TableBuilder addTbody ( List < List < Object > > trList ) throws TagTypeUnmatchException { addTbody ( trList , null ) ; return this ; } | add new tbody into table having tr td tags |
140,635 | public Table build ( ) { Table table = new Table ( ) ; Thead _thead = thead . buildThead ( ) ; if ( _thead != null ) { table . setThead ( _thead ) ; } Tfoot _tfoot = tfoot . buildTfoot ( ) ; if ( _tfoot != null ) { table . setTfoot ( _tfoot ) ; } for ( tbody _tbody : tbodyList ) { table . getTbody ( ) . add ( _tbody . ... | build table tag object finally . |
140,636 | protected String getVersion ( ) { Manifest manifest = ManifestLoader . loadManifest ( getClass ( ) ) ; String versionNumber = null ; if ( manifest != null ) { versionNumber = ManifestLoader . getValue ( manifest , Attributes . Name . IMPLEMENTATION_VERSION ) ; if ( versionNumber == null ) { versionNumber = ManifestLoad... | This method gets the Version of this program . |
140,637 | protected void setValueInternal ( String argument , char separator , GenericType < ? > propertyType ) { if ( this . valueAlreadySet ) { CliOptionDuplicateException exception = new CliOptionDuplicateException ( getParameterContainer ( ) . getName ( ) ) ; CliStyleHandling . EXCEPTION . handle ( getLogger ( ) , exception ... | This method parses container value as from a single argument and sets it as new object . |
140,638 | public static TIntIntHashMap makeVMIndex ( Collection < Instance > instances ) { TIntIntHashMap index = new TIntIntHashMap ( ) ; int p = 0 ; for ( Instance i : instances ) { Mapping m = i . getModel ( ) . getMapping ( ) ; for ( Node n : m . getOnlineNodes ( ) ) { for ( VM v : m . getRunningVMs ( n ) ) { index . put ( v... | Make an index revealing the position of each VM in a collection of disjoint instances |
140,639 | public static TIntIntHashMap makeNodeIndex ( Collection < Instance > instances ) { TIntIntHashMap index = new TIntIntHashMap ( ) ; int p = 0 ; for ( Instance i : instances ) { Mapping m = i . getModel ( ) . getMapping ( ) ; for ( Node n : m . getOfflineNodes ( ) ) { index . put ( n . id ( ) , p ) ; } for ( Node n : m .... | Make an index revealing the position of each node in a collection of disjoint instances |
140,640 | public void initialize ( AbstractDetectorStreamProvider provider , DetectorStreamProcessor lastProcessor ) { List < DetectorStreamProcessorFactory > factoryList = provider . getProcessorFactoryList ( ) ; int factoryCount = factoryList . size ( ) ; DetectorStreamBufferImpl buffer = new DetectorStreamBufferImpl ( lastPro... | This method initializes this class . It has to be called to complete the construction . |
140,641 | protected String doInBackground ( String ... params ) { String user = params [ 0 ] ; String password = params [ 1 ] ; String bugTitle = params [ 2 ] ; String bugDescription = params [ 3 ] ; String deviceInfo = params [ 4 ] ; String targetUser = params [ 5 ] ; String targetRepository = params [ 6 ] ; String extraInfo = ... | This is run in a background thread |
140,642 | protected void onPostExecute ( String result ) { super . onPostExecute ( result ) ; if ( result . equals ( "ok" ) ) { progress . dismiss ( ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { mActivity . showDoneAnimation ( ) ; } else { ( ( Activity ) mContext ) . finish ( ) ; } } else if ( result... | This runs in UI when background thread finishes |
140,643 | public static void main ( String [ ] args ) throws Exception { getparseArticle ( ) ; geoparseUppercaseArticle ( ) ; resolveStanfordEntities ( ) ; System . out . println ( "\n\"That's all folks!\"" ) ; } | Run this after installing and configuring CLAVIN to get a sense of how to use it in a few different ways . |
140,644 | private static void getparseArticle ( ) throws Exception { GeoParser parser = GeoParserFactory . getDefault ( "./IndexDirectory" , new StanfordExtractor ( ) , 1 , 1 , false ) ; File inputFile = new File ( "src/test/resources/sample-docs/Somalia-doc.txt" ) ; String inputString = TextUtils . fileToString ( inputFile ) ; ... | Standard usage of CLAVIN . Instantiate a default GeoParser give it some text check out the locations it extracts and resolves . |
140,645 | private static void resolveStanfordEntities ( ) throws IOException , ClavinException { InputStream mpis = WorkflowDemoNERD . class . getClassLoader ( ) . getResourceAsStream ( "models/english.all.3class.distsim.prop" ) ; Properties mp = new Properties ( ) ; mp . load ( mpis ) ; AbstractSequenceClassifier < CoreMap > na... | Sometimes you might already be using Stanford NER elsewhere in your application and you d like to just pass the output from Stanford NER directly into CLAVIN without having to re - run the input through Stanford NER just to use CLAVIN . This example shows you how to very easily do exactly that . |
140,646 | public Set < String > getDependentFeatures ( ) throws IOException { final boolean entryExitLogging = log . isLoggable ( Level . FINER ) ; final String methodName = "getDependentFeatures" ; if ( entryExitLogging ) { log . entering ( DependencyList . class . getName ( ) , methodName ) ; } if ( ! initialized ) { initializ... | Returns the set of features that were discovered when evaluating has! plugin expressions or aliases when expanding the dependencies . This information may be required by the cache manager in order to properly idenify cached responses . |
140,647 | public void setLabel ( String label ) { final boolean entryExitLogging = log . isLoggable ( Level . FINER ) ; final String methodName = "setLabel" ; if ( entryExitLogging ) { log . entering ( DependencyList . class . getName ( ) , methodName , new Object [ ] { label } ) ; } this . label = label ; if ( entryExitLogging ... | Associates an arbitrary text string with this object . |
140,648 | synchronized void initialize ( ) throws IOException { if ( initialized ) { return ; } final boolean traceLogging = log . isLoggable ( Level . FINEST ) ; final boolean entryExitLogging = log . isLoggable ( Level . FINER ) ; final String methodName = "initialize" ; if ( entryExitLogging ) { log . entering ( DependencyLis... | Internal method called to resolve dependencies the first time one of the accessor methods is called . This is done in order to make object creation light - weight and to avoid the possibility of throwing an exception in the object constructor . |
140,649 | void expandDependencies ( String name , ModuleDepInfo depInfo , ModuleDeps expandedDependencies ) throws IOException { final String methodName = "expandDependencies" ; final boolean traceLogging = log . isLoggable ( Level . FINEST ) ; final boolean entryExitLogging = log . isLoggable ( Level . FINER ) ; if ( entryExitL... | Expands the nested dependencies for the specified module |
140,650 | private Model makeModel ( ) { Model mo = new DefaultModel ( ) ; Mapping mapping = mo . getMapping ( ) ; int nbNodes = 300 ; int nbVMs = 6 * nbNodes ; ShareableResource rcMem = new ShareableResource ( "mem" ) ; ShareableResource rcBW = new ShareableResource ( "bandwidth" ) ; nodes = new ArrayList < > ( nbNodes ) ; for (... | A default model with 500 nodes hosting 3000 VMs . 6 VMs per node Each node has a 10GB network interface and 32 GB RAM Each VM consumes 1GB Bandwidth and between 1 to 5 GB RAM |
140,651 | public boolean applyAction ( Model c ) { if ( c . getMapping ( ) . isOffline ( node ) ) { c . getMapping ( ) . addOnlineNode ( node ) ; return true ; } return false ; } | Put the node online on the model . |
140,652 | public boolean applyAction ( Model m ) { Mapping map = m . getMapping ( ) ; if ( map . isOnline ( node ) && map . isRunning ( vm ) && map . getVMLocation ( vm ) . equals ( node ) ) { map . addReadyVM ( vm ) ; return true ; } return false ; } | Apply the action by removing the virtual machine from the model . |
140,653 | static String formatMessage ( String fmt , Object [ ] args ) { MessageFormat formatter = new MessageFormat ( fmt ) ; Format [ ] formats = formatter . getFormatsByArgumentIndex ( ) ; StringBuffer msg = new StringBuffer ( ) ; formatter . format ( args , msg , null ) ; if ( args . length > formats . length ) { for ( int i... | Formats the specified string using the specified arguments . If the argument array contains more elements than the format string can accommodate then the additional arguments are appended to the end of the formatted string . |
140,654 | static void logResuming ( String callerClass , String callerMethod , Object waitObj , long start ) { long elapsed = ( System . currentTimeMillis ( ) - start ) / 1000 ; log . logp ( Level . WARNING , callerClass , callerMethod , Messages . SignalUtil_2 , new Object [ ] { Thread . currentThread ( ) . getId ( ) , elapsed ... | Logs a warning level message indicating that a thread which has previously been reported as stuck is now resuming . |
140,655 | protected boolean writeResponse ( InputStream in , HttpServletRequest request , HttpServletResponse response ) throws IOException { final String sourceMethod = "writeResponse" ; final boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( AbstractAggregatorImpl . class . ... | Writes the response to the response object . IOExceptions that occur when writing to the response output stream are not propagated but are handled internally . Such exceptions are assumed to be caused by the client closing the connection and are not real errors . |
140,656 | void logException ( HttpServletRequest req , Level level , String sourceMethod , Throwable t ) { if ( log . isLoggable ( level ) ) { StringBuffer sb = new StringBuffer ( ) ; String uri = req . getRequestURI ( ) ; if ( uri != null ) { sb . append ( uri ) ; String queryArgs = req . getQueryString ( ) ; if ( queryArgs != ... | Formats and logs an exception log message including the request url query args the exception class name and exception message . |
140,657 | public String getPropValue ( String propName ) { String propValue = null ; propValue = System . getProperty ( propName ) ; IServiceReference [ ] refs = null ; if ( propValue == null ) { try { refs = getPlatformServices ( ) . getServiceReferences ( IVariableResolver . class . getName ( ) , "(name=" + getName ( ) + ")" )... | Returns the value for the property name used by the aggregator . By default it returns the system property indicated by the specified key . This method may be overriden by the platform dependent implementation of the aggregator . |
140,658 | protected void notifyRequestListeners ( RequestNotifierAction action , HttpServletRequest req , HttpServletResponse resp ) throws IOException { IServiceReference [ ] refs = null ; try { refs = getPlatformServices ( ) . getServiceReferences ( IRequestListener . class . getName ( ) , "(name=" + getName ( ) + ")" ) ; } ca... | Calls the registered request notifier listeners . |
140,659 | protected void notifyConfigListeners ( long seq ) throws IOException { IServiceReference [ ] refs = null ; try { refs = getPlatformServices ( ) . getServiceReferences ( IConfigListener . class . getName ( ) , "(name=" + getName ( ) + ")" ) ; } catch ( PlatformServicesException e ) { if ( log . isLoggable ( Level . SEVE... | Call the registered config change listeners |
140,660 | protected void registerExtension ( IAggregatorExtension ext , IAggregatorExtension before ) { final String sourceMethod = "registerExtension" ; boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( AbstractAggregatorImpl . class . getName ( ) , sourceMethod , new Object ... | Adds the specified extension to the list of registered extensions . |
140,661 | public void initialize ( IConfig config ) throws Exception { OverrideFoldersTreeWalker walker = new OverrideFoldersTreeWalker ( this , config ) ; walker . walkTree ( ) ; cacheMgr = newCacheManager ( walker . getLastModified ( ) ) ; deps = newDependencies ( walker . getLastModifiedJS ( ) ) ; resourcePaths = getPathsAndA... | This method does some initialization for the aggregator servlet . This method is called from platform dependent Aggregator implementation during its initialization . |
140,662 | protected Map < String , URI > getPathsAndAliases ( InitParams initParams ) { final String sourceMethod = "getPahtsAndAliases" ; boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( AbstractAggregatorImpl . class . getName ( ) , sourceMethod , new Object [ ] { initParam... | Returns a mapping of resource aliases to IResources defined in the init - params . If the IResource is null then the alias is for the aggregator itself rather than a resource location . |
140,663 | @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) protected void registerLayerListener ( ) { Dictionary dict = new Properties ( ) ; dict . put ( "name" , getName ( ) ) ; registrations . add ( getPlatformServices ( ) . registerService ( ILayerListener . class . getName ( ) , new AggregatorLayerListener ( this ) , dict... | Registers the layer listener |
140,664 | public BooleanTerm andWith ( BooleanTerm other ) { if ( isFalse ( ) || other . isFalse ( ) ) { return BooleanTerm . FALSE ; } if ( other . isTrue ( ) ) { return this ; } if ( isTrue ( ) ) { return other ; } Set < BooleanVar > result = new HashSet < BooleanVar > ( this ) ; for ( BooleanVar var : other ) { if ( result . ... | Returns the logical AND of this term with the specified term . |
140,665 | static public byte [ ] zip ( InputStream in ) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; VariableGZIPOutputStream compress = new VariableGZIPOutputStream ( bos , 10240 ) ; compress . setLevel ( Deflater . BEST_COMPRESSION ) ; Writer writer = new OutputStreamWriter ( compress , "UTF... | Returns a byte array containing the gzipped contents of the input stream |
140,666 | static public byte [ ] unzip ( InputStream in ) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; CopyUtil . copy ( new GZIPInputStream ( in ) , bos ) ; return bos . toByteArray ( ) ; } | Returns the unzipped contents of the zipped input stream in a byte array |
140,667 | public static String bind ( String message , Object binding ) { return internalBind ( message , null , String . valueOf ( binding ) , null ) ; } | Bind the given message s substitution locations with the given string value . |
140,668 | public static void initializeMessages ( final String bundleName , final Class clazz ) { if ( System . getSecurityManager ( ) == null ) { load ( bundleName , clazz ) ; return ; } AccessController . doPrivileged ( new PrivilegedAction ( ) { public Object run ( ) { load ( bundleName , clazz ) ; return null ; } } ) ; } | Initialize the given class with the values from the specified message bundle . |
140,669 | private Number parseNumber ( String numberValue , Object valueSource ) throws WrongValueTypeException { try { Double d = Double . valueOf ( numberValue ) ; return this . mathUtil . toSimplestNumber ( d ) ; } catch ( NumberFormatException e ) { throw new WrongValueTypeException ( e , numberValue , valueSource , Number .... | This method parses a numeric value . |
140,670 | public List < LocationOccurrence > extractLocationNames ( String text ) { if ( text == null ) throw new IllegalArgumentException ( "text input to extractLocationNames should not be null" ) ; return convertNERtoCLAVIN ( namedEntityRecognizer . classifyToCharacterOffsets ( text ) , text ) ; } | Get extracted locations from a plain - text body . |
140,671 | public static List < LocationOccurrence > convertNERtoCLAVIN ( List < Triple < String , Integer , Integer > > entities , String text ) { List < LocationOccurrence > locations = new ArrayList < LocationOccurrence > ( ) ; if ( entities != null ) { for ( Triple < String , Integer , Integer > entity : entities ) { if ( ent... | Converts output from Stanford NER to input required by CLAVIN resolver . |
140,672 | protected String getFunctionDescription ( String functionName ) { String className = getClass ( ) . getSimpleName ( ) ; StringBuilder buffer = new StringBuilder ( functionName . length ( ) + className . length ( ) + 4 ) ; buffer . append ( FUNCTION_NAME_PREFIX ) ; buffer . append ( functionName ) ; buffer . append ( " ... | This method gets a description of this function . |
140,673 | public BooleanFormula andWith ( BooleanFormula other ) { if ( other . isTrue ( ) ) { return this ; } if ( other . isFalse ( ) || isFalse ( ) ) { if ( booleanTerms == null ) { booleanTerms = new HashSet < BooleanTerm > ( ) ; } else { booleanTerms . clear ( ) ; } isSimplified = true ; return this ; } if ( isTrue ( ) ) { ... | Logically ands the provided terms with the terms in the formula replacing this formula with the result |
140,674 | public boolean removeTerms ( Set < BooleanTerm > toRemove ) { boolean modified = false ; if ( toRemove == null || toRemove . iterator ( ) == null ) { modified = booleanTerms == null || size ( ) != 0 ; booleanTerms = new HashSet < BooleanTerm > ( ) ; } else if ( booleanTerms != null ) { modified = removeAll ( toRemove )... | Removes the specified terms from the formula |
140,675 | public boolean addAll ( Collection < ? extends BooleanTerm > terms ) { boolean modified = false ; if ( terms == null ) { modified = booleanTerms != null ; booleanTerms = null ; } else if ( booleanTerms != null ) { for ( BooleanTerm term : terms ) { modified |= add ( term ) ; } } return modified ; } | Adds the terms to the formula . Note that if the formula has previously been simplified and determined to evaluate to true then adding any terms will have no effect . |
140,676 | public static TaskMonitor build ( IntVar start , IntVar duration , IntVar end ) { return new TaskMonitor ( start , duration , end ) ; } | Make a new Monitor |
140,677 | public boolean containsNode ( long id ) { return nodeIdMapping . containsKey ( id ) && ! isRemoved ( nodes . get ( nodeIdMapping . get ( id ) ) ) ; } | Verify whether the node which has the given id is in the graph or not . |
140,678 | public boolean applyAction ( Model m ) { Mapping map = m . getMapping ( ) ; if ( ! map . contains ( id ) ) { map . addReadyVM ( id ) ; return true ; } return false ; } | Put the VM in the ready state iff it does not already belong to the mapping . |
140,679 | public void visitResourceNames ( String packageName , boolean includeSubPackages , ClassLoader classLoader , ResourceVisitor visitor ) { try { String path = packageName . replace ( '.' , '/' ) ; if ( path . isEmpty ( ) ) { LOG . debug ( "Scanning entire classpath..." ) ; } else { LOG . trace ( "Scanning for resources o... | This method does the actual magic to locate resources on the classpath . |
140,680 | public boolean setPartitions ( Collection < Collection < Node > > parts ) { if ( ! isDisjoint ( parts ) ) { return false ; } partitions = parts ; return true ; } | Set the node partitions |
140,681 | public int run ( String ... args ) { CliParser parser = getParserBuilder ( ) . build ( this ) ; try { CliModeObject mode = parser . parseParameters ( args ) ; if ( this . help ) { assert ( mode . getId ( ) . equals ( CliMode . ID_HELP ) ) ; printHelp ( parser ) ; return 0 ; } validate ( mode ) ; return run ( mode ) ; }... | This method should be invoked from the static main - method . |
140,682 | public static < T > List < T > sortedCollection ( Collection < T > coll ) { List < T > list = new LinkedList < T > ( coll ) ; Collections . sort ( list , new UComp < T > ( ) ) ; return list ; } | Returns a list containing all the objects from a collection in increasing lexicographic order of their string representations . |
140,683 | public static < T > String stringImg ( Collection < T > coll ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "[ " ) ; for ( T t : sortedCollection ( coll ) ) { buffer . append ( t ) ; buffer . append ( " " ) ; } buffer . append ( "]" ) ; return buffer . toString ( ) ; } | Returns a string representation of all elements from a collection in increasing lexicographic order of their string representations . |
140,684 | public static < T > String stringImg ( T [ ] v ) { if ( v == null ) return "null" ; StringBuffer buffer = new StringBuffer ( ) ; Arrays . sort ( v , new UComp < T > ( ) ) ; for ( int i = 0 ; i < v . length ; i ++ ) { buffer . append ( v [ i ] ) ; buffer . append ( "\n" ) ; } return buffer . toString ( ) ; } | Returns a string representation of all elements from an array in increasing lexicographic order of their string representations . |
140,685 | public List < Sync > buildConstraint ( BtrPlaceTree t , List < BtrpOperand > args ) { if ( ! checkConformance ( t , args ) ) { return Collections . emptyList ( ) ; } @ SuppressWarnings ( "unchecked" ) List < VM > s = ( List < VM > ) params [ 0 ] . transform ( this , t , args . get ( 0 ) ) ; if ( s == null ) { return Co... | Build a sync constraint . |
140,686 | public static int getPrecisionFormat ( final String mapcode ) throws UnknownPrecisionFormatException { final String decodedMapcode = convertStringToPlainAscii ( mapcode ) . toUpperCase ( ) ; if ( ! PATTERN_MAPCODE . matcher ( decodedMapcode ) . matches ( ) ) { throw new UnknownPrecisionFormatException ( decodedMapcode ... | This method return the mapcode type given a mapcode string . If the mapcode string has an invalid format an exception is thrown . |
140,687 | public static boolean isValidMapcodeFormat ( final String mapcode ) throws IllegalArgumentException { checkNonnull ( "mapcode" , mapcode ) ; try { getPrecisionFormat ( mapcode . toUpperCase ( ) ) ; return true ; } catch ( final UnknownPrecisionFormatException ignored ) { return false ; } } | This method provides a shortcut to checking if a mapcode string is formatted properly or not at all . |
140,688 | public static boolean containsTerritory ( final String mapcode ) throws IllegalArgumentException { checkMapcodeCode ( "mapcode" , mapcode ) ; return PATTERN_TERRITORY . matcher ( mapcode . toUpperCase ( ) . trim ( ) ) . find ( ) ; } | Returns whether the mapcode contains territory information or not . |
140,689 | static String convertStringToPlainAscii ( final String string ) { return Decoder . decodeUTF16 ( string . toUpperCase ( ) ) ; } | Convert a string which potentially contains Unicode characters to an ASCII variant . |
140,690 | public static RePairGrammar buildGrammar ( SAXRecords saxRecords ) { RePairGrammar grammar = NewRepair . parse ( saxRecords . getSAXString ( SPACE ) ) ; return grammar ; } | Builds a repair grammar given a set of SAX records . |
140,691 | public static RePairGrammar buildGrammar ( String inputString ) { RePairGrammar grammar = NewRepair . parse ( inputString ) ; return grammar ; } | Builds a grammar given a string of terminals delimeted by space . |
140,692 | public String getValue ( String name ) { String result = null ; for ( InitParam initParam : initParams ) { if ( initParam . getName ( ) . equals ( name ) ) { result = initParam . getValue ( ) ; break ; } } return result ; } | Returns the value of the first instance of the named init - param or null if the init - param is not found . |
140,693 | public Collection < String > getNames ( ) { Collection < String > names = new HashSet < String > ( ) ; for ( InitParam initParam : initParams ) { names . add ( initParam . getName ( ) ) ; } return names ; } | Returns a collection of the init - param names or an empty collection if there are no init - params |
140,694 | public void setRefreshDelayInSeconds ( int refreshDelayInSeconds ) { ValueOutOfRangeException . checkRange ( Integer . valueOf ( refreshDelayInSeconds ) , MIN_DELAY , Integer . valueOf ( Integer . MAX_VALUE ) , getClass ( ) . getSimpleName ( ) + ".refreshDelayInSeconds" ) ; this . refreshDelayInSeconds = refreshDelayIn... | This method sets the refresh - delay in seconds . A reasonable value should be at least 5 seconds but better in the range of minutes . |
140,695 | public void register ( ModelViewConverter < ? extends ModelView > c ) { java2json . put ( c . getSupportedView ( ) , c ) ; json2java . put ( c . getJSONId ( ) , c ) ; } | Register a converter for a specific view . |
140,696 | public ModelView fromJSON ( Model mo , JSONObject in ) throws JSONConverterException { checkKeys ( in , ModelViewConverter . IDENTIFIER ) ; Object id = in . get ( ModelViewConverter . IDENTIFIER ) ; ModelViewConverter < ? extends ModelView > c = json2java . get ( id . toString ( ) ) ; if ( c == null ) { throw new JSONC... | Convert a json - encoded view . |
140,697 | public JSONObject toJSON ( ModelView o ) throws JSONConverterException { ModelViewConverter c = java2json . get ( o . getClass ( ) ) ; if ( c == null ) { throw new JSONConverterException ( "No converter available for a view with the '" + o . getClass ( ) + "' className" ) ; } return c . toJSON ( o ) ; } | Serialise a view . |
140,698 | public DistanceElement getElement ( long id ) { if ( ! vector . containsKey ( id ) ) vector . put ( id , new DistanceElement ( id ) ) ; return vector . get ( id ) ; } | Gets an element of the distance vector based on the given node id . If a DistanceElement object with the given id does not exist in the vector a new object with the id is added to it . Then the element with the given id as key is returned in the end . |
140,699 | public void printPathTo ( long targetId ) { System . out . println ( getPath ( targetId ) . stream ( ) . map ( String :: valueOf ) . reduce ( ( s1 , s2 ) -> s1 + " -> " + s2 ) . get ( ) ) ; } | Prints the path between a source node and a target node if it exists . If it does not exist a message indicating this is shown . Is a path does exist a sequence of nodes is printed to show the path that the nodes share . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.