Li era uno pseudo codice INVENTATO...ora ti faccio vedere il codice REALE:
codice:
private void aa()
{
for ( int i = 0; i < bodyObjects.size(); i++)
{
Body body = (Body)bodyObjects.elementAt(i);
if ( body.testo != null )
{
if ( body.testo.equalsIgnoreCase("relatore:") || body.testo.equalsIgnoreCase("relatore") )
System.out.println("OK relatore");
if ( body.testo.equalsIgnoreCase("presentata da:") || body.testo.equalsIgnoreCase("presentata da") )
System.out.println("OK presentata");
if ( body.testo.equalsIgnoreCase("sessione i") || body.testo.equalsIgnoreCase("sessione 1") )
System.out.println("OK Prima sessione");
if ( body.testo.equalsIgnoreCase("sessione ii") || body.testo.equalsIgnoreCase("sessione 2") )
System.out.println("OK Seconda sessione");
if ( body.testo.equalsIgnoreCase("sessione iii") || body.testo.equalsIgnoreCase("sessione 3") )
System.out.println("OK Terza sessione");
if ( body.testo.equalsIgnoreCase("indice") || body.testo.equalsIgnoreCase("ndice") )
System.out.println("OK INDICE");
if ( body.testo.equalsIgnoreCase("introduzione") || body.testo.equalsIgnoreCase("ntroduzione") )
System.out.println("OK INTRODUZIONE");
if ( body.testo.equalsIgnoreCase("conclusioni") || body.testo.equalsIgnoreCase("onclusioni") || body.testo.equalsIgnoreCase("conclusione") || body.testo.equalsIgnoreCase("onclusione") )
System.out.println("OK CONCLUSIONI");
if ( body.testo.equalsIgnoreCase("bibliografia") || body.testo.equalsIgnoreCase("ibliografia") || body.testo.equalsIgnoreCase("bibbliografia") || body.testo.equalsIgnoreCase("ibbliografia") )
System.out.println("OK BIBLIOGRAFIA");
}
if ( body.testo != null && body.font == null )
{
for ( int j = 0; j < styleObjects.size(); j++)
{
Style style = (Style)styleObjects.elementAt(j);
if ( body.stile.equals(style.name) )
{
if ( style.font != null )
{
if ( style.font.equals("Times New Roman") )
System.out.println("OK TIMES NEW ROMAN");
else
System.out.println("BIRICHINO" + style);
}
}
}
}
if ( body.font != null )
{
if ( body.testo != null && body.font.equals("Times New Roman") )
System.out.println("OK ANCHE COSì TIMES NEW ROMAN");
}
}
}
Io dovrei mettere dove il testo non è null (ossia c'è del testo) dovrei fare un controllo se body.stile (ossia se lo stile del body) è uguale a uno di quegli stili
che vengono fuori facendo
codice:
private void STILI()
{
String style1 = new String();
ArrayList buffer1 = new ArrayList();
for ( int i = 0; i < styleObjects.size(); i++)
{
Style style = (Style)styleObjects.elementAt(i);
if ( style.jc != null && style.jc.equals("both") )
if ( style.font != null && style.font.equals("Times New Roman") )
if ( style.size != null )
if ( style.size.equals("24") || style.size.equals("26") )
if ( style.grassetto == null && style.italico == null && style.sottolineato == null )
{
style1 = style.name;
buffer1.add(style1);
System.out.println(style1);
}
}
for (int j=0; j<buffer1.size();j++)
{
System.out.println(buffer1.get(j));
}
}
dentro l'ultimo for dovrei dire if(body.stile.equals(buffer1.get(j))) per dire se lo stile è uguale a uno di quelli circoscritti nel buffer