From a84cd149cbd9825414380ac1938441bd0acfe988 Mon Sep 17 00:00:00 2001 From: Vedran Date: Thu, 22 Mar 2018 19:07:06 +0100 Subject: [PATCH] calculateLevel method refactored --- .../java/org/cactoos/scalar/InheritanceLevel.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/cactoos/scalar/InheritanceLevel.java b/src/main/java/org/cactoos/scalar/InheritanceLevel.java index 4733f36ecf..2ac6e3349c 100644 --- a/src/main/java/org/cactoos/scalar/InheritanceLevel.java +++ b/src/main/java/org/cactoos/scalar/InheritanceLevel.java @@ -85,25 +85,22 @@ public Integer value() { if (this.base.equals(this.derived)) { level = InheritanceLevel.IDENTICAL; } else { - level = InheritanceLevel.calculateLevel(this.derived, this.base); + level = this.calculateLevel(); } return level; } /** * Calculates inheritance level. - * @param cbase Base class - * @param cderived Derived class * @return Integer Level */ - private static int calculateLevel(final Class cderived, - final Class cbase) { + private int calculateLevel() { int level = InheritanceLevel.NOT_RELATED; - Class sclass = cderived.getSuperclass(); + Class sclass = this.derived.getSuperclass(); int idx = 0; while (!sclass.equals(Object.class)) { idx += 1; - if (sclass.equals(cbase)) { + if (sclass.equals(this.base)) { level = idx; break; }