id
stringlengths
36
36
text
stringlengths
1
1.25M
eaf6633b-23c8-4d61-8b56-237aafed7eb7
public static int LCS(String a,String b) { int Rows = a.length()+1; int Cols = b.length()+1; dp = new int[Rows][Cols]; for(int i = 0;i<=a.length();i++) { dp[i][0] = 0; } for(int i = 0;i<=b.length();i++) { dp[0][i] = 0; }...
a3202390-66ea-4783-b428-db0eee4ce5f0
public static String backTrace(String a,String b,int i,int j) { if(i ==0 || j==0) return ""; else if(a.charAt(i-1) == b.charAt(j-1)) return backTrace(a, b, i-1, j-1) + a.charAt(i-1); else { if(dp[i][j-1] > dp[i-1][j]) return backTra...
b2ec1ae1-1e59-4adb-b4d5-fbcdb9403d29
public static void Print(int dp[][]) { for(int i = 0;i<3;i++) { for(int j = 0;j<3;j++) { System.out.print(dp[i][j] + " "); } System.out.println(); } }
a9d8beb4-6e6b-4aac-97ff-6249dfbc4e80
public static void main(String [] agrs) { System.out.println(LCS("abcwf","abcwf")); }
30393592-c208-4719-b9e9-5985abb5c375
public static int[] merge(int[] a,int[] b) { int []c = new int[a.length+b.length]; int coffset = 0; int aoffset = 0; int boffset = 0; while (aoffset<a.length && boffset < b.length) { if(a[aoffset] < b[boffset]) { c[coffset++] = ...
c95c9c3d-21a7-413c-a5c9-58a252b77401
public static void recursiveMerger(List<Integer[]> l) { if(l.size() == 0) { } }
422f2615-4779-40d2-a386-7e4a4029e942
public static void main(String [] args) { int [] a = {2,4,6,8,10,12,14,16,18}; int [] b = {1,3,5,7,9}; List<Integer[]> l = new LinkedList<Integer[]>(); System.out.println(Arrays.toString(merge(a, b))); }
1798d738-ca59-4886-89da-f844960ffe5d
public Album(int codeAlbum,String nom, Set<Chanson> chansons) { super(); this.codeAlbum=codeAlbum; this.nom = nom; this.chansons = chansons; }
a3bb5560-e95d-4438-a34b-6c5491418748
public Album(){ super(); this.chansons=new HashSet<Chanson>(); }
19c097f2-075b-4764-9660-8bd43a6f5067
public void addChanson(Chanson toAdd){ toAdd.setAlbum(this); this.chansons.add(toAdd); }
69958180-4232-4c55-88a8-0aeb0975eac3
public int getCodeAlbum() { return codeAlbum; }
d26fa041-67e1-430f-99d9-8c3f0073394f
public void setCodeAlbum(int codeAlbum) { this.codeAlbum = codeAlbum; }
16f08005-c2cd-4a2b-b8c1-9c91376bfa77
public int getId() { return id; }
740c4972-1e8d-4c30-8ff8-8528e592e6e4
public void setId(int id) { this.id = id; }
baa3bf74-d3f0-48fc-967d-7f8291f2a1ea
public String getNom() { return nom; }
c0711655-661d-4ee9-8f4e-d524001da7fb
public void setNom(String nom) { this.nom = nom; }
86a1032f-32c4-42e3-9e58-fbdc7fff9c4b
public Set<Chanson> getChansons() { return chansons; }
62192b4a-73d0-4fbd-acaa-fc8a90afd708
public void setChansons(Set<Chanson> chansons) { this.chansons = chansons; }
14796c3e-ff0e-499d-8be4-3e9372fb664e
public int getARTISTEID() { return ARTISTEID; }
208f7262-6ece-45bf-b3d2-24e3ccad4984
public void setARTISTEID(int aRTISTEID) { ARTISTEID = aRTISTEID; }
3064aaa2-64a9-491d-aab2-b729e6f6b27d
public Artiste getArt() { return art; }
2ae7b1b7-2a7b-442d-a253-1edc6f766c77
public void setArt(Artiste art) { this.art = art; }
5966ea84-5943-4a38-af03-2fd6c92c1392
public Chanson(int codeChanson,String nom, int duree) { super(); this.codeChanson=codeChanson; this.nom = nom; this.duree = duree; }
26e4b4b3-3b32-4cdb-8f86-3a5688bd3105
public Chanson() { super(); }
cf539293-4afc-4cc7-86d0-21ab75b79705
public int getCodeChanson() { return codeChanson; }
1ab3c4c3-f461-424f-ad47-616dbd25e407
public void setCodeChanson(int codeChanson) { this.codeChanson = codeChanson; }
e31924e9-cd16-440f-9d5b-997632c97122
public int getId() { return id; }
44b162ce-7aa8-4e08-8427-a20c2a49a3a9
public void setId(int id) { this.id = id; }
465feae2-8ca3-4f18-a73e-f6ed0bcc930b
public String getNom() { return nom; }
9c6ae1a2-3e6f-4f78-b714-780f8e2e95b2
public void setNom(String nom) { this.nom = nom; }
f736c752-0178-42aa-b368-7e2f2d93b13c
public int getDuree() { return duree; }
55992489-b121-48e8-8525-37bbc20b945e
public void setDuree(int duree) { this.duree = duree; }
8d0bdc80-a2b5-4d46-a9b7-0b0069efc5c1
public int getALBUMID() { return ALBUMID; }
c6a4226d-421c-48ad-835d-aa24e8f9bdac
public void setALBUMID(int aLBUMID) { ALBUMID = aLBUMID; }
41b03df1-fca3-4cce-9f8c-c7411f0c1d1d
public Album getAlbum() { return album; }
3679f85a-567e-4351-8633-1828c2c80510
public void setAlbum(Album album) { this.album = album; }
9449814f-1fba-404c-a0db-02af3fa9c0e8
public Artiste(int codeArtiste,String nom, Set<Album> albums) { super(); this.codeArtiste=codeArtiste; this.nom = nom; this.albums = albums; }
50dceda6-0cc1-4562-b831-4bbb71610a54
public Artiste() { super(); this.albums=new HashSet<Album>(); }
db21b01e-d1e5-4861-b101-834ed4f7470c
public void addAlbum(Album toAdd){ this.albums.add(toAdd); }
5b36012a-af29-4493-ac64-d128f848ab60
public int getCodeArtiste() { return codeArtiste; }
79f5ac32-9023-46b2-84e7-338f86ce4cca
public void setCodeArtiste(int codeArtiste) { this.codeArtiste = codeArtiste; }
ed5ae709-f643-4c1e-ab18-3270a54faa0b
public int getId() { return id; }
06e75cbc-3363-4506-a1b1-12672a750e85
public void setId(int id) { this.id = id; }
b29ad73c-1017-4c61-88e0-68b8559b03ed
public String getNom() { return nom; }
409697fe-e0bd-4289-81e9-beeea8dda212
public void setNom(String nom) { this.nom = nom; }
a5060609-f6e1-4d2d-80f1-63e48ddc51d7
public Set<Album> getAlbums() { return albums; }
d860d2d1-d255-48c0-83eb-6c7ff1abdc26
public void setAlbums(Set<Album> albums) { this.albums = albums; }
b5c45526-51c9-419a-b84f-3248d45205f1
public IndexControlleur() { // TODO Auto-generated constructor stub }
77d22d8a-5805-438b-b197-fdc0b9ac55f4
@RequestMapping(value="/",method=RequestMethod.GET) public String index(){ return "index"; }
c42c81b5-5ad9-4184-a927-3d21801775a7
public ChansonControlleur() { // TODO Auto-generated constructor stub }
2446e9c1-0620-472b-ac99-44540552be9b
@RequestMapping(value="/chanson",method = RequestMethod.GET) public String returnArtiste(@RequestParam(value="id") int id, Model mod){ mod.addAttribute("chanson",cService.findChanson(id)); return "chanson"; }
d90eccf4-634e-4980-b855-5756082a3413
@RequestMapping(value="/addChanson", method=RequestMethod.GET) public String returnChanson(Model mod){ mod.addAttribute("chanson", new Chanson()); return "createChanson"; }
bdba5c06-9f11-492d-9960-2011eb0e0998
@RequestMapping(value="/delChanson", method=RequestMethod.GET) public String delChanson(Model mod){ mod.addAttribute("chanson", new Chanson()); return "delChanson"; }
a60c7e68-3a4d-433f-a89d-517aefa86ae2
@RequestMapping(value="/upChanson", method=RequestMethod.GET) public String upChanson(Model mod){ mod.addAttribute("chanson", new Chanson()); return "upChanson"; }
9ee026ff-d385-49d2-bd66-8b995d5be55d
@RequestMapping(value="/addChanson", method=RequestMethod.POST) public String addChanson(@ModelAttribute("chanson")Chanson ch){ cService.createChanson(ch); return "createChanson"; }
f8045e65-e288-45ea-bdba-097743420ea1
@RequestMapping(value="/delChanson", method=RequestMethod.POST) public String delChanson(@ModelAttribute("chanson")Chanson ch){ cService.deleteChanson(ch); return "delChanson"; }
8bef4710-0f4e-4ded-a0f6-e447ccf5cf65
@RequestMapping(value="/upChanson", method=RequestMethod.POST) public String upChanson(@ModelAttribute("chanson")Chanson ch){ cService.updateChanson(ch); System.out.println(ch.getId()); return "upChanson"; }
d0c3fe8e-db63-4e18-b16a-909b3a9cfe1a
public ArtisteControlleur() { // TODO Auto-generated constructor stub }
308a416d-d7a3-43b1-a9b4-a919370fd0c8
@RequestMapping(value="/all",method = RequestMethod.GET) public String returnAllArtiste(ModelMap map){ Collection<Artiste> aList=aServ.findAllArtiste(); map.addAttribute("aList",aList); return "all"; }
5b375bc0-9675-49f7-af97-4c82cd13f1f4
@RequestMapping(value="/artiste",method = RequestMethod.GET) public String returnArtiste(@RequestParam(value="id") int id, Model mod){ mod.addAttribute("artiste",aServ.findArtiste(id)); return "artiste"; }
d253297a-29a4-47fe-a6d1-d41da4036c92
@RequestMapping(value="/delArtiste", method=RequestMethod.GET) public String delArtiste(Model mod){ mod.addAttribute("artiste", new Artiste()); return "delArtiste"; }
f0a8a960-a582-46c6-896e-ce5934a93f4f
@RequestMapping(value="/upArtiste", method=RequestMethod.GET) public String upArtiste(Model mod){ mod.addAttribute("artiste", new Artiste()); return "upArtiste"; }
11b8c220-f6e0-4702-9341-97a59e6cffff
@RequestMapping(value="/addArtiste",method=RequestMethod.GET) public String returnArtiste(Model mod){ mod.addAttribute("artiste",new Artiste()); return "createArtiste"; }
f77a1668-6833-436a-a752-b7d78279bf41
@RequestMapping(value="/addArtiste", method=RequestMethod.POST) public String returnArtiste(@ModelAttribute("artiste")Artiste a){ aServ.createArtiste(a); return "createArtiste"; }
a8a2331a-4134-4338-9642-17d2d0eabc32
@RequestMapping(value="/delArtiste", method=RequestMethod.POST) public String delArtiste(@ModelAttribute("artiste")Artiste a){ aServ.delArtiste(a);; return "delArtiste"; }
431b75ca-c080-42f5-bb60-90e3085c9ae0
@RequestMapping(value="/upArtiste", method=RequestMethod.POST) public String upArtiste(@ModelAttribute("artiste")Artiste a){ aServ.upArtiste(a); return "upArtiste"; }
c1c5c449-a466-4eee-9afd-ed15ffa0270b
public AlbumControlleur() { // TODO Auto-generated constructor stub }
cef5cf05-e228-4c81-9cd1-b344112a658d
@RequestMapping(value="/album",method = RequestMethod.GET) public String returnAlbum(@RequestParam(value="id") int id, Model mod){ mod.addAttribute("album",aServ.findAlbum(id)); return "album"; }
2d2a244e-ff83-4fa5-a94f-392e33ca1bbd
@RequestMapping(value="/addAlbum", method=RequestMethod.GET) public String addAlbum(Model mod){ mod.addAttribute("album", new Album()); return "createAlbum"; }
fe515c30-0b5b-48d7-8d77-5b1167e237c7
@RequestMapping(value="/delAlbum", method=RequestMethod.GET) public String delAlbum(Model mod){ mod.addAttribute("album", new Album()); return "delAlbum"; }
40a3fe55-8113-4a07-9292-1d04c506cc13
@RequestMapping(value="/upAlbum", method=RequestMethod.GET) public String upAlbum(Model mod){ mod.addAttribute("album", new Album()); return "upAlbum"; }
28c3e996-f3f8-4f77-835c-21e0052cf4ee
@RequestMapping(value="/addAlbum", method=RequestMethod.POST) public String addAlbum(@ModelAttribute("album")Album a){ aServ.createAlbum(a); return "createAlbum"; }
6011c809-2b70-44f9-8ccf-6d99e07022c7
@RequestMapping(value="/delAlbum", method=RequestMethod.POST) public String delAlbum(@ModelAttribute("album")Album a){ aServ.delAlbum(a); return "delAlbum"; }
974a8a9a-1511-4056-81a7-7b76ff829b4f
@RequestMapping(value="/upAlbum", method=RequestMethod.POST) public String upAlbum(@ModelAttribute("album")Album a){ aServ.upAlbum(a); return "upAlbum"; }
9f3cecc7-c377-4767-8192-c96d6793920a
public Collection<Artiste> findAllArtiste();
4bce2fd6-bd35-4703-84ce-ad2cc49e9cee
public Artiste findArtiste(Integer id);
3fe19223-948f-49d3-9dfd-5ea526220ec4
public void createArtiste(Artiste art);
e9f18062-9399-4dc2-84f2-e4f6a6881ae5
public void delArtiste(Artiste art);
71e9d1c2-6cb2-498f-b189-a2d800727663
public void upArtiste(Artiste art);
e3a89ae3-4487-476f-9208-b031d6738635
public AlbumDaoImpl() { // TODO Auto-generated constructor stub }
6cb06934-0b07-45f7-b5af-365894677969
@Autowired public void setSessionFactory(SessionFactory s){ //Configuration cfg= new Configuration(); this.sessionFactory=s; }
a8c2b5c7-5c96-41d3-bb67-d45cd27206b6
public static Album findAlbumByName(String name){ Query q=sessionFactory.getCurrentSession().createQuery("from Album A Where A.nom=:name"); q.setString("name",name); return (Album) q.uniqueResult(); }
c805c13a-f4bd-46a0-9cf6-4f3bf3ef1762
@Override public Collection<Album> findAllAlbum() { // TODO Auto-generated method stub return sessionFactory.getCurrentSession().createQuery("from Album").list(); }
cbe45301-c4a2-4d0a-b523-dd7c13672769
@Override public Album findAlbum(Integer id) { // TODO Auto-generated method stub return (Album) this.sessionFactory.getCurrentSession().get(Album.class, id); }
2e5d5265-5e78-400d-9512-c335f18eeaaa
@Override public void createAlbum(Album alb) { // TODO Auto-generated method stub if (alb.getArt()!=null){ if (ArtisteDaoImpl.findArtisteByName(alb.getArt().getNom())==null){ sessionFactory.getCurrentSession().save(alb.getArt()); } else{ Artiste tmp=(Artiste) ArtisteDaoImpl.findArtisteByName(...
1349cb5e-1d38-49d9-b2f3-15c35cf6c502
@Override public void delAlbum(Album alb) { Album a=(Album) sessionFactory.getCurrentSession().get(Album.class, findAlbumByName(alb.getNom()).getId()); if (a!=null){ sessionFactory.getCurrentSession().delete(a); } else{ System.out.println("Album not found"); } }
c6634d0c-a13a-4876-a3f6-a673672438f4
@Override public void upAlbum(Album alb) { Album a=(Album) sessionFactory.getCurrentSession().get(Album.class,alb.getId()); if (a!=null){ if (alb.getNom()!=a.getNom()) a.setNom(alb.getNom()); if (alb.getCodeAlbum()!=a.getCodeAlbum()) a.setCodeAlbum(alb.getCodeAlbum()); sessionFactory.getCurrentSes...
5e344cae-d808-45f8-aa69-7a57cb93f34a
public ChansonDaoImpl() { // TODO Auto-generated constructor stub }
6f7b6848-176e-46fc-a873-74234ee7467f
@Autowired public void setSessionFactory(SessionFactory s){ //Configuration cfg= new Configuration(); this.sessionFactory=s; }
e513b564-dc70-47a0-aca4-0cabb4766e8d
public static Chanson findChansonByName(String name){ Query q=sessionFactory.getCurrentSession().createQuery("from Chanson C Where C.nom=:name"); q.setString("name",name); return (Chanson) q.uniqueResult(); }
d8d5d333-798b-44f2-99ca-7d060aaa6803
@Override public Collection<Chanson> findAllChanson() { // TODO Auto-generated method stub return sessionFactory.getCurrentSession().createQuery("from Chanson").list(); }
527c7e84-f05b-48ff-8a11-a01b0d034d6c
@Override public Chanson findChanson(Integer id) { // TODO Auto-generated method stub return (Chanson) this.sessionFactory.getCurrentSession().get(Chanson.class, id); }
988f044c-f0a0-41d9-9832-e71675962062
@Override public void createChanson(Chanson ch) { // TODO Auto-generated method stub Album a=AlbumDaoImpl.findAlbumByName(ch.getAlbum().getNom()); ch.setAlbum(a); sessionFactory.getCurrentSession().save(ch); }
29366031-d221-4448-bfd5-69692ee8967f
public void deleteChanson(Chanson ch){ Chanson c=(Chanson) sessionFactory.getCurrentSession().get(Chanson.class,this.findChansonByName(ch.getNom()).getId()); if (c!=null){ sessionFactory.getCurrentSession().delete(c); } else{ System.out.println("Song not found"); } }
45f85c29-d243-412c-b244-22ef05340460
public void updateChanson(Chanson ch){ Chanson c=(Chanson) sessionFactory.getCurrentSession().get(Chanson.class,ch.getId()); System.out.println(c.getNom()); if(ch.getNom()!=null&&ch.getNom()!=c.getNom()) c.setNom(ch.getNom()); if(ch.getDuree()!=c.getDuree()) c.setDuree(ch.getDuree()); if(ch.getCodeChans...
6de7cedb-ba2d-47cd-9124-041dc0b1d07d
public Collection<Album> findAllAlbum();
4e420ab2-df37-4a86-985d-377e4584030f
public Album findAlbum(Integer id);
fc200dd6-7416-4e4f-a71c-cb87fc8e89f6
public void createAlbum(Album alb);
7b437cf4-f514-45ad-9e2f-39b1f1ed4813
public void delAlbum(Album alb);
84ab0f23-622f-49e8-b9ae-4769380a527f
public void upAlbum(Album alb);