idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
17,700
public static < T > Class < ? extends T > getGenericParamter ( String handler ) { ParameterizedType parameterizedType = ( ParameterizedType ) JKObjectUtil . getClass ( handler ) . getGenericInterfaces ( ) [ 0 ] ; Class < ? extends T > clas = ( Class < ? extends T > ) ( parameterizedType . getActualTypeArguments ( ) [ 0...
Gets the generic paramter .
17,701
public static boolean isClassAvilableInClassPath ( String string ) { try { Class . forName ( string ) ; return true ; } catch ( ClassNotFoundException e ) { return false ; } }
Checks if is class avilable in class path .
17,702
public static < T > String getInstanceVariables ( Class < T > clas ) { StringBuffer fieldsString = new StringBuffer ( ) ; Field [ ] fields = clas . getDeclaredFields ( ) ; int i = 0 ; for ( Field field : fields ) { if ( i ++ > 0 ) { fieldsString . append ( JK . CSV_SEPARATOR ) ; } fieldsString . append ( field . getNam...
Gets the instance variables .
17,703
public static String toJson ( Object obj ) { ObjectMapper mapper = new ObjectMapper ( ) ; try { return mapper . writeValueAsString ( obj ) ; } catch ( IOException e ) { JK . throww ( e ) ; return null ; } }
To json .
17,704
public static < T > Object jsonToObject ( String json , Class < T > clas ) { ObjectMapper mapper = new ObjectMapper ( ) ; try { return mapper . readValue ( json , clas ) ; } catch ( IOException e ) { JK . throww ( e ) ; return null ; } }
Json to object .
17,705
public static String getFieldNameByType ( Class < ? > classType , Class < ? > fieldType ) { Field [ ] declaredFields = classType . getDeclaredFields ( ) ; for ( Field field : declaredFields ) { if ( field . getType ( ) . isAssignableFrom ( fieldType ) ) { return field . getName ( ) ; } } if ( classType . getSuperclass ...
Gets the field name by type .
17,706
public static boolean isFieldExists ( Class < ? > clas , String fieldName ) { Field [ ] fields = clas . getDeclaredFields ( ) ; for ( Field field : fields ) { if ( field . getName ( ) . equals ( fieldName ) ) { return true ; } } if ( clas . getSuperclass ( ) != null ) { return isFieldExists ( clas . getSuperclass ( ) ,...
Checks if is field exists .
17,707
public static List < String > getAllClassesInPackage ( String packageName ) { List < String > classesNames = new Vector < > ( ) ; final ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider ( false ) ; provider . addIncludeFilter ( new RegexPatternTypeFilter ( Pattern . ...
Gets the all classes in package .
17,708
public static List < Field > getAllFields ( Class < ? > clas ) { JK . fixMe ( "add caching.." ) ; List < Field > list = new Vector < > ( ) ; if ( clas . getSuperclass ( ) != null ) { list . addAll ( getAllFields ( clas . getSuperclass ( ) ) ) ; } Field [ ] fields = clas . getDeclaredFields ( ) ; for ( Field field : fie...
Gets the all fields .
17,709
public static < T > T createInstanceForGenericClass ( Object parent ) { try { Object instance = getGenericClassFromParent ( parent ) . newInstance ( ) ; return ( T ) instance ; } catch ( InstantiationException | IllegalAccessException e ) { JK . throww ( e ) ; } return null ; }
Creates the instance for generic class .
17,710
public static Class getGenericClassFromParent ( Object parent ) { return ( Class ) ( ( ParameterizedType ) parent . getClass ( ) . getGenericSuperclass ( ) ) . getActualTypeArguments ( ) [ 0 ] ; }
Gets the generic class from parent .
17,711
public static String formatDouble ( final Double amount , String pattern ) { if ( pattern == null || pattern . equals ( "" ) ) { pattern = JKFormatUtil . DEFAULT_DOUBLE_FORMAT ; } return JKFormatUtil . getNumberFormatter ( pattern ) . format ( amount ) ; }
Format double .
17,712
public synchronized static String formatTime ( final Time object , String pattern ) { if ( pattern == null || pattern . equals ( "" ) ) { pattern = JKFormatUtil . DEFAULT_TIME_PATTERN ; } return JKFormatUtil . getDateFormatter ( pattern ) . format ( object ) ; }
Format time .
17,713
public synchronized static String formatTimeStamp ( final Timestamp date , String pattern ) { if ( pattern == null || pattern . equals ( "" ) ) { pattern = JKFormatUtil . DEFAULT_TIMESTAMP_PATTERN ; } return JKFormatUtil . getDateFormatter ( pattern ) . format ( date ) ; }
Format time stamp .
17,714
public static Format getDateFormatter ( final String pattern ) { Format format = JKFormatUtil . formatMap . get ( pattern ) ; if ( format == null ) { format = new SimpleDateFormat ( pattern ) ; JKFormatUtil . formatMap . put ( pattern , format ) ; } return format ; }
Gets the date formatter .
17,715
public static Format getNumberFormatter ( final String pattern ) { Format format = JKFormatUtil . formatMap . get ( pattern ) ; if ( format == null ) { format = new DecimalFormat ( pattern ) ; JKFormatUtil . formatMap . put ( pattern , format ) ; } return format ; }
Gets the number formatter .
17,716
public static String formatNumber ( Number count ) { Format numberFormatter = getNumberFormatter ( DEFAULT_NUMBER_FORMAT ) ; return numberFormatter . format ( count ) ; }
Format number .
17,717
public static java . util . Date parseDate ( String strDate , String pattern ) { try { SimpleDateFormat parser = new SimpleDateFormat ( pattern , Locale . US ) ; return parser . parse ( strDate ) ; } catch ( ParseException e ) { throw new JKException ( e ) ; } }
Parses the date .
17,718
public static int getYearFromData ( Date date ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; return cal . get ( Calendar . YEAR ) ; }
Gets the year from data .
17,719
public static boolean isTimesEqaualed ( Date time1 , Date time2 ) { return formatTime ( time1 ) . equals ( formatTime ( time2 ) ) ; }
Checks if is times eqaualed .
17,720
public static int getNumOfMonths ( Date date1 , Date date2 ) { Calendar firstDate = Calendar . getInstance ( ) ; Date date = new Date ( date1 . getTime ( ) ) ; firstDate . setTime ( date ) ; Calendar secondDate = Calendar . getInstance ( ) ; Date date3 = new Date ( date2 . getTime ( ) ) ; secondDate . setTime ( date3 )...
Gets the num of months .
17,721
public static CompareDates compareTwoDates ( Date date1 , Date date2 ) { Date d1 = new Date ( date1 . getTime ( ) ) ; Date d2 = new Date ( date2 . getTime ( ) ) ; if ( d1 . compareTo ( d2 ) < 0 ) return CompareDates . DATE1_LESS_THAN_DATE2 ; else if ( d1 . compareTo ( d2 ) > 0 ) return CompareDates . DATE1_GREATER_THAN...
Compare two dates .
17,722
public static Date adddDaysToCurrentDate ( int numberOfDays ) { Date date = new Date ( ) ; Calendar instance = Calendar . getInstance ( ) ; instance . setTime ( date ) ; instance . add ( Calendar . DATE , numberOfDays ) ; return instance . getTime ( ) ; }
Addd days to current date .
17,723
public static boolean isDate ( String strDate , String pattern ) { try { parseDate ( strDate , pattern ) ; return true ; } catch ( Exception e ) { return false ; } }
Checks if is date .
17,724
public static Date addMonths ( Date date , int numOfMonths ) { Calendar instance = Calendar . getInstance ( ) ; instance . setTime ( date ) ; instance . add ( Calendar . MONTH , numOfMonths ) ; return instance . getTime ( ) ; }
Adds the months .
17,725
public static long getDifference ( Time timeFrom , Time timeTo ) { try { DateFormat format = new SimpleDateFormat ( "HH:mm:ss" ) ; Date date = format . parse ( timeFrom . toString ( ) ) ; Date date2 = format . parse ( timeTo . toString ( ) ) ; long difference = ( date2 . getTime ( ) - date . getTime ( ) ) / 1000 / 60 ;...
Gets the difference .
17,726
private static int getDayOfMonth ( Date date ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; return cal . get ( Calendar . DAY_OF_MONTH ) ; }
Gets the day of month .
17,727
public static int getDayOfWeek ( Date date ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; return cal . get ( Calendar . DAY_OF_WEEK ) ; }
Gets the day of week .
17,728
public static int getHour ( Date timeFrom ) { Calendar instance = Calendar . getInstance ( ) ; instance . setTime ( timeFrom ) ; int hour = instance . get ( Calendar . HOUR ) ; return hour ; }
Gets the hour .
17,729
public static boolean isCurrentTimeBetweenTowTimes ( Date fromDate , Date fromTime , Date toDate , Date timeTo ) { JKTimeObject currntTime = getCurrntTime ( ) ; JKTimeObject fromTimeObject = new JKTimeObject ( ) ; JKTimeObject toTimeObject = new JKTimeObject ( ) ; if ( currntTime . after ( fromTimeObject . toTimeObject...
Checks if is current time between tow times .
17,730
public static long getDayDifference ( Date startDate , Date endDate ) { long startTime = startDate . getTime ( ) ; long endTime = endDate . getTime ( ) ; long diffTime = endTime - startTime ; long diffDays = TimeUnit . MILLISECONDS . toDays ( diffTime ) ; return diffDays ; }
Gets the day difference .
17,731
public static long getSecondsDifference ( Date startDate , Date endDate ) { long startTime = startDate . getTime ( ) ; long endTime = endDate . getTime ( ) ; long diffTime = endTime - startTime ; long diffInSeconds = TimeUnit . MILLISECONDS . toSeconds ( diffTime ) ; return diffInSeconds ; }
Gets the seconds difference .
17,732
public static long getHoursDifference ( Date startDate , Date endDate ) { long startTime = startDate . getTime ( ) ; long endTime = endDate . getTime ( ) ; long diffTime = endTime - startTime ; long diffInHours = TimeUnit . MILLISECONDS . toHours ( diffTime ) ; return diffInHours ; }
Gets the hours difference .
17,733
public static long getMillisDifference ( Date startDate , Date endDate ) { long startTime = startDate . getTime ( ) ; long endTime = endDate . getTime ( ) ; long diffTime = endTime - startTime ; return diffTime ; }
Gets the millis difference .
17,734
public static long getMinutesDifference ( Date startDate , Date endDate ) { long startTime = startDate . getTime ( ) ; long endTime = endDate . getTime ( ) ; long diffTime = endTime - startTime ; long diffInMinutes = TimeUnit . MILLISECONDS . toMinutes ( diffTime ) ; return diffInMinutes ; }
Gets the minutes difference .
17,735
public static boolean isDateEqaualed ( final java . util . Date date1 , final java . util . Date date2 ) { final String d1 = JKFormatUtil . formatDate ( date1 , JKFormatUtil . MYSQL_DATE_DB_PATTERN ) ; final String d2 = JKFormatUtil . formatDate ( date2 , JKFormatUtil . MYSQL_DATE_DB_PATTERN ) ; return d1 . equalsIgnor...
Checks if is date eqaualed .
17,736
public static boolean isPeriodActive ( final Date startDate , final Date endDate ) { if ( startDate == null && endDate == null ) { return true ; } if ( startDate == null ) { throw new JKException ( "START_DATE_CAN_NOT_BE_NULL" ) ; } if ( endDate == null ) { throw new JKException ( "END_DATE_CAN_NOT_BE_NULL" ) ; } if ( ...
Checks if is period active .
17,737
private static List < AbstractMolecule > buildMolecule ( HELM2Notation helm2notation ) throws BuilderMoleculeException , ChemistryException { return BuilderMolecule . buildMoleculefromPolymers ( helm2notation . getListOfPolymers ( ) , HELM2NotationUtils . getAllEdgeConnections ( helm2notation . getListOfConnections ( )...
method to build from one notation one molecule
17,738
public static double getMolecularWeight ( HELM2Notation helm2notation ) throws BuilderMoleculeException , CTKException , ChemistryException { List < AbstractMolecule > molecules = buildMolecule ( helm2notation ) ; return calculateMolecularWeight ( molecules ) ; }
method to get the molecular weight for the whole HELM
17,739
private static double calculateMolecularWeight ( List < AbstractMolecule > molecules ) throws BuilderMoleculeException , CTKException , ChemistryException { Double result = 0.0 ; for ( AbstractMolecule molecule : molecules ) { molecule = BuilderMolecule . mergeRgroups ( molecule ) ; result += Chemistry . getInstance ( ...
intern method to calculate the molecular weight for a list of molecules
17,740
public static double getExactMass ( HELM2Notation helm2notation ) throws BuilderMoleculeException , CTKException , ChemistryException { List < AbstractMolecule > molecules = buildMolecule ( helm2notation ) ; return calculateExactMass ( molecules ) ; }
method to get the ExactMass for the whole HELM
17,741
private static double calculateExactMass ( List < AbstractMolecule > molecules ) throws CTKException , ChemistryException , BuilderMoleculeException { Double result = 0.0 ; for ( AbstractMolecule molecule : molecules ) { molecule = BuilderMolecule . mergeRgroups ( molecule ) ; result += Chemistry . getInstance ( ) . ge...
intern method to calculate the exact mass for a list of molecules
17,742
public static String getMolecularFormular ( HELM2Notation helm2notation ) throws BuilderMoleculeException , CTKException , ChemistryException { List < AbstractMolecule > molecules = buildMolecule ( helm2notation ) ; LOG . info ( "Build process is finished" ) ; return calculateMolecularFormula ( molecules ) ; }
method to get the MolecularFormular for the whole HELM
17,743
private static String calculateMolecularFormula ( List < AbstractMolecule > molecules ) throws BuilderMoleculeException , CTKException , ChemistryException { Map < String , Integer > atomNumberMap = new TreeMap < String , Integer > ( ) ; for ( AbstractMolecule molecule : molecules ) { LOG . info ( molecule . getMolecul...
intern method to calculate the molecular formular for a list of molecules
17,744
public static MoleculeProperty getMoleculeProperties ( HELM2Notation helm2notation ) throws BuilderMoleculeException , CTKException , ExtinctionCoefficientException , ChemistryException { MoleculeProperty result = new MoleculeProperty ( ) ; List < AbstractMolecule > molecules = buildMolecule ( helm2notation ) ; result ...
method to get all molecule properties for one HELM2Notation
17,745
private static Map < String , Integer > generateAtomNumberMap ( AbstractMolecule molecule , Map < String , Integer > mapAtoms ) throws BuilderMoleculeException , CTKException , ChemistryException { molecule = BuilderMolecule . mergeRgroups ( molecule ) ; LOG . info ( "Merge group is finished" ) ; String formula = Chemi...
method to get for every atom the number of occurences
17,746
public void switchOff ( BitSet switchGroupAddress , int switchCode ) { if ( switchGroupAddress . length ( ) > 5 ) { throw new IllegalArgumentException ( "switch group address has more than 5 bits!" ) ; } this . sendTriState ( this . getCodeWordA ( switchGroupAddress , switchCode , false ) ) ; }
Switch a remote switch off
17,747
public void send ( final String bitString ) { BitSet bitSet = new BitSet ( bitString . length ( ) ) ; for ( int i = 0 ; i < bitString . length ( ) ; i ++ ) { if ( bitString . charAt ( i ) == '1' ) { bitSet . set ( i ) ; } } send ( bitSet , bitString . length ( ) ) ; }
Send a string of bits
17,748
public void send ( final BitSet bitSet , int length ) { if ( transmitterPin != null ) { for ( int nRepeat = 0 ; nRepeat < repeatTransmit ; nRepeat ++ ) { for ( int i = 0 ; i < length ; i ++ ) { if ( bitSet . get ( i ) ) { transmit ( protocol . getOneBit ( ) ) ; } else { transmit ( protocol . getZeroBit ( ) ) ; } } send...
Send a set of bits
17,749
public void sendTriState ( String codeWord ) { if ( transmitterPin != null ) { for ( int nRepeat = 0 ; nRepeat < repeatTransmit ; nRepeat ++ ) { for ( int i = 0 ; i < codeWord . length ( ) ; ++ i ) { switch ( codeWord . charAt ( i ) ) { case '0' : this . sendT0 ( ) ; break ; case 'F' : this . sendTF ( ) ; break ; case ...
Sends a Code Word
17,750
public static BitSet getSwitchGroupAddress ( String address ) { if ( address . length ( ) != 5 ) { throw new IllegalArgumentException ( "the switchGroupAddress must consist of exactly 5 bits!" ) ; } BitSet bitSet = new BitSet ( 5 ) ; for ( int i = 0 ; i < 5 ; i ++ ) { bitSet . set ( i , address . charAt ( i ) == '1' ) ...
convenient method to convert a string like 11011 to a BitSet .
17,751
public static boolean start ( RootDoc root ) throws Exception { umlProject = null ; mainGui = null ; Standard . start ( root ) ; setOptions ( root ) ; openOrCreateUmlProject ( root ) ; generateUml ( root ) ; return true ; }
Standard doclet start method
17,752
public static int optionLength ( String option ) { int result = Standard . optionLength ( option ) ; if ( result == 0 ) { if ( option . equals ( OPTION_PATH_UML_PROJECT ) ) { result = 2 ; } } return result ; }
Standard doclet method must be present!
17,753
public final void add ( final String problem , final Severity severity ) { this . problems . add ( new Problem ( problem , severity ) ) ; this . hasFatal |= severity == Severity . FATAL ; }
Add a problem with the specified severity .
17,754
public final Problem getLeadProblem ( ) { Collections . sort ( this . problems ) ; return this . problems . isEmpty ( ) ? null : this . problems . get ( this . problems . size ( ) - 1 ) ; }
Get the first problem of the highest severity .
17,755
public String toMutilLineString ( ) { final String newLine = System . getProperty ( "line.separator" ) ; final StringBuffer problemStr = new StringBuffer ( ) ; for ( final Problem problem : this . problems ) { problemStr . append ( problem . getMessage ( ) + newLine ) ; } return problemStr . toString ( ) ; }
To mutil line string .
17,756
public static int getTotalMonomerCount ( PolymerNotation polymer ) { int count = 0 ; for ( MonomerNotation element : polymer . getPolymerElements ( ) . getListOfElements ( ) ) { count += getMonomerCountFromMonomerNotation ( element ) ; } return count ; }
method to get the total monomer count of one PolymerNotation
17,757
private static int getMonomerCountFromMonomerNotation ( MonomerNotation monomerNotation ) { int multiply ; try { multiply = Integer . parseInt ( monomerNotation . getCount ( ) ) ; if ( multiply < 1 ) { multiply = 1 ; } } catch ( NumberFormatException e ) { multiply = 1 ; } if ( monomerNotation instanceof MonomerNotatio...
method to get the number of all existing monomers from one MonomerNotation
17,758
public String nextGroup ( ) { int currentPosition = this . position ; do { char currentCharacter = this . characters [ currentPosition ] ; if ( currentCharacter == '[' ) { currentPosition = NucleotideParser . getMatchingBracketPosition ( this . characters , currentPosition , '[' , ']' ) ; } else if ( currentCharacter =...
Returns the next group
17,759
public final static String toJSON ( HELM2Notation helm2notation ) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper ( ) ; String jsonINString = mapper . writeValueAsString ( helm2notation ) ; jsonINString = mapper . writerWithDefaultPrettyPrinter ( ) . writeValueAsString ( helm2notation ) ; return...
method to generate a JSON - Object from the given HELM2Notation
17,760
public final static List < ConnectionNotation > getAllEdgeConnections ( List < ConnectionNotation > connections ) { List < ConnectionNotation > listEdgeConnection = new ArrayList < ConnectionNotation > ( ) ; for ( ConnectionNotation connection : connections ) { if ( ! ( connection . getrGroupSource ( ) . equals ( "pair...
method to get all edge connections of a given List of ConnectionNotation
17,761
public final static List < PolymerNotation > getRNAPolymers ( List < PolymerNotation > polymers ) { List < PolymerNotation > rnaPolymers = new ArrayList < PolymerNotation > ( ) ; for ( PolymerNotation polymer : polymers ) { if ( polymer . getPolymerID ( ) instanceof RNAEntity ) { rnaPolymers . add ( polymer ) ; } } ret...
method to get all rna polymers given a List of PolymerNotation objects
17,762
public final static List < PolymerNotation > getPeptidePolymers ( List < PolymerNotation > polymers ) { List < PolymerNotation > peptidePolymers = new ArrayList < PolymerNotation > ( ) ; for ( PolymerNotation polymer : polymers ) { if ( polymer . getPolymerID ( ) instanceof PeptideEntity ) { peptidePolymers . add ( pol...
method to get all peptide polymers given a list of PolymerNotation objects
17,763
public final static List < PolymerNotation > getCHEMPolymers ( List < PolymerNotation > polymers ) { List < PolymerNotation > chemPolymers = new ArrayList < PolymerNotation > ( ) ; for ( PolymerNotation polymer : polymers ) { if ( polymer . getPolymerID ( ) instanceof ChemEntity ) { chemPolymers . add ( polymer ) ; } }...
method to get all chem polymers given a list of PolymerNotation objects
17,764
public final static List < PolymerNotation > getBLOBPolymers ( List < PolymerNotation > polymers ) { List < PolymerNotation > blobPolymers = new ArrayList < PolymerNotation > ( ) ; for ( PolymerNotation polymer : polymers ) { if ( polymer . getPolymerID ( ) instanceof BlobEntity ) { blobPolymers . add ( polymer ) ; } }...
method to get all blob polymers given a list of PolymerNotation objects
17,765
public final static void combineHELM2notation ( HELM2Notation helm2notation , HELM2Notation newHELM2Notation ) throws NotationException { HELM2NotationUtils . helm2notation = helm2notation ; Map < String , String > mapIds = generateMapChangeIds ( newHELM2Notation . getPolymerAndGroupingIDs ( ) ) ; section1 ( newHELM2No...
method to add a new HELMNotation to another HELM2Notation the new HELM2Notation will be merged to the first HELM2Notation
17,766
private static Map < String , String > generateMapChangeIds ( List < String > newIDs ) { Map < String , String > mapIds = new HashMap < String , String > ( ) ; List < String > oldIds = HELM2NotationUtils . helm2notation . getPolymerAndGroupingIDs ( ) ; Map < String , String > mapOldIds = new HashMap < String , String >...
method to generate a Map of old ids with the new ids
17,767
private static void section1 ( List < PolymerNotation > polymers , Map < String , String > mapIds ) throws NotationException { for ( PolymerNotation polymer : polymers ) { if ( mapIds . containsKey ( polymer . getPolymerID ( ) . getId ( ) ) ) { PolymerNotation newpolymer = new PolymerNotation ( mapIds . get ( polymer ....
method to add PolymerNotations to the existent
17,768
private static void section2 ( List < ConnectionNotation > connections , Map < String , String > mapIds ) throws NotationException { for ( ConnectionNotation connection : connections ) { HELMEntity first = connection . getSourceId ( ) ; String idFirst = first . getId ( ) ; HELMEntity second = connection . getTargetId (...
method to add ConnectionNotation to the existent
17,769
private static void section3 ( List < GroupingNotation > groupings , Map < String , String > mapIds ) throws NotationException { for ( GroupingNotation grouping : groupings ) { GroupEntity groupID = grouping . getGroupID ( ) ; if ( mapIds . containsKey ( groupID . getId ( ) ) ) { groupID = new GroupingNotation ( mapIds...
method to add groupings to the existent grouping section
17,770
private static void section4 ( List < AnnotationNotation > annotations , Map < String , String > mapIds ) { for ( AnnotationNotation annotation : annotations ) { String notation = annotation . getAnnotation ( ) ; notation = changeIDs ( notation , mapIds ) ; helm2notation . addAnnotation ( new AnnotationNotation ( notat...
method to add annotations to the existent annotation section
17,771
private static String changeIDs ( String text , Map < String , String > mapIds ) { String result = text ; for ( String key : mapIds . keySet ( ) ) { result = result . replace ( key , mapIds . get ( key ) ) ; } return result ; }
method to change the ids in a text according to map
17,772
public static final int getTotalMonomerCount ( HELM2Notation helm2notation ) { int result = 0 ; for ( PolymerNotation polymer : helm2notation . getListOfPolymers ( ) ) { result += PolymerUtils . getTotalMonomerCount ( polymer ) ; } return result ; }
method to get the total number of MonomerNotationUnits in a HELMNotation object
17,773
public static boolean hasNucleotideModification ( List < PolymerNotation > polymers ) throws NotationException { for ( PolymerNotation polymer : getRNAPolymers ( polymers ) ) { if ( RNAUtils . hasNucleotideModification ( polymer ) ) { return true ; } } return false ; }
method to check if any of the rna polymers have a modified nucleotide
17,774
public static String [ ] getFormatedSirnaSequences ( HELM2Notation helm2notation ) throws NotationException , RNAUtilsException , HELM2HandledException , org . helm . notation2 . exception . NotationException , ChemistryException { return getFormatedSirnaSequences ( helm2notation , DEFAULT_PADDING_CHAR , DEFAULT_BASE_P...
generate formated siRNA sequence with default padding char and base - pair char |
17,775
private static String reverseString ( String source ) { int i ; int len = source . length ( ) ; StringBuffer dest = new StringBuffer ( ) ; for ( i = ( len - 1 ) ; i >= 0 ; i -- ) { dest . append ( source . charAt ( i ) ) ; } return dest . toString ( ) ; }
method to reverse a String
17,776
public List < HELM2Notation > decompose ( HELM2Notation helm2notation ) { List < HELM2Notation > list = new ArrayList < HELM2Notation > ( ) ; List < ConnectionNotation > allselfConnections = getAllSelfCycleConnections ( helm2notation . getListOfConnections ( ) ) ; for ( PolymerNotation polymer : helm2notation . getList...
decompose the HELM2 into smaller HELM2 objects
17,777
private static List < ConnectionNotation > getAllSelfCycleConnections ( List < ConnectionNotation > connections ) { List < ConnectionNotation > listSelfCycle = new ArrayList < ConnectionNotation > ( ) ; for ( ConnectionNotation connection : connections ) { if ( ( connection . getTargetId ( ) . getId ( ) . equals ( conn...
method to get all self - cycle Connections
17,778
private static List < ConnectionNotation > getSelfCycleConnections ( String id , List < ConnectionNotation > connections ) { List < ConnectionNotation > list = new ArrayList < ConnectionNotation > ( ) ; for ( ConnectionNotation connection : connections ) { if ( connection . getSourceId ( ) . getId ( ) . equals ( id ) )...
method to get for one polymer all self - cycle ConnectionNotations
17,779
public static List < PolymerNotation > getListOfPolymersSpecificType ( String str , List < PolymerNotation > polymers ) { List < PolymerNotation > list = new ArrayList < PolymerNotation > ( ) ; for ( PolymerNotation polymer : polymers ) { if ( polymer . getPolymerID ( ) . getType ( ) . equals ( str ) ) { list . add ( p...
method to get all polymers for one specific polymer type
17,780
public static String buildDynamicKey ( final Object [ ] paramNames , final Object [ ] paramValues ) { return Arrays . toString ( paramNames ) . concat ( Arrays . toString ( paramValues ) ) ; }
Builds the dynamic key .
17,781
private Map < String , String > deserializeNucleotideStore ( JsonParser parser ) throws JsonParseException , IOException { Map < String , String > nucleotides = new TreeMap < String , String > ( String . CASE_INSENSITIVE_ORDER ) ; String currentNucleotideSymbol = "" ; String currentNucleotideNotation = "" ; boolean fou...
Private routine to deserialize nucleotide Store JSON . This is done manually to give more freedom regarding data returned by the webservice .
17,782
public static void fixPropertiesKeys ( final Properties prop ) { final Enumeration < Object > keys = prop . keys ( ) ; while ( keys . hasMoreElements ( ) ) { String currentKey = ( String ) keys . nextElement ( ) ; String fixedKey = fixPropertyKey ( currentKey ) ; String value = prop . getProperty ( currentKey ) ; value...
Fix properties keys .
17,783
public static String fixPropertyValue ( String value ) { value = value . replaceAll ( "\\{jk.appname\\}" , JK . getAppName ( ) ) ; return value ; }
Fix property value .
17,784
public static Object unifyReferences ( final Hashtable hash , Object object ) { final Object itemAtHash = hash . get ( object . hashCode ( ) ) ; if ( itemAtHash == null ) { hash . put ( object . hashCode ( ) , object ) ; } else { object = itemAtHash ; } return object ; }
return unified reference .
17,785
public static List < Entry > sortHashTable ( final Hashtable < ? , ? > hash , final boolean asc ) { final ArrayList < Entry > myArrayList = new ArrayList ( hash . entrySet ( ) ) ; Collections . sort ( myArrayList , new HashComparator ( asc ) ) ; return myArrayList ; }
Sort hash table .
17,786
public static String formatProperties ( Properties properties ) { StringBuffer buf = new StringBuffer ( ) ; Set < Object > keySet = properties . keySet ( ) ; for ( Object key : keySet ) { buf . append ( key . toString ( ) . trim ( ) . toUpperCase ( ) . replaceAll ( " " , "_" ) ) ; buf . append ( "=" ) ; buf . append ( ...
Format properties .
17,787
public static String getStandard ( HELM2Notation helm2notation ) throws HELM1FormatException , MonomerLoadingException , CTKException , ValidationException , ChemistryException { try { String firstSection = setStandardHELMFirstSection ( helm2notation ) ; List < String > ListOfSecondAndThirdSection = setStandardHELMSeco...
method to reproduce a standard HELM in HELM1 - Format
17,788
private static String setStandardHELMFourthSection ( List < AnnotationNotation > annotations ) { StringBuilder sb = new StringBuilder ( ) ; for ( AnnotationNotation annotation : annotations ) { sb . append ( annotation . toHELM2 ( ) + "|" ) ; } if ( sb . length ( ) > 1 ) { sb . setLength ( sb . length ( ) - 1 ) ; } ret...
method to transform the fourth section into HELM1 - Format
17,789
public static String getCanonical ( HELM2Notation helm2notation ) throws HELM1FormatException , ChemistryException { Map < String , String > convertsortedIdstoIds ; try { Object [ ] temp = setCanonicalHELMFirstSection ( helm2notation ) ; LOG . info ( "First Section of canonical HELM was generated" ) ; convertsortedIdst...
method to generate from a helm2notation a valid canonical HELM1
17,790
private static String setCanonicalHELMSecondSection ( Map < String , String > convertsortedIdstoIds , List < ConnectionNotation > connectionNotations ) throws HELM1ConverterException { StringBuilder notation = new StringBuilder ( ) ; for ( ConnectionNotation connectionNotation : connectionNotations ) { List < String > ...
method to generate a canonical HELM 1 connection section
17,791
private static String convertConnection ( String notation , String source , String target , Map < String , String > convertIds ) throws HELM1ConverterException { try { String test = notation . replace ( source , "one" ) ; test = test . replace ( target , "two" ) ; test = test . replace ( "one" , convertIds . get ( sour...
method to convert the polymers ids of the connection
17,792
private Element getXHELMRootElement ( String resource ) throws JDOMException , IOException { ByteArrayInputStream stream = new ByteArrayInputStream ( resource . getBytes ( ) ) ; SAXBuilder builder = new SAXBuilder ( ) ; Document doc = builder . build ( stream ) ; return doc . getRootElement ( ) ; }
method to get the XHELMRootElement of a document as a string
17,793
private void updateMonomerStore ( MonomerStore monomerStore ) throws MonomerLoadingException , IOException , MonomerException , ChemistryException { for ( Monomer monomer : monomerStore . getAllMonomersList ( ) ) { MonomerFactory . getInstance ( ) . getMonomerStore ( ) . addNewMonomer ( monomer ) ; MonomerFactory . get...
method to combine the new MonomerStore to the existing one in case of xHELM as input
17,794
private HELM2Notation readNotation ( String notation ) throws ParserException , JDOMException , IOException , MonomerException , ChemistryException { if ( notation . contains ( "<Xhelm>" ) ) { LOG . info ( "xhelm is used as input" ) ; String xhelm = notation ; Element xHELMRootElement = getXHELMRootElement ( xhelm ) ; ...
method to read the HELM string the HELM can be in version 1 or 2 or in Xhelm format
17,795
private HELM2Notation validate ( String helm ) throws ValidationException , ChemistryException { try { HELM2Notation helm2notation = readNotation ( helm ) ; LOG . info ( "Validation of HELM is starting" ) ; Validation . validateNotationObjects ( helm2notation ) ; LOG . info ( "Validation was successful" ) ; return helm...
method to validate the HELM - String input
17,796
public void validateHELM ( String helm ) throws ValidationException , MonomerLoadingException , ChemistryException { validate ( helm ) ; setMonomerFactoryToDefault ( helm ) ; }
method to validate the input HELM - String
17,797
public String convertStandardHELMToCanonicalHELM ( String notation ) throws HELM1FormatException , ValidationException , MonomerLoadingException , ChemistryException { String result = HELM1Utils . getCanonical ( validate ( notation ) ) ; setMonomerFactoryToDefault ( notation ) ; return result ; }
method to convert the input HELM into canonical HELM
17,798
public String convertIntoStandardHELM ( String notation ) throws HELM1FormatException , ValidationException , MonomerLoadingException , CTKException , ChemistryException { String result = HELM1Utils . getStandard ( validate ( notation ) ) ; setMonomerFactoryToDefault ( notation ) ; return result ; }
method to convert the input HELM into a standard HELM
17,799
public Float calculateExtinctionCoefficient ( String notation ) throws ExtinctionCoefficientException , ValidationException , MonomerLoadingException , ChemistryException { Float result = ExtinctionCoefficient . getInstance ( ) . calculate ( validate ( notation ) ) ; setMonomerFactoryToDefault ( notation ) ; return res...
method to calculate from a non - ambiguous HELM string the extinction coefficient