idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
3,800 | public static Object buildGenericType ( final Class < ? > mainClass , final Class < ? > assignableClass , final Object ... parameters ) throws CoreException { return buildGenericType ( mainClass , new Class < ? > [ ] { assignableClass } , parameters ) ; } | Build the nth generic type of a class . |
3,801 | public static Object buildGenericType ( final Class < ? > mainClass , final Class < ? > [ ] assignableClasses , final Object ... constructorParameters ) throws CoreException { Class < ? > genericClass = null ; final Class < ? > [ ] constructorParameterTypes = new Class < ? > [ constructorParameters . length ] ; try { i... | Build the generic type according to assignable class . |
3,802 | public static Object findAndBuildGenericType ( final Class < ? > mainClass , final Class < ? > assignableClass , final Class < ? > excludedClass , final Object ... parameters ) throws CoreException { Object object = null ; final Class < ? > objectClass = ClassUtility . findGenericClass ( mainClass , assignableClass ) ;... | Find and Build the generic type according to assignable and excluded classes . |
3,803 | private static Constructor < ? > getConstructor ( final Class < ? > genericClass , final Class < ? > [ ] constructorParameterTypes ) { Constructor < ? > constructor = null ; try { constructor = genericClass . getConstructor ( constructorParameterTypes ) ; } catch ( final NoSuchMethodException e ) { constructor = generi... | Retrieve the constructor of a Type . |
3,804 | public static String underscoreToCamelCase ( final String undescoredString ) { final String [ ] parts = undescoredString . split ( CASE_SEPARATOR ) ; final StringBuilder camelCaseString = new StringBuilder ( undescoredString . length ( ) ) ; camelCaseString . append ( parts [ 0 ] . toLowerCase ( Locale . getDefault ( )... | Convert A_STRING_UNDESCORED into aStringUnderscored . |
3,805 | public static String camelCaseToUnderscore ( final String camelCaseString ) { final StringBuilder sb = new StringBuilder ( ) ; for ( final String camelPart : camelCaseString . split ( "(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])" ) ) { if ( sb . length ( ) > 0 ) { sb . append ( CASE_SEPARATOR ) ; } sb . append ( camel... | Convert aStringUnderscored into A_STRING_UNDESCORED . |
3,806 | public static Method getMethodByName ( final Class < ? > cls , final String action ) throws NoSuchMethodException { for ( final Method m : cls . getMethods ( ) ) { if ( m . getName ( ) . equals ( action ) ) { return m ; } } throw new NoSuchMethodException ( action ) ; } | Return the method that exactly match the action name . The name must be unique into the class . |
3,807 | public static List < Field > retrievePropertyList ( final Class < ? > cls ) { final List < Field > propertyList = new ArrayList < > ( ) ; for ( final Field f : cls . getFields ( ) ) { propertyList . add ( f ) ; } return propertyList ; } | List all properties for the given class . |
3,808 | public static Field findProperty ( final Class < ? > sourceClass , final String itemName , final Class < ? > searchedClass ) { Field found = null ; if ( itemName != null && ! itemName . trim ( ) . isEmpty ( ) ) { try { found = sourceClass . getField ( ClassUtility . underscoreToCamelCase ( itemName ) ) ; } catch ( NoSu... | Retrieve a field according to the item name first then according to searched class . |
3,809 | public static List < Method > retrieveMethodList ( final Class < ? > cls , final String methodName ) { final List < Method > methodList = new ArrayList < > ( ) ; final String camelCasedMethodName = underscoreToCamelCase ( methodName ) ; for ( final Method m : cls . getMethods ( ) ) { if ( m . getName ( ) . equals ( cam... | Check if the given method exists in the given class . |
3,810 | public static Class < ? > getClassFromType ( final Type type ) { Class < ? > returnClass = null ; if ( type instanceof Class < ? > ) { returnClass = ( Class < ? > ) type ; } else if ( type instanceof ParameterizedType ) { returnClass = getClassFromType ( ( ( ParameterizedType ) type ) . getRawType ( ) ) ; } return retu... | Return the Class object for the given type . |
3,811 | public static Object getAnnotationAttribute ( final Annotation annotation , final String attributeName ) { Object object = null ; try { final Method attributeMethod = annotation . annotationType ( ) . getDeclaredMethod ( attributeName ) ; object = attributeMethod . invoke ( annotation ) ; } catch ( NoSuchMethodExceptio... | Retrieve an annotation property dynamically by reflection . |
3,812 | @ SuppressWarnings ( "unchecked" ) public static Class < ? extends Application > getClassFromStaticMethod ( final int classDeepLevel ) { Class < ? extends Application > clazz = null ; try { clazz = ( Class < ? extends Application > ) Class . forName ( Thread . currentThread ( ) . getStackTrace ( ) [ classDeepLevel ] . ... | Return the class used by the Nth level of the current call stack . |
3,813 | public static Object callMethod ( final Method method , final Object instance , final Object ... parameters ) throws CoreException { Object res = null ; try { final boolean accessible = method . isAccessible ( ) ; method . setAccessible ( true ) ; res = method . invoke ( instance , parameters ) ; method . setAccessible... | Call the given method for the instance object even if its visibility is private or protected . |
3,814 | public static void setFieldValue ( final Field field , final Object instance , final Object value ) throws CoreException { try { final boolean accessible = field . isAccessible ( ) ; field . setAccessible ( true ) ; field . set ( instance , value ) ; field . setAccessible ( accessible ) ; } catch ( IllegalAccessExcepti... | Update an object field even if it has a private or protected visibility . |
3,815 | public static Object getFieldValue ( final Field field , final Object instance ) throws CoreRuntimeException { Object value = null ; try { final boolean accessible = field . isAccessible ( ) ; field . setAccessible ( true ) ; value = field . get ( instance ) ; field . setAccessible ( accessible ) ; } catch ( IllegalAcc... | Retrieve an object field even if it has a private or protected visibility . |
3,816 | public static Class < ? > getGenericClassAssigned ( final Class < ? > fromClass , final Class < ? > typeSearched ) { Class < ? > realType = null ; final Type superType = fromClass . getGenericSuperclass ( ) ; realType = searchIntoParameterzedType ( superType , typeSearched ) ; if ( realType == null ) { for ( final Type... | Return the first generic type of the hierarchy that can be assigned to the type searched . |
3,817 | private static Class < ? > searchIntoParameterzedType ( final Type superType , final Class < ? > typeSearched ) { if ( superType instanceof ParameterizedType ) { for ( final Type genericType : ( ( ParameterizedType ) superType ) . getActualTypeArguments ( ) ) { if ( genericType instanceof Class < ? > && typeSearched . ... | Extract the searched type from a ParamterizedType . |
3,818 | public Middleware init ( final Yoke yoke , final String mount ) { if ( initialized ) { throw new RuntimeException ( "Already Initialized!" ) ; } this . yoke = yoke ; this . mount = mount ; this . initialized = true ; return this ; } | Initializes the middleware . This methos is called from Yoke once a middleware is added to the chain . |
3,819 | public String getUrl ( ) { final StringBuilder sb = new StringBuilder ( ) ; sb . append ( secured ( ) ? "https://" : "http://" ) . append ( website ( ) ) . append ( path ( ) ) . append ( name ( ) ) . append ( extension ( ) ) ; return sb . toString ( ) ; } | Build the image url . |
3,820 | private Region getRootPane ( final StageWaveBean swb ) { return swb . rootPane ( ) == null ? new StackPane ( ) : swb . rootPane ( ) ; } | Gets the root pane . |
3,821 | private Scene getScene ( final StageWaveBean swb , final Region region ) { Scene scene = swb . scene ( ) ; if ( scene == null ) { scene = new Scene ( region ) ; } else { scene . setRoot ( region ) ; } return scene ; } | Gets the scene . |
3,822 | private Stage getStage ( final StageWaveBean swb , final Scene scene ) { Stage stage = swb . stage ( ) ; if ( stage == null ) { stage = new Stage ( ) ; } stage . setScene ( scene ) ; return stage ; } | Gets the stage . |
3,823 | public static boolean canProcessAnnotation ( final Class < ? extends Component < ? > > componentClass ) { final SkipAnnotation skip = ClassUtility . getLastClassAnnotation ( componentClass , SkipAnnotation . class ) ; return ! ( skip == null || skip . value ( ) ) ; } | Check if annotation can be processed for the given class . |
3,824 | private static void injectComponent ( final Component < ? > component , final boolean inner ) { for ( final Field field : ClassUtility . getAnnotatedFields ( component . getClass ( ) , Link . class ) ) { final String keyPart = field . getAnnotation ( Link . class ) . value ( ) ; if ( inner ) { if ( InnerComponent . cla... | Inject component . |
3,825 | @ SuppressWarnings ( "unchecked" ) private static void injectComponent ( final FacadeReady < ? > component , final Field field , final Object ... keyParts ) { try { if ( Command . class . isAssignableFrom ( field . getType ( ) ) ) { ClassUtility . setFieldValue ( field , component , component . localFacade ( ) . global... | Inject a component into the property of an other . |
3,826 | @ SuppressWarnings ( "unchecked" ) private static void injectInnerComponent ( final Component < ? > component , final Field field , final Object ... keyParts ) { final ParameterizedType innerComponentType = ( ParameterizedType ) field . getGenericType ( ) ; final Class < ? > componentType = ( Class < ? > ) innerCompone... | Inject Inner component . |
3,827 | public static MultiMap < String , Method > defineLifecycleMethod ( final Component < ? > component ) { final MultiMap < String , Method > lifecycleMethod = new MultiMap < > ( ) ; manageLifecycleAnnotation ( component , lifecycleMethod , BeforeInit . class ) ; manageLifecycleAnnotation ( component , lifecycleMethod , Af... | Parse all methods to search annotated methods that are attached to a lifecycle phase . |
3,828 | private static void manageLifecycleAnnotation ( final Component < ? > component , final MultiMap < String , Method > lifecycleMethod , final Class < ? extends Annotation > annotationClass ) { for ( final Method method : ClassUtility . getAnnotatedMethods ( component . getClass ( ) , annotationClass ) ) { lifecycleMetho... | Store annotated method related to a lifecycle phase . |
3,829 | protected static void preloadAndLaunch ( final Class < ? extends Preloader > preloaderClass , final String ... args ) { preloadAndLaunch ( ClassUtility . getClassFromStaticMethod ( 3 ) , preloaderClass , args ) ; } | Launch the Current JavaFX Application with given preloader . |
3,830 | protected static void preloadAndLaunch ( final Class < ? extends Application > appClass , final Class < ? extends Preloader > preloaderClass , final String ... args ) { LauncherImpl . launchApplication ( appClass , preloaderClass , args ) ; } | Launch the given JavaFX Application with given preloader . |
3,831 | private void loadConfigurationFiles ( ) { final Configuration conf = ClassUtility . getLastClassAnnotation ( this . getClass ( ) , Configuration . class ) ; ResourceBuilders . PARAMETER_BUILDER . searchConfigurationFiles ( conf . value ( ) , conf . extension ( ) ) ; } | Load all configuration files before showing anything . |
3,832 | private void loadMessagesFiles ( ) { final Localized local = ClassUtility . getLastClassAnnotation ( this . getClass ( ) , Localized . class ) ; ResourceBuilders . MESSAGE_BUILDER . searchMessagesFiles ( local . value ( ) ) ; } | Load all Messages files before showing anything . |
3,833 | private void initializeStage ( ) { this . stage . setTitle ( applicationTitle ( ) ) ; final List < Image > stageIcons = stageIcons ( ) ; if ( stageIcons != null && ! stageIcons . isEmpty ( ) ) { this . stage . getIcons ( ) . addAll ( stageIcons ) ; } customizeStage ( this . stage ) ; } | Customize the primary Stage . |
3,834 | private void initializeScene ( ) { final Stage currentStage = this . stage ; final KeyCode fullKeyCode = fullScreenKeyCode ( ) ; final KeyCode iconKeyCode = iconifiedKeyCode ( ) ; if ( fullKeyCode != null && iconKeyCode != null ) { this . scene . addEventFilter ( KeyEvent . KEY_PRESSED , keyEvent -> { if ( fullKeyCode ... | Initialize the default scene . |
3,835 | protected void preloadModules ( ) { JRebirthThread . getThread ( ) . getFacade ( ) . componentFactory ( ) . define ( RegistrationPointItemBase . create ( ) . interfaceClass ( ModuleModel . class ) . exclusive ( false ) . reverse ( false ) ) ; final ServiceLoader < ModuleStarter > loader = ServiceLoader . load ( ModuleS... | Preload Module . xml files . |
3,836 | protected void addCSS ( final Scene scene , final StyleSheetItem styleSheetItem ) { final URL styleSheetURL = styleSheetItem . get ( ) ; if ( styleSheetURL == null ) { LOGGER . error ( CSS_LOADING_ERROR , styleSheetItem . toString ( ) , ResourceParameters . STYLE_FOLDER . get ( ) ) ; } else { scene . getStylesheets ( )... | Attach a new CSS file to the scene using the default classloader . |
3,837 | protected String applicationTitle ( ) { String name = StageParameters . APPLICATION_NAME . get ( ) ; if ( name . contains ( PARAM ) ) { name = name . replace ( PARAM , computeShortClassName ( ) ) ; } final String version = StageParameters . APPLICATION_VERSION . get ( ) ; final StringBuilder sb = new StringBuilder ( na... | Return the application title . |
3,838 | protected List < Image > stageIcons ( ) { return StageParameters . APPLICATION_ICONS . get ( ) . stream ( ) . map ( p -> Resources . create ( p ) . get ( ) ) . collect ( Collectors . toList ( ) ) ; } | Return the application stage icon . |
3,839 | private String computeShortClassName ( ) { String name = this . getClass ( ) . getSimpleName ( ) ; if ( name . endsWith ( APP_SUFFIX_CLASSNAME ) ) { name = name . substring ( 0 , name . indexOf ( APP_SUFFIX_CLASSNAME ) ) ; } return name ; } | Return the application class name without the Application suffix . |
3,840 | private void manageDefaultStyleSheet ( final Scene scene ) { if ( scene . getStylesheets ( ) . isEmpty ( ) ) { LOGGER . log ( NO_CSS_DEFINED ) ; addCSS ( scene , JRebirthStyles . DEFAULT ) ; } } | Attach default CSS file if none have been previously attached . |
3,841 | protected final Scene buildScene ( ) throws CoreException { final Scene scene = new Scene ( buildRootPane ( ) , StageParameters . APPLICATION_SCENE_WIDTH . get ( ) , StageParameters . APPLICATION_SCENE_HEIGHT . get ( ) , JRebirthColors . SCENE_BG_COLOR . get ( ) ) ; return scene ; } | Initialize the properties of the scene . |
3,842 | @ SuppressWarnings ( "unchecked" ) protected P buildRootPane ( ) throws CoreException { this . rootNode = ( P ) ClassUtility . buildGenericType ( this . getClass ( ) , Pane . class ) ; return this . rootNode ; } | Build dynamically the root pane . |
3,843 | protected void initializeExceptionHandler ( ) { Thread . setDefaultUncaughtExceptionHandler ( getDefaultUncaughtExceptionHandler ( ) ) ; JRebirth . runIntoJAT ( ATTACH_JAT_UEH . getText ( ) , ( ) -> Thread . currentThread ( ) . setUncaughtExceptionHandler ( getJatUncaughtExceptionHandler ( ) ) ) ; JRebirth . runIntoJIT... | Initialize all Uncaught Exception Handler . |
3,844 | public static Collection < String > getClasspathResources ( final Pattern searchPattern ) { final List < String > resources = new ArrayList < > ( ) ; final ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( hasJavaWebstartLibrary ( ) && cl instanceof JNLPClassLoaderIf ) { LOGGER . log ( USE_... | Retrieve all resources that match the search pattern from the java . class . path . |
3,845 | private static boolean hasJavaWebstartLibrary ( ) { boolean hasWebStartLibrary = true ; try { Class . forName ( "com.sun.jnlp.JNLPClassLoaderIf" ) ; } catch ( final ClassNotFoundException e ) { hasWebStartLibrary = false ; } return hasWebStartLibrary ; } | Check that javaws . jar is accessible . |
3,846 | private static List < String > getResources ( final String classpathEntryPath , final Pattern searchPattern , final boolean cachedJar ) { final List < String > resources = new ArrayList < > ( ) ; final File classpathEntryFile = new File ( classpathEntryPath ) ; if ( classpathEntryFile . isDirectory ( ) ) { resources . ... | Search all files that match the given Regex pattern . |
3,847 | private static List < String > getResourcesFromDirectory ( final File directory , final Pattern searchPattern ) { final List < String > resources = new ArrayList < > ( ) ; final File [ ] fileList = directory . listFiles ( ) ; if ( fileList != null && fileList . length > 0 ) { for ( final File file : fileList ) { if ( f... | Browse a directory to search resources that match the pattern . |
3,848 | @ SuppressWarnings ( "unchecked" ) private static List < String > getResourcesFromJarOrZipFile ( final File jarOrZipFile , final Pattern searchPattern ) { final List < String > resources = new ArrayList < > ( ) ; try ( ZipFile zf = new ZipFile ( jarOrZipFile ) ; ) { final Enumeration < ZipEntry > e = ( Enumeration < Zi... | Browse the jar content to search resources that match the pattern . |
3,849 | private static void checkResource ( final List < String > resources , final Pattern searchPattern , final String resourceName ) { if ( searchPattern . matcher ( resourceName ) . matches ( ) ) { resources . add ( resourceName ) ; } } | Check if the resource match the regex . |
3,850 | public static InputStream loadInputStream ( final String custConfFileName ) { InputStream is = null ; final File resourceFile = new File ( custConfFileName ) ; if ( resourceFile . exists ( ) ) { try { is = new FileInputStream ( resourceFile ) ; } catch ( final FileNotFoundException e ) { } } else { is = Thread . curren... | TRy to load a custom resource file . |
3,851 | @ SuppressWarnings ( "unchecked" ) private Class < PageEnum > getPageEnumClass ( ) { Class < PageEnum > res = null ; if ( object ( ) != null && object ( ) . pageEnumClass ( ) != null ) { res = ( Class < PageEnum > ) object ( ) . pageEnumClass ( ) ; } else if ( getFirstKeyPart ( ) instanceof Class && PageEnum . class . ... | Returns the page enum class associated to this model . |
3,852 | private String getStackName ( ) { String res = null ; if ( object ( ) != null && object ( ) . stackName ( ) != null ) { res = object ( ) . stackName ( ) ; } else if ( getFirstKeyPart ( ) instanceof String ) { res = ( String ) getFirstKeyPart ( ) ; } return res ; } | Returns the current stack name associated to this model . |
3,853 | private void showPage ( final UniqueKey < ? extends Model > pageModelKey , final Wave wave ) { if ( pageModelKey != null && ! pageModelKey . equals ( this . currentModelKey ) ) { LOGGER . info ( "Show Page Model: " + pageModelKey . toString ( ) ) ; final DisplayModelWaveBean waveBean = DisplayModelWaveBean . create ( )... | Private method used to show another page . |
3,854 | final void parseRange ( String range ) { if ( range == null ) { throw new IllegalArgumentException ( "Invalid IP range" ) ; } int index = range . indexOf ( '/' ) ; String subnetStr = null ; if ( index == - 1 ) { ipAddress = new IPAddress ( range ) ; } else { ipAddress = new IPAddress ( range . substring ( 0 , index ) )... | Parse the IP range string representation . |
3,855 | private int computeNetworkPrefixFromMask ( IPAddress mask ) { int result = 0 ; int tmp = mask . getIPAddress ( ) ; while ( ( tmp & 0x00000001 ) == 0x00000001 ) { result ++ ; tmp = tmp >>> 1 ; } if ( tmp != 0 ) { return - 1 ; } return result ; } | Compute the extended network prefix from the IP subnet mask . |
3,856 | private IPAddress computeMaskFromNetworkPrefix ( int prefix ) { StringBuilder str = new StringBuilder ( ) ; for ( int i = 0 ; i < 32 ; i ++ ) { if ( i < prefix ) { str . append ( "1" ) ; } else { str . append ( "0" ) ; } } String decimalString = toDecimalString ( str . toString ( ) ) ; return new IPAddress ( decimalStr... | Convert a extended network prefix integer into an IP number . |
3,857 | public boolean isIPAddressInRange ( IPAddress address ) { if ( ipSubnetMask == null ) { return this . ipAddress . equals ( address ) ; } int result1 = address . getIPAddress ( ) & ipSubnetMask . getIPAddress ( ) ; int result2 = ipAddress . getIPAddress ( ) & ipSubnetMask . getIPAddress ( ) ; return result1 == result2 ;... | Check if the specified IP address is in the encapsulated range . |
3,858 | final int parseIPAddress ( String ipAddressStr ) { int result = 0 ; if ( ipAddressStr == null ) { throw new IllegalArgumentException ( ) ; } try { String tmp = ipAddressStr ; int offset = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { int index = tmp . indexOf ( '.' ) ; if ( index != - 1 ) { String numberStr = tmp . substring ... | Convert a decimal - dotted notation representation of an IP address into an 32 bits interger value . |
3,859 | public static void on ( String op , OnListener listener ) { getInstance ( ) . mEvents . add ( new Event ( op , listener ) ) ; } | Connect && Disconnect events |
3,860 | private void enableDisableView ( View view , boolean enabled ) { view . setEnabled ( enabled ) ; view . setFocusable ( enabled ) ; if ( view instanceof ViewGroup ) { ViewGroup group = ( ViewGroup ) view ; for ( int idx = 0 ; idx < group . getChildCount ( ) ; idx ++ ) { enableDisableView ( group . getChildAt ( idx ) , e... | helper method to disable a view and all its subviews |
3,861 | public Crossfader withStructure ( View first , int firstWidth , View second , int secondWidth ) { withFirst ( first , firstWidth ) ; withSecond ( second , secondWidth ) ; return this ; } | define the default view and the slided view of the crossfader |
3,862 | public Crossfader withCanSlide ( boolean canSlide ) { this . mCanSlide = canSlide ; if ( mCrossFadeSlidingPaneLayout != null ) { mCrossFadeSlidingPaneLayout . setCanSlide ( mCanSlide ) ; } return this ; } | Allow the panel to slide |
3,863 | public Crossfader withPanelSlideListener ( SlidingPaneLayout . PanelSlideListener panelSlideListener ) { this . mPanelSlideListener = panelSlideListener ; if ( mCrossFadeSlidingPaneLayout != null ) { mCrossFadeSlidingPaneLayout . setPanelSlideListener ( mPanelSlideListener ) ; } return this ; } | set a PanelSlideListener used with the CrossFadeSlidingPaneLayout |
3,864 | public Crossfader build ( ) { if ( mFirstWidth < mSecondWidth ) { throw new RuntimeException ( "the first layout has to be the layout with the greater width" ) ; } ViewGroup container = ( ( ViewGroup ) mContent . getParent ( ) ) ; container . removeView ( mContent ) ; mCrossFadeSlidingPaneLayout = ( T ) LayoutInflater ... | builds the crossfader and it s content views will define all properties and define and add the layouts |
3,865 | protected void setWidth ( View view , int width ) { ViewGroup . LayoutParams lp = view . getLayoutParams ( ) ; lp . width = width ; view . setLayoutParams ( lp ) ; } | define the width of the given view |
3,866 | protected void setLeftMargin ( View view , int leftMargin ) { SlidingPaneLayout . LayoutParams lp = ( SlidingPaneLayout . LayoutParams ) view . getLayoutParams ( ) ; lp . leftMargin = leftMargin ; lp . rightMargin = 0 ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN_MR1 ) { lp . setMarginStart ( l... | define the left margin of the given view |
3,867 | public static boolean isPointInsideView ( float x , float y , View view ) { int location [ ] = new int [ 2 ] ; view . getLocationOnScreen ( location ) ; int viewX = location [ 0 ] ; int viewY = location [ 1 ] ; if ( ( viewX < x && x < ( viewX + view . getWidth ( ) ) ) && ( viewY < y && y < ( viewY + view . getHeight ( ... | Determines if given points are inside view |
3,868 | protected void ensureParentage ( AbstractNode child ) throws IllegalStateException { if ( child . parent == this ) return ; throw new IllegalStateException ( String . format ( "Can't disown child of type %s - it isn't my child (I'm a %s)" , child . getClass ( ) . getName ( ) , this . getClass ( ) . getName ( ) ) ) ; } | Checks if the provided node is a direct child of this node . |
3,869 | public Mat4 add ( final Mat4 other ) { return new Mat4 ( m00 + other . m00 , m01 + other . m01 , m02 + other . m02 , m03 + other . m03 , m10 + other . m10 , m11 + other . m11 , m12 + other . m12 , m13 + other . m13 , m20 + other . m20 , m21 + other . m21 , m22 + other . m22 , m23 + other . m23 , m30 + other . m30 , m31... | Add two matrices together and return the result |
3,870 | public String getOverviewReport ( ) { TreeSet < ReportEntry < V > > topLevelFailed = new TreeSet < ReportEntry < V > > ( ) ; fillReport ( topLevelFailed , rootReport ) ; StringBuilder out = new StringBuilder ( ) ; for ( ReportEntry < V > entry : topLevelFailed ) { if ( entry . getSubSteps ( ) < 100 ) break ; out . appe... | Returns a string describing in order of expensiveness the top - level failed rule chains in the parse run . |
3,871 | public List < String > getExtendedReport ( int topEntries ) { TreeSet < ReportEntry < V > > topLevelFailed = new TreeSet < ReportEntry < V > > ( ) ; fillReport ( topLevelFailed , rootReport ) ; int count = topEntries ; List < String > result = Lists . newArrayList ( ) ; StringBuilder out = new StringBuilder ( ) ; for (... | Lists the work done by the most expensive failed rules . |
3,872 | private static double doubleHighPart ( double d ) { if ( d > - Precision . SAFE_MIN && d < Precision . SAFE_MIN ) { return d ; } long xl = Double . doubleToLongBits ( d ) ; xl = xl & MASK_30BITS ; return Double . longBitsToDouble ( xl ) ; } | Get the high order bits from the mantissa . Equivalent to adding and subtracting HEX_40000 but also works for very large numbers |
3,873 | public static double cosh ( double x ) { if ( x != x ) { return x ; } if ( x > 20 ) { if ( x >= LOG_MAX_VALUE ) { final double t = exp ( 0.5 * x ) ; return ( 0.5 * t ) * t ; } else { return 0.5 * exp ( x ) ; } } else if ( x < - 20 ) { if ( x <= - LOG_MAX_VALUE ) { final double t = exp ( - 0.5 * x ) ; return ( 0.5 * t )... | Compute the hyperbolic cosine of a number . |
3,874 | private static double exp ( double x , double extra , double [ ] hiPrec ) { double intPartA ; double intPartB ; int intVal ; if ( x < 0.0 ) { intVal = ( int ) - x ; if ( intVal > 746 ) { if ( hiPrec != null ) { hiPrec [ 0 ] = 0.0 ; hiPrec [ 1 ] = 0.0 ; } return 0.0 ; } if ( intVal > 709 ) { final double result = exp ( ... | Internal helper method for exponential function . |
3,875 | public static double log10 ( final double x ) { final double hiPrec [ ] = new double [ 2 ] ; final double lores = log ( x , hiPrec ) ; if ( Double . isInfinite ( lores ) ) { return lores ; } final double tmp = hiPrec [ 0 ] * HEX_40000000 ; final double lna = hiPrec [ 0 ] + tmp - tmp ; final double lnb = hiPrec [ 0 ] - ... | Compute the base 10 logarithm . |
3,876 | public static double pow ( double d , int e ) { if ( e == 0 ) { return 1.0 ; } else if ( e < 0 ) { e = - e ; d = 1.0 / d ; } final int splitFactor = 0x8000001 ; final double cd = splitFactor * d ; final double d1High = cd - ( cd - d ) ; final double d1Low = d - d1High ; double resultHigh = 1 ; double resultLow = 0 ; do... | Raise a double to an int power . |
3,877 | public static double sin ( double x ) { boolean negative = false ; int quadrant = 0 ; double xa ; double xb = 0.0 ; xa = x ; if ( x < 0 ) { negative = true ; xa = - xa ; } if ( xa == 0.0 ) { long bits = Double . doubleToLongBits ( x ) ; if ( bits < 0 ) { return - 0.0 ; } return 0.0 ; } if ( xa != xa || xa == Double . P... | Sine function . |
3,878 | public static double cos ( double x ) { int quadrant = 0 ; double xa = x ; if ( x < 0 ) { xa = - xa ; } if ( xa != xa || xa == Double . POSITIVE_INFINITY ) { return Double . NaN ; } double xb = 0 ; if ( xa > 3294198.0 ) { double reduceResults [ ] = new double [ 3 ] ; reducePayneHanek ( xa , reduceResults ) ; quadrant =... | Cosine function . |
3,879 | public static double tan ( double x ) { boolean negative = false ; int quadrant = 0 ; double xa = x ; if ( x < 0 ) { negative = true ; xa = - xa ; } if ( xa == 0.0 ) { long bits = Double . doubleToLongBits ( x ) ; if ( bits < 0 ) { return - 0.0 ; } return 0.0 ; } if ( xa != xa || xa == Double . POSITIVE_INFINITY ) { re... | Tangent function . |
3,880 | public static double asin ( double x ) { if ( x != x ) { return Double . NaN ; } if ( x > 1.0 || x < - 1.0 ) { return Double . NaN ; } if ( x == 1.0 ) { return Math . PI / 2.0 ; } if ( x == - 1.0 ) { return - Math . PI / 2.0 ; } if ( x == 0.0 ) { return x ; } double temp = x * HEX_40000000 ; final double xa = x + temp ... | Compute the arc sine of a number . |
3,881 | public static double acos ( double x ) { if ( x != x ) { return Double . NaN ; } if ( x > 1.0 || x < - 1.0 ) { return Double . NaN ; } if ( x == - 1.0 ) { return Math . PI ; } if ( x == 1.0 ) { return 0.0 ; } if ( x == 0 ) { return Math . PI / 2.0 ; } double temp = x * HEX_40000000 ; final double xa = x + temp - temp ;... | Compute the arc cosine of a number . |
3,882 | public static double cbrt ( double x ) { long inbits = Double . doubleToLongBits ( x ) ; int exponent = ( int ) ( ( inbits >> 52 ) & 0x7ff ) - 1023 ; boolean subnormal = false ; if ( exponent == - 1023 ) { if ( x == 0 ) { return x ; } subnormal = true ; x *= 1.8014398509481984E16 ; inbits = Double . doubleToLongBits ( ... | Compute the cubic root of a number . |
3,883 | public static double toRadians ( double x ) { if ( Double . isInfinite ( x ) || x == 0.0 ) { return x ; } final double facta = 0.01745329052209854 ; final double factb = 1.997844754509471E-9 ; double xa = doubleHighPart ( x ) ; double xb = x - xa ; double result = xb * factb + xb * facta + xa * factb + xa * facta ; if ... | Convert degrees to radians with error of less than 0 . 5 ULP |
3,884 | public static double toDegrees ( double x ) { if ( Double . isInfinite ( x ) || x == 0.0 ) { return x ; } final double facta = 57.2957763671875 ; final double factb = 3.145894820876798E-6 ; double xa = doubleHighPart ( x ) ; double xb = x - xa ; return xb * factb + xb * facta + xa * factb + xa * facta ; } | Convert radians to degrees with error of less than 0 . 5 ULP |
3,885 | public static double scalb ( final double d , final int n ) { if ( ( n > - 1023 ) && ( n < 1024 ) ) { return d * Double . longBitsToDouble ( ( ( long ) ( n + 1023 ) ) << 52 ) ; } if ( Double . isNaN ( d ) || Double . isInfinite ( d ) || ( d == 0 ) ) { return d ; } if ( n < - 2098 ) { return ( d > 0 ) ? 0.0 : - 0.0 ; } ... | Multiply a double number by a power of 2 . |
3,886 | public static float scalb ( final float f , final int n ) { if ( ( n > - 127 ) && ( n < 128 ) ) { return f * Float . intBitsToFloat ( ( n + 127 ) << 23 ) ; } if ( Float . isNaN ( f ) || Float . isInfinite ( f ) || ( f == 0f ) ) { return f ; } if ( n < - 277 ) { return ( f > 0 ) ? 0.0f : - 0.0f ; } if ( n > 276 ) { retu... | Multiply a float number by a power of 2 . |
3,887 | public static double floor ( double x ) { long y ; if ( x != x ) { return x ; } if ( x >= TWO_POWER_52 || x <= - TWO_POWER_52 ) { return x ; } y = ( long ) x ; if ( x < 0 && y != x ) { y -- ; } if ( y == 0 ) { return x * y ; } return y ; } | Get the largest whole number smaller than x . |
3,888 | public static double ceil ( double x ) { double y ; if ( x != x ) { return x ; } y = floor ( x ) ; if ( y == x ) { return y ; } y += 1.0 ; if ( y == 0 ) { return x * y ; } return y ; } | Get the smallest whole number larger than x . |
3,889 | public static double rint ( double x ) { double y = floor ( x ) ; double d = x - y ; if ( d > 0.5 ) { if ( y == - 1.0 ) { return - 0.0 ; } return y + 1.0 ; } if ( d < 0.5 ) { return y ; } long z = ( long ) y ; return ( z & 1 ) == 0 ? y : y + 1.0 ; } | Get the whole number that is the nearest to x or the even one if x is exactly half way between two integers . |
3,890 | private static void resplit ( final double a [ ] ) { final double c = a [ 0 ] + a [ 1 ] ; final double d = - ( c - a [ 0 ] - a [ 1 ] ) ; if ( c < 8e298 && c > - 8e298 ) { double z = c * HEX_40000000 ; a [ 0 ] = ( c + z ) - z ; a [ 1 ] = c - a [ 0 ] + d ; } else { double z = c * 9.31322574615478515625E-10 ; a [ 0 ] = ( ... | Recompute a split . |
3,891 | private static void splitMult ( double a [ ] , double b [ ] , double ans [ ] ) { ans [ 0 ] = a [ 0 ] * b [ 0 ] ; ans [ 1 ] = a [ 0 ] * b [ 1 ] + a [ 1 ] * b [ 0 ] + a [ 1 ] * b [ 1 ] ; resplit ( ans ) ; } | Multiply two numbers in split form . |
3,892 | private static void splitAdd ( final double a [ ] , final double b [ ] , final double ans [ ] ) { ans [ 0 ] = a [ 0 ] + b [ 0 ] ; ans [ 1 ] = a [ 1 ] + b [ 1 ] ; resplit ( ans ) ; } | Add two numbers in split form . |
3,893 | static void printarray ( PrintStream out , String name , int expectedLen , double [ ] [ ] array2d ) { out . println ( name ) ; checkLen ( expectedLen , array2d . length ) ; out . println ( TABLE_START_DECL + " " ) ; int i = 0 ; for ( double [ ] array : array2d ) { out . print ( " {" ) ; for ( double d : array ) ... | Print an array . |
3,894 | Rule variableDefinition ( ) { return Sequence ( group . types . type ( ) . label ( "type" ) , variableDefinitionPart ( ) . label ( "head" ) , ZeroOrMore ( Sequence ( Ch ( ',' ) , group . basics . optWS ( ) , variableDefinitionPart ( ) ) . label ( "tail" ) ) , set ( actions . createVariableDefinition ( value ( "type" ) ... | Add your own modifiers! |
3,895 | Rule postfixIncrementExpressionChaining ( ) { return Sequence ( dotNewExpressionChaining ( ) , set ( ) , ZeroOrMore ( Sequence ( FirstOf ( String ( "++" ) , String ( "--" ) ) . label ( "operator" ) , group . basics . optWS ( ) ) . label ( "operatorCt" ) ) , set ( actions . createUnaryPostfixExpression ( value ( ) , nod... | P2 Technically postfix increment operations are in P2 along with all the unary operators like ~ and ! as well as typecasts . However because ALL of the P2 expression are right - associative the postfix operators can be considered as a higher level of precedence . |
3,896 | public static int compareTo ( double x , double y , double eps ) { if ( equals ( x , y , eps ) ) { return 0 ; } else if ( x < y ) { return - 1 ; } return 1 ; } | Compares two numbers given some amount of allowed error . |
3,897 | private void associateJavadoc ( List < Comment > comments , List < Node > nodes ) { final TreeMap < Integer , Node > startPosMap = Maps . newTreeMap ( ) ; for ( Node node : nodes ) node . accept ( new ForwardingAstVisitor ( ) { public boolean visitNode ( Node node ) { if ( node . isGenerated ( ) ) return false ; int st... | Associates comments that are javadocs to the node they belong to by checking if the node that immediately follows a javadoc node is a JavadocContainer . |
3,898 | private boolean gatherComments ( org . parboiled . Node < Node > parsed ) { boolean foundComments = false ; for ( org . parboiled . Node < Node > child : parsed . getChildren ( ) ) { foundComments |= gatherComments ( child ) ; } List < Comment > cmts = registeredComments . get ( parsed ) ; if ( cmts != null ) for ( Com... | Delves through the parboiled node tree to find comments . |
3,899 | public void startTiming ( String label ) { if ( mPerfWriter != null ) mPerfWriter . writeStartTiming ( label ) ; mPerfMeasurement = new Bundle ( ) ; mPerfMeasurement . putParcelableArrayList ( METRIC_KEY_ITERATIONS , new ArrayList < Parcelable > ( ) ) ; mExecTime = SystemClock . uptimeMillis ( ) ; mCpuTime = Process . ... | Start measurement of user and cpu time . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.