Split FC_WORDS and fixed nav links and added grouping to fix full set
This commit is contained in:
parent
9c2bc3b628
commit
2930452b07
|
@ -22,6 +22,8 @@
|
|||
*/
|
||||
package org.x4o.fc18.cake2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash01;
|
||||
|
@ -215,9 +217,21 @@ public enum FourCornerDotCake {
|
|||
|
||||
/// China Four Corner words with FIXED meaning for abstract translations, to make code without letters.
|
||||
/// 4 or 5 decimals come from four corner index 0000.0 = 00000 = first word index = "head" = "亠"
|
||||
FC_WORDS(4096, 100000, "Four Corner Words"),
|
||||
/// Reserved four corner extra words
|
||||
__RESERVED_WORDS(4096+100000, 131072-100000-4096), // fc end = 2^17-1
|
||||
FC_WORDS_0000(4096, 10000, "Four Corner Words 0-9999"),
|
||||
FC_WORDS_0001(1 + FC_WORDS_0000.getStop(), 10000, "Four Corner Words 10000-19999"),
|
||||
FC_WORDS_0010(1 + FC_WORDS_0001.getStop(), 10000, "Four Corner Words 20000-29999"),
|
||||
FC_WORDS_0011(1 + FC_WORDS_0010.getStop(), 10000, "Four Corner Words 30000-39999"),
|
||||
FC_WORDS_0100(1 + FC_WORDS_0011.getStop(), 10000, "Four Corner Words 40000-49999"),
|
||||
FC_WORDS_0101(1 + FC_WORDS_0100.getStop(), 10000, "Four Corner Words 50000-59999"),
|
||||
FC_WORDS_0110(1 + FC_WORDS_0101.getStop(), 10000, "Four Corner Words 60000-69999"),
|
||||
FC_WORDS_0111(1 + FC_WORDS_0110.getStop(), 10000, "Four Corner Words 70000-79999"),
|
||||
FC_WORDS_1000(1 + FC_WORDS_0111.getStop(), 10000, "Four Corner Words 80000-89999"),
|
||||
FC_WORDS_1001(1 + FC_WORDS_1000.getStop(), 10000, "Four Corner Words 90000-99999"),
|
||||
|
||||
/// After above 100K got one fixed word meaning, we can fill the few extra words too.
|
||||
FC_EXTRA_1010(1 + FC_WORDS_1001.getStop(), 10000, "Four Corner Words 100000-109999"),
|
||||
FC_EXTRA_1011(1 + FC_EXTRA_1010.getStop(), 10000, "Four Corner Words 110000-119999"),
|
||||
FC_EXTRA_1100(1 + FC_EXTRA_1011.getStop(), 131072-120000-4096, "Four Corner Words 120000-129999"),
|
||||
|
||||
// =========== Allow digital language constructs to be constants
|
||||
|
||||
|
@ -251,11 +265,11 @@ public enum FourCornerDotCake {
|
|||
FC_CLK1K_Z(131072 + (1024*25), 1024),
|
||||
FC_CLK1K_AMP(131072 + (1024*26), 1024),
|
||||
|
||||
// =========== Allow more data grams for legacy unicode and next generation unicode
|
||||
|
||||
/// Text structure control indicators
|
||||
__RESERVED_STRUCT(1 + FC_CLK1K_AMP.getStop(), 0x27000 - 576 - 1 - FC_CLK1K_AMP.getStop(), "Reserved for STRUCT"),
|
||||
|
||||
// =========== Allow more data grams for legacy unicode and next generation unicode
|
||||
|
||||
/// Preamble of a sand worm body as a identifiable type header.
|
||||
/// Octal worm encoding are 192 unique octals in ordered sequence and have allowed length of 24/48/96 or 192.
|
||||
/// This mime-type like information and decoders can be fetched from the the nether DB.
|
||||
|
@ -341,7 +355,7 @@ public enum FourCornerDotCake {
|
|||
|
||||
public boolean isExternWord() {
|
||||
int idx = ordinal();
|
||||
if (idx < FC_IBM1616_H8.ordinal()) {
|
||||
if (idx <= FC_PIE9D_27.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
if (idx > FC_CLK1K_AMP.ordinal()) {
|
||||
|
@ -350,6 +364,26 @@ public enum FourCornerDotCake {
|
|||
return true;
|
||||
}
|
||||
|
||||
public FourCornerDotCakeTower tower() {
|
||||
int idx = ordinal();
|
||||
if (idx <= __MIND_THE_GAP8.ordinal()) {
|
||||
return FourCornerDotCakeTower.BIT_GLYPHS;
|
||||
}
|
||||
if (idx <= FC_PIE9D_27.ordinal()) {
|
||||
return FourCornerDotCakeTower.PIE_SYMBOLS;
|
||||
}
|
||||
if (idx <= FC_OCE0864_H9.ordinal()) {
|
||||
return FourCornerDotCakeTower.DATA_GRAMS;
|
||||
}
|
||||
if (idx <= FC_EXTRA_1100.ordinal()) {
|
||||
return FourCornerDotCakeTower.WORDS_HUMAN;
|
||||
}
|
||||
if (idx <= FC_CLK1K_AMP.ordinal()) {
|
||||
return FourCornerDotCakeTower.WORDS_CODE;
|
||||
}
|
||||
return FourCornerDotCakeTower.EMBED;
|
||||
}
|
||||
|
||||
public String nameSpec() {
|
||||
return nameSpec;
|
||||
}
|
||||
|
@ -370,4 +404,15 @@ public enum FourCornerDotCake {
|
|||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
static public List<FourCornerDotCake> valuesByTower(FourCornerDotCakeTower tower) {
|
||||
List<FourCornerDotCake> result = new ArrayList<>();
|
||||
for (int i = 0; i < VALUES.length; i++) {
|
||||
FourCornerDotCake cake = VALUES[i];
|
||||
if (cake.tower().equals(tower)) {
|
||||
result.add(cake);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.cake2;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/// Grouping enum for the dot cake slices.
|
||||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Jan 19, 2025
|
||||
public enum FourCornerDotCakeTower {
|
||||
|
||||
BIT_GLYPHS("Symbols for 6 bit systems"),
|
||||
PIE_SYMBOLS("Pie cake symbols"),
|
||||
DATA_GRAMS("Local numeric value system"),
|
||||
WORDS_HUMAN("Normal words"),
|
||||
WORDS_CODE("Special words"),
|
||||
EMBED("Embedded data objects"),
|
||||
;
|
||||
|
||||
private final String nameNice;
|
||||
private final String description;
|
||||
|
||||
private FourCornerDotCakeTower(String description) {
|
||||
this.description = Objects.requireNonNull(description);
|
||||
this.nameNice = name().replaceAll("_", "-");
|
||||
}
|
||||
|
||||
public String nameNice() {
|
||||
return nameNice;
|
||||
}
|
||||
|
||||
public String description() {
|
||||
return description;
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.cake2.fcdoc;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.io.sax3.ContentCloseable;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPage;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPageWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
|
||||
/**
|
||||
* Cake doc stack page writer.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 17, 2025
|
||||
*/
|
||||
public class FCDocPageWriterCakeTower implements ApiDocPageWriter, FCDocSegmentWriter {
|
||||
|
||||
public static ApiDocPage createDocPage() {
|
||||
return new ApiDocPage("overview-tower","Tower","Overview of the cake tower.",new FCDocPageWriterCakeTower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePageContent(ApiDocWriteEvent<ApiDocPage> e) throws IOException {
|
||||
ApiDocContentWriter writer = e.getWriter();
|
||||
try (ContentCloseable content = writer.docPageContent()) {
|
||||
try (ContentCloseable table = writer.docTable("Cake Splices", null, ApiDocContentCss.overviewSummary)) {
|
||||
writeTableBoxHeader(writer, new String[] {"Name", "Start", "Stop", "Size"});
|
||||
for (FourCornerDotCake slice : FourCornerDotCake.values()) {
|
||||
writeCake(e, slice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeCake(ApiDocWriteEvent<ApiDocPage> e, FourCornerDotCake slice) throws IOException {
|
||||
String rootId = e.getDoc().getRootNode().getId();
|
||||
ApiDocContentWriter writer = e.getWriter();
|
||||
try (ContentCloseable tableRow = writer.docTableRow()) {
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colFirst);
|
||||
if (slice.ordinal() >= e.getDoc().getRootNode().getNodes().size()) {
|
||||
writer.printCharacters(slice.nameSpec());
|
||||
} else {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(ApiDocContentWriter.toSafeUri(rootId));
|
||||
buf.append("/");
|
||||
buf.append(ApiDocContentWriter.toSafeUri(slice.name()));
|
||||
buf.append("/index.html");
|
||||
writer.printHref(buf.toString(), slice.description(), slice.nameSpec(), "strong"); // TODO: reverse href method arguments
|
||||
}
|
||||
writer.printTagEnd(Tag.td);
|
||||
|
||||
try (ContentCloseable td = writer.printTag(Tag.td, ApiDocContentCss.colOne)) {
|
||||
writer.printCharacters(String.format("0x%06X", slice.getStart()));
|
||||
}
|
||||
try (ContentCloseable td = writer.printTag(Tag.td, ApiDocContentCss.colLast)) {
|
||||
writer.printCharacters(String.format("0x%06X", slice.getStop()));
|
||||
}
|
||||
try (ContentCloseable td = writer.printTag(Tag.td, ApiDocContentCss.colLast)) {
|
||||
writer.printCharacters(String.format("%d", slice.getLength()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,10 +24,17 @@ package org.x4o.fc18.cake2.fcdoc;
|
|||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.io.sax3.ContentCloseable;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeWriterMethod;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocConcept;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNodeBody;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
|
@ -70,4 +77,88 @@ public class FCDocSegmentWriterCake implements FCDocSegmentWriter {
|
|||
writer.printTagEnd(Tag.ul);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={TDocCake.class}, nodeBodyOrders=20)
|
||||
public void writeDefaultSummary(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
|
||||
// NOTE: copyed from defaultWriteSummary as that only called with zero summaries
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
ApiDocNode parent = event.getEventObject();
|
||||
ApiDocConcept concept = event.getDoc().findConceptByClass(parent.getUserData().getClass());
|
||||
List<ApiDocNode> nodes = parent.getNodes();
|
||||
if (nodes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String name = concept.getName()+" Summary";
|
||||
writer.docTableStart(name, "All childeren in "+name,ApiDocContentCss.overviewSummary);
|
||||
writer.docTableHeader("Name", "Description");
|
||||
for (ApiDocNode child : nodes) {
|
||||
String link = ApiDocContentWriter.toSafeUri(child.getId())+"/index.html";
|
||||
if (parent.getParent()==null) {
|
||||
link = ApiDocContentWriter.toSafeUri(parent.getId())+"/"+link; // root node
|
||||
}
|
||||
writer.docTableRowLink(link,child.getName(),child.getDescription());
|
||||
}
|
||||
writer.docTableEnd();
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={TDocCake.class}, nodeBodyOrders=30)
|
||||
public void writeTowerSummary(ApiDocWriteEvent<ApiDocNode> e) throws IOException {
|
||||
String rootId = e.getDoc().getRootNode().getId();
|
||||
ApiDocConcept concept = e.getDoc().findConceptByClass(e.getEventObject().getUserData().getClass());
|
||||
String tableName = concept.getName()+" Details";
|
||||
ApiDocContentWriter writer = e.getWriter();
|
||||
//try (ContentCloseable content = writer.docPageContent()) {
|
||||
try (ContentCloseable table = writer.docTable(tableName, null, ApiDocContentCss.overviewSummary)) {
|
||||
writeTableBoxHeader(writer, new String[] {"Cake", "Tower", "Start", "Stop", "Size", "External"});
|
||||
Set<FourCornerDotCake> linkableSlices = new HashSet<>();
|
||||
for (ApiDocNode towerNode : e.getEventObject().getNodes()) {
|
||||
for (ApiDocNode sliceNode : towerNode.getNodes()) {
|
||||
FourCornerDotCake slice = FourCornerDotCake.class.cast(sliceNode.getUserData());
|
||||
linkableSlices.add(slice);
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(ApiDocContentWriter.toSafeUri(rootId)); // TODO: add full tree node ID href version of toSafeUri
|
||||
buf.append("/");
|
||||
buf.append(ApiDocContentWriter.toSafeUri(towerNode.getId()));
|
||||
buf.append("/");
|
||||
buf.append(ApiDocContentWriter.toSafeUri(sliceNode.getId()));
|
||||
buf.append("/index.html");
|
||||
writeCake(writer, slice, buf.toString());
|
||||
}
|
||||
}
|
||||
for (FourCornerDotCake slice : FourCornerDotCake.values()) {
|
||||
if (linkableSlices.contains(slice)) {
|
||||
continue;
|
||||
}
|
||||
writeCake(writer, slice, null);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
private void writeCake(ApiDocContentWriter writer, FourCornerDotCake slice, String href) throws IOException {
|
||||
try (ContentCloseable tableRow = writer.docTableRow()) {
|
||||
try (ContentCloseable td = writer.printTag(Tag.td, ApiDocContentCss.colFirst)) {
|
||||
if (href == null) {
|
||||
writer.printCharacters(slice.nameSpec());
|
||||
} else {
|
||||
writer.printHref(href, slice.description(), slice.nameSpec(), "strong"); // TODO: reverse href method arguments
|
||||
}
|
||||
}
|
||||
try (ContentCloseable td = writer.printTag(Tag.td, ApiDocContentCss.colOne)) {
|
||||
writer.printCharacters(slice.tower().nameNice());
|
||||
}
|
||||
try (ContentCloseable td = writer.printTag(Tag.td, ApiDocContentCss.colLast)) {
|
||||
writer.printCharacters(String.format("0x%06X", slice.getStart()));
|
||||
}
|
||||
try (ContentCloseable td = writer.printTag(Tag.td, ApiDocContentCss.colLast)) {
|
||||
writer.printCharacters(String.format("0x%06X", slice.getStop()));
|
||||
}
|
||||
try (ContentCloseable td = writer.printTag(Tag.td, ApiDocContentCss.colLast)) {
|
||||
writer.printCharacters(String.format("%d", slice.getLength()));
|
||||
}
|
||||
try (ContentCloseable td = writer.printTag(Tag.td, ApiDocContentCss.colLast)) {
|
||||
writer.printCharacters(Boolean.toString(slice.isExternWord()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,9 +50,9 @@ import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
|||
*/
|
||||
public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter {
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=20)
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.DETAIL, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=20)
|
||||
public void writeDefaultSummary(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
|
||||
// NOTE: copyed from defaultWriteSummary as that only called with zero summaries
|
||||
// NOTE: copyed from defaultWriteSummary as that only called with zero summaries + changes name end in; Words
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
ApiDocNode parent = event.getEventObject();
|
||||
ApiDocConcept concept = event.getDoc().findConceptByClass(parent.getUserData().getClass());
|
||||
|
@ -60,7 +60,7 @@ public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter {
|
|||
if (nodes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String name = concept.getName()+" Summary";
|
||||
String name = concept.getName()+" Words";
|
||||
writer.docTableStart(name, "All childeren in "+name,ApiDocContentCss.overviewSummary);
|
||||
writer.docTableHeader("Name", "Description");
|
||||
for (ApiDocNode child : nodes) {
|
||||
|
@ -73,10 +73,23 @@ public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter {
|
|||
writer.docTableEnd();
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=10)
|
||||
public void writeMuffinSummary(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=1)
|
||||
public void writeCakeSliceDetails(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
FourCornerDotCake slice = (FourCornerDotCake)event.getEventObject().getUserData();
|
||||
try (ContentCloseable table = writer.docTable("Cake Slice", null, ApiDocContentCss.overviewSummary)) {
|
||||
writer.docTableHeader("Information", "Value");
|
||||
writer.docTableRow("Start index", String.format("0x%06X", slice.getStart()));
|
||||
writer.docTableRow("Stop index", String.format("0x%06X", slice.getStop()));
|
||||
writer.docTableRow("Size", Integer.toString(slice.getLength()));
|
||||
writer.docTableRow("External word", Boolean.toString(slice.isExternWord()));
|
||||
}
|
||||
// }
|
||||
//
|
||||
// @ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=10)
|
||||
// public void writeMuffinSummary(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
|
||||
// ApiDocContentWriter writer = event.getWriter();
|
||||
// FourCornerDotCake slice = (FourCornerDotCake)event.getEventObject().getUserData();
|
||||
if (slice.getStart() >= FourCornerDotCake.__MIND_THE_GAP8.getStart()) {
|
||||
return;
|
||||
}
|
||||
|
@ -125,17 +138,4 @@ public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter {
|
|||
writeP7x(writer, slice, conv);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=1)
|
||||
public void writeCakeSliceDetails(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
FourCornerDotCake slice = (FourCornerDotCake)event.getEventObject().getUserData();
|
||||
try (ContentCloseable table = writer.docTable("Cake Slice", null, ApiDocContentCss.overviewSummary)) {
|
||||
writer.docTableHeader("Information", "Value");
|
||||
writer.docTableRow("Start index", String.format("0x%06X", slice.getStart()));
|
||||
writer.docTableRow("Stop index", String.format("0x%06X", slice.getStop()));
|
||||
writer.docTableRow("Size", Integer.toString(slice.getLength()));
|
||||
writer.docTableRow("External word", Boolean.toString(slice.isExternWord()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.FourCornerDotCakeTower;
|
||||
import org.x4o.o2o.tdoc.ApiDocGenerator;
|
||||
import org.x4o.o2o.tdoc.DefaultPageWriterHelp;
|
||||
import org.x4o.o2o.tdoc.DefaultPageWriterTree;
|
||||
|
@ -45,7 +46,8 @@ import org.xml.sax.SAXException;
|
|||
*/
|
||||
public class FCDocWriter {
|
||||
|
||||
private static final String[] C_FC_ROOT = {"fc-root","Wedding","All cake slices.","The cake slices of the four corner cake tower."};
|
||||
private static final String[] C_FC_ROOT = {"fc-root","Wedding","All cake levels.","The cake tower of the four corner wedding cake."};
|
||||
private static final String[] C_FC_TOWER = {"fc-tower","Tower","All cake slices.","The cake slices of the four corner cake tower."};
|
||||
private static final String[] C_FC_SLICE = {"fc-slice","Cake","The cake slice information.","The four corner cake slice provides the layout of boundries."};
|
||||
private static final String[] C_FC_WORD = {"fc-word","Word","An FC18 word.","The word of an number."};
|
||||
|
||||
|
@ -68,7 +70,7 @@ public class FCDocWriter {
|
|||
}
|
||||
if ("-stop".equals(arg)) {
|
||||
if (!arguments.hasNext()) {
|
||||
System.err.println("No stop argument given, try; 255");
|
||||
System.err.println("No stop argument given, try; 255 or 2048");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
@ -98,7 +100,7 @@ public class FCDocWriter {
|
|||
|
||||
public FCDocWriter(Integer stopCakePoint) {
|
||||
this.doc = buildApiDoc(new TDocCake(), stopCakePoint);
|
||||
this.writer = new ApiDocGenerator(); // TODO: fix the cake "frame" links
|
||||
this.writer = new ApiDocGenerator();
|
||||
}
|
||||
|
||||
public ApiDoc getApiDoc() {
|
||||
|
@ -125,55 +127,54 @@ public class FCDocWriter {
|
|||
doc.setGroupTypeName("summary", "Summary",1);
|
||||
doc.setGroupTypeName("overview", "Overview",2);
|
||||
|
||||
//doc.addTreeNodeClassExclude();
|
||||
doc.setFrameNavConceptClass(TDocCakeWord.class);
|
||||
doc.addTreeNodeClassExclude(TDocCakeWord.class);
|
||||
doc.setFrameNavConceptClass(FourCornerDotCake.class);
|
||||
|
||||
doc.addTreeNodePageModeClass(TDocCake.class);
|
||||
doc.addTreeNodePageModeClass(FourCornerDotCake.class);
|
||||
doc.addTreeNodePageModeClass(TDocCakeTower.class);
|
||||
|
||||
doc.addAnnotatedClasses(FCDocSegmentWriterCake.class);
|
||||
doc.addAnnotatedClasses(FCDocSegmentWriterCakeWord.class);
|
||||
doc.addAnnotatedClasses(FCDocSegmentWriterCakeSlice.class);
|
||||
|
||||
ApiDocConcept adc1 = doc.addConcept(new ApiDocConcept(null,C_FC_ROOT,TDocCake.class));
|
||||
ApiDocConcept adc2 = doc.addConcept(new ApiDocConcept(adc1,C_FC_SLICE,FourCornerDotCake.class));
|
||||
ApiDocConcept adc3 = doc.addConcept(new ApiDocConcept(adc2,C_FC_WORD,TDocCakeWord.class));
|
||||
ApiDocConcept adc2 = doc.addConcept(new ApiDocConcept(adc1,C_FC_TOWER,TDocCakeTower.class));
|
||||
ApiDocConcept adc3 = doc.addConcept(new ApiDocConcept(adc2,C_FC_SLICE,FourCornerDotCake.class));
|
||||
/*ApiDocConcept adc4 = */doc.addConcept(new ApiDocConcept(adc3,C_FC_WORD,TDocCakeWord.class));
|
||||
|
||||
//ApiDocConcept adc4 = doc.addConcept(new ApiDocConcept(adc3,C_TABLE,Table.class));
|
||||
//adc4.addChildConcepts(new ApiDocConcept(adc4, CC_RS, Relationship.class));
|
||||
|
||||
doc.addDocPage(FCDocPageWriterMuffin.createDocPage());
|
||||
doc.addDocPage(FCDocPageWriterBaklava.createDocPage());
|
||||
doc.addDocPage(FCDocPageWriterCakeTower.createDocPage());
|
||||
doc.addDocPage(DefaultPageWriterTree.createDocPage());
|
||||
//doc.addDocPage(DefaultPageWriterIndexAll.createDocPage());
|
||||
doc.addDocPage(DefaultPageWriterHelp.createDocPage());
|
||||
|
||||
ApiDocNode rootNode = new ApiDocNode(docCake,"fc-root","WeddingNode","All cake slices in four corner.");
|
||||
ApiDocNode rootNode = new ApiDocNode(docCake,"fc-root","Tower","All cake tower floors.");
|
||||
doc.setRootNode(rootNode);
|
||||
for (FourCornerDotCake dotCake : FourCornerDotCake.values()) {
|
||||
|
||||
for (FourCornerDotCakeTower tower : FourCornerDotCakeTower.values()) {
|
||||
ApiDocNode towerNode = rootNode.addNode(createNodeCakeTower(tower));
|
||||
for (FourCornerDotCake dotCake : FourCornerDotCake.valuesByTower(tower)) {
|
||||
if (stopCakePoint != null && dotCake.getStart() > stopCakePoint) {
|
||||
break;
|
||||
}
|
||||
if (FourCornerDotCake.__RESERVED_WORDS.equals(dotCake)) {
|
||||
continue;
|
||||
}
|
||||
if (FourCornerDotCake.FC_UNI2K_11.ordinal() <= dotCake.ordinal()) {
|
||||
continue; // TODO: add as other class
|
||||
}
|
||||
ApiDocNode sliceNode = rootNode.addNode(createNodeCakeSlice(dotCake));
|
||||
|
||||
// TODO: maybe add extra grouping layer, as the `setFrameNavConceptClass` list is too big
|
||||
|
||||
ApiDocNode sliceNode = towerNode.addNode(createNodeCakeSlice(dotCake));
|
||||
for (int i = 0; i < dotCake.getLength(); i++) {
|
||||
ApiDocNode wordNode = sliceNode.addNode(createNodeCakeWord(dotCake, i));
|
||||
/*ApiDocNode wordNode =*/ sliceNode.addNode(createNodeCakeWord(dotCake, i));
|
||||
}
|
||||
|
||||
// TODO: print full 21 bit unicode range too
|
||||
}
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
private ApiDocNode createNodeCakeTower(FourCornerDotCakeTower tower) {
|
||||
return new ApiDocNode(new TDocCakeTower(tower), tower.name(), tower.nameNice(), tower.description());
|
||||
}
|
||||
|
||||
private ApiDocNode createNodeCakeSlice(FourCornerDotCake dotCake) {
|
||||
return new ApiDocNode(dotCake, dotCake.name(), dotCake.nameSpec(), dotCake.description());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.cake2.fcdoc;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCakeTower;
|
||||
|
||||
/**
|
||||
* Cake slice doc model type.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 19, 2025
|
||||
*/
|
||||
public class TDocCakeTower {
|
||||
|
||||
private final FourCornerDotCakeTower tower;
|
||||
|
||||
public TDocCakeTower(FourCornerDotCakeTower tower) {
|
||||
this.tower = tower;
|
||||
}
|
||||
|
||||
public FourCornerDotCakeTower getTower() {
|
||||
return tower;
|
||||
}
|
||||
}
|
|
@ -736,7 +736,18 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
|
|||
}
|
||||
}
|
||||
writer.printTagStart(Tag.li);
|
||||
writer.printHrefTarget(doc.getRootNode().getId()+"/"+ApiDocContentWriter.toSafeUri(node.getParent().getId())+"/"+node.getId()+"/"+node.getId()+"-frame.html", linkName,ApiDocContentCss.frameNavDetail.name());
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(doc.getRootNode().getId());
|
||||
buf.append("/");
|
||||
if (doc.getRootNode() != node.getParent()) {
|
||||
buf.append(ApiDocContentWriter.toSafeUri(node.getParent().getId()));
|
||||
buf.append("/");
|
||||
}
|
||||
buf.append(ApiDocContentWriter.toSafeUri(node.getId()));
|
||||
buf.append("/");
|
||||
buf.append(ApiDocContentWriter.toSafeUri(node.getId()));
|
||||
buf.append("-frame.html");
|
||||
writer.printHrefTarget(buf.toString(), linkName, ApiDocContentCss.frameNavDetail.name());
|
||||
writer.printTagEnd(Tag.li);
|
||||
}
|
||||
writer.printTagEnd(Tag.ul);
|
||||
|
|
Loading…
Reference in a new issue