From dcf57d2f7e131dac42f961561f6dedb6429a9e27 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Fri, 12 May 2017 03:50:32 -0700 Subject: [PATCH] Big refactor moving most logic into DebugComponent Summary: This adds very little (no?) new features and mostly just refactors code to live in a singular place. Instead of users having to worry about DebugComponent as well as the DebugInfo object and attaching it correctly to a tree now user's of the DebugComponent API only need to worry about a single class, greatly simplifying its usage. Reviewed By: passy Differential Revision: D5027780 fbshipit-source-id: 95a95b3572747aa2088f8f9b35a160257eb59269 --- java/com/facebook/yoga/YogaValue.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/java/com/facebook/yoga/YogaValue.java b/java/com/facebook/yoga/YogaValue.java index c1741a78..5065d115 100644 --- a/java/com/facebook/yoga/YogaValue.java +++ b/java/com/facebook/yoga/YogaValue.java @@ -44,4 +44,20 @@ public class YogaValue { public int hashCode() { return Float.floatToIntBits(value) + unit.intValue(); } + + @Override + public String toString() { + switch (unit) { + case UNDEFINED: + return "undefined"; + case POINT: + return Float.toString(value); + case PERCENT: + return value + "%"; + case AUTO: + return "auto"; + default: + throw new IllegalStateException(); + } + } }