idx
int64
0
34.9k
question
stringlengths
12
26.4k
target
stringlengths
15
2.3k
800
public NSObject [ ] objectsAtIndexes ( int ... indexes ) { NSObject [ ] result = new NSObject [ indexes . length ] ; Arrays . sort ( indexes ) ; for ( int i = 0 ; i < indexes . length ; i ++ ) result [ i ] = array [ indexes [ i ] ] ; return result ; }
Returns a new array containing only the values stored at the given indices. The values are sorted by their index.
801
private static Entry [ ] concat ( Entry [ ] attrs1 , Entry [ ] attrs2 ) { Entry [ ] nattrs = new Entry [ attrs1 . length + attrs2 . length ] ; System . arraycopy ( attrs1 , 0 , nattrs , 0 , attrs1 . length ) ; System . arraycopy ( attrs2 , 0 , nattrs , attrs1 . length , attrs2 . length ) ; return nattrs ; }
Return a concatenation of the two arrays.
802
public static List < ShapeRecord > rectangle ( double startX , double startY , double width , double height ) { List < ShapeRecord > shapeRecords = new ArrayList < ShapeRecord > ( ) ; shapeRecords . add ( move ( startX , startY ) ) ; shapeRecords . addAll ( straightEdge ( startX , startY , width , startY ) ) ; shapeRecords . addAll ( straightEdge ( width , startY , width , height ) ) ; shapeRecords . addAll ( straightEdge ( width , height , startX , height ) ) ; shapeRecords . addAll ( straightEdge ( startX , height , startX , startY ) ) ; return shapeRecords ; }
Creates a List of ShapeRecord to draw a rectangle from the given origin (startX, startY) for the specified width and height (in pixels).
803
public GlowServer ( ServerConfig config ) { materialValueManager = new BuiltinMaterialValueManager ( ) ; this . config = config ; opsList = new UuidListFile ( config . getFile ( "ops.json" ) ) ; whitelist = new UuidListFile ( config . getFile ( "whitelist.json" ) ) ; nameBans = new GlowBanList ( this , Type . NAME ) ; ipBans = new GlowBanList ( this , Type . IP ) ; Bukkit . setServer ( this ) ; loadConfig ( ) ; }
Creates a new server.
804
public FPSTextureView removeChild ( @ NonNull DisplayBase displayBase ) { displayBase . disable ( ) ; boolean a = mDisplayList . remove ( displayBase ) ; return this ; }
Removes the specified child from the display list.
805
static int midPt ( final int a , final int b ) { return a + ( b - a ) / 2 ; }
returns the middle point between two values
806
public static ReactiveSeq < Double > fromDoubleStream ( final DoubleStream stream ) { Objects . requireNonNull ( stream ) ; return StreamUtils . reactiveSeq ( stream . boxed ( ) , Optional . empty ( ) ) ; }
Construct a ReactiveSeq from a Stream
807
String format ( Date source , StringBuffer toAppendTo ) { return source . toString ( ) ; }
Format a given date.
808
public static boolean isExtension ( String filename , String [ ] extensions ) { if ( filename == null ) { return false ; } if ( extensions == null || extensions . length == 0 ) { return indexOfExtension ( filename ) == - 1 ; } String fileExt = getExtension ( filename ) ; for ( String extension : extensions ) { if ( fileExt . equals ( extension ) ) { return true ; } } return false ; }
Checks whether the extension of the filename is one of those specified. <p> This method obtains the extension as the textual part of the filename after the last dot. There must be no directory separator after the dot. The extension check is case-sensitive on all platforms.
809
public static List < String > availableInstances ( ) throws IOException { Path confPath = Paths . get ( SystemProperties . getConfigurationProxyConfPath ( ) ) ; return subDirectoryNames ( confPath ) ; }
Gets all existing subdirectory names from the configuration proxy configuration directory, which correspond to the configuration proxy instance ids.
810
public LazyFutureStream < Integer > from ( final IntStream stream ) { return fromStream ( stream . boxed ( ) ) ; }
Start a reactive dataflow from a stream.
811
protected void resetOptions ( ) { m_trainSelector = new weka . attributeSelection . AttributeSelection ( ) ; setEvaluator ( new CfsSubsetEval ( ) ) ; setSearch ( new BestFirst ( ) ) ; m_SelectedAttributes = null ; }
set options to their default values
812
protected void limitTransAndScale ( Matrix matrix ) { float [ ] vals = new float [ 9 ] ; matrix . getValues ( vals ) ; float curTransX = vals [ Matrix . MTRANS_X ] ; float curScaleX = vals [ Matrix . MSCALE_X ] ; mScaleX = Math . max ( 1f , Math . min ( getMaxScale ( ) , curScaleX ) ) ; float maxTransX = - ( float ) mContentRect . width ( ) * ( mScaleX - 1f ) ; float newTransX = Math . min ( Math . max ( curTransX , maxTransX ) , 0 ) ; vals [ Matrix . MTRANS_X ] = newTransX ; vals [ Matrix . MSCALE_X ] = mScaleX ; matrix . setValues ( vals ) ; }
limits the maximum scale and X translation of the given matrix
813
public void testGetInputEncoding ( ) throws Exception { assertEquals ( "US-ASCII" , documentA . getInputEncoding ( ) ) ; assertEquals ( "ISO-8859-1" , documentB . getInputEncoding ( ) ) ; }
XML parsers are advised of the document's character set via two channels: via the declaration and also the document's input source. To test that each of these winds up in the correct location in the document model, we supply different names for each. This is only safe because for the subset of characters in the document, the character sets are equivalent.
814
protected void closeDialogOk ( ) { dispose ( ) ; }
Overrideen to perform specific clean up when dialog closed.
815
public static boolean isDangerous ( double d ) { return Double . isInfinite ( d ) || Double . isNaN ( d ) || d == 0.0 ; }
Returns true if the argument is a "dangerous" double to have around, namely one that is infinite, NaN or zero.
816
public static byte [ ] fromBase58WithChecksum ( String s ) throws HyperLedgerException { byte [ ] b = fromBase58 ( s ) ; if ( b . length < 4 ) { throw new HyperLedgerException ( "Too short for checksum " + s ) ; } byte [ ] cs = new byte [ 4 ] ; System . arraycopy ( b , b . length - 4 , cs , 0 , 4 ) ; byte [ ] data = new byte [ b . length - 4 ] ; System . arraycopy ( b , 0 , data , 0 , b . length - 4 ) ; byte [ ] h = new byte [ 4 ] ; System . arraycopy ( Hash . hash ( data ) , 0 , h , 0 , 4 ) ; if ( Arrays . equals ( cs , h ) ) { return data ; } throw new HyperLedgerException ( "Checksum mismatch " + s ) ; }
decode from base58 assuming a trailing checksum of four bytes
817
public Collection < Class < ? extends Closeable > > shardServices ( ) { return Collections . emptyList ( ) ; }
Per index shard service that will be automatically closed.
818
public static SparseIntArray adjustPosition ( SparseIntArray positions , int startPosition , int endPosition , int adjustBy ) { SparseIntArray newPositions = new SparseIntArray ( ) ; for ( int i = 0 , size = positions . size ( ) ; i < size ; i ++ ) { int position = positions . keyAt ( i ) ; if ( position < startPosition || position > endPosition ) { newPositions . put ( position , positions . valueAt ( i ) ) ; } else if ( adjustBy > 0 ) { newPositions . put ( position + adjustBy , positions . valueAt ( i ) ) ; } else if ( adjustBy < 0 ) { if ( position > startPosition + adjustBy && position <= startPosition ) { ; } else { newPositions . put ( position + adjustBy , positions . valueAt ( i ) ) ; } } } return newPositions ; }
internal method to handle the selections if items are added / removed
819
public int compare ( Object o1 , Object o2 ) { String s1 = o1 . toString ( ) ; if ( s1 == null ) s1 = "" ; String s2 = o2 . toString ( ) ; if ( s2 == null ) s2 = "" ; return s1 . compareTo ( s2 ) ; }
Compare based on Name
820
private final ArrayList < AwtreeNodeLeaf > to_array ( ) { ArrayList < AwtreeNodeLeaf > result = new ArrayList < AwtreeNodeLeaf > ( leaf_count ) ; AwtreeNode curr_node = root_node ; if ( curr_node == null ) return result ; for ( ; ; ) { while ( curr_node instanceof AwtreeNodeFork ) { curr_node = ( ( AwtreeNodeFork ) curr_node ) . first_child ; } result . add ( ( AwtreeNodeLeaf ) curr_node ) ; AwtreeNodeFork curr_parent = curr_node . parent ; while ( curr_parent != null && curr_parent . second_child == curr_node ) { curr_node = curr_parent ; curr_parent = curr_node . parent ; } if ( curr_parent == null ) break ; curr_node = curr_parent . second_child ; } return result ; }
Inserts the leaves of this tree into an array list
821
public void unregister ( ) throws PayloadException , NetworkException { if ( sLogger . isActivated ( ) ) { sLogger . debug ( "Unregister from IMS" ) ; } mRegistration . deRegister ( ) ; mSip . closeStack ( ) ; }
Unregister from the IMS
822
public static int listFind ( String list , String value ) { return listFind ( list , value , "," ) ; }
finds a value inside a list, case sensitive
823
public FlacStreamReader ( RandomAccessFile raf ) { this . raf = raf ; }
Create instance for holding stream info
824
public static void overScrollBy ( final PullToRefreshBase < ? > view , final int deltaX , final int scrollX , final int deltaY , final int scrollY , final int scrollRange , final int fuzzyThreshold , final float scaleFactor , final boolean isTouchEvent ) { final int deltaValue , currentScrollValue , scrollValue ; switch ( view . getPullToRefreshScrollDirection ( ) ) { case HORIZONTAL : deltaValue = deltaX ; scrollValue = scrollX ; currentScrollValue = view . getScrollX ( ) ; break ; case VERTICAL : default : deltaValue = deltaY ; scrollValue = scrollY ; currentScrollValue = view . getScrollY ( ) ; break ; } if ( view . isPullToRefreshOverScrollEnabled ( ) && ! view . isRefreshing ( ) ) { final Mode mode = view . getMode ( ) ; if ( mode . permitsPullToRefresh ( ) && ! isTouchEvent && deltaValue != 0 ) { final int newScrollValue = ( deltaValue + scrollValue ) ; if ( PullToRefreshBase . DEBUG ) { Log . d ( LOG_TAG , "OverScroll. DeltaX: " + deltaX + ", ScrollX: " + scrollX + ", DeltaY: " + deltaY + ", ScrollY: " + scrollY + ", NewY: " + newScrollValue + ", ScrollRange: " + scrollRange + ", CurrentScroll: " + currentScrollValue ) ; } if ( newScrollValue < ( 0 - fuzzyThreshold ) ) { if ( mode . showHeaderLoadingLayout ( ) ) { if ( currentScrollValue == 0 ) { view . setState ( State . OVERSCROLLING ) ; } view . setHeaderScroll ( ( int ) ( scaleFactor * ( currentScrollValue + newScrollValue ) ) ) ; } } else if ( newScrollValue > ( scrollRange + fuzzyThreshold ) ) { if ( mode . showFooterLoadingLayout ( ) ) { if ( currentScrollValue == 0 ) { view . setState ( State . OVERSCROLLING ) ; } view . setHeaderScroll ( ( int ) ( scaleFactor * ( currentScrollValue + newScrollValue - scrollRange ) ) ) ; } } else if ( Math . abs ( newScrollValue ) <= fuzzyThreshold || Math . abs ( newScrollValue - scrollRange ) <= fuzzyThreshold ) { view . setState ( State . RESET ) ; } } else if ( isTouchEvent && State . OVERSCROLLING == view . getState ( ) ) { view . setState ( State . RESET ) ; } } }
Helper method for Overscrolling that encapsulates all of the necessary function. This is the advanced version of the call.
825
public void addScrollingListener ( OnWheelScrollListener listener ) { scrollingListeners . add ( listener ) ; }
Adds wheel scrolling listener
826
public final void skipUntil ( final double when ) { this . skipUntil = when ; }
Allow this SnapshotGenerator to skip all snapshots up to, but not including, a give timestep. This is especially useful for interactive settings where a user may fast-forward. Snapshot generation is one of the most expensive parts of mobility simulations, so this saves a lot of time.
827
public static String quote ( char ch ) { switch ( ch ) { case '\b' : return "\\b" ; case '\f' : return "\\f" ; case '\n' : return "\\n" ; case '\r' : return "\\r" ; case '\t' : return "\\t" ; case '\'' : return "\\'" ; case '\"' : return "\\\"" ; case '\\' : return "\\\\" ; default : return ( isPrintableAscii ( ch ) ) ? String . valueOf ( ch ) : String . format ( "\\u%04x" , ( int ) ch ) ; } }
Escapes a character if it has an escape sequence or is non-printable ASCII. Leaves non-ASCII characters alone.
828
public static byte [ ] serializeToByteArray ( Serializable value ) { try { ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; try ( ObjectOutputStream oos = new ObjectOutputStream ( new SnappyOutputStream ( buffer ) ) ) { oos . writeObject ( value ) ; } return buffer . toByteArray ( ) ; } catch ( IOException exn ) { throw new IllegalArgumentException ( "unable to serialize " + value , exn ) ; } }
Serializes the argument into an array of bytes, and returns it.
829
@ Override public Set < Statement > gather ( final IGASState < Set < Statement > , Set < Statement > , Set < Statement > > state , final Value u , final Statement e ) { return Collections . singleton ( e ) ; }
Return the edge as a singleton set.
830
public void run ( E start ) { run ( Collections . singleton ( start ) ) ; }
Computes shortest paths to nodes in the graph.
831
private boolean tooBig ( BasicBlock bb , int maxCost ) { int cost = 0 ; for ( Enumeration < Instruction > e = bb . forwardRealInstrEnumerator ( ) ; e . hasMoreElements ( ) ; ) { Instruction s = e . nextElement ( ) ; if ( s . isCall ( ) ) { cost += 3 ; } else if ( s . isAllocation ( ) ) { cost += 6 ; } else { cost ++ ; } if ( cost > maxCost ) return true ; } return false ; }
Simplistic cost estimate; since we are doing the splitting based on static hints, we are only willing to copy a very small amount of code.
832
@ Override public boolean addEntry ( Principal caller , AclEntry entry ) throws NotOwnerException { if ( ! isOwner ( caller ) ) throw new NotOwnerException ( ) ; if ( entryList . contains ( entry ) ) return false ; entryList . addElement ( entry ) ; return true ; }
Adds an ACL entry to this ACL. An entry associates a principal (e.g., an individual or a group) with a set of permissions. Each principal can have at most one positive ACL entry (specifying permissions to be granted to the principal) and one negative ACL entry (specifying permissions to be denied). If there is already an ACL entry of the same type (negative or positive) already in the ACL, false is returned.
833
private boolean has_colinear ( PlaPointInt a_point ) { int count = point_alist . size ( ) ; if ( count < 2 ) return false ; for ( int index = 0 ; index < count - 1 ; index ++ ) { PlaPointInt start = point_alist . get ( index ) ; PlaPointInt end = point_alist . get ( index + 1 ) ; if ( a_point . side_of ( start , end ) != PlaSide . COLLINEAR ) continue ; double d_start_p = start . distance_square ( a_point ) ; double d_p_end = a_point . distance_square ( end ) ; double d_start_end = start . distance_square ( end ) ; if ( d_start_end >= d_start_p ) { if ( d_start_end >= d_p_end ) { return true ; } else { point_alist . set ( index , a_point ) ; return true ; } } else { if ( d_start_end >= d_p_end ) { point_alist . set ( index + 1 , a_point ) ; return true ; } else { point_alist . set ( index , a_point ) ; return true ; } } } return false ; }
Return true if the given point is colinear with two points in the list and should NOT be added Now, the issue is that this point may be colinear (on the same line) but further away, so, it should be the one being kept, not the one currently in the list....
834
protected void incorporateDigestMethod ( final Element parentDom , final DigestAlgorithm digestAlgorithm ) { final Element digestMethodDom = documentDom . createElementNS ( XMLNS , DS_DIGEST_METHOD ) ; final String digestAlgorithmXmlId = digestAlgorithm . getXmlId ( ) ; digestMethodDom . setAttribute ( ALGORITHM , digestAlgorithmXmlId ) ; parentDom . appendChild ( digestMethodDom ) ; }
This method creates the ds:DigestMethod DOM object
835
public static boolean isXML11ValidName ( String name ) { final int length = name . length ( ) ; if ( length == 0 ) { return false ; } int i = 1 ; char ch = name . charAt ( 0 ) ; if ( ! isXML11NameStart ( ch ) ) { if ( length > 1 && isXML11NameHighSurrogate ( ch ) ) { char ch2 = name . charAt ( 1 ) ; if ( ! XMLChar . isLowSurrogate ( ch2 ) || ! isXML11NameStart ( XMLChar . supplemental ( ch , ch2 ) ) ) { return false ; } i = 2 ; } else { return false ; } } while ( i < length ) { ch = name . charAt ( i ) ; if ( ! isXML11Name ( ch ) ) { if ( ++ i < length && isXML11NameHighSurrogate ( ch ) ) { char ch2 = name . charAt ( i ) ; if ( ! XMLChar . isLowSurrogate ( ch2 ) || ! isXML11Name ( XMLChar . supplemental ( ch , ch2 ) ) ) { return false ; } } else { return false ; } } ++ i ; } return true ; }
Check to see if a string is a valid Name according to [5] in the XML 1.1 Recommendation
836
public String resolvePath ( String pathInfo ) { if ( ( pathInfo == null ) || ( pathInfo . indexOf ( ".." ) != - 1 ) ) { return null ; } int libStart = pathInfo . indexOf ( '/' ) + 1 ; int libEnd = pathInfo . indexOf ( '/' , libStart ) ; if ( libEnd == - 1 ) { libEnd = pathInfo . length ( ) ; } String libname = pathInfo . substring ( libStart , libEnd ) ; String subpath = pathInfo . substring ( libEnd ) ; String lib_home = getPath ( libname ) ; if ( lib_home == null ) { return null ; } return lib_home + "/" + subpath ; }
Return a file object that the path resolves to. Performs some minimal checks to try and prevent an attacker from feeding in urls that cause the servlets to climb out of their sandbox. A better option is to use a servlet container with the ability to restrict servlet file access. For example, Apache Software Foundation's Tomcat 5 Servlet/JSP Container running with the -security flag.
837
protected int rangeUpper ( String range ) { int hyphenIndex ; if ( ( hyphenIndex = range . indexOf ( '-' ) ) >= 0 ) { return Math . max ( rangeUpper ( range . substring ( 0 , hyphenIndex ) ) , rangeUpper ( range . substring ( hyphenIndex + 1 ) ) ) ; } return rangeSingle ( range ) ; }
Translates a range into it's upper index. Must only be called once setUpper has been called.
838
@ Override public boolean equals ( Object that ) { try { if ( that == null ) { return false ; } RuleBasedBreakIterator other = ( RuleBasedBreakIterator ) that ; if ( checksum != other . checksum ) { return false ; } if ( text == null ) { return other . text == null ; } else { return text . equals ( other . text ) ; } } catch ( ClassCastException e ) { return false ; } }
Returns true if both BreakIterators are of the same class, have the same rules, and iterate over the same text.
839
public static String extractResponse ( IDiagnosticsLogger log , StringWriter sw ) { String samlResponseField = "<input type=\"hidden\" name=\"SAMLResponse\" value=\"" ; String responseAsString = sw . toString ( ) ; log . debug ( "Received response " + responseAsString ) ; int index = responseAsString . indexOf ( samlResponseField ) ; assertTrue ( index >= 0 ) ; int startIndex = index + samlResponseField . length ( ) ; int endIndex = responseAsString . indexOf ( '\"' , startIndex ) ; assertTrue ( endIndex >= 0 ) ; String encodedSamlResponse = responseAsString . substring ( startIndex , endIndex ) ; String decodedSamlResponse = new String ( Base64 . decode ( encodedSamlResponse ) ) ; return decodedSamlResponse ; }
Extract Saml Response which was written to a stream
840
public void testPowNegativeNumToEvenExp ( ) { byte aBytes [ ] = { 50 , - 26 , 90 , 69 , 120 , 32 , 63 , - 103 , - 14 , 35 } ; int aSign = - 1 ; int exp = 4 ; byte rBytes [ ] = { 102 , 107 , - 122 , - 43 , - 52 , - 20 , - 27 , 25 , - 9 , 88 , - 13 , 75 , 78 , 81 , - 33 , - 77 , 39 , 27 , - 37 , 106 , 121 , - 73 , 108 , - 47 , - 101 , 80 , - 25 , 71 , 13 , 94 , - 7 , - 33 , 1 , - 17 , - 65 , - 70 , - 61 , - 3 , - 47 } ; BigInteger aNumber = new BigInteger ( aSign , aBytes ) ; BigInteger result = aNumber . pow ( exp ) ; byte resBytes [ ] = new byte [ rBytes . length ] ; resBytes = result . toByteArray ( ) ; for ( int i = 0 ; i < resBytes . length ; i ++ ) { assertTrue ( resBytes [ i ] == rBytes [ i ] ) ; } assertEquals ( "incorrect sign" , 1 , result . signum ( ) ) ; }
Exponentiation of a negative number to an even exponent.
841
public void putAttribute ( final String attrId , final List ltValues ) { if ( map == null ) { map = new HashMap ( ) ; } map . put ( attrId . toLowerCase ( ) , new LdapEntryAttributeVO ( attrId . toLowerCase ( ) , ltValues ) ) ; }
Permite aniadir un atributo a la entrada ldap
842
protected JavaFileObject preferredFileObject ( JavaFileObject a , JavaFileObject b ) { if ( preferSource ) return ( a . getKind ( ) == JavaFileObject . Kind . SOURCE ) ? a : b ; else { long adate = a . getLastModified ( ) ; long bdate = b . getLastModified ( ) ; return ( adate > bdate ) ? a : b ; } }
Implement policy to choose to derive information from a source file or a class file when both are present. May be overridden by subclasses.
843
public void evaluate ( final MultivariateFunction evaluationFunction , final Comparator < PointValuePair > comparator ) { for ( int i = 0 ; i < simplex . length ; i ++ ) { final PointValuePair vertex = simplex [ i ] ; final double [ ] point = vertex . getPointRef ( ) ; if ( Double . isNaN ( vertex . getValue ( ) ) ) { simplex [ i ] = new PointValuePair ( point , evaluationFunction . value ( point ) , false ) ; } } Arrays . sort ( simplex , comparator ) ; }
Evaluate all the non-evaluated points of the simplex.
844
public void testToEngineeringStringZeroNegExponent ( ) { String a = "0.0E-16" ; BigDecimal aNumber = new BigDecimal ( a ) ; String result = "0.00E-15" ; assertEquals ( "incorrect value" , result , aNumber . toEngineeringString ( ) ) ; }
Convert a negative BigDecimal to an engineering string representation
845
public SelectClause add ( Expression expression ) { selectList . add ( new SelectClauseExpression ( expression ) ) ; return this ; }
Adds an expression to the select clause.
846
private void attemptResponse ( InetSocketAddress addr , int timeout ) throws Exception { Socket s = new Socket ( ) ; try { s . connect ( addr , timeout ) ; respond ( s ) ; } finally { try { s . close ( ) ; } catch ( IOException e ) { logger . log ( Levels . HANDLED , "exception closing socket" , e ) ; } } }
attempt a connection to multicast request client
847
protected void addToPortMap ( IOFSwitch sw , MacAddress mac , VlanVid vlan , OFPort portVal ) { Map < MacVlanPair , OFPort > swMap = macVlanToSwitchPortMap . get ( sw ) ; if ( vlan == VlanVid . FULL_MASK ) { vlan = VlanVid . ofVlan ( 0 ) ; } if ( swMap == null ) { swMap = Collections . synchronizedMap ( new LRULinkedHashMap < MacVlanPair , OFPort > ( MAX_MACS_PER_SWITCH ) ) ; macVlanToSwitchPortMap . put ( sw , swMap ) ; } swMap . put ( new MacVlanPair ( mac , vlan ) , portVal ) ; }
Adds a host to the MAC/VLAN->SwitchPort mapping
848
public void save ( ) throws SSOException , SMSException { if ( readOnly ) { if ( debug . warningEnabled ( ) ) { debug . warning ( "SMSEntry: Attempted to save an entry that " + "is marked as read-only: " + dn ) ; } throw ( new SMSException ( SMSException . STATUS_NO_PERMISSION , "sms-INSUFFICIENT_ACCESS_RIGHTS" ) ) ; } save ( ssoToken ) ; }
Save the modification(s) to the object. Save the changes made so far to the datastore.
849
public ErrorDialog ( final SafeHtml message ) { this ( ) ; body . add ( message . toBlockWidget ( ) ) ; }
Create a dialog box to show a single message string.
850
public List < Annotation > findByProject ( AppContext app , ProjectPK projectPk , String orderBy ) { List < DataStoreQueryField > queryFields = new ArrayList < DataStoreQueryField > ( 1 ) ; queryFields . add ( new DataStoreQueryField ( "id.projectId" , projectPk . getProjectId ( ) ) ) ; return super . find ( app , projectPk , queryFields , findByProjectCache , orderBy ) ; }
Find a list of annotations of a given project.
851
public long start_brk ( ) { return Long . parseLong ( fields [ 46 ] ) ; }
(since Linux 3.3) Address above which program heap can be expanded with brk(2).
852
private void addToMap ( LocatorReg reg ) { undiscoveredLocators . add ( reg ) ; queueDiscoveryTask ( reg ) ; }
Adds the given LocatorReg object to the set containing the objects corresponding to the locators of desired lookup services that have not yet been discovered, and queues a DiscoveryTask to attempt, through unicast discovery, to discover the associated lookup service.
853
public static String [ ] createFixedRandomStrings ( int count ) { String [ ] strings = new String [ count ] ; Random lengthRandom = new Random ( ) ; lengthRandom . setSeed ( SEED ) ; Random stringRandom = new Random ( ) ; stringRandom . setSeed ( SEED ) ; for ( int i = 0 ; i < count ; i ++ ) { int nextLength = lengthRandom . nextInt ( MAX_LENGTH - MIN_LENGTH - 1 ) ; nextLength += MIN_LENGTH ; strings [ i ] = RandomStringUtils . random ( nextLength , 0 , CHARS . length , true , true , CHARS , stringRandom ) ; } return strings ; }
Creates the same random sequence of strings.
854
private void createEsxiSession ( ImageServerDialog d , ComputeImageJob job , ComputeImage ci , ComputeImageServer imageServer ) { String s = ImageServerUtils . getResourceAsString ( ESXI5X_UUID_TEMPLATE ) ; StringBuilder sb = new StringBuilder ( s ) ; ImageServerUtils . replaceAll ( sb , "${os_full_name}" , ci . getImageName ( ) ) ; ImageServerUtils . replaceAll ( sb , "${os_path}" , ci . getPathToDirectory ( ) ) ; ImageServerUtils . replaceAll ( sb , "${pxe_identifier}" , job . getPxeBootIdentifier ( ) ) ; String content = sb . toString ( ) ; log . trace ( content ) ; d . writeFile ( imageServer . getTftpBootDir ( ) + PXELINUX_CFG_DIR + job . getPxeBootIdentifier ( ) , content ) ; s = d . readFile ( imageServer . getTftpBootDir ( ) + ci . getPathToDirectory ( ) + "/boot.cfg" ) ; sb = new StringBuilder ( s . trim ( ) ) ; ImageServerUtils . replaceAll ( sb , "/" , "/" + ci . getPathToDirectory ( ) ) ; ImageServerUtils . replaceAll ( sb , "runweasel" , "runweasel vmkopts=debugLogToSerial:1 ks=http://" + imageServer . getImageServerSecondIp ( ) + ":" + imageServer . getImageServerHttpPort ( ) + "/ks/" + job . getPxeBootIdentifier ( ) + " kssendmac" ) ; content = sb . toString ( ) ; log . trace ( content ) ; d . writeFile ( imageServer . getTftpBootDir ( ) + PXELINUX_CFG_DIR + job . getPxeBootIdentifier ( ) + ".boot.cfg" , content ) ; content = generateKickstart ( job , ci , imageServer ) ; d . writeFile ( imageServer . getTftpBootDir ( ) + HTTP_KICKSTART_DIR + job . getPxeBootIdentifier ( ) , content ) ; content = generateFirstboot ( job , ci ) ; d . writeFile ( imageServer . getTftpBootDir ( ) + HTTP_FIRSTBOOT_DIR + job . getPxeBootIdentifier ( ) , content ) ; d . rm ( imageServer . getTftpBootDir ( ) + HTTP_SUCCESS_DIR + job . getPxeBootIdentifier ( ) ) ; d . rm ( imageServer . getTftpBootDir ( ) + HTTP_FAILURE_DIR + job . getPxeBootIdentifier ( ) ) ; }
Create PXE UUID config and PXE uuid boot.cfg files for ESXi 5.x and 6.x and put them under tftpboot/pxelinux.cfg/.
855
protected void createFilterToolbar ( ) { timer = new Timer ( 400 , null ) ; timer . setInitialDelay ( 400 ) ; timer . setActionCommand ( CMD_FILTER_CHANGED ) ; timer . setRepeats ( false ) ; searchFilter = new SearchFilter ( ) ; searchFilter . setFilterText ( StringUtils . EMPTY ) ; }
Create the search filter for the toolbar
856
public ParseHeaderState ( HttpHeaders headers , StringBuilder logger ) { Class < ? extends HttpHeaders > clazz = headers . getClass ( ) ; this . context = Arrays . < Type > asList ( clazz ) ; this . classInfo = ClassInfo . of ( clazz , true ) ; this . logger = logger ; this . arrayValueMap = new ArrayValueMap ( headers ) ; }
Initializes a new ParseHeaderState.
857
public static String listInsertAt ( String list , int pos , String value , String delimiter , boolean ignoreEmpty ) throws ExpressionException { if ( pos < 1 ) throw new ExpressionException ( "invalid string list index [" + ( pos ) + "]" ) ; char [ ] del = delimiter . toCharArray ( ) ; char c ; StringBuilder result = new StringBuilder ( ) ; String end = "" ; int len ; if ( ignoreEmpty ) { outer : while ( list . length ( ) > 0 ) { c = list . charAt ( 0 ) ; for ( int i = 0 ; i < del . length ; i ++ ) { if ( c == del [ i ] ) { list = list . substring ( 1 ) ; result . append ( c ) ; continue outer ; } } break ; } } if ( ignoreEmpty ) { outer : while ( list . length ( ) > 0 ) { c = list . charAt ( list . length ( ) - 1 ) ; for ( int i = 0 ; i < del . length ; i ++ ) { if ( c == del [ i ] ) { len = list . length ( ) ; list = list . substring ( 0 , len - 1 < 0 ? 0 : len - 1 ) ; end = c + end ; continue outer ; } } break ; } } len = list . length ( ) ; int last = 0 ; int count = 0 ; outer : for ( int i = 0 ; i < len ; i ++ ) { c = list . charAt ( i ) ; for ( int y = 0 ; y < del . length ; y ++ ) { if ( c == del [ y ] ) { if ( ! ignoreEmpty || last < i ) { if ( pos == ++ count ) { result . append ( value ) ; result . append ( del [ 0 ] ) ; } } result . append ( list . substring ( last , i ) ) ; result . append ( c ) ; last = i + 1 ; continue outer ; } } } count ++ ; if ( last <= len ) { if ( pos == count ) { result . append ( value ) ; result . append ( del [ 0 ] ) ; } result . append ( list . substring ( last ) ) ; } if ( pos > count ) { throw new ExpressionException ( "invalid string list index [" + ( pos ) + "], indexes go from 1 to " + ( count ) ) ; } return result + end ; }
casts a list to Array object, remove all empty items at start and end of the list and store count to info
858
void updateDayCounter ( final long newMessages ) { GregorianCalendar cal = new GregorianCalendar ( ) ; int currentIndex = cal . get ( Calendar . HOUR_OF_DAY ) ; boolean bUpdate = false ; for ( int i = 0 ; i <= currentIndex ; i ++ ) { if ( counters [ i ] > - 1 ) { bUpdate = true ; } if ( bUpdate == true ) { if ( counters [ i ] == - 1 ) { counters [ i ] = 0 ; } } } counters [ currentIndex ] += newMessages ; }
Update day counter hour array elements
859
public float readFloat ( ) throws IOException { return dis . readFloat ( ) ; }
Read a float from the input stream.
860
private < T > Stream < Collection < T > > partitionedStream ( Iterator < T > iterator ) { return StreamSupport . stream ( Spliterators . spliteratorUnknownSize ( Iterators . partition ( iterator , batchSize ) , Spliterator . ORDERED ) , false ) ; }
Partition a stream into a stream of collections, each with batchSize elements.
861
public static Cache . Entry makeRandomCacheEntry ( byte [ ] data , boolean isExpired , boolean needsRefresh ) { Random random = new Random ( ) ; Cache . Entry entry = new Cache . Entry ( ) ; if ( data != null ) { entry . data = data ; } else { entry . data = new byte [ random . nextInt ( 1024 ) ] ; } entry . etag = String . valueOf ( random . nextLong ( ) ) ; entry . lastModified = random . nextLong ( ) ; entry . ttl = isExpired ? 0 : Long . MAX_VALUE ; entry . softTtl = needsRefresh ? 0 : Long . MAX_VALUE ; return entry ; }
Makes a random cache entry.
862
public void removeLast ( ) { DataChangeEvent [ ] events ; synchronized ( this ) { int row = getRowCount ( ) - 1 ; Row r = new Row ( this , row ) ; events = new DataChangeEvent [ getColumnCount ( ) ] ; for ( int col = 0 ; col < events . length ; col ++ ) { events [ col ] = new DataChangeEvent ( this , col , row , r . get ( col ) , null ) ; } rows . remove ( row ) ; } notifyDataRemoved ( events ) ; }
Removes the last row from the table.
863
public CustomEntryConcurrentHashMap ( final Map < ? extends K , ? extends V > m ) { this ( Math . max ( ( int ) ( m . size ( ) / DEFAULT_LOAD_FACTOR ) + 1 , DEFAULT_INITIAL_CAPACITY ) , DEFAULT_LOAD_FACTOR , DEFAULT_CONCURRENCY_LEVEL , false ) ; putAll ( m ) ; }
Creates a new map with the same mappings as the given map. The map is created with a capacity of 1.5 times the number of mappings in the given map or 16 (whichever is greater), and a default load factor (0.75) and concurrencyLevel (16).
864
public FileReadStream ( ) { }
Create a new FileReadStream.
865
public static String quote ( String s ) { if ( s == null ) return null ; if ( s . length ( ) == 0 ) return "\"\"" ; StringBuffer b = new StringBuffer ( s . length ( ) + 8 ) ; quote ( b , s ) ; return b . toString ( ) ; }
Quote a string. The string is quoted only if quoting is required due to embeded delimiters, quote characters or the empty string.
866
public void querySorted ( String type , int index , boolean ascending , int page , int limit , int visibilityScope , CloudResponse < CloudObject [ ] > response ) { try { queryImpl ( type , null , 0 , page , limit , visibilityScope , 1 , index , ascending , false , false , response ) ; } catch ( CloudException e ) { response . onError ( e ) ; } }
Performs a query to the server finding the objects where the sort is equal to the given value. This operation executes immeditely without waiting for commit.
867
private void logMessage ( String msg , Object [ ] obj ) { if ( _monitoringPropertiesLoader . isToLogIndications ( ) ) { _logger . debug ( "-> " + msg , obj ) ; } }
Log the messages. This method eliminates the logging condition check every time when we need to log a message.
868
public void actionPerformed ( ActionEvent e ) { ActionMap map = tabPane . getActionMap ( ) ; if ( map != null ) { String actionKey ; if ( e . getSource ( ) == scrollForwardButton ) { actionKey = "scrollTabsForwardAction" ; } else { actionKey = "scrollTabsBackwardAction" ; } Action action = map . get ( actionKey ) ; if ( action != null && action . isEnabled ( ) ) { action . actionPerformed ( new ActionEvent ( tabPane , ActionEvent . ACTION_PERFORMED , null , e . getWhen ( ) , e . getModifiers ( ) ) ) ; } } }
ActionListener for the scroll buttons.
869
public double entropy ( int g , int lag ) { double h = 0.0 ; int n = cases . length - lag ; double ln2 = Math . log ( 2.0 ) ; int n0 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( cases [ i + lag ] [ g ] == 0 ) { n0 ++ ; } } double p ; if ( n0 == 0 || n0 == n ) { return h ; } else { p = ( double ) n0 / ( double ) n ; h = - ( p * Math . log ( p ) + ( 1.0 - p ) * Math . log ( 1.0 - p ) ) / ln2 ; } return h ; }
This method implements the same definition of entropy as above but this specialized version is intended to be used by the mutualInformation method (viz). This method computes the entropy of a gene's binarized expressions from a point in time until the end of the data signal. This is useful in the normalization of the mutual information.
870
public OnUpdateClause addAssignment ( Expression expression ) { assignments . add ( new Assignment ( expression ) ) ; return this ; }
Adds a variable to set to the clause.
871
public short readShortBE ( ) throws IOException { return inputStream . readShort ( ) ; }
read a 16bit short in BE
872
public boolean removeMetricCollector ( final IGangliaMetricsCollector c ) { if ( c == null ) throw new IllegalArgumentException ( ) ; return metricCollectors . remove ( c ) ; }
Remove a metrics collector.
873
private void fillCommentCombo ( Combo combo ) { if ( previousComments == null ) { previousComments = new ArrayList ( ) ; } for ( int i = previousComments . size ( ) - 1 ; i >= 0 ; i -- ) { combo . add ( ( ( String ) previousComments . get ( i ) ) ) ; } combo . select ( 0 ) ; }
Fill the comments combobox with previous search entries.
874
public static synchronized void removeFromDisabledList ( String classname ) { DISABLED . remove ( classname ) ; }
Remove the supplied fully qualified class name from the list of disabled plugins
875
public void refresh ( CloudObject [ ] objects , CloudResponse < Integer > response ) { refreshImpl ( objects , response ) ; }
Refresh the given objects with data from the server if they were modified on the server (this is the asynchronous version of the method). This operation executes immeditely without waiting for commit.
876
public static String approxTimeUntil ( final int seconds ) { final StringBuilder sbuf = new StringBuilder ( ) ; approxTimeUntil ( sbuf , seconds ) ; return sbuf . toString ( ) ; }
Create a text representing a saying of approximate time until.
877
public static AccessibilityNodeInfoCompat searchFocus ( TraversalStrategy traversal , AccessibilityNodeInfoCompat currentFocus , int direction , NodeFilter filter ) { if ( traversal == null || currentFocus == null ) { return null ; } if ( filter == null ) { filter = DEFAULT_FILTER ; } AccessibilityNodeInfoCompat targetNode = AccessibilityNodeInfoCompat . obtain ( currentFocus ) ; Set < AccessibilityNodeInfoCompat > seenNodes = new HashSet < > ( ) ; try { do { seenNodes . add ( targetNode ) ; targetNode = traversal . findFocus ( targetNode , direction ) ; if ( seenNodes . contains ( targetNode ) ) { LogUtils . log ( AccessibilityNodeInfoUtils . class , Log . ERROR , "Found duplicate during traversal: %s" , targetNode . getInfo ( ) ) ; return null ; } } while ( targetNode != null && ! filter . accept ( targetNode ) ) ; } finally { AccessibilityNodeInfoUtils . recycleNodes ( seenNodes ) ; } return targetNode ; }
Search focus that satisfied specified node filter from currentFocus to specified direction according to OrderTraversal strategy
878
private void collectWrapperAndSuppressedInfo ( Matcher matcher ) throws AdeException { m_suppressedNonWrapperMessageCount ++ ; m_suppressedMessagesRemaining = Integer . parseInt ( matcher . group ( 1 ) ) ; m_suppressedMessagesRemaining -- ; m_messageInstanceWaiting = m_messageTextPreprocessor . getExtraMessage ( m_prevMessageInstance ) ; }
Record the wrapper and suppressed messages information by adding/subtracting from counts. Note, if the suppressed message is a wrapper, the wrapper message also needs to be outputted.
879
private static void assertMp4WebvttSubtitleEquals ( Subtitle sub , Cue ... expectedCues ) { assertEquals ( 1 , sub . getEventTimeCount ( ) ) ; assertEquals ( 0 , sub . getEventTime ( 0 ) ) ; List < Cue > subtitleCues = sub . getCues ( 0 ) ; assertEquals ( expectedCues . length , subtitleCues . size ( ) ) ; for ( int i = 0 ; i < subtitleCues . size ( ) ; i ++ ) { List < String > differences = getCueDifferences ( subtitleCues . get ( i ) , expectedCues [ i ] ) ; assertTrue ( "Cues at position " + i + " are not equal. Different fields are " + Arrays . toString ( differences . toArray ( ) ) , differences . isEmpty ( ) ) ; } }
Asserts that the Subtitle's cues (which are all part of the event at t=0) are equal to the expected Cues.
880
public String concatenate ( String start , List < String > chunks ) { StringBuffer buf ; if ( start == null ) { buf = new StringBuffer ( ) ; } else { buf = new StringBuffer ( start ) ; } if ( chunks != null ) { for ( String chunk : chunks ) { if ( chunk != null ) { buf . append ( chunk ) ; } } } return ( buf . length ( ) == 0 ) ? null : buf . toString ( ) ; }
Concatenates a single String and a List of String into a single long String.
881
public List < String > createEntity ( String ... entitiesAsJson ) throws AtlasServiceException { return createEntity ( new JSONArray ( Arrays . asList ( entitiesAsJson ) ) ) ; }
Create the given entity
882
private void populateCompletedActivitiSteps ( Job job , List < HistoricActivityInstance > historicActivitiTasks ) { List < WorkflowStep > completedWorkflowSteps = new ArrayList < > ( ) ; for ( HistoricActivityInstance historicActivityInstance : historicActivitiTasks ) { completedWorkflowSteps . add ( new WorkflowStep ( historicActivityInstance . getActivityId ( ) , historicActivityInstance . getActivityName ( ) , HerdDateUtils . getXMLGregorianCalendarValue ( historicActivityInstance . getStartTime ( ) ) , HerdDateUtils . getXMLGregorianCalendarValue ( historicActivityInstance . getEndTime ( ) ) ) ) ; } job . setCompletedWorkflowSteps ( completedWorkflowSteps ) ; }
Populates the job Object with completed workflow steps.
883
public static String join ( String separator , double ... elements ) { if ( elements == null || elements . length == 0 ) { return "" ; } List < Number > list = new ArrayList < Number > ( elements . length ) ; for ( Double elem : elements ) { list . add ( elem ) ; } return join ( separator , list ) ; }
Returns a string with all double values concatenated by a specified separator.
884
public double entropyNMISqrt ( ) { if ( entropyFirst ( ) * entropySecond ( ) <= 0 ) { return entropyMutualInformation ( ) ; } return ( entropyMutualInformation ( ) / Math . sqrt ( entropyFirst ( ) * entropySecond ( ) ) ) ; }
Get the sqrt-normalized mutual information (normalized, 0 = unequal)
885
public void applyAll ( Collection < ? extends IChange > changes ) throws BadLocationException { final Map < URI , List < IAtomicChange > > changesPerFile = organize ( changes ) ; for ( URI currURI : changesPerFile . keySet ( ) ) { final IXtextDocument document = getDocument ( currURI ) ; applyAllInSameDocument ( changesPerFile . get ( currURI ) , document ) ; } }
Applies all given changes.
886
public static Map < String , String > strToMap ( String str , String delim , boolean trim , String pairsSeparator ) { if ( str == null ) return null ; Map < String , String > decodedMap = new HashMap < String , String > ( ) ; List < String > elements = split ( str , delim ) ; pairsSeparator = pairsSeparator == null ? "=" : pairsSeparator ; for ( String s : elements ) { List < String > e = split ( s , pairsSeparator ) ; if ( e . size ( ) != 2 ) { continue ; } String name = e . get ( 0 ) ; String value = e . get ( 1 ) ; if ( trim ) { if ( name != null ) { name = name . trim ( ) ; } if ( value != null ) { value = value . trim ( ) ; } } try { decodedMap . put ( URLDecoder . decode ( name , "UTF-8" ) , URLDecoder . decode ( value , "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e1 ) { Debug . logError ( e1 , module ) ; } } return decodedMap ; }
Creates a Map from a name/value pair string
887
public Criteria or ( ) { Criteria criteria = createCriteriaInternal ( ) ; oredCriteria . add ( criteria ) ; return criteria ; }
This method was generated by MyBatis Generator. This method corresponds to the database table customer
888
private boolean linkLast ( Node < E > node ) { if ( count >= capacity ) return false ; Node < E > l = last ; node . prev = l ; last = node ; if ( first == null ) first = node ; else l . next = node ; ++ count ; notEmpty . signal ( ) ; return true ; }
Links node as last element, or returns false if full.
889
public static String now ( ) { Calendar cal = Calendar . getInstance ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( DATE_FORMAT_NOW ) ; return sdf . format ( cal . getTime ( ) ) ; }
Get the current date and time in a format so that sorting the string will sort the date.
890
private void doPostHelper ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { logger . log ( Level . INFO , "request: " + request . getRequestURI ( ) ) ; final RequestAndResponse requestAndResponse = new RequestAndResponse ( request , response ) ; standardResponseStuff ( requestAndResponse ) ; final String uri = request . getRequestURI ( ) ; requestAndResponse . setOverrideUri ( uri ) ; if ( uri . equals ( "/createQuotationJson" ) ) { handleJsonCreateQuotation ( requestAndResponse ) ; } else if ( uri . equals ( "/makeNotebook" ) ) { handleHtmlMakeNotebook ( requestAndResponse ) ; } else if ( uri . equals ( "/moveNotesJson" ) ) { handleJsonMoveNotes ( requestAndResponse ) ; } else if ( uri . equals ( "/noteOpJson" ) ) { handleJsonNoteOp ( requestAndResponse ) ; } else if ( uri . equals ( "/getNotebookPathJson" ) ) { handleJsonGetNotebookPath ( requestAndResponse ) ; } else if ( uri . equals ( "/makeChildrenJson" ) ) { handleJsonMakeChildren ( requestAndResponse ) ; } else if ( uri . equals ( "/makeSiblingsJson" ) ) { handleJsonMakeSiblings ( requestAndResponse ) ; } else if ( uri . equals ( "/signIn" ) ) { handleJsonSignIn ( requestAndResponse ) ; } else if ( uri . equals ( "/signOut" ) ) { handleJsonSignOut ( requestAndResponse ) ; } else if ( uri . equals ( "/createAccount" ) ) { handleJsonCreateAccount ( requestAndResponse ) ; } else if ( uri . startsWith ( "/doRestore/" ) ) { handleHtmlDoUserRestore ( requestAndResponse ) ; } else if ( uri . startsWith ( "/doOfflineBackup/" ) ) { handleHtmlDoOfflineDbBackup ( requestAndResponse ) ; } else if ( uri . startsWith ( "/doOnlineBackup/" ) ) { handleHtmlDoOnlineDbBackup ( requestAndResponse ) ; } else if ( uri . startsWith ( "/doClear/" ) ) { handleHtmlDoClear ( requestAndResponse ) ; } else if ( uri . startsWith ( "/doBackup/" ) ) { handleHtmlDoUserBackup ( requestAndResponse ) ; } else if ( uri . startsWith ( "/doShutdown/" ) ) { handleHtmlDoShutdown ( requestAndResponse ) ; } else if ( uri . startsWith ( "/doCheckForErrors/" ) ) { handleHtmlDoCheckForErrors ( requestAndResponse ) ; } else if ( uri . startsWith ( "/changePassword/" ) ) { handleHtmlChangePassword ( requestAndResponse ) ; } else if ( uri . startsWith ( "/changeAccount/" ) ) { handleHtmlChangeAccount ( requestAndResponse ) ; } else if ( uri . startsWith ( "/closeAccount/" ) ) { handleHtmlCloseAccount ( requestAndResponse ) ; } else if ( uri . equals ( "/saveOptions" ) ) { handleJsonSaveOptions ( requestAndResponse ) ; } else if ( uri . startsWith ( "/doExport/" ) ) { handleHtmlDoExport ( requestAndResponse ) ; } else { returnHtml404 ( requestAndResponse ) ; } }
Does the real work of doPost().
891
public void clearSelections ( ) { mSelectedTags . clear ( ) ; refreshSelectedTags ( ) ; }
Clears all the selected tags
892
@ Override public synchronized void addTestSetListener ( TestSetListener tsl ) { m_listeners . addElement ( tsl ) ; }
Add a listener for test sets
893
public void addObserver ( Observer observer ) { Assert . notNull ( "observer" , observer ) ; observers . addIfAbsent ( observer ) ; }
Adds an observer to the set of observers for this object.
894
protected void applyValue ( T value ) { bean . setValue ( property , value ) ; }
Applies the given value, which means that the property that this Configurator configures is set to the value.
895
protected Object convertAttributeValue ( Object value ) { if ( value == null || value instanceof String || value instanceof Byte || value instanceof Long || value instanceof Double || value instanceof Boolean || value instanceof Integer || value instanceof Short || value instanceof Float ) { return value ; } return value . toString ( ) ; }
Convert the attribute value if necessary.
896
@ Override public int hashCode ( ) { int myPosition = position ; int hash = 0 ; long l ; while ( myPosition < limit ) { l = Double . doubleToLongBits ( get ( myPosition ++ ) ) ; hash = hash + ( ( int ) l ) ^ ( ( int ) ( l > > 32 ) ) ; } return hash ; }
Calculates this buffer's hash code from the remaining chars. The position, limit, capacity and mark don't affect the hash code.
897
private void onLocationChangedAsync ( Location location ) { try { if ( ! isRecording ( ) || isPaused ( ) ) { Log . w ( TAG , "Ignore onLocationChangedAsync. Not recording or paused." ) ; return ; } Track track = myTracksProviderUtils . getTrack ( recordingTrackId ) ; if ( track == null ) { Log . w ( TAG , "Ignore onLocationChangedAsync. No track." ) ; return ; } if ( ! LocationUtils . isValidLocation ( location ) ) { Log . w ( TAG , "Ignore onLocationChangedAsync. location is invalid." ) ; return ; } if ( ! location . hasAccuracy ( ) || location . getAccuracy ( ) >= recordingGpsAccuracy ) { Log . d ( TAG , "Ignore onLocationChangedAsync. Poor accuracy." ) ; return ; } if ( location . getTime ( ) == 0L ) { location . setTime ( System . currentTimeMillis ( ) ) ; } Location lastValidTrackPoint = getLastValidTrackPointInCurrentSegment ( track . getId ( ) ) ; long idleTime = 0L ; if ( lastValidTrackPoint != null && location . getTime ( ) > lastValidTrackPoint . getTime ( ) ) { idleTime = location . getTime ( ) - lastValidTrackPoint . getTime ( ) ; } locationListenerPolicy . updateIdleTime ( idleTime ) ; if ( currentRecordingInterval != locationListenerPolicy . getDesiredPollingInterval ( ) ) { registerLocationListener ( ) ; } SensorDataSet sensorDataSet = getSensorDataSet ( ) ; if ( sensorDataSet != null ) { location = new MyTracksLocation ( location , sensorDataSet ) ; } if ( ! currentSegmentHasLocation ) { insertLocation ( track , location , null ) ; currentSegmentHasLocation = true ; lastLocation = location ; return ; } if ( ! LocationUtils . isValidLocation ( lastValidTrackPoint ) ) { insertLocation ( track , location , null ) ; lastLocation = location ; return ; } double distanceToLastTrackLocation = location . distanceTo ( lastValidTrackPoint ) ; if ( distanceToLastTrackLocation > maxRecordingDistance ) { insertLocation ( track , lastLocation , lastValidTrackPoint ) ; Location pause = new Location ( LocationManager . GPS_PROVIDER ) ; pause . setLongitude ( 0 ) ; pause . setLatitude ( PAUSE_LATITUDE ) ; pause . setTime ( lastLocation . getTime ( ) ) ; insertLocation ( track , pause , null ) ; insertLocation ( track , location , null ) ; isIdle = false ; } else if ( sensorDataSet != null || distanceToLastTrackLocation >= recordingDistanceInterval ) { insertLocation ( track , lastLocation , lastValidTrackPoint ) ; insertLocation ( track , location , null ) ; isIdle = false ; } else if ( ! isIdle && location . hasSpeed ( ) && location . getSpeed ( ) < MAX_NO_MOVEMENT_SPEED ) { insertLocation ( track , lastLocation , lastValidTrackPoint ) ; insertLocation ( track , location , null ) ; isIdle = true ; } else if ( isIdle && location . hasSpeed ( ) && location . getSpeed ( ) >= MAX_NO_MOVEMENT_SPEED ) { insertLocation ( track , lastLocation , lastValidTrackPoint ) ; insertLocation ( track , location , null ) ; isIdle = false ; } else { Log . d ( TAG , "Not recording location, idle" ) ; } lastLocation = location ; } catch ( Error e ) { Log . e ( TAG , "Error in onLocationChangedAsync" , e ) ; throw e ; } catch ( RuntimeException e ) { Log . e ( TAG , "RuntimeException in onLocationChangedAsync" , e ) ; throw e ; } }
Called when location changed.
898
public static byte [ ] decode ( String str , int flags ) { return decode ( str . getBytes ( ) , flags ) ; }
Decode the Base64-encoded data in input and return the data in a new byte array. <p/> <p>The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
899
public void lockUI ( ProcessInfo pi ) { m_isLocked = true ; }
Lock User Interface Called from the Worker before processing