idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
600
protected void processClass ( ClassDoc doc ) { defaultProcess ( doc , true ) ; for ( MemberDoc member : doc . fields ( ) ) { processMember ( member ) ; } for ( MemberDoc member : doc . constructors ( ) ) { processMember ( member ) ; } for ( MemberDoc member : doc . methods ( ) ) { processMember ( member ) ; } if ( doc ...
Process the class documentation .
601
protected void processPackage ( PackageDoc doc ) { try { Field foundDoc = doc . getClass ( ) . getDeclaredField ( "foundDoc" ) ; foundDoc . setAccessible ( true ) ; foundDoc . set ( doc , false ) ; } catch ( Exception e ) { printWarning ( doc . position ( ) , "Cannot suppress warning about multiple package sources: " +...
Process the package documentation .
602
protected void defaultProcess ( Doc doc , boolean fixLeadingSpaces ) { try { StringBuilder buf = new StringBuilder ( ) ; buf . append ( getOptions ( ) . toHtml ( doc . commentText ( ) , fixLeadingSpaces ) ) ; buf . append ( '\n' ) ; for ( Tag tag : doc . tags ( ) ) { processTag ( tag , buf ) ; buf . append ( '\n' ) ; }...
Default processing of any documentation node .
603
@ SuppressWarnings ( "unchecked" ) protected void processTag ( Tag tag , StringBuilder target ) { TagRenderer < Tag > renderer = ( TagRenderer < Tag > ) tagRenderers . get ( tag . kind ( ) ) ; if ( renderer == null ) { renderer = TagRenderer . VERBATIM ; } renderer . render ( tag , target , this ) ; }
Process a tag .
604
public static void main ( String [ ] args ) throws Exception { args = Arrays . copyOf ( args , args . length + 2 ) ; args [ args . length - 2 ] = "-doclet" ; args [ args . length - 1 ] = MarkdownDoclet . class . getName ( ) ; Main . main ( args ) ; }
Just a main method for debugging .
605
public String [ ] [ ] load ( String [ ] [ ] options , DocErrorReporter errorReporter ) { LinkedList < String [ ] > optionsList = new LinkedList < > ( Arrays . asList ( options ) ) ; Iterator < String [ ] > optionsIter = optionsList . iterator ( ) ; while ( optionsIter . hasNext ( ) ) { String [ ] opt = optionsIter . ne...
Loads the options from the command line .
606
public JavadocQuirks getJavadocVersion ( ) { if ( javadocVersion == null ) { String javaVersion = System . getProperty ( "java.version" ) ; if ( javaVersion != null && javaVersion . compareTo ( "1.8" ) >= 0 ) { return JavadocQuirks . V8 ; } else { return JavadocQuirks . V7 ; } } return javadocVersion ; }
Gets the Javadoc version .
607
public void visit ( VerbatimNode node ) { if ( options . isHighlightEnabled ( ) && ! options . isAutoHighlightEnabled ( ) && node . getType ( ) . isEmpty ( ) ) { VerbatimNode noHighlightNode = new VerbatimNode ( node . getText ( ) , "no-highlight" ) ; noHighlightNode . setStartIndex ( node . getStartIndex ( ) ) ; noHig...
Overrides the default implementation to set the language to no - highlight no language is specified . If highlighting is disabled or auto - highlighting is enabled this method just calls the default implementation .
608
private static String createTagletPattern ( String tagNames ) { final StringBuilder regex = new StringBuilder ( ) ; final int size = STR_TAGS_REGEX_LIST . size ( ) ; for ( int regexIdx = 0 ; regexIdx < size ; regexIdx ++ ) { final String tagRegex = STR_TAGS_REGEX_LIST . get ( regexIdx ) ; final String argsRex = STR_ARG...
Creates the taglet pattern from tagNames .
609
public static ServiceContext createServiceContext ( ServletRequest request ) { if ( ! ( request instanceof HttpServletRequest ) ) { throw new IllegalArgumentException ( "Expected HttpServletRequest" ) ; } return createServiceContext ( ( HttpServletRequest ) request ) ; }
Convenience method it requires that the request is a HttpServletRequest .
610
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
611
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
612
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
613
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
614
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
615
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
616
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
617
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
618
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
619
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 .
620
public void afterThrowing ( Method m , Object [ ] args , Object target , ConcurrencyFailureException e ) throws OptimisticLockingException { handleOptimisticLockingException ( target , e ) ; }
Spring exception for Optimistic Locking .
621
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 .
622
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 .
623
public String getAsText ( ) { LocalDate value = ( LocalDate ) getValue ( ) ; return ( value != null ? value . toString ( this . formatter ) : "" ) ; }
Format the LocalDate as String using the specified format .
624
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
625
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
626
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
627
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 .
628
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 .
629
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
630
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 .
631
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
632
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
633
@ 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
634
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 .
635
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 .
636
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 .
637
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 .
638
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 .
639
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 .
640
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 .
641
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 .
642
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 .
643
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 .
644
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 .
645
public void attachItinerary ( final Itinerary itinerary ) { Validate . notNull ( itinerary ) ; itinerary ( ) . setCargo ( null ) ; setItinerary ( itinerary ) ; itinerary ( ) . setCargo ( this ) ; }
Attach a new itinerary to this cargo .
646
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
647
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 .
648
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 .
649
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
650
public String getCollectionInterfaceType ( Reference ref ) { String collectionType = getRefCollectionType ( ref ) ; return getCollectionInterfaceType ( collectionType ) ; }
Java interface for the collection type .
651
public String getCollectionImplType ( Reference ref ) { String collectionType = getRefCollectionType ( ref ) ; return getCollectionImplType ( collectionType ) ; }
Java implementation class for the collection type .
652
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 .
653
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 .
654
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 .
655
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 .
656
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
657
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 .
658
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
659
private void addDefaultValues ( ResourceOperation operation ) { if ( operation . getDelegate ( ) != null ) { copyFromDelegate ( operation , operation . getDelegate ( ) , false ) ; } }
Copy values from delegate ServiceOperation to this ResourceOperation
660
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 .
661
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 .
662
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
663
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
664
public String getAsText ( ) { DateTime value = ( DateTime ) getValue ( ) ; return ( value != null ? value . toString ( this . formatter ) : "" ) ; }
Format the DateTime as String using the specified format .
665
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 .
666
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 .
667
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 .
668
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 .
669
private static UInteger getCached ( long value ) { if ( VALUES != null && value < VALUES . length ) return VALUES [ ( int ) value ] ; return null ; }
Retrieve a cached value .
670
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 .
671
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 .
672
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 .
673
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 .
674
public PointSeries addNumberPoint ( final Number y ) { Point point = new Point ( y ) ; addPoint ( point ) ; return this ; }
Adds a point with only a number .
675
public PointSeries addNumbers ( final List < Number > values ) { for ( Number number : values ) { addNumberPoint ( number ) ; } return this ; }
Adds a list of point with only numbers .
676
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
677
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 .
678
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 .
679
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 .
680
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 .
681
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
682
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 .
683
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 .
684
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 .
685
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 .
686
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 .
687
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 .
688
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
689
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 .
690
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 .
691
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 .
692
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 .
693
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 .
694
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 .
695
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 .
696
@ 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
697
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
698
@ 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
699
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 ...