idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
9,000
public < V > V execute ( RedisCallback < V > cb ) { Jedis jedis = jedisPool . getResource ( ) ; boolean success = true ; try { return cb . execute ( jedis ) ; } catch ( JedisException e ) { success = false ; if ( jedis != null ) { jedisPool . returnBrokenResource ( jedis ) ; } throw e ; } finally { if ( success ) { jedisPool . returnResource ( jedis ) ; } } }
execute a redis operation
9,001
public byte [ ] encode ( T t ) { if ( t == null ) { if ( ! nullable ) { throw new InvalidArgument ( "cannot encode a null type" ) ; } return getNullValue ( ) ; } return encodeType ( t ) ; }
Encodes the column s type .
9,002
void setSize ( int size ) { if ( this . size != 0 ) { final String fmt = "column size is known: %d" ; final String msg = format ( fmt , this . size ) ; throw new IllegalStateException ( msg ) ; } this . size = size ; this . hash = hash ( ) ; }
Sets the column s size and recalculates its hash .
9,003
public static String [ ] [ ] additionalContext ( final String [ ] tokens , final Map < String , String > prevMap ) { final String [ ] [ ] ac = new String [ tokens . length ] [ 1 ] ; for ( int ti = 0 ; ti < tokens . length ; ti ++ ) { final String pt = prevMap . get ( tokens [ ti ] ) ; ac [ ti ] [ 0 ] = "pd=" + pt ; } return ac ; }
Generated previous decision features for each token based on contents of the specified map .
9,004
public static Point getSize ( String path ) { BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inJustDecodeBounds = true ; BitmapFactory . decodeFile ( path , options ) ; int width = options . outWidth ; int height = options . outHeight ; return new Point ( width , height ) ; }
Get width and height of the bitmap specified with the file path .
9,005
public static Point getSize ( byte [ ] byteArray , int offset , int length ) { BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inJustDecodeBounds = true ; BitmapFactory . decodeByteArray ( byteArray , offset , length , options ) ; int width = options . outWidth ; int height = options . outHeight ; return new Point ( width , height ) ; }
Get width and height of the bitmap specified with the byte array .
9,006
public static Point getSize ( Resources res , int resId ) { BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inJustDecodeBounds = true ; BitmapFactory . decodeResource ( res , resId , options ) ; int width = options . outWidth ; int height = options . outHeight ; return new Point ( width , height ) ; }
Get width and height of the bitmap specified with the resource id .
9,007
public static byte [ ] toByteArray ( Bitmap bitmap , Bitmap . CompressFormat format , int quality ) { ByteArrayOutputStream out = null ; try { out = new ByteArrayOutputStream ( ) ; bitmap . compress ( format , quality , out ) ; return out . toByteArray ( ) ; } finally { CloseableUtils . close ( out ) ; } }
Compress the bitmap to the byte array as the specified format and quality .
9,008
public static Bitmap shrink ( Bitmap bitmap , float scale ) { if ( scale >= 1.0f ) { return bitmap . copy ( bitmap . getConfig ( ) , false ) ; } Matrix matrix = new Matrix ( ) ; matrix . postScale ( scale , scale ) ; return Bitmap . createBitmap ( bitmap , 0 , 0 , ( int ) ( scale * bitmap . getWidth ( ) ) , ( int ) ( scale * bitmap . getHeight ( ) ) , matrix , true ) ; }
Shrink the bitmap to the specified scale .
9,009
@ TargetApi ( Build . VERSION_CODES . FROYO ) public static File storeOnExternalStorage ( Context context , Bitmap bitmap , String type , String path , String filename , Bitmap . CompressFormat format , int quality ) { if ( ! Environment . MEDIA_MOUNTED . equals ( Environment . getExternalStorageState ( ) ) ) { return null ; } File dir = new File ( context . getExternalFilesDir ( type ) , path ) ; FileUtils . makeDirsIfNeeded ( dir ) ; File file = new File ( dir , filename ) ; if ( ! storeAsFile ( bitmap , file , format , quality ) ) { return null ; } return file ; }
Store the bitmap on the external storage path .
9,010
public static File storeOnCacheDir ( Context context , Bitmap bitmap , String path , String filename , Bitmap . CompressFormat format , int quality ) { File dir = new File ( context . getCacheDir ( ) , path ) ; FileUtils . makeDirsIfNeeded ( dir ) ; File file = new File ( dir , filename ) ; if ( ! storeAsFile ( bitmap , file , format , quality ) ) { return null ; } return file ; }
Store the bitmap on the cache directory path .
9,011
public static boolean storeOnApplicationPrivateDir ( Context context , Bitmap bitmap , String filename , Bitmap . CompressFormat format , int quality ) { OutputStream out = null ; try { out = new BufferedOutputStream ( context . openFileOutput ( filename , Context . MODE_PRIVATE ) ) ; return bitmap . compress ( format , quality , out ) ; } catch ( FileNotFoundException e ) { Log . e ( TAG , "no such file for saving bitmap: " , e ) ; return false ; } finally { CloseableUtils . close ( out ) ; } }
Store the bitmap on the application private directory path .
9,012
public static boolean storeAsFile ( Bitmap bitmap , File file , Bitmap . CompressFormat format , int quality ) { OutputStream out = null ; try { out = new BufferedOutputStream ( new FileOutputStream ( file ) ) ; return bitmap . compress ( format , quality , out ) ; } catch ( FileNotFoundException e ) { Log . e ( TAG , "no such file for saving bitmap: " , e ) ; return false ; } finally { CloseableUtils . close ( out ) ; } }
Store the bitmap as a file .
9,013
public CBlob toCBlob ( ) { CBlob cBlob = new CBlob ( getPath ( ) , length , contentType ) ; cBlob . setModificationDate ( updated ) ; return cBlob ; }
Converts a CloudMe Blob to a generic CBlob
9,014
protected String punct ( final Parse punct , final int i ) { final StringBuilder feat = new StringBuilder ( 5 ) ; feat . append ( i ) . append ( "=" ) ; feat . append ( punct . getCoveredText ( ) ) ; return feat . toString ( ) ; }
Creates punctuation feature for the specified punctuation at the specified index based on the punctuation mark .
9,015
protected String punctbo ( final Parse punct , final int i ) { final StringBuilder feat = new StringBuilder ( 5 ) ; feat . append ( i ) . append ( "=" ) ; feat . append ( punct . getType ( ) ) ; return feat . toString ( ) ; }
Creates punctuation feature for the specified punctuation at the specfied index based on the punctuation s tag .
9,016
protected void checkcons ( final Parse child , final String i , final String type , final List < String > features ) { final StringBuilder feat = new StringBuilder ( 20 ) ; feat . append ( "c" ) . append ( i ) . append ( "=" ) . append ( child . getType ( ) ) . append ( "|" ) . append ( child . getHead ( ) . getCoveredText ( ) ) . append ( "|" ) . append ( type ) ; features . add ( feat . toString ( ) ) ; feat . setLength ( 0 ) ; feat . append ( "c" ) . append ( i ) . append ( "*=" ) . append ( child . getType ( ) ) . append ( "|" ) . append ( type ) ; features . add ( feat . toString ( ) ) ; }
Produces features to determine whether the specified child node is part of a complete constituent of the specified type and adds those features to the specfied list .
9,017
protected void getFrontierNodes ( final List < Parse > rf , final Parse [ ] nodes ) { int leftIndex = 0 ; int prevHeadIndex = - 1 ; for ( int fi = 0 ; fi < rf . size ( ) ; fi ++ ) { final Parse fn = rf . get ( fi ) ; final int headIndex = fn . getHeadIndex ( ) ; if ( headIndex != prevHeadIndex ) { nodes [ leftIndex ] = fn ; leftIndex ++ ; prevHeadIndex = headIndex ; if ( leftIndex == nodes . length ) { break ; } } } for ( int ni = leftIndex ; ni < nodes . length ; ni ++ ) { nodes [ ni ] = null ; } }
Populates specified nodes array with left - most right frontier node with a unique head . If the right frontier doesn t contain enough nodes then nulls are placed in the array elements .
9,018
public List < Integer > getParameterIndexes ( final int tid ) { List < Integer > ret = termParameterIndex . get ( tid ) ; if ( ret == null ) { ret = emptyList ( ) ; } return unmodifiableList ( ret ) ; }
Returns the parameter indices for the provided term index .
9,019
public int getNumberOfTermParameterMappings ( ) { int i = 0 ; for ( final List < Integer > value : termParameterIndex . values ( ) ) i += value . size ( ) ; return i ; }
Returns the number of term - parameter mappings
9,020
public int readLittleInt ( ) throws IOException { int ch1 = read ( ) ; int ch2 = read ( ) ; int ch3 = read ( ) ; int ch4 = read ( ) ; if ( ( ch1 | ch2 | ch3 | ch4 ) < 0 ) { throw new EOFException ( ) ; } return ( ch1 + ( ch2 << 8 ) + ( ch3 << 16 ) + ( ch4 << 24 ) ) ; }
reads a single integer value in little endian order
9,021
protected boolean addLayer ( Layer layer ) { int index = getLayerIndex ( layer ) ; if ( index < 0 ) { view . add ( new LayerControlPanel ( mapPresenter , layer , disableToggleOutOfRange ) ) ; return true ; } return false ; }
Add a layer to the legend drop down panel .
9,022
protected boolean removeLayer ( Layer layer ) { int index = getLayerIndex ( layer ) ; if ( index >= 0 ) { view . removeWidget ( index ) ; return true ; } return false ; }
Remove a layer from the drop down content panel again .
9,023
protected LabeledTextAreaPanel < String , DeregistrationModelBean > newMotivation ( final String id , final IModel < DeregistrationModelBean > model ) { final IModel < String > labelModel = ResourceModelFactory . newResourceModel ( ResourceBundleKey . builder ( ) . key ( "sem.main.feedback.deregistration.user.label" ) . defaultValue ( "Please confirm the deregistration" ) . parameters ( ListExtensions . toObjectArray ( getDomainName ( ) ) ) . build ( ) , this ) ; final IModel < String > placeholderModel = ResourceModelFactory . newResourceModel ( "global.enter.your.deregistration.motivation.label" , this , "Enter here your deregistration motivation." ) ; final LabeledTextAreaPanel < String , DeregistrationModelBean > description = new LabeledTextAreaPanel < String , DeregistrationModelBean > ( id , model , labelModel ) { private static final long serialVersionUID = 1L ; protected TextArea < String > newTextArea ( final String id , final IModel < DeregistrationModelBean > model ) { final TextArea < String > textArea = super . newTextArea ( id , model ) ; if ( placeholderModel != null ) { textArea . add ( new AttributeAppender ( "placeholder" , placeholderModel ) ) ; } return textArea ; } } ; return description ; }
Factory method for creating the LabeledTextAreaPanel . This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a Form .
9,024
public static synchronized SystemConfiguration createSystemConfiguration ( ) throws IOException { if ( self == null ) { if ( getenv ( BELFRAMEWORK_HOME_ENV_VAR ) == null ) { String err = MISSING_SYSCFG ; err = err . concat ( ": environment variable not set " ) ; err = err . concat ( BELFRAMEWORK_HOME_ENV_VAR ) ; throw new IOException ( err ) ; } self = new SystemConfiguration ( ) ; } return self ; }
Creates the system configuration as defined by the environment .
9,025
public static void main ( String ... args ) { final String cfgpath = "../docs/configuration/belframework.cfg" ; final File cfgfile = new File ( cfgpath ) ; try { SystemConfiguration syscfg = createSystemConfiguration ( cfgfile ) ; out . println ( syscfg . defaultConfiguration ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Prints the default system configuration .
9,026
private void searchAtLocation ( Coordinate location , boolean isShift ) { Geometry point = new Geometry ( Geometry . POINT , 0 , - 1 ) ; point . setCoordinates ( new Coordinate [ ] { location } ) ; GeomajasServerExtension . getInstance ( ) . getServerFeatureService ( ) . search ( mapPresenter , point , pixelsToUnits ( pixelTolerance ) , QueryType . INTERSECTS , searchLayerType , - 1 , new SelectionCallback ( isShift , false ) ) ; }
Search for features at a certain location .
9,027
private double pixelsToUnits ( int pixels ) { Coordinate c1 = mapPresenter . getViewPort ( ) . getTransformationService ( ) . transform ( new Coordinate ( 0 , 0 ) , RenderSpace . SCREEN , RenderSpace . WORLD ) ; Coordinate c2 = mapPresenter . getViewPort ( ) . getTransformationService ( ) . transform ( new Coordinate ( pixels , 0 ) , RenderSpace . SCREEN , RenderSpace . WORLD ) ; return MathService . distance ( c1 , c2 ) ; }
Transform a pixel - length into a real - life distance expressed in map CRS . This depends on the current map scale .
9,028
public static final Properties read ( String classpath ) throws IOException { final URL url = Resources . getResource ( classpath ) ; final ByteSource byteSource = Resources . asByteSource ( url ) ; final Properties properties = new Properties ( ) ; InputStream inputStream = null ; try { inputStream = byteSource . openBufferedStream ( ) ; properties . load ( inputStream ) ; } catch ( final IOException ioException ) { ioException . printStackTrace ( ) ; } finally { if ( inputStream != null ) { try { inputStream . close ( ) ; } catch ( final IOException ioException ) { throw ioException ; } } } return properties ; }
read properties from classpath
9,029
public void execute ( Bbox worldBounds ) { View endView = mapPresenter . getViewPort ( ) . asView ( worldBounds , ZoomOption . LEVEL_CLOSEST ) ; mapPresenter . getViewPort ( ) . registerAnimation ( NavigationAnimationFactory . createZoomIn ( mapPresenter , endView ) ) ; }
Effectively zoom to the bounds that the user drew on the map .
9,030
public static void setWindow ( final TrainingParameters params ) { if ( leftWindow == - 1 || rightWindow == - 1 ) { leftWindow = getWindowRange ( params ) . get ( 0 ) ; rightWindow = getWindowRange ( params ) . get ( 1 ) ; } }
Set the window length from the training parameters file .
9,031
private static List < Integer > getWindowRange ( final TrainingParameters params ) { final List < Integer > windowRange = new ArrayList < Integer > ( ) ; final String windowParam = Flags . getWindow ( params ) ; final String [ ] windowArray = windowParam . split ( "[ :-]" ) ; if ( windowArray . length == 2 ) { windowRange . add ( Integer . parseInt ( windowArray [ 0 ] ) ) ; windowRange . add ( Integer . parseInt ( windowArray [ 1 ] ) ) ; } return windowRange ; }
Get the window range feature .
9,032
private SignatureFieldExtension initExtension ( ) { SignatureFieldExtension ext = new SignatureFieldExtension ( this ) ; ext . addSignatureChangeListener ( new SignatureFieldExtension . SignatureChangeListener ( ) { private static final long serialVersionUID = 1L ; public void signatureChange ( SignatureFieldExtension . SignatureChangeEvent event ) { changingVariables = true ; try { setValue ( event . getSignature ( ) , true ) ; } finally { changingVariables = false ; } } } ) ; return ext ; }
Creates the javascript extension used to communicate with the client - side .
9,033
protected void setInternalValue ( String newValue , boolean repaintIsNotNeeded ) { super . setInternalValue ( newValue ) ; extension . setSignature ( newValue , changingVariables || repaintIsNotNeeded ) ; }
Sets the internal field value . May sends the value to the client - side .
9,034
public String getDeepestFolderId ( ) { if ( filesChain . isEmpty ( ) ) { return "root" ; } JSONObject last = filesChain . getLast ( ) ; if ( GoogleDrive . MIME_TYPE_DIRECTORY . equals ( last . getString ( "mimeType" ) ) ) { return last . getString ( "id" ) ; } if ( filesChain . size ( ) == 1 ) { return "root" ; } return filesChain . get ( filesChain . size ( ) - 2 ) . getString ( "id" ) ; }
If this remote path does not exist this is the last existing id or root .
9,035
UserCredentials fetchUserCredentials ( String code ) { HttpPost post = new HttpPost ( accessTokenUrl ) ; List < NameValuePair > parameters = new ArrayList < NameValuePair > ( ) ; parameters . add ( new BasicNameValuePair ( OAuth2 . CLIENT_ID , appInfo . getAppId ( ) ) ) ; parameters . add ( new BasicNameValuePair ( OAuth2 . CLIENT_SECRET , appInfo . getAppSecret ( ) ) ) ; parameters . add ( new BasicNameValuePair ( OAuth2 . CODE , code ) ) ; parameters . add ( new BasicNameValuePair ( OAuth2 . GRANT_TYPE , OAuth2 . AUTHORIZATION_CODE ) ) ; if ( appInfo . getRedirectUrl ( ) != null ) { parameters . add ( new BasicNameValuePair ( OAuth2 . REDIRECT_URI , appInfo . getRedirectUrl ( ) ) ) ; } try { post . setEntity ( new UrlEncodedFormEntity ( parameters , PcsUtils . UTF8 . name ( ) ) ) ; } catch ( UnsupportedEncodingException ex ) { throw new CStorageException ( "Can't encode parameters" , ex ) ; } HttpResponse response ; try { response = httpClient . execute ( post ) ; } catch ( IOException e ) { throw new CStorageException ( "HTTP request while fetching token has failed" , e ) ; } final String json ; try { json = EntityUtils . toString ( response . getEntity ( ) , PcsUtils . UTF8 . name ( ) ) ; } catch ( IOException e ) { throw new CStorageException ( "Can't retrieve json string in HTTP response entity" , e ) ; } LOGGER . debug ( "fetchUserCredentials - json: {}" , json ) ; Credentials credentials = Credentials . createFromJson ( json ) ; userCredentials = new UserCredentials ( appInfo , null , credentials ) ; return userCredentials ; }
Fetches user credentials
9,036
public static float [ ] restoreVertices ( int [ ] intVertices , int [ ] gridIndices , Grid grid , float vertexPrecision ) { int ve = CTM_POSITION_ELEMENT_COUNT ; int vc = intVertices . length / ve ; int prevGridIndex = 0x7fffffff ; int prevDeltaX = 0 ; float [ ] vertices = new float [ vc * ve ] ; for ( int i = 0 ; i < vc ; ++ i ) { int gridIdx = gridIndices [ i ] ; float [ ] gridOrigin = gridIdxToPoint ( grid , gridIdx ) ; int deltaX = intVertices [ i * ve ] ; if ( gridIdx == prevGridIndex ) { deltaX += prevDeltaX ; } vertices [ i * ve ] = vertexPrecision * deltaX + gridOrigin [ 0 ] ; vertices [ i * ve + 1 ] = vertexPrecision * intVertices [ i * ve + 1 ] + gridOrigin [ 1 ] ; vertices [ i * ve + 2 ] = vertexPrecision * intVertices [ i * ve + 2 ] + gridOrigin [ 2 ] ; prevGridIndex = gridIdx ; prevDeltaX = deltaX ; } return vertices ; }
Calculate inverse derivatives of the vertices .
9,037
public static float [ ] gridIdxToPoint ( Grid grid , int idx ) { int [ ] gridIdx = new int [ 3 ] ; int ydiv = grid . getDivision ( ) . getX ( ) ; int zdiv = ydiv * grid . getDivision ( ) . getY ( ) ; gridIdx [ 2 ] = idx / zdiv ; idx -= gridIdx [ 2 ] * zdiv ; gridIdx [ 1 ] = idx / ydiv ; idx -= gridIdx [ 1 ] * ydiv ; gridIdx [ 0 ] = idx ; Vec3f size = grid . getSize ( ) ; float [ ] point = { gridIdx [ 0 ] * size . getX ( ) + grid . getMin ( ) . getX ( ) , gridIdx [ 1 ] * size . getY ( ) + grid . getMin ( ) . getY ( ) , gridIdx [ 2 ] * size . getZ ( ) + grid . getMin ( ) . getZ ( ) } ; return point ; }
Convert a grid index to a point .
9,038
public MapConfiguration createLocalMap ( String crs , CrsType type , Bbox bounds , int minTileSize , int nrOfZoomLevels ) { MapConfiguration mapConfiguration = createTmsMap ( crs , type , bounds , minTileSize , nrOfZoomLevels ) ; mapConfiguration . setHintValue ( PROFILE , Profile . LOCAL ) ; return mapConfiguration ; }
Create a map configuration with a local profile .
9,039
public TmsLayer createLayer ( String id , TileConfiguration tileConfiguration , TmsLayerConfiguration layerConfiguration ) { return new TmsLayer ( id , tileConfiguration , layerConfiguration ) ; }
Create a new TMS layer instance .
9,040
public void getTileMapService ( final String baseUrl , final Callback < TileMapServiceInfo , String > callback ) { RequestBuilder builder = new RequestBuilder ( RequestBuilder . GET , baseUrl ) ; builder . setHeader ( "Cache-Control" , "no-cache" ) ; builder . setHeader ( "Pragma" , "no-cache" ) ; try { builder . sendRequest ( null , new RequestCallback ( ) { public void onError ( Request request , Throwable e ) { callback . onFailure ( e . getMessage ( ) ) ; } public void onResponseReceived ( Request request , Response response ) { if ( 200 == response . getStatusCode ( ) ) { Document messageDom = XMLParser . parse ( response . getText ( ) ) ; callback . onSuccess ( new TileMapServiceInfo100 ( messageDom . getDocumentElement ( ) ) ) ; } else { callback . onFailure ( response . getText ( ) ) ; } } } ) ; } catch ( RequestException e ) { callback . onFailure ( e . getMessage ( ) ) ; } }
Fetch the capabilities of a TileMapService and parse it . This is the base URL that contains a list of TileMaps .
9,041
protected MapConfiguration createTmsMap ( String crs , CrsType type , Bbox bounds , int minTileSize , int nrOfZoomLevels ) { MapConfigurationImpl mapConfiguration ; mapConfiguration = new MapConfigurationImpl ( ) ; mapConfiguration . setCrs ( crs , type ) ; double minSize = bounds . getWidth ( ) >= bounds . getHeight ( ) ? bounds . getHeight ( ) : bounds . getWidth ( ) ; List < Double > resolutions = new ArrayList < Double > ( ) ; for ( int i = 0 ; i < nrOfZoomLevels ; i ++ ) { resolutions . add ( minSize / ( minTileSize * Math . pow ( 2 , i ) ) ) ; } mapConfiguration . setResolutions ( resolutions ) ; mapConfiguration . setMaxBounds ( Bbox . ALL ) ; mapConfiguration . setHintValue ( MapConfiguration . INITIAL_BOUNDS , bounds ) ; return mapConfiguration ; }
Create a map with a local profile and specified crs bounds and number of zoom levels . The resolution at level 0 is based on mapping the bounds to a rectangular tile width minimum width and height of minTileSize pixels .
9,042
public void setOpacity ( double opacity ) { getLayerInfo ( ) . setStyle ( Double . toString ( opacity ) ) ; renderer . setOpacity ( opacity ) ; }
Apply a new opacity on the entire raster layer . Changing the opacity on a layer does NOT fire a layer style changed event .
9,043
static String getOptions ( final ProvisionOption provision ) { final StringBuilder options = new StringBuilder ( ) ; if ( provision . shouldUpdate ( ) ) { options . append ( SEPARATOR_OPTION ) . append ( OPTION_UPDATE ) ; } if ( ! provision . shouldStart ( ) ) { options . append ( SEPARATOR_OPTION ) . append ( OPTION_NO_START ) ; } if ( provision . getStartLevel ( ) != null ) { options . append ( SEPARATOR_OPTION ) . append ( provision . getStartLevel ( ) ) ; } return options . toString ( ) ; }
Returns common scanner options . Ment to be used by subclasses when building the url .
9,044
public static String asPath ( final String ... strings ) { if ( strings == null ) return null ; final StringBuilder bldr = new StringBuilder ( ) ; for ( final String string : strings ) { if ( bldr . length ( ) != 0 ) bldr . append ( separator ) ; bldr . append ( string ) ; } return bldr . toString ( ) ; }
Inserts the platform - specific filesystem path separator between the provided strings .
9,045
public static void createDirectories ( final String directory ) { if ( directory == null ) return ; final File f = new File ( directory ) ; if ( ! f . isDirectory ( ) ) { if ( ! f . mkdirs ( ) ) throw new RuntimeException ( "couldn't create " + directory ) ; } }
Create the provided directory and all necessary subdirectories if they do not already exist .
9,046
public static void createDirectory ( final String directory ) { if ( directory == null ) return ; final File f = new File ( directory ) ; if ( ! f . isDirectory ( ) ) { if ( ! f . mkdir ( ) ) throw new RuntimeException ( "couldn't create " + directory ) ; } }
Create the provided directory if it does not already exist .
9,047
public static int getPID ( ) { if ( pid == - 1 ) { RuntimeMXBean mx = ManagementFactory . getRuntimeMXBean ( ) ; String name = mx . getName ( ) ; String token = name . split ( "@" ) [ 0 ] ; pid = parseInt ( token ) ; } return pid ; }
Returns the virtual machine s process identifier .
9,048
public static UserStyleInfo createStyle ( RuleInfo rule ) { UserStyleInfo userStyleInfo = new UserStyleInfo ( ) ; FeatureTypeStyleInfo fts = new FeatureTypeStyleInfo ( ) ; fts . getRuleList ( ) . add ( rule ) ; userStyleInfo . getFeatureTypeStyleList ( ) . add ( fts ) ; return userStyleInfo ; }
Create a style with a single rule .
9,049
public static RuleInfo createRule ( LayerType type , FeatureStyleInfo featureStyle ) { SymbolizerTypeInfo symbolizer = createSymbolizer ( type , featureStyle ) ; RuleInfo rule = createRule ( featureStyle . getName ( ) , featureStyle . getName ( ) , symbolizer ) ; return rule ; }
Create a non - filtered rule from a feature style .
9,050
public static SymbolizerTypeInfo createSymbolizer ( LayerType type , FeatureStyleInfo featureStyle ) { SymbolInfo symbol = featureStyle . getSymbol ( ) ; SymbolizerTypeInfo symbolizer = null ; StrokeInfo stroke = createStroke ( featureStyle . getStrokeColor ( ) , featureStyle . getStrokeWidth ( ) , featureStyle . getStrokeOpacity ( ) , featureStyle . getDashArray ( ) ) ; FillInfo fill = createFill ( featureStyle . getFillColor ( ) , featureStyle . getFillOpacity ( ) ) ; switch ( type ) { case GEOMETRY : break ; case LINESTRING : case MULTILINESTRING : symbolizer = createLineSymbolizer ( stroke ) ; break ; case MULTIPOINT : case POINT : GraphicInfo graphic ; if ( symbol . getCircle ( ) != null ) { MarkInfo circle = createMark ( WKN_CIRCLE , fill , stroke ) ; graphic = createGraphic ( circle , ( int ) ( 2 * symbol . getCircle ( ) . getR ( ) ) ) ; } else if ( symbol . getRect ( ) != null ) { MarkInfo rect = createMark ( WKN_RECT , fill , stroke ) ; graphic = createGraphic ( rect , ( int ) symbol . getRect ( ) . getH ( ) ) ; } else { ExternalGraphicInfo image = createExternalGraphic ( symbol . getImage ( ) . getHref ( ) ) ; graphic = createGraphic ( image , symbol . getImage ( ) . getHeight ( ) ) ; } symbolizer = createPointSymbolizer ( graphic ) ; break ; case POLYGON : case MULTIPOLYGON : symbolizer = createPolygonSymbolizer ( fill , stroke ) ; break ; default : throw new IllegalStateException ( "Unknown layer type " + type ) ; } return symbolizer ; }
Create a symbolizer from a feature style .
9,051
public static RuleInfo createRule ( String title , String name , SymbolizerTypeInfo symbolizer ) { RuleInfo rule = new RuleInfo ( ) ; rule . setTitle ( title ) ; rule . setName ( name ) ; rule . getSymbolizerList ( ) . add ( symbolizer ) ; return rule ; }
Create a non - filtered rule with the specified title name and symbolizer .
9,052
public static PointSymbolizerInfo createPointSymbolizer ( GraphicInfo graphicInfo ) { PointSymbolizerInfo symbolizerInfo = new PointSymbolizerInfo ( ) ; symbolizerInfo . setGraphic ( graphicInfo ) ; return symbolizerInfo ; }
Creates a point symbolizer with the specified graphic .
9,053
public static LineSymbolizerInfo createLineSymbolizer ( StrokeInfo strokeInfo ) { LineSymbolizerInfo symbolizerInfo = new LineSymbolizerInfo ( ) ; symbolizerInfo . setStroke ( strokeInfo ) ; return symbolizerInfo ; }
Creates a line symbolizer with the specified stroke .
9,054
public static PolygonSymbolizerInfo createPolygonSymbolizer ( FillInfo fillInfo , StrokeInfo strokeInfo ) { PolygonSymbolizerInfo symbolizerInfo = new PolygonSymbolizerInfo ( ) ; symbolizerInfo . setFill ( fillInfo ) ; symbolizerInfo . setStroke ( strokeInfo ) ; return symbolizerInfo ; }
Creates a polygon symbolizer with the specified fill and stroke .
9,055
public static StrokeInfo createStroke ( String color , int width , float opacity , String dashArray ) { StrokeInfo strokeInfo = new StrokeInfo ( ) ; if ( color != null ) { strokeInfo . getCssParameterList ( ) . add ( createCssParameter ( "stroke" , color ) ) ; } strokeInfo . getCssParameterList ( ) . add ( createCssParameter ( "stroke-width" , width ) ) ; if ( dashArray != null ) { strokeInfo . getCssParameterList ( ) . add ( createCssParameter ( "stroke-dasharray" , dashArray ) ) ; } strokeInfo . getCssParameterList ( ) . add ( createCssParameter ( "stroke-opacity" , opacity ) ) ; return strokeInfo ; }
Creates a stroke with the specified CSS parameters .
9,056
public static FillInfo createFill ( String color , float opacity ) { FillInfo fillInfo = new FillInfo ( ) ; if ( color != null ) { fillInfo . getCssParameterList ( ) . add ( createCssParameter ( "fill" , color ) ) ; } fillInfo . getCssParameterList ( ) . add ( createCssParameter ( "fill-opacity" , opacity ) ) ; return fillInfo ; }
Creates a fill with the specified CSS parameters .
9,057
public static MarkInfo createMark ( String wellKnownName , FillInfo fill , StrokeInfo stroke ) { MarkInfo mark = new MarkInfo ( ) ; mark . setFill ( fill ) ; mark . setStroke ( stroke ) ; WellKnownNameInfo wellKnownNameInfo = new WellKnownNameInfo ( ) ; wellKnownNameInfo . setWellKnownName ( wellKnownName ) ; mark . setWellKnownName ( wellKnownNameInfo ) ; return mark ; }
Creates a mark with the specified parameters .
9,058
public static ExternalGraphicInfo createExternalGraphic ( String href ) { ExternalGraphicInfo externalGraphic = new ExternalGraphicInfo ( ) ; FormatInfo format = new FormatInfo ( ) ; format . setFormat ( "image/" + getExtension ( href ) ) ; externalGraphic . setFormat ( format ) ; OnlineResourceInfo onlineResource = new OnlineResourceInfo ( ) ; onlineResource . setType ( "simple" ) ; HrefInfo hrefInfo = new HrefInfo ( ) ; hrefInfo . setHref ( href ) ; onlineResource . setHref ( hrefInfo ) ; externalGraphic . setOnlineResource ( onlineResource ) ; return externalGraphic ; }
Creates an external graphic for the specified href .
9,059
public static GraphicInfo createGraphic ( MarkInfo mark , int size ) { GraphicInfo graphicInfo = new GraphicInfo ( ) ; ChoiceInfo choice = new ChoiceInfo ( ) ; choice . setMark ( mark ) ; graphicInfo . getChoiceList ( ) . add ( choice ) ; SizeInfo sizeInfo = new SizeInfo ( ) ; sizeInfo . setValue ( Integer . toString ( size ) ) ; graphicInfo . setSize ( sizeInfo ) ; return graphicInfo ; }
Creates a graphic with the specified mark and size .
9,060
public static GraphicInfo createGraphic ( ExternalGraphicInfo graphic , int size ) { GraphicInfo graphicInfo = new GraphicInfo ( ) ; ChoiceInfo choice = new ChoiceInfo ( ) ; choice . setExternalGraphic ( graphic ) ; graphicInfo . getChoiceList ( ) . add ( choice ) ; SizeInfo sizeInfo = new SizeInfo ( ) ; sizeInfo . setValue ( Integer . toString ( size ) ) ; graphicInfo . setSize ( sizeInfo ) ; return graphicInfo ; }
Creates a graphic with the specified external graphic and size .
9,061
public static CssParameterInfo createCssParameter ( String name , Object value ) { CssParameterInfo css = new CssParameterInfo ( ) ; css . setName ( name ) ; css . setValue ( value . toString ( ) ) ; return css ; }
Creates a CSS parameter with specified name and value .
9,062
public static TextSymbolizerInfo createSymbolizer ( FontStyleInfo style ) { TextSymbolizerInfo symbolizerInfo = new TextSymbolizerInfo ( ) ; FontInfo font = new FontInfo ( ) ; font . setFamily ( style . getFamily ( ) ) ; font . setStyle ( style . getStyle ( ) ) ; font . setWeight ( style . getWeight ( ) ) ; font . setSize ( style . getSize ( ) ) ; symbolizerInfo . setFont ( font ) ; symbolizerInfo . setFill ( createFill ( style . getColor ( ) , style . getOpacity ( ) ) ) ; return symbolizerInfo ; }
Creates a text symbolizer with the specified font style .
9,063
private List < Coordinate > getCoordinates ( Geometry [ ] geometries ) { List < Coordinate > coordinates = new ArrayList < Coordinate > ( ) ; for ( Geometry geometry : geometries ) { addCoordinateArrays ( geometry , coordinates ) ; } return coordinates ; }
Get a single list of coordinates from an array of geometries .
9,064
private List < Coordinate > sortX ( List < Coordinate > coordinates ) { List < Coordinate > sorted = new ArrayList < Coordinate > ( coordinates ) ; Collections . sort ( sorted , new XComparator ( ) ) ; return sorted ; }
Return a new and sorted list of coordinates . They should be sorted by their X values .
9,065
private List < Coordinate > sortY ( List < Coordinate > coordinates ) { List < Coordinate > sorted = new ArrayList < Coordinate > ( coordinates ) ; Collections . sort ( sorted , new YComparator ( ) ) ; return sorted ; }
Return a new and sorted list of coordinates . They should be sorted by their Y values .
9,066
private void readFile ( ) throws IOException { BufferedReader reader = null ; try { reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( file ) , PcsUtils . UTF8 ) ) ; LOGGER . debug ( "Reading credentials file {}" , file ) ; String line ; int index = 1 ; while ( ( line = reader . readLine ( ) ) != null ) { line = line . trim ( ) ; if ( line . startsWith ( "#" ) || line . length ( ) == 0 ) { continue ; } String [ ] userCredentialsArray = line . split ( "=" , 2 ) ; if ( userCredentialsArray . length != 2 ) { throw new IllegalArgumentException ( "Not parsable line #" + index ) ; } final String key = userCredentialsArray [ 0 ] . trim ( ) ; final Credentials value = Credentials . createFromJson ( userCredentialsArray [ 1 ] . trim ( ) ) ; credentialsMap . put ( key , value ) ; index ++ ; } } finally { PcsUtils . closeQuietly ( reader ) ; } }
Parses a file of credentials
9,067
private void writeFile ( ) throws IOException { LOGGER . debug ( "Writing credentials file to {}" , file ) ; File tempFile = new File ( file . getPath ( ) + ".tmp" ) ; Writer writer = null ; try { writer = new OutputStreamWriter ( new FileOutputStream ( tempFile ) , PcsUtils . UTF8 ) ; for ( String key : credentialsMap . keySet ( ) ) { Credentials cred = credentialsMap . get ( key ) ; final String line = key + "=" + cred . toJson ( ) + "\n" ; writer . write ( line ) ; } writer . flush ( ) ; } finally { PcsUtils . closeQuietly ( writer ) ; } file . delete ( ) ; tempFile . renameTo ( file ) ; }
Serializes credentials data
9,068
private String getUserKey ( AppInfo appInfo , String userId ) { if ( userId == null ) { throw new IllegalArgumentException ( "userId should not be null" ) ; } return String . format ( "%s%s" , getAppPrefix ( appInfo ) , userId ) ; }
Builds the key of a credentials according to a given appInfo and userId
9,069
private String getAppPrefix ( AppInfo appInfo ) { return String . format ( "%s.%s." , appInfo . getProviderName ( ) , appInfo . getAppName ( ) ) ; }
Builds a key prefix according to a given appInfo
9,070
public void beginContext ( ServletContext context , ServletRequest req , ServletResponse resp ) { pushRequestContext ( context , req , resp ) ; super . beginContext ( ) ; }
Begins a new execution context associated with a specific ServletRequest
9,071
private synchronized void pushRequestContext ( ServletContext context , ServletRequest req , ServletResponse resp ) { getRequestStack ( ) . push ( new RequestContext ( context , req , resp ) ) ; }
Pushes the current request context onto the stack
9,072
private synchronized RequestContext peekRequestContext ( ) { Stack < RequestContext > reqStack = getRequestStack ( ) ; if ( reqStack . empty ( ) ) return null ; return reqStack . peek ( ) ; }
Returns the current request context or null is none is available
9,073
public static String [ ] getHostsToPowerOfTwo ( String [ ] numberOfHosts ) { int definedHosts = numberOfHosts . length ; int numOfHosts = Util . ceilingNextPowerOfTwo ( definedHosts ) ; Set < String > newHosts = new HashSet < String > ( numOfHosts ) ; if ( definedHosts < numOfHosts ) { for ( int i = 0 ; i < numOfHosts ; i ++ ) { newHosts . add ( numberOfHosts [ i % definedHosts ] ) ; } } else { return numberOfHosts ; } return newHosts . toArray ( new String [ newHosts . size ( ) ] ) ; }
Given an array of host names makes the host list into a array that has a power of two length . It does this by reusing existing strings to form the new string .
9,074
protected Object [ ] getParameterValues ( ControlBeanContext context , Method m , Object [ ] args ) { ArrayList < Object > paramValues = new ArrayList < Object > ( ) ; for ( SqlFragment frag : _children ) { if ( frag . hasComplexValue ( context , m , args ) ) { paramValues . addAll ( Arrays . asList ( frag . getParameterValues ( context , m , args ) ) ) ; } } return paramValues . toArray ( ) ; }
Get the parameter values from this fragment and its children . An SqlSubstitutionFragment only contains parameters if one of its children has a complex value type .
9,075
protected String getPreparedStatementText ( ControlBeanContext context , Method m , Object [ ] args ) { StringBuilder sb = new StringBuilder ( ) ; for ( SqlFragment frag : _children ) { boolean complexFragment = frag . hasComplexValue ( context , m , args ) ; if ( frag . hasParamValue ( ) && ! complexFragment ) { Object [ ] pValues = frag . getParameterValues ( context , m , args ) ; for ( Object o : pValues ) { sb . append ( processSqlParams ( o ) ) ; } } else { _hasParamValue |= complexFragment ; sb . append ( frag . getPreparedStatementText ( context , m , args ) ) ; } } return sb . toString ( ) ; }
Return the text for a PreparedStatement from this fragment . This type of fragment typically evaluates any reflection parameters at this point . The exception is if the reflected result is a ComplexSqlFragment it that case the sql text is retrieved from the fragment in this method . The parameter values are retrieved in the getParameterValues method of this class .
9,076
private String processSqlParams ( Object value ) { Object [ ] arr = null ; if ( value != null ) { arr = TypeMappingsFactory . toObjectArray ( value ) ; } if ( value == null || ( arr != null && arr . length == 0 ) ) { return "" ; } else if ( arr != null ) { StringBuilder result = new StringBuilder ( ) ; for ( int i = 0 ; i < arr . length ; i ++ ) { if ( i > 0 ) { result . append ( ',' ) ; result . append ( arr [ i ] . toString ( ) ) ; } else { result . append ( arr [ i ] . toString ( ) ) ; } } return result . toString ( ) ; } else { return value . toString ( ) ; } }
Check for the cases of a null or array type param value . If array type build a string of the array values seperated by commas .
9,077
protected Method mapControlBeanMethodToEJB ( Method m ) { Method ejbMethod = findEjbMethod ( m , _homeInterface ) ; if ( ejbMethod == null ) { if ( _beanInstance == null ) { _beanInstance = resolveBeanInstance ( ) ; if ( _beanInstance == null ) { throw new ControlException ( "Unable to resolve bean instance" ) ; } } ejbMethod = findEjbMethod ( m , _beanInstance . getClass ( ) ) ; if ( ejbMethod == null ) { throw new ControlException ( "Unable to map ejb control interface method to EJB method: " + m . getName ( ) ) ; } } return ejbMethod ; }
Map a control bean method to an EJB method .
9,078
protected Method findEjbMethod ( Method controlBeanMethod , Class ejbInterface ) { final String cbMethodName = controlBeanMethod . getName ( ) ; final Class cbMethodReturnType = controlBeanMethod . getReturnType ( ) ; final Class [ ] cbMethodParams = controlBeanMethod . getParameterTypes ( ) ; Method [ ] ejbMethods = ejbInterface . getMethods ( ) ; for ( Method m : ejbMethods ) { if ( ! cbMethodName . equals ( m . getName ( ) ) || ! cbMethodReturnType . equals ( m . getReturnType ( ) ) ) { continue ; } Class [ ] params = m . getParameterTypes ( ) ; if ( cbMethodParams . length == params . length ) { int i ; for ( i = 0 ; i < cbMethodParams . length ; i ++ ) { if ( cbMethodParams [ i ] != params [ i ] ) break ; } if ( i == cbMethodParams . length ) return m ; } } return null ; }
Find the method which has the same signature in the specified class .
9,079
private Object lookupHomeInstance ( ) throws NamingException { javax . naming . Context ctx = getInitialContext ( ) ; try { return ctx . lookup ( _jndiName ) ; } catch ( NameNotFoundException nnfe ) { if ( ! _jndiName . startsWith ( JNDI_APPSCOPED_PREFIX ) ) { throw nnfe ; } } return ctx . lookup ( _jndiName . substring ( JNDI_APPSCOPED_PREFIX . length ( ) ) ) ; }
Do a JNDI lookup for the home instance of the ejb . Attempt the lookup first using an app scoped jndi prefix if not successful attempt without the prefix .
9,080
public void setTagId ( String tagId ) throws JspException { JspContext jspContext = getJspContext ( ) ; DataGridTagModel dataGridModel = DataGridUtil . getDataGridTagModel ( jspContext ) ; if ( dataGridModel == null ) throw new JspException ( Bundle . getErrorString ( "DataGridTags_MissingDataGridModel" ) ) ; int renderState = dataGridModel . getRenderState ( ) ; if ( renderState == DataGridTagModel . RENDER_STATE_GRID ) applyIndexedTagId ( _trState , tagId ) ; else applyTagId ( _trState , tagId ) ; }
Set the name of the tagId for the HTML tr tag .
9,081
public void initialize ( ControlBean bean , Object target ) { initServices ( bean , target ) ; initControls ( bean , target ) ; initEventProxies ( bean , target ) ; }
Initializes a new ControlImplementation instance associated with the specified bean .
9,082
public void setOnClick ( String onClick ) { _theadTag . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONCLICK , onClick ) ; }
Sets the onClick JavaScript event for the HTML thead tag .
9,083
public void setOnDblClick ( String onDblClick ) { _theadTag . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONDBLCLICK , onDblClick ) ; }
Sets the onDblClick JavaScript event for the HTML thead tag .
9,084
public void setOnKeyDown ( String onKeyDown ) { _theadTag . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONKEYDOWN , onKeyDown ) ; }
Sets the onKeyDown JavaScript event for the HTML thead tag .
9,085
public void setChar ( String alignChar ) { _theadTag . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . CHAR , alignChar ) ; }
Sets the value of the horizontal alignment character attribute rendered by the HTML thead tag .
9,086
public void setValign ( String valign ) { _theadTag . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . VALIGN , valign ) ; }
Sets the value of the vertical alignment attribute rendered by the HTML thead tag .
9,087
public String extractName ( XAttributable element ) { XAttribute attribute = element . getAttributes ( ) . get ( KEY_NAME ) ; if ( attribute == null ) { return null ; } else { return ( ( XAttributeLiteral ) attribute ) . getValue ( ) ; } }
Retrieves the name of a log data hierarchy element if set by this extension s name attribute .
9,088
public void assignName ( XAttributable element , String name ) { if ( name != null && name . trim ( ) . length ( ) > 0 ) { XAttributeLiteral attr = ( XAttributeLiteral ) ATTR_NAME . clone ( ) ; attr . setValue ( name ) ; element . getAttributes ( ) . put ( KEY_NAME , attr ) ; } }
Assigns any log data hierarchy element its name as defined by this extension s name attribute .
9,089
public String extractInstance ( XEvent event ) { XAttribute attribute = event . getAttributes ( ) . get ( KEY_INSTANCE ) ; if ( attribute == null ) { return null ; } else { return ( ( XAttributeLiteral ) attribute ) . getValue ( ) ; } }
Retrieves the activity instance identifier of an event if set by this extension s instance attribute .
9,090
public void assignInstance ( XEvent event , String instance ) { if ( instance != null && instance . trim ( ) . length ( ) > 0 ) { XAttributeLiteral attr = ( XAttributeLiteral ) ATTR_INSTANCE . clone ( ) ; attr . setValue ( instance ) ; event . getAttributes ( ) . put ( KEY_INSTANCE , attr ) ; } }
Assigns any event its activity instance identifier as defined by this extension s instance attribute .
9,091
protected void loadPlugins ( ) { pickingPlugin = new PickingGraphMousePlugin < String , String > ( ) ; scalingPlugin = new ScalingGraphMousePlugin ( new CrossoverScalingControl ( ) , 0 , in , out ) ; editingPlugin = new RoleGraphEditingPlugin ( ) ; add ( scalingPlugin ) ; setMode ( Mode . EDITING ) ; }
create the plugins and load the plugins for TRANSFORMING mode
9,092
public void setMode ( Mode mode ) { if ( this . mode != mode ) { fireItemStateChanged ( new ItemEvent ( this , ItemEvent . ITEM_STATE_CHANGED , this . mode , ItemEvent . DESELECTED ) ) ; this . mode = mode ; if ( mode == Mode . PICKING ) { setPickingMode ( ) ; } else if ( mode == Mode . EDITING ) { setEditingMode ( ) ; } if ( modeBox != null ) { modeBox . setSelectedItem ( mode ) ; } fireItemStateChanged ( new ItemEvent ( this , ItemEvent . ITEM_STATE_CHANGED , mode , ItemEvent . SELECTED ) ) ; } }
setter for the Mode .
9,093
public void remove ( ) { if ( _mapIterator == null ) throw new UnsupportedOperationException ( Bundle . getErrorString ( "IteratorFactory_Iterator_removeUnsupported" , new Object [ ] { this . getClass ( ) . getName ( ) } ) ) ; else _mapIterator . remove ( ) ; }
Remove the current item in the iterator .
9,094
public void setAlt ( String alt ) { _state . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , ALT , alt , true ) ; }
Sets the property to specify the alt text of the image .
9,095
public static void validate ( PropertyKey key , Object value ) throws IllegalArgumentException { validate ( key . getAnnotations ( ) , value ) ; }
This method ensures that any control property value assignment satisfies all property constraints . This method should be called by control property setters to ensure values assigned to properties at runtime are validated .
9,096
public static void validateMembership ( Annotation propertySet ) { Class c = propertySet . annotationType ( ) ; MembershipRule rule = ( MembershipRule ) c . getAnnotation ( MembershipRule . class ) ; if ( rule == null ) return ; MembershipRuleValues ruleValue = rule . value ( ) ; String [ ] memberNames = rule . memberNames ( ) ; Method [ ] members = getMembers ( c , memberNames ) ; int i = getNumOfMembersSet ( propertySet , members ) ; if ( ruleValue == MembershipRuleValues . ALL_IF_ANY ) { if ( i != 0 && i != members . length ) throw new IllegalArgumentException ( "The membership rule on " + propertySet . toString ( ) + " is not satisfied. Either all members must be set or none is set" ) ; } else if ( ruleValue == MembershipRuleValues . EXACTLY_ONE ) { if ( i != 1 ) throw new IllegalArgumentException ( "The membership rule on " + propertySet . toString ( ) + " is not satisfied. Exactly one member must be set" ) ; } else if ( ruleValue == MembershipRuleValues . AT_LEAST_ONE ) { if ( i < 1 ) throw new IllegalArgumentException ( "The membership rule on " + propertySet . toString ( ) + " is not satisfied. At least one member must be set" ) ; } else if ( ruleValue == MembershipRuleValues . AT_MOST_ONE ) { if ( i > 1 ) throw new IllegalArgumentException ( "The membership rule on " + propertySet . toString ( ) + " is not satisfied. At most one member may be set" ) ; } }
This method ensures the membership constraints defined on a property set is satisfied .
9,097
public void setOnKeyUp ( String onKeyUp ) { _anchorState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONKEYUP , onKeyUp ) ; }
Sets the onKeyUp JavaScript event for the HTML anchor .
9,098
public void setOnKeyPress ( String onKeyPress ) { _anchorState . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONKEYPRESS , onKeyPress ) ; }
Sets the onKeyPress JavaScript event for the HTML anchor .
9,099
public void setTarget ( String target ) { _anchorState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . TARGET , target ) ; }
Sets the window target for the HTML anchor .