idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
130,800
private boolean validateSignature ( Credentials credentials , String secretKey ) { String clientSignature = credentials . getSignature ( ) ; String serverSignature = createSignature ( credentials , secretKey ) ; return MessageDigest . isEqual ( clientSignature . getBytes ( ) , serverSignature . getBytes ( ) ) ; }
Validate the signature on the request by generating a new signature here and making sure they match . The only way for them to match is if both signature are generated using the same secret key . If they match this means that the requester has a valid secret key and can be a trusted source .
130,801
private String createSignature ( Credentials credentials , String secretKey ) { return new SignatureGenerator ( ) . generate ( secretKey , credentials . getMethod ( ) , credentials . getTimestamp ( ) , credentials . getPath ( ) , credentials . getContent ( ) ) ; }
Create a signature given the set of request credentials and a secret key .
130,802
public void clear ( ) { for ( int i = 0 ; i < mNumberPinBoxes ; i ++ ) { getPinBox ( i ) . getText ( ) . clear ( ) ; } checkPinBoxesAvailableOrder ( ) ; }
Clear PinBoxes values
130,803
public void resetChildrenFocus ( ) { for ( int pinBoxesId : pinBoxesIds ) { EditText pin = ( EditText ) findViewById ( pinBoxesId ) ; pin . setOnFocusChangeListener ( this ) ; } }
Clear PinBoxes focus
130,804
public static float convertPixelToDp ( Context context , float px ) { Resources resources = context . getResources ( ) ; DisplayMetrics metrics = resources . getDisplayMetrics ( ) ; return px / ( metrics . densityDpi / 160f ) ; }
This method converts device specific pixels to density independent pixels .
130,805
public static void hideKeyboard ( Context context ) { try { InputMethodManager imm = ( InputMethodManager ) context . getSystemService ( Context . INPUT_METHOD_SERVICE ) ; View currentFocus = ( ( Activity ) context ) . getCurrentFocus ( ) ; if ( imm != null && currentFocus != null ) { IBinder windowToken = currentFocus...
Hides the already popped up keyboard from the screen .
130,806
private void createEditModeView ( Context context ) { ( ( LayoutInflater ) context . getSystemService ( Context . LAYOUT_INFLATER_SERVICE ) ) . inflate ( R . layout . pin_view_edit_mode , this , true ) ; }
This method inflates the PinView to be visible from Preview Layout
130,807
private void createView ( Context context ) { ( ( LayoutInflater ) context . getSystemService ( Context . LAYOUT_INFLATER_SERVICE ) ) . inflate ( R . layout . pin_view , this , true ) ; inputMethodManager = ( InputMethodManager ) getContext ( ) . getSystemService ( Service . INPUT_METHOD_SERVICE ) ; mLinearLayoutPinTex...
This method inflates the PinView
130,808
private void getAttributes ( Context context , AttributeSet attrs ) { TypedArray typedArray = context . obtainStyledAttributes ( attrs , R . styleable . PinView ) ; if ( typedArray != null ) { try { mNumberPinBoxes = typedArray . getInteger ( R . styleable . PinView_numberPinBoxes , PinViewSettings . DEFAULT_NUMBER_PIN...
Retrieve styles attributes
130,809
private void setStylePinBox ( EditText editText ) { editText . setFilters ( new InputFilter [ ] { new InputFilter . LengthFilter ( mNumberCharacters ) } ) ; if ( mMaskPassword ) { editText . setTransformationMethod ( PasswordTransformationMethod . getInstance ( ) ) ; } else { editText . setTransformationMethod ( HideRe...
Set a PinBox with all attributes
130,810
private void setStylesPinTitle ( TextView pinTitle ) { if ( mColorTextTitles != PinViewSettings . DEFAULT_TEXT_COLOR_TITLES ) { pinTitle . setTextColor ( mColorTextTitles ) ; } pinTitle . setTextSize ( PinViewUtils . convertPixelToDp ( getContext ( ) , mTextSizeTitles ) ) ; }
Set a Title with all attributes
130,811
private void setStylesSplit ( TextView split ) { if ( split != null ) { split . setText ( mSplit ) ; split . setLayoutParams ( new LayoutParams ( ViewGroup . LayoutParams . WRAP_CONTENT , ViewGroup . LayoutParams . MATCH_PARENT ) ) ; split . setGravity ( Gravity . CENTER_VERTICAL ) ; if ( mColorSplit != PinViewSettings...
Set a Split with all attributes
130,812
public boolean dispatchKeyEventPreIme ( KeyEvent event ) { if ( mKeyboardMandatory ) { if ( getContext ( ) != null ) { InputMethodManager imm = ( InputMethodManager ) getContext ( ) . getSystemService ( Context . INPUT_METHOD_SERVICE ) ; if ( imm . isActive ( ) && event . getKeyCode ( ) == KeyEvent . KEYCODE_BACK ) { s...
Keyboard back button
130,813
public static DataLinkType valueOf ( short value ) { for ( Map . Entry < DataLinkType , Short > entry : registry . entrySet ( ) ) { if ( entry . getValue ( ) == value ) { return entry . getKey ( ) ; } } return new DataLinkType ( ( short ) - 1 , "Unknown" ) ; }
Get datalink type from value .
130,814
@ ConditionalOnClass ( { Inet4Address . class , PcapIf . class } ) @ Bean ( NETMASK_BEAN_NAME ) public Inet4Address netmask ( @ Qualifier ( PCAP_IF_BEAN_NAME ) PcapIf pcapIf ) { Iterator < PcapAddr > iterator = pcapIf . getAddresses ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { PcapAddr pcapAddr = iterator . ...
Default netmask .
130,815
@ ConditionalOnClass ( { MacAddress . class , PcapIf . class , PcapAddr . class , SockAddr . class , DeviceNotFoundException . class , PlatformNotSupportedException . class } ) @ Bean ( MAC_ADDRESS_BEAN_NAME ) public MacAddress macAddress ( @ Qualifier ( PCAP_IF_BEAN_NAME ) PcapIf pcapIf ) throws PlatformNotSupportedEx...
Default mac address specified by pcapIf .
130,816
@ ConditionalOnClass ( { Context . class , DataLinkType . class } ) @ Bean ( DATALINK_TYPE_BEAN_NAME ) public DataLinkType dataLinkType ( @ Qualifier ( CONTEXT_BEAN_NAME ) Context context ) { DataLinkType dataLinkType = context . pcapDataLink ( ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Datalink type: {...
A handle link type .
130,817
@ Bean ( ERRBUF_BEAN_NAME ) public StringBuilder errbuf ( ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Create error buffer with size: {}." , PCAP_ERRBUF_SIZE ) ; } return new StringBuilder ( PCAP_ERRBUF_SIZE ) ; }
Error buffer .
130,818
@ Bean ( EXECUTOR_SERVICE_BEAN_NAME ) public ExecutorService executorService ( ) { if ( this . properties . getNumberOfThread ( ) == 0 ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Use cached thread pool." ) ; } return Executors . newCachedThreadPool ( ) ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . de...
Thread pool .
130,819
@ ConditionalOnClass ( { PcapIf . class } ) @ Bean ( PCAP_BUILDER_BEAN_NAME ) public Pcap . Builder pcapBuilder ( @ Qualifier ( PCAP_IF_BEAN_NAME ) PcapIf pcapIf , @ Qualifier ( ERRBUF_BEAN_NAME ) StringBuilder errbuf ) { String source = pcapIf . getName ( ) ; Pcap . Builder builder = new Pcap . Builder ( ) . source ( ...
Pcap builder .
130,820
@ ConditionalOnClass ( { Pcap . class , Inet4Address . class , Context . class } ) @ Bean ( CONTEXT_BEAN_NAME ) public Context context ( @ Qualifier ( PCAP_BUILDER_BEAN_NAME ) Pcap . Builder builder , @ Qualifier ( NETMASK_BEAN_NAME ) Inet4Address netmask ) { switch ( properties . getPcapType ( ) ) { case DEAD : if ( L...
Jxnet application context .
130,821
public static Context getApplicationContext ( ) { com . ardikars . jxnet . context . Context context = com . ardikars . jxnet . context . Application . getApplicationContext ( ) ; return new ApplicationContext ( context ) ; }
Get application context .
130,822
public void load ( Callback < Void > callback , Class [ ] loadClasses ) { boolean doNotLoad = false ; for ( Class clazzes : loadClasses ) { try { Class . forName ( clazzes . getName ( ) ) ; } catch ( ClassNotFoundException e ) { callback . onFailure ( e ) ; doNotLoad = true ; } } if ( ! doNotLoad ) { doLoad ( callback ...
Load classes then perform load native library .
130,823
public static PcapIf pcapIf ( StringBuilder errbuf ) throws DeviceNotFoundException { String source = Application . source ; List < PcapIf > alldevsp = new ArrayList < PcapIf > ( ) ; if ( PcapFindAllDevs ( alldevsp , errbuf ) != OK && LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "Error: {}" + errbuf ....
Get default pcap interface .
130,824
public byte [ ] getData ( ) { if ( this . data == null ) { return new byte [ ] { } ; } if ( this . data . length == 0 ) { Family family = getSaFamily ( ) ; if ( family == Family . AF_INET6 ) { this . data = new byte [ Inet6Address . IPV6_ADDRESS_LENGTH ] ; } else { this . data = new byte [ Inet4Address . IPV4_ADDRESS_L...
Returns bytes address of SockAddr .
130,825
public SockAddr getAddr ( ) { SockAddr sockAddr = null ; if ( this . addr != null ) { sockAddr = new SockAddr ( this . addr . getSaFamily ( ) . getValue ( ) , this . addr . getData ( ) ) ; } return sockAddr ; }
Getting interface address .
130,826
public SockAddr getNetmask ( ) { SockAddr sockAddr = null ; if ( this . netmask != null ) { sockAddr = new SockAddr ( this . netmask . getSaFamily ( ) . getValue ( ) , this . netmask . getData ( ) ) ; } return sockAddr ; }
Getting interface netmask .
130,827
public SockAddr getBroadAddr ( ) { SockAddr sockAddr = null ; if ( this . broadaddr != null ) { sockAddr = new SockAddr ( this . broadaddr . getSaFamily ( ) . getValue ( ) , this . broadaddr . getData ( ) ) ; } return sockAddr ; }
Getting interface broadcast address .
130,828
public SockAddr getDstAddr ( ) { SockAddr sockAddr = null ; if ( this . dstaddr != null ) { sockAddr = new SockAddr ( this . dstaddr . getSaFamily ( ) . getValue ( ) , this . dstaddr . getData ( ) ) ; } return sockAddr ; }
Getting interface destination address .
130,829
public static PcapPktHdr newInstance ( final int caplen , final int len , final int tvSec , final long tvUsec ) { return new PcapPktHdr ( caplen , len , tvSec , tvUsec ) ; }
Create new PcapPktHdr instance .
130,830
public PcapPktHdr copy ( ) { PcapPktHdr pktHdr = new PcapPktHdr ( ) ; pktHdr . caplen = this . caplen ; pktHdr . len = this . len ; pktHdr . tv_sec = this . tv_sec ; pktHdr . tv_usec = this . tv_usec ; return pktHdr ; }
Copy this instance .
130,831
public void run ( String ... args ) { int maxIteration = 10 ; int totalMoreFast = 0 ; int totalMoreFastWithThreadPool = 0 ; int totalMoreFastPacketThreadPool = 0 ; for ( int i = 0 ; i < maxIteration ; i ++ ) { LOGGER . info ( "**********************************" ) ; long jxnetRunnerRes = jxnetRunner . run ( ) ; long jx...
Run bencmarking test .
130,832
protected Map < String , String > convertParameters ( WikiParameters params ) { Map < String , String > xwikiParams ; if ( params . getSize ( ) > 0 ) { xwikiParams = new LinkedHashMap < String , String > ( ) ; for ( WikiParameter wikiParameter : params . toList ( ) ) { xwikiParams . put ( wikiParameter . getKey ( ) , w...
Convert Wikimodel parameters to XWiki parameters format .
130,833
protected Pair < Map < String , String > , Map < String , String > > convertAndSeparateParameters ( WikiParameters params ) { Map < String , String > resourceParameters ; Map < String , String > genericParameters ; if ( params . getSize ( ) > 0 ) { resourceParameters = new LinkedHashMap < String , String > ( ) ; generi...
Convert Wikimodel parameters to XWiki parameters format separating anchor and query string parameters which we consider ResourceReference parameters from the rest which we consider generic event parameters .
130,834
public void transferStart ( QueueListener eventsToTransfer ) { while ( ! eventsToTransfer . isEmpty ( ) ) { Event event = eventsToTransfer . removeLast ( ) ; this . previousEvents . offerFirst ( event ) ; } }
Transfer all passed events by removing the from the passed parameter and moving them to the beginning of the event stack .
130,835
public WikiFormat addStyle ( WikiStyle style ) { if ( fStyles . contains ( style ) ) { return this ; } WikiFormat clone = getClone ( ) ; clone . fStyles . add ( style ) ; return clone ; }
Creates a new style set and adds the given style to it .
130,836
public WikiFormat removeStyle ( WikiStyle style ) { if ( ! fStyles . contains ( style ) ) { return this ; } WikiFormat clone = getClone ( ) ; clone . fStyles . remove ( style ) ; return clone ; }
Creates a new style set which does not contain the specified style .
130,837
public static String escapeXmlString ( String str , boolean escapeQuots ) { if ( str == null ) { return "" ; } StringBuffer buf = new StringBuffer ( ) ; char [ ] array = str . toCharArray ( ) ; for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] == '>' || array [ i ] == '&' || array [ i ] == '<' || ( escap...
Returns the escaped string .
130,838
private XDOM createXDOM ( String content , MacroTransformationContext macroContext , boolean transform , MetaData metadata , boolean inline , Syntax syntax ) throws MacroExecutionException { try { XDOM result = getSyntaxParser ( syntax ) . parse ( new StringReader ( content ) ) ; if ( metadata != null ) { result . getM...
creates XDOM .
130,839
private void performTransformation ( MutableRenderingContext renderingContext , Transformation transformation , TransformationContext context , Block block ) throws MacroExecutionException { try { renderingContext . transformInContext ( transformation , context , block ) ; } catch ( Exception e ) { throw new MacroExecu...
Calls transformInContext on renderingContext .
130,840
private Parser getSyntaxParser ( Syntax syntax ) throws MacroExecutionException { try { return this . componentManager . getInstance ( Parser . class , syntax . toIdString ( ) ) ; } catch ( ComponentLookupException e ) { throw new MacroExecutionException ( "Failed to find source parser for syntax [" + syntax + "]" , e ...
Get the parser for the current syntax .
130,841
protected String computeLabel ( ResourceReference reference ) { String label ; try { URILabelGenerator uriLabelGenerator = this . componentManager . getInstance ( URILabelGenerator . class , reference . getType ( ) . getScheme ( ) ) ; label = uriLabelGenerator . generateLabel ( reference ) ; } catch ( ComponentLookupEx...
Default implementation for computing a link label when no label has been specified . Can be overwritten by implementations to provide a different algorithm .
130,842
private void handleTargetAttribute ( Map < String , String > anchorAttributes ) { String target = anchorAttributes . get ( "target" ) ; if ( StringUtils . isNotBlank ( target ) && ! "_self" . equals ( target ) && ! "_parent" . equals ( target ) && ! "_top" . equals ( target ) ) { List < String > relAttributes = new Arr...
When a link is open in an other window or in an other frame the loaded page has some restricted access to the parent window . Among other things it has the ability to redirect it to an other page which can lead to dangerous phishing attacks .
130,843
private String addAttributeValue ( String currentValue , String valueToAdd ) { String newValue ; if ( currentValue == null || currentValue . length ( ) == 0 ) { newValue = "" ; } else { newValue = currentValue + " " ; } return newValue + valueToAdd ; }
Add an attribute value to an existing attribute . This is useful for example for adding a value to an HTML CLASS attribute .
130,844
public long indexOf ( Block child ) { CounterBlockMatcher counter = new CounterBlockMatcher ( child ) ; Block found = getFirstBlock ( counter , Axes . ANCESTOR_OR_SELF ) ; return found != null ? counter . getCount ( ) : - 1 ; }
Find the index of the block in the tree .
130,845
public final static String clearName ( String name ) { boolean stripDots = false ; boolean ascii = true ; return clearName ( name , stripDots , ascii ) ; }
Clears the name of files ; used while uploading attachments within XWiki
130,846
public static int getHtmlCodeByHtmlEntity ( String htmlEntity ) { Entity entity = fHtmlToWiki . get ( htmlEntity ) ; return entity != null ? entity . fHtmlCode : 0 ; }
Returns an HTML code corresponding to the specified HTML entity .
130,847
public static int getHtmlCodeByWikiSymbol ( String wikiEntity ) { Entity entity = fWikiToHtml . get ( wikiEntity ) ; return entity != null ? entity . fHtmlCode : 0 ; }
Returns an HTML code corresponding to the specified wiki entity .
130,848
public static boolean matchesSequence ( char [ ] array , int arrayPos , char [ ] sequence ) { int i ; int j ; for ( i = arrayPos , j = 0 ; i < array . length && j < sequence . length ; i ++ , j ++ ) { if ( array [ i ] != sequence [ j ] ) { break ; } } return j == sequence . length ; }
Indicate if the specified sequence starts from the given position in the character array .
130,849
private static int removeSpaces ( char [ ] array , int pos , StringBuffer buf ) { buf . delete ( 0 , buf . length ( ) ) ; for ( ; pos < array . length && ( array [ pos ] == '=' || Character . isSpaceChar ( array [ pos ] ) ) ; pos ++ ) { if ( array [ pos ] == '=' ) { buf . append ( array [ pos ] ) ; } } return pos ; }
Moves forward the current position in the array until the first not empty character is found .
130,850
public static int skipSequence ( char [ ] array , int arrayPos , char [ ] sequence ) { int i ; int j ; for ( i = arrayPos , j = 0 ; i < array . length && j < sequence . length ; i ++ , j ++ ) { if ( array [ i ] != sequence [ j ] ) { break ; } } return j == sequence . length ? i : arrayPos ; }
Skips the specified sequence if it starts from the given position in the character array .
130,851
public static int splitToPairs ( String str , List < WikiParameter > list , String delimiter , String end , char escapeChar ) { if ( str == null ) { return 0 ; } char [ ] array = str . toCharArray ( ) ; if ( delimiter == null ) { delimiter = " " ; } char [ ] delimiterArray = delimiter . toCharArray ( ) ; char [ ] endAr...
Splits the given string into a set of key - value pairs ; all extracted values will be added to the given list
130,852
public static String unescape ( String str , char escape ) { if ( str == null ) { return "" ; } StringBuffer buf = new StringBuffer ( ) ; char [ ] array = str . toCharArray ( ) ; boolean escaped = false ; for ( int i = 0 ; i < array . length ; i ++ ) { char ch = array [ i ] ; if ( escaped ) { buf . append ( ch ) ; esca...
Unescapes the given string and returns the result .
130,853
protected void processLinkQueue ( ) { long timeout = this . configuration . getCheckTimeout ( ) ; List < Pattern > excludedReferencePatterns = this . configuration . getExcludedReferencePatterns ( ) ; LinkQueueItem queueItem = null ; boolean shouldBeChecked = false ; while ( ! this . linkQueue . isEmpty ( ) && ! should...
Read the queue and find links to process removing links that have already been checked out recently .
130,854
private Block generateTree ( List < HeaderBlock > headers , int start , int depth , boolean numbered , String documentReference ) { Block tocBlock = null ; int currentLevel = start - 1 ; Block currentBlock = null ; for ( HeaderBlock headerBlock : headers ) { int headerLevel = headerBlock . getLevel ( ) . getAsInt ( ) ;...
Convert headers into list block tree .
130,855
private ListItemBlock createTocEntry ( HeaderBlock headerBlock , String documentReference ) { DocumentResourceReference reference = new DocumentResourceReference ( documentReference ) ; reference . setAnchor ( headerBlock . getId ( ) ) ; LinkBlock linkBlock = new LinkBlock ( this . tocBlockFilter . generateLabel ( head...
Create a new toc list item based on section title .
130,856
private ListBLock createChildListBlock ( boolean numbered , Block parentBlock ) { ListBLock childListBlock = numbered ? new NumberedListBlock ( Collections . emptyList ( ) ) : new BulletedListBlock ( Collections . emptyList ( ) ) ; if ( parentBlock != null ) { parentBlock . addChild ( childListBlock ) ; } return childL...
Create a new ListBlock and add it in the provided parent block .
130,857
private void appendInlineEvent ( Event event ) throws SAXException { cleanContentLeadingSpaces ( ) ; cleanContentExtraWhiteSpaces ( ) ; if ( getContent ( ) . length ( ) > 0 ) { sendPreviousContent ( false ) ; fPreviousInlineText . append ( getContent ( ) ) ; if ( getContent ( ) . charAt ( getContent ( ) . length ( ) - ...
Append an inline element . Inline elements ending with a space are stacked waiting for a non space character or the end of the inline content .
130,858
protected void startNonVisibleElement ( ) throws SAXException { if ( shouldRemoveWhiteSpaces ( ) ) { cleanContentLeadingSpaces ( ) ; cleanContentExtraWhiteSpaces ( ) ; if ( getContent ( ) . length ( ) > 0 ) { sendPreviousContent ( false ) ; fPreviousInlineText . append ( getContent ( ) ) ; if ( getContent ( ) . charAt ...
Append an non visible element .
130,859
protected void trimLeadingWhiteSpaces ( ) { if ( shouldRemoveWhiteSpaces ( ) && getContent ( ) . length ( ) > 0 ) { String result = trimLeadingWhiteSpaces ( getContent ( ) ) ; getContent ( ) . setLength ( 0 ) ; getContent ( ) . append ( result ) ; } }
when in CDATA or PRE elements ) .
130,860
private String cleanHTML ( String content , MacroTransformationContext context ) throws MacroExecutionException { String cleanedContent = content ; HTMLCleanerConfiguration cleanerConfiguration = getCleanerConfiguration ( context ) ; Document document = this . htmlCleaner . clean ( new StringReader ( cleanedContent ) ,...
Clean the HTML entered by the user transforming it into valid XHTML .
130,861
private String renderWikiSyntax ( String content , Transformation transformation , MacroTransformationContext context ) throws MacroExecutionException { String xhtml ; try { XDOM xdom = this . contentParser . parse ( content , context , false , false ) ; List < MacroBlock > macros = xdom . getBlocks ( MACROBLOCKMATCHER...
Parse the passed context using a wiki syntax parser and render the result as an XHTML string .
130,862
protected WikiParameters getParameters ( String [ ] chunks ) { return WikiParameters . newWikiParameters ( chunks . length > 2 ? chunks [ 2 ] . trim ( ) : null ) ; }
Extracts parameters part of the original reference and returns it as a WikiParameters .
130,863
protected String [ ] splitToChunks ( String str ) { String delimiter = "[|>]" ; String [ ] chunks = str . split ( delimiter ) ; return chunks ; }
Returns the given string split to individual segments
130,864
private void addFootnoteRef ( MacroMarkerBlock footnoteMacro , Block footnoteRef ) { footnoteMacro . getChildren ( ) . clear ( ) ; footnoteMacro . addChild ( footnoteRef ) ; }
Add a footnote to the list of document footnotes . If such a list doesn t exist yet create it and append it to the end of the document .
130,865
private ListItemBlock createFootnoteBlock ( String content , int counter , MacroTransformationContext context ) throws MacroExecutionException { List < Block > parsedContent ; try { parsedContent = this . contentParser . parse ( content , context , false , true ) . getChildren ( ) ; } catch ( MacroExecutionException e ...
Generate the footnote block a numbered list item containing a backlink to the footnote s reference and the actual footnote text parsed into XDOM .
130,866
public WikiParameter [ ] getParameters ( String key ) { Map < String , WikiParameter [ ] > map = getParameters ( ) ; WikiParameter [ ] list = map . get ( key ) ; return list ; }
Returns all parameters with this key
130,867
public List < WikiParameter > toList ( ) { List < WikiParameter > result = new ArrayList < WikiParameter > ( fList ) ; return result ; }
Returns a new list containing all parameters defined in this object .
130,868
private void beginInternalLink ( ResourceReference reference , boolean freestanding , Map < String , String > parameters ) { Map < String , String > spanAttributes = new LinkedHashMap < String , String > ( ) ; Map < String , String > anchorAttributes = new LinkedHashMap < String , String > ( ) ; anchorAttributes . putA...
Start of an internal link .
130,869
public void normalize ( Set < String > testNames , Map < String , Pair < Set < Test > , Set < Test > > > tests ) { for ( Pair < Set < Test > , Set < Test > > inOutTests : tests . values ( ) ) { addNotApplicableTests ( testNames , inOutTests . getLeft ( ) ) ; addNotApplicableTests ( testNames , inOutTests . getRight ( )...
Add not applicable tests for all syntaxes .
130,870
private static SyntaxType register ( String id , String name ) { SyntaxType syntaxType = new SyntaxType ( id , name ) ; KNOWN_SYNTAX_TYPES . put ( id , syntaxType ) ; return syntaxType ; }
Register a Syntax Type .
130,871
public void onMacro ( String name , WikiParameters params , String content ) { checkBlockContainer ( ) ; fMacroName = name ; fMacroParameters = params ; fMacroContent = content ; }
Waiting for following events to know if the macro is inline or not .
130,872
public void onVerbatim ( String str , WikiParameters params ) { checkBlockContainer ( ) ; fVerbatimContent = str ; fVerbatimParameters = params ; }
Waiting for following events to know if the verbatim is inline or not .
130,873
protected Parser getSyntaxParser ( Syntax syntax ) throws MacroExecutionException { if ( this . componentManager . hasComponent ( Parser . class , syntax . toIdString ( ) ) ) { try { return this . componentManager . getInstance ( Parser . class , syntax . toIdString ( ) ) ; } catch ( ComponentLookupException e ) { thro...
Get the parser for the passed Syntax .
130,874
private void parseReference ( char [ ] array , int i , StringBuffer reference , StringBuffer parameters ) { int nb ; for ( boolean escaped = false ; i < array . length ; ++ i ) { char c = array [ i ] ; if ( ! escaped ) { if ( array [ i ] == '~' && ! escaped ) { escaped = true ; } else if ( ( nb = countFirstChar ( array...
Extract the link and the parameters .
130,875
public void printXMLComment ( String content , boolean escape ) { try { this . xmlWriter . write ( new DefaultComment ( escape ? XMLUtils . escapeXMLComment ( content ) : content ) ) ; } catch ( IOException e ) { } }
Print a XML comment .
130,876
public Event getEvent ( int depth ) { Event event = null ; if ( depth > 0 && size ( ) > depth - 1 ) { event = get ( depth - 1 ) ; } return event ; }
Returns the event at the specified position in this queue .
130,877
private Listener popListener ( ) { Listener listener = this . listenerStack . pop ( ) ; if ( ! this . listenerStack . isEmpty ( ) ) { setWrappedListener ( this . listenerStack . peek ( ) ) ; } return listener ; }
Removes the last listener from the stack .
130,878
public static char getChar ( String symbol ) { CharInfo info = ( CharInfo ) fSymbolMap . get ( symbol ) ; return ( info != null ) ? ( char ) info . fCode : '\0' ; }
A character corresponding to the given symbol .
130,879
public static String getDescription ( char ch ) { CharInfo info = ( CharInfo ) fCodeMap . get ( Integer . valueOf ( ch ) ) ; return ( info != null ) ? info . fDescription : null ; }
Returns description of the given character
130,880
public static String getDescription ( String symbol ) { CharInfo info = ( CharInfo ) fSymbolMap . get ( symbol ) ; return ( info != null ) ? info . fDescription : null ; }
Returns description of the given symbol .
130,881
public void generateError ( MacroBlock macroToReplace , String message , Throwable throwable ) { List < Block > errorBlocks = this . errorBlockGenerator . generateErrorBlocks ( message , throwable , macroToReplace . isInline ( ) ) ; macroToReplace . getParent ( ) . replaceChild ( wrapInMacroMarker ( macroToReplace , er...
Generates Blocks to signify that the passed Macro Block has failed to execute .
130,882
private void mergeTree ( Block targetTree , Block sourceTree ) { for ( Block block : sourceTree . getChildren ( ) ) { int pos = indexOf ( targetTree . getChildren ( ) , block ) ; if ( pos > - 1 ) { Block foundBlock = targetTree . getChildren ( ) . get ( pos ) ; mergeTree ( foundBlock , block ) ; } else { targetTree . a...
Merged two XDOM trees .
130,883
private int indexOf ( List < Block > targetBlocks , Block block ) { int pos = 0 ; for ( Block targetBlock : targetBlocks ) { if ( blockEquals ( targetBlock , block ) ) { return pos ; } pos ++ ; } return - 1 ; }
Shallow indexOf implementation that only compares nodes based on their data and not their children data .
130,884
private void parseTree ( List < Block > sourceBlocks ) { Block matchStartBlock = null ; int count = 0 ; Block mappingCursor = this . mappingTree . getChildren ( ) . get ( 0 ) ; Block sourceBlock = sourceBlocks . get ( 0 ) ; while ( sourceBlock != null ) { while ( mappingCursor != null ) { if ( blockEquals ( sourceBlock...
Parse a list of blocks and replace suite of Blocks matching the icon mapping definitions by image blocks .
130,885
private static BufferedImage createThumb ( BufferedImage image , int thumbWidth , int thumbHeight ) { int imageWidth = image . getWidth ( null ) ; int imageHeight = image . getHeight ( null ) ; int [ ] size = getNewSize ( imageWidth , imageHeight , thumbWidth , thumbHeight ) ; if ( size [ 0 ] == imageWidth && size [ 1 ...
Creates a smaller version of an image or returns the original image if it was in the specified boundaries . The returned image keeps the ratio of the original image .
130,886
public static int [ ] getImageSize ( InputStream input , int maxWidth , int maxHeight ) throws IOException { int [ ] size = getImageSize ( input ) ; return getNewSize ( size [ 0 ] , size [ 1 ] , maxWidth , maxHeight ) ; }
Returns the possible size of an image from the given input stream ; the returned size does not overcome the specified maximal borders but keeps the ratio of the image . This method closes the given stream .
130,887
public static int [ ] getNewSize ( int width , int height , int maxWidth , int maxHeight ) { if ( width <= maxWidth && height <= maxHeight ) { return new int [ ] { width , height } ; } double thumbRatio = ( double ) maxWidth / ( double ) maxHeight ; double imageRatio = ( double ) width / ( double ) height ; if ( thumbR...
Calculates new size of an image with the specified max borders keeping the ratio between height and width of the image .
130,888
public void addBlock ( Block block ) { try { this . stack . getFirst ( ) . add ( block ) ; } catch ( NoSuchElementException e ) { throw new IllegalStateException ( "All container blocks are closed, too many calls to endBlockList()." ) ; } }
Add a block to the current block container .
130,889
private int readChar ( Reader source ) throws ParseException { int c ; try { c = source . read ( ) ; } catch ( IOException e ) { throw new ParseException ( "Failed to read input source" , e ) ; } return c ; }
Read a single char from an Reader source .
130,890
private ResourceReference parseDocumentLink ( StringBuilder content ) { String queryString = null ; String text = parseElementAfterString ( content , SEPARATOR_QUERYSTRING ) ; if ( text != null ) { queryString = removeEscapesFromExtraParts ( text ) ; } String anchor = null ; text = parseElementAfterString ( content , S...
Construct a Document Link reference out of the passed content .
130,891
private ResourceReference parseURILinks ( String rawLink ) { ResourceReference result = null ; int uriSchemeDelimiterPos = rawLink . indexOf ( ':' ) ; if ( uriSchemeDelimiterPos > - 1 ) { String scheme = rawLink . substring ( 0 , uriSchemeDelimiterPos ) ; String reference = rawLink . substring ( uriSchemeDelimiterPos +...
Check if the passed link references is an URI link reference .
130,892
private ResourceReference parseInterWikiLinks ( StringBuilder content ) { ResourceReference result = null ; String interWikiAlias = parseElementAfterString ( content , SEPARATOR_INTERWIKI ) ; if ( interWikiAlias != null ) { InterWikiResourceReference link = new InterWikiResourceReference ( removeEscapes ( content . toS...
Check if the passed link references is an interwiki link reference .
130,893
protected String parseElementAfterString ( StringBuilder content , String separator ) { String element = null ; int index = content . lastIndexOf ( separator ) ; while ( index != - 1 ) { if ( ! shouldEscape ( content , index ) ) { element = content . substring ( index + separator . length ( ) ) . trim ( ) ; content . d...
Find out the element located to the right of the passed separator .
130,894
private boolean shouldEscape ( StringBuilder content , int charPosition ) { int counter = 0 ; int pos = charPosition - 1 ; while ( pos > - 1 && content . charAt ( pos ) == ESCAPE_CHAR ) { counter ++ ; pos -- ; } return counter % 2 != 0 ; }
Count the number of escape chars before a given character and if that number is odd then that character should be escaped .
130,895
public void comment ( char [ ] array , int start , int length ) throws SAXException { fStack . onComment ( array , start , length ) ; }
Lexical handler methods
130,896
public void popListener ( Class < ? extends ChainingListener > listenerClass ) { if ( StackableChainingListener . class . isAssignableFrom ( listenerClass ) ) { this . listeners . get ( listenerClass ) . pop ( ) ; } }
Remove the last instance corresponding to the passed listener class if it s stackable in order to go back to the previous state .
130,897
public Service setSupportedServiceProfiles ( Iterable < ServiceProfile > profiles ) { if ( profiles == null ) { this . supportedServiceProfiles = null ; return this ; } Set < ServiceProfile > set = new TreeSet < ServiceProfile > ( ) ; for ( ServiceProfile profile : profiles ) { if ( profile != null ) { set . add ( prof...
Set the supported service profiles .
130,898
public boolean supports ( ServiceProfile profile ) { if ( profile == null ) { return false ; } if ( supportedServiceProfiles == null ) { return false ; } for ( ServiceProfile supportedProfile : supportedServiceProfiles ) { if ( supportedProfile == profile ) { return true ; } } return false ; }
Check if this service supports the specified profile .
130,899
public boolean supportsAll ( ServiceProfile ... profiles ) { if ( profiles == null ) { return true ; } for ( ServiceProfile profile : profiles ) { if ( supports ( profile ) == false ) { return false ; } } return true ; }
Check if this service supports all the specified service profiles .