idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
29,100
public void decreaseFontSize ( ) { if ( inRange ( ) || ( atMax ( ) && atUpperBoundary ( ) ) ) { currentFontIndex -- ; } else if ( atMin ( ) ) { lowerVirtualCount -- ; } else if ( atMax ( ) && inUpper ( ) ) { upperVirtualCount -- ; } }
Move the font size pointer down . If this would move the pointer past the minimum font size track this increase with a virtual size .
29,101
public DescriptorValue calculate ( IAtom atom , IAtomContainer container ) { String symbol = atom . getSymbol ( ) ; double vdwradius = PeriodicTable . getVdwRadius ( symbol ) ; return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( vdwradius ) , NAMES ) ; }
This method calculate the Van der Waals radius of an atom .
29,102
public < S extends ICDKObject , T extends S > boolean register ( Class < S > intf , Constructor < T > constructor ) { return register ( intf , constructor , null ) ; }
Register a specific constructor with an explicit interface .
29,103
public < S extends ICDKObject , T extends S > boolean register ( Class < S > intf , Constructor < T > constructor , CreationModifier < T > modifier ) { if ( Modifier . isPrivate ( constructor . getModifiers ( ) ) || Modifier . isProtected ( constructor . getModifiers ( ) ) ) return Boolean . FALSE ; constructor . setAccessible ( true ) ; return register ( key ( intf , constructor ) , constructor , modifier ) != null ; }
Register a specific constructor with a creation modifier to an explicit interface .
29,104
private < T > Creator < T > register ( ConstructorKey key , Constructor < T > constructor , CreationModifier < T > modifier ) { Creator < T > creator = new ReflectionCreator < T > ( constructor ) ; if ( modifier != null ) creator = new ModifiedCreator < T > ( creator , modifier ) ; return register ( key , creator ) ; }
Register a constructor key with a public constructor .
29,105
public < T extends ICDKObject > T ofClass ( Class < T > intf , Object ... objects ) { try { if ( ! intf . isInterface ( ) ) throw new IllegalArgumentException ( "expected interface, got " + intf . getClass ( ) ) ; Creator < T > constructor = get ( new ObjectBasedKey ( intf , objects ) ) ; return constructor . create ( objects ) ; } catch ( InstantiationException e ) { throw new IllegalArgumentException ( "unable to instantiate chem object: " , e ) ; } catch ( IllegalAccessException e ) { throw new IllegalArgumentException ( "constructor is not accessible: " , e ) ; } catch ( InvocationTargetException e ) { throw new IllegalArgumentException ( "invocation target exception: " , e ) ; } }
Construct an implementation using a constructor whose parameters match that of the provided objects .
29,106
private < T > Creator < T > find ( final ConstructorKey key ) { for ( ConstructorKey candidate : lookup . getCandidates ( key ) ) { if ( key . isAssignable ( candidate ) ) { return get ( candidate ) ; } } if ( key . isUniform ( ) ) { Object types = Array . newInstance ( key . type ( 0 ) , 0 ) ; final ConstructorKey alt = new ObjectBasedKey ( key . intf ( ) , new Object [ ] { types } ) ; Creator < T > creator = get ( alt ) ; return new ArrayWrapCreator < T > ( creator ) ; } LOGGER . debug ( "no instance handler found for " , key ) ; return new Creator < T > ( ) { public T create ( Object [ ] objects ) { throw new IllegalArgumentException ( getSuggestionMessage ( key ) ) ; } public Class < T > getDeclaringClass ( ) { throw new IllegalArgumentException ( "missing declaring class" ) ; } } ; }
Find a constructor whose parameters are assignable from the provided key .
29,107
public < T extends ICDKObject > Set < Class < ? > > implementorsOf ( Class < T > intf ) { Set < Class < ? > > implementations = new HashSet < Class < ? > > ( 5 ) ; for ( ConstructorKey key : lookup . getConstructors ( intf ) ) { implementations . add ( get ( key ) . getDeclaringClass ( ) ) ; } return implementations ; }
Access the registered implementations for a given interface .
29,108
public IAtomContainer getSpanningTree ( ) { IAtomContainer container = molecule . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; for ( int a = 0 ; a < totalVertexCount ; a ++ ) container . addAtom ( molecule . getAtom ( a ) ) ; for ( int b = 0 ; b < totalEdgeCount ; b ++ ) if ( bondsInTree [ b ] ) container . addBond ( molecule . getBond ( b ) ) ; return container ; }
Access the computed spanning tree of the input molecule .
29,109
public IRingSet getBasicRings ( ) throws NoSuchAtomException { IRingSet ringset = molecule . getBuilder ( ) . newInstance ( IRingSet . class ) ; IAtomContainer spt = getSpanningTree ( ) ; for ( int i = 0 ; i < totalEdgeCount ; i ++ ) if ( ! bondsInTree [ i ] ) ringset . addAtomContainer ( getRing ( spt , molecule . getBond ( i ) ) ) ; return ringset ; }
The basic rings of the spanning tree . Using the pruned edges return any path which connects the end points of the pruned edge in the tree . These paths form cycles .
29,110
public IAtomContainer getCyclicFragmentsContainer ( ) { IAtomContainer fragContainer = this . molecule . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; IAtomContainer spt = getSpanningTree ( ) ; for ( int i = 0 ; i < totalEdgeCount ; i ++ ) if ( ! bondsInTree [ i ] ) { IRing ring = getRing ( spt , molecule . getBond ( i ) ) ; for ( int b = 0 ; b < ring . getBondCount ( ) ; b ++ ) { IBond ringBond = ring . getBond ( b ) ; if ( ! fragContainer . contains ( ringBond ) ) { for ( int atomCount = 0 ; atomCount < ringBond . getAtomCount ( ) ; atomCount ++ ) { IAtom atom = ringBond . getAtom ( atomCount ) ; if ( ! fragContainer . contains ( atom ) ) { atom . setFlag ( CDKConstants . ISINRING , true ) ; fragContainer . addAtom ( atom ) ; } } fragContainer . addBond ( ringBond ) ; } } } return fragContainer ; }
Returns an IAtomContainer which contains all the atoms and bonds which are involved in ring systems .
29,111
private void identifyBonds ( ) { IAtomContainer spt = getSpanningTree ( ) ; IRing ring ; int nBasicRings = 0 ; for ( int i = 0 ; i < totalEdgeCount ; i ++ ) { if ( ! bondsInTree [ i ] ) { ring = getRing ( spt , molecule . getBond ( i ) ) ; for ( int b = 0 ; b < ring . getBondCount ( ) ; b ++ ) { int m = molecule . indexOf ( ring . getBond ( b ) ) ; cb [ nBasicRings ] [ m ] = 1 ; } nBasicRings ++ ; } } bondsAcyclicCount = 0 ; bondsCyclicCount = 0 ; for ( int i = 0 ; i < totalEdgeCount ; i ++ ) { int s = 0 ; for ( int j = 0 ; j < nBasicRings ; j ++ ) { s += cb [ j ] [ i ] ; } switch ( s ) { case ( 0 ) : { bondsAcyclicCount ++ ; break ; } case ( 1 ) : { bondsCyclicCount ++ ; break ; } default : { bondsCyclicCount ++ ; } } } identifiedBonds = true ; }
Identifies whether bonds are cyclic or not . It is used by several other methods .
29,112
public IRingSet getAllRings ( ) throws NoSuchAtomException { IRingSet ringset = getBasicRings ( ) ; IRing newring ; int nBasicRings = ringset . getAtomContainerCount ( ) ; for ( int i = 0 ; i < nBasicRings ; i ++ ) getBondsInRing ( molecule , ( IRing ) ringset . getAtomContainer ( i ) , cb [ i ] ) ; for ( int i = 0 ; i < nBasicRings ; i ++ ) { for ( int j = i + 1 ; j < nBasicRings ; j ++ ) { newring = combineRings ( ringset , i , j ) ; if ( newring != null ) ringset . addAtomContainer ( newring ) ; } } return ringset ; }
All basic rings and the all pairs of basic rings share at least one edge combined .
29,113
public void setup ( IChemModel chemModel , Rectangle screen ) { this . setScale ( chemModel ) ; Rectangle2D bounds = BoundsCalculator . calculateBounds ( chemModel ) ; if ( bounds != null ) this . modelCenter = new Point2d ( bounds . getCenterX ( ) , bounds . getCenterY ( ) ) ; this . drawCenter = new Point2d ( screen . getCenterX ( ) , screen . getCenterY ( ) ) ; this . setup ( ) ; }
Setup the transformations necessary to draw this Chem Model .
29,114
public void setScale ( IChemModel chemModel ) { double bondLength = AverageBondLengthCalculator . calculateAverageBondLength ( chemModel ) ; double scale = this . calculateScaleForBondLength ( bondLength ) ; this . rendererModel . getParameter ( Scale . class ) . setValue ( scale ) ; }
Set the scale for an IChemModel . It calculates the average bond length of the model and calculates the multiplication factor to transform this to the bond length that is set in the RendererModel .
29,115
public Rectangle paint ( IChemModel chemModel , IDrawVisitor drawVisitor ) { IAtomContainerSet moleculeSet = chemModel . getMoleculeSet ( ) ; IReactionSet reactionSet = chemModel . getReactionSet ( ) ; if ( moleculeSet == null && reactionSet != null ) { Rectangle2D totalBounds = calculateBounds ( reactionSet ) ; this . setupTransformNatural ( totalBounds ) ; IRenderingElement diagram = reactionSetRenderer . generateDiagram ( reactionSet ) ; this . paint ( drawVisitor , diagram ) ; return this . convertToDiagramBounds ( totalBounds ) ; } if ( moleculeSet != null && reactionSet == null ) { Rectangle2D totalBounds = calculateBounds ( moleculeSet ) ; this . setupTransformNatural ( totalBounds ) ; IRenderingElement diagram = moleculeSetRenderer . generateDiagram ( moleculeSet ) ; this . paint ( drawVisitor , diagram ) ; return this . convertToDiagramBounds ( totalBounds ) ; } if ( moleculeSet != null && reactionSet != null ) { Rectangle2D totalBounds = BoundsCalculator . calculateBounds ( chemModel ) ; this . setupTransformNatural ( totalBounds ) ; ElementGroup diagram = new ElementGroup ( ) ; diagram . add ( reactionSetRenderer . generateDiagram ( reactionSet ) ) ; diagram . add ( moleculeSetRenderer . generateDiagram ( moleculeSet ) ) ; this . paint ( drawVisitor , diagram ) ; return this . convertToDiagramBounds ( totalBounds ) ; } return new Rectangle ( 0 , 0 , 0 , 0 ) ; }
Paint an IChemModel using the IDrawVisitor at a scale determined by the bond length in RendererModel .
29,116
public void paint ( IChemModel chemModel , IDrawVisitor drawVisitor , Rectangle2D bounds , boolean resetCenter ) { IAtomContainerSet moleculeSet = chemModel . getMoleculeSet ( ) ; IReactionSet reactionSet = chemModel . getReactionSet ( ) ; if ( moleculeSet == null || reactionSet != null ) { if ( reactionSet != null ) { reactionSetRenderer . paint ( reactionSet , drawVisitor , bounds , resetCenter ) ; } return ; } Rectangle2D modelBounds = BoundsCalculator . calculateBounds ( moleculeSet ) ; this . setupTransformToFit ( bounds , modelBounds , AverageBondLengthCalculator . calculateAverageBondLength ( chemModel ) , resetCenter ) ; IRenderingElement diagram = moleculeSetRenderer . generateDiagram ( moleculeSet ) ; this . paint ( drawVisitor , diagram ) ; }
Paint a ChemModel .
29,117
public Rectangle calculateDiagramBounds ( IChemModel model ) { IAtomContainerSet moleculeSet = model . getMoleculeSet ( ) ; IReactionSet reactionSet = model . getReactionSet ( ) ; if ( ( moleculeSet == null && reactionSet == null ) ) { return new Rectangle ( ) ; } Rectangle2D moleculeBounds = null ; Rectangle2D reactionBounds = null ; if ( moleculeSet != null ) { moleculeBounds = BoundsCalculator . calculateBounds ( moleculeSet ) ; } if ( reactionSet != null ) { reactionBounds = BoundsCalculator . calculateBounds ( reactionSet ) ; } if ( moleculeBounds == null ) { return this . calculateScreenBounds ( reactionBounds ) ; } else if ( reactionBounds == null ) { return this . calculateScreenBounds ( moleculeBounds ) ; } else { Rectangle2D allbounds = new Rectangle2D . Double ( ) ; Rectangle2D . union ( moleculeBounds , reactionBounds , allbounds ) ; return this . calculateScreenBounds ( allbounds ) ; } }
Given a chem model calculates the bounding rectangle in screen space .
29,118
public void addAtom ( IPDBAtom oAtom , IMonomer oMonomer , IStrand oStrand ) { super . addAtom ( oAtom , oMonomer , oStrand ) ; if ( ! sequentialListOfMonomers . contains ( oMonomer . getMonomerName ( ) ) ) sequentialListOfMonomers . add ( oMonomer . getMonomerName ( ) ) ; }
Adds the IPDBAtom oAtom to a specified Monomer of a specified Strand . Additionally it keeps record of the iCode .
29,119
public DescriptorValue calculate ( IAtom atom , IAtomContainer container ) { int atomValence = AtomValenceTool . getValence ( atom ) ; return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new IntegerResult ( atomValence ) , getDescriptorNames ( ) ) ; }
This method calculates the valence of an atom .
29,120
private static void addGeometricConfiguration ( IDoubleBondStereochemistry dbs , int flavour , GraphBuilder gb , Map < IAtom , Integer > indices ) { IBond db = dbs . getStereoBond ( ) ; IBond [ ] bs = dbs . getBonds ( ) ; if ( SmiFlavor . isSet ( flavour , SmiFlavor . UseAromaticSymbols ) && db . getFlag ( CDKConstants . ISAROMATIC ) ) return ; int u = indices . get ( db . getBegin ( ) ) ; int v = indices . get ( db . getEnd ( ) ) ; int x = indices . get ( bs [ 0 ] . getOther ( db . getBegin ( ) ) ) ; int y = indices . get ( bs [ 1 ] . getOther ( db . getEnd ( ) ) ) ; if ( dbs . getStereo ( ) == TOGETHER ) { gb . geometric ( u , v ) . together ( x , y ) ; } else { gb . geometric ( u , v ) . opposite ( x , y ) ; } }
Add double - bond stereo configuration to the Beam GraphBuilder .
29,121
private static void addTetrahedralConfiguration ( ITetrahedralChirality tc , GraphBuilder gb , Map < IAtom , Integer > indices ) { IAtom [ ] ligands = tc . getLigands ( ) ; int u = indices . get ( tc . getChiralAtom ( ) ) ; int vs [ ] = new int [ ] { indices . get ( ligands [ 0 ] ) , indices . get ( ligands [ 1 ] ) , indices . get ( ligands [ 2 ] ) , indices . get ( ligands [ 3 ] ) } ; gb . tetrahedral ( u ) . lookingFrom ( vs [ 0 ] ) . neighbors ( vs [ 1 ] , vs [ 2 ] , vs [ 3 ] ) . winding ( tc . getStereo ( ) == CLOCKWISE ? Configuration . CLOCKWISE : Configuration . ANTI_CLOCKWISE ) . build ( ) ; }
Add tetrahedral stereo configuration to the Beam GraphBuilder .
29,122
private static void addExtendedTetrahedralConfiguration ( ExtendedTetrahedral et , GraphBuilder gb , Map < IAtom , Integer > indices ) { IAtom [ ] ligands = et . peripherals ( ) ; int u = indices . get ( et . focus ( ) ) ; int vs [ ] = new int [ ] { indices . get ( ligands [ 0 ] ) , indices . get ( ligands [ 1 ] ) , indices . get ( ligands [ 2 ] ) , indices . get ( ligands [ 3 ] ) } ; gb . extendedTetrahedral ( u ) . lookingFrom ( vs [ 0 ] ) . neighbors ( vs [ 1 ] , vs [ 2 ] , vs [ 3 ] ) . winding ( et . winding ( ) == CLOCKWISE ? Configuration . CLOCKWISE : Configuration . ANTI_CLOCKWISE ) . build ( ) ; }
Add extended tetrahedral stereo configuration to the Beam GraphBuilder .
29,123
private int determineCharge ( IAtomContainer mol , IAtom atom ) { Integer q = atom . getFormalCharge ( ) ; if ( q == null ) q = 0 ; switch ( q ) { case - 3 : return 7 ; case - 2 : return 6 ; case - 1 : return 5 ; case 0 : if ( mol . getConnectedSingleElectronsCount ( atom ) == 1 ) return 4 ; return 0 ; case + 1 : return 3 ; case + 2 : return 2 ; case + 3 : return 1 ; } return 0 ; }
4 = doublet radical 5 = - 1 6 = - 2 7 = - 3
29,124
protected static String formatMDLInt ( int x , int n ) { char [ ] buf = new char [ n ] ; Arrays . fill ( buf , ' ' ) ; String val = Integer . toString ( x ) ; if ( val . length ( ) > n ) val = "0" ; int off = n - val . length ( ) ; for ( int i = 0 ; i < val . length ( ) ; i ++ ) buf [ off + i ] = val . charAt ( i ) ; return new String ( buf ) ; }
Formats an integer to fit into the connection table and changes it to a String .
29,125
protected static String formatMDLFloat ( float fl ) { String s = "" , fs = "" ; int l ; NumberFormat nf = NumberFormat . getNumberInstance ( Locale . ENGLISH ) ; nf . setMinimumIntegerDigits ( 1 ) ; nf . setMaximumIntegerDigits ( 4 ) ; nf . setMinimumFractionDigits ( 4 ) ; nf . setMaximumFractionDigits ( 4 ) ; nf . setGroupingUsed ( false ) ; if ( Double . isNaN ( fl ) || Double . isInfinite ( fl ) ) s = "0.0000" ; else s = nf . format ( fl ) ; l = 10 - s . length ( ) ; for ( int f = 0 ; f < l ; f ++ ) fs += " " ; fs += s ; return fs ; }
Formats a float to fit into the connectiontable and changes it to a String .
29,126
protected static String formatMDLString ( String s , int le ) { s = s . trim ( ) ; if ( s . length ( ) > le ) return s . substring ( 0 , le ) ; int l ; l = le - s . length ( ) ; for ( int f = 0 ; f < l ; f ++ ) s += " " ; return s ; }
Formats a String to fit into the connectiontable .
29,127
public void setParameters ( Object [ ] params ) throws CDKException { if ( params . length > 1 ) { throw new CDKException ( "BondCount only expects one parameter" ) ; } if ( ! ( params [ 0 ] instanceof String ) ) { throw new CDKException ( "The parameter must be of type IBond.Order" ) ; } String bondType = ( String ) params [ 0 ] ; if ( bondType . length ( ) > 1 || ! "sdtq" . contains ( bondType ) ) { throw new CDKException ( "The only allowed values for this parameter are 's', 'd', 't', 'q' and ''." ) ; } order = bondType ; }
Sets the parameters attribute of the BondCountDescriptor object
29,128
public DescriptorValue calculate ( IAtomContainer container ) { if ( order . equals ( "" ) ) { int bondCount = 0 ; for ( IBond bond : container . bonds ( ) ) { boolean hasHydrogen = false ; for ( int i = 0 ; i < bond . getAtomCount ( ) ; i ++ ) { if ( bond . getAtom ( i ) . getSymbol ( ) . equals ( "H" ) ) { hasHydrogen = true ; break ; } } if ( ! hasHydrogen ) bondCount ++ ; } return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new IntegerResult ( bondCount ) , getDescriptorNames ( ) , null ) ; } int bondCount = 0 ; for ( IBond bond : container . bonds ( ) ) { if ( bondMatch ( bond . getOrder ( ) , order ) ) { bondCount += 1 ; } } return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new IntegerResult ( bondCount ) , getDescriptorNames ( ) ) ; }
This method calculate the number of bonds of a given type in an atomContainer
29,129
public Vector sub ( Vector b ) { if ( ( b == null ) || ( size != b . size ) ) return null ; int i ; Vector result = new Vector ( size ) ; for ( i = 0 ; i < size ; i ++ ) result . vector [ i ] = vector [ i ] - b . vector [ i ] ; return result ; }
Subtraktion from two vectors
29,130
public Vector mul ( double b ) { Vector result = new Vector ( size ) ; int i ; for ( i = 0 ; i < size ; i ++ ) result . vector [ i ] = vector [ i ] * b ; return result ; }
Multiplikation from a vectors with an double
29,131
private void extractMechanism ( EntryReact entry ) { String mechanismName = "org.openscience.cdk.reaction.mechanism." + entry . getMechanism ( ) ; try { mechanism = ( IReactionMechanism ) this . getClass ( ) . getClassLoader ( ) . loadClass ( mechanismName ) . newInstance ( ) ; logger . info ( "Loaded mechanism: " , mechanismName ) ; } catch ( ClassNotFoundException exception ) { logger . error ( "Could not find this IReactionMechanism: " , mechanismName ) ; logger . debug ( exception ) ; } catch ( InstantiationException | IllegalAccessException exception ) { logger . error ( "Could not load this IReactionMechanism: " , mechanismName ) ; logger . debug ( exception ) ; } }
Extract the mechanism necessary for this reaction .
29,132
private EntryReact initiateDictionary ( String nameDict , IReactionProcess reaction ) { DictionaryDatabase db = new DictionaryDatabase ( ) ; dictionary = db . getDictionary ( nameDict ) ; String entryString = reaction . getSpecification ( ) . getSpecificationReference ( ) ; entryString = entryString . substring ( entryString . indexOf ( '#' ) + 1 , entryString . length ( ) ) ; return ( EntryReact ) dictionary . getEntry ( entryString . toLowerCase ( ) ) ; }
Open the Dictionary OWLReact .
29,133
private void initiateParameterMap2 ( EntryReact entry ) { List < List < String > > paramDic = entry . getParameterClass ( ) ; paramsMap2 = new ArrayList < IParameterReact > ( ) ; for ( Iterator < List < String > > it = paramDic . iterator ( ) ; it . hasNext ( ) ; ) { List < String > param = it . next ( ) ; String paramName = "org.openscience.cdk.reaction.type.parameters." + param . get ( 0 ) ; try { IParameterReact ipc = ( IParameterReact ) this . getClass ( ) . getClassLoader ( ) . loadClass ( paramName ) . newInstance ( ) ; ipc . setParameter ( Boolean . parseBoolean ( param . get ( 1 ) ) ) ; ipc . setValue ( param . get ( 2 ) ) ; logger . info ( "Loaded parameter class: " , paramName ) ; paramsMap2 . add ( ipc ) ; } catch ( ClassNotFoundException exception ) { logger . error ( "Could not find this IParameterReact: " , paramName ) ; logger . debug ( exception ) ; } catch ( InstantiationException | IllegalAccessException exception ) { logger . error ( "Could not load this IParameterReact: " , paramName ) ; logger . debug ( exception ) ; } } }
Creates a map with the name and type of the parameters .
29,134
public IParameterReact getParameterClass ( Class < ? > paramClass ) { for ( Iterator < IParameterReact > it = paramsMap2 . iterator ( ) ; it . hasNext ( ) ; ) { IParameterReact ipr = it . next ( ) ; if ( ipr . getClass ( ) . equals ( paramClass ) ) return ipr ; } return null ; }
Return the IParameterReact if it exists given the class .
29,135
private String getCTAB ( IAtomContainer atomContainer ) throws CDKException { StringWriter strWriter = new StringWriter ( ) ; MDLV2000Writer mdlWriter = new MDLV2000Writer ( strWriter ) ; mdlWriter . write ( atomContainer ) ; try { mdlWriter . close ( ) ; } catch ( IOException exception ) { } String ctab = strWriter . toString ( ) ; for ( int line = 1 ; line <= 3 ; line ++ ) { ctab = ctab . substring ( ctab . indexOf ( LSEP ) + ( LSEP . length ( ) ) ) ; } return ctab ; }
Produces a CTAB block for an atomContainer without the header lines .
29,136
@ SuppressWarnings ( "unchecked" ) public Paging < PlaylistTrack > execute ( ) throws IOException , SpotifyWebApiException { return new PlaylistTrack . JsonUtil ( ) . createModelObjectPaging ( getJson ( ) ) ; }
Get a playlist s tracks .
29,137
public static String concat ( String [ ] parts , char character ) { StringBuilder stringBuilder = new StringBuilder ( ) ; for ( String part : parts ) { stringBuilder . append ( part ) . append ( character ) ; } stringBuilder . deleteCharAt ( stringBuilder . length ( ) - 1 ) ; return stringBuilder . toString ( ) ; }
String concatenation helper method .
29,138
public AuthorizationCodeRefreshRequest . Builder authorizationCodeRefresh ( ) { return new AuthorizationCodeRefreshRequest . Builder ( clientId , clientSecret ) . setDefaults ( httpManager , scheme , host , port ) . grant_type ( "refresh_token" ) . refresh_token ( refreshToken ) ; }
Refresh the access token by using authorization code grant .
29,139
public GetAlbumRequest . Builder getAlbum ( String id ) { return new GetAlbumRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . id ( id ) ; }
Returns an album with the ID given below .
29,140
public GetAlbumsTracksRequest . Builder getAlbumsTracks ( String id ) { return new GetAlbumsTracksRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . id ( id ) ; }
Returns the tracks of the album with the ID given below .
29,141
public GetSeveralAlbumsRequest . Builder getSeveralAlbums ( String ... ids ) { return new GetSeveralAlbumsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . ids ( concat ( ids , ',' ) ) ; }
Get multiple albums .
29,142
public GetArtistRequest . Builder getArtist ( String id ) { return new GetArtistRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . id ( id ) ; }
Get an artist .
29,143
public GetArtistsAlbumsRequest . Builder getArtistsAlbums ( String id ) { return new GetArtistsAlbumsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . id ( id ) ; }
Get the albums of a specific artist .
29,144
public GetArtistsTopTracksRequest . Builder getArtistsTopTracks ( String id , CountryCode country ) { return new GetArtistsTopTracksRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . id ( id ) . country ( country ) ; }
Get the top tracks of an artist in a specific country .
29,145
public GetSeveralArtistsRequest . Builder getSeveralArtists ( String ... ids ) { return new GetSeveralArtistsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . ids ( concat ( ids , ',' ) ) ; }
Get multiple artists .
29,146
public GetCategoryRequest . Builder getCategory ( String category_id ) { return new GetCategoryRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . category_id ( category_id ) ; }
Get a category .
29,147
public GetCategorysPlaylistsRequest . Builder getCategorysPlaylists ( String category_id ) { return new GetCategorysPlaylistsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . category_id ( category_id ) ; }
Get the playlists from a specific category .
29,148
public GetListOfCategoriesRequest . Builder getListOfCategories ( ) { return new GetListOfCategoriesRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Get a list of categories .
29,149
public GetListOfFeaturedPlaylistsRequest . Builder getListOfFeaturedPlaylists ( ) { return new GetListOfFeaturedPlaylistsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Get Featured Playlists of different countries which may match a specific language .
29,150
public GetListOfNewReleasesRequest . Builder getListOfNewReleases ( ) { return new GetListOfNewReleasesRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Get the newest releases from a specific country .
29,151
public GetRecommendationsRequest . Builder getRecommendations ( ) { return new GetRecommendationsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Create a playlist - style listening experience based on seed artists tracks and genres .
29,152
public GetAvailableGenreSeedsRequest . Builder getAvailableGenreSeeds ( ) { return new GetAvailableGenreSeedsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Retrieve a list of available genres seed parameter values for recommendations .
29,153
public CheckCurrentUserFollowsArtistsOrUsersRequest . Builder checkCurrentUserFollowsArtistsOrUsers ( ModelObjectType type , String [ ] ids ) { return new CheckCurrentUserFollowsArtistsOrUsersRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . type ( type ) . ids ( concat ( ids , ',' ) ) ; }
Check to see if the current user is following one or more artists or other Spotify users .
29,154
public CheckUsersFollowPlaylistRequest . Builder checkUsersFollowPlaylist ( String owner_id , String playlist_id , String [ ] ids ) { return new CheckUsersFollowPlaylistRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . owner_id ( owner_id ) . playlist_id ( playlist_id ) . ids ( concat ( ids , ',' ) ) ; }
Check to see if one or more Spotify users are following a specified playlist .
29,155
public FollowArtistsOrUsersRequest . Builder followArtistsOrUsers ( ModelObjectType type , String [ ] ids ) { return new FollowArtistsOrUsersRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . type ( type ) . ids ( concat ( ids , ',' ) ) ; }
Add the current user as a follower of one or more artists or other Spotify users .
29,156
public FollowPlaylistRequest . Builder followPlaylist ( String owner_id , String playlist_id , boolean public_ ) { return new FollowPlaylistRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . owner_id ( owner_id ) . playlist_id ( playlist_id ) . public_ ( public_ ) ; }
Add the current user as a follower of a playlist .
29,157
public UnfollowArtistsOrUsersRequest . Builder unfollowArtistsOrUsers ( ModelObjectType type , String [ ] ids ) { return new UnfollowArtistsOrUsersRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . type ( type ) . ids ( concat ( ids , ',' ) ) ; }
Remove the current user as a follower of one or more artists or other Spotify users .
29,158
public UnfollowPlaylistRequest . Builder unfollowPlaylist ( String owner_id , String playlist_id ) { return new UnfollowPlaylistRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . owner_id ( owner_id ) . playlist_id ( playlist_id ) ; }
Remove the current user as a follower of a playlist .
29,159
public GetUsersSavedTracksRequest . Builder getUsersSavedTracks ( ) { return new GetUsersSavedTracksRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Get an users Your Music tracks .
29,160
public RemoveAlbumsForCurrentUserRequest . Builder removeAlbumsForCurrentUser ( String ... ids ) { return new RemoveAlbumsForCurrentUserRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . ids ( concat ( ids , ',' ) ) ; }
Remove one or more albums from the current users Your Music library .
29,161
public RemoveUsersSavedTracksRequest . Builder removeUsersSavedTracks ( String ... ids ) { return new RemoveUsersSavedTracksRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . ids ( concat ( ids , ',' ) ) ; }
Remove a track if saved to the users Your Music library .
29,162
public GetUsersTopArtistsRequest . Builder getUsersTopArtists ( ) { return new GetUsersTopArtistsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Get the current users top artists based on calculated affinity .
29,163
public GetUsersTopTracksRequest . Builder getUsersTopTracks ( ) { return new GetUsersTopTracksRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Get the current users top tracks based on calculated affinity .
29,164
public GetInformationAboutUsersCurrentPlaybackRequest . Builder getInformationAboutUsersCurrentPlayback ( ) { return new GetInformationAboutUsersCurrentPlaybackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Get information about the users current playback state including track track progress and active device .
29,165
public GetUsersAvailableDevicesRequest . Builder getUsersAvailableDevices ( ) { return new GetUsersAvailableDevicesRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Get information about an users available devices .
29,166
public GetUsersCurrentlyPlayingTrackRequest . Builder getUsersCurrentlyPlayingTrack ( ) { return new GetUsersCurrentlyPlayingTrackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Get the object currently being played on the users Spotify account .
29,167
public PauseUsersPlaybackRequest . Builder pauseUsersPlayback ( ) { return new PauseUsersPlaybackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Pause playback on the users account .
29,168
public SeekToPositionInCurrentlyPlayingTrackRequest . Builder seekToPositionInCurrentlyPlayingTrack ( int position_ms ) { return new SeekToPositionInCurrentlyPlayingTrackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . position_ms ( position_ms ) ; }
Seeks to the given position in the users currently playing track .
29,169
public SetRepeatModeOnUsersPlaybackRequest . Builder setRepeatModeOnUsersPlayback ( String state ) { return new SetRepeatModeOnUsersPlaybackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . state ( state ) ; }
Set the repeat mode for the users playback . Options are repeat - track repeat - context and off .
29,170
public SetVolumeForUsersPlaybackRequest . Builder setVolumeForUsersPlayback ( int volume_percent ) { return new SetVolumeForUsersPlaybackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . volume_percent ( volume_percent ) ; }
Set the volume for the users current playback device .
29,171
public SkipUsersPlaybackToNextTrackRequest . Builder skipUsersPlaybackToNextTrack ( ) { return new SkipUsersPlaybackToNextTrackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Skips to next track in the users queue .
29,172
public StartResumeUsersPlaybackRequest . Builder startResumeUsersPlayback ( ) { return new StartResumeUsersPlaybackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Start a new context or resume current playback on the users active device .
29,173
public ToggleShuffleForUsersPlaybackRequest . Builder toggleShuffleForUsersPlayback ( boolean state ) { return new ToggleShuffleForUsersPlaybackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . state ( state ) ; }
Toggle shuffle on or off for users playback .
29,174
public TransferUsersPlaybackRequest . Builder transferUsersPlayback ( JsonArray device_ids ) { return new TransferUsersPlaybackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . device_ids ( device_ids ) ; }
Transfer playback to a new device and determine if it should start playing .
29,175
public AddTracksToPlaylistRequest . Builder addTracksToPlaylist ( String user_id , String playlist_id , String [ ] uris ) { return new AddTracksToPlaylistRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . user_id ( user_id ) . playlist_id ( playlist_id ) . uris ( concat ( uris , ',' ) ) ; }
Add tracks to a playlist .
29,176
public ChangePlaylistsDetailsRequest . Builder changePlaylistsDetails ( String user_id , String playlist_id ) { return new ChangePlaylistsDetailsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . user_id ( user_id ) . playlist_id ( playlist_id ) ; }
Update a playlists properties .
29,177
public CreatePlaylistRequest . Builder createPlaylist ( String user_id , String name ) { return new CreatePlaylistRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . user_id ( user_id ) . name ( name ) ; }
Create a playlist .
29,178
public GetListOfCurrentUsersPlaylistsRequest . Builder getListOfCurrentUsersPlaylists ( ) { return new GetListOfCurrentUsersPlaylistsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) ; }
Get a list of the playlists owned or followed by the current Spotify user .
29,179
public GetListOfUsersPlaylistsRequest . Builder getListOfUsersPlaylists ( String user_id ) { return new GetListOfUsersPlaylistsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . user_id ( user_id ) ; }
Get an users playlists .
29,180
public GetPlaylistRequest . Builder getPlaylist ( String user_id , String playlist_id ) { return new GetPlaylistRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . user_id ( user_id ) . playlist_id ( playlist_id ) ; }
Get a playlist .
29,181
public GetPlaylistCoverImageRequest . Builder getPlaylistCoverImage ( String user_id , String playlist_id ) { return new GetPlaylistCoverImageRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . user_id ( user_id ) . playlist_id ( playlist_id ) ; }
Get the image used to represent a specific playlist .
29,182
public GetPlaylistsTracksRequest . Builder getPlaylistsTracks ( String playlist_id ) { return new GetPlaylistsTracksRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . playlist_id ( playlist_id ) ; }
Get a playlists tracks .
29,183
public RemoveTracksFromPlaylistRequest . Builder removeTracksFromPlaylist ( String user_id , String playlist_id , JsonArray tracks ) { return new RemoveTracksFromPlaylistRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . user_id ( user_id ) . playlist_id ( playlist_id ) . tracks ( tracks ) ; }
Delete tracks from a playlist
29,184
public ReplacePlaylistsTracksRequest . Builder replacePlaylistsTracks ( String playlist_id , JsonArray uris ) { return new ReplacePlaylistsTracksRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . playlist_id ( playlist_id ) . uris ( uris ) ; }
Replace tracks in a playlist .
29,185
public UploadCustomPlaylistCoverImageRequest . Builder uploadCustomPlaylistCoverImage ( String user_id , String playlist_id ) { return new UploadCustomPlaylistCoverImageRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . user_id ( user_id ) . playlist_id ( playlist_id ) ; }
Replace the image used to represent a specific playlist .
29,186
public SearchItemRequest . Builder searchItem ( String q , String type ) { return new SearchItemRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . q ( q ) . type ( type ) ; }
Get Spotify catalog information about artists albums tracks or playlists that match a keyword string .
29,187
public SearchAlbumsRequest . Builder searchAlbums ( String q ) { return new SearchAlbumsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . q ( q ) ; }
Get Spotify catalog information about albums that match a keyword string .
29,188
public SearchArtistsRequest . Builder searchArtists ( String q ) { return new SearchArtistsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . q ( q ) ; }
Get Spotify catalog information about artists that match a keyword string .
29,189
public SearchPlaylistsRequest . Builder searchPlaylists ( String q ) { return new SearchPlaylistsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . q ( q ) ; }
Get Spotify catalog information about playlists that match a keyword string .
29,190
public SearchTracksRequest . Builder searchTracks ( String q ) { return new SearchTracksRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . q ( q ) ; }
Get Spotify catalog information about tracks that match a keyword string .
29,191
public GetAudioAnalysisForTrackRequest . Builder getAudioAnalysisForTrack ( String id ) { return new GetAudioAnalysisForTrackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . id ( id ) ; }
Get a detailed audio analysis for a single track identified by its unique Spotify ID .
29,192
public GetAudioFeaturesForTrackRequest . Builder getAudioFeaturesForTrack ( String id ) { return new GetAudioFeaturesForTrackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . id ( id ) ; }
Get audio features for a track based on its Spotify ID .
29,193
public GetAudioFeaturesForSeveralTracksRequest . Builder getAudioFeaturesForSeveralTracks ( String ... ids ) { return new GetAudioFeaturesForSeveralTracksRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . ids ( concat ( ids , ',' ) ) ; }
Get audio features for multiple tracks based on their Spotify IDs .
29,194
public GetSeveralTracksRequest . Builder getSeveralTracks ( String ... ids ) { return new GetSeveralTracksRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . ids ( concat ( ids , ',' ) ) ; }
Get multiple tracks .
29,195
public GetTrackRequest . Builder getTrack ( String id ) { return new GetTrackRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . id ( id ) ; }
Get a track .
29,196
public GetUsersProfileRequest . Builder getUsersProfile ( String user_id ) { return new GetUsersProfileRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . user_id ( user_id ) ; }
Get public profile information about a Spotify user .
29,197
@ SuppressWarnings ( "unchecked" ) public Paging < SavedAlbum > execute ( ) throws IOException , SpotifyWebApiException { return new SavedAlbum . JsonUtil ( ) . createModelObjectPaging ( getJson ( ) ) ; }
Get the saved albums of the current user .
29,198
@ SuppressWarnings ( "unchecked" ) public PagingCursorbased < Artist > execute ( ) throws IOException , SpotifyWebApiException { return new Artist . JsonUtil ( ) . createModelObjectPagingCursorbased ( getJson ( ) , "artists" ) ; }
Get a list of artists the user is following .
29,199
@ SuppressWarnings ( "unchecked" ) public Paging < PlaylistSimplified > execute ( ) throws IOException , SpotifyWebApiException { return new PlaylistSimplified . JsonUtil ( ) . createModelObjectPaging ( getJson ( ) , "playlists" ) ; }
Search for playlists .