Canalblog
Editer l'article Suivre ce blog Administration + Créer mon blog
Publicité
Notre Temps
12 avril 2010

input textb4StringReader(textB)nextLine

input textb4
StringReader(textB)
nextLine getNexLine;
currentSeq = decodeLine (nextLine)
if not isSequenceTag(currentSeq)
abort 'syntax error'
end if
currentSequence (id, level, order, occur) // occ , order, and level are init to 1
Loop over StringReader(textB) until nextline=null
  BaseTag = decocdeLine(nextLine)
  if isSequenceTag(baseTag)
   newSeq = baseTag
    // new Subsequence, new Sequence, end sequence
  else if isSimpleTag(baseTag)
   newTag = baseTag
  else // null
   currenTag.append text
  end if

http://www.dba-oracle.com/concepts/rule_based_optimizer.htm
http://www.devx.com/gethelpon/10MinuteSolution/16596/0/

import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;

public class Test {
public static void main(String[] args) {
  String s= "X1hhhhahhha" +"\r\n";
  s= s + "a1hhhhahhha" +"\r\n";
  s=s+ "X2hhhhahhha" +"\r\n";
  s= s + "a2hhhhahhha" +"\r\n";
  s=s+ "X3hhhhahhha" +"\r\n";
  s= s + "a3hhhhahhha" +"\r\n";
  s=s+ "X4hhhhahhha" +"\r\n";
  s= s + "a4hhhhahhha" +"\r\n";
  s=s+ "X5hhhhahhha" +"\r\n";
  s= s + "a5hhhhahhha" +"\r\n";
  try {
   new Test().treat(s);
  } catch (Exception e) {
   // TODO: handle exception
   e.printStackTrace();
  }
 
}
private void treat(String s)throws IOException{
  StringReader sR = new StringReader(s);
  BufferedReader bR = new BufferedReader(sR);
  decodeX(bR);
  System.out.println("End Treat");
   
 
 
 
}

private void decodeX(BufferedReader bR)throws IOException{
 
  String nextLine = bR.readLine();
 
  while (nextLine!=null){
   if (nextLine.substring(0, 1).equals("X")) {
    System.out.println(nextLine);
    decodeX(bR);
   
   }else{
    System.out.println(nextLine);
   }
   
   
     if (bR.ready()){
      System.out.println("ready");
      nextLine = bR.readLine();
      
     }else{
      System.out.println("not ready");
     }
   
  }
 
  System.out.println("End DecodeX");
 
}
}

  return tagObject or seq Object. tag and seq inherit from iTag
   or
  return null
  when retun null must add the it to the tag by append

Publicité
Publicité
Commentaires
Notre Temps
Publicité
Albums Photos
Publicité