-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
499 changed files
with
2,271 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/armanco/integral/data/db/SectionTypeConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.armanco.integral.data.db | ||
|
||
import androidx.room.TypeConverter | ||
import com.armanco.integral.data.models.Section | ||
|
||
|
||
class SectionTypeConverter { | ||
|
||
@TypeConverter | ||
fun toSection(value: Int) = enumValues<Section>()[value] | ||
|
||
@TypeConverter | ||
fun fromSection(value: Section) = value.ordinal | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/armanco/integral/data/models/AngleUnit.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.armanco.integral.data.models | ||
|
||
enum class AngleUnit { | ||
DEGREE, | ||
RADIAN | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.armanco.integral.data.models | ||
|
||
object Keys { | ||
const val SECTION = "section" | ||
} |
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/armanco/integral/data/models/Section.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.armanco.integral.data.models | ||
|
||
enum class Section { | ||
INTEGRAL, | ||
TRIGONOMETRY | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.armanco.integral.data.models | ||
|
||
enum class Solver { | ||
INTEGRAL, | ||
TRIGONOMETRY, | ||
INVERSE_TRIGONOMETRY | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 10 additions & 18 deletions
28
app/src/main/java/com/armanco/integral/data/repository/SolverRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,27 @@ | ||
package com.armanco.integral.data.repository | ||
|
||
import com.mathlibrary.exception.CalculatorException | ||
import com.mathlibrary.integral.Integral | ||
import javax.inject.Inject | ||
|
||
class SolverRepository @Inject constructor() { | ||
|
||
@Throws(CalculatorException::class) | ||
fun trapezoidal(f: String, lowerLimit: Double, upperLimit: Double): Double? { | ||
return try { | ||
val integral = Integral(f, false) | ||
integral.trapezoidal(lowerLimit, upperLimit) | ||
} catch (e: Exception) { | ||
null | ||
} | ||
val integral = Integral(f, false) | ||
return integral.trapezoidal(lowerLimit, upperLimit) | ||
} | ||
|
||
@Throws(CalculatorException::class) | ||
fun simpson(f: String, lowerLimit: Double, upperLimit: Double): Double? { | ||
return try { | ||
val integral = Integral(f, false) | ||
integral.simpson(lowerLimit, upperLimit) | ||
} catch (e: Exception) { | ||
null | ||
} | ||
val integral = Integral(f, false) | ||
return integral.simpson(lowerLimit, upperLimit) | ||
} | ||
|
||
@Throws(CalculatorException::class) | ||
fun romberg(f: String, lowerLimit: Double, upperLimit: Double, steps: Int): Double? { | ||
return try { | ||
val integral = Integral(f, false) | ||
integral.Romberg(lowerLimit, upperLimit, steps) | ||
} catch (e: Exception) { | ||
null | ||
} | ||
val integral = Integral(f, false) | ||
return integral.Romberg(lowerLimit, upperLimit, steps) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.