Commit 4c575546 authored by Dorchies David's avatar Dorchies David
Browse files

feat: load session, run nub, get result

Refs #1
parents
No related merge requests found
Showing with 105 additions and 0 deletions
+105 -0
^.*\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
.gitignore 0 → 100644
.Rproj.user
.Rhistory
.RData
.Ruserdata
.V8history
DESCRIPTION 0 → 100644
Package: rcassiopee
Type: Package
Title: What the Package Does (Title Case)
Version: 0.1.0
Author: Who wrote it
Maintainer: The package maintainer <yourself@somewhere.net>
Description: More about what it does (maybe more than one line)
Use four spaces when indenting paragraphs within the Description.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Imports:
V8
LICENSE 0 → 100644
YEAR: 2020
COPYRIGHT HOLDER: David Dorchies
LICENSE.md 0 → 100644
# MIT License
Copyright (c) 2020 David Dorchies
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
NAMESPACE 0 → 100644
exportPattern("^[[:alpha:]]+")
R/CalcNub.R 0 → 100644
CalcNub <- function(sv8, uid) {
s <- paste0("jalhyd.Session.getInstance().findNubByUid(\"", uid, "\").CalcSerie()")
sv8$eval(s)
}
R/Cassiopee.R 0 → 100644
#' Title
#'
#' @return
#' @export
#'
#' @examples
Cassiopee <- function() {
ct <- v8()
ct$source(system.file("jalhyd", "bundle.js", package = "rcassiopee"))
return(ct)
}
GetResult <- function(sv8, uid, key = "", element = 0) {
if(key == "") {
key <- "vCalc"
} else {
key <- paste0("values.", key)
}
s <- paste0("jalhyd.Session.getInstance().findNubByUid(\"", uid, "\").result.resultElements[", element, "].", key)
as.numeric(sv8$eval(s))
}
#' Title
#'
#' @param sv8
#' @param x
#'
#' @return
#' @export
#'
#' @examples
LoadSession <- function(sv8, x) {
if(file.exists(x)) {
x <- readLines(x)
}
sv8$assign("sess", x)
sv8$eval("jalhyd.Session.getInstance().unserialise(sess)")
}
This diff is collapsed.
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 4
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment