Exemplo n.º 1
0
 public StructuredTextCSV(
     Datafile datafile, String regexopen, String regexclose, String open, String close) {
   super(datafile);
   this.open = open;
   this.close = close;
   regex_open = ByteSearch.create(regexopen);
   regex_close = ByteSearch.create(regexclose);
 }
Exemplo n.º 2
0
 public StructuredTextCSV(
     BufferReaderWriter reader, String regexopen, String regexclose, String open, String close) {
   super(reader);
   this.open = open;
   this.close = close;
   regex_open = ByteSearch.create(regexopen);
   regex_close = ByteSearch.create(regexclose);
 }
Exemplo n.º 3
0
 public IntField(String label, String open, String close, String openlabel, String closelabel) {
   this(
       getRoot(),
       label,
       ByteSearch.create(open),
       ByteSearch.create(close),
       openlabel,
       closelabel);
 }
Exemplo n.º 4
0
 public IntField(
     FolderNode parent,
     String label,
     String open,
     String close,
     String openlabel,
     String closelabel) {
   this(parent, label, ByteSearch.create(open), ByteSearch.create(close), openlabel, closelabel);
 }
Exemplo n.º 5
0
 public JsonField addJson(
     FolderNode parent,
     String label,
     String open,
     String close,
     String openlabel,
     String closelabel) {
   return addJson(
       parent, label, ByteSearch.create(open), ByteSearch.create(close), openlabel, closelabel);
 }
Exemplo n.º 6
0
 public DoubleArrayField addDoubleArray(
     FolderNode parent,
     String label,
     String open,
     String close,
     String openlabel,
     String closelabel) {
   return addDoubleArray(
       parent, label, ByteSearch.create(open), ByteSearch.create(close), openlabel, closelabel);
 }
Exemplo n.º 7
0
 public FolderNode addNode(
     FolderNode parent,
     String label,
     String open,
     String close,
     String openlabel,
     String closelabel) {
   return addNode(
       parent, label, ByteSearch.create(open), ByteSearch.create(close), openlabel, closelabel);
 }
Exemplo n.º 8
0
 public JsonArrayField addJsonArray(
     String label, Type clazz, String open, String close, String openlabel, String closelabel) {
   return addJsonArray(
       getRoot(),
       label,
       clazz,
       ByteSearch.create(open),
       ByteSearch.create(close),
       openlabel,
       closelabel);
 }
Exemplo n.º 9
0
 @Override
 public void rebuildBeforeFirstUse() {
   Node lastNode = getRoot();
   while (lastNode instanceof FolderNode) {
     FolderNode foldernode = (FolderNode) lastNode;
     lastNode = foldernode.orderedfields.get(foldernode.orderedfields.size() - 1);
   }
   lastNode.closelabel = "";
   lastNode.setOpenClose(ByteSearch.create(""), ByteSearch.create("$"));
   if (log.isTraceEnabled()) {
     dumpStructure();
   }
 }
Exemplo n.º 10
0
 public JsonArrayField addJsonArray(
     FolderNode parent,
     String label,
     Type clazz,
     String open,
     String close,
     String openlabel,
     String closelabel) {
   return addJsonArray(
       parent,
       label,
       clazz,
       ByteSearch.create(open),
       ByteSearch.create(close),
       openlabel,
       closelabel);
 }
Exemplo n.º 11
0
 @Override
 public ByteSearchSection process(Content content, ByteSearchSection section) {
   ByteSearchPosition end = endmarker.findPos(section);
   if (end.found() && end.start > section.innerstart) {
     return content.addSectionPos(
         outputsection, content.content, section.start, section.innerstart, end.start, end.end);
   }
   return null;
 }
Exemplo n.º 12
0
 private void check(String content) {
   if (!checked && open != null && open != ByteSearch.EMPTY) {
     if (open.match(content)) {
       log.fatalexception(
           new RuntimeException(),
           "StructuredTextFile.JsonField value matches open tag: [%s]\n%s",
           open.toString(),
           content);
     }
     if (close != null && close.exists(content)) {
       ByteSearchPosition findPos = close.findPos(content);
       if (findPos.notEmpty()) {
         log.fatalexception(
             new RuntimeException(),
             "StructuredTextFile.JsonField value matches close tag: [%s]\n%s",
             close.toString(),
             content);
       }
     }
     checked = true;
   }
 }
Exemplo n.º 13
0
 @Override
 public ByteSearchSection process(Content content, ByteSearchSection section) {
   int tagclose = findQuoteSafeTagEnd(section);
   if (tagclose > -1) {
     ByteSearchPosition end = endmarker.findPos(section, tagclose);
     if (end.found()) {
       ByteSearchSection s =
           content.addSectionPos(
               outputsection, content.content, section.start, tagclose, end.start, end.end);
       return s;
     }
   }
   return null;
 }
Exemplo n.º 14
0
/**
 * Marks <headline> sections.
 *
 * <p>
 *
 * @author jbpvuurens
 */
public class MarkHeadline extends SectionMarker {

  public static Log log = new Log(MarkHeadline.class);
  public ByteSearch endmarker = ByteSearch.create("</headline>");

  public MarkHeadline(Extractor extractor, String inputsection, String outputsection) {
    super(extractor, inputsection, outputsection);
  }

  @Override
  public ByteRegex getStartMarker() {
    return new ByteRegex("<headline>");
  }

  @Override
  public ByteSearchSection process(Content content, ByteSearchSection section) {
    ByteSearchPosition end = endmarker.findPos(section);
    if (end.found() && end.start > section.innerstart) {
      return content.addSectionPos(
          outputsection, content.content, section.start, section.innerstart, end.start, end.end);
    }
    return null;
  }
}
Exemplo n.º 15
0
 public JsonField addJson(
     String label, String open, String close, String openlabel, String closelabel) {
   return addJson(
       getRoot(), label, ByteSearch.create(open), ByteSearch.create(close), openlabel, closelabel);
 }
Exemplo n.º 16
0
 @Override
 public FolderNode createRoot() {
   return addNode(null, "root", ByteSearch.create(""), ByteSearch.create("($|\n)"), "", "\n");
 }
Exemplo n.º 17
0
 public Long128Field addLong128(
     String label, String open, String close, String openlabel, String closelabel) {
   return addLong128(
       getRoot(), label, ByteSearch.create(open), ByteSearch.create(close), openlabel, closelabel);
 }
Exemplo n.º 18
0
 protected ByteSearch match() {
   return ByteSearch.create(".*");
 }
Exemplo n.º 19
0
 public DoubleArrayField addDoubleArray(
     String label, String open, String close, String openlabel, String closelabel) {
   return addDoubleArray(
       getRoot(), label, ByteSearch.create(open), ByteSearch.create(close), openlabel, closelabel);
 }
Exemplo n.º 20
0
 public FolderNode addNode(
     String label, String open, String close, String openlabel, String closelabel) {
   return addNode(
       getRoot(), label, ByteSearch.create(open), ByteSearch.create(close), openlabel, closelabel);
 }