亲属计算规则算法--java实现(关键算法摘要)

本文介绍了一种亲属计算规则算法的Java实现,详细阐述了关键算法的思路和步骤,帮助读者理解如何在编程中处理亲属关系计算问题。
摘要由CSDN通过智能技术生成

 一个简单的亲属关系计算算法实现

package com.zifamily.zfapp.sns;

import org.apache.commons.collections.CollectionUtils;
import org.junit.Before;
import org.junit.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.stream.Collectors;

/**
 * 家人关系推算
 * @author QYF
 * @Title: RoleReckonTest
 * @Date: 2018/12/14 11:48
 */
public class RoleReckonTest {

    //【关系】f:父,m:母,h:夫,w:妻,s:子,d:女
    //【修饰符】 1:男性,0:女性

    public  HashMap<String,String> roleMap=new HashMap();

    /**
     * 角色性别   1--男性 ;0--女性
     */
    public  HashMap<String,String> roleSex=new HashMap();

    /**
     * 角色反转
     */

    public  HashMap<String,String> roleRef=new HashMap();

    @Before
    public void addData(){

       // roleMap.put("jr","家人");
        roleMap.put("f,f","爷爷");
        roleMap.put("f,m","奶奶");
        roleMap.put("m,f","外公");
        roleMap.put("m,m","外婆");
        roleMap.put("f","爸爸");
        roleMap.put("m","妈妈");

        roleMap.put("h,f","公公");
        roleMap.put("h,m","婆婆");

        roleMap.put("w,f","岳父");
        roleMap.put("w,m","岳母");
        roleMap.put("f,ob","伯父");
        roleMap.put("f,ob,w","伯母");
        roleMap.put("f,lb","叔叔");
        roleMap.put("f,lb,w","婶婶");

        roleMap.put("f,os","姑母");   //????
        roleMap.put("f,ls","姑姐");       //????
        roleMap.put("f,xs,h","姑丈"); //????


        roleMap.put("m,ob","大舅");
        roleMap.put("m,ob,w","大舅妈");
        roleMap.put("m,lb","小舅");
        roleMap.put("m,lb,w","小舅妈");
        roleMap.put("m,os","大姨");
        roleMap.put("m,os,h","大姨父");
        roleMap.put("m,ls","小姨");
        roleMap.put("m,ls,h","小姨父");
        roleMap.put("ob","哥哥");
        roleMap.put("os","姐姐");
        roleMap.put("lb","弟弟");
        roleMap.put("ls","妹妹");
        roleMap.put("ob,w","嫂子");
        roleMap.put("lb,w","弟妹");
        roleMap.put("os,h","姐夫");
        roleMap.put("ls,h","妹夫");


        roleMap.put("f,xb,s&o","堂哥");  //解析?
        roleMap.put("f,xb,d&o","堂姐");  //解析?
        roleMap.put("f,xb,d&l","堂妹");
        roleMap.put("f,xb,s&l","堂弟");

        roleMap.put("f,xs,s&o","表哥");   //姑表哥
        roleMap.put("m,xb,s&o","表哥");   //舅表哥
        roleMap.put("m,xs,s&o","表哥");   //姨表哥

        roleMap.put("m,xb,d&o","表姐");   //舅表姐
        roleMap.put("m,xs,d&o","表姐");   //姨表姐
        roleMap.put("f,xs,d&o","表姐");   //姑表姐

        roleMap.put("f,xs,s&l","表弟");   //姑表弟
        roleMap.put("m,xb,s&l","表弟");   //舅表弟
        roleMap.put("m,xs,s&l","表弟");   //姨表弟

        roleMap.put("m,xb,d&l","表妹");   //舅表妹
        roleMap.put("m,xs,d&l","表妹");   //姨表妹
        roleMap.put("f,xs,d&l","表妹");   //姑表妹


        roleMap.put("h","老公");
        roleMap.put("h,ob","大伯子");
        roleMap.put("h,lb","小叔子");
        roleMap.put("h,os","大姑子");
        roleMap.put("h,ls","小姑子");
        roleMap.put("h,ob,w","大婶子");
        roleMap.put("h,lb,w","小婶子");

        roleMap.put("h,os,h","大姑夫");    //大姑子的老公?
        roleMap.put("h,ls,h","小姑夫");    //小姑子的老公?

        roleMap.put("w","老婆");
        roleMap.put("w,ob","大舅子&#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值