idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
26,700 | public < T > T get ( String key , Class < T > clazz , T defaultValue ) { Object obj = argMap . get ( key ) ; if ( obj == null ) { return defaultValue ; } return Reflection . toType ( obj , clazz ) ; } | Get the specified key s value from the unit input anc cast it into the type you want . |
26,701 | @ SuppressWarnings ( "unchecked" ) public < T > Set < T > getSet ( String key ) { return Reflection . toType ( get ( key ) , Set . class ) ; } | Get the set . Note you must be sure with the generic type or a class cast exception will be thrown . |
26,702 | public < T > T getArgBean ( Class < ? extends T > beanClass ) { return Reflection . toType ( argMap , beanClass ) ; } | Convert this unit request s argument map into java bean . |
26,703 | public static UnitRequest create ( String group , String unit ) { return new UnitRequest ( ) . setContext ( RequestContext . create ( ) . setGroup ( group ) . setUnit ( unit ) ) ; } | Create a new UnitRequest instance with the group and unit name . |
26,704 | public static UnitRequest create ( Class < ? extends Unit > unitClass ) { Unit unit = LocalUnitsManager . getUnitByUnitClass ( unitClass ) ; return create ( unit . getGroup ( ) . getName ( ) , unit . getName ( ) ) ; } | Create a new UnitRequest instance by the Unit class . |
26,705 | public void start ( ) throws Exception { Preconditions . checkState ( state . compareAndSet ( State . LATENT , State . STARTED ) , "Cannot be started more than once" ) ; startTask . set ( AfterConnectionEstablished . execute ( client , new Runnable ( ) { public void run ( ) { try { internalStart ( ) ; } finally { start... | Add this instance to the leadership election and attempt to acquire leadership . |
26,706 | public void start ( ) throws Exception { if ( ! state . compareAndSet ( State . LATENT , State . STARTED ) ) { throw new IllegalStateException ( ) ; } try { client . create ( ) . creatingParentContainersIfNeeded ( ) . forPath ( queuePath ) ; } catch ( KeeperException . NodeExistsException ignore ) { } if ( lockPath != ... | Start the queue . No other methods work until this is called |
26,707 | public boolean flushPuts ( long waitTime , TimeUnit timeUnit ) throws InterruptedException { long msWaitRemaining = TimeUnit . MILLISECONDS . convert ( waitTime , timeUnit ) ; synchronized ( putCount ) { while ( putCount . get ( ) > 0 ) { if ( msWaitRemaining <= 0 ) { return false ; } long startMs = System . currentTim... | Wait until any pending puts are committed |
26,708 | public int remove ( String id ) throws Exception { id = Preconditions . checkNotNull ( id , "id cannot be null" ) ; queue . checkState ( ) ; int count = 0 ; for ( String name : queue . getChildren ( ) ) { if ( parseId ( name ) . id . equals ( id ) ) { if ( queue . tryRemove ( name ) ) { ++ count ; } } } return count ; ... | Remove any items with the given Id |
26,709 | private static String extendedKey ( Properties properties , String key ) { String extendedKey = extendedKey ( key ) ; return properties . containsKey ( extendedKey ) ? extendedKey : key ; } | For internal use only please do not rely on this method . |
26,710 | public void start ( ) { Preconditions . checkState ( Thread . currentThread ( ) . equals ( ourThread ) , "Not in the correct thread" ) ; client . addParentWatcher ( watcher ) ; } | SessionFailRetryLoop must be started |
26,711 | public void close ( ) { Preconditions . checkState ( Thread . currentThread ( ) . equals ( ourThread ) , "Not in the correct thread" ) ; failedSessionThreads . remove ( ourThread ) ; client . removeParentWatcher ( watcher ) ; } | Must be called in a finally handler when done with the loop |
26,712 | public static boolean verifyEnvironment ( ) { if ( ! PRODUCTION . equals ( getEnv ( ) ) ) { return true ; } else { File tokenFile = new File ( "/etc/xian/xian_runtime_production.token" ) ; if ( tokenFile . exists ( ) && tokenFile . isFile ( ) ) { String token = PlainFileUtil . readAll ( tokenFile ) ; return "cbab75c745... | Production safety check . Protection for production env . |
26,713 | public static CuratorFramework newClient ( String connectString , RetryPolicy retryPolicy ) { return newClient ( connectString , DEFAULT_SESSION_TIMEOUT_MS , DEFAULT_CONNECTION_TIMEOUT_MS , retryPolicy ) ; } | Create a new client with default session timeout and default connection timeout |
26,714 | public static CuratorFramework newClient ( String connectString , int sessionTimeoutMs , int connectionTimeoutMs , RetryPolicy retryPolicy ) { return builder ( ) . connectString ( connectString ) . sessionTimeoutMs ( sessionTimeoutMs ) . connectionTimeoutMs ( connectionTimeoutMs ) . retryPolicy ( retryPolicy ) . build ... | Create a new client |
26,715 | public void invokeSlackWebhook ( ) { RestTemplate restTemplate = new RestTemplate ( ) ; RichMessage richMessage = new RichMessage ( "Just to test Slack's incoming webhooks." ) ; Attachment [ ] attachments = new Attachment [ 1 ] ; attachments [ 0 ] = new Attachment ( ) ; attachments [ 0 ] . setText ( "Some data relevant... | Make a POST call to the incoming webhook url . |
26,716 | public void afterConnectionClosed ( WebSocketSession session , CloseStatus status ) { logger . debug ( "WebSocket closed: {}, Close Status: {}" , session , status . toString ( ) ) ; } | Invoked after the web socket connection is closed . You can override this method in the child classes . |
26,717 | protected void startRTMAndWebSocketConnection ( ) { slackService . connectRTM ( getSlackToken ( ) ) ; if ( slackService . getWebSocketUrl ( ) != null ) { webSocketManager = new WebSocketConnectionManager ( client ( ) , handler ( ) , slackService . getWebSocketUrl ( ) ) ; webSocketManager . start ( ) ; } else { logger .... | Entry point where the web socket connection starts and after which your bot becomes live . |
26,718 | @ Controller ( events = EventType . QUICK_REPLY , pattern = "(yes|no)" ) public void onReceiveQuickReply ( Event event ) { if ( "yes" . equals ( event . getMessage ( ) . getQuickReply ( ) . getPayload ( ) ) ) { reply ( event , "Cool! You can type: \n 1) Show Buttons \n 2) Show List \n 3) Setup meeting" ) ; } else { rep... | This method gets invoked when the user clicks on a quick reply button whose payload is either yes or no . |
26,719 | @ Controller ( events = EventType . MESSAGE , pattern = "(?i)(bye|tata|ttyl|cya|see you)" ) public void showGithubLink ( Event event ) { reply ( event , new Message ( ) . setAttachment ( new Attachment ( ) . setType ( "template" ) . setPayload ( new Payload ( ) . setTemplateType ( "button" ) . setText ( "Bye. Happy cod... | Show the github project url when the user says bye . |
26,720 | @ Controller ( events = EventType . PIN_ADDED ) public void onPinAdded ( WebSocketSession session , Event event ) { reply ( session , event , "Thanks for the pin! You can find all pinned items under channel details." ) ; } | Invoked when an item is pinned in the channel . |
26,721 | public void connectRTM ( String slackToken ) { RTM rtm = restTemplate . getForEntity ( slackApiEndpoints . getRtmConnectApi ( ) , RTM . class , slackToken ) . getBody ( ) ; currentUser = rtm . getSelf ( ) ; webSocketUrl = rtm . getUrl ( ) ; getImChannels ( slackToken , 200 , "" ) ; } | Start a RTM connection . Fetch the web socket url to connect to current user details and list of channel ids where the current user has had conversation . |
26,722 | private void getImChannels ( String slackToken , int limit , String nextCursor ) { try { Event event = restTemplate . getForEntity ( slackApiEndpoints . getImListApi ( ) , Event . class , slackToken , limit , nextCursor ) . getBody ( ) ; imChannelIds . addAll ( Arrays . stream ( event . getIms ( ) ) . map ( Channel :: ... | Fetch all im channels to determine direct message to the bot . |
26,723 | protected final void startConversation ( Event event , String methodName ) { startConversation ( event . getSender ( ) . getId ( ) , methodName ) ; } | Call this method to start a conversation . |
26,724 | private void invokeChainedMethod ( Event event ) { Queue < MethodWrapper > queue = conversationQueueMap . get ( event . getSender ( ) . getId ( ) ) ; if ( queue != null && ! queue . isEmpty ( ) ) { MethodWrapper methodWrapper = queue . peek ( ) ; try { EventType [ ] eventTypes = methodWrapper . getMethod ( ) . getAnnot... | Invoke the appropriate method in a conversation . |
26,725 | private String getPatternFromEventType ( Event event ) { switch ( event . getType ( ) ) { case MESSAGE : return event . getMessage ( ) . getText ( ) ; case QUICK_REPLY : return event . getMessage ( ) . getQuickReply ( ) . getPayload ( ) ; case POSTBACK : return event . getPostback ( ) . getPayload ( ) ; default : retur... | Match the pattern with different attributes based on the event type . |
26,726 | private Queue < MethodWrapper > formConversationQueue ( Queue < MethodWrapper > queue , String methodName ) { MethodWrapper methodWrapper = methodNameMap . get ( methodName ) ; queue . add ( methodWrapper ) ; if ( StringUtils . isEmpty ( methodName ) ) { return queue ; } else { return formConversationQueue ( queue , me... | Form a Queue with all the methods responsible for a particular conversation . |
26,727 | @ SuppressWarnings ( "fallthrough" ) public static int murmur2 ( final byte [ ] data ) { int length = data . length ; int seed = 0x9747b28c ; final int m = 0x5bd1e995 ; final int r = 24 ; int h = seed ^ length ; int length4 = length / 4 ; for ( int i = 0 ; i < length4 ; i ++ ) { final int i4 = i * 4 ; int k = ( data [ ... | Generates 32 bit murmur2 hash from byte array |
26,728 | private void prepareTopic ( final Map < String , InternalTopicMetadata > topicPartitions ) { log . debug ( "Starting to validate internal topics {} in partition assignor." , topicPartitions ) ; final Map < String , InternalTopicConfig > topicsToMakeReady = new HashMap < > ( ) ; for ( final InternalTopicMetadata metadat... | Internal helper function that creates a Kafka topic |
26,729 | ColumnRange removeColumn ( int column ) { if ( isSingleCol ( ) ) { return null ; } else if ( column == left ) { left ++ ; return this ; } else if ( column + 1 == right ) { right -- ; return this ; } else { ColumnRange created = new ColumnRange ( this . element , this . locator , column + 1 , this . right ) ; created . ... | Removes a column from the range possibly asking it to be destroyed or splitting it . |
26,730 | private State checkh ( State state ) throws DatatypeException , IOException { if ( state . context . length ( ) == 0 ) { state = appendToContext ( state ) ; } state . current = state . reader . read ( ) ; state = appendToContext ( state ) ; state = skipSpaces ( state ) ; boolean expectNumber = true ; for ( ; ; ) { swit... | Checks an h command . |
26,731 | private State skipSubPath ( State state ) throws IOException { for ( ; ; ) { switch ( state . current ) { case - 1 : case 'm' : case 'M' : return state ; default : break ; } state . current = state . reader . read ( ) ; state = appendToContext ( state ) ; } } | Skips a sub - path . |
26,732 | private State skipSpaces ( State state ) throws IOException { for ( ; ; ) { switch ( state . current ) { default : return state ; case 0x20 : case 0x09 : case 0x0D : case 0x0A : } state . current = state . reader . read ( ) ; state = appendToContext ( state ) ; } } | Skips the whitespaces in the current reader . |
26,733 | private void appendColumnRange ( ColumnRange colRange ) { if ( last == null ) { first = colRange ; last = colRange ; } else { last . setNext ( colRange ) ; last = colRange ; } } | Appends a column range to the linked list of column ranges . |
26,734 | public void characters ( char [ ] ch , int start , int length ) throws SAXException { try { for ( int j = 0 ; j < length ; j ++ ) { char c = ch [ start + j ] ; switch ( c ) { case '<' : this . writer . write ( "<" ) ; break ; case '>' : this . writer . write ( ">" ) ; break ; case '&' : this . writer . write ( "&... | Writes out characters . |
26,735 | public void endDocument ( ) throws SAXException { try { this . writer . close ( ) ; } catch ( IOException ioe ) { throw ( SAXException ) new SAXException ( ioe ) . initCause ( ioe ) ; } } | Must be called in the end . |
26,736 | public void endElement ( String namespaceURI , String localName , String qName ) throws SAXException { try { if ( XHTML_NS . equals ( namespaceURI ) && Arrays . binarySearch ( emptyElements , localName ) < 0 ) { this . writer . write ( "</" ) ; this . writer . write ( localName ) ; this . writer . write ( '>' ) ; } } c... | Writes an end tag if the element is an XHTML element and is not an empty element in HTML 4 . 01 Strict . |
26,737 | public void startDocument ( ) throws SAXException { try { switch ( doctype ) { case NO_DOCTYPE : return ; case DOCTYPE_HTML5 : writer . write ( "<!DOCTYPE html>\n" ) ; return ; case DOCTYPE_HTML401_STRICT : writer . write ( "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\... | Must be called first . |
26,738 | public void startElement ( String namespaceURI , String localName , String qName , Attributes atts ) throws SAXException { try { if ( XHTML_NS . equals ( namespaceURI ) ) { if ( "meta" . equals ( localName ) && ( ( atts . getIndex ( "" , "http-equiv" ) != - 1 ) || ( atts . getIndex ( "" , "httpequiv" ) != - 1 ) ) ) { r... | Writes a start tag if the element is an XHTML element . |
26,739 | private void fatal ( String message , char textFound , String textExpected ) throws SAXException { fatal ( message , Character . valueOf ( textFound ) . toString ( ) , textExpected ) ; } | Report a serious error . |
26,740 | private void parseComment ( ) throws Exception { boolean saved = expandPE ; expandPE = false ; parseUntil ( endDelimComment ) ; require ( '>' ) ; expandPE = saved ; handler . comment ( dataBuffer , 0 , dataBufferPos ) ; dataBufferPos = 0 ; } | Skip a comment . |
26,741 | private void parsePI ( ) throws SAXException , IOException { String name ; boolean saved = expandPE ; expandPE = false ; name = readNmtoken ( true ) ; if ( name . indexOf ( ':' ) >= 0 ) { fatal ( "Illegal character(':') in processing instruction name " , name , null ) ; } if ( "xml" . equalsIgnoreCase ( name ) ) { fata... | Parse a processing instruction and do a call - back . |
26,742 | private String parseXMLDecl ( String encoding ) throws SAXException , IOException { String version ; String encodingName = null ; String standalone = null ; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF ; require ( "version" ) ; parseEq ( ) ; checkLegalVersion ( version = readLiteral ( flags ) ) ; if... | Parse the XML declaration . |
26,743 | private void checkEncodingLiteral ( String encodingName ) throws SAXException { if ( encodingName == null ) { return ; } if ( encodingName . length ( ) == 0 ) { fatal ( "The empty string does not a legal encoding name." ) ; } char c = encodingName . charAt ( 0 ) ; if ( ! ( ( ( c >= 'a' ) && ( c <= 'z' ) ) || ( ( c >= '... | hsivonen 2006 - 04 - 28 |
26,744 | private String parseTextDecl ( String encoding ) throws SAXException , IOException { String encodingName = null ; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF ; if ( tryRead ( "version" ) ) { String version ; parseEq ( ) ; checkLegalVersion ( version = readLiteral ( flags ) ) ; if ( ! version . equa... | Parse a text declaration . |
26,745 | private void parseMisc ( ) throws Exception { while ( true ) { skipWhitespace ( ) ; if ( tryRead ( startDelimPI ) ) { parsePI ( ) ; } else if ( tryRead ( startDelimComment ) ) { parseComment ( ) ; } else { return ; } } } | Parse miscellaneous markup outside the document element and DOCTYPE declaration . |
26,746 | private void parseDoctypedecl ( ) throws Exception { String rootName ; ExternalIdentifiers ids ; requireWhitespace ( ) ; rootName = readNmtoken ( true ) ; skipWhitespace ( ) ; ids = readExternalIds ( false , true ) ; handler . doctypeDecl ( rootName , ids . publicId , ids . systemId ) ; skipWhitespace ( ) ; if ( tryRea... | Parse a document type declaration . |
26,747 | private void parseMarkupdecl ( ) throws Exception { char [ ] saved = null ; boolean savedPE = expandPE ; require ( '<' ) ; unread ( '<' ) ; expandPE = false ; if ( tryRead ( "<!ELEMENT" ) ) { saved = readBuffer ; expandPE = savedPE ; parseElementDecl ( ) ; } else if ( tryRead ( "<!ATTLIST" ) ) { saved = readBuffer ; ex... | Parse a markup declaration in the internal or external DTD subset . |
26,748 | private void parseElement ( boolean maybeGetSubset ) throws Exception { String gi ; char c ; int oldElementContent = currentElementContent ; String oldElement = currentElement ; ElementDecl element ; tagAttributePos = 0 ; gi = readNmtoken ( true ) ; if ( maybeGetSubset ) { InputSource subset = handler . getExternalSubs... | Parse an element with its tags . |
26,749 | private void parseAttribute ( String name ) throws Exception { String aname ; String type ; String value ; int flags = LIT_ATTRIBUTE | LIT_ENTITY_REF ; aname = readNmtoken ( true ) ; type = getAttributeType ( name , aname ) ; parseEq ( ) ; if ( handler . stringInterning ) { if ( ( type == "CDATA" ) || ( type == null ) ... | Parse an attribute assignment . |
26,750 | private void parseContent ( ) throws Exception { char c ; while ( true ) { parseCharData ( ) ; c = readCh ( ) ; switch ( c ) { case '&' : c = readCh ( ) ; if ( c == '#' ) { parseCharRef ( ) ; } else { unread ( c ) ; parseEntityRef ( true ) ; } isDirtyCurrentElement = true ; break ; case '<' : dataBufferFlush ( ) ; c = ... | Parse the content of an element . |
26,751 | private void parseElementDecl ( ) throws Exception { String name ; requireWhitespace ( ) ; name = readNmtoken ( true ) ; requireWhitespace ( ) ; parseContentspec ( name ) ; skipWhitespace ( ) ; require ( '>' ) ; } | Parse an element type declaration . |
26,752 | private void parseContentspec ( String name ) throws Exception { if ( tryRead ( "EMPTY" ) ) { setElement ( name , CONTENT_EMPTY , null , null ) ; if ( ! skippedPE ) { handler . getDeclHandler ( ) . elementDecl ( name , "EMPTY" ) ; } return ; } else if ( tryRead ( "ANY" ) ) { setElement ( name , CONTENT_ANY , null , nul... | Content specification . |
26,753 | private void parseElements ( char [ ] saved ) throws Exception { char c ; char sep ; skipWhitespace ( ) ; parseCp ( ) ; skipWhitespace ( ) ; c = readCh ( ) ; switch ( c ) { case ')' : if ( readBuffer != saved ) { handler . verror ( "Illegal Group/PE nesting" ) ; } dataBufferAppend ( ')' ) ; c = readCh ( ) ; switch ( c ... | Parse an element - content model . |
26,754 | private void parseCp ( ) throws Exception { if ( tryRead ( '(' ) ) { dataBufferAppend ( '(' ) ; parseElements ( readBuffer ) ; } else { dataBufferAppend ( readNmtoken ( true ) ) ; char c = readCh ( ) ; switch ( c ) { case '?' : case '*' : case '+' : dataBufferAppend ( c ) ; break ; default : unread ( c ) ; break ; } } ... | Parse a content particle . |
26,755 | private void parseMixed ( char [ ] saved ) throws Exception { skipWhitespace ( ) ; if ( tryRead ( ')' ) ) { if ( readBuffer != saved ) { handler . verror ( "Illegal Group/PE nesting" ) ; } dataBufferAppend ( ")*" ) ; tryRead ( '*' ) ; return ; } skipWhitespace ( ) ; while ( ! tryRead ( ")" ) ) { require ( '|' ) ; dataB... | Parse mixed content . |
26,756 | private void parseAttlistDecl ( ) throws Exception { String elementName ; requireWhitespace ( ) ; elementName = readNmtoken ( true ) ; boolean white = tryWhitespace ( ) ; while ( ! tryRead ( '>' ) ) { if ( ! white ) { fatal ( "whitespace required before attribute definition" ) ; } parseAttDef ( elementName ) ; white = ... | Parse an attribute list declaration . |
26,757 | private void parseAttDef ( String elementName ) throws Exception { String name ; String type ; String enumer = null ; name = readNmtoken ( true ) ; requireWhitespace ( ) ; type = readAttType ( ) ; if ( handler . stringInterning ) { if ( ( "ENUMERATION" == type ) || ( "NOTATION" == type ) ) { enumer = dataBufferToString... | Parse a single attribute definition . |
26,758 | private String readAttType ( ) throws Exception { if ( tryRead ( '(' ) ) { parseEnumeration ( false ) ; return "ENUMERATION" ; } else { String typeString = readNmtoken ( true ) ; if ( handler . stringInterning ) { if ( "NOTATION" == typeString ) { parseNotationType ( ) ; return typeString ; } else if ( ( "CDATA" == typ... | Parse the attribute type . |
26,759 | private void parseEnumeration ( boolean isNames ) throws Exception { dataBufferAppend ( '(' ) ; skipWhitespace ( ) ; dataBufferAppend ( readNmtoken ( isNames ) ) ; skipWhitespace ( ) ; while ( ! tryRead ( ')' ) ) { require ( '|' ) ; dataBufferAppend ( '|' ) ; skipWhitespace ( ) ; dataBufferAppend ( readNmtoken ( isName... | Parse an enumeration . |
26,760 | private void parseDefault ( String elementName , String name , String type , String enumer ) throws Exception { int valueType = ATTRIBUTE_DEFAULT_SPECIFIED ; String value = null ; int flags = LIT_ATTRIBUTE ; boolean saved = expandPE ; String defaultType = null ; if ( ! skippedPE ) { flags |= LIT_ENTITY_REF ; if ( handl... | Parse the default value for an attribute . |
26,761 | private void parseConditionalSect ( char [ ] saved ) throws Exception { skipWhitespace ( ) ; if ( tryRead ( "INCLUDE" ) ) { skipWhitespace ( ) ; require ( '[' ) ; if ( readBuffer != saved ) { handler . verror ( "Illegal Conditional Section/PE nesting" ) ; } skipWhitespace ( ) ; while ( ! tryRead ( "]]>" ) ) { parseMark... | Parse a conditional section . |
26,762 | private void parseCharRef ( boolean doFlush ) throws SAXException , IOException { int value = 0 ; char c ; if ( tryRead ( 'x' ) ) { loop1 : while ( true ) { c = readCh ( ) ; if ( c == ';' ) { break loop1 ; } else { int n = Character . digit ( c , 16 ) ; if ( n == - 1 ) { fatal ( "illegal character in character referenc... | Read and interpret a character reference . |
26,763 | private void parseEntityRef ( boolean externalAllowed ) throws SAXException , IOException { String name ; name = readNmtoken ( true ) ; require ( ';' ) ; switch ( getEntityType ( name ) ) { case ENTITY_UNDECLARED : String message ; message = "reference to undeclared general entity " + name ; if ( skippedPE && ! docIsSt... | Parse and expand an entity reference . |
26,764 | private void parsePEReference ( ) throws SAXException , IOException { String name ; name = "%" + readNmtoken ( true ) ; require ( ';' ) ; switch ( getEntityType ( name ) ) { case ENTITY_UNDECLARED : handler . verror ( "reference to undeclared parameter entity " + name ) ; break ; case ENTITY_INTERNAL : if ( inLiteral )... | Parse and expand a parameter entity reference . |
26,765 | private void parseEntityDecl ( ) throws Exception { boolean peFlag = false ; int flags = 0 ; expandPE = false ; requireWhitespace ( ) ; if ( tryRead ( '%' ) ) { peFlag = true ; requireWhitespace ( ) ; } expandPE = true ; String name = readNmtoken ( true ) ; if ( name . indexOf ( ':' ) >= 0 ) { fatal ( "Illegal characte... | Parse an entity declaration . |
26,766 | private void parseNotationDecl ( ) throws Exception { String nname ; ExternalIdentifiers ids ; requireWhitespace ( ) ; nname = readNmtoken ( true ) ; if ( nname . indexOf ( ':' ) >= 0 ) { fatal ( "Illegal character(':') in notation name " , nname , null ) ; } requireWhitespace ( ) ; ids = readExternalIds ( true , false... | Parse a notation declaration . |
26,767 | private void parseCharData ( ) throws Exception { char c ; int state = 0 ; boolean pureWhite = false ; if ( ( currentElementContent == CONTENT_ELEMENTS ) && ! isDirtyCurrentElement ) { pureWhite = true ; } while ( true ) { int i ; loop : for ( i = readBufferPos ; i < readBufferLength ; i ++ ) { advanceLocation ( ) ; sw... | Parse character data . |
26,768 | private void requireWhitespace ( ) throws SAXException , IOException { char c = readCh ( ) ; if ( isWhitespace ( c ) ) { skipWhitespace ( ) ; } else { fatal ( "whitespace required" , c , null ) ; } } | Require whitespace characters . |
26,769 | private void skipWhitespace ( ) throws SAXException , IOException { char c = readCh ( ) ; while ( isWhitespace ( c ) ) { c = readCh ( ) ; } unread ( c ) ; } | Skip whitespace characters . |
26,770 | private ExternalIdentifiers readExternalIds ( boolean inNotation , boolean isSubset ) throws Exception { char c ; ExternalIdentifiers ids = new ExternalIdentifiers ( ) ; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF ; if ( tryRead ( "PUBLIC" ) ) { requireWhitespace ( ) ; ids . publicId = readLiteral ... | Try reading external identifiers . A system identifier is not required for notations . |
26,771 | private boolean isWhitespace ( char c ) { if ( c > 0x20 ) { return false ; } if ( ( c == 0x20 ) || ( c == 0x0a ) || ( c == 0x09 ) || ( c == 0x0d ) ) { return true ; } return false ; } | Test if a character is whitespace . |
26,772 | private void dataBufferAppend ( char c ) { if ( dataBufferPos >= dataBuffer . length ) { dataBuffer = ( char [ ] ) extendArray ( dataBuffer , dataBuffer . length , dataBufferPos ) ; } dataBuffer [ dataBufferPos ++ ] = c ; } | Add a character to the data buffer . |
26,773 | private void dataBufferNormalize ( ) { int i = 0 ; int j = 0 ; int end = dataBufferPos ; while ( ( j < end ) && ( dataBuffer [ j ] == ' ' ) ) { j ++ ; } while ( ( end > j ) && ( dataBuffer [ end - 1 ] == ' ' ) ) { end -- ; } while ( j < end ) { char c = dataBuffer [ j ++ ] ; if ( c == ' ' ) { while ( ( j < end ) && ( d... | Normalise space characters in the data buffer . |
26,774 | private void dataBufferFlush ( ) throws SAXException { int saveLine = line ; int saveColumn = column ; line = linePrev ; column = columnPrev ; if ( ( currentElementContent == CONTENT_ELEMENTS ) && ( dataBufferPos > 0 ) && ! inCDATA ) { for ( int i = 0 ; i < dataBufferPos ; i ++ ) { if ( ! isWhitespace ( dataBuffer [ i ... | Flush the contents of the data buffer to the handler as appropriate and reset the buffer for new input . |
26,775 | private void require ( char delim ) throws SAXException , IOException { char c = readCh ( ) ; if ( c != delim ) { fatal ( "required character" , c , Character . valueOf ( delim ) . toString ( ) ) ; } } | Require a character to appear or throw an exception . |
26,776 | private Object extendArray ( Object array , int currentSize , int requiredSize ) { if ( requiredSize < currentSize ) { return array ; } else { Object newArray = null ; int newSize = currentSize * 2 ; if ( newSize <= requiredSize ) { newSize = requiredSize + 1 ; } if ( array instanceof char [ ] ) { newArray = new char [... | Ensure the capacity of an array allocating a new one if necessary . Usually extends only for name hash collisions . |
26,777 | private void filterCR ( boolean moreData ) { int i , j ; readBufferOverflow = - 1 ; loop : for ( i = j = readBufferPos ; j < readBufferLength ; i ++ , j ++ ) { switch ( readBuffer [ j ] ) { case '\r' : if ( j == readBufferLength - 1 ) { if ( moreData ) { readBufferOverflow = '\r' ; readBufferLength -- ; } else { readBu... | Filter carriage returns in the read buffer . CRLF becomes LF ; CR becomes LF . |
26,778 | private void initializeVariables ( ) throws SAXException { prev = '\u0000' ; line = 0 ; column = 1 ; linePrev = 0 ; columnPrev = 1 ; nextCharOnNewLine = true ; dataBufferPos = 0 ; dataBuffer = new char [ DATA_BUFFER_INITIAL ] ; nameBufferPos = 0 ; nameBuffer = new char [ NAME_BUFFER_INITIAL ] ; elementInfo = new HashMa... | Re - initialize the variables for each parse . |
26,779 | @ SuppressWarnings ( "deprecation" ) public void characters ( char [ ] ch , int start , int length ) throws SAXException { if ( alreadyComplainedAboutThisRun ) { return ; } if ( atStartOfRun ) { char c = ch [ start ] ; if ( pos == 1 ) { if ( isComposingChar ( UCharacter . getCodePoint ( buf [ 0 ] , c ) ) ) { warn ( "Te... | In the normal mode this method has the usual SAX semantics . In the source text mode this method is used for reporting the source text . |
26,780 | private void appendToBuf ( char [ ] ch , int start , int end ) { if ( start == end ) { return ; } int neededBufLen = pos + ( end - start ) ; if ( neededBufLen > buf . length ) { char [ ] newBuf = new char [ neededBufLen ] ; System . arraycopy ( buf , 0 , newBuf , 0 , pos ) ; if ( bufHolder == null ) { bufHolder = buf ;... | Appends a slice of an UTF - 16 code unit array to the internal buffer . |
26,781 | void verror ( String message ) throws SAXException { SAXParseException err ; err = new SAXParseException ( message , this ) ; errorHandler . error ( err ) ; } | make layered SAX2 DTD validation more conformant |
26,782 | public static void setParams ( int connectionTimeout , int socketTimeout , int maxRequests ) { PrudentHttpEntityResolver . maxRequests = maxRequests ; PoolingHttpClientConnectionManager phcConnMgr ; Registry < ConnectionSocketFactory > registry = RegistryBuilder . < ConnectionSocketFactory > create ( ) . register ( "ht... | Sets the timeouts of the HTTP client . |
26,783 | public void errOnHorizontalOverlap ( Cell laterCell ) throws SAXException { if ( ! ( ( laterCell . right <= left ) || ( right <= laterCell . left ) ) ) { this . err ( "Table cell is overlapped by later table cell." ) ; laterCell . err ( "Table cell overlaps an earlier table cell." ) ; } } | Emit errors if this cell and the argument overlap horizontally . |
26,784 | public void warn ( String message ) throws SAXException { if ( errorHandler != null ) { SAXParseException spe = new SAXParseException ( message , locator ) ; errorHandler . warning ( spe ) ; } } | Emit a warning . The locator is used . |
26,785 | public void warn ( String message , Locator overrideLocator ) throws SAXException { if ( errorHandler != null ) { SAXParseException spe = new SAXParseException ( message , overrideLocator ) ; errorHandler . warning ( spe ) ; } } | Emit a warning with specified locator . |
26,786 | public void err ( String message , Locator overrideLocator ) throws SAXException { if ( errorHandler != null ) { SAXParseException spe = new SAXParseException ( message , overrideLocator ) ; errorHandler . error ( spe ) ; } } | Emit an error with specified locator . |
26,787 | public void err ( String message ) throws SAXException { if ( errorHandler != null ) { SAXParseException spe = new SAXParseException ( message , locator ) ; errorHandler . error ( spe ) ; } } | Emit an error . The locator is used . |
26,788 | public String validate ( Path path ) throws IOException , SAXException { try ( OneOffValidator validator = new OneOffValidator ( asciiQuotes , detectLanguages , forceHTML , lineOffset , loadEntities , noStream , outputFormat , schemaUrl ) ) { return validator . validate ( path ) ; } } | Validate the file at the given path |
26,789 | public String validate ( InputStream in ) throws IOException , SAXException { try ( OneOffValidator validator = new OneOffValidator ( asciiQuotes , detectLanguages , forceHTML , lineOffset , loadEntities , noStream , outputFormat , schemaUrl ) ) { return validator . validate ( in ) ; } } | Validate the input source |
26,790 | private void pop ( ) throws SAXException { if ( current == null ) { throw new IllegalStateException ( "Bug!" ) ; } current . end ( ) ; if ( stack . isEmpty ( ) ) { current = null ; } else { current = stack . removeLast ( ) ; } } | Ends the current table discards it and pops the top of the stack to be the new current table . |
26,791 | public static String [ ] split ( String value ) { if ( value == null || "" . equals ( value ) ) { return EMPTY_STRING_ARRAY ; } int len = value . length ( ) ; List < String > list = new LinkedList < > ( ) ; boolean collectingSpace = true ; int start = 0 ; for ( int i = 0 ; i < len ; i ++ ) { char c = value . charAt ( i... | Splits the argument on white space . |
26,792 | public Object evaluate ( Input input ) { if ( noInput ( input ) ) { return NO_INPUT ; } String line = input . words ( ) . stream ( ) . collect ( Collectors . joining ( " " ) ) . trim ( ) ; String command = findLongestCommand ( line ) ; List < String > words = input . words ( ) ; if ( command != null ) { MethodTarget me... | Evaluate a single line of input from the user by trying to map words to a command and arguments . |
26,793 | public TableBuilder addOutlineBorder ( BorderStyle style ) { this . addBorder ( 0 , 0 , model . getRowCount ( ) , model . getColumnCount ( ) , OUTLINE , style ) ; return this ; } | Set a border on the outline of the whole table . |
26,794 | public TableBuilder addHeaderBorder ( BorderStyle style ) { this . addBorder ( 0 , 0 , 1 , model . getColumnCount ( ) , OUTLINE , style ) ; return addOutlineBorder ( style ) ; } | Set a border on the outline of the whole table as well as around the first row . |
26,795 | public TableBuilder addFullBorder ( BorderStyle style ) { this . addBorder ( 0 , 0 , model . getRowCount ( ) , model . getColumnCount ( ) , FULL , style ) ; return this ; } | Set a border around each and every cell of the table . |
26,796 | public TableBuilder addHeaderAndVerticalsBorders ( BorderStyle style ) { this . addBorder ( 0 , 0 , 1 , model . getColumnCount ( ) , OUTLINE , style ) ; this . addBorder ( 0 , 0 , model . getRowCount ( ) , model . getColumnCount ( ) , OUTLINE | INNER_VERTICAL , style ) ; return this ; } | Set a border on the outline of the whole table around the first row and draw vertical lines around each column . |
26,797 | public TableBuilder addInnerBorder ( BorderStyle style ) { this . addBorder ( 0 , 0 , model . getRowCount ( ) , model . getColumnCount ( ) , INNER , style ) ; return this ; } | Set a border on the inner verticals and horizontals of the table but not on the outline . |
26,798 | public static TableBuilder configureKeyValueRendering ( TableBuilder builder , String delimiter ) { return builder . on ( CellMatchers . ofType ( Map . class ) ) . addFormatter ( new MapFormatter ( delimiter ) ) . addAligner ( new KeyValueHorizontalAligner ( delimiter . trim ( ) ) ) . addSizer ( new KeyValueSizeConstra... | Install all the necessary formatters aligners etc for key - value rendering of Maps . |
26,799 | public static void disable ( ConfigurableEnvironment environment ) { environment . getPropertySources ( ) . addFirst ( new MapPropertySource ( "interactive.override" , Collections . singletonMap ( SPRING_SHELL_INTERACTIVE_ENABLED , "false" ) ) ) ; } | Helper method to dynamically disable this runner . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.