Łukasiewicz谓词逻辑?(Łukasiewicz predicate logic?)
有没有办法用Java API模拟Łukasiewicz的三值逻辑?
更具体地说,我想模仿Łukasiewicz''M' (“这不是假的......”)运算符。
例如,我需要构造这个
Predicate<String>
,它给出了以下结果:predicate.test("0") = false predicate.test(null) = true predicate.test("1") = true
当否定时,给出:
predicate.negate().test("0") = true predicate.negate().test(null) = true predicate.negate().test("1") = false
如果要测试的值是
A
,则我的谓词计算MA
。negate()
做的是计算¬MA
而我希望它计算M¬A
。PS不要用三值替换
boolean
值来解决使用三值替换Predicate
的答案,因为我非常清楚自己如何做到这一点。 我问这个问题是为了找出纯Java8是否有可能,只需要很少的额外编码工作。Is there a way to emulate Łukasiewicz' three-valued logic with the Java API?
More concretely, I want to emulate Łukasiewicz' 'M' ("it is not false that...") operator.
For example I need to construct this
Predicate<String>
which gives the following results:predicate.test("0") = false predicate.test(null) = true predicate.test("1") = true
which when negated, gives:
predicate.negate().test("0") = true predicate.negate().test(null) = true predicate.negate().test("1") = false
If the value to test is
A
, my predicate calculatesMA
. Whatnegate()
does is calculate¬MA
whereas I want it to calculateM¬A
.P.S. Don't bother working out an answer with a three-valued replacement for
Predicate
with a three-valued replacement ofboolean
, because I know well enough how to do that myself. I'm asking this question to find out if it's possible with pure Java8 with minimal extra coding effort.
原文:https://stackoverflow.com/questions/33982052
最满意答案
是的你应该。
.gitmodules
文件由其他文件(如.gitignore
文件)进行版本控制。 它还与项目的其余部分一起推拉。你可以做
$ git diff --cached --submodule
更清楚当您提交这些更改时,您将看到诸如
create mode 160000 comms
类的消息160000模式是Git中的一种特殊模式,这意味着您将提交记录为目录条目而不是子目录或文件
Yes, you should. The
.gitmodules
file is version-controlled with the other files, like the.gitignore
file. It’s also pushed and pulled with the rest of the project.you can do
$ git diff --cached --submodule
to be more clearwhen you commit these changes you will see message like
create mode 160000 comms
The 160000 mode is a special mode in Git which means you’re recording a commit as a directory entry rather than a subdirectory or a file
相关问答
更多-
Git子模块工作流程(Git submodules workflow)[2024-02-06]
你可能想要尝试git子树 ( alt link )。 在我的项目中,我使用了远程回馈和干净(无历史记录)分支机构,运气很好。 You may want to try git subtree (alt link) instead. I’ve had a lot of luck with it, using both remote repos and clean (untied to master history) branches in my project. -
您可以使用与git submodule init一样使用的机制,即查看.gitmodules 。 该文件枚举每个子模块路径及其引用的URL。 例如,从repo的根, cat .gitmodules将打印内容到屏幕(假设你有cat )。 编辑: 因为.gitmodule文件具有git配置格式,可以使用git config来解析这些文件: git config --file .gitmodules --name-only --get-regexp path 将显示所有子模块条目,并与 git config - ...
-
是的,你可以rm -rf .git/modules/XXX 。 Yes, you can rm -rf .git/modules/XXX.
-
跟踪子模块中的更改(Tracking changes in submodules)[2022-06-02]
可以在子模块的存储库中本地检查子模块的更改。 它们不需要被推回到子模块的原始位置。 但是,如果您要在团队外部共享父项目,则需要公开显示子模块更改。 例: 本地存储库“foo” foo中的子模块称为“bar” 在bar内进行更改,最好在新分支内进行 在bar内本地提交这些更改 在本地提交foo 只要您不在外部共享此存储库,这很好。 否则,您必须将更改推送到子模块,以便其他团队成员可以看到您对子模块的更改。 Changes to submodules can be checked in locally with ... -
对所有repo克隆执行--recurse-submodules = on-demand(Enforce --recurse-submodules=on-demand for all clones of a repo)[2023-04-11]
还没有:该补丁中提出的配置“ push.recurseSubmodules ”没有通过。 即使它有,这意味着每个用户都需要配置他/她的克隆。 唯一的其他解决方案是定义一个别名(如“ git - default push to --recurse-submodules=check ”)。 同样,这是一个按用户的解决方案(没有简单的方法将该设置从一个中央仓库传播到其所有克隆)。 Not yet: the config "push.recurseSubmodules" proposed in that patch ... -
Git子模块混乱(Git submodules confusion)[2022-04-15]
内部git跟踪文件夹不存在于s中,而是列出了类似链接的条目,其中包含像sha哈希的字母数字 那些不是子模块,而是简单的gitlink ( 索引中的特殊条目 ),代表嵌套的git repo SHA1。 请参阅“ 嵌套git repos和子模块之间的区别 ”。 有什么方法可以从我的主要git仓库中恢复我的更改,还是他们永远丢失了? 至少克隆你的repo(你推送gitlinks +你的代码的那个):你会在那里找到你的变化。 然后从一个新的回购开始,并强制推动。 有没有办法让内部仓库(现在是一个链接)到我将代码推送 ... -
Git子模块和螺纹钢(Git submodules and rebar)[2023-02-04]
在Erlang应用程序的代码中添加其他应用程序以允许其他开发人员轻松更新而不使用git子模块的正确方法是什么? 将该应用添加到rebar.config并使用: ./rebar update-deps 用于更新。 第一次,你需要使用: ./rebar get-deps 请参阅: https : //github.com/basho/rebar/wiki/Rebar-commands 现在,回到你的错误。 我的感觉是,您的代码中有一个(几乎)空的mochiweb目录,可能是因为使用了Git子模块。 当您运行 ... -
将子模块添加到存储库(Adding submodules to a repository)[2024-03-02]
是的你应该。 .gitmodules文件由其他文件(如.gitignore文件)进行版本控制。 它还与项目的其余部分一起推拉。 你可以做$ git diff --cached --submodule更清楚 当您提交这些更改时,您将看到诸如create mode 160000 comms类的消息 160000模式是Git中的一种特殊模式,这意味着您将提交记录为目录条目而不是子目录或文件 Yes, you should. The .gitmodules file is version-controlled wi ... -
Git子模块是-dirty?(Git submodules are being -dirty?)[2022-03-13]
-dirty后缀表示子模块已更改。 做这个: cd wp-content/plugins/advanced-custom-fields 然后 git status 并且您将看到哪些更改导致您的子模块变脏。 the -dirty suffix means the submodule has changed. do this: cd wp-content/plugins/advanced-custom-fields then git status and you'll see what changes ... -
使用单个git存储库而不是子模块管理不同的代码库(Manage different codebases using single git repository instead of submodules)[2023-07-23]
是的,你可以使用orphan分支。 orphan分支将从新父分支重新开始,因此它不会与任何其他分支进行任何共同提交。 这样,您可以拥有多个分支,每个分支对应于相应菜谱的不同提交历史记录。 所以你需要做的就是: git checkout --orphan newbranch 从git checkout手册页 : --orphan创建一个名为 的新孤立分支,从 启动并切换到它。 在这个新分支上进行的第一次提交将没有父项,它将成为与所有其 ...