/** Number of names. */ protectedstaticfloat nameCount; /** Names to use for children. */ protectedstaticfinal String[] NAMES; /** Potential fonts used to draw with. */ protectedstatic Font[] fonts; /** Used to generate the names. */ protectedstatic Random nameGen; /** Number of children to create for each node. */ protectedstaticfinalint DEFAULT_CHILDREN_COUNT = 7;
/** *MessagedthefirsttimegetChildCountismessaged.Creates *childrenwithrandomnamesfromnames.
*/ protectedvoid loadChildren() {
DynamicTreeNode newNode;
Font font; int randomIndex;
SampleData data;
for (int counter = 0; counter < DynamicTreeNode.DEFAULT_CHILDREN_COUNT;
counter++) {
randomIndex = (int) (nameGen.nextFloat() * nameCount);
String displayString = NAMES[randomIndex]; if (fonts == null || fonts[randomIndex].canDisplayUpTo(displayString)
!= -1) {
font = null;
} else {
font = fonts[randomIndex];
}
if (counter % 2 == 0) {
data = new SampleData(font, Color.red, displayString);
} else {
data = new SampleData(font, Color.blue, displayString);
}
newNode = new DynamicTreeNode(data); /* Don't use add() here, add calls insert(newNode, getChildCount()) soifyouwanttouseadd,justbesuretosethasLoaded=true
first. */
insert(newNode, counter);
} /* This node has now been loaded, mark it so. */
hasLoaded = true;
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-09-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.