This repository was archived by the owner on Aug 5, 2023. It is now read-only.
Repository navigation
Use Cases
yueyinqiu edited this page May 5, 2023
·
1 revision
为防编码问题,同时照顾对相关内容了解较浅的外国友人(这对我们来说应该大概或许是深入到血液中的 &doge ),除注释外,代码使用了全英语。考虑到用例也会涉及到很多类名和实际概念重名,中文反而更难说清,因此用例以全英文给出(就是懒不想写第二份)。若有难懂之处可以联系添加中文用例。
All the codes could be found in the solution directory UseCases.
using YiJingFramework.PrimitiveTypes;
using YiJingFramework.PrimitiveTypes.GuaWithFixedCount;
using YiJingFramework.EntityRelationships.MostAccepted.EntityYinyangExtensions;
var qian = GuaTrigram.Parse("111");
Console.WriteLine(qian.Yinyang());
Console.WriteLine();
// Ouput: Yang
var zi = Dizhi.Zi;
Console.WriteLine(zi.Yinyang());
Console.WriteLine();
// Ouput: Yang
var jia = Tiangan.Jia;
Console.WriteLine(jia.Yinyang());
Console.WriteLine();
// Ouput: Yang| ☷ | ☶ | ☵ | ☴ | ☳ | ☲ | ☱ |
|---|---|---|---|---|---|---|
| 阴 | 阳 | 阳 | 阴 | 阳 | 阴 | 阴 |
| 000 | 001 | 010 | 011 | 100 | 101 | 110 |
|---|---|---|---|---|---|---|
| Yin | Yang | Yang | Yin | Yang | Yin | Yin |
| 甲 | 乙 | 丙 | 丁 | 戊 | 己 | 庚 | 辛 | 壬 | 癸 |
|---|---|---|---|---|---|---|---|---|---|
| 阳 | 阴 | 阳 | 阴 | 阳 | 阴 | 阳 | 阴 | 阳 | 阴 |
| Jia | Yi | Bing | Ding | Wu | Ji | Geng | Xin | Ren | Gui |
|---|---|---|---|---|---|---|---|---|---|
| Yang | Yin | Yang | Yin | Yang | Yin | Yang | Yin | Yang | Yin |
| 子 | 丑 | 寅 | 卯 | 辰 | 巳 | 午 | 未 | 申 | 酉 | 戌 | 亥 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 阳 | 阴 | 阳 | 阴 | 阳 | 阴 | 阳 | 阴 | 阳 | 阴 | 阳 | 阴 |
| Zi | Chou | Yin | Mao | Chen | Si | Wu | Wei | Shen | You | Xu | Hai |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Yang | Yin | Yang | Yin | Yang | Yin | Yang | Yin | Yang | Yin | Yang | Yin |
using YiJingFramework.PrimitiveTypes;
using YiJingFramework.PrimitiveTypes.GuaWithFixedCount;
using YiJingFramework.EntityRelationships.MostAccepted.EntityWuxingExtensions;
var qian = GuaTrigram.Parse("111");
Console.WriteLine(qian.Wuxing());
Console.WriteLine();
// Ouput: Metal
var zi = Dizhi.Zi;
Console.WriteLine(zi.Wuxing());
Console.WriteLine();
// Ouput: Water
var jia = Tiangan.Jia;
Console.WriteLine(jia.Wuxing());
Console.WriteLine();
// Ouput: Wood| ☷ | ☶ | ☵ | ☴ | ☳ | ☲ | ☱ |
|---|---|---|---|---|---|---|
| 土 | 土 | 水 | 木 | 木 | 火 | 金 |
| 000 | 001 | 010 | 011 | 100 | 101 | 110 |
|---|---|---|---|---|---|---|
| Earth | Earth | Water | Wood | Wood | Fire | Metal |
| 甲 | 乙 | 丙 | 丁 | 戊 | 己 | 庚 | 辛 | 壬 | 癸 |
|---|---|---|---|---|---|---|---|---|---|
| 木 | 木 | 火 | 火 | 土 | 土 | 金 | 金 | 水 | 水 |
| Jia | Yi | Bing | Ding | Wu | Ji | Geng | Xin | Ren | Gui |
|---|---|---|---|---|---|---|---|---|---|
| Wood | Wood | Fire | Fire | Earth | Earth | Metal | Metal | Water | Water |
| 子 | 丑 | 寅 | 卯 | 辰 | 巳 | 午 | 未 | 申 | 酉 | 戌 | 亥 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 水 | 土 | 木 | 木 | 土 | 火 | 火 | 土 | 金 | 金 | 土 | 水 |
| Zi | Chou | Yin | Mao | Chen | Si | Wu | Wei | Shen | You | Xu | Hai |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Water | Earth | Wood | Wood | Earth | Fire | Fire | Earth | Metal | Metal | Earth | Water |
using YiJingFramework.PrimitiveTypes;
using YiJingFramework.EntityRelationships.MostAccepted;
using YiJingFramework.EntityRelationships.MostAccepted.WuxingRelationshipExtensions;
var wood = Wuxing.Wood;
var metal = Wuxing.Metal;
var relationship = WuxingRelationship.OvercomingMe;
Console.WriteLine(
$"For {wood}, " +
$"{metal} is the Wuxing that {wood.GetWuxingRelationship(metal)}.");
Console.WriteLine(
$"For {wood}, " +
$"the Wuxing that {relationship} is {wood.GetWuxingThat(relationship)}.");
Console.WriteLine();
// Outputs:
// For Wood, Metal is the Wuxing that OvercomingMe.
// For Wood, the Wuxing that OvercomingMe is Metal.| 关系 | 木 | 火 | 土 | 金 | 水 |
|---|---|---|---|---|---|
| 同我 | 木 | 火 | 土 | 金 | 水 |
| 生我 | 水 | 木 | 火 | 土 | 金 |
| 我生 | 火 | 土 | 金 | 水 | 木 |
| 克我 | 金 | 水 | 木 | 火 | 土 |
| 我克 | 土 | 金 | 水 | 木 | 火 |
| Relationship | Wood | Fire | Earth | Metal | Water |
|---|---|---|---|---|---|
| SameAsMe | Wood | Fire | Earth | Metal | Water |
| GeneratingMe | Water | Wood | Fire | Earth | Metal |
| GeneratedByMe | Fire | Earth | Metal | Water | Wood |
| OvercomingMe | Metal | Water | Wood | Fire | Earth |
| OvercameByMe | Earth | Metal | Water | Wood | Fire |
using YiJingFramework.PrimitiveTypes;
using YiJingFramework.PrimitiveTypes.GuaWithFixedCount;
using YiJingFramework.EntityRelationships.MostAccepted.GuaDerivingExtensions;
Console.WriteLine(Gua.Parse("111111").ReverseLines(1, 2, 3, 2));
Console.WriteLine();
// Output: 101011
Console.WriteLine(Gua.Parse("10100000").Cuogua());
Console.WriteLine();
// Output: 01011111
Console.WriteLine(Gua.Parse("11110101").Zonggua());
Console.WriteLine();
// Output: 10101111
Console.WriteLine(GuaHexagram.Parse("111000").Hugua());
Console.WriteLine();
// Output: 110100
Console.WriteLine(GuaHexagram.Parse("100110").Jiaogua());
Console.WriteLine();
// Output: 110100
Console.WriteLine(Gua.Parse("10011011").Split(3).ElementAt(0));
Console.WriteLine(Gua.Parse("10011011").Split(3).ElementAt(1));
Console.WriteLine(Gua.Parse("10011011").Split(3).ElementAt(2));
Console.WriteLine();
// Outputs:
// 100
// 110
// 11using YiJingFramework.PrimitiveTypes;
using YiJingFramework.PrimitiveTypes.GuaWithFixedCount;
using YiJingFramework.EntityRelationships.MostAccepted.GuaToCharacterExtensions;
Console.OutputEncoding = System.Text.Encoding.Unicode;
// If you cannot correctly see the outputs below, try modifing your text encodings or fonts.
Console.WriteLine(GuaWith1Line.Parse("1").ToUnicodeChar());
Console.WriteLine();
// Output: ⚊
Console.WriteLine(GuaWith2Lines.Parse("11").ToUnicodeChar());
Console.WriteLine();
// Output: ⚌
Console.WriteLine(GuaTrigram.Parse("111").ToUnicodeChar());
Console.WriteLine();
// Output: ☰
Console.WriteLine(GuaHexagram.Parse("111111").ToUnicodeChar());
Console.WriteLine();
// Output: ䷀
_ = GuaToCharacterExtensions.TryFromUnicodeChar('䷀', out Gua? result);
Console.WriteLine(result);
// Output: