idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
12,900 | public boolean isEnabledFor ( E_MessageType type ) { if ( ! this . messageHandlers . containsKey ( type ) ) { return false ; } return this . messageHandlers . get ( type ) . isEnabled ( ) ; } | Returns is the report level is enabled or not . |
12,901 | public MessageMgr clear ( ) { for ( MessageTypeHandler handler : this . messageHandlers . values ( ) ) { handler . clear ( ) ; } this . messages . clear ( ) ; return this ; } | Resets the collected messages and all counters . |
12,902 | public ByteData decodeFrame ( Frame frame , ByteData pcmData ) { int byteSize = frame . header . blockSize * channels * ( ( streamInfo . getBitsPerSample ( ) + 7 ) / 2 ) ; if ( pcmData == null || pcmData . getData ( ) . length < byteSize ) { pcmData = new ByteData ( byteSize ) ; } else { pcmData . setLen ( 0 ) ; } if (... | Fill the given ByteData object with PCM data from the frame . |
12,903 | public StreamInfo readStreamInfo ( ) throws IOException { readStreamSync ( ) ; Metadata metadata = readNextMetadata ( ) ; if ( ! ( metadata instanceof StreamInfo ) ) throw new IOException ( "StreamInfo metadata block missing" ) ; return ( StreamInfo ) metadata ; } | Read the FLAC stream info . |
12,904 | public void decode ( ) throws IOException { readMetadata ( ) ; try { while ( true ) { findFrameSync ( ) ; try { readFrame ( ) ; frameListeners . processFrame ( frame ) ; callPCMProcessors ( frame ) ; } catch ( FrameDecodeException e ) { badFrames ++ ; } } } catch ( EOFException e ) { eof = true ; } } | Decode the FLAC file . |
12,905 | public void decode ( SeekPoint from , SeekPoint to ) throws IOException { if ( ! ( inputStream instanceof RandomFileInputStream ) ) throw new IOException ( "Not a RandomFileInputStream: " + inputStream . getClass ( ) . getName ( ) ) ; ( ( RandomFileInputStream ) inputStream ) . seek ( from . getStreamOffset ( ) ) ; bit... | Decode the data frames between two seek points . |
12,906 | private void readStreamSync ( ) throws IOException { int id = 0 ; for ( int i = 0 ; i < 4 ; ) { int x = bitStream . readRawUInt ( 8 ) ; if ( x == Constants . STREAM_SYNC_STRING [ i ] ) { i ++ ; id = 0 ; } else if ( x == ID3V2_TAG [ id ] ) { id ++ ; i = 0 ; if ( id == 3 ) { skipID3v2Tag ( ) ; id = 0 ; } } else { throw n... | Read the stream sync string . |
12,907 | public Metadata readNextMetadata ( ) throws IOException { Metadata metadata = null ; boolean isLast = ( bitStream . readRawUInt ( Metadata . STREAM_METADATA_IS_LAST_LEN ) != 0 ) ; int type = bitStream . readRawUInt ( Metadata . STREAM_METADATA_TYPE_LEN ) ; int length = bitStream . readRawUInt ( Metadata . STREAM_METADA... | Read a single metadata record . |
12,908 | public void seekTo ( long seekToSamples ) throws IOException { if ( seekTable != null ) { for ( int s = 0 ; s < seekTable . numberOfPoints ( ) ; s ++ ) { SeekPoint p = seekTable . getSeekPoint ( s ) ; samplesDecoded = p . getSampleNumber ( ) ; if ( samplesDecoded >= seekToSamples ) { if ( s > 0 ) p = seekTable . getSee... | This will do a forward seek - backwards is not possible yet because we would need to reset the inputstream |
12,909 | public float getBand ( int band ) { float eq = 0.0f ; if ( ( band >= 0 ) && ( band < BANDS ) ) { eq = settings [ band ] ; } return eq ; } | Retrieves the eq setting for a given band . |
12,910 | float [ ] getBandFactors ( ) { float [ ] factors = new float [ BANDS ] ; for ( int i = 0 , maxCount = BANDS ; i < maxCount ; i ++ ) { factors [ i ] = getBandFactor ( settings [ i ] ) ; } return factors ; } | Retrieves an array of floats whose values represent a scaling factor that can be applied to linear samples in each band to provide the equalization represented by this instance . |
12,911 | public Node < T > add ( T element ) { Node < T > node = new Node < > ( this , element ) ; nodes . add ( node ) ; return node ; } | Append a new node with the given element . |
12,912 | public boolean remove ( T element ) { for ( Iterator < Node < T > > it = nodes . iterator ( ) ; it . hasNext ( ) ; ) if ( ObjectUtil . equalsOrNull ( it . next ( ) . element , element ) ) { it . remove ( ) ; return true ; } return false ; } | Remove the first occurrence of the given element . |
12,913 | public Node < T > get ( T element ) { for ( Node < T > node : nodes ) if ( node . element . equals ( element ) ) return node ; return null ; } | Get the node containing the given element . |
12,914 | public static String tooltip ( Field field ) { final String tooltip = field . getTooltip ( ) ; if ( tooltip == null ) { return "" ; } return "<img class='tooltip' title='" + tooltip + "' alt='?' src='" + getContextPath ( ) + "/templates/" + getTemplate ( ) + "/img/tooltip.gif' />" ; } | This method show a tooltip if the key is defined |
12,915 | protected void print ( Object ... objects ) throws IOException { for ( Object object : objects ) { pageContext . getOut ( ) . print ( object ) ; } } | Prints the objects in the jsp writer of the page context |
12,916 | protected void println ( Object ... objects ) throws IOException { for ( Object object : objects ) { pageContext . getOut ( ) . println ( object ) ; } } | Prints the objects in the jsp writer of the page context with a new line |
12,917 | public Map < String , Integer > toMap ( ) { Map < String , Integer > ret = new HashMap < > ( ) ; ret . put ( "major" , this . major ) ; ret . put ( "minor" , this . minor ) ; ret . put ( "patch" , this . patch ) ; return ret ; } | Returns the string as a map using the key major for the major part the key minor for the minor part and the key patch for the patch part . |
12,918 | @ SuppressWarnings ( "unchecked" ) protected Class < T > determineBasicMessageClass ( ) { Class < ? > thisClazz = this . getClass ( ) ; Type superClazz = thisClazz . getGenericSuperclass ( ) ; while ( superClazz instanceof Class ) { superClazz = ( ( Class < ? > ) superClazz ) . getGenericSuperclass ( ) ; } Parameterize... | In order to decode the JSON we need the class representation of the basic message type . This method uses reflection to try to get that type . |
12,919 | public static JCorsConfig load ( ) { log . info ( "Initializing JCors..." ) ; InputStream fileStream = findFileInClasspath ( CONFIG_FILE_NAME ) ; JCorsConfig config = new JCorsConfig ( ) ; if ( fileStream != null ) { config = loadFromFileStream ( fileStream ) ; Constraint . ensureNotNull ( config , "It was not possible... | Loads a configuration from jcors . xml in classpath . If this file is not found uses a default configuration |
12,920 | private static InputStream findFileInClasspath ( String fileName ) { InputStream is = null ; try { ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; is = classLoader . getResourceAsStream ( fileName ) ; return is ; } catch ( Exception ex ) { log . error ( String . format ( "Error while ... | Finds a file by name in classpath |
12,921 | private static JCorsConfig loadFromFileStream ( InputStream fileStream ) { try { JAXBContext context = JAXBContext . newInstance ( ConfigBuilder . class ) ; Unmarshaller unmarshaller = context . createUnmarshaller ( ) ; unmarshaller . setSchema ( loadXmlSchema ( ) ) ; ConfigBuilder configBuilder = ( ConfigBuilder ) unm... | Builds a configuration class based on XML file |
12,922 | private static Schema loadXmlSchema ( ) throws SAXException { InputStream schemaFileStream = findFileInClasspath ( CONFIG_SCHEMA_FILE_NAME ) ; Constraint . ensureNotNull ( schemaFileStream , "JCors configuration schema not found" ) ; SchemaFactory schemaFactory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCH... | Loads the XML validation schema from the classpath |
12,923 | private static boolean searchTree ( DependencyNode node , int level , ArtifactMatcher excludes , StringBuilder message ) throws InvalidVersionSpecificationException { List < DependencyNode > children = node . getChildren ( ) ; boolean hasTransitiveDependencies = level > 1 ; boolean excluded = false ; StringBuilder mess... | Searches dependency tree recursively for transitive dependencies that are not excluded while generating nice info message along the way . |
12,924 | public static int getGenre ( String str ) { for ( int i = 0 ; i < GENRES . length ; i ++ ) if ( GENRES [ i ] . equalsIgnoreCase ( str ) ) return i ; return - 1 ; } | Tries to find the string provided in the table and returns the corresponding int code if successful . Returns - 1 if the genres is not found in the table . |
12,925 | public static Element getChild ( Element parent , String childName ) { NodeList nodes = parent . getChildNodes ( ) ; for ( int i = 0 ; i < nodes . getLength ( ) ; ++ i ) { Node node = nodes . item ( i ) ; if ( ( node instanceof Element ) && node . getNodeName ( ) . equals ( childName ) ) return ( Element ) node ; } ret... | Return the first child of the given name or null . |
12,926 | public static List < Element > getChildren ( Element parent , String childName ) { ArrayList < Element > children = new ArrayList < Element > ( ) ; NodeList nodes = parent . getChildNodes ( ) ; for ( int i = 0 ; i < nodes . getLength ( ) ; ++ i ) { Node node = nodes . item ( i ) ; if ( ( node instanceof Element ) && no... | Return the children with the given name . |
12,927 | public static String getInnerText ( Node node ) { if ( node instanceof Element ) return ( ( Element ) node ) . getTextContent ( ) ; if ( node . getNodeType ( ) == Node . TEXT_NODE ) return node . getNodeValue ( ) ; if ( node instanceof Text ) return ( ( Text ) node ) . getData ( ) ; return null ; } | Return the inner text of a node . |
12,928 | public static String getChildText ( Element parent , String childName ) { Element child = getChild ( parent , childName ) ; if ( child == null ) return null ; return getInnerText ( child ) ; } | Return the inner text of the first child with the given name . |
12,929 | public static Message warn ( Entity entity , String key , String ... args ) { return message ( MessageType . WARN , entity , key , args ) ; } | Create an entity scoped warning message |
12,930 | public static Message error ( Entity entity , String key , String ... args ) { return message ( MessageType . ERROR , entity , key , args ) ; } | Create an entity scoped error message |
12,931 | public static Message info ( Entity entity , Field field , String key , String ... args ) { return message ( MessageType . INFO , entity , field , key , args ) ; } | Create a field scoped information message |
12,932 | public static void initEnvironment ( ) { if ( System . getProperty ( "org.apache.commons.logging.Log" ) == null ) System . setProperty ( "org.apache.commons.logging.Log" , "net.lecousin.framework.log.bridges.ApacheCommonsLogging" ) ; String protocols = System . getProperty ( "java.protocol.handler.pkgs" ) ; if ( protoc... | Initialize properties . |
12,933 | public static MutableBoolean stop ( boolean forceJvmToStop ) { if ( stop != null ) { new Exception ( "LCCore already stopped" , stop ) . printStackTrace ( System . err ) ; return new MutableBoolean ( true ) ; } stop = new Exception ( "LCCore stop requested here" ) ; MutableBoolean stopped = new MutableBoolean ( false )... | Stop the environement . |
12,934 | public static void replaceMainThreadExecutor ( MainThreadExecutor executor ) { MainThreadExecutor previous ; synchronized ( LCCore . class ) { previous = mainThreadExecutor ; mainThreadExecutor = executor ; } do { Runnable toExecute = previous . pop ( ) ; if ( toExecute == null ) break ; executor . execute ( toExecute ... | Replace the main thread executor . |
12,935 | private Model readModel ( File pom ) throws IOException , XmlPullParserException { Reader reader = ReaderFactory . newXmlReader ( pom ) ; MavenXpp3Reader xpp3 = new MavenXpp3Reader ( ) ; Model model = null ; try { model = xpp3 . read ( reader ) ; } finally { reader . close ( ) ; reader = null ; } return model ; } | Gets the pom model for this file . |
12,936 | private Model getPomModel ( String groupId , String artifactId , String version , File pom ) throws ArtifactResolutionException , ArtifactNotFoundException , IOException , XmlPullParserException { Model model = null ; boolean found = false ; try { model = readModel ( pom ) ; found = checkIfModelMatches ( groupId , arti... | This method gets the model for the defined artifact . Looks first in the filesystem then tries to get it from the repo . |
12,937 | public List < Model > getModelsRecursively ( String groupId , String artifactId , String version , File pom ) throws ArtifactResolutionException , ArtifactNotFoundException , IOException , XmlPullParserException { List < Model > models = null ; Model model = getPomModel ( groupId , artifactId , version , pom ) ; Parent... | This method loops through all the parents getting each pom model and then its parent . |
12,938 | protected boolean checkIfModelMatches ( String groupId , String artifactId , String version , Model model ) { String modelGroup = model . getGroupId ( ) ; String modelArtifactId = model . getArtifactId ( ) ; String modelVersion = model . getVersion ( ) ; try { if ( StringUtils . isEmpty ( modelGroup ) ) { modelGroup = ... | Make sure the model is the one I m expecting . |
12,939 | public void execute ( EnforcerRuleHelper helper ) throws EnforcerRuleException { boolean callSuper ; MavenProject project = null ; if ( onlyWhenRelease ) { project = getProject ( helper ) ; callSuper = ! project . getArtifact ( ) . isSnapshot ( ) ; } else { callSuper = true ; } if ( callSuper ) { super . execute ( help... | Override parent to allow optional ignore of this rule . |
12,940 | public Object getNestedProperty ( Object obj , String propertyName ) { if ( obj != null && propertyName != null ) { return PresentationManager . getPm ( ) . get ( obj , propertyName ) ; } return null ; } | Getter for a nested property in the given object . |
12,941 | public String visualize ( Object obj ) throws ConverterException { Integer pad = 0 ; String padc = getConfig ( "pad-count" , "0" ) ; try { pad = Integer . parseInt ( padc ) ; } catch ( Exception e ) { } char padch = getConfig ( "pad-char" , " " ) . charAt ( 0 ) ; String padd = getConfig ( "pad-direction" , "left" ) ; S... | Visualization with some standard properties . |
12,942 | public void addAllowedOrigin ( String origin ) { Constraint . ensureNotEmpty ( origin , String . format ( "Invalid origin '%s'" , origin ) ) ; allowedOrigins . add ( origin ) ; } | Add an origin allowed by the resource |
12,943 | public void addAllowedHeader ( String header ) { Constraint . ensureNotEmpty ( header , String . format ( "Invalid header '%s'" , header ) ) ; allowedHeaders . add ( header . toLowerCase ( ) ) ; } | Add a header allowed by the resource |
12,944 | public Collection < String > getAllowedHeaders ( Collection < String > requestHeaders ) { Constraint . ensureNotNull ( requestHeaders , "Null headers" ) ; Set < String > rtAllowedHeaders = new HashSet < String > ( allowedHeaders ) ; rtAllowedHeaders . addAll ( requestHeaders ) ; return rtAllowedHeaders ; } | Return all headers allowed by the resource including the preflight request headers |
12,945 | public boolean isMethodAllowed ( String method ) { return HttpMethod . isValidMethod ( method ) && ( allowedMethods . isEmpty ( ) || allowedMethods . contains ( method ) ) ; } | Check if the method is allowed by the resource This check is case - sensitive |
12,946 | public void addAllowedMethod ( String method ) { Constraint . ensureNotEmpty ( method , String . format ( "Invalid method '%s'" , method ) ) ; Constraint . ensureTrue ( HttpMethod . isValidMethod ( method ) , String . format ( "Invalid method '%s'" , method ) ) ; allowedMethods . add ( method . toUpperCase ( ) ) ; } | Add a method allowed by the resource |
12,947 | public Collection < String > getAllowedMethods ( String requestMethod ) { Constraint . ensureNotEmpty ( requestMethod , String . format ( "Invalid method '%s'" , requestMethod ) ) ; Set < String > rtAllowedMethods = new HashSet < String > ( allowedMethods ) ; rtAllowedMethods . add ( requestMethod . toUpperCase ( ) ) ;... | Return all methods allowed by the resource including the preflight request method |
12,948 | public boolean registerFileExtension ( String fileTypeName , String fileTypeExtension , String application ) throws OSException { throw new UnsupportedOperationException ( "Not supported yet." ) ; } | Registers a new file extension in the operating system . |
12,949 | int fetch_headers ( Info vi , Comment vc , int [ ] serialno , Page og_ptr ) { Page og = new Page ( ) ; Packet op = new Packet ( ) ; int ret ; if ( og_ptr == null ) { ret = get_next_page ( og , CHUNKSIZE ) ; if ( ret == OV_EREAD ) return OV_EREAD ; if ( ret < 0 ) return OV_ENOTVORBIS ; og_ptr = og ; } if ( serialno != n... | non - streaming input sources |
12,950 | void prefetch_all_headers ( Info first_i , Comment first_c , int dataoffset ) throws JOrbisException { Page og = new Page ( ) ; int ret ; vi = new Info [ links ] ; vc = new Comment [ links ] ; dataoffsets = new long [ links ] ; pcmlengths = new long [ links ] ; serialnos = new int [ links ] ; for ( int i = 0 ; i < link... | attention to how that s done ) |
12,951 | public Integer getInt ( String name , Integer def ) { final String s = getProperty ( name ) ; try { return Integer . parseInt ( s ) ; } catch ( Exception e ) { return def ; } } | Returns the property assuming its an int . If it isn t or if its not defined returns default value |
12,952 | public boolean getBool ( String name , boolean def ) { final String s = getProperty ( name ) ; if ( s == null ) { return def ; } try { return s != null && s . equalsIgnoreCase ( "true" ) ; } catch ( Exception e ) { return def ; } } | Returns the property assuming its a boolean . If it isn t or if its not defined returns default value . |
12,953 | public List < String > getAll ( String name ) { if ( properties == null ) { return null ; } final List < String > all = new ArrayList < String > ( ) ; for ( Property property : properties ) { if ( property . getName ( ) . equals ( name ) ) { all . add ( property . getValue ( ) ) ; } } return all ; } | Return all values for the given name |
12,954 | public void removeFromQueue ( T t ) { synchronized ( messages ) { for ( Map . Entry < Long , Message > messageEntry : messages . entrySet ( ) ) { if ( messageEntry . getValue ( ) . equals ( t ) ) { Message message = messages . remove ( messageEntry . getKey ( ) ) ; recycle ( message ) ; notifyQueueChanged ( ) ; return ... | Removing message from queue |
12,955 | public void scheduleOnce ( Envelope envelope , long time ) { if ( envelope . getMailbox ( ) != this ) { throw new RuntimeException ( "envelope.mailbox != this mailbox" ) ; } envelopes . putEnvelopeOnce ( envelope , time , comparator ) ; } | Send envelope once at time |
12,956 | protected boolean isEqualEnvelope ( Envelope a , Envelope b ) { return a . getMessage ( ) . getClass ( ) == b . getMessage ( ) . getClass ( ) ; } | Override this if you need to change filtering for scheduleOnce behaviour . By default it check equality only of class names . |
12,957 | public static < N extends TreeNode < N > > int countNodes ( N tree ) { int result = 0 ; if ( tree == null ) { return result ; } List < N > children = tree . getChildren ( ) ; for ( N node : children ) { result += countNodes ( node ) ; } return result + 1 ; } | This method counts all nodes within a tree . |
12,958 | public static < N extends TreeNode < N > > boolean equalsWithoutOrder ( N tree1 , N tree2 ) { if ( ! tree1 . getName ( ) . equals ( tree2 . getName ( ) ) ) { return false ; } List < N > children1 = tree1 . getChildren ( ) ; List < N > children2 = tree2 . getChildren ( ) ; if ( children1 . size ( ) != children2 . size (... | This method checks to trees for equality . Equality is only checked on name basis and the order of the children is neglected . |
12,959 | public void closeFiles ( ) { filesAreOpened = false ; for ( HeaderIndexFile < Data > file : files ) { if ( file != null ) { file . close ( ) ; } } } | Closes all files |
12,960 | public static String format ( Object o , int precision ) { return String . format ( getFormat ( o , precision ) , o ) ; } | Returns a String representation of the given object using an appropriate format and the specified precision in case the object is a non - integer number . |
12,961 | public static String formatTrimmed ( Object o , int precision , int length ) { return String . format ( getTrimmedFormat ( getFormat ( o , precision ) , length ) , o ) ; } | Returns a String representation of the given object using an appropriate format and the specified precision in case the object is a non - integer number trimmed to the specified length . |
12,962 | public static String getIndexedFormat ( int index , String format ) { if ( index < 1 ) throw new IllegalArgumentException ( ) ; if ( format == null ) throw new NullPointerException ( ) ; if ( format . length ( ) == 0 ) throw new IllegalArgumentException ( ) ; return String . format ( INDEXED_FORMAT , index , format ) ;... | Returns an indexed format by placing the specified index before the given format . |
12,963 | public int getLength ( ) { int length = 0 ; Iterator < V > it = this . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { length += ( ( ID3v2Frame ) it . next ( ) ) . getFrameLength ( ) ; } return length ; } | Returns the length in bytes of all the frames contained in this object . |
12,964 | public byte [ ] getBytes ( ) { byte b [ ] = new byte [ getLength ( ) ] ; int bytesCopied = 0 ; Iterator < V > it = this . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { ID3v2Frame frame = ( ID3v2Frame ) it . next ( ) ; System . arraycopy ( frame . getFrameBytes ( ) , 0 , b , bytesCopied , frame . getFrameLeng... | Return an array bytes containing all frames contained in this object . This can be used to easily write the frames to a file . |
12,965 | void refreshCaptions ( ) { email . setCaption ( lp . l ( "user.email.caption" ) ) ; password . setCaption ( lp . l ( "user.password.caption" ) ) ; login . setCaption ( lp . l ( "loginform.button.caption" ) ) ; } | Since the language can be changed while this form is displayed we need a method to refresh the captions |
12,966 | private String checkOriginHeader ( HttpServletRequest request , JCorsConfig config ) { String originHeader = request . getHeader ( CorsHeaders . ORIGIN_HEADER ) ; Constraint . ensureNotEmpty ( originHeader , "Cross-Origin requests must specify an Origin Header" ) ; String [ ] origins = originHeader . split ( " " ) ; fo... | Checks if the origin is allowed |
12,967 | public static < Data extends AbstractKVStorable > DRUMS < Data > openTable ( AccessMode accessMode , DRUMSParameterSet < Data > gp ) throws IOException { AbstractHashFunction hashFunction ; try { hashFunction = readHashFunction ( gp ) ; } catch ( ClassNotFoundException e ) { throw new IOException ( "Could not load Hash... | Opens an existing table . |
12,968 | public static < Data extends AbstractKVStorable > DRUMS < Data > createOrOpenTable ( AbstractHashFunction hashFunction , DRUMSParameterSet < Data > gp ) throws IOException { File databaseDirectoryFile = new File ( gp . DATABASE_DIRECTORY ) ; DRUMS < Data > drums = null ; if ( databaseDirectoryFile . exists ( ) ) { drum... | Creates or opens the table . If the directory doesn t exists it will be created . |
12,969 | public boolean accept ( final File f ) { if ( f . isDirectory ( ) ) return true ; int len = extensions . size ( ) ; if ( len == 0 ) return true ; for ( int i = 0 ; i < len ; i ++ ) { String suffix = extensions . get ( i ) ; if ( suffix . equals ( "*" ) ) return true ; if ( f . getName ( ) . toLowerCase ( ) . endsWith (... | Whether the given file is accepted by this filter . |
12,970 | protected int interpretInfo ( LineParser lp , MessageMgr mm ) { String fileName = this . getFileName ( lp ) ; String content = this . getContent ( fileName , mm ) ; if ( content == null ) { return 1 ; } String [ ] lines = StringUtils . split ( content , "\n" ) ; String info = null ; for ( String s : lines ) { if ( s . ... | Interprets the actual info command |
12,971 | protected int interpretLs ( LineParser lp , MessageMgr mm ) { String directory = lp . getArgs ( ) ; IOFileFilter fileFilter = new WildcardFileFilter ( new String [ ] { "*.ssc" } ) ; DirectoryLoader dl = new CommonsDirectoryWalker ( directory , DirectoryFileFilter . INSTANCE , fileFilter ) ; if ( dl . getLoadErrors ( ) ... | Interprets the actual ls command |
12,972 | protected int interpretRun ( LineParser lp , MessageMgr mm ) { String fileName = this . getFileName ( lp ) ; String content = this . getContent ( fileName , mm ) ; if ( content == null ) { return 1 ; } mm . report ( MessageMgr . createInfoMessage ( "" ) ) ; mm . report ( MessageMgr . createInfoMessage ( "running file {... | Interprets the actual run command |
12,973 | protected String getFileName ( LineParser lp ) { String fileName = lp . getArgs ( ) ; if ( fileName == null ) { fileName = this . lastScript ; } else if ( ! fileName . endsWith ( "." + SCRIPT_FILE_EXTENSION ) ) { fileName += "." + SCRIPT_FILE_EXTENSION ; } return fileName ; } | Returns a file name taken as argument from the line parser with fixed extension |
12,974 | protected String getContent ( String fileName , MessageMgr mm ) { StringFileLoader sfl = new StringFileLoader ( fileName ) ; if ( sfl . getLoadErrors ( ) . hasErrors ( ) ) { mm . report ( sfl . getLoadErrors ( ) ) ; return null ; } String content = sfl . load ( ) ; if ( sfl . getLoadErrors ( ) . hasErrors ( ) ) { mm . ... | Returns the content of a string read from a file . |
12,975 | < T extends Entity < ? , ? > > Builder < BE , T > proceedTo ( Relationships . WellKnown over , Class < T > entityType ) { return new Builder < > ( this , hop ( ) , Query . filter ( ) , entityType ) . hop ( Related . by ( over ) , type ( entityType ) ) ; } | The new context will have the source path composed by appending current select candidates to the current source path and its select candidates will filter for entities related by the provided relationship to the new sources and will have the provided type . |
12,976 | < T extends Entity < ? , ? > , P extends Enum < P > & Parents > TraversalContext < BE , T > proceedWithParents ( Class < T > nextEntityType , Class < P > parentsType , P currentParent , P [ ] parents , BiConsumer < P , Query . SymmetricExtender > hopBuilder ) { EnumSet < P > ps = ParentsUtil . convert ( parentsType , c... | Proceeds the traversal to the next entities taking into account what parents the next entities should have . |
12,977 | Builder < BE , Relationship > proceedToRelationships ( Relationships . Direction direction ) { return new Builder < > ( this , hop ( ) , Query . filter ( ) , Relationship . class ) . hop ( new SwitchElementType ( direction , false ) ) ; } | The new context will have the source path composed by appending current select candidates to the current source path . The new context will have select candidates such that it will select the relationships in given direction stemming from the entities on the new source path . |
12,978 | TraversalContext < BE , E > replacePath ( Query path ) { return new TraversalContext < > ( inventory , path , Query . empty ( ) , backend , entityClass , configuration , observableContext , transactionRetries , this , null , transactionConstructor ) ; } | Constructs a new traversal context by replacing the source path with the provided query and clearing out the selected candidates . |
12,979 | public List < MonitorLine > getLinesFrom ( Object actual ) throws Exception { String line ; Integer currentLineNo = 0 ; final List < MonitorLine > result = new ArrayList < MonitorLine > ( ) ; BufferedReader in = null ; try { in = new BufferedReader ( new FileReader ( getFilename ( ) ) ) ; Integer startLine = ( actual =... | Get the file lines since the actual until the last . |
12,980 | public List < MonitorLine > getLastLine ( Integer count ) throws Exception { String line ; final List < MonitorLine > result = new ArrayList < MonitorLine > ( ) ; BufferedReader in = null ; try { in = new BufferedReader ( new FileReader ( getFilename ( ) ) ) ; int i = 0 ; line = in . readLine ( ) ; while ( line != null... | Return the last file line |
12,981 | @ SuppressWarnings ( "incomplete-switch" ) protected Icon getIcon ( JTable table , int column ) { SortKey sortKey = getSortKey ( table , column ) ; if ( sortKey != null && table . convertColumnIndexToView ( sortKey . getColumn ( ) ) == column ) { switch ( sortKey . getSortOrder ( ) ) { case ASCENDING : return UIManager... | Overloaded to return an icon suitable to the primary sorted column or null if the column is not the primary sort key . |
12,982 | public void run ( ) { while ( true ) { if ( countObservers ( ) == 0 ) { try { Thread . sleep ( Long . MAX_VALUE ) ; } catch ( InterruptedException e ) { } } else { startWatching ( ) ; while ( countObservers ( ) > 0 ) { getNewLines ( ) ; try { Thread . sleep ( getDelay ( ) ) ; } catch ( InterruptedException e ) { } } } ... | Implemented from runnable |
12,983 | public void startWatching ( ) { try { final List < MonitorLine > lines = getSource ( ) . getLastLine ( getInitialCount ( ) ) ; actual = null ; updateLines ( lines ) ; } catch ( Exception e ) { notifyObservers ( e ) ; } } | Start watching a monitor |
12,984 | public void getNewLines ( ) { try { List < MonitorLine > lines ; if ( getAll ( ) ) { lines = getSource ( ) . getLinesFrom ( null ) ; } else { lines = getSource ( ) . getLinesFrom ( actual ) ; } updateLines ( lines ) ; } catch ( Exception e ) { notifyObservers ( e ) ; } } | Looks for new lines |
12,985 | protected void createFile ( ) throws FileLockException , IOException { openChannel ( ) ; filledUpTo = 0 ; accessFile . setLength ( DEFAULT_SIZE ) ; size = DEFAULT_SIZE ; filledUpTo = HEADER_SIZE ; writeHeader ( ) ; } | this method will be called to init the database - file |
12,986 | public void unlock ( ) throws IOException { System . runFinalization ( ) ; if ( fileLock != null ) { try { fileLock . release ( ) ; } catch ( ClosedChannelException e ) { throw new IOException ( "Can't close Channel in " + osFile + "." ) ; } fileLock = null ; } } | tries to unlock the file |
12,987 | public void lock ( ) throws FileLockException , IOException { if ( mode == AccessMode . READ_ONLY ) { return ; } for ( int retries = 0 ; retries < max_retries_connect ; retries ++ ) { try { fileLock = channel . lock ( ) ; break ; } catch ( OverlappingFileLockException e ) { try { logger . debug ( "Can't open file '" + ... | tries to lock the file |
12,988 | protected long checkRegions ( long offset , int length ) throws IOException { if ( offset + length > filledUpTo ) throw new IOException ( "Can't access memory outside the file size (" + filledUpTo + " bytes). You've requested portion " + offset + "-" + ( offset + length ) + " bytes. File: " + osFile . getAbsolutePath (... | checks if the accessed region is accessible |
12,989 | public void close ( ) { logger . debug ( "Try to close accessFile and channel for file: " + osFile ) ; if ( headerBuffer != null ) { headerBuffer . force ( ) ; headerBuffer = null ; } try { unlock ( ) ; if ( channel != null && channel . isOpen ( ) ) { channel . close ( ) ; channel = null ; } if ( accessFile != null ) {... | closes all open channels and the file |
12,990 | public void delete ( ) throws IOException { close ( ) ; if ( osFile != null ) { boolean deleted = osFile . delete ( ) ; while ( ! deleted ) { try { Thread . sleep ( 100 ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; logger . error ( "{} not deleted." , osFile ) ; } System . gc ( ) ; deleted = osFile... | tries to delete the file |
12,991 | protected boolean isInIgnoreParamList ( Parameter param ) { return "javax.servlet.http.HttpServletRequest" . equals ( param . type ( ) . qualifiedTypeName ( ) ) || "javax.servlet.http.HttpServletResponse" . equals ( param . type ( ) . qualifiedTypeName ( ) ) || "javax.servlet.http.HttpSession" . equals ( param . type (... | param which will not be displayed in doc . |
12,992 | public void write ( long offset , ByteBuffer sourceBuffer ) throws IOException { offset += contentStart ; sourceBuffer . position ( 0 ) ; long newFilePosition = offset + sourceBuffer . limit ( ) ; if ( newFilePosition > contentEnd ) { logger . debug ( "Filesize exceeded (contendEnd: {},size: {})" , contentEnd , size ) ... | writes the bytes from the given ByteBuffer to the file beginning at offset . The size of the HEADER will be respected automatically . |
12,993 | public void enlargeFile ( long toEnlarge ) throws IOException { size += ( long ) Math . ceil ( ( double ) toEnlarge / incrementSize ) * incrementSize ; logger . debug ( "Enlarge filesize of {} to {}" , osFile , size ) ; contentEnd = size ; accessFile . setLength ( size ) ; if ( ( size - contentStart ) / chunkSize > ind... | Rounds up the given size to the next full chunk and enlarges the file by these amounts of bytes . |
12,994 | public boolean isConsistent ( ) throws IOException { byte [ ] b = new byte [ elementSize ] ; long offset = 0 ; byte [ ] oldKey = null ; int i = 0 ; while ( offset < this . getFilledUpFromContentStart ( ) ) { this . read ( offset , ByteBuffer . wrap ( b ) ) ; byte [ ] key = Arrays . copyOfRange ( b , 0 , keySize ) ; if ... | This method checks if the keys of all inserted elements are incrementing continuously . |
12,995 | public boolean isConsitentWithIndex ( ) throws IOException { byte [ ] b = new byte [ keySize ] ; long offset = 0 ; int maxChunk = getChunkIndex ( getFilledUpFromContentStart ( ) ) ; boolean isConsistent = true ; for ( int i = 1 ; i <= maxChunk ; i ++ ) { offset = i * getChunkSize ( ) - elementSize ; read ( offset , Byt... | This method checks if the data is consistent with the index . |
12,996 | public List < Field > getFields ( Entity entity , String operationId , PMSecurityUser user ) { final String [ ] fs = getFields ( ) . split ( "[ ]" ) ; final List < Field > result = new ArrayList < Field > ( ) ; for ( String string : fs ) { final Field field = entity . getFieldById ( string ) ; if ( field != null ) { if... | Fields contained in this panel . |
12,997 | public List < Integer > getPageRange ( ) { List < Integer > r = new ArrayList < Integer > ( ) ; for ( int i = 1 ; i <= getPages ( ) ; i ++ ) { r . add ( i ) ; } return r ; } | Returns a list with the existing pages index |
12,998 | public boolean registerFileExtension ( String fileTypeName , String fileTypeExtension , String application ) throws RegistryException , OSException { if ( ! isApplicable ( ) ) { return false ; } fileTypeExtension = sanitizeFileExtension ( fileTypeExtension ) ; String applicationPath = toWindowsPath ( new File ( applica... | Registers a new file extension in the Windows registry . |
12,999 | public static int cs_fkeep ( Scs A , Scs_ifkeep fkeep , Object other ) { int j , p , nz = 0 , n , Ap [ ] , Ai [ ] ; float Ax [ ] ; if ( ! Scs_util . CS_CSC ( A ) ) return ( - 1 ) ; n = A . n ; Ap = A . p ; Ai = A . i ; Ax = A . x ; for ( j = 0 ; j < n ; j ++ ) { p = Ap [ j ] ; Ap [ j ] = nz ; for ( ; p < Ap [ j + 1 ] ;... | Srops entries from a sparse matrix ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.