idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
40,300 | public static HeuristicFunction < City , Double > heuristicFunction ( ) { return new HeuristicFunction < City , Double > ( ) { @ Override public Double estimate ( City state ) { return heuristics ( ) . get ( state ) ; } } ; } | Heuristic function required to define search problems to be used with Hipster . | 56 | 15 |
40,301 | public static < S > UnweightedNode < Void , S > newNodeWithoutAction ( UnweightedNode < Void , S > previousNode , S state ) { return new UnweightedNode < Void , S > ( previousNode , state , null ) ; } | This static method creates an unweighted node without defining an explicit action using the parent node and a state . | 56 | 22 |
40,302 | public static < T extends GraphNode < T > > T getFirstChild ( T node ) { return hasChildren ( node ) ? node . getChildren ( ) . get ( 0 ) : null ; } | Returns the first child node of the given node or null if node is null or does not have any children . | 42 | 22 |
40,303 | public static < T extends GraphNode < T > > T getLastChild ( T node ) { return hasChildren ( node ) ? node . getChildren ( ) . get ( node . getChildren ( ) . size ( ) - 1 ) : null ; } | Returns the last child node of the given node or null if node is null or does not have any children . | 53 | 22 |
40,304 | public static < T extends GraphNode < T > > int countAllDistinct ( T node ) { if ( node == null ) return 0 ; return collectAllNodes ( node , new HashSet < T > ( ) ) . size ( ) ; } | Counts all distinct nodes in the graph reachable from the given node . This method can properly deal with cycles in the graph . | 53 | 26 |
40,305 | public static < T extends GraphNode < T > , C extends Collection < T > > C collectAllNodes ( T node , C collection ) { // we don't recurse if the collecion already contains the node // this costs a bit of performance but prevents infinite recursion in the case of graph cycles checkArgNotNull ( collection , "collection"... | Collects all nodes from the graph reachable from the given node in the given collection . This method can properly deal with cycles in the graph . | 127 | 29 |
40,306 | public static < T extends GraphNode < T > > String printTree ( T node , Formatter < T > formatter ) { checkArgNotNull ( formatter , "formatter" ) ; return printTree ( node , formatter , Predicates . < T > alwaysTrue ( ) , Predicates . < T > alwaysTrue ( ) ) ; } | Creates a string representation of the graph reachable from the given node using the given formatter . | 74 | 20 |
40,307 | private static < T extends GraphNode < T > > StringBuilder printTree ( T node , Formatter < T > formatter , String indent , StringBuilder sb , Predicate < T > nodeFilter , Predicate < T > subTreeFilter ) { if ( nodeFilter . apply ( node ) ) { String line = formatter . format ( node ) ; if ( line != null ) { sb . append... | private recursion helper | 162 | 4 |
40,308 | public static boolean isBoxedType ( Class < ? > primitive , Class < ? > boxed ) { return ( primitive . equals ( boolean . class ) && boxed . equals ( Boolean . class ) ) || ( primitive . equals ( byte . class ) && boxed . equals ( Byte . class ) ) || ( primitive . equals ( char . class ) && boxed . equals ( Character .... | Determines if the primitive type is boxed as the boxed type | 203 | 13 |
40,309 | public static Constructor findConstructor ( Class < ? > type , Object [ ] args ) { outer : for ( Constructor constructor : type . getConstructors ( ) ) { Class < ? > [ ] paramTypes = constructor . getParameterTypes ( ) ; if ( paramTypes . length != args . length ) continue ; for ( int i = 0 ; i < args . length ; i ++ )... | Finds the constructor of the given class that is compatible with the given arguments . | 197 | 16 |
40,310 | public static String humanize ( long value ) { if ( value < 0 ) { return ' ' + humanize ( - value ) ; } else if ( value > 1000000000000000000L ) { return Double . toString ( ( value + 500000000000000L ) / 1000000000000000L * 1000000000000000L / 1000000000000000000.0 ) + ' ' ; } else if ( value > 100000000000000000L ) {... | Formats the given long value into a human readable notation using the Kilo Mega Giga etc . abbreviations . | 681 | 23 |
40,311 | @ Override protected Rule fromStringLiteral ( String string ) { return string . endsWith ( " " ) ? Sequence ( String ( string . substring ( 0 , string . length ( ) - 1 ) ) , WhiteSpace ( ) ) : String ( string ) ; } | character or string literal | 58 | 4 |
40,312 | static Matcher findProperLabelMatcher ( MatcherPath path , int errorIndex ) { try { return findProperLabelMatcher0 ( path , errorIndex ) ; } catch ( RuntimeException e ) { if ( e == UnderneathTestNot ) return null ; else throw e ; } } | Finds the Matcher in the given failedMatcherPath whose label is best for presentation in expected strings of parse error messages given the provided lastMatchPath . | 63 | 32 |
40,313 | public static String printParseErrors ( List < ParseError > errors ) { checkArgNotNull ( errors , "errors" ) ; StringBuilder sb = new StringBuilder ( ) ; for ( ParseError error : errors ) { if ( sb . length ( ) > 0 ) sb . append ( "---\n" ) ; sb . append ( printParseError ( error ) ) ; } return sb . toString ( ) ; } | Pretty prints the given parse errors showing their location in the given input buffer . | 99 | 15 |
40,314 | public static String printParseError ( ParseError error , Formatter < InvalidInputError > formatter ) { checkArgNotNull ( error , "error" ) ; checkArgNotNull ( formatter , "formatter" ) ; String message = error . getErrorMessage ( ) != null ? error . getErrorMessage ( ) : error instanceof InvalidInputError ? formatter ... | Pretty prints the given parse error showing its location in the given input buffer . | 150 | 15 |
40,315 | public static String repeat ( char c , int n ) { char [ ] array = new char [ n ] ; Arrays . fill ( array , c ) ; return String . valueOf ( array ) ; } | Creates a string consisting of n times the given character . | 43 | 12 |
40,316 | public static boolean startsWith ( String string , String prefix ) { return string != null && ( prefix == null || string . startsWith ( prefix ) ) ; } | Test whether a string starts with a given prefix handling null values without exceptions . | 33 | 15 |
40,317 | private static int getLine0 ( int [ ] newlines , int index ) { int j = Arrays . binarySearch ( newlines , index ) ; return j >= 0 ? j : - ( j + 1 ) ; } | returns the zero based input line number the character with the given index is found in | 47 | 17 |
40,318 | public boolean enterFrame ( ) { if ( level ++ > 0 ) { if ( stack == null ) stack = new LinkedList < T > ( ) ; stack . add ( get ( ) ) ; } return set ( initialValueFactory . create ( ) ) ; } | Provides a new frame for the variable . Potentially existing previous frames are saved . Normally you do not have to call this method manually as parboiled provides for automatic Var frame management . | 56 | 38 |
40,319 | public static Matcher unwrap ( Matcher matcher ) { if ( matcher instanceof MemoMismatchesMatcher ) { MemoMismatchesMatcher memoMismatchesMatcher = ( MemoMismatchesMatcher ) matcher ; return unwrap ( memoMismatchesMatcher . inner ) ; } return matcher ; } | Retrieves the innermost Matcher that is not a MemoMismatchesMatcher . | 74 | 20 |
40,320 | public String [ ] getLabels ( Matcher matcher ) { if ( ( matcher instanceof AnyOfMatcher ) && ( ( AnyOfMatcher ) matcher ) . characters . toString ( ) . equals ( matcher . getLabel ( ) ) ) { AnyOfMatcher cMatcher = ( AnyOfMatcher ) matcher ; if ( ! cMatcher . characters . isSubtractive ( ) ) { String [ ] labels = new S... | Gets the labels corresponding to the given matcher AnyOfMatchers are treated specially in that their label is constructed as a list of their contents | 185 | 29 |
40,321 | public static Matcher unwrap ( Matcher matcher ) { if ( matcher instanceof VarFramingMatcher ) { VarFramingMatcher varFramingMatcher = ( VarFramingMatcher ) matcher ; return unwrap ( varFramingMatcher . inner ) ; } return matcher ; } | Retrieves the innermost Matcher that is not a VarFramingMatcher . | 66 | 18 |
40,322 | public static Class < ? > findLoadedClass ( String className , ClassLoader classLoader ) { checkArgNotNull ( className , "className" ) ; checkArgNotNull ( classLoader , "classLoader" ) ; try { Class < ? > classLoaderBaseClass = Class . forName ( "java.lang.ClassLoader" ) ; Method findLoadedClassMethod = classLoaderBase... | Returns the class with the given name if it has already been loaded by the given class loader . Otherwise the method returns null . | 198 | 25 |
40,323 | public static boolean isAssignableTo ( String classInternalName , Class < ? > type ) { checkArgNotNull ( classInternalName , "classInternalName" ) ; checkArgNotNull ( type , "type" ) ; return type . isAssignableFrom ( getClassForInternalName ( classInternalName ) ) ; } | Determines whether the class with the given descriptor is assignable to the given type . | 71 | 18 |
40,324 | public static < T extends TreeNode < T > > T getRoot ( T node ) { if ( node == null ) return null ; if ( node . getParent ( ) != null ) return getRoot ( node . getParent ( ) ) ; return node ; } | Returns the root of the tree the given node is part of . | 55 | 13 |
40,325 | public static < T extends MutableTreeNode < T > > void addChild ( T parent , T child ) { checkArgNotNull ( parent , "parent" ) ; parent . addChild ( parent . getChildren ( ) . size ( ) , child ) ; } | Adds a new child node to a given MutableTreeNode parent . | 56 | 14 |
40,326 | public static < T extends MutableTreeNode < T > > void removeChild ( T parent , T child ) { checkArgNotNull ( parent , "parent" ) ; int index = parent . getChildren ( ) . indexOf ( child ) ; checkElementIndex ( index , parent . getChildren ( ) . size ( ) ) ; parent . removeChild ( index ) ; } | Removes the given child from the given parent node . | 79 | 11 |
40,327 | Rule ArrayCreatorRest ( ) { return Sequence ( LBRK , FirstOf ( Sequence ( RBRK , ZeroOrMore ( Dim ( ) ) , ArrayInitializer ( ) ) , Sequence ( Expression ( ) , RBRK , ZeroOrMore ( DimExpr ( ) ) , ZeroOrMore ( Dim ( ) ) ) ) ) ; } | BasicType must be followed by at least one DimExpr or by ArrayInitializer . | 74 | 18 |
40,328 | public T getAndSet ( T value ) { T t = this . value ; this . value = value ; return t ; } | Replaces this references value with the given one . | 27 | 10 |
40,329 | private static void verify ( char [ ] [ ] strings ) { int length = strings . length ; for ( int i = 0 ; i < length ; i ++ ) { char [ ] a = strings [ i ] ; inner : for ( int j = i + 1 ; j < length ; j ++ ) { char [ ] b = strings [ j ] ; if ( b . length < a . length ) continue ; for ( int k = 0 ; k < a . length ; k ++ ) ... | but match in the fast implementation | 244 | 6 |
40,330 | public static < V > Node < V > findNode ( Node < V > parent , Predicate < Node < V > > predicate ) { checkArgNotNull ( predicate , "predicate" ) ; if ( parent != null ) { if ( predicate . apply ( parent ) ) return parent ; if ( hasChildren ( parent ) ) { Node < V > found = findNode ( parent . getChildren ( ) , predicat... | Returns the first node underneath the given parent for which the given predicate evaluates to true . If parent is null or no node is found the method returns null . | 104 | 31 |
40,331 | public static < V > Node < V > findNode ( List < Node < V > > parents , Predicate < Node < V > > predicate ) { checkArgNotNull ( predicate , "predicate" ) ; if ( parents != null && ! parents . isEmpty ( ) ) { for ( Node < V > child : parents ) { Node < V > found = findNode ( child , predicate ) ; if ( found != null ) r... | Returns the first node underneath the given parents for which the given predicate evaluates to true . If parents is null or empty or no node is found the method returns null . | 100 | 33 |
40,332 | public static < V > Node < V > findNodeByLabel ( Node < V > parent , String labelPrefix ) { return findNode ( parent , new LabelPrefixPredicate < V > ( labelPrefix ) ) ; } | Returns the first node underneath the given parent for which matches the given label prefix . If parents is null or empty or no node is found the method returns null . | 49 | 32 |
40,333 | public static < V > Node < V > findNodeByLabel ( List < Node < V > > parents , String labelPrefix ) { return findNode ( parents , new LabelPrefixPredicate < V > ( labelPrefix ) ) ; } | Returns the first node underneath the given parents which matches the given label prefix . If parents is null or empty or no node is found the method returns null . | 52 | 31 |
40,334 | public static < V > Node < V > findLastNode ( List < Node < V > > parents , Predicate < Node < V > > predicate ) { checkArgNotNull ( predicate , "predicate" ) ; if ( parents != null && ! parents . isEmpty ( ) ) { int parentsSize = parents . size ( ) ; for ( int i = parentsSize - 1 ; i >= 0 ; i -- ) { Node < V > found =... | Returns the last node underneath the given parents for which the given predicate evaluates to true . If parents is null or empty or no node is found the method returns null . | 124 | 33 |
40,335 | public static < V , C extends Collection < Node < V > > > C collectNodes ( Node < V > parent , Predicate < Node < V > > predicate , C collection ) { checkArgNotNull ( predicate , "predicate" ) ; checkArgNotNull ( collection , "collection" ) ; return parent != null && hasChildren ( parent ) ? collectNodes ( parent . get... | Collects all nodes underneath the given parent for which the given predicate evaluates to true . | 95 | 17 |
40,336 | public static String getNodeText ( Node < ? > node , InputBuffer inputBuffer ) { checkArgNotNull ( node , "node" ) ; checkArgNotNull ( inputBuffer , "inputBuffer" ) ; if ( node . hasError ( ) ) { // if the node has a parse error we cannot simply cut a string out of the underlying input buffer, since we // would also in... | Returns the input text matched by the given node with error correction . | 320 | 13 |
40,337 | public static < V , C extends Collection < Node < V > > > C collectNodes ( List < Node < V > > parents , Predicate < Node < V > > predicate , C collection ) { checkArgNotNull ( predicate , "predicate" ) ; checkArgNotNull ( collection , "collection" ) ; if ( parents != null && ! parents . isEmpty ( ) ) { for ( Node < V ... | Collects all nodes underneath the given parents for which the given predicate evaluates to true . | 129 | 17 |
40,338 | public static String collectContent ( InputBuffer buf ) { StringBuilder sb = new StringBuilder ( ) ; int ix = 0 ; loop : while ( true ) { char c = buf . charAt ( ix ++ ) ; switch ( c ) { case INDENT : sb . append ( ' ' ) ; // right pointed double angle quotation mark break ; case DEDENT : sb . append ( ' ' ) ; // left ... | Collects the actual input text the input buffer provides into a String . This is especially useful for IndentDedentInputBuffers created by transformIndents . | 128 | 33 |
40,339 | public boolean append ( char c ) { return set ( get ( ) == null ? String . valueOf ( c ) : get ( ) + c ) ; } | Appends the given char . If this instance is currently uninitialized the given char is used for initialization . | 33 | 21 |
40,340 | public static void ensure ( boolean condition , String errorMessageFormat , Object ... errorMessageArgs ) { if ( ! condition ) { throw new GrammarException ( errorMessageFormat , errorMessageArgs ) ; } } | Throws a GrammarException if the given condition is not met . | 43 | 14 |
40,341 | private void sort ( InstructionGroup group ) { final InsnList instructions = method . instructions ; Collections . sort ( group . getNodes ( ) , new Comparator < InstructionGraphNode > ( ) { public int compare ( InstructionGraphNode a , InstructionGraphNode b ) { return Integer . valueOf ( instructions . indexOf ( a . ... | sort the group instructions according to their method index | 101 | 9 |
40,342 | private void markUngroupedEnclosedNodes ( InstructionGroup group ) { while_ : while ( true ) { for ( int i = getIndexOfFirstInsn ( group ) , max = getIndexOfLastInsn ( group ) ; i < max ; i ++ ) { InstructionGraphNode node = method . getGraphNodes ( ) . get ( i ) ; if ( node . getGroup ( ) == null ) { markGroup ( node ... | also capture all group nodes hidden behind xLoads | 114 | 10 |
40,343 | public boolean isPrefixOf ( MatcherPath that ) { checkArgNotNull ( that , "that" ) ; return element . level <= that . element . level && ( this == that || ( that . parent != null && isPrefixOf ( that . parent ) ) ) ; } | Determines whether this path is a prefix of the given other path . | 61 | 15 |
40,344 | public Element getElementAtLevel ( int level ) { checkArgument ( level >= 0 ) ; if ( level > element . level ) return null ; if ( level < element . level ) return parent . getElementAtLevel ( level ) ; return element ; } | Returns the Element at the given level . | 54 | 8 |
40,345 | public MatcherPath commonPrefix ( MatcherPath that ) { checkArgNotNull ( that , "that" ) ; if ( element . level > that . element . level ) return parent . commonPrefix ( that ) ; if ( element . level < that . element . level ) return commonPrefix ( that . parent ) ; if ( this == that ) return this ; return ( parent != ... | Returns the common prefix of this MatcherPath and the given other one . | 106 | 15 |
40,346 | public boolean contains ( Matcher matcher ) { return element . matcher == matcher || ( parent != null && parent . contains ( matcher ) ) ; } | Determines whether the given matcher is contained in this path . | 34 | 14 |
40,347 | public static Predicate < Matcher > preventLoops ( ) { return new Predicate < Matcher > ( ) { private final Set < Matcher > visited = new HashSet < Matcher > ( ) ; public boolean apply ( Matcher node ) { node = unwrap ( node ) ; if ( visited . contains ( node ) ) { return false ; } visited . add ( node ) ; return true ... | A predicate for rule tree printing . Prevents SOEs by detecting and suppressing loops in the rule tree . | 89 | 21 |
40,348 | private void extractInstructions ( InstructionGroup group ) { for ( InstructionGraphNode node : group . getNodes ( ) ) { if ( node != group . getRoot ( ) ) { AbstractInsnNode insn = node . getInstruction ( ) ; method . instructions . remove ( insn ) ; group . getInstructions ( ) . add ( insn ) ; } } } | move all group instructions except for the root from the underlying method into the groups Insnlist | 81 | 18 |
40,349 | private void extractFields ( InstructionGroup group ) { List < FieldNode > fields = group . getFields ( ) ; for ( InstructionGraphNode node : group . getNodes ( ) ) { if ( node . isXLoad ( ) ) { VarInsnNode insn = ( VarInsnNode ) node . getInstruction ( ) ; // check whether we already have a field for the var with this... | create FieldNodes for all xLoad instructions | 304 | 9 |
40,350 | private synchronized void name ( InstructionGroup group , ParserClassNode classNode ) { // generate an MD5 hash across the buffer, use only the first 96 bit MD5Digester digester = new MD5Digester ( classNode . name ) ; group . getInstructions ( ) . accept ( digester ) ; for ( FieldNode field : group . getFields ( ) ) d... | set a group name base on the hash across all group instructions and fields | 200 | 14 |
40,351 | public Characters add ( Characters other ) { checkArgNotNull ( other , "other" ) ; if ( ! subtractive && ! other . subtractive ) { return addToChars ( other . chars ) ; } if ( subtractive && other . subtractive ) { return retainAllChars ( other . chars ) ; } return subtractive ? removeFromChars ( other . chars ) : othe... | Returns a new Characters object containing all the characters of this instance plus all characters of the given instance . | 93 | 20 |
40,352 | public Characters remove ( Characters other ) { checkArgNotNull ( other , "other" ) ; if ( ! subtractive && ! other . subtractive ) { return removeFromChars ( other . chars ) ; } if ( subtractive && other . subtractive ) { return new Characters ( false , other . removeFromChars ( chars ) . chars ) ; } return subtractiv... | Returns a new Characters object containing all the characters of this instance minus all characters of the given instance . | 101 | 20 |
40,353 | public boolean overlapsWith ( IndexRange other ) { checkArgNotNull ( other , "other" ) ; return end > other . start && other . end > start ; } | Determines whether this range overlaps with the given other one . | 37 | 14 |
40,354 | public boolean touches ( IndexRange other ) { checkArgNotNull ( other , "other" ) ; return other . end == start || end == other . start ; } | Determines whether this range immediated follows or precedes the given other one . | 35 | 17 |
40,355 | public IndexRange mergedWith ( IndexRange other ) { checkArgNotNull ( other , "other" ) ; return new IndexRange ( Math . min ( start , other . start ) , Math . max ( end , other . end ) ) ; } | Created a new IndexRange that spans all characters between the smallest and the highest index of the two ranges . | 52 | 21 |
40,356 | private Paint getPreparedPaint ( ) { getActionButton ( ) . resetPaint ( ) ; Paint paint = getActionButton ( ) . getPaint ( ) ; paint . setStyle ( Paint . Style . FILL ) ; paint . setColor ( getActionButton ( ) . getButtonColorRipple ( ) ) ; return paint ; } | Returns the paint which is prepared for Ripple Effect drawing | 74 | 10 |
40,357 | private void initShadowRadius ( TypedArray attrs ) { int index = R . styleable . ActionButton_shadow_radius ; if ( attrs . hasValue ( index ) ) { shadowRadius = attrs . getDimension ( index , shadowRadius ) ; LOGGER . trace ( "Initialized Action Button shadow radius: {}" , getShadowRadius ( ) ) ; } } | Initializes the shadow radius | 84 | 5 |
40,358 | private void initShadowXOffset ( TypedArray attrs ) { int index = R . styleable . ActionButton_shadow_xOffset ; if ( attrs . hasValue ( index ) ) { shadowXOffset = attrs . getDimension ( index , shadowXOffset ) ; LOGGER . trace ( "Initialized Action Button X-axis offset: {}" , getShadowXOffset ( ) ) ; } } | Initializes the shadow X - axis offset | 87 | 8 |
40,359 | private void initShadowYOffset ( TypedArray attrs ) { int index = R . styleable . ActionButton_shadow_yOffset ; if ( attrs . hasValue ( index ) ) { shadowYOffset = attrs . getDimension ( index , shadowYOffset ) ; LOGGER . trace ( "Initialized Action Button shadow Y-axis offset: {}" , getShadowYOffset ( ) ) ; } } | Initializes the shadow Y - axis offset | 88 | 8 |
40,360 | private void initShadowColor ( TypedArray attrs ) { int index = R . styleable . ActionButton_shadow_color ; if ( attrs . hasValue ( index ) ) { shadowColor = attrs . getColor ( index , shadowColor ) ; LOGGER . trace ( "Initialized Action Button shadow color: {}" , getShadowColor ( ) ) ; } } | Initializes the shadow color | 79 | 5 |
40,361 | private void initShadowResponsiveEffectEnabled ( TypedArray attrs ) { int index = R . styleable . ActionButton_shadowResponsiveEffect_enabled ; if ( attrs . hasValue ( index ) ) { shadowResponsiveEffectEnabled = attrs . getBoolean ( index , shadowResponsiveEffectEnabled ) ; LOGGER . trace ( "Initialized Action Button S... | Initializes the Shadow Responsive Effect | 103 | 7 |
40,362 | private void initStrokeWidth ( TypedArray attrs ) { int index = R . styleable . ActionButton_stroke_width ; if ( attrs . hasValue ( index ) ) { strokeWidth = attrs . getDimension ( index , strokeWidth ) ; LOGGER . trace ( "Initialized Action Button stroke width: {}" , getStrokeWidth ( ) ) ; } } | Initializes the stroke width | 84 | 5 |
40,363 | private void initStrokeColor ( TypedArray attrs ) { int index = R . styleable . ActionButton_stroke_color ; if ( attrs . hasValue ( index ) ) { strokeColor = attrs . getColor ( index , strokeColor ) ; LOGGER . trace ( "Initialized Action Button stroke color: {}" , getStrokeColor ( ) ) ; } } | Initializes the stroke color | 83 | 5 |
40,364 | @ SuppressWarnings ( "all" ) @ Override public void startAnimation ( Animation animation ) { if ( animation != null && ( getAnimation ( ) == null || getAnimation ( ) . hasEnded ( ) ) ) { super . startAnimation ( animation ) ; } } | Adds additional checking whether animation is null before starting to play it | 60 | 12 |
40,365 | @ TargetApi ( Build . VERSION_CODES . LOLLIPOP ) private boolean hasElevation ( ) { return Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP && getElevation ( ) > 0.0f ; } | Checks whether view elevation is enabled | 65 | 7 |
40,366 | protected void drawStroke ( Canvas canvas ) { resetPaint ( ) ; getPaint ( ) . setStyle ( Paint . Style . STROKE ) ; getPaint ( ) . setStrokeWidth ( getStrokeWidth ( ) ) ; getPaint ( ) . setColor ( getStrokeColor ( ) ) ; canvas . drawCircle ( calculateCenterX ( ) , calculateCenterY ( ) , calculateCircleRadius ( ) , getP... | Draws stroke around the main circle | 124 | 7 |
40,367 | protected void drawImage ( Canvas canvas ) { int startPointX = ( int ) ( calculateCenterX ( ) - getImageSize ( ) / 2 ) ; int startPointY = ( int ) ( calculateCenterY ( ) - getImageSize ( ) / 2 ) ; int endPointX = ( int ) ( startPointX + getImageSize ( ) ) ; int endPointY = ( int ) ( startPointY + getImageSize ( ) ) ; g... | Draws the image centered inside the view | 197 | 8 |
40,368 | @ Override protected void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { super . onMeasure ( widthMeasureSpec , heightMeasureSpec ) ; LOGGER . trace ( "Called Action Button onMeasure" ) ; setMeasuredDimension ( calculateMeasuredWidth ( ) , calculateMeasuredHeight ( ) ) ; LOGGER . trace ( "Measured the Act... | Sets the measured dimension for the entire view | 103 | 9 |
40,369 | private int calculateShadowWidth ( ) { float mShadowRadius = isShadowResponsiveEffectEnabled ( ) ? ( ( ShadowResponsiveDrawer ) shadowResponsiveDrawer ) . getMaxShadowRadius ( ) : getShadowRadius ( ) ; int shadowWidth = hasShadow ( ) ? ( int ) ( ( mShadowRadius + Math . abs ( getShadowXOffset ( ) ) ) * 2 ) : 0 ; LOGGER... | Calculates shadow width in actual pixels | 118 | 8 |
40,370 | private int calculateShadowHeight ( ) { float mShadowRadius = isShadowResponsiveEffectEnabled ( ) ? ( ( ShadowResponsiveDrawer ) shadowResponsiveDrawer ) . getMaxShadowRadius ( ) : getShadowRadius ( ) ; int shadowHeight = hasShadow ( ) ? ( int ) ( ( mShadowRadius + Math . abs ( getShadowYOffset ( ) ) ) * 2 ) : 0 ; LOGG... | Calculates shadow height in actual pixels | 118 | 8 |
40,371 | void invalidate ( ) { if ( isInvalidationRequired ( ) ) { view . postInvalidate ( ) ; LOGGER . trace ( "Called view invalidation" ) ; } if ( isInvalidationDelayedRequired ( ) ) { view . postInvalidateDelayed ( getInvalidationDelay ( ) ) ; LOGGER . trace ( "Called view delayed invalidation. Delay time is: {}" , getInval... | Invalidates the view based on the current invalidator configuration | 103 | 11 |
40,372 | boolean isInsideCircle ( float centerPointX , float centerPointY , float radius ) { double xValue = Math . pow ( ( getX ( ) - centerPointX ) , 2 ) ; double yValue = Math . pow ( ( getY ( ) - centerPointY ) , 2 ) ; double radiusValue = Math . pow ( radius , 2 ) ; boolean touchPointInsideCircle = xValue + yValue <= radiu... | Checks whether the touch point is inside the circle or not | 135 | 12 |
40,373 | public List < Classification . RuntimeClassification > getClassifications ( ) { List < Classification . RuntimeClassification > result = new ArrayList <> ( ) ; getClassifications ( result , tree . getRoot ( ) ) ; return result ; } | Returns list of bottom level classes | 51 | 6 |
40,374 | public static JSONObject getStepAsJSON ( Machine machine , boolean verbose , boolean showUnvisited ) { JSONObject object = new JSONObject ( ) ; if ( verbose ) { object . put ( "modelName" , FilenameUtils . getBaseName ( machine . getCurrentContext ( ) . getModel ( ) . getName ( ) ) ) ; } if ( machine . getCurrentContex... | Will create a JSON formatted string representing the current step . The step is the current element which can be either a vertex orn an edge . | 696 | 27 |
40,375 | private static void next ( ) { final short t0 = s0 ; short t1 = s1 ; t1 ^= t0 ; s0 = ( short ) ( rotl ( t0 , 8 ) ^ t1 ^ t1 << 5 ) ; s1 = rotl ( t1 , 13 ) ; } | 8 - 5 - 13 x^32 + x^19 + x^10 + x^9 + x^8 + x^6 + x^5 + x^4 + x^2 + x + 1 | 67 | 44 |
40,376 | private static long [ ] computeParameters ( final LongIterator iterator ) { long v = - 1 , prev = - 1 , c = 0 ; while ( iterator . hasNext ( ) ) { v = iterator . nextLong ( ) ; if ( prev > v ) throw new IllegalArgumentException ( "The list of values is not monotone: " + prev + " > " + v ) ; prev = v ; c ++ ; } return n... | Computes the number of elements and the last element returned by the given iterator . | 103 | 16 |
40,377 | public static long [ ] [ ] preprocessJenkins ( final BitVector bv , final long seed ) { final long length = bv . length ( ) ; final int wordLength = ( int ) ( length / ( Long . SIZE * 3 ) ) + 1 ; final long aa [ ] = new long [ wordLength ] , bb [ ] = new long [ wordLength ] , cc [ ] = new long [ wordLength ] ; long a ,... | Preprocesses a bit vector so that Jenkins 64 - bit hashing can be computed in constant time on all prefixes . | 520 | 24 |
40,378 | public static long murmur ( final BitVector bv , final long seed ) { long h = seed , k ; long from = 0 ; final long length = bv . length ( ) ; while ( length - from >= Long . SIZE ) { k = bv . getLong ( from , from += Long . SIZE ) ; k *= M ; k ^= k >>> R ; k *= M ; h ^= k ; h *= M ; } if ( length > from ) { k = bv . g... | MurmurHash 64 - bit | 181 | 6 |
40,379 | public static long murmur ( final BitVector bv , final long prefixLength , final long [ ] state ) { final long precomputedUpTo = prefixLength - prefixLength % Long . SIZE ; long h = state [ ( int ) ( precomputedUpTo / Long . SIZE ) ] , k ; if ( prefixLength > precomputedUpTo ) { k = bv . getLong ( precomputedUpTo , pre... | Constant - time MurmurHash 64 - bit hashing for any prefix . | 161 | 15 |
40,380 | public static long murmur ( final BitVector bv , final long prefixLength , final long [ ] state , final long lcp ) { final int startStateWord = ( int ) ( Math . min ( lcp , prefixLength ) / Long . SIZE ) ; long h = state [ startStateWord ] , k ; long from = startStateWord * Long . SIZE ; while ( prefixLength - from >= ... | Constant - time MurmurHash 64 - bit hashing reusing precomputed state partially . | 225 | 19 |
40,381 | public static long [ ] preprocessMurmur ( final BitVector bv , final long seed ) { long h = seed , k ; long from = 0 ; final long length = bv . length ( ) ; final int wordLength = ( int ) ( length / Long . SIZE ) ; final long state [ ] = new long [ wordLength + 1 ] ; int i = 0 ; state [ i ++ ] = h ; for ( ; length - fr... | Preprocesses a bit vector so that MurmurHash 64 - bit can be computed in constant time on all prefixes . | 162 | 25 |
40,382 | public static long murmur3 ( final BitVector bv , final long seed ) { long h1 = 0x9368e53c2f6af274 L ^ seed ; long h2 = 0x586dcd208f7cd3fd L ^ seed ; long c1 = 0x87c37b91114253d5 L ; long c2 = 0x4cf5ad432745937f L ; long from = 0 ; final long length = bv . length ( ) ; long k1 , k2 ; while ( length - from >= Long . SIZ... | MurmurHash3 64 - bit | 625 | 7 |
40,383 | public static void murmur3 ( final BitVector bv , final long prefixLength , final long [ ] hh1 , final long [ ] hh2 , final long [ ] cc1 , final long cc2 [ ] , final long h [ ] ) { final int startStateWord = ( int ) ( prefixLength / ( 2 * Long . SIZE ) ) ; long precomputedUpTo = startStateWord * 2L * Long . SIZE ; long... | Constant - time MurmurHash3 128 - bit hashing for any prefix . | 491 | 16 |
40,384 | public static void murmur3 ( final BitVector bv , final long prefixLength , final long [ ] hh1 , final long [ ] hh2 , final long [ ] cc1 , final long cc2 [ ] , final long lcp , final long h [ ] ) { final int startStateWord = ( int ) ( Math . min ( lcp , prefixLength ) / ( 2 * Long . SIZE ) ) ; long from = startStateWor... | Constant - time MurmurHash3 128 - bit hashing reusing precomputed state partially . | 703 | 20 |
40,385 | public static long [ ] [ ] preprocessMurmur3 ( final BitVector bv , final long seed ) { long from = 0 ; final long length = bv . length ( ) ; long h1 = 0x9368e53c2f6af274 L ^ seed ; long h2 = 0x586dcd208f7cd3fd L ^ seed ; long c1 = 0x87c37b91114253d5 L ; long c2 = 0x4cf5ad432745937f L ; final int wordLength = ( int ) (... | Preprocesses a bit vector so that MurmurHash3 can be computed in constant time on all prefixes . | 483 | 23 |
40,386 | public static long [ ] preprocessSpooky4 ( final BitVector bv , final long seed ) { final long length = bv . length ( ) ; if ( length < Long . SIZE * 2 ) return null ; final long [ ] state = new long [ 4 * ( int ) ( length + Long . SIZE * 2 ) / ( 4 * Long . SIZE ) ] ; long h0 , h1 , h2 , h3 ; h0 = seed ; h1 = seed ; h2... | Preprocesses a bit vector so that SpookyHash 4 - word - state can be computed in constant time on all prefixes . | 665 | 27 |
40,387 | public long getLongByTriple ( final long [ ] triple ) { if ( n == 0 ) return defRetValue ; final int [ ] e = new int [ 3 ] ; final int chunk = chunkShift == Long . SIZE ? 0 : ( int ) ( triple [ 0 ] >>> chunkShift ) ; final long chunkOffset = offset [ chunk ] ; HypergraphSorter . tripleToEdge ( triple , seed [ chunk ] ,... | Low - level access to the output of this minimal perfect hash function . | 251 | 14 |
40,388 | private boolean sort ( ) { // We cache all variables for faster access final int [ ] d = this . d ; //System.err.println("Visiting..."); if ( LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( "Peeling hypergraph..." ) ; top = 0 ; for ( int i = 0 ; i < numVertices ; i ++ ) if ( d [ i ] == 1 ) peel ( i ) ; if ( LOGGER . isD... | Sorts the edges of a random 3 - hypergraph in &ldquo ; leaf peeling&rdquo ; order . | 152 | 27 |
40,389 | public LcpMonotoneMinimalPerfectHashFunction < T > build ( ) throws IOException { if ( built ) throw new IllegalStateException ( "This builder has been already used" ) ; built = true ; return new LcpMonotoneMinimalPerfectHashFunction <> ( keys , numKeys , transform , signatureWidth , tempDir ) ; } | Builds an LCP monotone minimal perfect hash function . | 75 | 13 |
40,390 | public void add ( final T o , final long value ) throws IOException { final long [ ] triple = new long [ 3 ] ; Hashes . spooky4 ( transform . toBitVector ( o ) , seed , triple ) ; add ( triple , value ) ; } | Adds an element to this store associating it with a specified value . | 57 | 14 |
40,391 | private void add ( final long [ ] triple , final long value ) throws IOException { final int chunk = ( int ) ( triple [ 0 ] >>> DISK_CHUNKS_SHIFT ) ; count [ chunk ] ++ ; checkedForDuplicates = false ; if ( DEBUG ) System . err . println ( "Adding " + Arrays . toString ( triple ) ) ; writeLong ( triple [ 0 ] , byteBuff... | Adds a triple to this store . | 229 | 7 |
40,392 | public void addAll ( final Iterator < ? extends T > elements , final LongIterator values , final boolean requiresValue2CountMap ) throws IOException { if ( pl != null ) { pl . expectedUpdates = - 1 ; pl . start ( "Adding elements..." ) ; } final long [ ] triple = new long [ 3 ] ; while ( elements . hasNext ( ) ) { Hash... | Adds the elements returned by an iterator to this store associating them with specified values possibly building the associated value frequency map . | 187 | 24 |
40,393 | public void addAll ( final Iterator < ? extends T > elements , final LongIterator values ) throws IOException { addAll ( elements , values , false ) ; } | Adds the elements returned by an iterator to this store associating them with specified values . | 35 | 17 |
40,394 | @ Override public void close ( ) throws IOException { if ( ! closed ) { LOGGER . debug ( "Wall clock for quicksort: " + Util . format ( quickSortWallTime / 1E9 ) + "s" ) ; closed = true ; for ( final WritableByteChannel channel : writableByteChannel ) channel . close ( ) ; for ( final File f : file ) f . delete ( ) ; }... | Closes this store disposing all associated resources . | 93 | 10 |
40,395 | public void reset ( final long seed ) throws IOException { if ( locked ) throw new IllegalStateException ( ) ; if ( DEBUG ) System . err . println ( "RESET(" + seed + ")" ) ; filteredSize = 0 ; this . seed = seed ; checkedForDuplicates = false ; Arrays . fill ( count , 0 ) ; for ( int i = 0 ; i < DISK_CHUNKS ; i ++ ) {... | Resets this store using a new seed . All accumulated data are cleared and a new seed is reinstated . | 142 | 21 |
40,396 | public void checkAndRetry ( final Iterable < ? extends T > iterable , final LongIterable values ) throws IOException { final RandomGenerator random = new XoRoShiRo128PlusRandomGenerator ( ) ; int duplicates = 0 ; for ( ; ; ) try { check ( ) ; break ; } catch ( final DuplicateException e ) { if ( duplicates ++ > 3 ) thr... | Checks that this store has no duplicate triples and try to rebuild if this fails to happen . | 157 | 20 |
40,397 | public LongBigList signatures ( final int signatureWidth , final ProgressLogger pl ) throws IOException { final LongBigList signatures = LongArrayBitVector . getInstance ( ) . asLongBigList ( signatureWidth ) ; final long signatureMask = - 1L >>> Long . SIZE - signatureWidth ; signatures . size ( size ( ) ) ; pl . expe... | Generate a list of signatures using the lowest bits of the first hash in this store . | 206 | 18 |
40,398 | public int log2Chunks ( final int log2chunks ) { this . chunks = 1 << log2chunks ; diskChunkStep = ( int ) Math . max ( DISK_CHUNKS / chunks , 1 ) ; virtualDiskChunks = DISK_CHUNKS / diskChunkStep ; if ( DEBUG ) { System . err . print ( "Chunk sizes: " ) ; final double avg = filteredSize / ( double ) DISK_CHUNKS ; doub... | Sets the number of chunks . | 284 | 7 |
40,399 | public long [ ] select ( long rank , long [ ] dest , final int offset , final int length ) { if ( length == 0 ) return dest ; final long s = select ( rank ) ; dest [ offset ] = s ; int curr = ( int ) ( s / Long . SIZE ) ; long window = bits [ curr ] & - 1L << s ; window &= window - 1 ; for ( int i = 1 ; i < length ; i ... | Performs a bulk select of consecutive ranks into a given array fragment . | 155 | 14 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.