Back to project page Android-Lib-Database.
The source code is released under:
Apache License
If you think the Android project Android-Lib-Database listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package android.lib.database.predicate; // w ww . j a v a 2s. co m import java.util.ArrayList; import java.util.List; final class ThreeSidedPredicate extends Predicate { private ThreeSidedPredicate(final String predicate, final List<Object> parameters) { super(predicate, parameters); } public static ThreeSidedPredicate newInstance(final String template, final Object left, final Object middle, final Object right, final boolean leftIsValue, final boolean middleIsValue, final boolean rightIsValue) { final List<Object> parameters = new ArrayList<Object>(); final String predicate; if (leftIsValue) { parameters.add(left); } if (middleIsValue) { parameters.add(middle); } if (rightIsValue) { parameters.add(right); } if (leftIsValue) { if (middleIsValue) { if (rightIsValue) { predicate = String.format(template, Predicate.PARAMETER, Predicate.PARAMETER, Predicate.PARAMETER); } else { predicate = String.format(template, Predicate.PARAMETER, Predicate.PARAMETER, Predicate.PARAMETER); } } else { if (rightIsValue) { predicate = String.format(template, Predicate.PARAMETER, middle, Predicate.PARAMETER); } else { predicate = String.format(template, Predicate.PARAMETER, middle, right); } } } else { if (middleIsValue) { if (rightIsValue) { predicate = String.format(template, left, Predicate.PARAMETER, Predicate.PARAMETER); } else { predicate = String.format(template, left, Predicate.PARAMETER, right); } } else { if (rightIsValue) { predicate = String.format(template, left, middle, Predicate.PARAMETER); } else { predicate = String.format(template, left, middle, right); } } } return new ThreeSidedPredicate(predicate, parameters); } }