idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
19,600
public static void assertOnlyOneMethod ( final Collection < Method > methods , Class < ? extends Annotation > annotation ) { if ( methods . size ( ) > 1 ) { throw annotation == null ? MESSAGES . onlyOneMethodCanExist ( ) : MESSAGES . onlyOneMethodCanExist2 ( annotation ) ; } }
Asserts only one method is annotated with annotation .
19,601
public final void invoke ( final Endpoint endpoint , final Invocation invocation ) throws Exception { try { this . init ( endpoint , invocation ) ; final Object targetBean = invocation . getInvocationContext ( ) . getTargetBean ( ) ; final Class < ? > implClass = targetBean . getClass ( ) ; final Method seiMethod = inv...
Invokes method on endpoint implementation .
19,602
public < T > T getSPI ( Class < T > spiType , ClassLoader loader ) { T returnType = null ; if ( DeploymentModelFactory . class . equals ( spiType ) ) { returnType = loadService ( spiType , DefaultDeploymentModelFactory . class , loader ) ; } else if ( EndpointMetricsFactory . class . equals ( spiType ) ) { returnType =...
Gets the specified SPI using the provided classloader
19,603
@ SuppressWarnings ( "unchecked" ) private < T > T loadService ( Class < T > spiType , Class < ? > defaultImpl , ClassLoader loader ) { final String defaultImplName = defaultImpl != null ? defaultImpl . getName ( ) : null ; return ( T ) ServiceLoader . loadService ( spiType . getName ( ) , defaultImplName , loader ) ; ...
Load SPI implementation through ServiceLoader
19,604
private boolean isRecording ( Endpoint endpoint ) { List < RecordProcessor > processors = endpoint . getRecordProcessors ( ) ; if ( processors == null || processors . isEmpty ( ) ) { return false ; } for ( RecordProcessor processor : processors ) { if ( processor . isRecording ( ) ) { return true ; } } return false ; }
Returns true if there s at least a record processor in recording mode
19,605
public static void rethrow ( final String message , final Exception reason ) { if ( reason == null ) { throw new IllegalArgumentException ( ) ; } Loggers . ROOT_LOGGER . error ( message == null ? reason . getMessage ( ) : message , reason ) ; throw new InjectionException ( message , reason ) ; }
Rethrows Injection exception that will wrap passed reason .
19,606
public EndpointConfig resolveEndpointConfig ( ) { final String endpointClassName = getEndpointClassName ( ) ; String configName = endpointClassName ; String configFile = EndpointConfig . DEFAULT_ENDPOINT_CONFIG_FILE ; boolean specifiedConfig = false ; if ( isEndpointClassAnnotated ( org . jboss . ws . api . annotation ...
Returns the EndpointConfig resolved for the current endpoint
19,607
public Set < String > getAllHandlers ( EndpointConfig config ) { Set < String > set = new HashSet < String > ( ) ; if ( config != null ) { for ( UnifiedHandlerChainMetaData uhcmd : config . getPreHandlerChains ( ) ) { for ( UnifiedHandlerMetaData uhmd : uhcmd . getHandlers ( ) ) { set . add ( uhmd . getHandlerClass ( )...
Returns a set of full qualified class names of the handlers from the specified endpoint config
19,608
@ SuppressWarnings ( "unchecked" ) protected void publishWsdlImports ( URL parentURL , Definition parentDefinition , List < String > published , String expLocation ) throws Exception { @ SuppressWarnings ( "rawtypes" ) Iterator it = parentDefinition . getImports ( ) . values ( ) . iterator ( ) ; while ( it . hasNext ( ...
Publish the wsdl imports for a given wsdl definition
19,609
protected void publishSchemaImports ( URL parentURL , Element element , List < String > published , String expLocation ) throws Exception { Element childElement = getFirstChildElement ( element ) ; while ( childElement != null ) { final String ns = childElement . getNamespaceURI ( ) ; if ( Constants . NS_SCHEMA_XSD . e...
Publish the schema imports for a given wsdl definition
19,610
public void unpublishWsdlFiles ( ) throws IOException { String deploymentDir = ( dep . getParent ( ) != null ? dep . getParent ( ) . getSimpleName ( ) : dep . getSimpleName ( ) ) ; File serviceDir = new File ( serverConfig . getServerDataDir ( ) . getCanonicalPath ( ) + "/wsdl/" + deploymentDir ) ; deleteWsdlPublishDir...
Delete the published wsdl
19,611
protected void deleteWsdlPublishDirectory ( File dir ) throws IOException { String [ ] files = dir . list ( ) ; for ( int i = 0 ; files != null && i < files . length ; i ++ ) { String fileName = files [ i ] ; File file = new File ( dir + "/" + fileName ) ; if ( file . isDirectory ( ) ) { deleteWsdlPublishDirectory ( fi...
Delete the published wsdl document traversing down the dir structure
19,612
protected Object readResolve ( ) throws ObjectStreamException { try { Class < ? > proxyClass = getProxyClass ( ) ; Object instance = proxyClass . newInstance ( ) ; ProxyFactory . setInvocationHandlerStatic ( instance , handler ) ; return instance ; } catch ( InstantiationException e ) { throw new RuntimeException ( e )...
Resolve the serialized proxy to a real instance .
19,613
protected Class < ? > getProxyClass ( ) throws ClassNotFoundException { ClassLoader classLoader = getProxyClassLoader ( ) ; return Class . forName ( proxyClassName , false , classLoader ) ; }
Get the associated proxy class .
19,614
public static DocumentBuilder newDocumentBuilder ( final DocumentBuilderFactory factory ) { try { final DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder ; } catch ( Exception e ) { throw MESSAGES . unableToCreateInstanceOf ( e , DocumentBuilder . class . getName ( ) ) ; } }
Creates a new DocumentBuilder instance using the provided DocumentBuilderFactory
19,615
public static Element parse ( String xmlString ) throws IOException { try { return parse ( new ByteArrayInputStream ( xmlString . getBytes ( "UTF-8" ) ) ) ; } catch ( IOException e ) { ROOT_LOGGER . cannotParse ( xmlString ) ; throw e ; } }
Parse the given XML string and return the root Element This uses the document builder associated with the current thread .
19,616
public static Element parse ( InputStream xmlStream , DocumentBuilder builder ) throws IOException { try { Document doc ; synchronized ( builder ) { doc = builder . parse ( xmlStream ) ; } return doc . getDocumentElement ( ) ; } catch ( SAXException se ) { throw new IOException ( se . toString ( ) ) ; } finally { xmlSt...
Parse the given XML stream and return the root Element
19,617
public static Element parse ( InputStream xmlStream ) throws IOException { DocumentBuilder builder = getDocumentBuilder ( ) ; return parse ( xmlStream , builder ) ; }
Parse the given XML stream and return the root Element This uses the document builder associated with the current thread .
19,618
public static Element parse ( InputSource source ) throws IOException { try { Document doc ; DocumentBuilder builder = getDocumentBuilder ( ) ; synchronized ( builder ) { doc = builder . parse ( source ) ; } return doc . getDocumentElement ( ) ; } catch ( SAXException se ) { throw new IOException ( se . toString ( ) ) ...
Parse the given input source and return the root Element . This uses the document builder associated with the current thread .
19,619
public static Element createElement ( String localPart ) { Document doc = getOwnerDocument ( ) ; if ( ROOT_LOGGER . isTraceEnabled ( ) ) ROOT_LOGGER . trace ( "createElement {}" + localPart ) ; return doc . createElement ( localPart ) ; }
Create an Element for a given name . This uses the document builder associated with the current thread .
19,620
public static Element createElement ( String localPart , String prefix , String uri ) { Document doc = getOwnerDocument ( ) ; if ( prefix == null || prefix . length ( ) == 0 ) { if ( ROOT_LOGGER . isTraceEnabled ( ) ) ROOT_LOGGER . trace ( "createElement {" + uri + "}" + localPart ) ; return doc . createElementNS ( uri...
Create an Element for a given name prefix and uri . This uses the document builder associated with the current thread .
19,621
public static Element createElement ( QName qname ) { return createElement ( qname . getLocalPart ( ) , qname . getPrefix ( ) , qname . getNamespaceURI ( ) ) ; }
Create an Element for a given QName . This uses the document builder associated with the current thread .
19,622
public static Text createTextNode ( String value ) { Document doc = getOwnerDocument ( ) ; return doc . createTextNode ( value ) ; }
Create a org . w3c . dom . Text node . This uses the document builder associated with the current thread .
19,623
public static Document getOwnerDocument ( ) { Document doc = documentThreadLocal . get ( ) ; if ( doc == null ) { doc = getDocumentBuilder ( ) . newDocument ( ) ; documentThreadLocal . set ( doc ) ; } return doc ; }
Get the owner document that is associated with the current thread
19,624
public static Element sourceToElement ( Source source ) throws IOException { Element retElement = null ; if ( source instanceof StreamSource ) { StreamSource streamSource = ( StreamSource ) source ; InputStream ins = streamSource . getInputStream ( ) ; if ( ins != null ) { retElement = DOMUtils . parse ( ins ) ; } Read...
Parse the contents of the provided source into an element . This uses the document builder associated with the current thread .
19,625
public static String node2String ( final Node node ) throws UnsupportedEncodingException { return node2String ( node , true , Constants . DEFAULT_XML_CHARSET ) ; }
Converts XML node in pretty mode using UTF - 8 encoding to string .
19,626
public static String node2String ( final Node node , boolean prettyPrint ) throws UnsupportedEncodingException { return node2String ( node , prettyPrint , Constants . DEFAULT_XML_CHARSET ) ; }
Converts XML node in specified pretty mode using UTF - 8 encoding to string .
19,627
public static String node2String ( final Node node , boolean prettyPrint , String encoding ) throws UnsupportedEncodingException { final ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; new DOMWriter ( new PrintWriter ( baos ) , encoding ) . setPrettyprint ( prettyPrint ) . print ( node ) ; return baos . to...
Converts XML node in specified pretty mode and encoding to string .
19,628
public void setContextProperties ( Map < String , String > contextProperties ) { if ( contextProperties != null ) { this . contextProperties = new HashMap < String , String > ( 4 ) ; this . contextProperties . putAll ( contextProperties ) ; } }
This is called once at AS boot time during deployment aspect parsing ; this provided map is copied .
19,629
public String [ ] getParameterTypes ( ) { final String [ ] parameterTypes = this . parameterTypes ; return parameterTypes == NO_STRINGS ? parameterTypes : parameterTypes . clone ( ) ; }
Get the parameter type names as strings .
19,630
public Method getPublicMethod ( final Class < ? > clazz ) throws NoSuchMethodException , ClassNotFoundException { return clazz . getMethod ( name , typesOf ( parameterTypes , clazz . getClassLoader ( ) ) ) ; }
Look up a public method matching this method identifier using reflection .
19,631
public static MethodIdentifier getIdentifier ( final Class < ? > returnType , final String name , final Class < ? > ... parameterTypes ) { return new MethodIdentifier ( returnType . getName ( ) , name , namesOf ( parameterTypes ) ) ; }
Construct a new instance using class objects for the parameter types .
19,632
public static MethodIdentifier getIdentifier ( final String returnType , final String name , final String ... parameterTypes ) { return new MethodIdentifier ( returnType , name , parameterTypes ) ; }
Construct a new instance using string names for the return and parameter types .
19,633
public ProxyConfiguration < T > setProxyName ( final Package pkg , final String simpleName ) { this . proxyName = pkg . getName ( ) + '.' + simpleName ; return this ; }
Sets the proxy name
19,634
public static Class < ? > loadJavaType ( String typeName , ClassLoader classLoader ) throws ClassNotFoundException { if ( classLoader == null ) classLoader = getContextClassLoader ( ) ; Class < ? > javaType = primitiveNames . get ( typeName ) ; if ( javaType == null ) javaType = getArray ( typeName , classLoader ) ; if...
Load a Java type from a given class loader .
19,635
public static boolean isPrimitive ( Class < ? > javaType ) { return javaType . isPrimitive ( ) || ( javaType . isArray ( ) && isPrimitive ( javaType . getComponentType ( ) ) ) ; }
True if the given class is a primitive or array of which .
19,636
public static String getJustClassName ( Class < ? > cls ) { if ( cls == null ) return null ; if ( cls . isArray ( ) ) { Class < ? > c = cls . getComponentType ( ) ; return getJustClassName ( c . getName ( ) ) ; } return getJustClassName ( cls . getName ( ) ) ; }
Given a class strip out the package name
19,637
public static String getJustClassName ( String classname ) { int index = classname . lastIndexOf ( '.' ) ; if ( index < 0 ) index = 0 ; else index = index + 1 ; return classname . substring ( index ) ; }
Given a FQN of a class strip out the package name
19,638
public static Class < ? > getPrimitiveType ( Class < ? > javaType ) { if ( javaType == Integer . class ) return int . class ; if ( javaType == Short . class ) return short . class ; if ( javaType == Boolean . class ) return boolean . class ; if ( javaType == Byte . class ) return byte . class ; if ( javaType == Long . ...
Get the corresponding primitive for a give wrapper type . Also handles arrays of which .
19,639
public static Object getPrimitiveValueArray ( Object value ) { if ( value == null ) return null ; Class < ? > javaType = value . getClass ( ) ; if ( javaType . isArray ( ) ) { int length = Array . getLength ( value ) ; Object destArr = Array . newInstance ( getPrimitiveType ( javaType . getComponentType ( ) ) , length ...
Converts an n - dimensional array of wrapper types to primitive types
19,640
public static boolean isAssignableFrom ( Class < ? > dest , Class < ? > src ) { if ( dest == null || src == null ) throw MESSAGES . cannotCheckClassIsAssignableFrom ( dest , src ) ; boolean isAssignable = dest . isAssignableFrom ( src ) ; if ( isAssignable == false && dest . getName ( ) . equals ( src . getName ( ) ) )...
Return true if the dest class is assignable from the src . Also handles arrays and primitives .
19,641
public static Class < ? > erasure ( Type type ) { if ( type instanceof ParameterizedType ) { return erasure ( ( ( ParameterizedType ) type ) . getRawType ( ) ) ; } if ( type instanceof TypeVariable < ? > ) { return erasure ( ( ( TypeVariable < ? > ) type ) . getBounds ( ) [ 0 ] ) ; } if ( type instanceof WildcardType )...
Erases a type according to the JLS type erasure rules
19,642
public static boolean isJBossRepositoryClassLoader ( ClassLoader loader ) { Class < ? > clazz = loader . getClass ( ) ; while ( ! clazz . getName ( ) . startsWith ( "java" ) ) { if ( "org.jboss.mx.loading.RepositoryClassLoader" . equals ( clazz . getName ( ) ) ) return true ; clazz = clazz . getSuperclass ( ) ; } retur...
Tests if this class loader is a JBoss RepositoryClassLoader
19,643
public static void clearBlacklists ( ClassLoader loader ) { if ( isJBossRepositoryClassLoader ( loader ) ) { for ( Method m : loader . getClass ( ) . getMethods ( ) ) { if ( "clearBlackLists" . equalsIgnoreCase ( m . getName ( ) ) ) { try { m . invoke ( loader ) ; } catch ( Exception e ) { if ( ROOT_LOGGER . isTraceEna...
Clears black lists on a JBoss RepositoryClassLoader . This is somewhat of a hack and could be replaced with an integration module . This is needed when the following order of events occur .
19,644
private static String getName ( final String resourceName , final String fallBackName ) { return resourceName . length ( ) > 0 ? resourceName : fallBackName ; }
Returns JNDI resource name .
19,645
private static String convertToBeanName ( final String methodName ) { return Character . toLowerCase ( methodName . charAt ( 3 ) ) + methodName . substring ( 4 ) ; }
Translates setBeanName to beanName string .
19,646
protected final Method getImplMethod ( final Class < ? > implClass , final Method seiMethod ) throws NoSuchMethodException { final String methodName = seiMethod . getName ( ) ; final Class < ? > [ ] paramTypes = seiMethod . getParameterTypes ( ) ; return implClass . getMethod ( methodName , paramTypes ) ; }
Returns implementation method that will be used for invocation .
19,647
@ SuppressWarnings ( "rawtypes" ) public void setupConfigHandlers ( Binding binding , CommonConfig config ) { if ( config != null ) { List < Handler > userHandlers = getNonConfigHandlers ( binding . getHandlerChain ( ) ) ; List < Handler > handlers = convertToHandlers ( config . getPreHandlerChains ( ) , binding . getB...
Setups a given Binding instance using a specified CommonConfig
19,648
public T newInstance ( InvocationHandler handler ) throws InstantiationException , IllegalAccessException { T ret = newInstance ( ) ; setInvocationHandler ( ret , handler ) ; return ret ; }
Create a new proxy initialising it with the given invocation handler .
19,649
public void setInvocationHandler ( Object proxy , InvocationHandler handler ) { Field field = getInvocationHandlerField ( ) ; try { field . set ( proxy , handler ) ; } catch ( IllegalArgumentException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } }
Sets the invocation handler for a proxy created from this factory .
19,650
public InvocationHandler getInvocationHandler ( Object proxy ) { Field field = getInvocationHandlerField ( ) ; try { return ( InvocationHandler ) field . get ( proxy ) ; } catch ( IllegalArgumentException e ) { throw new RuntimeException ( "Object is not a proxy of correct type" , e ) ; } catch ( IllegalAccessException...
Returns the invocation handler for a proxy created from this factory .
19,651
public boolean isProxyClassDefined ( ClassLoader classLoader ) { try { classLoader . loadClass ( this . className ) ; return true ; } catch ( ClassNotFoundException e ) { return false ; } }
Checks if the proxy class has been defined in the given class loader
19,652
protected String getImplicitContextRoot ( ArchiveDeployment dep ) { String simpleName = dep . getSimpleName ( ) ; String contextRoot = simpleName . substring ( 0 , simpleName . length ( ) - 4 ) ; return contextRoot ; }
Use the implicit context root derived from the deployment name
19,653
public static void copyReader ( OutputStream outs , Reader reader ) throws IOException { try { OutputStreamWriter writer = new OutputStreamWriter ( outs , StandardCharsets . UTF_8 ) ; char [ ] bytes = new char [ 1024 ] ; int r = reader . read ( bytes ) ; while ( r > 0 ) { writer . write ( bytes , 0 , r ) ; r = reader ....
Copy the reader to the output stream
19,654
public Object invoke ( final Object proxy , final Method method , final Object [ ] args ) throws Throwable { InterceptorContext context = new InterceptorContext ( ) ; context . setParameters ( args ) ; context . setMethod ( method ) ; return interceptor . processInvocation ( context ) ; }
Handle a proxy method invocation .
19,655
public static byte [ ] generateRandomUUIDBytes ( ) { if ( rand == null ) rand = new SecureRandom ( ) ; byte [ ] buffer = new byte [ 16 ] ; rand . nextBytes ( buffer ) ; buffer [ 6 ] = ( byte ) ( ( buffer [ 6 ] & 0x0f ) | 0x40 ) ; buffer [ 8 ] = ( byte ) ( ( buffer [ 8 ] & 0x3f ) | 0x80 ) ; return buffer ; }
Generates a pseudo random UUID and returns it in byte array form .
19,656
public static String convertToString ( byte [ ] uuid ) { if ( uuid . length != 16 ) throw Messages . MESSAGES . uuidMustBeOf16Bytes ( ) ; String string = bytesToHex ( uuid , 0 , 4 ) + "-" + bytesToHex ( uuid , 4 , 2 ) + "-" + bytesToHex ( uuid , 6 , 2 ) + "-" + bytesToHex ( uuid , 8 , 2 ) + "-" + bytesToHex ( uuid , 10...
Converts a UUID in byte array form to the IETF string format .
19,657
public void afterClassLoad ( Class < ? > clazz ) { super . afterClassLoad ( clazz ) ; try { Class . forName ( clazz . getName ( ) , true , clazz . getClassLoader ( ) ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( e ) ; } }
Sets the accessible flag on the cached methods
19,658
static boolean isEscaped ( final String characters , final int position ) { int p = position ; int nbBackslash = 0 ; while ( p > 0 && characters . charAt ( -- p ) == '\\' ) { nbBackslash ++ ; } return ( nbBackslash % 2 == 1 ) ; }
Indicates if the character at the given position is escaped or not .
19,659
private Object wrappedAction ( final Context cx , final Scriptable scope , final Scriptable thisObj , final Object [ ] args , final int actionType ) { try { ScriptRuntime . setRegExpProxy ( cx , wrapped_ ) ; return wrapped_ . action ( cx , scope , thisObj , args , actionType ) ; } finally { ScriptRuntime . setRegExpPro...
Calls action on the wrapped RegExp proxy .
19,660
static String jsRegExpToJavaRegExp ( String re ) { re = re . replaceAll ( "\\[\\^\\\\\\d\\]" , "." ) ; re = re . replaceAll ( "\\[([^\\]]*)\\\\b([^\\]]*)\\]" , "[$1\\\\cH$2]" ) ; re = re . replaceAll ( "(?<!\\\\)\\[([^((?<!\\\\)\\[)\\]]*)\\[" , "[$1\\\\[" ) ; re = re . replaceAll ( "(?<!\\\\)\\[([^\\]]*)(?<!\\\\)\\\\\\...
Transform a JavaScript regular expression to a Java regular expression
19,661
private void consumeInputFully ( HttpServletRequest req ) { try { ServletInputStream is = req . getInputStream ( ) ; while ( ! is . isFinished ( ) && is . read ( ) != - 1 ) { } } catch ( IOException e ) { log . info ( "Could not consume full client request" , e ) ; } }
connection - see SOLR - 8453 and SOLR - 8683
19,662
public void toSAX ( ContentHandler contentHandler ) throws SAXException { for ( SaxBit saxbit : this . saxbits ) { saxbit . send ( contentHandler ) ; } }
Stream this buffer into the provided content handler . If contentHandler object implements LexicalHandler it will get lexical events as well .
19,663
public void dump ( Writer writer ) throws IOException { Iterator < SaxBit > i = this . saxbits . iterator ( ) ; while ( i . hasNext ( ) ) { final SaxBit saxbit = i . next ( ) ; saxbit . dump ( writer ) ; } writer . flush ( ) ; }
Dump buffer contents into the provided writer .
19,664
public void addChild ( Tree t ) { if ( t == null ) { return ; } BaseTree childTree = ( BaseTree ) t ; if ( childTree . isNil ( ) ) { if ( this . children != null && this . children == childTree . children ) { throw new RuntimeException ( "attempt to add child list to itself" ) ; } if ( childTree . children != null ) { ...
Add t as child of this node .
19,665
public void addChildren ( List < ? extends Tree > kids ) { for ( int i = 0 ; i < kids . size ( ) ; i ++ ) { Tree t = kids . get ( i ) ; addChild ( t ) ; } }
Add all elements of kids list as children of this node
19,666
public Tree getAncestor ( int ttype ) { Tree t = this ; t = t . getParent ( ) ; while ( t != null ) { if ( t . getType ( ) == ttype ) return t ; t = t . getParent ( ) ; } return null ; }
Walk upwards and get first ancestor with this token type .
19,667
public List < ? extends Tree > getAncestors ( ) { if ( getParent ( ) == null ) return null ; List < Tree > ancestors = new ArrayList < Tree > ( ) ; Tree t = this ; t = t . getParent ( ) ; while ( t != null ) { ancestors . add ( 0 , t ) ; t = t . getParent ( ) ; } return ancestors ; }
Return a list of all ancestors of this node . The first node of list is the root and the last is the parent of this node .
19,668
public String toStringTree ( ) { if ( children == null || children . isEmpty ( ) ) { return this . toString ( ) ; } StringBuilder buf = new StringBuilder ( ) ; if ( ! isNil ( ) ) { buf . append ( "(" ) ; buf . append ( this . toString ( ) ) ; buf . append ( ' ' ) ; } for ( int i = 0 ; children != null && i < children ....
Print out a whole tree not just a node
19,669
public Obj work ( Obj cmd ) throws Exception { stopping = false ; return status ( ) . with ( P_STATUS , STATUS_STARTED ) ; }
null not run false err true ok
19,670
public String render ( SoyMapData model , String view ) throws IOException { return getSoyTofu ( null ) . newRenderer ( view ) . setData ( model ) . render ( ) ; }
simple helper method to quickly render a template
19,671
public Obj buildObject ( Object ... members ) { Obj o = newObject ( ) ; for ( int i = 0 ; i < members . length ; i += 2 ) { o . put ( ( String ) members [ i ] , members [ i + 1 ] ) ; } return o ; }
members in the form key val key val etc .
19,672
@ SuppressWarnings ( "unchecked" ) public < T > void sort ( Arr arr , Comparator < T > c ) { int l = arr . getLength ( ) ; Object [ ] objs = new Object [ l ] ; for ( int i = 0 ; i < l ; i ++ ) { objs [ i ] = arr . get ( i ) ; } Arrays . sort ( ( T [ ] ) objs , c ) ; for ( int i = 0 ; i < l ; i ++ ) { arr . put ( i , ob...
can lead to classcastexception if comparator is not of the right type
19,673
public JsonTransformer build ( ) { try { return new WrappingTransformer ( buildPipe ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( "Failed to build pipeline: " + e . getMessage ( ) , e ) ; } }
Build a raw pipeline without a terminating transformer . It is the caller s responsibility to set the final transformer (
19,674
public List < String > getSearchDimensions ( ) { List < String > dimensions = new ArrayList < String > ( ) ; for ( int i = 0 ; i < m_Space . dimensions ( ) ; ++ i ) { dimensions . add ( m_Space . getDimension ( i ) . getLabel ( ) ) ; } return dimensions ; }
Returns the search dimensions
19,675
protected String logPerformances ( Space space , Vector < Performance > performances , Tag type ) { return m_Owner . logPerformances ( space , performances , type ) ; }
generates a table string for all the performances in the space and returns that .
19,676
protected void logPerformances ( Space space , Vector < Performance > performances ) { m_Owner . logPerformances ( space , performances ) ; }
aligns all performances in the space and prints those tables to the log file .
19,677
public void addPerformance ( Performance performance , int folds ) { m_Performances . add ( performance ) ; m_Cache . add ( folds , performance ) ; m_Trace . add ( new AbstractMap . SimpleEntry < Integer , Performance > ( folds , performance ) ) ; }
Adds the performance to the cache and the current list of performances .
19,678
public List < Entry < String , Object > > getTraceParameterSettings ( int index ) { List < Entry < String , Object > > result = new ArrayList < Map . Entry < String , Object > > ( ) ; List < String > dimensions = getSearchDimensions ( ) ; for ( int i = 0 ; i < dimensions . size ( ) ; ++ i ) { String parameter = dimensi...
Returns the parameter settings in structured way
19,679
public SearchResult search ( Instances data ) throws Exception { SearchResult result ; SearchResult best ; try { log ( "\n" + getClass ( ) . getName ( ) + "\n" + getClass ( ) . getName ( ) . replaceAll ( "." , "=" ) + "\n" + "Options: " + Utils . joinOptions ( getOptions ( ) ) + "\n" ) ; log ( "\n- ) ; check ( data ) ;...
Performs the search and returns the best setup .
19,680
public void cleanUp ( ) { m_Owner = null ; m_Train = null ; m_Test = null ; m_Generator = null ; m_Values = null ; }
Cleans up after the task finishes .
19,681
public int compareTo ( Point < E > obj ) { if ( obj == null ) return - 1 ; if ( dimensions ( ) != obj . dimensions ( ) ) return - 1 ; for ( int i = 0 ; i < dimensions ( ) ; i ++ ) { if ( getValue ( i ) . getClass ( ) != obj . getValue ( i ) . getClass ( ) ) return - 1 ; if ( getValue ( i ) instanceof Double ) { if ( Ut...
Compares the given point with this point .
19,682
public Space subspace ( Point < Integer > center ) { Space result ; SpaceDimension [ ] dimensions ; int i ; dimensions = new SpaceDimension [ dimensions ( ) ] ; for ( i = 0 ; i < dimensions . length ; i ++ ) dimensions [ i ] = getDimension ( i ) . subdimension ( center . getValue ( i ) - 1 , center . getValue ( i ) + 1...
Returns a subspace around the given point with just one more neighbor left and right on each dimension .
19,683
protected boolean inc ( Integer [ ] locations , int [ ] max ) { boolean result ; int i ; result = true ; i = 0 ; while ( i < locations . length ) { if ( locations [ i ] < max [ i ] - 1 ) { locations [ i ] ++ ; break ; } else { locations [ i ] = 0 ; i ++ ; if ( i == locations . length ) result = false ; } } return resul...
Increments the location array by 1 .
19,684
protected Vector < Point < Integer > > listPoints ( ) { Vector < Point < Integer > > result ; int i ; int [ ] max ; Integer [ ] locations ; boolean ok ; result = new Vector < Point < Integer > > ( ) ; max = new int [ dimensions ( ) ] ; for ( i = 0 ; i < max . length ; i ++ ) max [ i ] = getDimension ( i ) . width ( ) ;...
returns a Vector with all points in the space .
19,685
protected String getID ( int cv , Point < Object > values ) { String result ; int i ; result = "" + cv ; for ( i = 0 ; i < values . dimensions ( ) ; i ++ ) result += "\t" + values . getValue ( i ) ; return result ; }
returns the ID string for a cache item .
19,686
public Performance get ( int cv , Point < Object > values ) { return m_Cache . get ( getID ( cv , values ) ) ; }
returns a cached performance object null if not yet in the cache .
19,687
public void add ( int cv , Performance p ) { m_Cache . put ( getID ( cv , p . getValues ( ) ) , p ) ; }
adds the performance to the cache .
19,688
public DefaultEvaluationTask newTask ( MultiSearchCapable owner , Instances train , Instances test , SetupGenerator generator , Point < Object > values , int folds , int eval , int classLabel ) { return new DefaultEvaluationTask ( owner , train , test , generator , values , folds , eval , classLabel ) ; }
Returns a new task .
19,689
public boolean check ( int id ) { for ( Tag tag : getTags ( ) ) { if ( tag . getID ( ) == id ) return true ; } return false ; }
Returns whether the ID is valid .
19,690
public double getMetric ( int id , int classLabel ) { try { switch ( id ) { case DefaultEvaluationMetrics . EVALUATION_CC : return m_Evaluation . correlationCoefficient ( ) ; case DefaultEvaluationMetrics . EVALUATION_MATTHEWS_CC : return m_Evaluation . matthewsCorrelationCoefficient ( 0 ) ; case DefaultEvaluationMetri...
Returns the metric for the given ID .
19,691
public boolean invert ( int id ) { switch ( id ) { case EVALUATION_CC : case EVALUATION_ACC : case EVALUATION_KAPPA : case EVALUATION_MATTHEWS_CC : case EVALUATION_PRECISION : case EVALUATION_WEIGHTED_PRECISION : case EVALUATION_RECALL : case EVALUATION_WEIGHTED_RECALL : case EVALUATION_AUC : case EVALUATION_WEIGHTED_A...
Returns whether to negate the metric for sorting purposes .
19,692
public String [ ] getItems ( ) throws Exception { String [ ] result ; if ( getCustomDelimiter ( ) . isEmpty ( ) ) result = Utils . splitOptions ( getList ( ) ) ; else result = getList ( ) . split ( getCustomDelimiter ( ) ) ; return result ; }
Splits the list string using the appropriate delimiter .
19,693
public SpaceDimension spaceDimension ( ) throws Exception { String [ ] items ; items = getItems ( ) ; return new ListSpaceDimension ( 0 , items . length - 1 , items , getProperty ( ) ) ; }
Returns the parameter as space dimensions .
19,694
public boolean getBooleanSetting ( final ChaiSetting setting ) { final String settingValue = getSetting ( setting ) ; return StringHelper . convertStrToBoolean ( settingValue ) ; }
Get an individual setting value and test it as a boolean .
19,695
public List < String > bindURLsAsList ( ) { final List < String > splitUrls = Arrays . asList ( getSetting ( ChaiSetting . BIND_URLS ) . split ( LDAP_URL_SEPARATOR_REGEX_PATTERN ) ) ; return Collections . unmodifiableList ( splitUrls ) ; }
Returns an immutable list of the ldap URLs .
19,696
private static void pause ( final long time ) { final long startTime = System . currentTimeMillis ( ) ; do { try { final long sleepTime = time - ( System . currentTimeMillis ( ) - startTime ) ; Thread . sleep ( sleepTime > 0 ? sleepTime : 10 ) ; } catch ( InterruptedException e ) { } } while ( ( System . currentTimeMil...
Causes the executing thread to pause for a period of time .
19,697
public static ChaiResponseSet newChaiResponseSet ( final Map < Challenge , String > challengeResponseMap , final Locale locale , final int minimumRandomRequired , final ChaiConfiguration chaiConfiguration , final String csIdentifier ) throws ChaiValidationException { return newChaiResponseSet ( challengeResponseMap , C...
Create a new ResponseSet . The generated ResponseSet will be suitable for writing to the directory .
19,698
private void checkTimer ( ) { try { serviceThreadLock . lock ( ) ; if ( watchdogTimer == null ) { if ( ! issuedWatchdogWrappers . allValues ( ) . isEmpty ( ) ) { LOGGER . debug ( "starting up " + THREAD_NAME + ", " + watchdogFrequency + "ms check frequency" ) ; startWatchdogThread ( ) ; } } } finally { serviceThreadLoc...
Regulate the timer . This is important because the timer task creates its own thread and if the task isn t cleaned up there could be a thread leak .
19,699
public static ConfigObjectRecord createNew ( final ChaiEntry entry , final String attr , final String recordType , final String guid1 , final String guid2 ) { if ( entry == null ) { throw new NullPointerException ( "entry can not be null" ) ; } if ( recordType == null ) { throw new NullPointerException ( "recordType ca...
Create a new config object record . This will only create a java object representing the config object record . It is up to the caller to call the updatePayload method which will actually commit the record to the directory .