提交 f44959f4 编写于 作者: qq_35526484's avatar qq_35526484

update the caculation to java

上级 229d01ef
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/scheme/scheme.txt" charset="GBK" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<compositeConfiguration>
<compositeBuild compositeDefinitionSource="SCRIPT" />
</compositeConfiguration>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="resolveModulePerSourceSet" value="false" />
<option name="testRunner" value="PLATFORM" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -33,11 +33,11 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'androidx.annotation:annotation:1.0.0'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation rootProject.ext.dependencies["lib_calculation"]
// implementation rootProject.ext.dependencies["lib_calculation"]
//临时
implementation 'com.google.code.gson:gson:2.8.5'
......
......@@ -2,7 +2,6 @@ package com.leiguoqiang.handwriting.model;
import android.util.Log;
import com.dosmono.device.KeyImpl;
import com.leiguoqiang.handwriting.entity.PointBean;
import java.math.BigDecimal;
......@@ -15,61 +14,61 @@ import java.math.BigDecimal;
public class CalculateModel {
public static float add(float a, float b) {
// float result = new BigDecimal(a).add(new BigDecimal(b)).floatValue();
// return Float.isNaN(result) ? 0.0f : result;
float result = KeyImpl.add(a, b);
float result = new BigDecimal(a).add(new BigDecimal(b)).floatValue();
return Float.isNaN(result) ? 0.0f : result;
}
public static float subtraction(float a, float b) {
// float result = new BigDecimal(a).subtract(new BigDecimal(b)).floatValue();
// float result = KeyImpl.add(a, b);
// return Float.isNaN(result) ? 0.0f : result;
}
float result = KeyImpl.subtraction(a, b);
public static float subtraction(float a, float b) {
float result = new BigDecimal(a).subtract(new BigDecimal(b)).floatValue();
return Float.isNaN(result) ? 0.0f : result;
// float result = KeyImpl.subtraction(a, b);
// return Float.isNaN(result) ? 0.0f : result;
}
public static float subtraction(long a, long b) {
// float result = new BigDecimal(a).subtract(new BigDecimal(b)).longValue();
// return Float.isNaN(result) ? 0.0f : result;
//
float result = KeyImpl.subtraction(a, b);
float result = new BigDecimal(a).subtract(new BigDecimal(b)).longValue();
return Float.isNaN(result) ? 0.0f : result;
//
// float result = KeyImpl.subtraction(a, b);
// return Float.isNaN(result) ? 0.0f : result;
}
public static float multiple(float a, float b) {
// float result = new BigDecimal(a).multiply(new BigDecimal(b)).floatValue();
// return Float.isNaN(result) ? 0.0f : result;
//
float result = KeyImpl.multiple(a, b);
float result = new BigDecimal(a).multiply(new BigDecimal(b)).floatValue();
return Float.isNaN(result) ? 0.0f : result;
//
// float result = KeyImpl.multiple(a, b);
// return Float.isNaN(result) ? 0.0f : result;
}
public static float divider(float a, float b) {
// float result = 0.0f;
// try {
// result = new BigDecimal(a).divide(new BigDecimal(b), 20, BigDecimal.ROUND_HALF_UP).floatValue();
// } catch (Exception e) {
// Log.i("handwriting_module:", "除法错误");
// }
// return Float.isNaN(result) ? 0.0f : result;
//
float result = KeyImpl.divider(a, b);
float result = 0.0f;
try {
result = new BigDecimal(a).divide(new BigDecimal(b), 20, BigDecimal.ROUND_HALF_UP).floatValue();
} catch (Exception e) {
Log.i("handwriting_module:", "除法错误");
}
return Float.isNaN(result) ? 0.0f : result;
// float result = KeyImpl.divider(a, b);
// return Float.isNaN(result) ? 0.0f : result;
}
public static float divider(long a, long b) {
// float result = 0;
// try {
// result = new BigDecimal(a).divide(new BigDecimal(b), 20, BigDecimal.ROUND_HALF_UP).longValue();
// } catch (Exception e) {
// Log.i("handwriting_module:", "除法错误");
// }
// return Float.isNaN(result) ? 0.0f : result;
//
float result = KeyImpl.divider(a, b);
float result = 0;
try {
result = new BigDecimal(a).divide(new BigDecimal(b), 20, BigDecimal.ROUND_HALF_UP).longValue();
} catch (Exception e) {
Log.i("handwriting_module:", "除法错误");
}
return Float.isNaN(result) ? 0.0f : result;
// float result = KeyImpl.divider(a, b);
// return Float.isNaN(result) ? 0.0f : result;
}
/**
......
#Mon Feb 17 14:16:59 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册