idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
124,300 | public static String convertToString ( Collection < ? extends Object > parameters ) { if ( parameters == null || parameters . isEmpty ( ) ) return "" ; StringBuilder result = new StringBuilder ( ) ; for ( Object param : parameters ) { if ( param instanceof String ) param = "'" + param + "'" ; if ( result . length ( ) !... | Converts a collection with IN parameters to a plain string representation |
124,301 | public static List < Field > listFields ( Class < ? > clazz ) { assert clazz != null ; Class < ? > entityClass = clazz ; List < Field > list = new ArrayList < Field > ( ) ; while ( ! Object . class . equals ( entityClass ) && entityClass != null ) { list . addAll ( Arrays . asList ( entityClass . getDeclaredFields ( ) ... | lists all fields of a given class |
124,302 | public static Field findField ( Class < ? > clazz , String name ) { Class < ? > entityClass = clazz ; while ( ! Object . class . equals ( entityClass ) && entityClass != null ) { Field [ ] fields = entityClass . getDeclaredFields ( ) ; for ( Field field : fields ) { if ( name . equals ( field . getName ( ) ) ) { return... | tries to find a field by a field name |
124,303 | public static Method findProperty ( Class < ? > clazz , String name ) { assert clazz != null ; assert name != null ; Class < ? > entityClass = clazz ; while ( entityClass != null ) { Method [ ] methods = ( entityClass . isInterface ( ) ? entityClass . getMethods ( ) : entityClass . getDeclaredMethods ( ) ) ; for ( Meth... | tries to find a property method by name |
124,304 | public static Object getValue ( Object instance , String name ) { assert instance != null ; assert name != null ; try { Class < ? > clazz = instance . getClass ( ) ; Object value = null ; Method property = findProperty ( clazz , name ) ; if ( property != null ) { value = property . invoke ( instance ) ; } else { Field ... | tries to get the value from a field or a getter property for a given object instance |
124,305 | public static NamedQuery findNamedQuery ( Class < ? > type , String name ) { NamedQuery annotatedNamedQuery = ( NamedQuery ) type . getAnnotation ( NamedQuery . class ) ; if ( annotatedNamedQuery != null ) { return annotatedNamedQuery ; } NamedQueries annotatedNamedQueries = ( NamedQueries ) type . getAnnotation ( Name... | get a named query from an entity |
124,306 | public static String createResultCountQuery ( String query ) { String resultCountQueryString = null ; int select = query . toLowerCase ( ) . indexOf ( "select" ) ; int from = query . toLowerCase ( ) . indexOf ( "from" ) ; if ( select == - 1 || from == - 1 ) { return null ; } resultCountQueryString = "select count(" + q... | Build a query based on the original query to count results |
124,307 | public static String toSeparatedString ( List < ? > values , String separator ) { return toSeparatedString ( values , separator , null ) ; } | build a single String from a List of objects with a given separator |
124,308 | public static String toSeparatedString ( List < ? > values , String separator , String prefix ) { StringBuilder result = new StringBuilder ( ) ; for ( Object each : values ) { if ( each == null ) { continue ; } if ( result . length ( ) > 0 ) { result . append ( separator ) ; } if ( prefix != null ) { result . append ( ... | build a single String from a List of objects with a given separator and prefix |
124,309 | private boolean isJoda ( Class < ? > clazz ) { for ( Constructor < ? > each : clazz . getConstructors ( ) ) { Class < ? > [ ] parameterTypes = each . getParameterTypes ( ) ; if ( parameterTypes . length > 0 ) { if ( parameterTypes [ 0 ] . getName ( ) . startsWith ( "org.joda.time." ) ) { return true ; } } } return fals... | Check if joda date time library is used without introducing runtime dependency . |
124,310 | public void afterThrowing ( Method m , Object [ ] args , Object target , ConcurrencyFailureException e ) throws OptimisticLockingException { handleOptimisticLockingException ( target , e ) ; } | Spring exception for Optimistic Locking . |
124,311 | public static boolean checkAggregateReferences ( Application app ) { Map < DomainObject , Set < DomainObject > > aggregateGroups = getAggregateGroups ( app ) ; for ( Set < DomainObject > group1 : aggregateGroups . values ( ) ) { for ( Set < DomainObject > group2 : aggregateGroups . values ( ) ) { if ( group1 == group2 ... | According to DDD the aggregate root is the only member of the aggregate that objects outside the aggregate boundary may hold references to . |
124,312 | public void setAsText ( String text ) throws IllegalArgumentException { if ( this . allowEmpty && ! StringUtils . hasText ( text ) ) { setValue ( null ) ; } else { setValue ( new LocalDate ( this . formatter . parseDateTime ( text ) ) ) ; } } | Parse the value from the given text using the specified format . |
124,313 | public String getAsText ( ) { LocalDate value = ( LocalDate ) getValue ( ) ; return ( value != null ? value . toString ( this . formatter ) : "" ) ; } | Format the LocalDate as String using the specified format . |
124,314 | public String getAsText ( ) { Enum < ? > value = ( Enum < ? > ) getValue ( ) ; if ( value == null ) { return "" ; } String text = getMessagesAccessor ( ) . getMessage ( messagesKeyPrefix + value . name ( ) , ( String ) null ) ; if ( text == null ) { return value . toString ( ) ; } else { return text ; } } | Format the Enum as translated String |
124,315 | public void setAsText ( String text ) throws IllegalArgumentException { if ( text == null || text . equals ( "" ) ) { setValue ( null ) ; return ; } Enum < ? > value = Enum . valueOf ( enumClass , text ) ; setValue ( value ) ; } | Parse the value from the given text is not supported by this editor |
124,316 | public synchronized Iterator < String > getPropertyKeys ( ) { if ( properties == null ) { properties = new HashMap < String , Serializable > ( ) ; } return properties . keySet ( ) . iterator ( ) ; } | Gets all property keys for attributes of the ServiceContext object |
124,317 | public static RouteSpecification forCargo ( Cargo cargo , DateTime arrivalDeadline ) { Validate . notNull ( cargo ) ; Validate . notNull ( arrivalDeadline ) ; return new RouteSpecification ( arrivalDeadline , cargo . getOrigin ( ) , cargo . getDestination ( ) ) ; } | Factory for creatig a route specification for a cargo from cargo origin to cargo destination . Use for initial routing . |
124,318 | public static SystemException unwrapSystemException ( Throwable throwable ) { if ( throwable == null ) { return null ; } else if ( throwable instanceof SystemException ) { return ( SystemException ) throwable ; } else if ( throwable . getCause ( ) != null ) { return unwrapSystemException ( throwable . getCause ( ) ) ; ... | Looks for SystemException in the cause chain . |
124,319 | public List < T > getDomainObjectsAsList ( Set < ? extends KEY > keys ) { List < T > all = new ArrayList < T > ( ) ; Iterator < ? extends KEY > iter = keys . iterator ( ) ; List < KEY > chunkKeys = new ArrayList < KEY > ( ) ; for ( int i = 1 ; iter . hasNext ( ) ; i ++ ) { KEY element = iter . next ( ) ; chunkKeys . ad... | Fetch existing domain objects based on natural keys |
124,320 | protected boolean executeGenerator ( ) throws MojoExecutionException { List < Object > classpathEntries = new ArrayList < Object > ( ) ; classpathEntries . addAll ( project . getResources ( ) ) ; classpathEntries . add ( project . getBuild ( ) . getOutputDirectory ( ) ) ; extendPluginClasspath ( classpathEntries ) ; Pr... | Executes the commandline running the Eclipse MWE2 launcher and returns the commandlines exit value . |
124,321 | public static < T > List < Option < T > > createOptions ( Collection < T > domainObjects ) { List < Option < T > > options = new ArrayList < Option < T > > ( ) ; for ( T value : domainObjects ) { String id = String . valueOf ( getId ( value ) ) ; options . add ( new Option < T > ( id , value ) ) ; } return options ; } | Factory method to create a list of Options from a list of DomainObjects . It is expected that the DomainObjects has |
124,322 | public static void dispatch ( Object target , Event event , String methodName ) { try { MethodUtils . invokeMethod ( target , methodName , event ) ; } catch ( InvocationTargetException e ) { if ( e . getTargetException ( ) instanceof RuntimeException ) { throw ( RuntimeException ) e . getTargetException ( ) ; } else { ... | Runtime dispatch to method with correct event parameter type |
124,323 | @ SuppressWarnings ( "unchecked" ) public DataMapper < Object , DBObject > getDataMapper ( Class < ? > domainObjectClass ) { if ( additionalDataMappers != null ) { for ( DataMapper < Object , DBObject > each : additionalDataMappers ) { if ( each . canMapToData ( domainObjectClass ) ) { return each ; } } } if ( dataMapp... | Matching DataMapper if any otherwise null |
124,324 | public String getAsText ( ) { Object value = getValue ( ) ; if ( value == null ) { return "" ; } String propertyName = null ; try { StringBuffer label = new StringBuffer ( ) ; for ( int i = 0 ; i < properties . length ; i ++ ) { propertyName = properties [ i ] ; Class < ? > propertyType = PropertyUtils . getPropertyTyp... | Format the Object as String of concatenated properties . |
124,325 | private void cleanDirectory ( File dir ) { if ( isVerbose ( ) || getLog ( ) . isDebugEnabled ( ) ) { getLog ( ) . info ( "Deleting previously generated files in directory: " + dir . getPath ( ) ) ; } if ( dir . exists ( ) ) { try { FileUtils . cleanDirectory ( dir ) ; } catch ( IOException e ) { getLog ( ) . warn ( "Cl... | Deletes all files within the given directory . |
124,326 | protected String getProjectRelativePath ( File file ) { String path = file . getAbsolutePath ( ) ; String prefix = project . getBasedir ( ) . getAbsolutePath ( ) ; if ( path . startsWith ( prefix ) ) { path = path . substring ( prefix . length ( ) + 1 ) ; } if ( File . separatorChar != '/' ) { path = path . replace ( F... | Returns the path of given file relative to the enclosing Maven project . |
124,327 | private String calculateChecksum ( File file ) throws IOException { InputStream is = new FileInputStream ( file ) ; return DigestUtils . md5Hex ( is ) ; } | Returns a hex representation of the MD5 checksum from given file . |
124,328 | private void initDerivedDefaults ( @ Named ( "Mutable Defaults" ) MutableConfigurationProvider defaultConfiguration ) { if ( hasProperty ( "test.dbunit.dataSetFile" ) ) { defaultConfiguration . setBoolean ( "generate.test.dbunitTestData" , false ) ; } if ( getProperty ( "deployment.applicationServer" ) . equalsIgnoreCa... | Prepare the default values with values inherited from the configuration . |
124,329 | Properties getProperties ( String prefix , boolean removePrefix ) { Properties result = new Properties ( ) ; for ( String key : getPropertyNames ( ) ) { if ( key . startsWith ( prefix ) ) { result . put ( ( removePrefix ) ? key . substring ( prefix . length ( ) ) : key , getProperty ( key ) ) ; } } return result ; } | Gets all properties with a key starting with prefix . |
124,330 | public String mapValidationAnnotation ( String annotation , String defaultAnnotation ) { String key = "validation.annotation." + toFirstUpper ( annotation ) ; if ( hasProperty ( key ) ) { return getProperty ( key ) ; } else { return defaultAnnotation ; } } | Gets a single validation annotation from properties . |
124,331 | private List < String > getAllPConfigurationKeyValues ( ConfigurationProvider configuration ) { List < String > keyValues = new ArrayList < String > ( ) ; for ( String key : configuration . keys ( ) ) { keyValues . add ( key + "=\"" + configuration . getString ( key ) + "\"" ) ; } Collections . sort ( keyValues ) ; ret... | Returns a sorted list of all key - value pairs defined in given configuration instance . |
124,332 | public static SQLException unwrapSQLException ( Throwable throwable ) { if ( throwable == null ) { return null ; } else if ( throwable instanceof SQLException ) { return ( SQLException ) throwable ; } else if ( throwable . getCause ( ) != null ) { return unwrapSQLException ( throwable . getCause ( ) ) ; } else { return... | Looks for SQLException in the cause chain . |
124,333 | private void changeAuditInformation ( Auditable auditableEntity ) { Timestamp lastUpdated = new Timestamp ( System . currentTimeMillis ( ) ) ; auditableEntity . setLastUpdated ( lastUpdated ) ; String lastUpdatedBy = ServiceContextStore . getCurrentUser ( ) ; auditableEntity . setLastUpdatedBy ( lastUpdatedBy ) ; if ( ... | set audit informations doesn t modify createdDate and createdBy once set . Only works with DomainObjects that implement the Auditable interface . In other cases a IllegalArgumentException is thrown . |
124,334 | public boolean isExpected ( final HandlingEvent event ) { if ( getLegs ( ) . isEmpty ( ) ) { return true ; } if ( event . getType ( ) == Type . RECEIVE ) { final Leg leg = getLegs ( ) . get ( 0 ) ; return ( leg . getFrom ( ) . equals ( event . getLocation ( ) ) ) ; } if ( event . getType ( ) == Type . LOAD ) { for ( Le... | Test if the given handling event is expected when executing this itinerary . |
124,335 | public void attachItinerary ( final Itinerary itinerary ) { Validate . notNull ( itinerary ) ; itinerary ( ) . setCargo ( null ) ; setItinerary ( itinerary ) ; itinerary ( ) . setCargo ( this ) ; } | Attach a new itinerary to this cargo . |
124,336 | private < T > T nullSafe ( T actual , T safe ) { return actual == null ? safe : actual ; } | Utility for Null Object Pattern - should be moved out of this class |
124,337 | private void changeAuditInformation ( JodaAuditable auditableEntity ) { DateTime lastUpdated = new DateTime ( ) ; auditableEntity . setLastUpdated ( lastUpdated ) ; String lastUpdatedBy = ServiceContextStore . getCurrentUser ( ) ; auditableEntity . setLastUpdatedBy ( lastUpdatedBy ) ; if ( auditableEntity . getCreatedD... | set audit informations doesn t modify createdDate and createdBy once set . Only works with DomainObjects that implement the JodaAuditable interface . In other cases a IllegalArgumentException is thrown . |
124,338 | protected final void processLine ( String line , int level ) { boolean isError = doProcessLine ( line , level ) ; if ( isErrorStream || isError ) { errorCount ++ ; } lineCount ++ ; } | Depending on stream type the given line is logged and the correspondig counter is increased . |
124,339 | public void afterThrowing ( Method m , Object [ ] args , Object target , ConstraintViolationException e ) { Logger log = LoggerFactory . getLogger ( target . getClass ( ) ) ; StringBuilder logText = new StringBuilder ( excMessage ( e ) ) ; if ( e . getConstraintViolations ( ) != null && e . getConstraintViolations ( ) ... | Handles validation exception |
124,340 | public String getCollectionInterfaceType ( Reference ref ) { String collectionType = getRefCollectionType ( ref ) ; return getCollectionInterfaceType ( collectionType ) ; } | Java interface for the collection type . |
124,341 | public String getCollectionImplType ( Reference ref ) { String collectionType = getRefCollectionType ( ref ) ; return getCollectionImplType ( collectionType ) ; } | Java implementation class for the collection type . |
124,342 | public String getRefCollectionType ( Reference ref ) { String type = ref . getCollectionType ( ) ; return ( type == null ? "set" : type . toLowerCase ( ) ) ; } | Collection type can be set list bag or map . It corresponds to the Hibernate collection types . |
124,343 | public String getGetAccessor ( TypedElement e , String prefix ) { String capName = toFirstUpper ( e . getName ( ) ) ; if ( prefix != null ) { capName = toFirstUpper ( prefix ) + capName ; } String result = isBooleanPrimitiveType ( e ) ? "is" + capName : "get" + ( "Class" . equals ( capName ) ? "Class_" : capName ) ; re... | Get - accessor method name of a property according to JavaBeans naming conventions . |
124,344 | public String toFirstUpper ( String name ) { if ( name . length ( ) == 0 ) { return name ; } else { return name . substring ( 0 , 1 ) . toUpperCase ( ) + name . substring ( 1 ) ; } } | First character to upper case . |
124,345 | public String toFirstLower ( String name ) { if ( name . length ( ) == 0 ) { return name ; } else { return name . substring ( 0 , 1 ) . toLowerCase ( ) + name . substring ( 1 ) ; } } | First character to lower case . |
124,346 | public String substringBefore ( String string , String pattern ) { if ( string == null || pattern == null ) { return string ; } int pos = string . indexOf ( pattern ) ; if ( pos != - 1 ) { return string . substring ( 0 , pos ) ; } return null ; } | Gets the substring before a given pattern |
124,347 | public void addDefaultValues ( Service service ) { for ( ServiceOperation op : ( List < ServiceOperation > ) service . getOperations ( ) ) { addDefaultValues ( op ) ; } } | Fill in parameters and return values for operations that delegate to Repository . |
124,348 | private void addDefaultValues ( ServiceOperation operation ) { if ( operation . getDelegate ( ) != null ) { copyFromDelegate ( operation , operation . getDelegate ( ) , true ) ; } else if ( operation . getServiceDelegate ( ) != null ) { addDefaultValues ( operation . getServiceDelegate ( ) ) ; copyFromDelegate ( operat... | Copy values from delegate RepositoryOperation to this ServiceOperation |
124,349 | private void addDefaultValues ( ResourceOperation operation ) { if ( operation . getDelegate ( ) != null ) { copyFromDelegate ( operation , operation . getDelegate ( ) , false ) ; } } | Copy values from delegate ServiceOperation to this ResourceOperation |
124,350 | private String handleValidationAnnotations ( String validate ) { if ( validate == null ) return "" ; if ( validate . length ( ) > 15 ) { @ SuppressWarnings ( "unused" ) boolean baa = true ; } validate = validate . replaceAll ( "&&" , " " ) ; validate = validate . replaceAll ( "'" , "\"" ) ; for ( Map . Entry < String ,... | Parses the given validation string and tries to map annotations from properties . |
124,351 | public boolean isRefInverse ( Reference ref ) { if ( ref . isInverse ( ) ) { return true ; } if ( ! ref . isInverse ( ) && ( ref . getOpposite ( ) != null ) && ref . getOpposite ( ) . isInverse ( ) ) { return false ; } if ( ref . getOpposite ( ) == null ) { return false ; } String name1 = ref . getTo ( ) . getName ( ) ... | Inverse attribute for many - to - many associations . |
124,352 | private List < Reference > getAllManyReferences ( DomainObject domainObject ) { List < Reference > allReferences = domainObject . getReferences ( ) ; List < Reference > allManyReferences = new ArrayList < Reference > ( ) ; for ( Reference ref : allReferences ) { if ( ref . isMany ( ) ) { allManyReferences . add ( ref )... | List of references with multiplicity > 1 |
124,353 | private List < Reference > getAllOneReferences ( DomainObject domainObject ) { List < Reference > allReferences = domainObject . getReferences ( ) ; List < Reference > allOneReferences = new ArrayList < Reference > ( ) ; for ( Reference ref : allReferences ) { if ( ! ref . isMany ( ) ) { allOneReferences . add ( ref ) ... | List of references with multiplicity = 1 |
124,354 | public String getAsText ( ) { DateTime value = ( DateTime ) getValue ( ) ; return ( value != null ? value . toString ( this . formatter ) : "" ) ; } | Format the DateTime as String using the specified format . |
124,355 | public String getGenericType ( RepositoryOperation op ) { GenericAccessObjectStrategy strategy = genericAccessObjectStrategies . get ( op . getName ( ) ) ; if ( strategy == null ) { return "" ; } else { return strategy . getGenericType ( op ) ; } } | Get the generic type declaration for generic access objects . |
124,356 | protected boolean acceptToString ( Field field ) { return acceptedToStringTypes . contains ( field . getType ( ) ) || acceptedToStringTypes . contains ( field . getType ( ) . getName ( ) ) ; } | Subclasses may override this method to include or exclude some properties in toString . By default only simple types will be included in toString . Relations to other domain objects can not be included since we don t know if they are fetched and we don t wont toString to fetch them . |
124,357 | private static final UByte [ ] mkValues ( ) { UByte [ ] ret = new UByte [ 256 ] ; for ( int i = Byte . MIN_VALUE ; i <= Byte . MAX_VALUE ; i ++ ) ret [ i & MAX_VALUE ] = new UByte ( ( byte ) i ) ; return ret ; } | Generate a cached value for each byte value . |
124,358 | private static final UInteger [ ] mkValues ( ) { int precacheSize = getPrecacheSize ( ) ; UInteger [ ] ret ; if ( precacheSize <= 0 ) return null ; ret = new UInteger [ precacheSize ] ; for ( int i = 0 ; i < precacheSize ; i ++ ) ret [ i ] = new UInteger ( i ) ; return ret ; } | Generate a cached value for initial unsigned integer values . |
124,359 | private static UInteger getCached ( long value ) { if ( VALUES != null && value < VALUES . length ) return VALUES [ ( int ) value ] ; return null ; } | Retrieve a cached value . |
124,360 | private static UInteger valueOfUnchecked ( long value ) { UInteger cached ; if ( ( cached = getCached ( value ) ) != null ) return cached ; return new UInteger ( value , true ) ; } | Get the value of a long without checking the value . |
124,361 | private static final int getPrecacheSize ( ) { String prop = null ; long propParsed ; try { prop = System . getProperty ( PRECACHE_PROPERTY ) ; } catch ( SecurityException e ) { return DEFAULT_PRECACHE_SIZE ; } if ( prop == null ) return DEFAULT_PRECACHE_SIZE ; if ( prop . length ( ) <= 0 ) return DEFAULT_PRECACHE_SIZE... | Figure out the size of the precache . |
124,362 | private Object readResolve ( ) throws ObjectStreamException { UInteger cached ; rangeCheck ( value ) ; if ( ( cached = getCached ( value ) ) != null ) return cached ; return this ; } | Replace version read through deserialization with cached version . |
124,363 | public ColorReference brighten ( final Float brightness ) { ColorReference copy = copy ( ) ; if ( copy . brightness == null ) { copy . brightness = brightness ; } else { copy . brightness += brightness ; } return copy ; } | Brightens this color by the amount given . Returns a copy of this color object not this object itself . |
124,364 | public PointSeries addNumberPoint ( final Number y ) { Point point = new Point ( y ) ; addPoint ( point ) ; return this ; } | Adds a point with only a number . |
124,365 | public PointSeries addNumbers ( final List < Number > values ) { for ( Number number : values ) { addNumberPoint ( number ) ; } return this ; } | Adds a list of point with only numbers . |
124,366 | private void addCodeContainer ( Chart chart ) { Label codeContainer = new Label ( "code" , new StringFromResourceModel ( chart . getOptions ( ) . getClass ( ) , chart . getOptions ( ) . getClass ( ) . getSimpleName ( ) + ".java" ) ) ; codeContainer . setOutputMarkupId ( true ) ; add ( codeContainer ) ; } | Adds a code container corresponding to the current chart |
124,367 | public void setTheme ( final Theme theme ) { if ( this . themeReference != null || this . themeUrl != null ) { throw new IllegalStateException ( "A theme can only be defined once. Calling different setTheme methods is not allowed!" ) ; } this . theme = theme ; } | Sets the theme for this chart by specifying a theme class . |
124,368 | protected StringValue getVariableValue ( String parameterName ) { RequestCycle cycle = RequestCycle . get ( ) ; WebRequest webRequest = ( WebRequest ) cycle . getRequest ( ) ; StringValue value = webRequest . getRequestParameters ( ) . getParameterValue ( parameterName ) ; return value ; } | Reads the value of the given javascript variable from the AJAX request . |
124,369 | public CssStyle setProperty ( final String key , final String value ) { if ( this . properties == null ) { this . properties = new HashMap < String , String > ( ) ; } this . properties . put ( sanitizeCssPropertyName ( key ) , value ) ; return this ; } | Sets a CSS property . |
124,370 | private String sanitizeCssPropertyName ( final String propertyName ) { if ( ! propertyName . contains ( "-" ) ) { return propertyName ; } else { String sanitized = propertyName ; int index = sanitized . indexOf ( '-' ) ; while ( index != - 1 ) { String charToBeReplaced = sanitized . substring ( index + 1 , index + 2 ) ... | Replaces hyphen notation with camel case notation . |
124,371 | private int getSelectedTab ( ) { String theme = "default" ; List < PageParameters . NamedPair > pairs = getPageParameters ( ) . getAllNamed ( ) ; theme = pairs . get ( 0 ) . getValue ( ) ; if ( "grid" . equals ( theme ) ) { return 1 ; } else if ( "skies" . equals ( theme ) ) { return 2 ; } else if ( "gray" . equals ( t... | Used in the renderHead method to highlight the currently selected theme tab |
124,372 | private List < BrowserUsageData > getBrowserData ( ) { List < BrowserUsageData > browserData = new ArrayList < BrowserUsageData > ( ) ; browserData . add ( getMSIEUsageData ( ) ) ; browserData . add ( getFirefoxUsageData ( ) ) ; browserData . add ( getChromeUsageData ( ) ) ; browserData . add ( getSafariUsageData ( ) )... | Creates the data displayed in the donut chart . |
124,373 | private BrowserUsageData getChromeUsageData ( ) { BrowserUsageData data = new BrowserUsageData ( ) ; data . setBrowserName ( "Chrome" ) ; data . setMarketShare ( 11.94f ) ; ColorReference chromeColor = new HighchartsColor ( 2 ) ; data . setColor ( chromeColor ) ; data . getVersionUsageData ( ) . add ( new VersionUsageD... | Creates the Chrome data . |
124,374 | private BrowserUsageData getFirefoxUsageData ( ) { BrowserUsageData data = new BrowserUsageData ( ) ; data . setBrowserName ( "Firefox" ) ; data . setMarketShare ( 21.63f ) ; ColorReference ffColor = new HighchartsColor ( 1 ) ; data . setColor ( ffColor ) ; data . getVersionUsageData ( ) . add ( new VersionUsageData ( ... | Creates the Firefox data . |
124,375 | private BrowserUsageData getMSIEUsageData ( ) { BrowserUsageData data = new BrowserUsageData ( ) ; data . setBrowserName ( "MSIE" ) ; data . setMarketShare ( 55.11f ) ; ColorReference ieColor = new HighchartsColor ( 0 ) ; data . setColor ( ieColor ) ; data . getVersionUsageData ( ) . add ( new VersionUsageData ( "MSIE ... | Creates the Internet Explorer data . |
124,376 | private BrowserUsageData getOperaUsageData ( ) { BrowserUsageData data = new BrowserUsageData ( ) ; data . setBrowserName ( "Opera" ) ; data . setMarketShare ( 2.14f ) ; ColorReference operaColor = new HighchartsColor ( 4 ) ; data . setColor ( operaColor ) ; data . getVersionUsageData ( ) . add ( new VersionUsageData (... | Creates the Opera data . |
124,377 | private BrowserUsageData getSafariUsageData ( ) { BrowserUsageData data = new BrowserUsageData ( ) ; data . setBrowserName ( "Safari" ) ; data . setMarketShare ( 7.15f ) ; ColorReference safariColor = new HighchartsColor ( 3 ) ; data . setColor ( safariColor ) ; data . getVersionUsageData ( ) . add ( new VersionUsageDa... | Creates the Safari data . |
124,378 | public void renderHead ( final IHeaderResponse response ) { int selectedTab = this . getSelectedTab ( ) ; response . render ( OnDomReadyHeaderItem . forScript ( "$('#themes li:eq(" + selectedTab + ") a').tab('show');" ) ) ; } | Highlights the currently selected theme tab |
124,379 | public < T > void addSerializer ( final Class < T > clazz , final JsonSerializer < T > serializer ) { this . jacksonModule . addSerializer ( clazz , serializer ) ; } | This method gives the opportunity to add a custom serializer to serializer one of the highchart option classes . It may be neccessary to serialize certain option classes differently for different web frameworks . |
124,380 | public Series < D > addPoint ( final D point ) { if ( this . data == null ) { this . data = new ArrayList < D > ( ) ; } this . data . add ( point ) ; return this ; } | Adds a point to this series . |
124,381 | public void setRenderTo ( final Options options , final String renderTo ) { if ( options . getChartOptions ( ) == null ) { options . setChartOptions ( new ChartOptions ( ) ) ; } options . getChartOptions ( ) . setRenderTo ( renderTo ) ; } | Null - safe setter for the renderTo configuration . |
124,382 | public static boolean needsFunnelJs ( final Options options ) { return options . getChart ( ) != null && ( options . getChart ( ) . getType ( ) == SeriesType . FUNNEL || options . getChart ( ) . getType ( ) == SeriesType . PYRAMID ) ; } | Checks if the specified Options object needs the javascript file funnel . js to work properly . This method can be called by GUI components to determine whether the javascript file has to be included in the page or not . |
124,383 | public static boolean needsHeatmapJs ( final Options options ) { return options . getChart ( ) != null && ( options . getChart ( ) . getType ( ) == SeriesType . HEATMAP ) ; } | Checks if the specified Options object needs the javascript file heatmap . js to work properly . This method can be called by GUI components to determine whether the javascript file has to be included in the page or not . |
124,384 | public static boolean needsExportingJs ( final Options options ) { return options . getExporting ( ) == null || ( options . getExporting ( ) . getEnabled ( ) != null && options . getExporting ( ) . getEnabled ( ) ) ; } | Checks if the specified Options object needs the javascript file exporting . js to work properly . This method can be called by GUI components to determine whether the javascript file has to be included in the page or not . |
124,385 | private void addCharts ( PageParameters parameters ) { List < Chart > charts = getChartFromParams ( parameters ) ; if ( charts . size ( ) > 1 ) { List < SmallChartComponent > components = new ArrayList < > ( ) ; for ( Chart i : charts ) { components . add ( new SmallChartComponent ( i ) ) ; } add ( new ListView < Small... | Gets the charts and the code containers from the page parameters constructs Wicket componenets from them and adds them to a Wicket ListView . |
124,386 | @ SuppressWarnings ( "unchecked" ) private Zipper < K , V > compareDepth ( Tree < K , V > left , Tree < K , V > right ) { return unzipBoth ( left , right , ( List < Tree < K , V > > ) Collections . EMPTY_LIST , ( List < Tree < K , V > > ) Collections . EMPTY_LIST , 0 ) ; } | If the trees were balanced returns an empty zipper |
124,387 | private List < Tree < K , V > > unzip ( List < Tree < K , V > > zipper , boolean leftMost ) { Tree < K , V > next = leftMost ? zipper . get ( 0 ) . getLeft ( ) : zipper . get ( 0 ) . getRight ( ) ; if ( next == null ) return zipper ; return unzip ( cons ( next , zipper ) , leftMost ) ; } | Once a side is found to be deeper unzip it to the bottom |
124,388 | @ SuppressWarnings ( "unchecked" ) private Zipper < K , V > unzipBoth ( Tree < K , V > left , Tree < K , V > right , List < Tree < K , V > > leftZipper , List < Tree < K , V > > rightZipper , int smallerDepth ) { if ( isBlackTree ( left ) && isBlackTree ( right ) ) { return unzipBoth ( left . getRight ( ) , right . get... | found to be deeper or the bottom is reached |
124,389 | public E get ( int index ) { int idx = checkRangeConvert ( index ) ; return pointer . getElem ( idx , idx ^ focus ) ; } | with local variables exclusively . But we re not quite there yet ... |
124,390 | private void cleanLeftEdge ( int cutIndex ) { if ( cutIndex < ( 1 << 5 ) ) { zeroLeft ( pointer . display0 , cutIndex ) ; } else if ( cutIndex < ( 1 << 10 ) ) { zeroLeft ( pointer . display0 , cutIndex & 0x1f ) ; pointer . display1 = copyRight ( pointer . display1 , ( cutIndex >>> 5 ) ) ; } else if ( cutIndex < ( 1 << ... | requires structure is at index cutIndex and writable at level 0 |
124,391 | @ SuppressWarnings ( "unchecked" ) public E getElem ( int index , int xor ) { if ( xor < ( 1 << 5 ) ) { return ( E ) display0 [ index & 31 ] ; } else if ( xor < ( 1 << 10 ) ) { return ( E ) ( ( Object [ ] ) display1 [ ( index >> 5 ) & 31 ] ) [ index & 31 ] ; } else if ( xor < ( 1 << 15 ) ) { return ( E ) ( ( Object [ ]... | requires structure is at pos oldIndex = xor ^ index |
124,392 | public void stabilize ( int index ) { switch ( depth - 1 ) { case 5 : display5 = copyOf ( display5 ) ; display4 = copyOf ( display4 ) ; display3 = copyOf ( display3 ) ; display2 = copyOf ( display2 ) ; display1 = copyOf ( display1 ) ; display5 [ ( index >> 25 ) & 31 ] = display4 ; display4 [ ( index >> 20 ) & 31 ] = di... | ensures structure is clean and at pos index and writable at all levels except 0 |
124,393 | public Object [ ] copyRange ( Object [ ] array , int oldLeft , int newLeft ) { Object [ ] elems = new Object [ 32 ] ; System . arraycopy ( array , oldLeft , elems , newLeft , 32 - Math . max ( newLeft , oldLeft ) ) ; return elems ; } | USED IN DROP |
124,394 | private void updateProgressButton ( ProgressButton progressButton , SeekBar progressSeekBar ) { progressButton . setProgress ( progressSeekBar . getProgress ( ) ) ; updatePinProgressContentDescription ( progressButton ) ; } | Helper method to update the progressButton s progress and it s content description . |
124,395 | private void updatePinProgressContentDescription ( ProgressButton button ) { int progress = button . getProgress ( ) ; if ( progress <= 0 ) { button . setContentDescription ( getString ( button . isChecked ( ) ? R . string . content_desc_pinned_not_downloaded : R . string . content_desc_unpinned_not_downloaded ) ) ; } ... | Helper method to update the progressButton s content description . |
124,396 | private ProgressButton addProgressButton ( LinearLayout container ) { final LinearLayout . LayoutParams layoutParams = new LinearLayout . LayoutParams ( 0 , LinearLayout . LayoutParams . WRAP_CONTENT , 1.0f ) ; final ProgressButton progressButton = new ProgressButton ( this ) ; progressButton . setLayoutParams ( layout... | Helper function that creates a new progress button adds it to the given layout . Returns a reference to the progress button for customization . |
124,397 | public void setMax ( int max ) { if ( max <= 0 || max < mProgress ) { throw new IllegalArgumentException ( String . format ( "Max (%d) must be > 0 and >= %d" , max , mProgress ) ) ; } mMax = max ; invalidate ( ) ; } | Sets the maximum progress value . Defaults to 100 . |
124,398 | public void setProgressAndMax ( int progress , int max ) { if ( progress > max || progress < 0 ) { throw new IllegalArgumentException ( String . format ( "Progress (%d) must be between %d and %d" , progress , 0 , max ) ) ; } else if ( max <= 0 ) { throw new IllegalArgumentException ( String . format ( "Max (%d) must be... | Sets the current progress and maximum progress value both of which must be valid values . |
124,399 | public void setMaxStrokeWidth ( float width ) { maxStrokeWidth = TypedValue . applyDimension ( TypedValue . COMPLEX_UNIT_DIP , width , getResources ( ) . getDisplayMetrics ( ) ) ; } | Sets the maximum stroke width |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.