idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
18,000
public static void scan ( final Class < ? extends Annotation > clas , final String [ ] basePackage , final AnnotationHandler handler ) { final ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider ( false ) ; scanner . setResourceLoader ( new PathMatchingResourcePatternRe...
Utility method to scan the given package and handler for the annotation of the given class . Its uses the Spring annotation detector
18,001
public static List < String > scanAsList ( final Class < ? extends Annotation > clas , final String ... basePackage ) { final List < String > classes = new ArrayList < > ( ) ; scan ( clas , basePackage , new AnnotationHandler ( ) { public void handleAnnotationFound ( String className ) { classes . add ( className ) ; }...
Scan as list .
18,002
public void refreshGuiAndShowFile ( File file ) { if ( rootNode . getChildCount ( ) > 0 ) { rootNode . removeAllChildren ( ) ; treeModel . reload ( ) ; } if ( guiMain . getAsmProjectUml ( ) . getProjectUml ( ) != null ) { addTreeNodes ( file ) ; guiMain . getMenuMain ( ) . setVisibleProjectMenu ( true ) ; } else { guiM...
refresh tree and expand to file that usually newly created
18,003
public static String buildToString ( Object ... params ) { StringBuffer finalMessage = new StringBuffer ( ) ; int i = 0 ; for ( Object object : params ) { if ( i ++ > 0 ) { finalMessage . append ( FIELD_SEPARATOR ) ; } if ( object instanceof List < ? > ) { finalMessage . append ( JKCollectionUtil . toString ( ( List < ...
Builds the to string .
18,004
public static Map toMap ( Object [ ] keys , Object [ ] values ) { Map map = new HashMap < > ( ) ; int i = 0 ; for ( Object key : keys ) { map . put ( key , values [ i ++ ] ) ; } return map ; }
To map .
18,005
public static void validateNull ( String name , Object object ) { if ( object == null ) { throw new IllegalStateException ( name . concat ( " cannot be null" ) ) ; } }
Validate null .
18,006
public static void addToSystemConfig ( String prefix , Properties prop ) { for ( Entry < Object , Object > entry : prop . entrySet ( ) ) { String key = prefix . concat ( entry . getKey ( ) . toString ( ) ) ; String value = entry . getValue ( ) . toString ( ) ; System . setProperty ( key , value ) ; } }
Adds the to system config .
18,007
public static char [ ] readPassword ( String msg ) { Console console = System . console ( ) ; if ( console != null ) { return console . readPassword ( ) ; } scanner = getScanner ( ) ; System . out . print ( msg ) ; return scanner . nextLine ( ) . toCharArray ( ) ; }
Read password .
18,008
public static void printOnce ( Object msg ) { if ( messagesCache . get ( msg . hashCode ( ) ) == null ) { JK . printBlock ( msg ) ; messagesCache . put ( msg . hashCode ( ) , msg ) ; } }
Print the message and then save it into list to avoid reporing it again it can be helpfull to debugging purposes .
18,009
public static String getAppName ( ) { String appName = System . getProperty ( JKContextConstants . JK_APP_NAME ) ; if ( appName == null ) { String mainClassName = JKDebugUtil . getMainClassName ( ) ; return mainClassName . substring ( 0 , mainClassName . lastIndexOf ( "." ) ) ; } return appName ; }
Gets the app name .
18,010
public static void dumpBeansNames ( ) { DefaultListableBeanFactory f = ( DefaultListableBeanFactory ) context . getBeanFactory ( ) ; String [ ] beanDefinitionNames = f . getBeanDefinitionNames ( ) ; for ( String name : beanDefinitionNames ) { JK . print ( name , " for class :" , f . getBean ( name ) . getClass ( ) . ge...
Dump beans names .
18,011
protected static Configuration getConfig ( String path ) { if ( cfg == null ) { cfg = new Configuration ( ) ; cfg . setClassForTemplateLoading ( TemplateUtil . class , path == null ? "/templates" : path ) ; cfg . setLocale ( Locale . US ) ; cfg . setTemplateExceptionHandler ( TemplateExceptionHandler . RETHROW_HANDLER ...
Gets the config .
18,012
protected void handleClient ( final Socket client ) throws IOException { final ClientHandler handler = new ClientHandler ( client ) ; this . executorService . execute ( handler ) ; }
Handle client request this method will be called when new client connection received by the start method .
18,013
public synchronized void stop ( ) throws IOException { this . stopped = true ; if ( this . server != null && this . waitingClient ) { this . server . close ( ) ; this . server = null ; } }
Stop the server instance by setting the stopped flag to true the close the server instance if open .
18,014
private void resetConfigToDefault ( ) { isUseWebservice = true ; isUpdateAutomatic = true ; isUseExternalMonomers = false ; isUseExternalNucleotides = false ; setUseExternalAttachments ( false ) ; webserviceMonomersURL = "http://localhost:8080/HELM2MonomerService/rest" ; webserviceMonomersPath = "monomer/" ; webservice...
Resets the configuration to default values .
18,015
public void refresh ( ) { File configFile = new File ( CONFIG_FILE_PATH ) ; if ( ! configFile . exists ( ) ) { BufferedWriter writer = null ; BufferedReader reader = null ; try { configFile . createNewFile ( ) ; InputStream in = Chemistry . class . getResourceAsStream ( "/org/helm/notation2/resources/MonomerStoreConfig...
Refreshes the configuration using the local properties file .
18,016
private static void addEntry ( final ArrayList < String > aStringArray ) { try { final MagicMimeEntry magicEntry = new MagicMimeEntry ( aStringArray ) ; mMagicMimeEntries . add ( magicEntry ) ; } catch ( final InvalidMagicMimeEntryException e ) { } }
Adds the entry .
18,017
private static String getMagicMimeType ( final byte [ ] bytes ) throws IOException { final int len = mMagicMimeEntries . size ( ) ; for ( int i = 0 ; i < len ; i ++ ) { final MagicMimeEntry me = mMagicMimeEntries . get ( i ) ; final String mtype = me . getMatch ( bytes ) ; if ( mtype != null ) { return mtype ; } } retu...
Gets the magic mime type .
18,018
public static String getMimeType ( final byte [ ] data ) { String mimeType = null ; try { mimeType = MimeUtil . getMagicMimeType ( data ) ; } catch ( final Exception e ) { } finally { if ( mimeType == null ) { mimeType = UNKNOWN_MIME_TYPE ; } } return mimeType ; }
Gets the mime type .
18,019
private static void parse ( final Reader r ) throws IOException { final BufferedReader br = new BufferedReader ( r ) ; String line ; final ArrayList < String > sequence = new ArrayList < String > ( ) ; line = br . readLine ( ) ; while ( true ) { if ( line == null ) { break ; } line = line . trim ( ) ; if ( line . lengt...
Parse the magic . mime file
18,020
public static JKContext getCurrentContext ( ) { JKContext context = ( JKContext ) JKThreadLocal . getValue ( JKContextConstants . JK_CONTEXT ) ; if ( context == null ) { context = getInstance ( ) . createDesktopContext ( ) ; JKThreadLocal . setValue ( JKContextConstants . JK_CONTEXT , context ) ; } return context ; }
Gets the current context .
18,021
public static byte [ ] generateImageHELMMolecule ( HELM2Notation helm2notation ) throws BuilderMoleculeException , CTKException , IOException , ChemistryException { LOG . info ( "Image generation process of HELM molecule starts" ) ; String smiles = SMILES . getSMILESForAll ( helm2notation ) ; LOG . info ( "Get for the ...
method to generate an image of the HELM molecule
18,022
public static List < String > getAminoAcidList ( String peptideSequence ) throws MonomerException , NotationException , MonomerLoadingException , ChemistryException { if ( null == peptideSequence ) { throw new NotationException ( "Peptide Sequence must be specified" ) ; } String cleanSeq = cleanup ( peptideSequence ) ;...
This method converts peptide sequence into a List of amino acid
18,023
public static List < String > getAminoAcidList ( String peptideSequence , String delimiter ) throws MonomerException , NotationException , MonomerLoadingException , ChemistryException { if ( null == peptideSequence ) { throw new NotationException ( "Peptide Sequence must be specified" ) ; } if ( null == delimiter || de...
This method converts peptide sequence into a List of amino acid with optional delimiter
18,024
public static String cleanup ( String sequence ) { String result = sequence . replaceAll ( "\\s" , "" ) ; if ( result . equals ( result . toLowerCase ( ) ) ) { result = result . toUpperCase ( ) ; } return result ; }
remove white space and convert all lower case to upper case
18,025
public static void downloadFile ( final String fileUrl , final String localFile ) throws IOException { final URL url = new URL ( fileUrl ) ; final HttpURLConnection connection = ( HttpURLConnection ) url . openConnection ( ) ; final byte [ ] data = JKIOUtil . readStream ( connection . getInputStream ( ) ) ; JKIOUtil . ...
Download file .
18,026
public static File downloadFileToTemp ( final String fileUrl , final String ext ) throws IOException { final File file = File . createTempFile ( "jk-" , ext ) ; JKHttpUtil . downloadFile ( fileUrl , file . getAbsolutePath ( ) ) ; return file ; }
Download file to temp .
18,027
public static String requestUrl ( final String url , final String method , final Properties header , final String body ) { try { final URL siteUrl = new URL ( url ) ; final HttpURLConnection connection = ( HttpURLConnection ) siteUrl . openConnection ( ) ; connection . setRequestMethod ( method ) ; final Enumeration < ...
Send http request .
18,028
public static String getUrlContents ( String urlString ) { HttpURLConnection con = null ; try { URL url = new URL ( urlString ) ; con = ( HttpURLConnection ) url . openConnection ( ) ; con . connect ( ) ; InputStream inputStream = con . getInputStream ( ) ; BufferedReader reader = new BufferedReader ( new InputStreamRe...
Gets the url contents .
18,029
public static String getValueFromUrl ( String url , String preText , int length ) { String urlContents = getUrlContents ( url ) ; int indexOf = urlContents . indexOf ( preText ) ; if ( indexOf != - 1 ) { indexOf += preText . length ( ) ; String substring = urlContents . substring ( indexOf , indexOf + length ) ; return...
Gets the value from url based on pre - text value from the response .
18,030
public static InputStream getUrlInputStream ( String urlString ) { URL url ; try { url = new URL ( urlString ) ; HttpURLConnection con = ( HttpURLConnection ) url . openConnection ( ) ; con . connect ( ) ; return con . getInputStream ( ) ; } catch ( Exception e ) { throw new JKException ( e ) ; } }
Gets the url input stream .
18,031
public static < T > T readUrlAsObject ( String url , Class < T > type ) { String contents = getUrlContents ( url ) ; ObjectMapper mapper = new ObjectMapper ( ) ; mapper . enableDefaultTyping ( ) ; try { return mapper . readValue ( contents , type ) ; } catch ( IOException e ) { JK . throww ( e ) ; return null ; } }
Read the given url contents and try to create an object from the given type .
18,032
public static Password createPassword ( char [ ] password ) { byte [ ] salt = JKSecurityUtil . salt ( ) ; byte [ ] hash = JKSecurityUtil . hash ( password , salt ) ; Password pass = new Password ( ) ; pass . setHash ( encodeInToBase64 ( hash ) ) ; pass . setSalt ( encodeInToBase64 ( salt ) ) ; return pass ; }
Encrypt password .
18,033
public Class < ? > getJavaType ( ) { if ( javaType == null ) { javaType = JKTypeMapping . getType ( getCode ( ) ) . getClass ( ) ; if ( javaType == null ) { JK . error ( "JKType cannot by null, and code not avaiable %s" , code ) ; } } return javaType ; }
Gets the java type .
18,034
public String getName ( ) { if ( name == null ) { name = JKMessage . get ( getJavaType ( ) . getSimpleName ( ) ) ; } return name ; }
Gets the name .
18,035
public JKTimeObject toTimeObject ( Date date , Date time ) { JKTimeObject fsTimeObject = new JKTimeObject ( ) ; Calendar timeInstance = Calendar . getInstance ( ) ; timeInstance . setTimeInMillis ( time . getTime ( ) ) ; fsTimeObject . setHour ( timeInstance . get ( Calendar . HOUR_OF_DAY ) ) ; fsTimeObject . setMunite...
To time object .
18,036
public static RgroupStructure buildMoleculefromSinglePolymer ( final PolymerNotation polymernotation ) throws BuilderMoleculeException , HELM2HandledException , ChemistryException { LOG . info ( "Build molecule for single Polymer " + polymernotation . getPolymerID ( ) . getId ( ) ) ; if ( polymernotation . getPolymerID...
method to build a molecule for a single polymer
18,037
private static RgroupStructure buildMoleculefromCHEM ( final String id , final List < Monomer > validMonomers ) throws BuilderMoleculeException , ChemistryException { LOG . info ( "Build molecule for chemical component" ) ; if ( validMonomers . size ( ) == 1 ) { try { Monomer monomer = validMonomers . get ( 0 ) ; Strin...
method to build a molecule from a chemical component
18,038
private static AttachmentList generateAttachmentList ( final List < Attachment > listAttachments ) { AttachmentList list = new AttachmentList ( ) ; for ( Attachment attachment : listAttachments ) { list . add ( new org . helm . chemtoolkit . Attachment ( attachment . getAlternateId ( ) , attachment . getLabel ( ) , att...
method to generate the AttachmentList given a list of attachments
18,039
public static AbstractMolecule mergeRgroups ( AbstractMolecule molecule ) throws BuilderMoleculeException , ChemistryException { try { boolean flag = true ; for ( int i = molecule . getAttachments ( ) . size ( ) - 1 ; i > - 1 ; i -- ) { org . helm . chemtoolkit . Attachment attachment = molecule . getAttachments ( ) . ...
method to merge all unused rgroups into a molecule
18,040
public static AbstractMolecule getMoleculeForMonomer ( final Monomer monomer ) throws BuilderMoleculeException , ChemistryException { String input = getInput ( monomer ) ; if ( input != null ) { List < Attachment > listAttachments = monomer . getAttachmentList ( ) ; AttachmentList list = new AttachmentList ( ) ; for ( ...
method to build a molecule for a given monomer
18,041
void addEntry ( final String aLine ) { final String trimmed = aLine . replaceAll ( "^>*" , "" ) ; String [ ] tokens = trimmed . split ( "\t" ) ; final Vector < String > v = new Vector < String > ( ) ; for ( int i = 0 ; i < tokens . length ; i ++ ) { if ( ! "" . equals ( tokens [ i ] ) ) { v . add ( tokens [ i ] ) ; } }...
as much of the file as possible . Currently about 70 entries are incorrect
18,042
public String getMatch ( final byte [ ] content ) throws IOException { final ByteBuffer buf = readBuffer ( content ) ; if ( buf == null ) { return null ; } buf . position ( 0 ) ; final boolean matches = match ( buf ) ; if ( matches ) { final int subLen = this . subEntries . size ( ) ; final String myMimeType = getMimeT...
Gets the match .
18,043
private int howManyGreaterThans ( final String aLine ) { if ( aLine == null ) { return - 1 ; } int i = 0 ; final int len = aLine . length ( ) ; while ( i < len ) { if ( aLine . charAt ( i ) == '>' ) { i ++ ; } else { break ; } } return i ; }
How many greater thans .
18,044
private boolean matchByte ( final ByteBuffer bbuf ) throws IOException { final byte b = bbuf . get ( 0 ) ; return b == getContent ( ) . charAt ( 0 ) ; }
Match byte .
18,045
private boolean matchLong ( final ByteBuffer bbuf , final ByteOrder bo , final boolean needMask , final long lMask ) throws IOException { bbuf . order ( bo ) ; long got ; final String testContent = getContent ( ) ; if ( testContent . startsWith ( "0x" ) ) { got = Long . parseLong ( testContent . substring ( 2 ) , 16 ) ...
Match long .
18,046
private boolean matchShort ( final ByteBuffer bbuf , final ByteOrder bo , final boolean needMask , final short sMask ) throws IOException { bbuf . order ( bo ) ; short got ; final String testContent = getContent ( ) ; if ( testContent . startsWith ( "0x" ) ) { got = ( short ) Integer . parseInt ( testContent . substrin...
Match short .
18,047
private boolean matchString ( final ByteBuffer bbuf ) throws IOException { if ( this . isBetween ) { final String buffer = new String ( bbuf . array ( ) ) ; if ( buffer . contains ( getContent ( ) ) ) { return true ; } return false ; } final int read = getContent ( ) . length ( ) ; for ( int j = 0 ; j < read ; j ++ ) {...
Match string .
18,048
@ SuppressWarnings ( "unused" ) private ByteBuffer readBuffer ( final RandomAccessFile raf ) throws IOException { final int startPos = getCheckBytesFrom ( ) ; if ( startPos > raf . length ( ) ) { return null ; } raf . seek ( startPos ) ; ByteBuffer buf ; switch ( getType ( ) ) { case MagicMimeEntry . STRING_TYPE : { in...
Read buffer .
18,049
public void traverseAndPrint ( final String tabs ) { logger . info ( tabs + toString ( ) ) ; final int len = this . subEntries . size ( ) ; for ( int i = 0 ; i < len ; i ++ ) { final MagicMimeEntry me = this . subEntries . get ( i ) ; me . traverseAndPrint ( tabs + "\t" ) ; } }
Traverse and print .
18,050
public void addEmptyValue ( final JKTableColumn col ) { final JKTableColumnValue value = new JKTableColumnValue ( col ) ; this . columnsValues . add ( value ) ; }
Adds the empty value .
18,051
public Double getColumnValueAsDouble ( final int col , final double defaultValue ) { Double value = getColumnValueAsDouble ( col ) ; if ( value == null ) { value = defaultValue ; } return value ; }
Gets the column value as double .
18,052
public static String getSMILESForAll ( HELM2Notation helm2notation ) throws BuilderMoleculeException , CTKException , ChemistryException { LOG . debug ( "Build single molecule(s)" ) ; List < AbstractMolecule > molecules = BuilderMolecule . buildMoleculefromPolymers ( helm2notation . getListOfPolymers ( ) , HELM2Notatio...
method to generate smiles for the whole HELMNotation
18,053
public static boolean containsGenericStructurePolymer ( List < PolymerNotation > polymers ) throws HELM2HandledException , ChemistryException , IOException , CTKException { for ( PolymerNotation polymer : polymers ) { if ( polymer . getPolymerID ( ) instanceof ChemEntity ) { Monomer monomer = MethodsMonomerUtils . getL...
method if the any of the given PolymerNotation contains generic structures
18,054
public static String getCanonicalSMILESForPolymer ( PolymerNotation polymer ) throws BuilderMoleculeException , HELM2HandledException , CTKSmilesException , CTKException , NotationException , ChemistryException { AbstractMolecule molecule = BuilderMolecule . buildMoleculefromSinglePolymer ( polymer ) . getMolecule ( ) ...
method to generate canonical smiles for one single PolymerNotation
18,055
public static String convertMolToSMILESWithAtomMapping ( String molfile , List < Attachment > attachments ) throws CTKException , ChemistryException { String smiles = Chemistry . getInstance ( ) . getManipulator ( ) . convertMolIntoSmilesWithAtomMapping ( molfile ) ; for ( Attachment attachment : attachments ) { int r ...
Converts molfile with the given attachments in smiles with atom mapping
18,056
public static boolean isConnected ( String molfile ) throws CTKException , ChemistryException { return Chemistry . getInstance ( ) . getManipulator ( ) . isConnected ( molfile ) ; }
returns if structure is connected
18,057
protected static CloseableHttpResponse putResource ( String json , String fullURL ) throws ClientProtocolException , IOException , URISyntaxException { try ( CloseableHttpClient httpclient = HttpClients . createDefault ( ) ) { HttpPut httpput = new HttpPut ( new URIBuilder ( fullURL ) . build ( ) ) ; httpput . setHeade...
Calls a PUT routine with given JSON on given resource URL .
18,058
protected static CloseableHttpResponse getResource ( String fullURL ) throws IOException , URISyntaxException { URI uri = new URIBuilder ( fullURL ) . build ( ) ; try ( CloseableHttpClient httpclient = HttpClients . createDefault ( ) ) { HttpGet httpget = new HttpGet ( uri ) ; LOG . debug ( "Executing request " + httpg...
Call a GET routine on given resource URL .
18,059
public static String getXHELM ( HELM2Notation helm2notation ) throws MonomerException , HELM1FormatException , IOException , JDOMException , NotationException , CTKException , ValidationException , ChemistryException { set = new HashSet < Monomer > ( ) ; Element root = new Element ( xHelmNotationExporter . XHELM_ELEMEN...
method to get xhelm for the helm notation only if it was possible to convert the helm in the old format
18,060
private static void addAdHocMonomer ( MonomerNotation monomerNotation ) throws IOException , JDOMException , ChemistryException { Monomer monomer = MonomerFactory . getInstance ( ) . getMonomerStore ( ) . getMonomer ( monomerNotation . getType ( ) , monomerNotation . getUnit ( ) . replace ( "[" , "" ) . replace ( "]" ,...
method to add the monomer to the database if it is an adhoc monomer
18,061
private List < Attachment > deserializeAttachmentList ( JsonParser parser , Map < String , Attachment > attachmentDB ) throws JsonParseException , IOException { List < Attachment > attachments = new ArrayList < Attachment > ( ) ; Attachment currentAttachment = null ; while ( ! JsonToken . END_ARRAY . equals ( parser . ...
Private routine to deserialize a JSON containing attachment data . This is done manually to give more freedom regarding data returned by the webservice .
18,062
private static List < CategorizedMonomer > deserializeEditorCategorizationConfig ( JsonParser parser ) throws JsonParseException , IOException { List < CategorizedMonomer > config = new LinkedList < CategorizedMonomer > ( ) ; CategorizedMonomer currentMonomer = null ; parser . nextToken ( ) ; while ( parser . hasCurren...
Private routine to deserialize JSON containing monomer categorization data . This is done manually to give more freedom regarding data returned by the webservice .
18,063
public static Attachment getAttachment ( Element attachment ) { Namespace ns = attachment . getNamespace ( ) ; Attachment att = new Attachment ( ) ; att . setAlternateId ( attachment . getChildText ( ATTACHEMENT_ID_ELEMENT , ns ) ) ; att . setLabel ( attachment . getChildText ( ATTACHEMENT_LABEL_ELEMENT , ns ) ) ; att ...
Convert ATTACHMENT element to Attachment object
18,064
public static Element getAttachementElement ( Attachment att ) { Element attachment = new Element ( ATTACHEMENT_ELEMENT ) ; if ( null != att . getAlternateId ( ) && att . getAlternateId ( ) . length ( ) > 0 ) { Element e = new Element ( ATTACHEMENT_ID_ELEMENT ) ; e . setText ( att . getAlternateId ( ) ) ; attachment . ...
This method converts Attachment to ATTACHMENT XML element
18,065
public static boolean validateAttachement ( Attachment attachment ) throws MonomerException , IOException , ChemistryException { String alternateId = attachment . getAlternateId ( ) ; if ( null == alternateId ) { throw new MonomerException ( "Attachment must have unique ID" ) ; } String smiles = attachment . getCapGrou...
This method validates Attachment by the following rules Attachment must have unique ID cap group SMILES must be valid cap group SMILES must contain one R group R group in SMILES must match R group label
18,066
public static Monomer getMonomer ( Element monomer ) throws MonomerException { Monomer m = new Monomer ( ) ; Namespace ns = monomer . getNamespace ( ) ; m . setAlternateId ( monomer . getChildText ( MONOMER_ID_ELEMENT , ns ) ) ; m . setCanSMILES ( monomer . getChildText ( MONOMER_SMILES_ELEMENT , ns ) ) ; String encode...
Convert monomer element to Monomer object
18,067
public static Element getMonomerElement ( Monomer monomer ) throws MonomerException { Element element = new Element ( MONOMER_ELEMENT ) ; if ( null != monomer . getAlternateId ( ) ) { Element e = new Element ( MONOMER_ID_ELEMENT ) ; e . setText ( monomer . getAlternateId ( ) ) ; element . getChildren ( ) . add ( e ) ; ...
This method converts Monomer to MONOMER XML element
18,068
private static boolean areAttachmentLabelsUnique ( List < String > labels ) { Map < String , String > map = new TreeMap < String , String > ( String . CASE_INSENSITIVE_ORDER ) ; for ( int i = 0 ; i < labels . size ( ) ; i ++ ) { map . put ( labels . get ( i ) , labels . get ( i ) ) ; } if ( labels . size ( ) == map . s...
This method checks if strings in a list are unique
18,069
public Attachment getAttachment ( String label ) { for ( Attachment attachment : attachmentList ) { if ( attachment . getLabel ( ) . equalsIgnoreCase ( label ) ) { return attachment ; } } return null ; }
get a specific attachment by passing in a label
18,070
public MoleculeProperty getCapMoleculeInfo ( String label ) throws CTKException , ChemistryException , IOException { for ( Attachment attachment : attachmentList ) { if ( attachment . getLabel ( ) . equalsIgnoreCase ( label ) ) { String capSmi = attachment . getCapGroupSMILES ( ) ; org . helm . chemtoolkit . MoleculeIn...
This method returns the MoleculeInfo for the input R group label of this monomer
18,071
public boolean addAttachment ( Attachment attachment ) { boolean isExist = false ; for ( Attachment a : attachmentList ) { if ( a . getLabel ( ) . equalsIgnoreCase ( attachment . getLabel ( ) ) ) { isExist = true ; } } if ( ! isExist ) { return attachmentList . add ( attachment ) ; } return false ; }
Try to add a new attachment to this monomer
18,072
public static JKCacheManager getCacheManager ( ) { if ( JKCacheFactory . defaultCacheManager == null ) { logger . debug ( "init cacheManager" ) ; defaultCacheManager = new JKDefaultCacheManager ( ) ; } return JKCacheFactory . defaultCacheManager ; }
Gets the default cache manager .
18,073
public JKTableColumn getTableColumn ( final int col , final boolean visibleIndex ) { int actualIndex ; if ( visibleIndex ) { actualIndex = this . visibilityManager . getActualIndexFromVisibleIndex ( col ) ; } else { actualIndex = col ; } return this . tableColumns . get ( actualIndex ) ; }
return NULL of col is out of bound .
18,074
public int getValueAtAsInteger ( final int row , final int col ) { final Object valueAt = getValueAt ( row , col ) ; int number = 0 ; if ( valueAt != null && ! valueAt . toString ( ) . equals ( "" ) ) { number = Integer . parseInt ( valueAt . toString ( ) . trim ( ) ) ; } return number ; }
Gets the value at as integer .
18,075
public boolean isEditable ( final int row , final int column ) { if ( isEditable ( column ) ) { final int actualIndex = getTableColumn ( column ) . getIndex ( ) ; final JKTableRecord record = getRecord ( row ) ; return record . isColumnEnabled ( actualIndex ) ; } return false ; }
Checks if is editable .
18,076
public void setEditable ( final int row , final int col , final boolean enable ) { final int actualIndex = getTableColumn ( col ) . getIndex ( ) ; getRecord ( row ) . setColumnEnabled ( actualIndex , enable ) ; }
Sets the editable .
18,077
public void addJKTableColumn ( String keyLabel ) { JKTableColumn col = new JKTableColumn ( ) ; col . setName ( keyLabel ) ; addJKTableColumn ( col ) ; }
Adds the JK table column .
18,078
public void insertConstructor ( InsertableConstructor insertableConstructor ) throws CannotCompileException , AfterBurnerImpossibleException , NotFoundException { List < CtConstructor > constructorList = extractExistingConstructors ( insertableConstructor ) ; log . info ( "constructor : " + constructorList . toString (...
Inserts java instructions into all constructors a given class .
18,079
protected ValidationResult getCachedResult ( String certFingerprint ) { CachedValidationResult cvr = validationResultsCache . get ( certFingerprint ) ; if ( cvr == null ) return null ; if ( ! cachedValidationResultHasExpired ( cvr , System . currentTimeMillis ( ) ) ) { return cvr . getResult ( ) ; } validationResultsCa...
Gets a validation result from the memory cache
18,080
public ValidationResult validate ( X509Certificate [ ] certChain ) { certChainSanityChecks ( certChain ) ; String certFingerprint = null ; try { certFingerprint = FingerprintHelper . getFingerprint ( certChain [ certChain . length - 1 ] ) ; } catch ( Throwable t ) { String errorMsg = String . format ( "Error computing ...
Validates a certificate chain using the wrapped validator caching the result for future validation calls .
18,081
public int minChannel ( ) { int c = 0 ; if ( getValue ( c ) > getValue ( 1 ) ) c = 1 ; if ( getValue ( c ) > getValue ( 2 ) ) c = 2 ; return c ; }
Returns the channel index with minimum value . Alpha is not considered .
18,082
public int maxChannel ( ) { int c = 0 ; if ( getValue ( c ) < getValue ( 1 ) ) c = 1 ; if ( getValue ( c ) < getValue ( 2 ) ) c = 2 ; return c ; }
Returns the channel index with maximum value . Alpha is not considered .
18,083
public JsTopicControls getJsTopicControlsFromProxyClass ( Class < ? > proxy ) { Class < ? > realClass = unProxyClassServices . getRealClass ( proxy ) ; return realClass . getAnnotation ( JsTopicControls . class ) ; }
get JsTopicControls from JsTopicAccessController instance
18,084
public void readStacktraceConfig ( @ Initialized ( ApplicationScoped . class ) ServletContext sc ) { String stacktrace ; if ( ocelotConfigurationsStack . isUnsatisfied ( ) ) { stacktrace = sc . getInitParameter ( Constants . Options . STACKTRACE_LENGTH ) ; if ( stacktrace == null ) { stacktrace = DEFAULTSTACKTRACE ; } ...
Read in web . xml the optional STACKTRACE_LENGTH config and set it in StacktraceConfigurationManager
18,085
public static String generateBasepath ( final String ip , Short port ) { if ( isEmpty ( ip ) ) { throw new IllegalArgumentException ( NULL_SERVER_IP_MSG ) ; } if ( port == null ) { port = 80 ; } StringBuilder basePath = new StringBuilder ( ) ; basePath . append ( "http://" ) . append ( ip ) . append ( ":" ) . append ( ...
Generate the base path for the retina .
18,086
public Object convertJsonToJava ( String jsonArg , Type paramType , Annotation [ ] parameterAnnotations ) throws JsonUnmarshallingException , JsonMarshallerException { if ( "null" . equals ( jsonArg ) ) { return null ; } JsonUnmarshaller juma = getJsonUnmarshallerAnnotation ( parameterAnnotations ) ; if ( null != juma ...
Convert json to Java
18,087
JsonUnmarshaller getJsonUnmarshallerAnnotation ( Annotation [ ] annotations ) { for ( Annotation annotation : annotations ) { if ( JsonUnmarshaller . class . isInstance ( annotation ) ) { return ( JsonUnmarshaller ) annotation ; } } return null ; }
return the JsonUnmarshaller annotation
18,088
Class < ? extends IJsonMarshaller > getMarshallerAnnotation ( Annotation [ ] annotations ) { JsonUnmarshaller ju = getJsonUnmarshallerAnnotation ( annotations ) ; return ( ju != null ) ? ju . value ( ) : null ; }
If argument is annotated with JsonUnmarshaller annotation get the JsonUnmarshaller class
18,089
Object convertArgument ( String arg , Type paramType ) throws IllegalArgumentException { Object result = null ; if ( null == arg || "null" . equals ( arg ) ) { return result ; } logger . debug ( "Try to convert {} : param = {} : {}" , new Object [ ] { arg , paramType , paramType . getClass ( ) } ) ; try { if ( Paramete...
try to convert json argument in java type
18,090
void checkStringArgument ( Class cls , String arg ) throws IOException { if ( arg . startsWith ( Constants . QUOTE ) ) { if ( ! cls . equals ( String . class ) ) { throw new IOException ( ) ; } } else if ( cls . equals ( String . class ) ) { throw new IOException ( ) ; } }
check if class and argument are string
18,091
private void compareApiUsage ( ) throws ApiException , JsonProcessingException { LOG . info ( "The Compare API usage." ) ; Compare compareApiInstance = retinaApisInstance . compareApi ( ) ; LOG . info ( "Compare API: compare" ) ; Metric metric = compareApiInstance . compare ( new Term ( "apple" ) , new Term ( "banana" ...
The Compare API usage .
18,092
private void imageApiUsage ( ) throws ApiException , IOException { LOG . info ( "The Image API usage." ) ; Images api = retinaApisInstance . imageApi ( ) ; LOG . info ( "Image API: getImageForExpression" ) ; try ( ByteArrayInputStream inputStream = api . getImage ( TEXT_1 ) ) { if ( inputStream . read ( ) == 0 ) { thro...
The Image API usage .
18,093
private void retinasApiUsage ( ) throws ApiException { LOG . info ( "The Retinas API usage." ) ; Retinas api = getInfo ( "api.cortical.io" , API_KEY ) ; LOG . info ( "Retinas API: getRetinas" ) ; List < Retina > retinas = api . getAllRetinas ( ) ; for ( Retina retina : retinas ) { LOG . info ( "Retina: Name: " + retin...
The Retinas API usage .
18,094
private void termsApiUsage ( ) throws JsonProcessingException , ApiException { LOG . info ( "The Terms API usage." ) ; Terms api = retinaApisInstance . termsApi ( ) ; LOG . info ( "Terms API: getContextsForTerm" ) ; List < Context > contexts = api . getContexts ( "apple" ) ; logContext ( contexts ) ; contexts = api . g...
The Terms API usage .
18,095
private void textApiUsage ( ) throws ApiException , JsonProcessingException { String text = "Toll IPEC has been an industry leader in environmental sustainability through its purchase of compressed natural gas powered trucks" ; String text2 = "Shellshock can serve as a highway for worms and malware to hit your Unix, Li...
The Text API usage .
18,096
public void doEvents ( ) { while ( ! isInterrupted ( ) ) { Iterator < Map . Entry < Timer , Runnable > > it = timerMap . entrySet ( ) . iterator ( ) ; if ( it . hasNext ( ) ) { long timeout = it . next ( ) . getKey ( ) . uptime - System . currentTimeMillis ( ) ; doEvents ( timeout > 0 ? timeout : 0 ) ; } else { doEvent...
Consume events until interrupted
18,097
public < T > T getField ( String field , ExtensionFieldType < T > extensionFieldType ) { if ( field == null || field . isEmpty ( ) ) { throw new IllegalArgumentException ( "Invalid field name" ) ; } if ( extensionFieldType == null ) { throw new IllegalArgumentException ( "Invalid field type" ) ; } if ( ! isFieldPresent...
Return the value for the field with a given name and type .
18,098
protected List getProjectClasspathElements ( ) throws DependencyResolutionRequiredException { Set results = new LinkedHashSet ( ) ; Set includes = getClasspathIncludes ( ) ; if ( includes . contains ( CLASSPATH_INCLUDE_ALL ) || includes . contains ( CLASSPATH_INCLUDE_RUNTIME ) ) { for ( Iterator i = project . getRuntim...
Allow the script to work with every JAR dependency of both the project and plugin including optional and provided dependencies . Runtime classpath elements are loaded first so that legacy behavior is not modified . Additional elements are added first in the order of project artifacts then in the order of plugin artifac...
18,099
private Map findProviders ( ) { Map providers = getContainer ( ) . getComponentDescriptorMap ( Provider . class . getName ( ) ) ; if ( providers == null ) { throw new Error ( "No providers discovered" ) ; } Set keys = providers . keySet ( ) ; Map found = null ; for ( Iterator iter = keys . iterator ( ) ; iter . hasNext...
Find any providers which are available in the container .