jueves, 17 de enero de 2019

Java code – Vector in an ArrayList form alternating

 import java .  lang .  annotation .  Documented; 
 import java .  lang .  annotation .  ElementType; 
 import java .  lang .  annotation .  Retention; 
 import java .  lang .  annotation .  RetentionPolicy; 
 import java .  lang .  annotation .  Target; 
 import java .  util .  ArrayList; 
 import javax .  swing .  JFrame; 
 import static javax .  swing .  JFrame .  EXIT_ON_CLOSE; 
 import javax .  swing .  JOptionPane; 
 import javax .  swing .  JScrollPane; 
 import javax .  swing .  JTextArea; 
 
 
 @Documented  ()  
 @Target  ( ] ElementType .  TYPE_USE )  
 @Retention  ( RetentionPolicy .  RUNTIME )  
 @interface Forma_alternativa_de_guardar_vector_en_ArrayList  { 
 public String description  ()  default  "Allows showing that there is an alternative way of saving vectors in ArrayList" ; 
 }  
 
 
  /  *  * 
 
   *  Displays the alternate way of saving a vector in an ArrayList . 
 
   *  @author Rafael Angel Montero Fernandez . 
 
   *  /
 
 @Forma_alternativa_de_guardar_vector_en_ArrayList 
 class Save_vector_forma_dos  { 
 
  /  *  * 
 
   *  Facilitates the printing of messages on the screen . 
 
   *  @param data Any text . 
 
   *  /
 
 private void msj  ( String data )  { 
 System .  out .  println  ( data ) ; 
 }  
  /  *  * 
 
   *  Load the sample data into the different objects . 
 
   *  /
 
 public void charge_data  ()  { 
 Model one_person  =  new Model  ( "Rafael"  ]) ; 
 Rs_Vector un_rs  =  new Rs_Vector  () ; 
 un_rs .  add  ( ] a_person  0 ) ; 
 un_rs .  ; 
;  =  new Model  ( "Joan of Arc" ) ; 

 un_rs .  add  ( one_person  1 ) ; 

 rs .  add  ( un_rs ) ; 

 un_rs  =  new Rs_Vector  () ; 

 one_person  =  new Model  ( "Lozen" ) ; 

 un_rs .  add  ( one_person  ] 1 ) ; 

 one_person  =  new Model  ( "Grace OMalen" ) ; 

 un_rs .  add  ( a_person  0 ) ; 

 un_rs .  setIdentifier  ( 2  ]) ; 

 rs .  add  ( un_rs ) ; 

 }  

 

  /  *  * 
 

   *  Load the data in JTextArea to be displayed in a form . 
 

   *  But just in case too  prints the report data on the screen . 
 

   *  @return Returns an instance of JTextArea loaded with data . 
 

   *  /
 

 private JTextArea display_registers  ()  { 

 this .  load_data  () ; 

 ] JTextArea jtaReport  =  new JTextArea  () ; 

 jtaReporte .  setBounds  ( 0  ] 0  300  200 ) ; 

 for  ( int f0  =  0; f0  < =  rs .  size  ()  -  1; f0  +  + ) [19659015] { 

 msj  ( "f0  = "   +  f0 ) ; 

 msj  ( rs .  get  ( f0 ) .  toString  () ) ; [19659002] jtaReporte .  setText  ( jtaReporte .  getText  ()   +   " n"   +  rs .  get  ( f0 ) .  toString  ()  ) ; 

 ] 

 }  

  // JOptionPane .  showMessageDialog  ( null  jtaReporte )  ];
 

 return jtaReporte; 

 }  

 

  /  *  * 
 

   *  Calls the required internal methods  creates the instance of a JFrame . 
 

   *  Show it with a JTextArea with data . 
 

   *  Displays the results of the tests . 
 

   *  /
 

 public void try  ()  { 

 JFrame FRM_Report  =  new JFrame  ( "Report"  ]) ; 

 FRM_Report .  setBounds  ( 100  50  300  200 ) ; 

 JScrollPane jsp  =  new JScrollPane  ( show_registers  () ) ; 

 jsp .  setBounds  ( 0  0  300  200 ) ; 

 ] FRM_Report .  add  ( jsp ) ; 

 FRM_Report .  setVisible  ( true ) ; 

 FRM_Report .  setResizable  ( false  06]) ; 

 FRM_Report .  setDefaultCloseOperation  ( EXIT_ON_CLOSE ) ; 

 }  

 [19659002]  /  *  * 
 

   *  This ArrayList allows to save a class Rs_Vector  which has a vector of 2 squares inside . 
 

   *  /
 

 private ArrayList  < Rs_Vector >  rs  =  new ArrayList  < Rs_Vector >  ([19659015]) ; 

 

  /  *  * 
 

   *  You can save two objects at a time . 
 

   *  /
 

 public class Rs_Vector  { 

  /  *  * 
 

   *  Instance or internal object of Model . 
 

   *  /
 

 private Individual model  []  =  new Model  [ 2 ] ; 

  /  *  * 
 

 
 

   *  *  /
 

 private int identifier  /  *  = val  or  *  /;
  

  /  *  * 
 

 
 

   *  *  /
 

 public void setIdentifier  ( int new_identifier )  

  { 

 

 identifier  =  new_identifier ; 

 }  

  /  *  * 
 

 
 

   *  *  /
 

 public int getIdentifier  ()  { 

 

 return identifier; 

 }  

 

  /  *  * 
 

   *  Adds data to ArrayList . 
 

   *  @param una_person One object or instanacia Model with data . 
 

   *  @param id A value of zero or 1 . 
 

   *  /
 

 public void add  ( Model one_person  int id )  { 

 if  ( (  id >  person .  length  -  1 )  |  |  ( id  ] [ 0 ) )  { 

 JOptionPane .  showMessageDialog  ( null   "The indicated index is outside the limits of the vector .  ") ; 

 }  else  { 

 person  [ id ]  =  one_person; 

 msj  ( person  [ id ] .  getName  () ) ; 

 one_person  =  null;  // Canceled to avoid . 
 

 }  

 }  

 

  /  *  * 
 

   * 
 

   *  @return Returns the registration of the two persons . 
 

   *  /
 

 @Override 

 public String toString  ()  { 

  // msj  ( "Identifier ="  +  this .  getIdentifier  ()   +  ".  Person 1 : "  ] +  person  [ 0 ] .  getName  ()   +  "; person 2 :  " +  person  [ 1 ] .  getName  () ) ;
 

 return  "Identifier  = "   +  this .  getIdentifier  ()   +   ] ".  Person 1 : "   +  person  [ 0 ] .  getName  ()   +   "; person 2 : "   +  person  [ 1 ] .  ] getName  () ; 

 }  

 }  

 

  /  *  ] * 
 

   *  Model to be used in the example . 
 

   *  /
 

 public class Model  { 

 public Model  ( String newName )  { 

 setName  ( new_Name ) ; 

 

 }  

 

 

 public Model  ()  { }  

  /  *  * 
 

  name is ok . 
 

   *  *  /
 

 private String Name  /  *  = val  or  *  /;
  

  /  *  * 
 

  name is ok . 
 

   *  *  /
 

 public void setName  ( String new_Name )  

  { 

 

 Name  =  new_Name ; 

 }  

  /  *  * 
 

  name is ok . 
 

   *  *  /
 

 public String getName  ()  { 

 

 return Name; 

 }  

 

 @ Override 

 public String to String  ()  { 

 return this .  getName  () ; 

 }  

 }  // End of class
 

 } 

.

Source link



from Nettech Post http://bit.ly/2T58Flj

No hay comentarios:

Publicar un comentario

Slutty Japanese Babe Toyed And Creamed

Japanese hot babe with big tits gets toyed and creamed. Author: sexualbabe Added: 02/11/2021