diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2015-07-24 21:47:55 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2015-07-24 21:47:55 +0000 |
commit | 7481844c98f174b1a0cedc56385872b8f4e343a2 (patch) | |
tree | ad78c6cc7e6bd8fa1aadf4e2effb366160678e6e /src/java/org/apache/poi/sl/draw/geom/ModExpression.java | |
parent | b5fcac48e1606a9d3893cbd31adcf94459192c31 (diff) | |
parent | 4e1c37905af496fcf0719b3ed623295c410040a9 (diff) | |
download | poi-7481844c98f174b1a0cedc56385872b8f4e343a2.tar.gz poi-7481844c98f174b1a0cedc56385872b8f4e343a2.zip |
merged common_sl branch to trunk
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1692593 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/sl/draw/geom/ModExpression.java')
-rw-r--r-- | src/java/org/apache/poi/sl/draw/geom/ModExpression.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/sl/draw/geom/ModExpression.java b/src/java/org/apache/poi/sl/draw/geom/ModExpression.java new file mode 100644 index 0000000000..ff20fc20f6 --- /dev/null +++ b/src/java/org/apache/poi/sl/draw/geom/ModExpression.java @@ -0,0 +1,49 @@ +/* + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +package org.apache.poi.sl.draw.geom; + +import java.util.regex.Matcher; + +/** + * Modulo Formula: + * <p> + * Arguments: 3 (fmla="mod x y z") + * Usage: "mod x y z" = sqrt(x^2 + b^2 + c^2) = value of this guide + * </p> + * + * @author Yegor Kozlov + */ +public class ModExpression implements Expression { + private String arg1, arg2, arg3; + + ModExpression(Matcher m){ + arg1 = m.group(1); + arg2 = m.group(2); + arg3 = m.group(3); + } + + public double evaluate(Context ctx){ + double x = ctx.getValue(arg1); + double y = ctx.getValue(arg2); + double z = ctx.getValue(arg3); + return Math.sqrt(x*x + y*y + z*z); + } + +} |