idx
int64 0
34.9k
| question
stringlengths 12
26.4k
| target
stringlengths 15
2.3k
|
---|---|---|
34,800 | protected void drawItemLabel ( Graphics2D g2 , PlotOrientation orientation , CategoryDataset dataset , int row , int column , double x , double y , boolean negative ) { CategoryItemLabelGenerator generator = getItemLabelGenerator ( row , column ) ; if ( generator != null ) { Font labelFont = getItemLabelFont ( row , column ) ; Paint paint = getItemLabelPaint ( row , column ) ; g2 . setFont ( labelFont ) ; g2 . setPaint ( paint ) ; String label = generator . generateLabel ( dataset , row , column ) ; ItemLabelPosition position ; if ( ! negative ) { position = getPositiveItemLabelPosition ( row , column ) ; } else { position = getNegativeItemLabelPosition ( row , column ) ; } Point2D anchorPoint = calculateLabelAnchorPoint ( position . getItemLabelAnchor ( ) , x , y , orientation ) ; TextUtilities . drawRotatedString ( label , g2 , ( float ) anchorPoint . getX ( ) , ( float ) anchorPoint . getY ( ) , position . getTextAnchor ( ) , position . getAngle ( ) , position . getRotationAnchor ( ) ) ; } } | Draws an item label. |
34,801 | private void register ( String key , Object value ) throws SAXException { if ( key != null ) { if ( _mapping . get ( key ) != null || ( _handler != null && _handler . hasVariable ( key ) ) ) { throw new SAXException ( "ID " + key + " is already defined" ) ; } if ( _handler != null ) { _handler . setVariable ( key , value ) ; } else { _mapping . put ( key , value ) ; } } } | Registers an object by name. This will throw an exception if an object has already been registered under the given name. |
34,802 | protected BusinessObjectDataDdlCollectionResponse generateBusinessObjectDataDdlCollectionImpl ( BusinessObjectDataDdlCollectionRequest businessObjectDataDdlCollectionRequest ) { validateBusinessObjectDataDdlCollectionRequest ( businessObjectDataDdlCollectionRequest ) ; BusinessObjectDataDdlCollectionResponse businessObjectDataDdlCollectionResponse = new BusinessObjectDataDdlCollectionResponse ( ) ; List < BusinessObjectDataDdl > businessObjectDataDdlResponses = new ArrayList < > ( ) ; businessObjectDataDdlCollectionResponse . setBusinessObjectDataDdlResponses ( businessObjectDataDdlResponses ) ; List < String > ddls = new ArrayList < > ( ) ; for ( BusinessObjectDataDdlRequest request : businessObjectDataDdlCollectionRequest . getBusinessObjectDataDdlRequests ( ) ) { BusinessObjectDataDdl businessObjectDataDdl = generateBusinessObjectDataDdlImpl ( request , true ) ; businessObjectDataDdlResponses . add ( businessObjectDataDdl ) ; ddls . add ( businessObjectDataDdl . getDdl ( ) ) ; } businessObjectDataDdlCollectionResponse . setDdlCollection ( StringUtils . join ( ddls , "\n\n" ) ) ; return businessObjectDataDdlCollectionResponse ; } | Retrieves the DDL to initialize the specified type of the database system to perform queries for a collection of business object data in the specified storages. |
34,803 | public void test_checksum03 ( ) { byte [ ] data = new byte [ 100 ] ; r . nextBytes ( data ) ; ByteBuffer buf = ByteBuffer . wrap ( data ) ; buf . limit ( 20 ) ; buf . position ( 9 ) ; buf . mark ( ) ; buf . position ( 12 ) ; chk . checksum ( buf , 0 , data . length ) ; assertEquals ( 20 , buf . limit ( ) ) ; assertEquals ( 12 , buf . position ( ) ) ; buf . reset ( ) ; assertEquals ( 9 , buf . position ( ) ) ; } | Test verifies that the mark, position and limit are unchanged by the checksum operation. |
34,804 | public boolean isNamespaceRepairingMode ( ) { return namespaceRepairingMode ; } | Is StAX namespace repairing mode on or off? |
34,805 | public void addSipEventListener ( SipEventListener listener ) { mListeners . add ( listener ) ; } | Add a SIP event listener |
34,806 | private static String escapeJSON ( String text ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( '"' ) ; for ( int index = 0 ; index < text . length ( ) ; index ++ ) { char chr = text . charAt ( index ) ; switch ( chr ) { case '"' : case '\\' : builder . append ( '\\' ) ; builder . append ( chr ) ; break ; case '\b' : builder . append ( "\\b" ) ; break ; case '\t' : builder . append ( "\\t" ) ; break ; case '\n' : builder . append ( "\\n" ) ; break ; case '\r' : builder . append ( "\\r" ) ; break ; default : if ( chr < ' ' ) { String t = "000" + Integer . toHexString ( chr ) ; builder . append ( "\\u" + t . substring ( t . length ( ) - 4 ) ) ; } else { builder . append ( chr ) ; } break ; } } builder . append ( '"' ) ; return builder . toString ( ) ; } | Escape a string to create a valid JSON string |
34,807 | public PMElement elementAt ( int i ) { return gr . elementAt ( i ) ; } | Returns element at specific index. |
34,808 | public static List < BlockNode > collectBlocksDominatedBy ( BlockNode dominator , BlockNode start ) { List < BlockNode > result = new ArrayList < BlockNode > ( ) ; collectWhileDominates ( dominator , start , result ) ; return result ; } | Collect all block dominated by 'dominator', starting from 'start' |
34,809 | public static DbfTableModel createDefaultModel ( EsriGraphicList list ) { if ( logger . isLoggable ( Level . FINE ) ) logger . fine ( "ESE: creating DbfTableModel" ) ; DbfTableModel _model = new DbfTableModel ( 7 ) ; _model . setLength ( 0 , ( byte ) 50 ) ; _model . setColumnName ( 0 , SHAPE_DBF_DESCRIPTION ) ; _model . setType ( 0 , ( byte ) DbfTableModel . TYPE_CHARACTER ) ; _model . setDecimalCount ( 0 , ( byte ) 0 ) ; _model . setLength ( 1 , ( byte ) 10 ) ; _model . setColumnName ( 1 , SHAPE_DBF_LINECOLOR ) ; _model . setType ( 1 , ( byte ) DbfTableModel . TYPE_CHARACTER ) ; _model . setDecimalCount ( 1 , ( byte ) 0 ) ; _model . setLength ( 2 , ( byte ) 10 ) ; _model . setColumnName ( 2 , SHAPE_DBF_FILLCOLOR ) ; _model . setType ( 2 , ( byte ) DbfTableModel . TYPE_CHARACTER ) ; _model . setDecimalCount ( 2 , ( byte ) 0 ) ; _model . setLength ( 3 , ( byte ) 10 ) ; _model . setColumnName ( 3 , SHAPE_DBF_SELECTCOLOR ) ; _model . setType ( 3 , ( byte ) DbfTableModel . TYPE_CHARACTER ) ; _model . setDecimalCount ( 3 , ( byte ) 0 ) ; _model . setLength ( 4 , ( byte ) 4 ) ; _model . setColumnName ( 4 , SHAPE_DBF_LINEWIDTH ) ; _model . setType ( 4 , ( byte ) DbfTableModel . TYPE_NUMERIC ) ; _model . setDecimalCount ( 4 , ( byte ) 0 ) ; _model . setLength ( 5 , ( byte ) 20 ) ; _model . setColumnName ( 5 , SHAPE_DBF_DASHPATTERN ) ; _model . setType ( 5 , ( byte ) DbfTableModel . TYPE_CHARACTER ) ; _model . setDecimalCount ( 5 , ( byte ) 0 ) ; _model . setLength ( 6 , ( byte ) 10 ) ; _model . setColumnName ( 6 , SHAPE_DBF_DASHPHASE ) ; _model . setType ( 6 , ( byte ) DbfTableModel . TYPE_NUMERIC ) ; _model . setDecimalCount ( 6 , ( byte ) 4 ) ; int count = 0 ; for ( OMGraphic omg : list ) { Object index = omg . getAttribute ( SHAPE_INDEX_ATTRIBUTE ) ; if ( index == null ) { index = new Integer ( count ) ; omg . putAttribute ( SHAPE_INDEX_ATTRIBUTE , index ) ; } count ++ ; List < Object > record = new ArrayList < Object > ( ) ; Object obj = omg . getAttribute ( SHAPE_DBF_DESCRIPTION ) ; if ( obj instanceof String ) { record . add ( obj ) ; } else { record . add ( "" ) ; } record . add ( ColorFactory . getHexColorString ( omg . getLineColor ( ) ) ) ; record . add ( ColorFactory . getHexColorString ( omg . getFillColor ( ) ) ) ; record . add ( ColorFactory . getHexColorString ( omg . getSelectColor ( ) ) ) ; BasicStroke bs = ( BasicStroke ) omg . getStroke ( ) ; record . add ( new Double ( bs . getLineWidth ( ) ) ) ; String dp = BasicStrokeEditor . dashArrayToString ( bs . getDashArray ( ) ) ; if ( dp == BasicStrokeEditor . NONE ) { dp = "" ; } record . add ( dp ) ; record . add ( new Double ( bs . getDashPhase ( ) ) ) ; _model . addRecord ( record ) ; if ( logger . isLoggable ( Level . FINER ) ) logger . finer ( "ESE: adding record: " + record ) ; } return _model ; } | Prepares and returns a 7 column DbfTableModel to accept input for columns of TYPE_CHARACTER. <br> <br> The default model used holds most of the DrawingAttributes of the OMGraphics. |
34,810 | void resize ( int newCapacity ) { Entry [ ] oldTable = table ; int oldCapacity = oldTable . length ; if ( oldCapacity == MAXIMUM_CAPACITY ) { threshold = Integer . MAX_VALUE ; return ; } Entry [ ] newTable = new Entry [ newCapacity ] ; transfer ( newTable ) ; table = newTable ; threshold = ( int ) ( newCapacity * loadFactor ) ; } | Rehashes the contents of this map into a new array with a larger capacity. This method is called automatically when the number of keys in this map reaches its threshold. If current capacity is MAXIMUM_CAPACITY, this method does not resize the map, but sets threshold to Integer.MAX_VALUE. This has the effect of preventing future calls. |
34,811 | public void testHasAttribute1 ( ) throws Throwable { Document doc ; NodeList elementList ; Element testNode ; boolean state ; doc = ( Document ) load ( "staff" , builder ) ; elementList = doc . getElementsByTagName ( "address" ) ; testNode = ( Element ) elementList . item ( 4 ) ; state = testNode . hasAttribute ( "domestic" ) ; assertFalse ( "throw_False" , state ) ; } | Runs the test case. |
34,812 | LocoNetMessage createPacket ( String s ) { byte b [ ] = StringUtil . bytesFromHexString ( s ) ; if ( b . length == 0 ) { return null ; } LocoNetMessage m = new LocoNetMessage ( b . length ) ; for ( int i = 0 ; i < b . length ; i ++ ) { m . setElement ( i , b [ i ] ) ; } return m ; } | Create a well-formed LocoNet packet from a String |
34,813 | public void removeQualifiers ( ) { PropertyOptions opts = getOptions ( ) ; opts . setHasQualifiers ( false ) ; opts . setHasLanguage ( false ) ; opts . setHasType ( false ) ; qualifier = null ; } | Removes all qualifiers from the node and sets the options appropriate. |
34,814 | public static boolean moveFile ( Context context , @ NonNull final File source , @ NonNull final File targetDir ) { File target = new File ( targetDir , source . getName ( ) ) ; boolean success = source . renameTo ( target ) ; if ( ! success ) { success = copyFile ( context , source , targetDir ) ; if ( success ) { success = deleteFile ( context , source ) ; } } return success ; } | Move a file. The target file may even be on external SD card. |
34,815 | public String toXMLString ( ) throws FSMsgException { return toXMLString ( true , true ) ; } | This method translates the request to an XML document String based on the Request schema described above. NOTE: this is a complete AuthnRequest xml string with RequestID, MajorVersion, etc. |
34,816 | public void create ( SSOToken token , String objName , Map attrs ) throws SMSException , SSOException { if ( objName == null || objName . length ( ) == 0 || attrs == null ) { throw new IllegalArgumentException ( "SMSFlatFileObject.create: " + "One or more arguments is null or empty" ) ; } String objKey = objName . toLowerCase ( ) ; String filepath = null ; mRWLock . readRequest ( ) ; try { filepath = mNameMap . getProperty ( objKey ) ; if ( filepath != null ) { String errmsg = "SMSFlatFileObject.create: object " + objName + " already exists in " + filepath ; mDebug . error ( errmsg ) ; throw new ServiceAlreadyExistsException ( errmsg ) ; } } finally { mRWLock . readDone ( ) ; } mRWLock . writeRequest ( ) ; try { filepath = mNameMap . getProperty ( objKey ) ; if ( filepath != null ) { String errmsg = "SMSFlatFileObject.create: object " + objName + " already exists in " + filepath ; mDebug . error ( errmsg ) ; throw new ServiceAlreadyExistsException ( errmsg ) ; } filepath = getAttrFile ( objName ) ; File filehandle = new File ( filepath ) ; File parentDir = filehandle . getParentFile ( ) ; if ( parentDir . isDirectory ( ) ) { String errmsg = "SMSFlatFileObject.create: object " + objName + " directory " + parentDir . getPath ( ) + " exists before create!" ; mDebug . error ( errmsg ) ; throw new ServiceAlreadyExistsException ( errmsg ) ; } Set sunserviceids = null ; Set sunxmlkeyvals = null ; Properties props = new Properties ( ) ; Set keys = attrs . keySet ( ) ; if ( keys != null ) { for ( Iterator i = keys . iterator ( ) ; i . hasNext ( ) ; ) { String key = ( String ) i . next ( ) ; Set vals = ( Set ) attrs . get ( key ) ; if ( key . equalsIgnoreCase ( SMSEntry . ATTR_SERVICE_ID ) ) { sunserviceids = vals ; } else if ( key . equalsIgnoreCase ( SMSEntry . ATTR_XML_KEYVAL ) ) { sunxmlkeyvals = vals ; } props . put ( key , toValString ( vals ) ) ; } } try { if ( ! parentDir . mkdirs ( ) ) { String errmsg = "SMSFlatFileObject.create: object " + objName + ": Could not create directory " + parentDir . getPath ( ) ; mDebug . error ( errmsg ) ; throw new SMSException ( errmsg ) ; } try { if ( ! filehandle . createNewFile ( ) ) { String errmsg = "SMSFlatFileObject.create: object " + objName + ": Could not create file " + filepath ; mDebug . error ( errmsg ) ; throw new SMSException ( errmsg ) ; } } catch ( IOException e ) { String errmsg = "SMSFlatFileObject.create: object " + objName + " IOException encountered when creating file " + filehandle . getPath ( ) + ". Exception: " + e . getMessage ( ) ; mDebug . error ( "SMSFlatFileObject.create" , e ) ; throw new SMSException ( errmsg ) ; } saveProperties ( props , filehandle , objName ) ; if ( sunserviceids != null && ! sunserviceids . isEmpty ( ) ) { createSunServiceIdFiles ( parentDir , sunserviceids ) ; } if ( sunxmlkeyvals != null && ! sunxmlkeyvals . isEmpty ( ) ) { createSunXmlKeyValFiles ( parentDir , sunxmlkeyvals ) ; } mNameMap . setProperty ( objKey , filepath ) ; saveProperties ( mNameMap , mNameMapHandle , null ) ; } catch ( SMSException e ) { deleteDir ( parentDir ) ; mNameMap . remove ( objKey ) ; throw e ; } } finally { mRWLock . writeDone ( ) ; } } | Creates the configuration object. Creates the directory for the object and the attributes properties file with the given attributes. |
34,817 | public static int determineConsecutiveDigitCount ( CharSequence msg , int startpos ) { int count = 0 ; int len = msg . length ( ) ; int idx = startpos ; if ( idx < len ) { char ch = msg . charAt ( idx ) ; while ( isDigit ( ch ) && idx < len ) { count ++ ; idx ++ ; if ( idx < len ) { ch = msg . charAt ( idx ) ; } } } return count ; } | Determines the number of consecutive characters that are encodable using numeric compaction. |
34,818 | private List < Entry > reduceWithDouglasPeuker ( List < Entry > entries , double epsilon ) { if ( epsilon <= 0 || entries . size ( ) < 3 ) { return entries ; } keep [ 0 ] = true ; keep [ entries . size ( ) - 1 ] = true ; algorithmDouglasPeucker ( entries , epsilon , 0 , entries . size ( ) - 1 ) ; List < Entry > reducedEntries = new ArrayList < Entry > ( ) ; for ( int i = 0 ; i < entries . size ( ) ; i ++ ) { if ( keep [ i ] ) { Entry curEntry = entries . get ( i ) ; reducedEntries . add ( new Entry ( curEntry . getVal ( ) , curEntry . getXIndex ( ) ) ) ; } } return reducedEntries ; } | uses the douglas peuker algorithm to reduce the given List of entries |
34,819 | private boolean isProjectUsingDefaultSdk ( T projectSdk ) { if ( ! isDefaultSdk ( projectSdk ) ) { return false ; } try { IClasspathEntry entry = ClasspathUtilities . findClasspathEntryContainer ( javaProject . getRawClasspath ( ) , doGetContainerId ( ) ) ; if ( entry != null ) { if ( SdkClasspathContainer . isDefaultContainerPath ( doGetContainerId ( ) , entry . getPath ( ) ) ) { return true ; } } } catch ( CoreException ce ) { CorePluginLog . logError ( ce ) ; } return false ; } | Returns true if the given project SDK is actually the default SDK for the workspace AND the project has a classpath container entry for the given SDK that indicates that the workspace default should actually be used (i.e. no trailing segments). Also returns true if the project SDK is the default SDK for the workspace and the project does not have a classpath container entry for the SDK. |
34,820 | private ArrayList < DbEntry > tryRemove ( int col , int row , ArrayList < DbEntry > items , float [ ] outLoss ) { boolean [ ] [ ] occupied = new boolean [ mTrgX ] [ mTrgY ] ; col = mShouldRemoveX ? col : Integer . MAX_VALUE ; row = mShouldRemoveY ? row : Integer . MAX_VALUE ; ArrayList < DbEntry > finalItems = new ArrayList < > ( ) ; ArrayList < DbEntry > removedItems = new ArrayList < > ( ) ; for ( DbEntry item : items ) { if ( ( item . cellX <= col && ( item . spanX + item . cellX ) > col ) || ( item . cellY <= row && ( item . spanY + item . cellY ) > row ) ) { removedItems . add ( item ) ; if ( item . cellX >= col ) item . cellX -- ; if ( item . cellY >= row ) item . cellY -- ; } else { if ( item . cellX > col ) item . cellX -- ; if ( item . cellY > row ) item . cellY -- ; finalItems . add ( item ) ; markCells ( occupied , item , true ) ; } } OptimalPlacementSolution placement = new OptimalPlacementSolution ( occupied , removedItems ) ; placement . find ( ) ; finalItems . addAll ( placement . finalPlacedItems ) ; outLoss [ 0 ] = placement . lowestWeightLoss ; outLoss [ 1 ] = placement . lowestMoveCost ; return finalItems ; } | Tries the remove the provided row and column. |
34,821 | public String [ ] removeIntervalFacets ( String field ) { while ( remove ( FacetParams . FACET_INTERVAL , field ) ) { } ; return remove ( String . format ( Locale . ROOT , "f.%s.facet.interval.set" , field ) ) ; } | Remove all Interval Facets on a field |
34,822 | @ Override public boolean equals ( Object o ) { if ( this == o ) { return true ; } if ( o == null || getClass ( ) != o . getClass ( ) ) { return false ; } ObjectStat that = ( ObjectStat ) o ; if ( length != that . length ) { return false ; } if ( ! bucketName . equals ( that . bucketName ) ) { return false ; } if ( ! name . equals ( that . name ) ) { return false ; } if ( ! createdTime . equals ( that . createdTime ) ) { return false ; } if ( ! etag . equals ( that . etag ) ) { return false ; } return contentType . equals ( that . contentType ) ; } | Checks whether given object is same as this ObjectStat. |
34,823 | public void put ( int key , float value ) { int i = binarySearch ( mKeys , 0 , mSize , key ) ; if ( i >= 0 ) { mValues [ i ] = value ; } else { i = ~ i ; if ( mSize >= mKeys . length ) { int n = ArrayUtils . idealIntArraySize ( mSize + 1 ) ; int [ ] nkeys = new int [ n ] ; float [ ] nvalues = new float [ n ] ; System . arraycopy ( mKeys , 0 , nkeys , 0 , mKeys . length ) ; System . arraycopy ( mValues , 0 , nvalues , 0 , mValues . length ) ; mKeys = nkeys ; mValues = nvalues ; } if ( mSize - i != 0 ) { System . arraycopy ( mKeys , i , mKeys , i + 1 , mSize - i ) ; System . arraycopy ( mValues , i , mValues , i + 1 , mSize - i ) ; } mKeys [ i ] = key ; mValues [ i ] = value ; mSize ++ ; } } | Adds a mapping from the specified key to the specified value, replacing the previous mapping from the specified key if there was one. |
34,824 | private static String single ( File file ) { return file . getAbsolutePath ( ) ; } | Get absolute path to a single file. |
34,825 | public boolean init ( ) { m_session = m_request . getSession ( true ) ; m_forward = WebUtil . getParameter ( m_request , P_ForwardTo ) ; if ( m_forward != null ) m_session . setAttribute ( P_ForwardTo , m_forward ) ; else m_forward = "" ; m_salesRep = WebUtil . getParameter ( m_request , P_SalesRep_ID ) ; if ( m_salesRep != null ) m_session . setAttribute ( P_SalesRep_ID , m_salesRep ) ; m_email = WebUtil . getParameter ( m_request , P_EMail ) ; if ( m_email == null ) m_email = "" ; m_email = m_email . trim ( ) ; if ( m_email != null ) m_session . setAttribute ( P_EMail , m_email ) ; m_password = WebUtil . getParameter ( m_request , P_Password ) ; if ( m_password == null ) m_password = "" ; m_password = m_password . trim ( ) ; if ( m_session . getAttribute ( WebInfo . NAME ) != null ) { WebInfo wi = ( WebInfo ) m_session . getAttribute ( WebInfo . NAME ) ; m_wu = wi . getWebUser ( ) ; } return true ; } | init will initialize the WebLogin Object for further use |
34,826 | protected int numberOfAttributes ( int total , double fraction ) { int k = ( int ) Math . round ( ( fraction < 1.0 ) ? total * fraction : fraction ) ; if ( k > total ) k = total ; if ( k < 1 ) k = 1 ; return k ; } | calculates the number of attributes |
34,827 | private static String dblString ( double decimalValue , int availableSpace ) { return dblString ( BigDecimal . valueOf ( decimalValue ) , - 1 , availableSpace ) ; } | Create a string from a BigDecimal making sure that it's not longer than the available space. |
34,828 | public void runTest ( ) throws Throwable { Document doc ; NodeList elementList ; Node nameNode ; CharacterData child ; String substring ; doc = ( Document ) load ( "hc_staff" , false ) ; elementList = doc . getElementsByTagName ( "strong" ) ; nameNode = elementList . item ( 0 ) ; child = ( CharacterData ) nameNode . getFirstChild ( ) ; substring = child . substringData ( 0 , 8 ) ; assertEquals ( "characterdataSubStringValueAssert" , "Margaret" , substring ) ; } | Runs the test case. |
34,829 | static public < T > void reset ( @ Nonnull Class < T > type ) { log . debug ( "Reset type {}" , type . getName ( ) ) ; managerLists . put ( type , new ArrayList < > ( ) ) ; } | Deregister all objects of a particular type. |
34,830 | SortedSet < String > typesToImport ( ) { SortedSet < String > typesToImport = new TreeSet < String > ( ) ; for ( Map . Entry < String , Spelling > entry : imports . entrySet ( ) ) { if ( entry . getValue ( ) . importIt ) { typesToImport . add ( entry . getKey ( ) ) ; } } return typesToImport ; } | Returns the set of types to import. We import every type that is neither in java.lang nor in the package containing the AutoCursor class, provided that the result refers to the type unambiguously. For example, if there is a property of type java.util.Map.Entry then we will import java.util.Map.Entry and refer to the property as Entry. We could also import just java.util.Map in this case and refer to Map.Entry, but currently we never do that. |
34,831 | public long createBackBuffer ( X11ComponentPeer peer , int numBuffers , BufferCapabilities caps ) throws AWTException { if ( ! X11GraphicsDevice . isDBESupported ( ) ) { throw new AWTException ( "Page flipping is not supported" ) ; } if ( numBuffers > 2 ) { throw new AWTException ( "Only double or single buffering is supported" ) ; } BufferCapabilities configCaps = getBufferCapabilities ( ) ; if ( ! configCaps . isPageFlipping ( ) ) { throw new AWTException ( "Page flipping is not supported" ) ; } long window = peer . getContentWindow ( ) ; int swapAction = getSwapAction ( caps . getFlipContents ( ) ) ; return createBackBuffer ( window , swapAction ) ; } | Attempts to create an XDBE-based backbuffer for the given peer. If the requested configuration is not natively supported, an AWTException is thrown. Otherwise, if the backbuffer creation is successful, a handle to the native backbuffer is returned. |
34,832 | private String inverseRename ( String renamedFilename , Map < String , String > renamedToReferenceMap ) { List < String > renamedAllParts = FILE_SEP_SPLITTER . splitToList ( renamedFilename ) ; for ( int i = renamedAllParts . size ( ) ; i > 0 ; i -- ) { String renamedParts = FILE_SEP_JOINER . join ( renamedAllParts . subList ( 0 , i ) ) ; String partsToSubstitute = renamedToReferenceMap . get ( renamedParts ) ; if ( partsToSubstitute != null ) { return renamedFilename . replace ( renamedParts , partsToSubstitute ) ; } } return renamedFilename ; } | Walks backwards through the dir prefixes of renamedFilename looking for a match in renamedToReferenceMap. |
34,833 | public void generateAtom ( XmlWriter w , ExtensionProfile extProfile ) throws IOException { ArrayList < XmlWriter . Attribute > attrs = new ArrayList < XmlWriter . Attribute > ( 3 ) ; List < XmlNamespace > nsDecls = new ArrayList < XmlNamespace > ( ) ; if ( rel != null ) { attrs . add ( new XmlWriter . Attribute ( "rel" , rel ) ) ; } if ( type != null ) { attrs . add ( new XmlWriter . Attribute ( "type" , type ) ) ; } if ( href != null ) { attrs . add ( new XmlWriter . Attribute ( "href" , href ) ) ; } if ( hrefLang != null ) { attrs . add ( new XmlWriter . Attribute ( "hreflang" , hrefLang ) ) ; } if ( title != null ) { attrs . add ( new XmlWriter . Attribute ( "title" , title ) ) ; } if ( titleLang != null ) { attrs . add ( new XmlWriter . Attribute ( "xml:lang" , titleLang ) ) ; } if ( length != - 1 ) { attrs . add ( new XmlWriter . Attribute ( "length" , String . valueOf ( length ) ) ) ; } if ( etag != null ) { nsDecls . add ( Namespaces . gNs ) ; attrs . add ( new XmlWriter . Attribute ( Namespaces . gAlias , "etag" , etag ) ) ; } generateStartElement ( w , Namespaces . atomNs , "link" , attrs , nsDecls ) ; if ( content != null ) { content . generateAtom ( w , extProfile ) ; } generateExtensions ( w , extProfile ) ; w . endElement ( Namespaces . atomNs , "link" ) ; } | Generates XML in the Atom format. |
34,834 | public String findURIFromDoc ( int owner ) { int n = m_sourceTree . size ( ) ; for ( int i = 0 ; i < n ; i ++ ) { SourceTree sTree = ( SourceTree ) m_sourceTree . elementAt ( i ) ; if ( owner == sTree . m_root ) return sTree . m_url ; } return null ; } | Given a document, find the URL associated with that document. |
34,835 | private EnvironmentLogger buildParentTree ( String childName ) { if ( childName == null || childName . equals ( "" ) ) return null ; int p = childName . lastIndexOf ( '.' ) ; String parentName ; if ( p > 0 ) parentName = childName . substring ( 0 , p ) ; else parentName = "" ; EnvironmentLogger parent = null ; SoftReference < EnvironmentLogger > parentRef = _envLoggers . get ( parentName ) ; if ( parentRef != null ) parent = parentRef . get ( ) ; if ( parent != null ) return parent ; else { parent = new EnvironmentLogger ( parentName , null ) ; _envLoggers . put ( parentName , new SoftReference < EnvironmentLogger > ( parent ) ) ; EnvironmentLogger grandparent = buildParentTree ( parentName ) ; if ( grandparent != null ) parent . setParent ( grandparent ) ; return parent ; } } | Recursively builds the parents of the logger. |
34,836 | static public byte [ ] charArrayToHexArray ( char [ ] array ) { byte [ ] ascii = new byte [ ( array . length % 2 == 0 ) ? array . length : array . length + 1 ] ; for ( int i = 0 ; i < ascii . length ; i ++ ) { if ( i < ascii . length ) { if ( 'A' <= array [ i ] && array [ i ] <= 'F' ) { ascii [ i ] = ( byte ) ( array [ i ] - 'A' ) ; } else if ( 'a' <= array [ i ] && array [ i ] <= 'f' ) { ascii [ i ] = ( byte ) ( array [ i ] - 'a' ) ; } else if ( '0' <= array [ i ] && array [ i ] <= '9' ) { ascii [ i ] = ( byte ) ( array [ i ] - '0' ) ; } else { ascii [ i ] = 0x0 ; } } else { ascii [ i ] = 0x0 ; } } byte [ ] result = new byte [ array . length / 2 ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = ( byte ) ( ( ascii [ i * 2 ] * 16 ) | ascii [ i * 2 + 1 ] ) ; } int i ; for ( i = result . length - 1 ; i >= 0 && result [ i ] == 0 ; i -- ) ; if ( i < result . length - 1 ) { result = Arrays . copyOf ( result , i + 1 ) ; } return result ; } | Utility method that transforms a an ascii array representing hexa data in a real hexa array. The resulting array is half the size of the one passed as parameter. |
34,837 | public UnicastThread ( int port ) throws IOException { super ( "unicast request" ) ; setDaemon ( true ) ; if ( port == 0 ) { try { listen = new ServerSocket ( Constants . getDiscoveryPort ( ) ) ; } catch ( IOException e ) { logger . log ( Levels . HANDLED , "failed to bind to default port" , e ) ; } } if ( listen == null ) { listen = new ServerSocket ( port ) ; } this . port = listen . getLocalPort ( ) ; } | Create a daemon thread. Set up the socket now rather than in run, so that we get any exception up front. |
34,838 | @ Override public boolean domainMatch ( final String host , final String domain ) { final boolean match = host . equals ( domain ) || ( domain . startsWith ( "." ) && host . endsWith ( domain ) ) ; return match ; } | Performs domain-match as defined by the RFC2109. |
34,839 | private JList < String > createNewInfoLabelJList ( String source ) { final JList < String > createdInfoLabelList = new JList < > ( ) ; createdInfoLabelList . setModel ( source == null ? localInfoLabelListModel : remoteInfoLabelListModels . get ( source ) ) ; createdInfoLabelList . setCellRenderer ( new ConfigurableInfoLabelRenderer ( ) ) ; createdInfoLabelList . setFixedCellHeight ( 20 ) ; createdInfoLabelList . setBackground ( LIGHTER_GRAY ) ; return createdInfoLabelList ; } | Creates a new JList for info labels of a source |
34,840 | public void end ( ) { check ( numthreads , 0 , 0 ) ; done . set ( true ) ; } | Trigger the threads that we're done |
34,841 | private List < FilePath > listSeqnoFiles ( ) { LinkedList < FilePath > children = new LinkedList < FilePath > ( ) ; for ( String fileName : listSeqnoFileNames ( ) ) { FilePath fp = new FilePath ( serviceDir , fileName ) ; children . add ( fp ) ; } return children ; } | Return a list of seqno file paths or an empty list of none exist. |
34,842 | protected void includeBasis ( int selectedBasis ) { basisSet . add ( Integer . valueOf ( selectedBasis ) ) ; reestimateAlpha ( selectedBasis ) ; } | Include a basis function into the model. |
34,843 | public static Script createRedeemScript ( int threshold , List < ECKey > pubkeys ) { pubkeys = new ArrayList < ECKey > ( pubkeys ) ; Collections . sort ( pubkeys , ECKey . PUBKEY_COMPARATOR ) ; return ScriptBuilder . createMultiSigOutputScript ( threshold , pubkeys ) ; } | Creates redeem script with given public keys and threshold. Given public keys will be placed in redeem script in the lexicographical sorting order. |
34,844 | public void processingInstruction ( String target , String data ) throws SAXException { charactersFlush ( ) ; int dataIndex = m_data . size ( ) ; m_previous = addNode ( DTM . PROCESSING_INSTRUCTION_NODE , DTM . PROCESSING_INSTRUCTION_NODE , m_parents . peek ( ) , m_previous , - dataIndex , false ) ; m_data . addElement ( m_valuesOrPrefixes . stringToIndex ( target ) ) ; m_values . addElement ( data ) ; m_data . addElement ( m_valueIndex ++ ) ; } | Override the processingInstruction() interface in SAX2DTM2. <p> %OPT% This one is different from SAX2DTM.processingInstruction() in that we do not use extended types for PI nodes. The name of the PI is saved in the DTMStringPool. Receive notification of a processing instruction. |
34,845 | public void union ( Set x ) { Enumeration elements = x . elements ( ) ; while ( elements . hasMoreElements ( ) ) put ( elements . nextElement ( ) ) ; } | Destructively modify this so that it becomes the union of itself with x. We iterate over the elements in x, adding to this any that are not in x. |
34,846 | public final double doOperation ( ) { List < Integer > allIndices = new ArrayList < Integer > ( masterList ) ; int left , right ; for ( int i = 0 ; i < size ; i ++ ) { left = allIndices . remove ( MathUtils . nextInt ( allIndices . size ( ) ) ) ; right = allIndices . remove ( MathUtils . nextInt ( allIndices . size ( ) ) ) ; double value1 = parameter . getParameterValue ( left ) ; double value2 = parameter . getParameterValue ( right ) ; parameter . setParameterValue ( left , value2 ) ; parameter . setParameterValue ( right , value1 ) ; } return 0.0 ; } | swap the values in two random parameter slots. |
34,847 | public static AnnotatedTypeMirror leastUpperBound ( AnnotatedTypeFactory atypeFactory , AnnotatedTypeMirror type1 , AnnotatedTypeMirror type2 ) { TypeMirror lub = InternalUtils . leastUpperBound ( atypeFactory . getProcessingEnv ( ) , type1 . getUnderlyingType ( ) , type2 . getUnderlyingType ( ) ) ; return leastUpperBound ( atypeFactory , type1 , type2 , lub ) ; } | Returns the lub of two annotated types. |
34,848 | private void writeInterfaceHash ( IndentingWriter p ) throws IOException { p . pln ( "private static final long interfaceHash = " + remoteClass . interfaceHash ( ) + "L;" ) ; } | Writes declaration and initializer for "interfaceHash" static field. |
34,849 | protected InvalidPropertyException ( final String message , final String propertyName ) { super ( String . format ( message , propertyName ) ) ; this . propertyName = propertyName ; } | Creates a new exception. |
34,850 | public int addPadding ( byte [ ] in , int inOff ) { byte code = ( byte ) ( in . length - inOff ) ; while ( inOff < in . length - 1 ) { if ( random == null ) { in [ inOff ] = 0 ; } else { in [ inOff ] = ( byte ) random . nextInt ( ) ; } inOff ++ ; } in [ inOff ] = code ; return code ; } | add the pad bytes to the passed in block, returning the number of bytes added. |
34,851 | public void addNodeKeys ( ArrayList < SpatialKey > list , Page p ) { if ( p != null && ! p . isLeaf ( ) ) { for ( int i = 0 ; i < p . getKeyCount ( ) ; i ++ ) { list . add ( ( SpatialKey ) p . getKey ( i ) ) ; addNodeKeys ( list , p . getChildPage ( i ) ) ; } } } | Add all node keys (including internal bounds) to the given list. This is mainly used to visualize the internal splits. |
34,852 | static double svd_dmax ( double a , double b ) { return Math . max ( a , b ) ; } | returns the larger of two double precision numbers |
34,853 | public static final Circle scale ( Circle circle , double scale ) { if ( circle == null ) throw new NullPointerException ( Messages . getString ( "geometry.nullShape" ) ) ; if ( scale <= 0 ) throw new IllegalArgumentException ( Messages . getString ( "geometry.invalidScale" ) ) ; return new Circle ( circle . radius * scale ) ; } | Returns a scaled version of the given circle. |