Skip to content

Commit dcf57d2

Browse files
Emil Sjolanderfacebook-github-bot
authored andcommitted
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
1 parent 3fefe9f commit dcf57d2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

java/com/facebook/yoga/YogaValue.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,20 @@ public boolean equals(Object other) {
4444
public int hashCode() {
4545
return Float.floatToIntBits(value) + unit.intValue();
4646
}
47+
48+
@Override
49+
public String toString() {
50+
switch (unit) {
51+
case UNDEFINED:
52+
return "undefined";
53+
case POINT:
54+
return Float.toString(value);
55+
case PERCENT:
56+
return value + "%";
57+
case AUTO:
58+
return "auto";
59+
default:
60+
throw new IllegalStateException();
61+
}
62+
}
4763
}

0 commit comments

Comments
 (0)