@NonNull @Override public Value call(Context context, Value data, int dataIndex, Value... arguments) throws Exception { if (arguments.length < 1) { return ProteusConstants.TRUE; } return ParseHelper.parseBoolean(arguments[0]) ? ProteusConstants.FALSE : ProteusConstants.TRUE; }
@Override public Value compile(@Nullable Value value, Context context) { return ParseHelper.parseBoolean(value) ? ProteusConstants.TRUE : ProteusConstants.FALSE; } }
@NonNull @Override public Value call(Context context, Value data, int dataIndex, Value... arguments) throws Exception { Value i = arguments[0]; Value t = arguments[1]; Value e = arguments[2]; return ParseHelper.parseBoolean(i) ? t : e; }
@NonNull @Override public Value call(Context context, Value data, int dataIndex, Value... arguments) throws Exception { if (arguments.length < 1) { return ProteusConstants.FALSE; } boolean bool = true; for (Value argument : arguments) { bool = ParseHelper.parseBoolean(argument); if (!bool) { break; } } return bool ? ProteusConstants.TRUE : ProteusConstants.FALSE; }
@NonNull @Override public Value call(Context context, Value data, int dataIndex, Value... arguments) throws Exception { if (arguments.length < 1) { return ProteusConstants.FALSE; } boolean bool = false; for (Value argument : arguments) { bool = ParseHelper.parseBoolean(argument); if (bool) { break; } } return bool ? ProteusConstants.TRUE : ProteusConstants.FALSE; }
@NonNull private static Pair<int[], Value> parseState(ObjectValue value, Context context) { Value drawable = DrawableResourceProcessor.staticCompile(value.get(DRAWABLE_STR), context); int[] states = new int[value.getAsObject().entrySet().size() - 1]; int index = 0; for (Map.Entry<String, Value> entry : value.getAsObject().entrySet()) { Integer stateInteger = sStateMap.get(entry.getKey()); if (stateInteger != null) { // e.g state_pressed = true state_pressed = false states[index] = ParseHelper.parseBoolean(entry.getValue()) ? stateInteger : -stateInteger; index++; } else { throw new IllegalArgumentException(entry.getKey() + " is not a valid state"); } } return new Pair<>(states, drawable); }