/* * [EnusureSortedBiblicaly.java] * * Summary: Ensures bible references in biblestudy.html are in order. * * Copyright: (c) 2014-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2014-01-20 initial */ package com.mindprod.repair; import com.mindprod.common18.Misc; import com.mindprod.hunkio.HunkIO; import java.io.File; import java.io.IOException; import java.util.regex.Matcher; import java.util.regex.Pattern; import static java.lang.System.*; /** * Ensures bible references in biblestudy.html are in order. *

* Does not correct errors. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2014-01-20 initial * @since 2014-01-20 */ public class EnusureSortedBiblicaly { // find // "" private static final Pattern KJV = Pattern.compile( " { final String book; final int chapter; final int verse; BibleReference( final String book, final int chapter, final int verse ) { this.book = book; this.chapter = chapter; this.verse = verse; } /** * sort biblically (alphabetically not chronologically) * Defines default the sort order for BibleReference Objects. * Compare this BibleReference with another BibleReference * Compares book case sensitively then chapter numerically then verse numerically. * Informally, returns (this-other) or +ve if this sorts after other. *

* Summary: sort biblically. *

* Requires: JDK 1.8+. *

* Java code generated with: Canadian Mind Products ComparatorCutter. *

* Version History: * 1.0 2014-01-20 - initial release * * @param other other BibleReference to compare with this one * * @return +ve if this>other, 0 if this==other, -ve if this<other */ public final int compareTo( BibleReference other ) { int diff = this.book.compareTo( other.book ); if ( diff != 0 ) { return diff; } int diff1 = Misc.compare( this.chapter, other.chapter ); if ( diff1 != 0 ) { return diff1; } return Misc.compare( this.verse, other.verse ); } }