signature:
public class ClientBase { /** * Send the given call to the server .
 * @ param call the remote method call to be invoked
 * @ return the result of the method call
 * @ throws ServerException wrapper around { @ link ThriftException } . Callers should catch and unwrap this .
 * @ throws IOException from the protocol
 * @ throws Exception exception received from server implements { @ link com . microsoft . thrifty . Struct } */
final Object invokeRequest ( MethodCall < ? > call ) throws Exception { } }

implementation:
boolean isOneWay = call . callTypeId == TMessageType . ONEWAY ; int sid = seqId . incrementAndGet ( ) ; protocol . writeMessageBegin ( call . name , call . callTypeId , sid ) ; call . send ( protocol ) ; protocol . writeMessageEnd ( ) ; protocol . flush ( ) ; if ( isOneWay ) { // No response will be received
return null ; } MessageMetadata metadata = protocol . readMessageBegin ( ) ; if ( metadata . seqId != sid ) { throw new ThriftException ( ThriftException . Kind . BAD_SEQUENCE_ID , "Unrecognized sequence ID" ) ; } if ( metadata . type == TMessageType . EXCEPTION ) { ThriftException e = ThriftException . read ( protocol ) ; protocol . readMessageEnd ( ) ; throw new ServerException ( e ) ; } else if ( metadata . type != TMessageType . REPLY ) { throw new ThriftException ( ThriftException . Kind . INVALID_MESSAGE_TYPE , "Invalid message type: " + metadata . type ) ; } if ( metadata . seqId != seqId . get ( ) ) { throw new ThriftException ( ThriftException . Kind . BAD_SEQUENCE_ID , "Out-of-order response" ) ; } if ( ! metadata . name . equals ( call . name ) ) { throw new ThriftException ( ThriftException . Kind . WRONG_METHOD_NAME , "Unexpected method name in reply; expected " + call . name + " but received " + metadata . name ) ; } try { Object result = call . receive ( protocol , metadata ) ; protocol . readMessageEnd ( ) ; return result ; } catch ( Exception e ) { if ( e instanceof Struct ) { // Business as usual
protocol . readMessageEnd ( ) ; } throw e ; }


signature: public class BinaryProtocol { @ Override public MessageMetadata readMessageBegin ( ) throws IOException { } }

implementation: int size = readI32 ( ) ; if ( size < 0 ) { int version = size & VERSION_MASK ; if ( version != VERSION_1 ) { throw new ProtocolException ( "Bad version in readMessageBegin" ) ; } return new MessageMetadata ( readString ( ) , ( byte ) ( size & 0xff ) , readI32 ( ) ) ; } else { if ( strictRead ) { throw new ProtocolException ( "Missing version in readMessageBegin" ) ; } return new MessageMetadata ( readStringWithSize ( size ) , readByte ( ) , readI32 ( ) ) ; }


signature:
public class AsyncClientBase { /** * When invoked by a derived instance , places the given call in a queue to
 * be sent to the server .
 * @ param methodCall the remote method call to be invoked */
protected void enqueue ( MethodCall < ? > methodCall ) { } }

implementation:
if ( ! running . get ( ) ) { throw new IllegalStateException ( "Cannot write to a closed service client" ) ; } if ( ! pendingCalls . offer ( methodCall ) ) { // This should never happen with an unbounded queue
throw new IllegalStateException ( "Call queue is full" ) ; }


signature:
public class PlatformUtils { /** * Resolves a file system location to an Eclipse workspace resource .
 * @ param location The file system location
 * @ return The Eclipse < code > IFile < / code > , null if not found */
public static IFile getResourceFromFSPath ( String location ) { } }

implementation: return Activator . getDefault ( ) . getWorkspace ( ) . getRoot ( ) . getFileForLocation ( new Path ( location ) ) ;


signature:
public class PlatformUtils { /** * Causes the platform to update Guvnor decoration notions . */
public static void updateDecoration ( ) { } }

implementation: final IWorkbench workbench = Activator . getDefault ( ) . getWorkbench ( ) ; workbench . getDisplay ( ) . syncExec ( new Runnable ( ) { public void run ( ) { IDecoratorManager manager = workbench . getDecoratorManager ( ) ; manager . update ( GuvnorDecorator . DECORATOR_ID ) ; } } ) ;


signature:
public class PlatformUtils { /** * Causes the Repository view to refresh , if it is open . */
public static void refreshRepositoryView ( ) { } }

implementation:
IWorkbenchWindow activeWindow = Activator . getDefault ( ) . getWorkbench ( ) . getActiveWorkbenchWindow ( ) ; // If there is no active workbench window , then there can be no Repository view
if ( activeWindow == null ) { return ; } // If there is no active workbench page , then there can be no Repository view
IWorkbenchPage page = activeWindow . getActivePage ( ) ; if ( page == null ) { return ; } RepositoryView view = ( RepositoryView ) page . findView ( IGuvnorConstants . REPVIEW_ID ) ; if ( view != null ) { view . refresh ( ) ; }


signature:
public class PlatformUtils { /** * Tries to find the Resource History view , attempting to open it if necessary . */
public static ResourceHistoryView getResourceHistoryView ( ) throws Exception { } }

implementation:
IWorkbenchWindow activeWindow = Activator . getDefault ( ) . getWorkbench ( ) . getActiveWorkbenchWindow ( ) ; // If there is no active workbench window , then there can be no Repository History view
if ( activeWindow == null ) { return null ; } // If there is no active workbench page , then there can be no Repository History view
IWorkbenchPage page = activeWindow . getActivePage ( ) ; if ( page == null ) { return null ; } return ( ResourceHistoryView ) page . showView ( IGuvnorConstants . RESHISTORYVIEW_ID ) ;


signature:
public class PlatformUtils { /** * Opens a read - only , in - memory editor .
 * @ param contents The contents for the editor
 * @ param name The name of the file . Will be used to determine
 * eclipse editor association , defaulting to text editor
 * if no association is found */
public static void openEditor ( String contents , String name ) { } }

implementation:
IWorkbenchWindow window = PlatformUI . getWorkbench ( ) . getActiveWorkbenchWindow ( ) ; IStorage storage = new StringStorage ( contents , name ) ; IStorageEditorInput input = new StringInput ( storage ) ; IWorkbenchPage page = window . getActivePage ( ) ; IEditorDescriptor desc = PlatformUI . getWorkbench ( ) . getEditorRegistry ( ) . getDefaultEditor ( name ) ; // If there is no editor associated with the given file name , we ' ll just
// use the eclipse text editor as a default
String editorId = desc != null ? desc . getId ( ) : "org.eclipse.ui.DefaultTextEditor" ; // $ NON - NLS - 1 $
try { if ( page != null ) { page . openEditor ( input , editorId ) ; } } catch ( Exception e ) { Activator . getDefault ( ) . displayError ( IStatus . ERROR , e . getMessage ( ) , e , true ) ; }


signature:
public class PlatformUtils { /** * Convenience method for reporting log in failure */
public static void reportAuthenticationFailure ( ) { } }

implementation:
Display display = PlatformUI . getWorkbench ( ) . getDisplay ( ) ; display . asyncExec ( new Runnable ( ) { public void run ( ) { Display display = Display . getCurrent ( ) ; Shell shell = display . getActiveShell ( ) ; MessageDialog . openError ( shell , Messages . getString ( "login.failure.dialog.caption" ) , // $ NON - NLS - 1 $
Messages . getString ( "login.failure.dialog.message" ) ) ; // $ NON - NLS - 1 $
} } ) ;


signature:
public class PlatformUtils { /** * Prompts for user name and password for a given Guvnor repository .
 * @ param server The repository for log in
 * @ return The dialog results . Includes whether the user decided to save
 * the user name and password in the platform ' s key ring .
 * Null if the user cancels the dialog . */
public AuthPromptResults promptForAuthentication ( final String server ) { } }

implementation: Display display = PlatformUI . getWorkbench ( ) . getDisplay ( ) ; AuthPromptRunnable op = new AuthPromptRunnable ( server ) ; display . syncExec ( op ) ; return op . getResults ( ) ;


signature:
public class BufferPool { /** * Returns a buffer ( byte array ) of size < code > BUFFER _ SIZE < / code > from the
 * pool . When the buffer is no longer needed , it should be put back in the
 * pool for future use by calling < code > putBuffer < / code > .
 * @ return a buffer
 * @ see # putBuffer ( byte [ ] ) */
public synchronized byte [ ] getBuffer ( ) { } }

implementation: if ( pool . isEmpty ( ) ) return new byte [ BUFFER_SIZE ] ; byte [ ] buffer = ( byte [ ] ) pool . lastElement ( ) ; pool . removeElementAt ( pool . size ( ) - 1 ) ; return buffer ;


signature:
public class BufferPool { /** * Puts the given buffer into the pool for future use . The size of the
 * buffer must be < code > BUFFER _ SIZE < / code > .
 * @ param buffer the buffer to be put back into the buffer pool
 * @ see # getBuffer ( ) */
public synchronized void putBuffer ( byte [ ] buffer ) { } }

implementation: Assert . isNotNull ( buffer ) ; Assert . isTrue ( buffer . length == BUFFER_SIZE ) ; if ( pool . size ( ) < MAX_BUFFERS ) pool . addElement ( buffer ) ;


signature:
public class KieNavigatorView { /** * Creates a page displayed when there are no servers defined .
 * @ param kit
 * @ return Control */
private Control createDefaultPage ( FormToolkit kit ) { } }

implementation:
Form form = kit . createForm ( book ) ; Composite body = form . getBody ( ) ; GridLayout layout = new GridLayout ( 2 , false ) ; body . setLayout ( layout ) ; Link hlink = new Link ( body , SWT . NONE ) ; hlink . setText ( "Use the Servers View to create a new server..." ) ; hlink . setBackground ( book . getDisplay ( ) . getSystemColor ( SWT . COLOR_LIST_BACKGROUND ) ) ; GridData gd = new GridData ( SWT . LEFT , SWT . FILL , true , false ) ; hlink . setLayoutData ( gd ) ; hlink . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { // show Servers View
ViewUtils . showServersView ( ) ; } } ) ; // Create the context menu for the default page
final CommonViewer commonViewer = this . getCommonViewer ( ) ; if ( commonViewer != null ) { ICommonViewerSite commonViewerSite = CommonViewerSiteFactory . createCommonViewerSite ( this . getViewSite ( ) ) ; if ( commonViewerSite != null ) { // Note : actionService cannot be null
final NavigatorActionService actionService = new NavigatorActionService ( commonViewerSite , commonViewer , commonViewer . getNavigatorContentService ( ) ) ; MenuManager menuManager = new MenuManager ( "#PopupMenu" ) ; menuManager . addMenuListener ( new IMenuListener ( ) { public void menuAboutToShow ( IMenuManager mgr ) { ISelection selection = commonViewer . getSelection ( ) ; actionService . setContext ( new ActionContext ( selection ) ) ; actionService . fillContextMenu ( mgr ) ; } } ) ; Menu menu = menuManager . createContextMenu ( body ) ; // It is necessary to set the menu in two places :
// 1 . The white space in the server view
// 2 . The text and link in the server view . If this menu is not
// set , if the
// user right clicks on the text or uses shortcut keys to open
// the context menu ,
// the context menu will not come up
body . setMenu ( menu ) ; hlink . setMenu ( menu ) ; } else { // if ( Trace . FINEST ) {
// Trace . trace ( Trace . STRING _ FINEST ,
// " The commonViewerSite is null " ) ;
} } else { // if ( Trace . FINEST ) {
// Trace . trace ( Trace . STRING _ FINEST , " The commonViewer is null " ) ;
} return form ;


signature:
public class KieNavigatorView { /** * Switch between the servers and default / empty page . */
void toggleDefaultPage ( ) { } }

implementation: if ( treeViewer . getTree ( ) . getItemCount ( ) < 1 ) { book . showPage ( noServersPage ) ; } else { book . showPage ( mainPage ) ; }


signature:
public class KieNavigatorView { /** * Start the animation thread */
protected void startThread ( ) { } }

implementation:
if ( animationActive ) return ; stopAnimation = false ; final Display display = treeViewer == null ? Display . getDefault ( ) : treeViewer . getControl ( ) . getDisplay ( ) ; final int SLEEP = 200 ; final Runnable [ ] animator = new Runnable [ 1 ] ; animator [ 0 ] = new Runnable ( ) { public void run ( ) { if ( ! stopAnimation ) { try { int size = 0 ; String [ ] servers ; synchronized ( starting ) { size = starting . size ( ) ; servers = new String [ size ] ; starting . toArray ( servers ) ; } for ( int i = 0 ; i < size ; i ++ ) { IServer server = ServerCore . findServer ( servers [ i ] ) ; if ( server != null ) { // ServerDecorator . animate ( ) ;
treeViewer . update ( server , new String [ ] { "ICON" } ) ; } } } catch ( Exception e ) { // if ( Trace . FINEST ) {
// Trace . trace ( Trace . STRING _ FINEST ,
// " Error in Servers view animation " , e ) ;
} display . timerExec ( SLEEP , animator [ 0 ] ) ; } } } ; Display . getDefault ( ) . asyncExec ( new Runnable ( ) { public void run ( ) { display . timerExec ( SLEEP , animator [ 0 ] ) ; } } ) ;


signature:
public class PropertyBehavior { /** * Adds the given property href to this propertybehavior ' s list of live
 * properties . The property href must not be < code > null < / code > and the
 * form of this property behavior must not already be omit or
 * keepAllAlive .
 * @ param propertyHref the property href to add */
public void addProperty ( String propertyHref ) { } }

implementation:
Assert . isNotNull ( propertyHref ) ; Assert . isTrue ( getFirstChild ( root , "omit" ) == null ) ; // $ NON - NLS - 1 $
Element keepalive = getFirstChild ( root , "keepalive" ) ; // $ NON - NLS - 1 $
if ( keepalive == null ) keepalive = addChild ( root , "keepalive" , fgNamesKeepAlive , true ) ; // $ NON - NLS - 1 $
else Assert . isTrue ( ! "*" . equals ( getFirstText ( keepalive ) ) ) ; // $ NON - NLS - 1 $
addChild ( keepalive , "href" , // $ NON - NLS - 1 $
encodeHref ( propertyHref ) , new String [ ] { "href" } , // $ NON - NLS - 1 $
false ) ;


signature:
public class PropertyBehavior { /** * Returns an < code > Enumeration < / code > over this propertybehavior ' s
 * property hrefs . The methods < code > isMerge ( ) < / code > and
 * < code > isKeepAllAlive < / code > return false if this propertybehavior is
 * in the " keep some alive " form .
 * @ return an < code > Enumeration < / code > of < code > String < / code > s
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed , or this
 * propertybehavior is not in the " keep some alive " form
 * @ see # isKeepAllAlive ( )
 * @ see # isOmit ( ) */
public Enumeration getProperties ( ) throws MalformedElementException { } }

implementation:
Element keepalive = getFirstChild ( root , "keepalive" ) ; // $ NON - NLS - 1 $
ensureNotNull ( Policy . bind ( "ensure.missingKeealiveElmt" ) , keepalive ) ; // $ NON - NLS - 1 $
ensure ( ! "*" . equals ( getFirstText ( keepalive ) ) , // $ NON - NLS - 1 $
Policy . bind ( "ensure.wrongForm" ) ) ; // $ NON - NLS - 1 $
final Element firstHref = getFirstChild ( keepalive , "href" ) ; // $ NON - NLS - 1 $
ensureNotNull ( Policy . bind ( "ensure.missingHrefElmt" ) , firstHref ) ; // $ NON - NLS - 1 $
Enumeration e = new Enumeration ( ) { Element currentHref = firstHref ; public boolean hasMoreElements ( ) { return currentHref != null ; } public Object nextElement ( ) { if ( ! hasMoreElements ( ) ) throw new NoSuchElementException ( ) ; String href = getFirstText ( currentHref ) ; currentHref = getTwin ( currentHref , true ) ; return decodeHref ( href ) ; } } ; return e ;


signature:
public class PropertyBehavior { /** * Returns < code > true < / code > if this propertybehavior is in the
 * " keep all alive " form , otherwise , returns < code > false < / code > .
 * @ return a boolean indicating whether this propertybehavior is in the
 * " keep all alive " form or not
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed */
public boolean isKeepAllAlive ( ) throws MalformedElementException { } }

implementation:
Element child = getFirstChild ( root , childNames ) ; ensureNotNull ( Policy . bind ( "ensure.expectingOmitOrKeepaliveElmt" ) , child ) ; // $ NON - NLS - 1 $
boolean isKeepAllAlive = false ; if ( isDAVElement ( child , "keepalive" ) ) { // $ NON - NLS - 1 $
isKeepAllAlive = "*" . equals ( getFirstText ( child ) ) ; // $ NON - NLS - 1 $
ensureNull ( Policy . bind ( "ensure.conflictingHrefElmt" ) , getFirstChild ( child , "href" ) ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
} child = getNextSibling ( child , childNames ) ; ensureNull ( Policy . bind ( "ensure.conflictingOmitOrKeepaliveElmt" ) , child ) ; // $ NON - NLS - 1 $
return isKeepAllAlive ;


signature:
public class PropertyBehavior { /** * Sets whether this propertybehavior is in the " keep all alive " form or
 * not .
 * @ param isKeepAllAlive a boolean indicating whether this
 * propertybehavior will be in the " keep all
 * alive " form */
public void setIsKeepAllAlive ( boolean isKeepAllAlive ) { } }

implementation:
Element child = getFirstChild ( root , childNames ) ; boolean isAlreadyKeepAllAlive = false ; if ( isDAVElement ( child , "keepalive" ) ) // $ NON - NLS - 1 $
isAlreadyKeepAllAlive = "*" . equals ( getFirstText ( child ) ) ; // $ NON - NLS - 1 $
if ( isKeepAllAlive ) { if ( ! isAlreadyKeepAllAlive ) { if ( child != null ) root . removeChild ( child ) ; appendChild ( root , "keepalive" , "*" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
} } else if ( isAlreadyKeepAllAlive ) root . removeChild ( child ) ;


signature:
public class PropertyBehavior { /** * Sets whether this propertybehavior is in the " omit " form or not .
 * @ param isOmit a boolean indicating whether this propertybehavior will
 * be in the " omit " form */
public void setIsOmit ( boolean isOmit ) { } }

implementation:
Element child = getFirstChild ( root , childNames ) ; boolean isAlreadyOmit = isDAVElement ( child , "omit" ) ; // $ NON - NLS - 1 $
if ( isOmit ) { if ( ! isAlreadyOmit ) { if ( child != null ) root . removeChild ( child ) ; appendChild ( root , "omit" ) ; // $ NON - NLS - 1 $
} } else if ( isAlreadyOmit ) root . removeChild ( child ) ;


signature:
public class ActiveLock { /** * Adds the given href to this activelock ' s locktoken . The href must not
 * be < code > null < / code > .
 * @ param href the href to add */
public void addLockTokenHref ( String href ) { } }

implementation:
Assert . isNotNull ( href ) ; Element locktoken = getLastChild ( root , "locktoken" ) ; // $ NON - NLS - 1 $
if ( locktoken == null ) locktoken = setChild ( root , "locktoken" , childNames , false ) ; // $ NON - NLS - 1 $
appendChild ( locktoken , "href" , encodeHref ( href ) ) ; // $ NON - NLS - 1 $


signature:
public class ActiveLock { /** * Returns the depth of this activelock ; for example ,
 * < code > Context . DEPTH _ ZERO < / code > .
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed
 * @ see Context */
public String getDepth ( ) throws MalformedElementException { } }

implementation:
String depth = getChildText ( root , "depth" , false ) ; // $ NON - NLS - 1 $
ensureNotNull ( Policy . bind ( "ensure.missingDepthElmt" ) , depth ) ; // $ NON - NLS - 1 $
ensure ( depth . equals ( IContext . DEPTH_ZERO ) || depth . equals ( IContext . DEPTH_ONE ) || depth . equals ( IContext . DEPTH_INFINITY ) , Policy . bind ( "ensure.invalidDepth" , depth ) ) ; // $ NON - NLS - 1 $
return depth ;


signature:
public class ActiveLock { /** * Returns an < code > Enumeration < / code > of < code > String < / code > s
 * containing this activelock ' s lock token hrefs .
 * @ return an < code > Enumeration < / code > of < code > String < / code > s
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed */
public Enumeration getLockTokenHrefs ( ) throws MalformedElementException { } }

implementation:
Element locktoken = getLastChild ( root , "locktoken" ) ; // $ NON - NLS - 1 $
Element firstHref = null ; if ( locktoken != null ) { firstHref = getFirstChild ( locktoken , "href" ) ; // $ NON - NLS - 1 $
ensureNotNull ( Policy . bind ( "ensure.missingHrefElmt" ) , firstHref ) ; // $ NON - NLS - 1 $
} final Node node = firstHref ; Enumeration e = new Enumeration ( ) { Node currentHref = node ; public boolean hasMoreElements ( ) { return currentHref != null ; } public Object nextElement ( ) { if ( ! hasMoreElements ( ) ) { throw new NoSuchElementException ( ) ; } String href = getFirstText ( ( Element ) currentHref ) ; currentHref = getTwin ( ( Element ) currentHref , true ) ; return decodeHref ( href ) ; } } ; return e ;


signature:
public class ActiveLock { /** * Returns this activelock ' s owner , or < code > null < / code > if this
 * active lock has no owner .
 * @ return this activelock ' s owner , or < code > null < / code >
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed */
public Owner getOwner ( ) throws MalformedElementException { } }

implementation:
Element owner = getLastChild ( root , "owner" ) ; // $ NON - NLS - 1 $
if ( owner == null ) return null ; return new Owner ( owner ) ;


signature:
public class ActiveLock { /** * Sets the depth of this activelock to the given depth . The depth must
 * not be null and must be one of :
 * < ul >
 * < li > < code > Context . DEPTH _ ZERO < / code >
 * < li > < code > Context . DEPTH _ ONE < / code >
 * < li > < code > Context . DEPTH _ INFINITY < / code >
 * < / ul >
 * @ param depth the depth for this activelock
 * @ see Context */
public void setDepth ( String depth ) { } }

implementation: Assert . isNotNull ( depth ) ; Assert . isTrue ( depth . equals ( IContext . DEPTH_ZERO ) || depth . equals ( IContext . DEPTH_ONE ) || depth . equals ( IContext . DEPTH_INFINITY ) ) ; setChild ( root , "depth" , depth , childNames , false ) ; // $ NON - NLS - 1 $


signature:
public class ActiveLock { /** * Sets whether this activelock is shared or exclusive . If isShared is
 * < code > true < / code > , the activelock is set as shared , otherwise , the
 * activelock is set as exclusive .
 * @ param isShared a boolean indicating whether this activelock will be
 * set to be shared or exclusive */
public void setIsShared ( boolean isShared ) { } }

implementation:
Element lockscope = setChild ( root , "lockscope" , childNames , true ) ; // $ NON - NLS - 1 $
if ( isShared ) appendChild ( lockscope , "shared" ) ; // $ NON - NLS - 1 $
else appendChild ( lockscope , "exclusive" ) ; // $ NON - NLS - 1 $


signature:
public class ActiveLock { /** * Creates and sets an owner element on this activelock and returns an
 * editor on it .
 * @ return an editor on an owner element */
public Owner setOwner ( ) { } }

implementation:
Element owner = setChild ( root , "owner" , childNames , false ) ; // $ NON - NLS - 1 $
Owner result = null ; try { result = new Owner ( owner ) ; } catch ( MalformedElementException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
} return result ;


signature:
public class ActiveLock { /** * Sets the timeout on this activelock to the given timeout . If the
 * timeout is < code > null < / code > the current timeout is removed .
 * @ param timeout the timeout value for this activelock , or
 * < code > null < / code > for no timeout */
public void setTimeout ( String timeout ) { } }

implementation:
if ( timeout == null ) { Element child = getLastChild ( root , "timeout" ) ; // $ NON - NLS - 1 $
if ( child != null ) root . removeChild ( child ) ; } else setChild ( root , "timeout" , timeout , childNames , false ) ; // $ NON - NLS - 1 $


signature:
public class KieResourceHandler { /** * / * ( non - Javadoc )
 * @ see org . kie . eclipse . server . IKieResourceHandler # getPreferenceName ( java . lang . String ) */
@ Override public String getPreferenceName ( String name ) { } }

implementation: String canonicalName = getCanonicalName ( getRoot ( ) . getName ( ) ) ; if ( name == null ) return canonicalName ; return canonicalName + IKieConstants . PREF_PATH_SEPARATOR + getCanonicalName ( name ) ;


signature:
public class LockInfo { /** * Creates a new WebDAV lockinfo element and sets it as the root of the
 * given document . Returns an editor on the new lockinfo element . The
 * document must not be < code > null < / code > , and must not already have a
 * root element .
 * @ param document the document that will become the root of a new
 * lockinfo element
 * @ return an element editor on a lockinfo element */
public static LockInfo create ( Document document ) { } }

implementation:
Assert . isNotNull ( document ) ; Assert . isTrue ( document . getOwnerDocument ( ) == null ) ; Element element = create ( document , "lockinfo" ) ; // $ NON - NLS - 1 $
Element locktype = appendChild ( element , "locktype" ) ; // $ NON - NLS - 1 $
appendChild ( locktype , "write" ) ; // $ NON - NLS - 1 $
LockInfo result = null ; try { result = new LockInfo ( element ) ; } catch ( MalformedElementException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
} return result ;


signature:
public class LockInfo { /** * Returns < code > true < / code > if this lockinfo is shared and
 * < code > false < / code > if it is exclusive .
 * @ return a boolean indicating whether this lockinfo is shared or
 * exclusive
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed */
public boolean isShared ( ) throws MalformedElementException { } }

implementation:
Element lockscope = getFirstChild ( root , "lockscope" ) ; // $ NON - NLS - 1 $
ensureNotNull ( Policy . bind ( "ensure.missingLockscopeElmt" ) , lockscope ) ; // $ NON - NLS - 1 $
String [ ] names = new String [ ] { "shared" , "exclusive" } ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
Element sharedOrExclusive = getFirstChild ( lockscope , names ) ; ensureNotNull ( Policy . bind ( "ensure.missingSharedOrExclusiveElmt" ) , sharedOrExclusive ) ; // $ NON - NLS - 1 $
boolean isShared = isDAVElement ( sharedOrExclusive , "shared" ) ; // $ NON - NLS - 1 $
ensure ( getNextSibling ( sharedOrExclusive , names ) == null , Policy . bind ( "ensure.conflictingSharedOrExclusiveElmt" ) ) ; // $ NON - NLS - 1 $
return isShared ;


signature:
public class ConditionTerm { /** * Add a ConditionFactor to a ConditionTerm .
 * @ param factor the factor to add
 * @ exception WebDAVException thrown if the term already contains the factor */
public void addConditionFactor ( ConditionFactor factor ) throws WebDAVException { } }

implementation:
if ( conditionFactors . contains ( factor ) ) throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseDuplicateEntry" ) ) ; // $ NON - NLS - 1 $
conditionFactors . addElement ( factor ) ;


signature:
public class ConditionTerm { /** * Create a ConditionTerm by parsing the given If header as defined by
 * section 9.4 in the WebDAV spec .
 * @ param tokenizer a StreamTokenizer on the contents of a WebDAV If header
 * @ return the parsed ConditionTerm
 * @ exception WebDAVException thrown if there is a syntax error in the If header */
public static ConditionTerm create ( StreamTokenizer tokenizer ) throws WebDAVException { } }

implementation:
ConditionTerm term = new ConditionTerm ( ) ; try { int token = tokenizer . ttype ; if ( token == '(' ) token = tokenizer . nextToken ( ) ; else throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissing" , String . valueOf ( token ) , "(" ) ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
while ( token == StreamTokenizer . TT_WORD || token == '<' || token == '[' ) { term . addConditionFactor ( ConditionFactor . create ( tokenizer ) ) ; token = tokenizer . ttype ; } if ( token == ')' ) token = tokenizer . nextToken ( ) ; else throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissing" , String . valueOf ( token ) , ")" ) ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
} catch ( IOException exc ) { // ignore or log ?
} if ( ! term . getConditionFactors ( ) . hasMoreElements ( ) ) throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissingStateOrEntity" ) ) ; // $ NON - NLS - 1 $
return term ;


signature:
public class ConditionTerm { /** * See if this ConditionTerm matches the given ConditionTerm . This is an
 * AND operation . All the factors in the ConditionTerm must match .
 * @ param conditionTerm the term to match
 * @ return true if all the factors in the term match those in this term */
public boolean matches ( ConditionTerm conditionTerm ) { } }

implementation: int numberOfItemsToMatch = 0 ; boolean match = true ; Enumeration factors = getConditionFactors ( ) ; while ( match && factors . hasMoreElements ( ) ) { ConditionFactor factor = ( ConditionFactor ) factors . nextElement ( ) ; if ( factor . not ( ) ) { match = ! conditionTerm . contains ( factor ) ; } else { match = conditionTerm . contains ( factor ) ; numberOfItemsToMatch ++ ; } } match = match && numberOfItemsToMatch == conditionTerm . numberOfFactors ( ) ; return match ;


signature:
public class DSLRuleSourceViewerConfig { /** * Get the appropriate content assistance , for each partition . */
public IContentAssistant getContentAssistant ( ISourceViewer sourceViewer ) { } }

implementation: ContentAssistant assistant = new ContentAssistant ( ) ; assistant . setContentAssistProcessor ( new DefaultCompletionProcessor ( getEditor ( ) ) , IDocument . DEFAULT_CONTENT_TYPE ) ; assistant . setContentAssistProcessor ( new DSLRuleCompletionProcessor ( getEditor ( ) ) , DRLPartionScanner . RULE_PART_CONTENT ) ; assistant . setProposalPopupOrientation ( IContentAssistant . PROPOSAL_OVERLAY ) ; assistant . setAutoActivationDelay ( 0 ) ; return assistant ;


signature:
public class VertexEditPart { /** * / * ( non - Javadoc )
 * @ see java . beans . PropertyChangeListener # propertyChange ( java . beans . PropertyChangeEvent ) */
public void propertyChange ( PropertyChangeEvent evt ) { } }

implementation: String prop = evt . getPropertyName ( ) ; if ( GraphicalVertex . SIZE_PROP . equals ( prop ) || GraphicalVertex . LOCATION_PROP . equals ( prop ) ) { refreshVisuals ( ) ; } else if ( GraphicalVertex . SOURCE_CONNECTIONS_PROP . equals ( prop ) ) { refreshSourceConnections ( ) ; } else if ( GraphicalVertex . TARGET_CONNECTIONS_PROP . equals ( prop ) ) { refreshTargetConnections ( ) ; }


signature:
public class VertexEditPart { /** * / * ( non - Javadoc )
 * @ see org . eclipse . gef . editparts . AbstractEditPart # refreshVisuals ( ) */
protected void refreshVisuals ( ) { } }

implementation: Rectangle bounds = new Rectangle ( getCastedModel ( ) . getLocation ( ) , getCastedModel ( ) . getSize ( ) ) ; ( ( GraphicalEditPart ) getParent ( ) ) . setLayoutConstraint ( this , getFigure ( ) , bounds ) ;


signature:
public class VertexEditPart { /** * / * ( non - Javadoc )
 * @ see org . eclipse . gef . editparts . AbstractGraphicalEditPart # getAdapter ( java . lang . Class ) */
public Object getAdapter ( @ SuppressWarnings ( "rawtypes" ) Class key ) { } }

implementation: if ( key == IPropertySource . class ) { return propertySource ; } return super . getAdapter ( key ) ;


signature:
public class DroolsHandler { /** * $ NON - NLS - 1 $ */
@ Override public void initializeRuntimes ( List < RuntimeDefinition > serverDefinitions ) { } }

implementation: IRuntime [ ] existingRuntimes = DroolsRuntimeManager . getDefault ( ) . getConfiguredRuntimes ( ) ; List < DroolsRuntime > droolsRuntimes = new ArrayList < DroolsRuntime > ( ) ; if ( existingRuntimes != null ) { for ( IRuntime runtime : existingRuntimes ) { if ( runtime instanceof DroolsRuntime ) droolsRuntimes . add ( ( DroolsRuntime ) runtime ) ; } } initializeInternal ( serverDefinitions , droolsRuntimes ) ; if ( droolsRuntimes . size ( ) > 0 ) { DroolsRuntime [ ] dra = droolsRuntimes . toArray ( new DroolsRuntime [ 0 ] ) ; DroolsRuntimeManager . getDefault ( ) . setRuntimes ( dra ) ; }


signature:
public class DefaultCompletionProcessor { /** * create and returns a java project based on the current editor input or returns null */
private IJavaProject getCurrentJavaProject ( ) { } }

implementation: IEditorInput input = getEditor ( ) . getEditorInput ( ) ; if ( ! ( input instanceof IFileEditorInput ) ) { return null ; } IProject project = ( ( IFileEditorInput ) input ) . getFile ( ) . getProject ( ) ; IJavaProject javaProject = JavaCore . create ( project ) ; return javaProject ;


signature:
public class DefaultCompletionProcessor { /** * do we already have a completion for that string that would be either a local variable or a field ? */
protected static boolean doesNotContainFieldCompletion ( String completion , List < ICompletionProposal > completions ) { } }

implementation: if ( completion == null || completion . length ( ) == 0 || completions == null ) { return false ; } for ( Iterator < ICompletionProposal > iter = completions . iterator ( ) ; iter . hasNext ( ) ; ) { Object o = iter . next ( ) ; if ( o instanceof AbstractJavaCompletionProposal ) { AbstractJavaCompletionProposal prop = ( AbstractJavaCompletionProposal ) o ; String content = prop . getReplacementString ( ) ; if ( completion . equals ( content ) ) { IJavaElement javaElement = prop . getJavaElement ( ) ; if ( javaElement instanceof ILocalVariable || javaElement instanceof IField ) { return false ; } } } } return true ;


signature:
public class DSLAdapter { /** * Get a reader to the DSL contents */
public static Reader getDSLContent ( String ruleSource , IResource input ) throws CoreException { } }

implementation: String dslFileName = findDSLConfigName ( ruleSource , input ) ; if ( dslFileName == null ) { return null ; } IResource res = findDSLResource ( input , dslFileName ) ; if ( res instanceof IFile ) { IFile dslConf = ( IFile ) res ; if ( dslConf . exists ( ) ) { return new InputStreamReader ( dslConf . getContents ( ) ) ; } } return null ;


signature:
public class DSLAdapter { /** * This does the hunting around the projec to find the . dsl file . */
private void loadConfig ( IFile input ) { } }

implementation: IResource res = findDSLResource ( input , dslConfigName ) ; if ( res instanceof IFile ) { IFile dslConf = ( IFile ) res ; if ( dslConf . exists ( ) ) { InputStream stream = null ; try { stream = dslConf . getContents ( ) ; readConfig ( stream ) ; valid = true ; } catch ( Exception e ) { throw new IllegalStateException ( "Unable to open DSL config file. (Exception: " + e . getMessage ( ) + ")" ) ; } finally { closeStream ( stream ) ; } } }


signature:
public class DSLAdapter { /** * This will load in the DSL config file , using the DSLMapping from drools - compiler */
void readConfig ( InputStream stream ) throws IOException , CoreException { } }

implementation: DSLTokenizedMappingFile file = new DSLTokenizedMappingFile ( ) ; file . parseAndLoad ( new InputStreamReader ( stream ) ) ; DSLMapping grammar = file . getMapping ( ) ; List < DSLMappingEntry > conditions = grammar . getEntries ( DSLMappingEntry . CONDITION ) ; List < DSLMappingEntry > consequences = grammar . getEntries ( DSLMappingEntry . CONSEQUENCE ) ; conditionProposals = buildProposals ( conditions ) ; consequenceProposals = buildProposals ( consequences ) ; dslTree . buildTree ( grammar ) ;


signature:
public class DSLAdapter { /** * Sniffs out the expander / DSL config name as best it can . */
static String findDSLConfigName ( String content ) { } }

implementation: String name = null ; Matcher matches = EXPANDER_PATTERN . matcher ( content ) ; if ( matches . find ( ) ) { name = matches . group ( 1 ) + ".dsl" ; } return name ;


signature:
public class URLTool { /** * Returns the given < code > URL < / code > with a trailing slash appended to
 * it . If the < code > URL < / code > already has a trailing slash the
 * < code > URL < / code > is returned unchanged .
 * < table >
 * < caption > Example < / caption >
 * < tr >
 * < th > Given URL < / th >
 * < th > Returned URL < / th >
 * < tr >
 * < td > " http : / / hostname / folder " < / td >
 * < td > " http : / / hostname / folder / " < / td >
 * < tr >
 * < td > " http : / / hostname / folder / < / td >
 * < td > " http : / / hostname / folder / " < / td >
 * < / table >
 * @ param url a URL
 * @ return the given URL with a trailing slash */
public static URL appendTrailingSlash ( URL url ) { } }

implementation:
String file = url . getFile ( ) ; if ( file . endsWith ( "/" ) ) { // $ NON - NLS - 1 $
return url ; } try { return new URL ( url . getProtocol ( ) , url . getHost ( ) , url . getPort ( ) , file + "/" ) ; // $ NON - NLS - 1 $
} catch ( MalformedURLException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
} return null ;


signature:
public class URLTool { /** * Returns the child URL formed by joining the given member with the
 * given parent URL .
 * @ return a child URL of the given parent
 * @ throws MalformedURLException if the given parent is malformed */
public static URL getChild ( String parent , String member ) throws MalformedURLException { } }

implementation: return getChild ( new URL ( parent ) , member ) ;


signature:
public class URLTool { /** * Returns the child URL formed by joining the given member with the
 * given parent URL .
 * @ return a child URL of the given parent */
public static URL getChild ( URL parent , String member ) { } }

implementation:
String file = parent . getFile ( ) ; if ( ! file . endsWith ( "/" ) ) // $ NON - NLS - 1 $
file = file + "/" ; // $ NON - NLS - 1 $
try { return new URL ( parent . getProtocol ( ) , parent . getHost ( ) , parent . getPort ( ) , file + member ) ; } catch ( MalformedURLException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
} return null ;


signature:
public class URLTool { /** * Returns all elements in the given URLs path .
 * < table >
 * < caption > Example < / caption >
 * < tr >
 * < th > Given URL < / th >
 * < th > Element < / th >
 * < tr >
 * < td > " http : / / hostname / " < / td >
 * < td > [ ] < / td >
 * < tr >
 * < td > " http : / / hostname / folder / < / td >
 * < td > [ folder ] < / td >
 * < tr >
 * < td > " http : / / hostname / folder / file < / td >
 * < td > [ folder , file ] < / td >
 * < / table >
 * @ param url a URL
 * @ return all elements in the given URLs path */
public static Vector getElements ( URL url ) { } }

implementation: Vector result = new Vector ( 5 ) ; String lastElement = null ; while ( ( lastElement = getLastElement ( url ) ) != null ) { result . insertElementAt ( lastElement , 0 ) ; url = getParent ( url ) ; } return result ;


signature:
public class URLTool { /** * Returns the last element in the given URLs path , or < code > null < / code >
 * if the URL is the root .
 * < table >
 * < caption > Example < / caption >
 * < tr >
 * < th > Given URL < / th >
 * < th > Last Element < / th >
 * < tr >
 * < td > " http : / / hostname / " < / td >
 * < td > null < / td >
 * < tr >
 * < td > " http : / / hostname / folder / < / td >
 * < td > folder < / td >
 * < tr >
 * < td > " http : / / hostname / folder / file < / td >
 * < td > file < / td >
 * < / table >
 * @ param url a URL
 * @ return the last element in the given URLs path , or
 * < code > null < / code > if the URL is the root */
public static String getLastElement ( URL url ) { } }

implementation: String file = url . getFile ( ) ; int len = file . length ( ) ; if ( len == 0 || len == 1 && file . charAt ( 0 ) == '/' ) { return null ; } int lastSlashIndex = - 1 ; for ( int i = len - 2 ; lastSlashIndex == - 1 && i >= 0 ; -- i ) { if ( file . charAt ( i ) == '/' ) { lastSlashIndex = i ; } } boolean isDirectory = file . charAt ( len - 1 ) == '/' ; if ( lastSlashIndex == - 1 ) { if ( isDirectory ) return file . substring ( 0 , len - 1 ) ; return file ; } if ( isDirectory ) return file . substring ( lastSlashIndex + 1 , len - 1 ) ; return file . substring ( lastSlashIndex + 1 , len ) ;


signature:
public class URLTool { /** * Returns the parent URL of the given URL , or < code > null < / code > if the
 * given URL is the root .
 * < table >
 * < caption > Example < / caption >
 * < tr >
 * < th > Given URL < / th >
 * < th > Parent URL < / th >
 * < tr >
 * < td > " http : / / hostname / " < / td >
 * < td > null < / td >
 * < tr >
 * < td > " http : / / hostname / folder / file < / td >
 * < td > " http : / / hostname / folder / < / td >
 * < / table >
 * @ param url a URL
 * @ return the parent of the given URL */
public static URL getParent ( URL url ) { } }

implementation:
String file = url . getFile ( ) ; int len = file . length ( ) ; if ( len == 0 || len == 1 && file . charAt ( 0 ) == '/' ) return null ; int lastSlashIndex = - 1 ; for ( int i = len - 2 ; lastSlashIndex == - 1 && i >= 0 ; -- i ) { if ( file . charAt ( i ) == '/' ) lastSlashIndex = i ; } if ( lastSlashIndex == - 1 ) file = "" ; // $ NON - NLS - 1 $
else file = file . substring ( 0 , lastSlashIndex + 1 ) ; try { url = new URL ( url . getProtocol ( ) , url . getHost ( ) , url . getPort ( ) , file ) ; } catch ( MalformedURLException e ) { Assert . isTrue ( false , e . getMessage ( ) ) ; } return url ;


signature:
public class URLTool { /** * Returns the root URL of the given URL .
 * < table >
 * < caption > Example < / caption >
 * < tr >
 * < th > Given URL < / th >
 * < th > Root URL < / th >
 * < tr >
 * < td > " http : / / hostname / " < / td >
 * < td > " http : / / hostname / " < / td >
 * < tr >
 * < td > " http : / / hostname / folder / file < / td >
 * < td > " http : / / hostname / " < / td >
 * < / table >
 * @ param url a URL
 * @ return the root URL of the given URL */
public static URL getRoot ( URL url ) { } }

implementation:
try { return new URL ( url . getProtocol ( ) , url . getHost ( ) , url . getPort ( ) , "/" ) ; // $ NON - NLS - 1 $
} catch ( MalformedURLException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
} return null ;


signature:
public class URLTool { /** * Returns the given URL with its trailing slash removed . If the URL has
 * no trailing slash , the URL is returned unchanged .
 * < table >
 * < caption > Example < / caption >
 * < tr >
 * < th > Given URL < / th >
 * < th > Returned URL < / th >
 * < tr >
 * < td > " http : / / hostname / folder " < / td >
 * < td > " http : / / hostname / folder " < / td >
 * < tr >
 * < td > " http : / / hostname / folder / < / td >
 * < td > " http : / / hostname / folder " < / td >
 * < / table >
 * @ param url a URL
 * @ return the given URL with its last slash removed */
public static URL removeTrailingSlash ( URL url ) { } }

implementation:
String file = url . getFile ( ) ; if ( file . endsWith ( "/" ) ) { // $ NON - NLS - 1 $
file = file . substring ( 0 , file . length ( ) - 1 ) ; try { return new URL ( url . getProtocol ( ) , url . getHost ( ) , url . getPort ( ) , file ) ; } catch ( MalformedURLException e ) { Assert . isTrue ( false , e . getMessage ( ) ) ; } } else { return url ; } return null ;


signature:
public class URLTool { /** * Returns a boolean indicating whether the given URLs overlap .
 * < table >
 * < caption > Example < / caption >
 * < tr >
 * < th > First URL < / th >
 * < th > Second URL < / th >
 * < th > Do they overlap < / th >
 * < tr >
 * < td > " http : / / hostname / folder / " < / td >
 * < td > " http : / / hostname / folder / " < / td >
 * < td > true < / td >
 * < tr >
 * < td > " http : / / hostname / folder / " < / td >
 * < td > " http : / / hostname / folder / file " < / td >
 * < td > true < / td >
 * < tr >
 * < td > " http : / / hostname / folder / file " < / td >
 * < td > " http : / / hostname / folder / " < / td >
 * < td > true < / td >
 * < tr >
 * < td > " http : / / hostname / folder1 / " < / td >
 * < td > " http : / / hostname / folder2 / " < / td >
 * < td > false < / td >
 * < / table >
 * @ param url1 firt URL
 * @ param url2 second URL
 * @ return a boolean indicating whether the given URLs overlap */
public static boolean urlsOverlap ( String url1 , String url2 ) throws MalformedURLException { } }

implementation: return urlsOverlap ( new URL ( url1 ) , new URL ( url2 ) ) ;


signature:
public class URLTool { /** * Returns a boolean indicating whether the given URLs overlap .
 * < table >
 * < caption > Example < / caption >
 * < tr >
 * < th > First URL < / th >
 * < th > Second URL < / th >
 * < th > Do they overlap < / th >
 * < tr >
 * < td > " http : / / hostname / folder / " < / td >
 * < td > " http : / / hostname / folder / " < / td >
 * < td > true < / td >
 * < tr >
 * < td > " http : / / hostname / folder / " < / td >
 * < td > " http : / / hostname / folder / file " < / td >
 * < td > true < / td >
 * < tr >
 * < td > " http : / / hostname / folder / file " < / td >
 * < td > " http : / / hostname / folder / " < / td >
 * < td > true < / td >
 * < tr >
 * < td > " http : / / hostname / folder1 / " < / td >
 * < td > " http : / / hostname / folder2 / " < / td >
 * < td > false < / td >
 * < tr >
 * < td > " http : / / hostname1 / folder / " < / td >
 * < td > " http : / / hostname2 / folder / " < / td >
 * < td > false < / td >
 * < / table >
 * @ param url1 firt URL
 * @ param url2 second URL
 * @ return a boolean indicating whether the given URLs overlap */
public static boolean urlsOverlap ( URL url1 , URL url2 ) { } }

implementation: if ( ! getRoot ( url1 ) . equals ( getRoot ( url2 ) ) ) { return false ; } Vector elements1 = URLTool . getElements ( url1 ) ; Vector elements2 = URLTool . getElements ( url2 ) ; for ( int i = 0 ; i < elements1 . size ( ) && i < elements2 . size ( ) ; ++ i ) { String element1 = ( String ) elements1 . elementAt ( i ) ; String element2 = ( String ) elements2 . elementAt ( i ) ; if ( ! element1 . equals ( element2 ) ) { return false ; } } return true ;


signature:
public class RuleHelperActionDelegate { /** * Return a menu which launches the various wizards */
public Menu getMenu ( Control parent ) { } }

implementation: setMenu ( new Menu ( parent ) ) ; final Shell shell = parent . getShell ( ) ; addProjectWizard ( menu , shell ) ; addRuleWizard ( menu , shell ) ; addDSLWizard ( menu , shell ) ; addDTWizard ( menu , shell ) ; return menu ;


signature:
public class Response { /** * Returns the content length of this message ' s body , or - 1 if the
 * content length is unknown .
 * @ return the content length of this message ' s body */
public long getContentLength ( ) { } }

implementation:
// Get the declared content length .
long contentLength = context . getContentLength ( ) ; // If it is defined send the answer .
if ( contentLength != - 1 ) return contentLength ; // Certain messages are defined as having zero length
// message bodies .
int statusCode = getStatusCode ( ) ; if ( statusCode == IResponse . SC_NO_CONTENT || statusCode == IResponse . SC_NOT_MODIFIED || statusCode >= 100 && statusCode < 200 ) return 0 ; // We don ' t know how long the body is .
return - 1 ;


signature:
public class Response { /** * Returns the content type of this response ' s body , or < code > null < / code >
 * if the content type is unknown .
 * @ return the content type of this response ' s body */
public ContentType getContentType ( ) { } }

implementation:
String contentTypeString = context . getContentType ( ) ; if ( contentTypeString == null ) return null ; ContentType contentType = null ; try { contentType = new ContentType ( contentTypeString ) ; } catch ( IllegalArgumentException e ) { // ignore or log ?
} return contentType ;


signature:
public class Response { /** * Returns this response ' s body as a DOM < code > Document < / code > . This
 * response must have a document body .
 * @ exception IOException if there is an I / O error */
public Document getDocumentBody ( ) throws IOException { } }

implementation:
Assert . isTrue ( hasDocumentBody ) ; Assert . isTrue ( ! hasInputStream ) ; // Lazily parse the message body .
if ( document == null ) { String characterEncoding = null ; ContentType contentType = getContentType ( ) ; if ( contentType != null ) { characterEncoding = contentType . getValue ( "charset" ) ; // $ NON - NLS - 1 $
} if ( characterEncoding == null ) { characterEncoding = "ASCII" ; // $ NON - NLS - 1 $
} IDocumentMarshaler marshaler = new DocumentMarshaler ( ) ; document = marshaler . parse ( new InputStreamReader ( is , characterEncoding ) ) ; } return document ;


signature:
public class QueryElementNodeVertex { /** * / * ( non - Javadoc )
 * @ see org . drools . core . reteoo . BaseNodeVertex # getHtml ( ) */
public String getHtml ( ) { } }

implementation: return NODE_NAME + " : " + this . node . getId ( ) + " : " + this . node . getQueryElement ( ) == null ? "" : this . node . getQueryElement ( ) . getQueryName ( ) ;


signature:
public class MultiStatus { /** * Creates and adds a response element to this multistatus and returns
 * an editor on it .
 * @ return an editor on a response element */
public ResponseBody addResponse ( ) { } }

implementation:
Element response = addChild ( root , "response" , childNames , true ) ; // $ NON - NLS - 1 $
try { return new ResponseBody ( response ) ; } catch ( MalformedElementException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
return null ; // Never reached .
}


signature:
public class MultiStatus { /** * Creates a new WebDAV multistatus element and sets it as the root of
 * the given document . Returns an editor on the new multistatus element .
 * The document must not be < code > null < / code > , and must not already have
 * a root element . < / p >
 * @ param document the document that will become the root of a new
 * multistatus element
 * @ return an element editor on a multistatus element */
public static MultiStatus create ( Document document ) { } }

implementation:
Assert . isNotNull ( document ) ; Assert . isTrue ( document . getOwnerDocument ( ) == null ) ; Element element = create ( document , "multistatus" ) ; // $ NON - NLS - 1 $
try { return new MultiStatus ( element ) ; } catch ( MalformedElementException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
return null ; // Never reached .
}


signature:
public class MultiStatus { /** * Returns an < code > Enumeration < / code > over this multistatus ' responses .
 * @ return an < code > Enumeration < / code > of < code > ResponseBody < / code > s
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed */
public Enumeration getResponses ( ) throws MalformedElementException { } }

implementation:
final Element firstResponse = getFirstChild ( root , "response" ) ; // $ NON - NLS - 1 $
ensureNotNull ( Policy . bind ( "ensure.missingResponseElmt" ) , firstResponse ) ; // $ NON - NLS - 1 $
Enumeration e = new Enumeration ( ) { Element currentResponse = firstResponse ; public boolean hasMoreElements ( ) { return currentResponse != null ; } public Object nextElement ( ) { if ( ! hasMoreElements ( ) ) throw new NoSuchElementException ( ) ; ResponseBody responseBody = null ; try { responseBody = new ResponseBody ( currentResponse ) ; } catch ( MalformedElementException ex ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
} currentResponse = getTwin ( currentResponse , true ) ; return responseBody ; } } ; return e ;


signature:
public class GuvnorDecorator { /** * $ NON - NLS - 1 $ */
private boolean isGuvnorResource ( Object element ) { } }

implementation: if ( element instanceof IResource ) { return GuvnorMetadataUtils . findGuvnorMetadata ( ( IResource ) element ) != null ; } else { return false ; }


signature:
public class HrefSet { /** * Adds the given href to the end of the set of hrefs . If the href
 * already exists it is not added .
 * @ param href the href to add to the end of the set of hrefs */
public void addHref ( String href ) { } }

implementation: String encodedHref = encodeHref ( href ) ; if ( isDuplicate ( encodedHref ) ) return ; appendChild ( root , "href" , encodedHref ) ; // $ NON - NLS - 1 $


signature:
public class HrefSet { /** * Creates a new href set element with the given name and sets it as
 * the root of the given document . Returns an editor on the new href set
 * element . The document must not be < code > null < / code > , and must not
 * already have a root element .
 * @ param document the document that will become the root of a new
 * href set element
 * @ return an element editor on a href set element */
public static HrefSet create ( Document document , QualifiedName name ) { } }

implementation:
Assert . isNotNull ( document ) ; Assert . isTrue ( document . getOwnerDocument ( ) == null ) ; Assert . isNotNull ( name ) ; Assert . isTrue ( DAV_NS . equals ( name . getQualifier ( ) ) ) ; Element element = create ( document , name . getLocalName ( ) ) ; try { return new HrefSet ( element , name ) ; } catch ( MalformedElementException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
return null ; // Never reached .
}


signature:
public class HrefSet { /** * Returns an < code > Enumeration < / code > over the set of hrefs .
 * @ return an < code > Enumeration < / code > of href < code > String < / code > s */
public Enumeration getHrefs ( ) { } }

implementation:
final Element firstHref = getFirstChild ( root , "href" ) ; // $ NON - NLS - 1 $
Enumeration e = new Enumeration ( ) { Element currentHref = firstHref ; public boolean hasMoreElements ( ) { return currentHref != null ; } public Object nextElement ( ) { if ( ! hasMoreElements ( ) ) throw new NoSuchElementException ( ) ; String href = getFirstText ( currentHref ) ; currentHref = getNextSibling ( currentHref , "href" ) ; // $ NON - NLS - 1 $
return decodeHref ( href ) ; } } ; return e ;


signature:
public class HrefSet { /** * Inserts the given newHref before the given refHref in the set of
 * hrefs . If newHref already exists it is not inserted .
 * @ param refHref the existing href
 * @ param newHref the new href to be inserted before the existing href */
public void insertHrefBefore ( String newHref , String refHref ) { } }

implementation:
String refHrefEncoded = encodeHref ( refHref ) ; String newHrefEncoded = encodeHref ( newHref ) ; if ( isDuplicate ( newHrefEncoded ) ) return ; Element child = getFirstChild ( root , "href" ) ; // $ NON - NLS - 1 $
while ( child != null ) { if ( refHrefEncoded . equals ( getFirstText ( child ) ) ) { insertBefore ( child , "href" , newHrefEncoded ) ; // $ NON - NLS - 1 $
return ; } child = getNextSibling ( child , "href" ) ; // $ NON - NLS - 1 $
} Assert . isTrue ( false , Policy . bind ( "assert.noHrefRef" ) ) ; // $ NON - NLS - 1 $


signature:
public class HrefSet { /** * Remove the given href from the set of hrefs .
 * @ param href the href to remove from the set of hrefs */
public void removeHref ( String href ) { } }

implementation:
String encodedHref = encodeHref ( href ) ; Element child = getFirstChild ( root , "href" ) ; // $ NON - NLS - 1 $
while ( child != null ) { if ( encodedHref . equals ( getFirstText ( child ) ) ) { root . removeChild ( child ) ; return ; } child = getNextSibling ( child , "href" ) ; // $ NON - NLS - 1 $
}


signature:
public class ResponseBody { /** * Gets this response ' s first propstat with the given status and adds an
 * element created from the given property name as a property of the
 * propstat ' s prop . If such a propstat does not exists , it is created .
 * The propstat ' s response description is set to the given response
 * description , or removed if the response description is
 * < code > null < / code > . Returns the propstat . The property name must not
 * be < code > null < / code > and its qualifier and local part must not be
 * < code > null < / code > and must not be the empty string . The status must
 * not be < code > null < / code > . This response must not already be in the
 * " status " form .
 * @ param propertyName the name of the property to create and add
 * @ param status the status of the propstat to add the
 * property element to
 * @ param responseDescription the new response description of the
 * propstat , or < code > null < / code > to remove
 * the old one
 * @ return a propstat with the specified property
 * element , status , and response description */
public PropStat accumulatePropStat ( QualifiedName propertyName , String status , String responseDescription ) { } }

implementation:
Assert . isNotNull ( propertyName ) ; Assert . isNotNull ( status ) ; Element child = getFirstChild ( root , new String [ ] { "href" , "status" } ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
Assert . isTrue ( child == null || isDAVElement ( child , "href" ) // $ NON - NLS - 1 $
&& getNextSibling ( child , new String [ ] { "href" , "status" } ) == null ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
String nsName = propertyName . getQualifier ( ) ; Assert . isTrue ( ! "" . equals ( nsName ) ) ; // $ NON - NLS - 1 $
String localName = propertyName . getLocalName ( ) ; Assert . isNotNull ( localName ) ; Assert . isTrue ( ! localName . equals ( "" ) ) ; // $ NON - NLS - 1 $
Document document = root . getOwnerDocument ( ) ; Element element = document . createElement ( localName ) ; declareNS ( element , null , nsName ) ; try { return accumulatePropStat ( element , status , responseDescription ) ; } catch ( MalformedElementException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
return null ; // Never reached .
}


signature:
public class ResponseBody { /** * Gets this response ' s first propstat with the given status and adds a
 * clone of the given element as a property of its prop . If such a
 * propstat does not exists , it is created . The propstat ' s response
 * description is set to the given response description , or removed if
 * the response description is < code > null < / code > . Returns the propstat .
 * The element and status must not be < code > null < / code > . This response
 * must not already be in the " status " form .
 * @ param element the property element being added
 * @ param status the status of the propstat to add the
 * property element to
 * @ param responseDescription the new response description of the
 * propstat , or < code > null < / code > to remove
 * the old one
 * @ return a propstat with the given property
 * element , status , and response description
 * @ throws MalformedElementException if there is
 * reason to believe that the given element
 * is not well formed */
public PropStat accumulatePropStat ( Element element , String status , String responseDescription ) throws MalformedElementException { } }

implementation:
Assert . isNotNull ( element ) ; Assert . isNotNull ( status ) ; Element child = getFirstChild ( root , new String [ ] { "href" , "status" } ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
Assert . isTrue ( child == null || isDAVElement ( child , "href" ) // $ NON - NLS - 1 $
&& getNextSibling ( child , new String [ ] { "href" , "status" } ) == null ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
boolean found = false ; Element propstat = getFirstChild ( root , "propstat" ) ; // $ NON - NLS - 1 $
while ( ! found && propstat != null ) { String text = getChildText ( propstat , "status" , false ) ; // $ NON - NLS - 1 $
if ( text != null && text . equals ( status ) ) found = true ; else propstat = getTwin ( propstat , true ) ; } Element prop = null ; if ( propstat == null ) { propstat = addChild ( root , "propstat" , fgNamesPropStat , false ) ; // $ NON - NLS - 1 $
prop = setChild ( propstat , "prop" , PropStat . childNames , true ) ; // $ NON - NLS - 1 $
setChild ( propstat , "status" , status , PropStat . childNames , false ) ; // $ NON - NLS - 1 $
} else { prop = getFirstChild ( propstat , "prop" ) ; // $ NON - NLS - 1 $
if ( prop == null ) prop = setChild ( propstat , "prop" , PropStat . childNames , true ) ; // $ NON - NLS - 1 $
} if ( responseDescription == null ) { Element responsedescription = getLastChild ( propstat , "responsedescription" ) ; // $ NON - NLS - 1 $
if ( responsedescription != null ) propstat . removeChild ( responsedescription ) ; } else setChild ( propstat , "responsedescription" , // $ NON - NLS - 1 $
responseDescription , PropStat . childNames , false ) ; extractNode ( prop , element ) ; try { return new PropStat ( propstat ) ; } catch ( MalformedElementException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
return null ; // Never reached .
}


signature:
public class ResponseBody { /** * Adds the given href to this response . If < code > setHref ( String ) < / code >
 * hasn ' t been called and no hrefs have been added , this method sets
 * the first href and is thus equivalent to
 * < code > setHref ( String ) < / code > . The href must not be < code > null < / code > .
 * This response must not already be in " propstat " form .
 * @ param href the href to add */
public void addHref ( String href ) { } }

implementation:
Assert . isNotNull ( href ) ; Assert . isTrue ( getLastChild ( root , "propstat" ) == null ) ; // $ NON - NLS - 1 $
addChild ( root , "href" , encodeHref ( href ) , fgNamesStatus , false ) ; // $ NON - NLS - 1 $


signature:
public class ResponseBody { /** * Creates and adds a propstat element on this response and returns an
 * editor on it .
 * @ return an editor on a propstat element */
public PropStat addPropStat ( ) { } }

implementation:
Element firstHref = getFirstChild ( root , "href" ) ; // $ NON - NLS - 1 $
Assert . isTrue ( firstHref == null || getNextSibling ( firstHref , new String [ ] { "href" , "status" } ) == null ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
Element element = addChild ( root , "propstat" , fgNamesPropStat , false ) ; // $ NON - NLS - 1 $
try { return new PropStat ( element ) ; } catch ( MalformedElementException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
return null ; // Never reached .
}


signature:
public class ResponseBody { /** * Changes all of this response ' s propstats with the given old status
 * to have the given new status . In addition , their response
 * descriptions are changed to be the given response description or
 * removed if the given response description is < code > null < / code > . The
 * old status and new status must not be < code > null < / null > . This
 * response must not be in the " status " form .
 * @ param oldStatus the old status of the propstat ' s that are
 * changed
 * @ param newStatus the new status of the propstat ' s that are
 * changed
 * @ param responseDescription the new response description of the
 * propstat ' s that are changed , or
 * < code > null < / null > */
public void changePropStatStatus ( String oldStatus , String newStatus , String responseDescription ) { } }

implementation:
Assert . isNotNull ( oldStatus ) ; Assert . isNotNull ( newStatus ) ; Element firstHref = getFirstChild ( root , "href" ) ; // $ NON - NLS - 1 $
Assert . isTrue ( firstHref == null || getNextSibling ( firstHref , new String [ ] { "href" , "status" } ) == null ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
Element propstat = getFirstChild ( root , "propstat" ) ; // $ NON - NLS - 1 $
while ( propstat != null ) { String status = getChildText ( propstat , "status" , true ) ; // $ NON - NLS - 1 $
if ( oldStatus . equals ( status ) ) { setChild ( propstat , "status" , newStatus , PropStat . childNames , true ) ; // $ NON - NLS - 1 $
if ( responseDescription == null ) { Element responsedescription = getLastChild ( propstat , "responsedescription" ) ; // $ NON - NLS - 1 $
if ( responsedescription != null ) propstat . removeChild ( responsedescription ) ; } else setChild ( propstat , "responsedescription" , // $ NON - NLS - 1 $
responseDescription , PropStat . childNames , false ) ; } propstat = getTwin ( propstat , true ) ; }


signature:
public class ResponseBody { /** * Returns this response ' s first href .
 * @ return this response ' s first href .
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed */
public String getHref ( ) throws MalformedElementException { } }

implementation:
String href = getChildText ( root , "href" , true ) ; // $ NON - NLS - 1 $
ensureNotNull ( Policy . bind ( "ensure.missingHrefElmt" ) , href ) ; // $ NON - NLS - 1 $
return decodeHref ( href ) ;


signature:
public class ResponseBody { /** * Returns an < code > Enumeration < / code > of this response ' s hrefs ( not
 * including the first href ) .
 * @ return an < code > Enumeration < / code > of this response ' s href
 * < code > String < code > s
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed , or if
 * this response is not in " status " form */
public Enumeration getHrefs ( ) throws MalformedElementException { } }

implementation:
final Node firstHref = getFirstChild ( root , "href" ) ; // $ NON - NLS - 1 $
ensureNotNull ( Policy . bind ( "ensure.missingHrefElmt" ) , firstHref ) ; // $ NON - NLS - 1 $
ensureNotNull ( Policy . bind ( "ensure.missingStatusElmt" ) , // $ NON - NLS - 1 $
getNextSibling ( ( Element ) firstHref , "status" ) ) ; // $ NON - NLS - 1 $
Enumeration e = new Enumeration ( ) { Node currentHref = getTwin ( ( Element ) firstHref , true ) ; public boolean hasMoreElements ( ) { return currentHref != null ; } public Object nextElement ( ) { if ( ! hasMoreElements ( ) ) throw new NoSuchElementException ( ) ; String href = getFirstText ( ( Element ) currentHref ) ; currentHref = getTwin ( ( Element ) currentHref , true ) ; return decodeHref ( href ) ; } } ; return e ;


signature:
public class ResponseBody { /** * Returns an < code > Enumeration < / code > of this response ' s
 * < code > Propstat < / code > s .
 * @ return an < code > Enumeration < / code > of this response ' s
 * < code > PropStat < / code > s
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed , or if
 * this response is not in " propstat " form */
public Enumeration getPropStats ( ) throws MalformedElementException { } }

implementation:
final Element firstPropStat = getFirstChild ( root , "propstat" ) ; // $ NON - NLS - 1 $
ensureNotNull ( "ensure.missingPropstatElmt" , firstPropStat ) ; // $ NON - NLS - 1 $
Enumeration e = new Enumeration ( ) { Element currentPropStat = firstPropStat ; public boolean hasMoreElements ( ) { return currentPropStat != null ; } public Object nextElement ( ) { if ( ! hasMoreElements ( ) ) throw new NoSuchElementException ( ) ; PropStat result = null ; try { result = new PropStat ( currentPropStat ) ; } catch ( MalformedElementException ex ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
} currentPropStat = getTwin ( currentPropStat , true ) ; return result ; } } ; return e ;


signature:
public class ResponseBody { /** * Returns this response ' s status .
 * @ return this response ' s status
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed , or if
 * this response is not in " status " form */
public String getStatus ( ) throws MalformedElementException { } }

implementation:
Element status = getFirstChild ( root , "status" ) ; // $ NON - NLS - 1 $
ensureNotNull ( Policy . bind ( "ensure.missingStatusElmt" ) , status ) ; // $ NON - NLS - 1 $
return getFirstText ( status ) ;


signature:
public class ResponseBody { /** * Returns < code > true < / code > if this response is in " propstat " form and
 * < code > false < / code > if it is in " status " form .
 * @ return a boolean indicating whether this response is in " propstat "
 * or " status " form
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed */
public boolean isPropStat ( ) throws MalformedElementException { } }

implementation:
Element child = getFirstChild ( root , new String [ ] { "status" , "propstat" } ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
ensureNotNull ( Policy . bind ( "ensure.missingStatusOrPropstatElmt" ) , child ) ; // $ NON - NLS - 1 $
boolean isPropStat = isDAVElement ( child , "propstat" ) ; // $ NON - NLS - 1 $
if ( isPropStat ) child = getNextSibling ( child , "status" ) ; // $ NON - NLS - 1 $
else child = getNextSibling ( child , "propstat" ) ; // $ NON - NLS - 1 $
ensureNull ( Policy . bind ( "ensure.conflictingStatusOrPropstatElmt" ) , child ) ; // $ NON - NLS - 1 $
return isPropStat ;


signature:
public class ResponseBody { /** * Sets this response ' s response description to the given value . If the
 * value is < code > null < / code > and a response description has already
 * been set , it is removed .
 * @ param value a response description , or < code > null < / code > */
public void setResponseDescription ( Element value ) { } }

implementation:
Element child = getLastChild ( root , "responsedescription" ) ; // $ NON - NLS - 1 $
if ( child != null ) root . removeChild ( child ) ; if ( value == null ) { child = setChild ( root , "responsedescription" , childNames , false ) ; // $ NON - NLS - 1 $
child . appendChild ( value ) ; }


signature:
public class ResponseBody { /** * Sets the status on this response to the given status . The status
 * must not be < code > null < / code > . This response must not already be in
 * the " propstat " form .
 * @ param status the status for this response */
public void setStatus ( String status ) { } }

implementation:
Assert . isNotNull ( status ) ; Assert . isTrue ( getLastChild ( root , "propstat" ) == null ) ; // $ NON - NLS - 1 $
setChild ( root , "status" , status , fgNamesStatus , true ) ; // $ NON - NLS - 1 $


signature:
public class JsonObject { /** * Appends a new member to the end of this object , with the specified name and the JSON
 * representation of the specified string .
 * This method < strong > does not prevent duplicate names < / strong > . Calling this method with a name
 * that already exists in the object will append another member with the same name . In order to
 * replace existing members , use the method < code > set ( name , value ) < / code > instead . However ,
 * < strong > < em > add < / em > is much faster than < em > set < / em > < / strong > ( because it does not need to
 * search for existing members ) . Therefore < em > add < / em > should be preferred when constructing new
 * objects .
 * @ param name
 * the name of the member to add
 * @ param value
 * the value of the member to add
 * @ return the object itself , to enable method chaining */
public JsonObject add ( String name , String value ) { } }

implementation: add ( name , valueOf ( value ) ) ; return this ;


signature:
public class JsonObject { /** * Sets the value of the member with the specified name to the JSON representation of the
 * specified string . If this object does not contain a member with this name , a new member is
 * added at the end of the object . If this object contains multiple members with this name , only
 * the last one is changed .
 * This method should < strong > only be used to modify existing objects < / strong > . To fill a new
 * object with members , the method < code > add ( name , value ) < / code > should be preferred which is much
 * faster ( as it does not need to search for existing members ) .
 * @ param name
 * the name of the member to add
 * @ param value
 * the value of the member to add
 * @ return the object itself , to enable method chaining */
public JsonObject set ( String name , String value ) { } }

implementation: set ( name , valueOf ( value ) ) ; return this ;


signature:
public class BasicAuthority { /** * Returns the Basic authorization credentials for the given username and
 * password . The credentials have the following form :
 * < code >
 * credentials = " Basic " basic - credentials
 * basic - credentials = base64 - user - pass
 * base64 - user - pass = & lt ; base64 encoding of user - pass , except not
 * limited to 76 char / line & gt ;
 * user - pass = userid " : " password
 * userid = * & lt ; TEXT excluding " : " & gt ;
 * password = * TEXT
 * < / code >
 * < P > Userids might be case sensitive .
 * < P > For example , if the user ' s name is " Aladdin " and the user ' s
 * password is " open sesame " , the following credentials are supplied :
 * < code >
 * Basic QWxhZGRpbjpvcGVuIHN1c2FtZQ = =
 * < / code >
 * @ param username
 * @ param password
 * @ return the Basic authorization credentials for the given
 * username and password */
private String credentials ( String username , String password ) { } }

implementation:
Assert . isNotNull ( username ) ; Assert . isNotNull ( password ) ; String userpass = username + ":" + password ; // $ NON - NLS - 1 $
byte [ ] data = null ; try { data = userpass . getBytes ( "UTF8" ) ; // $ NON - NLS - 1 $
} catch ( UnsupportedEncodingException e ) { data = userpass . getBytes ( ) ; } return "Basic " + Base64Encoder . encode ( data ) ; // $ NON - NLS - 1 $


signature:
public class ModelElement { /** * Report a property change to registered listeners ( for example edit parts ) .
 * @ param property the programmatic name of the property that changed
 * @ param oldValue the old value of this property
 * @ param newValue the new value of this property */
protected void firePropertyChange ( String property , Object oldValue , Object newValue ) { } }

implementation: if ( pcsDelegate . hasListeners ( property ) ) { pcsDelegate . firePropertyChange ( property , oldValue , newValue ) ; }


signature:
public class DebugUtil { /** * Return the current stack frame context , or a valid stack frame for the
 * given value . */
public static IJavaStackFrame getStackFrame ( IValue value ) throws CoreException { } }

implementation: IStatusHandler handler = getStackFrameProvider ( ) ; if ( handler != null ) { IJavaStackFrame stackFrame = ( IJavaStackFrame ) handler . handleStatus ( fgNeedStackFrame , value ) ; if ( stackFrame != null ) { return stackFrame ; } } IDebugTarget target = value . getDebugTarget ( ) ; IJavaDebugTarget javaTarget = ( IJavaDebugTarget ) target . getAdapter ( IJavaDebugTarget . class ) ; if ( javaTarget != null ) { IThread [ ] threads = javaTarget . getThreads ( ) ; for ( int i = 0 ; i < threads . length ; i ++ ) { IThread thread = threads [ i ] ; if ( thread . isSuspended ( ) ) { return ( IJavaStackFrame ) thread . getTopStackFrame ( ) ; } } } return null ;


signature:
public class RuleCompletionProcessor { /** * Returns true if the first class is the same or a subtype of the second
 * class .
 * @ param class1
 * @ param class2
 * @ return */
private boolean isSubtypeOf ( String class1 , String class2 ) { } }

implementation:
if ( class1 == null || class2 == null ) { return false ; } class1 = convertToNonPrimitiveClass ( class1 ) ; class2 = convertToNonPrimitiveClass ( class2 ) ; // TODO add code to take primitive types into account
ClassTypeResolver resolver = new ClassTypeResolver ( getUniqueImports ( ) , ProjectClassLoader . getProjectClassLoader ( getEditor ( ) ) ) ; try { Class < ? > clazz1 = resolver . resolveType ( class1 ) ; Class < ? > clazz2 = resolver . resolveType ( class2 ) ; if ( clazz1 == null || clazz2 == null ) { return false ; } return clazz2 . isAssignableFrom ( clazz1 ) ; } catch ( ClassNotFoundException exc ) { return false ; }


signature:
public class RuleCompletionProcessor { /** * Completions for object instance members */
private Collection < ICompletionProposal > getMvelInstanceCompletionsFromJDT ( final int documentOffset , final String prefix , Map < String , String > params , Class < ? > lastType , boolean settersOnly ) { } }

implementation:
if ( lastType == null ) { lastType = Object . class ; } // FIXME : there is a small chance of var name collision using this arbitrary mvdrlofc as a variable name .
// ideally the variable name should be inferred from the last member of the expression
final String syntheticVarName = "mvdrlofc" ; String javaText = "\n" + lastType . getPackage ( ) . getName ( ) + "." + CompletionUtil . getSimpleClassName ( lastType ) + " " + syntheticVarName + ";\n" + syntheticVarName + "." ; final List < ICompletionProposal > list1 = new ArrayList < ICompletionProposal > ( ) ; requestJavaCompletionProposals ( javaText , prefix , documentOffset , params , list1 ) ; final List < ICompletionProposal > list = list1 ; Collection < ICompletionProposal > mvelList = RuleCompletionProcessor . mvelifyProposals ( list , settersOnly ) ; return mvelList ;


signature:
public class RuleCompletionProcessor { /** * Completions for static Class members */
private Collection < ICompletionProposal > getMvelClassCompletionsFromJDT ( final int documentOffset , final String prefix , Map < String , String > params , Class < ? > lastType ) { } }

implementation:
if ( lastType == null ) { lastType = Object . class ; } // FIXME : there is a small chance of var name collision using this arbitrary mvdrlofc as a variable name .
// ideally the variable name should be inferred from the last member of the expression
String javaText = "\n" + CompletionUtil . getSimpleClassName ( lastType ) + "." ; final List < ICompletionProposal > list1 = new ArrayList < ICompletionProposal > ( ) ; requestJavaCompletionProposals ( javaText , prefix , documentOffset , params , list1 ) ; final List < ICompletionProposal > list = list1 ; Collection < ICompletionProposal > mvelList = RuleCompletionProcessor . mvelifyProposals ( list , false ) ; return mvelList ;


signature:
public class RuleCompletionProcessor { /** * Attempt to compare proposals of different types based on the tokenized display string
 * @ param proposals
 * @ param newProposal
 * @ return true if the collection contains a proposal which matches the new Proposal .
 * The match is based on the first token based on a space split */
public static boolean containsProposal ( final Collection < ICompletionProposal > proposals , String newProposal ) { } }

implementation: for ( ICompletionProposal prop : proposals ) { String displayString = prop . getDisplayString ( ) ; String [ ] existings = displayString . split ( " " ) ; if ( existings . length == 0 ) { continue ; } String [ ] newProposals = newProposal . split ( " " ) ; if ( newProposals . length == 0 ) { continue ; } if ( existings [ 0 ] . equals ( newProposals [ 0 ] ) ) { return true ; } } return false ;


signature:
public class RuleCompletionProcessor { /** * Filters accessor method proposals to replace them with their mvel expression equivalent
 * For instance a completion for getStatus ( ) would be replaced by a completion for status
 * when asking for stters only , then only setters or writable fields will be returned */
public static Collection < ICompletionProposal > mvelifyProposals ( List < ICompletionProposal > list , boolean settersOnly ) { } }

implementation:
final Collection < ICompletionProposal > set = new HashSet < ICompletionProposal > ( ) ; for ( ICompletionProposal o : list ) { if ( o instanceof JavaMethodCompletionProposal ) { // methods
processJavaMethodCompletionProposal ( list , settersOnly , set , o ) ; } else if ( o instanceof JavaCompletionProposal ) { // fields
processesJavaCompletionProposal ( settersOnly , set , o ) ; } else if ( ! settersOnly ) { set . add ( o ) ; } } return set ;


signature:
public class ElementEditor { /** * Creates a WebDAV element with the given name and appends it as a
 * child of the given parent . Returns the child element . The parent must
 * not be < code > null < / code > and must be a WebDAV element . The name of
 * the child must not be < code > null < / code > .
 * @ param parent the parent element to which the child is added
 * @ param name the name of the child element that is created and added
 * as a child of the parent
 * @ return the child element that is created */
public static Element appendChild ( Element parent , String name ) { } }

implementation:
Assert . isTrue ( isDAVElement ( parent ) ) ; Assert . isNotNull ( name ) ; String nsPrefix = getNSPrefix ( parent ) ; String tagName = nsPrefix == null ? name : nsPrefix + ":" + name ; // $ NON - NLS - 1 $
Element child = parent . getOwnerDocument ( ) . createElement ( tagName ) ; parent . appendChild ( child ) ; return child ;


signature:
public class ElementEditor { /** * Creates a WebDAV element with the given name and appends it as a
 * child of the given parent . In addition , a text node created from the
 * given data is created and appended to the child . Returns the child
 * element . The parent must not be < code > null < / code > and must be a
 * WebDAV element . The name of the child must not be < code > null < / code > .
 * The data must not be < code > null < / code > .
 * @ param parent the parent element to which the child is added
 * @ param name the name of the child element that is created and added
 * as a child of the parent
 * @ param data the data of the text node which is created and added to
 * the child
 * @ return the child element that is created */
public static Element appendChild ( Element parent , String name , String data ) { } }

implementation: Assert . isTrue ( isDAVElement ( parent ) ) ; Assert . isNotNull ( name ) ; Assert . isNotNull ( data ) ; Element child = appendChild ( parent , name ) ; child . appendChild ( child . getOwnerDocument ( ) . createTextNode ( data ) ) ; return child ;


signature:
public class ElementEditor { /** * Returns a clone of the given node . The given document becomes the
 * owner document of the clone .
 * @ param document the owner document of the clone
 * @ param node the node to clone
 * @ return a clone of the given node */
public static Node cloneNode ( Document document , Node node ) { } }

implementation:
Node nodeClone = null ; switch ( node . getNodeType ( ) ) { case Node . ELEMENT_NODE : { nodeClone = document . createElement ( ( ( Element ) node ) . getTagName ( ) ) ; NamedNodeMap namedNodeMap = node . getAttributes ( ) ; for ( int i = 0 ; i < namedNodeMap . getLength ( ) ; ++ i ) { Attr attr = ( Attr ) namedNodeMap . item ( i ) ; Attr attrClone = document . createAttribute ( attr . getName ( ) ) ; attrClone . setValue ( attr . getValue ( ) ) ; ( ( Element ) nodeClone ) . setAttributeNode ( attrClone ) ; } } break ; case Node . TEXT_NODE : nodeClone = document . createTextNode ( ( ( CharacterData ) node ) . getData ( ) ) ; break ; case Node . CDATA_SECTION_NODE : nodeClone = document . createCDATASection ( ( ( CharacterData ) node ) . getData ( ) ) ; break ; case Node . ENTITY_REFERENCE_NODE : nodeClone = document . createEntityReference ( node . getNodeName ( ) ) ; break ; case Node . PROCESSING_INSTRUCTION_NODE : nodeClone = document . createProcessingInstruction ( ( ( ProcessingInstruction ) node ) . getTarget ( ) , ( ( ProcessingInstruction ) node ) . getData ( ) ) ; break ; case Node . COMMENT_NODE : nodeClone = document . createComment ( ( ( CharacterData ) node ) . getData ( ) ) ; break ; case Node . DOCUMENT_FRAGMENT_NODE : nodeClone = document . createDocumentFragment ( ) ; break ; case Node . DOCUMENT_NODE : case Node . DOCUMENT_TYPE_NODE : case Node . NOTATION_NODE : case Node . ATTRIBUTE_NODE : case Node . ENTITY_NODE : Assert . isTrue ( false , Policy . bind ( "assert.notSupported" ) ) ; // $ NON - NLS - 1 $
break ; default : Assert . isTrue ( false , Policy . bind ( "assert.unknownNodeType" ) ) ; // $ NON - NLS - 1 $
} return nodeClone ;


signature:
public class ElementEditor { /** * Creates a WebDAV element with the given name and adds it as the root
 * of the given document . In addition , the WebDAV namespace is declared
 * on the new element . Returns the new element . The document must not be
 * < code > null < / code > and must not already have a root element . The name
 * of the element to be created must not be < code > null < / code > .
 * @ param document the document in which the new element is rooted
 * @ param name the name of the element to be created
 * @ return the rooted element */
public static Element create ( Document document , String name ) { } }

implementation: Assert . isNotNull ( document ) ; Assert . isTrue ( document . getDocumentElement ( ) == null ) ; Assert . isNotNull ( name ) ; Element element = document . createElement ( name ) ; declareNS ( element , null , DAV_NS ) ; document . appendChild ( element ) ; return element ;


signature:
public class ElementEditor { /** * Adds a namespace declaration to the given element . If only the prefix
 * is < code > null < / code > , a default namespace is declared . If the prefix
 * and the namespaceUrl are < code > null < / code > the default namespace is
 * removed . The element must not be < code > null < / code > . If the
 * namespaceUrl is < code > null < / code > , the < code > prefix < / code > must also
 * be < code > null < / code > .
 * @ param element the element to receive the namespace attribute
 * @ param prefix the prefix to be used ( without a colon ) ; for
 * example , " D " , or < code > null < / code >
 * @ param namespaceUrl the URL of the namespace ; for example , " DAV : " , or
 * < code > null < / code > */
public static void declareNS ( Element element , String prefix , String namespaceUrl ) { } }

implementation:
Assert . isNotNull ( element ) ; Assert . isTrue ( namespaceUrl != null || prefix == null && namespaceUrl == null ) ; String name = XML_PREFIX + ( prefix == null ? "" : ":" + prefix ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
String value = namespaceUrl == null ? "" : namespaceUrl ; // $ NON - NLS - 1 $
element . setAttribute ( name , value ) ;


signature:
public class ElementEditor { /** * Ensures that the given node is a WebDAV element with the given name ,
 * returning it as an < code > Element < / code > if it is .
 * @ param message the message for the exception that is thrown if the
 * node is not a WebDAV element with the given name
 * @ param node the node , or < code > null < / code >
 * @ param name the expected local name of the WebDAV element
 * @ returns the node as an < code > Element < / code >
 * @ throws MalformedElementException with the given message if it
 * is not a WebDAV element with the given name
 * @ deprecated */
protected static Element ensureDAVElement ( String message , Node node , String name ) throws MalformedElementException { } }

implementation: Assert . isNotNull ( name ) ; if ( node == null || node . getNodeType ( ) != Node . ELEMENT_NODE ) throw new MalformedElementException ( message ) ; Element element = ( Element ) node ; if ( ! name . equals ( getNSLocalName ( element ) ) || ! DAV_NS . equals ( getNSName ( element ) ) ) throw new MalformedElementException ( message ) ; return element ;


signature:
public class ElementEditor { /** * Ensures that the given object is not < code > null < / code > .
 * @ param message the message for the exception that is thrown if the
 * object is < code > null < / code >
 * @ param object the object , or < code > null < / code >
 * @ throws MalformedElementException if the given object is
 * < code > null < / code > */
protected static void ensureNotNull ( String message , Object object ) throws MalformedElementException { } }

implementation: if ( object == null ) throw new MalformedElementException ( message ) ;


signature:
public class ElementEditor { /** * Ensures that the given object is < code > null < / code > .
 * @ param message the message for the exception that is thrown if the
 * object is not < code > null < / code >
 * @ param object the object , or < code > null < / code >
 * @ throws MalformedElementException if the given object is not
 * < code > null < / code > */
protected static void ensureNull ( String message , Object object ) throws MalformedElementException { } }

implementation: if ( object != null ) throw new MalformedElementException ( message ) ;


signature:
public class ElementEditor { /** * Ensures that the given node is a text node , returning it as a
 * < code > Text < / code > node if it is .
 * @ param message the message for the exception that is thrown if the
 * node is not a < code > Text < / code > node
 * @ param node the node , or < code > null < / code >
 * @ returns the node as a < code > Text < / code > node
 * @ exception MalformedElementException if the node is
 * < code > null < / code > or not a text node */
protected static Text ensureText ( String message , Node node ) throws MalformedElementException { } }

implementation: if ( node == null || node . getNodeType ( ) != Node . TEXT_NODE ) throw new MalformedElementException ( message ) ; return ( Text ) node ;


signature:
public class ElementEditor { /** * Clones the given element , and its subtrees , and sets it as the root
 * of the given document . Returns the cloned element . The document must
 * not have a root and must not be < code > null < / code > . The element must
 * not be < code > null < / code > .
 * @ param document the document that will become the owner and parent
 * of the cloned element
 * @ param element the element to be cloned
 * @ returns a clone of the element
 * @ throws MalformedElementException if an element exists in the
 * subtree to be cloned whose namespace can ' t be
 * resolved */
public static Element extractElement ( Document document , Element element ) throws MalformedElementException { } }

implementation: Assert . isNotNull ( document ) ; Assert . isTrue ( document . getDocumentElement ( ) == null ) ; Assert . isNotNull ( element ) ; return ( Element ) extractNode ( document , element ) ;


signature:
public class ElementEditor { /** * Clones the given node , and its subtrees , and sets it as the root of
 * the given parent node . Returns the cloned node . The parent node and
 * the node to be cloned must not be < code > null < / code > .
 * @ param parent the node that will become the parent of the cloned
 * node
 * @ param node the node to be cloned
 * @ returns a clone of the element
 * @ throws MalformedElementException if an element exists in the
 * subtree to be cloned whose namespace can ' t be resolved */
public static Node extractNode ( Node parent , Node node ) throws MalformedElementException { } }

implementation:
// Get a handle to the root of the parent node tree .
Document document ; if ( parent . getNodeType ( ) == Node . DOCUMENT_NODE ) document = ( Document ) parent ; else document = parent . getOwnerDocument ( ) ; // Create a clone of the node owned by the document , and add to the parent .
Node nodeClone = cloneNode ( document , node ) ; parent . appendChild ( nodeClone ) ; // If the node is an Element
if ( node . getNodeType ( ) == Node . ELEMENT_NODE ) { // Figure out its namespace information .
String nsPrefix = getNSPrefix ( ( Element ) node ) ; String nsName = getNSName ( ( Element ) node ) ; // Is this namespace already defined on the clone ? If not declare it .
String nsNameClone = resolve ( nsPrefix , ( Element ) nodeClone ) ; if ( nsName != nsNameClone && ( nsName == null || ! nsName . equals ( nsNameClone ) ) ) declareNS ( ( Element ) nodeClone , nsPrefix , nsName ) ; // Do the same namespace fix - up for each of the node ' s attributes .
NamedNodeMap nodeMap = nodeClone . getAttributes ( ) ; for ( int i = 0 ; i < nodeMap . getLength ( ) ; ++ i ) { Attr attr = ( Attr ) nodeMap . item ( i ) ; nsPrefix = getNSPrefix ( attr . getName ( ) ) ; if ( nsPrefix != null && ! nsPrefix . equals ( XML_PREFIX ) ) { nsName = resolve ( nsPrefix , ( Element ) node ) ; nsNameClone = resolve ( nsPrefix , ( Element ) nodeClone ) ; if ( nsName != nsNameClone && ( nsName == null || ! nsName . equals ( nsNameClone ) ) ) declareNS ( ( Element ) nodeClone , nsPrefix , nsName ) ; } } } // Recursively clone each of the node ' s children .
Node child = node . getFirstChild ( ) ; while ( child != null ) { extractNode ( nodeClone , child ) ; child = child . getNextSibling ( ) ; } // Finished cloning this node .
return nodeClone ;


signature:
public class ElementEditor { /** * Returns the first child of the given parent that is a WebDAV element
 * with one of the given names , or < code > null < / code > if no such child
 * exists .
 * If firstToLast is true , the search for the child starts at the parent ' s
 * first child , otherwise , the search starts at the parent ' s last child .
 * The parent must not be < code > null < / code > and must be a WebDAV element .
 * The names of children to search for must not be < code > null < / code > . < / p >
 * @ param parent the parent of the child to search .
 * @ param names all possible names of the child to search for .
 * @ param firstToLast a boolean specifying the direction to search for
 * the child among the parent ' s children .
 * @ return the specified child of the parent , or
 * < code > null < code > if no such child exists . */
private static Element getChild ( Element parent , String [ ] names , boolean firstToLast ) { } }

implementation:
Assert . isTrue ( isDAVElement ( parent ) ) ; Assert . isNotNull ( names ) ; // Get the first candidate .
Node child = null ; if ( firstToLast ) child = parent . getFirstChild ( ) ; else child = parent . getLastChild ( ) ; // While there are children left to consider .
while ( child != null ) { // See if the child name matches any being sought .
for ( int i = 0 ; i < names . length ; ++ i ) if ( isDAVElement ( child , names [ i ] ) ) return ( Element ) child ; // Try the next child .
if ( firstToLast ) child = child . getNextSibling ( ) ; else child = child . getPreviousSibling ( ) ; } // A matching child was not found .
return null ;


signature:
public class ElementEditor { /** * < p > Returns the child WebDAV element of the given parent that is
 * nearest in position to a WebDAV element with the given name , or
 * < code > null < / code > if no such child exists .
 * < p > Children are expected to be in the order specified by the given
 * names . If firstToLast is true , the search for the child starts at the
 * parent ' s first child , otherwise , the search starts at the parent ' s
 * last child .
 * < p > The parent must not be < code > null < / code > and must be a WebDAV
 * element . The name of the child to search for must not be
 * < code > null < / code > . The parent ' s valid child names must not be
 * < code > null < / code > , and must contain the name of the child being
 * searched for .
 * < p > The returned child is as follows :
 * < ul >
 * < li > Searching first to last < / li >
 * < ul >
 * < li > returns < code > null < / code > if an element with the given name
 * should appear as the last child < / li >
 * < li > returns the first occurring child if an element with the given
 * name is a child < / li >
 * < li > returns a child if an element with the given name would appear
 * before it < / li >
 * < / ul >
 * < li > Searching last to first < / li >
 * < ul >
 * < li > returns < code > null < / code > if an element with the given name
 * would appear as the first child < / li >
 * < li > returns the last occurring child if an element with the given
 * name is a child < / li >
 * < li > returns a child if an element with the given name would appear
 * after it < / li >
 * < / ul >
 * < / ul >
 * @ param parent the parent of the child being searched for
 * @ param name the name of the child being searched for
 * @ param names the ordered collection of valid child names for
 * the parent
 * @ param firstToLast a boolean specifying the direction to search for
 * the specified child among the parent ' s children
 * @ return a child of the parent , or < code > null < / code > */
public static Element getChild ( Element parent , String name , String [ ] names , boolean firstToLast ) { } }

implementation: Assert . isNotNull ( parent ) ; Assert . isNotNull ( name ) ; Assert . isNotNull ( names ) ; boolean found = false ; for ( int i = 0 ; ! found && i < names . length ; ++ i ) { found = names [ i ] . equals ( name ) ; } Assert . isTrue ( found ) ; int i ; Node child = null ; if ( firstToLast ) { i = 0 ; child = parent . getFirstChild ( ) ; } else { i = names . length - 1 ; child = parent . getLastChild ( ) ; } while ( child != null && ! names [ i ] . equals ( name ) ) { int mark = i ; while ( ! isDAVElement ( child , names [ i ] ) && ! names [ i ] . equals ( name ) ) { if ( firstToLast ) { ++ i ; } else { -- i ; } } if ( ! names [ i ] . equals ( name ) ) { if ( firstToLast ) { child = child . getNextSibling ( ) ; } else { child = child . getPreviousSibling ( ) ; } } else if ( ! isDAVElement ( child , names [ i ] ) ) { int pos = i ; found = false ; while ( ! found && ( pos >= 0 && pos < names . length ) ) { found = isDAVElement ( child , names [ pos ] ) ; if ( firstToLast ) { ++ pos ; } else { -- pos ; } } if ( ! found ) { i = mark ; if ( firstToLast ) { child = child . getNextSibling ( ) ; } else { child = child . getPreviousSibling ( ) ; } } } } return ( Element ) child ;


signature:
public class ElementEditor { /** * Returns the first child element of the given parent element , or
 * < code > null < / code > if no such child exists . If firstToLast is true ,
 * the search for the child starts at the parent ' s first child ,
 * otherwise , the search starts at the parent ' s last child . The parent
 * must not be < code > null < / code > .
 * @ param parent the parent of the child element to search for
 * @ param firstToLast a boolean specifying the direction to search for
 * the child element among the parent ' s children
 * @ return the child element , or < code > null < / code > if no such
 * child exists */
public static Element getChildElement ( Element parent , boolean firstToLast ) { } }

implementation: Assert . isNotNull ( parent ) ; Node child = null ; if ( firstToLast ) child = parent . getFirstChild ( ) ; else child = parent . getLastChild ( ) ; while ( child != null && ! isElement ( child ) ) { if ( firstToLast ) child = child . getNextSibling ( ) ; else child = child . getPreviousSibling ( ) ; } return ( Element ) child ;


signature:
public class ElementEditor { /** * Returns the data of the first child text node of the first WebDAV
 * child with the given name of the given parent , or the empty
 * < code > String < / code > if no such child text node exists , or
 * < code > null < / code > if no such child exists . If firstToLast is true , the
 * search for the child starts at the parent ' s first child , otherwise ,
 * the search starts at the parent ' s last child . The parent must not be
 * < code > null < / code > and must be a WebDAV element . The name of the child
 * must not be < code > null < / code > .
 * @ param parent the parent of the child with the child text node
 * to search for
 * @ param name the name of the child with the child text node to
 * search for
 * @ param firstToLast a boolean specifying the direction to search for
 * the specified child among the parent ' s children
 * @ return the data of the child ' s child text node , or the
 * empty < code > String < / code > if no such child exists ,
 * or < code > null < / code > if no such child exists */
public static String getChildText ( Element parent , String name , boolean firstToLast ) { } }

implementation: Assert . isTrue ( isDAVElement ( parent ) ) ; Assert . isNotNull ( name ) ; Element child ; if ( firstToLast ) child = getFirstChild ( parent , name ) ; else child = getLastChild ( parent , name ) ; if ( child != null ) return getText ( child , firstToLast ) ; return null ;