IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Java Discussion :

Concaténation deux affichages


Sujet :

Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre très actif
    Femme Profil pro
    étudiante chercheuse
    Inscrit en
    Septembre 2013
    Messages
    274
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : étudiante chercheuse
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2013
    Messages : 274
    Par défaut Concaténation deux affichages
    bonjour
    j'en ai 2 fonction d'affichage l'une affiche l’entête d'une matrice appelé "afficheentete " et l'autre affiche le contenu de matrice appelé "affiche contenu" je veux faire une méthode appelé affiche qui affiche le conteu au sein de l’entête .
    le code de la fonction afficheentete est :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    public static void afficheentete()throws JDOMException, IOException
    	{
    		TestXml xml = new TestXml() ; 
    		Element root = xml.getRoot("C:\\Users\\faten\\Desktop\\Tentative FiNALParcTool\\xmlparser\\src\\default.editeurparctool.xml") ;
    		ArrayList<ContainTask> TaskC = xml.getContainTask(root);
    		ArrayList<Place> Places = xml.getPlaces(root);
     
    		ArrayList<Inarcttp> INTTP = xml.getInputArcTTP(root);
     
    		ArrayList <ArrayList> Matrice = new ArrayList<ArrayList>();
     
    		  Matrice.add(0,TaskC);
    	      Matrice.add(1,Places);
    		 ArrayList<Place> Procstab = new ArrayList<Place>(); 
    		  ArrayList<Place> TitoTi = new ArrayList<Place>();  // if  (p.getIplace == p.getJplaace) ==> titoTi
    		  ArrayList<Place> TitoTj = new ArrayList<Place>(); 
     
     
    			int nbTache= TaskC.size();
    			int nbLigne=15;
    			int nbColonne=9;
    			int nbPlaces=Places.size();
    	     //System.out.println();
     
    			for(int i = 0; i <= 1; i++)
    	        { 
    	            ArrayList s = Matrice.get(i);
     
    	            if(i==1)
    	            {
    	            for (int j = 0; j < s.size(); j++) 
    	            { 
    	        		Place  p = new Place();  
    	        		p = (Place) s.get(j) ; 
     
    	        		 if(p.getTypePlace()==9) // proc
    	        		{      
    	        		    	Procstab.add(p) ; 
     
    	        		 }//System.out.print(Procstab);
    	        		 if(p.getTypePlace()==10)
    	        		{ 
     
    			    	 TitoTi.add(p) ;  
     
    	        		 }//System.out.print(TitoTi);
    			     if(p.getTypePlace()==11)
    	        		{ 
    	        		    	TitoTj.add(p) ;  
     
    	        		 }
    			    // System.out.print(TitoTj);
    	            }
    	            }
     
    	        }
     
    			// l affichage du contenu 	
    	        System.out.print("             ");
    	        for ( int j = 0 ; j < nbTache; j++ ) //colonne 
    	        {  System.out.print("   ");
    	        for ( int k = 0 ; k <nbColonne; k++ ) 
    	        {
    	       	 System.out.print("  ");
    	      	     if (k ==0){System.out.print("T"+(j+1)+"Creation" );}
    	      	     if (k ==1)	{System.out.print("T" +(j+1)+"IncremtPeriod" );}
    	        	 if (k ==2)	{System.out.print("T" +(j+1)+"Reset" );}
    	        	 if (k ==3)	{System.out.print("T" +(j+1)+"Activation" );} 
    	        	 if (k ==4)	{System.out.print("T" +(j+1)+"Execution" );}
    	        	 if (k ==5)	{System.out.print("T" +(j+1)+"Incrementing " );}
    	        	 if (k ==6)	{System.out.print("T" +(j+1)+"Receiving" );}
    	         	 if (k ==7)	{System.out.print("T" +(j+1)+"Releasing" );}
    	         	 if (k ==8)	{System.out.print("T" +(j+1)+"Sending" );}
     
    	        }
     
    		}System.out.println();
     
    		for ( int i = 0 ; i < nbTache; i++ ) //ligne 
    	        { 
    	        for ( int l = 0 ; l <nbLigne; l++ ) 
    	        {if (l ==0){System.out.println("P" +(i+1)+"Uncreated      " );}
    	     	 if (l ==1){System.out.println("P" +(i+1)+"DeadLine       " );}
    	      	 if (l ==2){System.out.println("P" +(i+1)+"RemainingPeriod" );}
    	      	 if (l ==3){System.out.println("P" +(i+1)+"Created        " );} 
    	      	 if (l ==4){System.out.println("P" +(i+1)+"ElapsedPeriod  " );}
    	      	 if (l ==5){System.out.println("P" +(i+1)+"ReceivedData   " );}
    	      	 if (l ==6){System.out.println("P" +(i+1)+"Ready          " );}
    	       	 if (l ==7){System.out.println("P" +(i+1)+"Disabled       " );}
    	       	 if (l ==8){System.out.println("P" +(i+1)+"Activated      " );}
    	      	 if (l ==9){System.out.println("P" +(i+1)+"GetProc        " );}
    	     	 if (l ==10){System.out.println("P" +(i+1)+"IncreExec      " ); }
    	     	 if (l ==11){System.out.println("P" +(i+1)+"Maker          " ); }
    	     	 if (l ==12){System.out.println("P" +(i+1)+"e" +(i+1)+"             " ); }
    	      	 if (l ==13){System.out.println("P" +(i+1)+"ReleaseProc    " );}
    	      	 if (l ==14){System.out.println("P" +(i+1)+"DataToSend     " );}
    	        }
    	        }
    		//System.out.println();
     
    	    for ( int l = nbTache*nbLigne ; l <=nbTache*nbLigne+nbPlaces ; l++ ) 
     
    	    {int tailleProcstab =Procstab.size();
    	    int tailleTitoTi=TitoTi.size();
    	    int tailleTitoTj=TitoTj.size();
    	    //affichage des lignes string normal
    		 /*ordre dont j'ai fait le traitement indice place/task/xml
    		   l'ordre: "uncreated""DeadLine" "RemainingPeriod" "Ready" "GetProc" "Releasing" "DataToSend" "ReceivedData"*/
    	    int nb = nbTache*nbLigne+tailleTitoTi; 
    		int nb1 =nb+tailleProcstab ;
    	 if(l>=nbTache*nbLigne && l <(nbTache*nbLigne+tailleTitoTi))   //TitoTi
    	 {    
    		 for(l=nbTache*nbLigne;l <(nbTache*nbLigne+tailleTitoTi);l++)
    		 {
     
    		System.out.println(TitoTi.get(l-nbTache*nbLigne)+"            " );//T1toT1.....T1toT13 
     
    	 }
    	 }
     
    		 if(l>=nb && l < (nb + tailleProcstab+1)&& l <nb1) //  Proc
    	      {
    			 for(l=nb;l <(nb + tailleTitoTi+1)&& l <nb1;l++)
    		 {
     
    				 System.out.println(Procstab.get(l-nb)+"           ");//proc 1/2/3/4 
    		 }
     
    	     }
     
     
    	 	   if(l>=nb1 && l < (nb1+tailleTitoTj))//TitoTj
     
    	         {
    	 		 for(l=nb1;l <(nb1+tailleTitoTj);l++)
    	 		 {
    	     	   System.out.println(TitoTj.get(l-nb1)+"           ");
    	 		 }
     
    	        }
    	    }
     
    	}
    Le code de la fonction affichecontenu est
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    public static void affichecontenu(int mat[][], int n, int m)
    	{
    		for (int i=0;i<n;i++)
    		{System.out.print("             ");
    			for (int j=0;j<m;j++)
    			{
    				System.out.print(mat[i][j]);
     
    		     }
    			System.out.println();
     
    		}
    	}
    merci d'avance

  2. #2
    Modérateur
    Avatar de wax78
    Homme Profil pro
    R&D - Palefrenier programmeur
    Inscrit en
    Août 2006
    Messages
    4 095
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : R&D - Palefrenier programmeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2006
    Messages : 4 095
    Par défaut
    Ha mais de rien et bonne chance

    T'aurais pas oublié quelques chose genre la question ?

    Il serait, de plus, de bon aloi de poster un code un peu plus épuré de toutes les choses inutiles car a mon avis 80% du code n'a rien avoir avec ton problème, ce qui fait que personne n'aura envie de lire le code pour essayer de le comprendre et donc de t'aider.
    (Les "ça ne marche pas", même écrits sans faute(s), vous porteront discrédit ad vitam æternam et malheur pendant 7 ans)

    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  3. #3
    Membre très actif
    Femme Profil pro
    étudiante chercheuse
    Inscrit en
    Septembre 2013
    Messages
    274
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : étudiante chercheuse
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2013
    Messages : 274
    Par défaut
    j'ai déjà poster le question je veux savoir comment concatiner les 2 fonction dans une même fonction qui permet d'afficher le contenu de matrice au sein des entête ligne et colonne
    merci

  4. #4
    Membre Expert Avatar de Nico02
    Homme Profil pro
    Developpeur Java/JEE
    Inscrit en
    Février 2011
    Messages
    728
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Developpeur Java/JEE
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2011
    Messages : 728
    Par défaut
    Au hasard, pourquoi ne pas les appeler l'une après l'autre ?

  5. #5
    Membre très actif
    Femme Profil pro
    étudiante chercheuse
    Inscrit en
    Septembre 2013
    Messages
    274
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : étudiante chercheuse
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2013
    Messages : 274
    Par défaut
    j'ai déjà appelé l'une aprés l'autre mais le contenu de matrice sera afficher juste après les entête pas au sein d'eux

  6. #6
    Membre très actif
    Femme Profil pro
    étudiante chercheuse
    Inscrit en
    Septembre 2013
    Messages
    274
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : étudiante chercheuse
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2013
    Messages : 274
    Par défaut
    voilà j'ai diviser l'affichage des entete en 2 l'une pour les ligne et l'autre pour les colonne cava , mais pour les ligne j'ai pas trouver où appelé la méthode afficheenteteLigne (voir méthode affiche -->ka dernière)
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    public static void afficheenteteLigne()throws JDOMException, IOException
    	{
    		TestXml xml = new TestXml() ; 
    		Element root = xml.getRoot("C:\\Users\\faten\\Desktop\\Tentative FiNALParcTool\\xmlparser\\src\\default.editeurparctool.xml") ;
    		ArrayList<ContainTask> TaskC = xml.getContainTask(root);
    		ArrayList<Place> Places = xml.getPlaces(root);
     
    		ArrayList <ArrayList> Matrice = new ArrayList<ArrayList>();
     
    		  Matrice.add(0,TaskC);
    	      Matrice.add(1,Places);
    		 ArrayList<Place> Procstab = new ArrayList<Place>(); 
    		  ArrayList<Place> TitoTi = new ArrayList<Place>();  // if  (p.getIplace == p.getJplaace) ==> titoTi
    		  ArrayList<Place> TitoTj = new ArrayList<Place>(); 
     
     
    			int nbTache= TaskC.size();
    			int nbLigne=15;
    			int nbPlaces=Places.size();
    	     //System.out.println();
     
    			for(int i = 0; i <= 1; i++)
    	        { 
    	            ArrayList s = Matrice.get(i);
     
    	            if(i==1)
    	            {
    	            for (int j = 0; j < s.size(); j++) 
    	            { 
    	        		Place  p = new Place();  
    	        		p = (Place) s.get(j) ; 
     
    	        		 if(p.getTypePlace()==9) // proc
    	        		{      
    	        		    	Procstab.add(p) ; 
     
    	        		 }//System.out.print(Procstab);
    	        		 if(p.getTypePlace()==10)
    	        		{ 
     
    			    	 TitoTi.add(p) ;  
     
    	        		 }//System.out.print(TitoTi);
    			     if(p.getTypePlace()==11)
    	        		{ 
    	        		    	TitoTj.add(p) ;  
     
    	        		 }
    			    // System.out.print(TitoTj);
    	            }
    	            }
     
    	        }
     
     
     
    		for ( int i = 0 ; i < nbTache; i++ ) //ligne 
    	        { 
    	        for ( int l = 0 ; l <nbLigne; l++ ) 
    	        {if (l ==0){System.out.println("P" +(i+1)+"Uncreated      " );}
    	     	 if (l ==1){System.out.println("P" +(i+1)+"DeadLine       " );}
    	      	 if (l ==2){System.out.println("P" +(i+1)+"RemainingPeriod" );}
    	      	 if (l ==3){System.out.println("P" +(i+1)+"Created        " );} 
    	      	 if (l ==4){System.out.println("P" +(i+1)+"ElapsedPeriod  " );}
    	      	 if (l ==5){System.out.println("P" +(i+1)+"ReceivedData   " );}
    	      	 if (l ==6){System.out.println("P" +(i+1)+"Ready          " );}
    	       	 if (l ==7){System.out.println("P" +(i+1)+"Disabled       " );}
    	       	 if (l ==8){System.out.println("P" +(i+1)+"Activated      " );}
    	      	 if (l ==9){System.out.println("P" +(i+1)+"GetProc        " );}
    	     	 if (l ==10){System.out.println("P" +(i+1)+"IncreExec      " ); }
    	     	 if (l ==11){System.out.println("P" +(i+1)+"Maker          " ); }
    	     	 if (l ==12){System.out.println("P" +(i+1)+"e" +(i+1)+"             " ); }
    	      	 if (l ==13){System.out.println("P" +(i+1)+"ReleaseProc    " );}
    	      	 if (l ==14){System.out.println("P" +(i+1)+"DataToSend     " );}
    	        }
    	        }
    		//System.out.println();
     
    	    for ( int l = nbTache*nbLigne ; l <=nbTache*nbLigne+nbPlaces ; l++ ) 
     
    	    {int tailleProcstab =Procstab.size();
    	    int tailleTitoTi=TitoTi.size();
    	    int tailleTitoTj=TitoTj.size();
    	    //affichage des lignes string normal
    		 /*ordre dont j'ai fait le traitement indice place/task/xml
    		   l'ordre: "uncreated""DeadLine" "RemainingPeriod" "Ready" "GetProc" "Releasing" "DataToSend" "ReceivedData"*/
    	    int nb = nbTache*nbLigne+tailleTitoTi; 
    		int nb1 =nb+tailleProcstab ;
    	 if(l>=nbTache*nbLigne && l <(nbTache*nbLigne+tailleTitoTi))   //TitoTi
    	 {    
    		 for(l=nbTache*nbLigne;l <(nbTache*nbLigne+tailleTitoTi);l++)
    		 {
     
    		System.out.println(TitoTi.get(l-nbTache*nbLigne)+"            " );//T1toT1.....T1toT13 
     
    	 }
    	 }
     
    		 if(l>=nb && l < (nb + tailleProcstab+1)&& l <nb1) //  Proc
    	      {
    			 for(l=nb;l <(nb + tailleTitoTi+1)&& l <nb1;l++)
    		 {
     
    				 System.out.println(Procstab.get(l-nb)+"           ");//proc 1/2/3/4 
    		 }
     
    	     }
     
     
    	 	   if(l>=nb1 && l < (nb1+tailleTitoTj))//TitoTj
     
    	         {
    	 		 for(l=nb1;l <(nb1+tailleTitoTj);l++)
    	 		 {
    	     	   System.out.println(TitoTj.get(l-nb1)+"           ");
    	 		 }
     
    	        }
    	    }
     
    	}
    	public static void afficheenteteColonne()throws JDOMException, IOException{
    		TestXml xml = new TestXml() ; 
    		Element root = xml.getRoot("C:\\Users\\faten\\Desktop\\Tentative FiNALParcTool\\xmlparser\\src\\default.editeurparctool.xml") ;
    		ArrayList<ContainTask> TaskC = xml.getContainTask(root);
    		int nbTache= TaskC.size();
    		int nbColonne=9;
        System.out.print("             ");
        for ( int j = 0 ; j < nbTache; j++ ) //colonne 
        {  System.out.print("   ");
        for ( int k = 0 ; k <nbColonne; k++ ) 
        {
       	 System.out.print("  ");
      	     if (k ==0){System.out.print("T"+(j+1)+"Creation" );}
      	     if (k ==1)	{System.out.print("T" +(j+1)+"IncremtPeriod" );}
        	 if (k ==2)	{System.out.print("T" +(j+1)+"Reset" );}
        	 if (k ==3)	{System.out.print("T" +(j+1)+"Activation" );} 
        	 if (k ==4)	{System.out.print("T" +(j+1)+"Execution" );}
        	 if (k ==5)	{System.out.print("T" +(j+1)+"Incrementing " );}
        	 if (k ==6)	{System.out.print("T" +(j+1)+"Receiving" );}
         	 if (k ==7)	{System.out.print("T" +(j+1)+"Releasing" );}
         	 if (k ==8)	{System.out.print("T" +(j+1)+"Sending" );}
     
        }
     
    }System.out.println();
    	}
    	public static void affiche(int mat[][], int n, int m)throws JDOMException, IOException
    	{
    		afficheenteteColonne();
    		for (int i=0;i<n;i++)
    		{System.out.print("             ");
    			for (int j=0;j<m;j++)
    			{
     
    				System.out.print(mat[i][j]);
     
    		     }
    			System.out.println();
     
    		}
    	}
    help

  7. #7
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    Citation Envoyé par FATENMRABET Voir le message
    j'ai déjà poster le question je veux savoir comment concatiner les 2 fonction dans une même fonction qui permet d'afficher le contenu de matrice au sein des entête ligne et colonne
    merci
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    public void afficheTout(int mat[][], int n, int m){
        afficheenteteLigne()
        affichecontenu(mat, n, m)
    }

  8. #8
    Membre très actif
    Femme Profil pro
    étudiante chercheuse
    Inscrit en
    Septembre 2013
    Messages
    274
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : étudiante chercheuse
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2013
    Messages : 274
    Par défaut
    même problème les entêtes s'affiche au début puis vient par la suite le contenu

  9. #9
    Membre très actif
    Femme Profil pro
    étudiante chercheuse
    Inscrit en
    Septembre 2013
    Messages
    274
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : étudiante chercheuse
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2013
    Messages : 274
    Par défaut
    affichage courante de dernier code que j'ai poster c bon just où il ya des X JE VEUX AFFICHER L'ENTETE DES LIGNEs
    T1Creation T1IncremtPeriod T1Reset T1Activation
    xxxxxx 1000000000000000000000000000000000000000000000000000000

Discussions similaires

  1. Réponses: 12
    Dernier message: 12/04/2010, 17h27
  2. Concaténer deux listes
    Par Dunk dans le forum Pascal
    Réponses: 13
    Dernier message: 25/04/2006, 18h09
  3. concaténation et affichage
    Par ph_anrys dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 30/08/2005, 15h43
  4. Réponses: 6
    Dernier message: 27/05/2004, 10h41
  5. Concaténer deux variables ?
    Par glsn dans le forum ASP
    Réponses: 2
    Dernier message: 19/12/2003, 13h53

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo