Example #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);
 }
Example #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);
 }
Example #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);
 }
Example #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);
 }
Example #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);
 }
Example #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);
 }
Example #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);
 }
Example #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);
 }
Example #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();
   }
 }
Example #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);
 }
Example #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;
 }
Example #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;
   }
 }
Example #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;
 }
Example #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;
  }
}
Example #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);
 }
Example #16
0
 @Override
 public FolderNode createRoot() {
   return addNode(null, "root", ByteSearch.create(""), ByteSearch.create("($|\n)"), "", "\n");
 }
Example #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);
 }
Example #18
0
 protected ByteSearch match() {
   return ByteSearch.create(".*");
 }
Example #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);
 }
Example #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);
 }