From c843c4fe769b8b2f1bdfb6105abda230b839eeed Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Mon, 9 Nov 2020 01:31:44 +0100 Subject: [PATCH] arachis'd --- .../prediction/StructurePredictor.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/G-Earth/src/main/java/gearth/misc/packetrepresentation/prediction/StructurePredictor.java b/G-Earth/src/main/java/gearth/misc/packetrepresentation/prediction/StructurePredictor.java index aa1f413..e6d360c 100644 --- a/G-Earth/src/main/java/gearth/misc/packetrepresentation/prediction/StructurePredictor.java +++ b/G-Earth/src/main/java/gearth/misc/packetrepresentation/prediction/StructurePredictor.java @@ -44,18 +44,19 @@ public class StructurePredictor { while (index < packet.getBytesLength()) { double currentLogScore = dynamic[index - 6].logScore; for (TypeChecker typeChecker : typeCheckers) { - if (typeChecker.canRead(index)) { - double score = typeChecker.score(index); - double newScore = currentLogScore + Math.log(score); - int nextIndex = typeChecker.nextIndex(index) - 6; - if (dynamic[nextIndex] == null || newScore > dynamic[nextIndex].logScore) { - dynamic[nextIndex] = new SubStructure( - index - 6, - typeChecker.getStructCode(), - newScore - ); - } + if (!typeChecker.canRead(index)) continue; + + double score = typeChecker.score(index); + double newScore = currentLogScore + Math.log(score); + int nextIndex = typeChecker.nextIndex(index) - 6; + if (dynamic[nextIndex] == null || newScore > dynamic[nextIndex].logScore) { + dynamic[nextIndex] = new SubStructure( + index - 6, + typeChecker.getStructCode(), + newScore + ); } + } index++; }