[软件构造]Lab 2

星期五的晚上

  • 写写 Lab2 放松一下

EclEmma

  • 挺有意思的

Part 1 Poetic Walks

  • purpose: ADT 's desiging ,testing ,and implementing
  • spec ; are privided
  • mutable types
  • next is more difficult

Freedom and Restrictions

Overview 总览

  • implement : graph
  • timeless art of paralleled briliance 永恒的才华的瑰宝

P1-3:

  • Graph:
  • labeled vertices 结点有标记
  • mutable weighted directed graphs 可变权有向图
  • mutable graph可变图:顶点和边可以被add和remove from the graph
  • directed edges有向边 : edge from a source vertex to a target vertxt 边从源顶点到目标顶点
  • weighted edges带权边:edges are associated with a positive integer weight 一个边与一个正整数相关联(二元组)
  • labeled vertices有名点:vertices are distinguished by a label of some immutable t
    ype.fo顶点通过immutable type相区分
Graph doc 看graog.java的程序
  • Graph 是一个generic type(类属性)类似于List或Map<K,V>,

  • in the specification of List,E is a placeholder for the types of the element in the list.E是个类型的占位符,

  • in Map,K and V are placeholders for the types of keys and values,在 映射 里,K和V是关键字类型和值类型的占位符。

  • Only later does the client of List or Map choose patticular types for theses place holder by constructing只是到了后来,甲方才会用type改成占位符

  • The specification of a genetic type is written in terms of the placeholders,genetic type的规约依据(in terms of)占位符来写。Map<K,V>里头,K在规约里头就得说是immutable…

  • in our spectification for Graph 我们对L的immutability作除一样的要求,mutable vertex是violate the precondition 违反前置条件的。

  • 要实现两次Graph ,,用两种不同的reps(represent 应该就是ADT interface里的实现 翻译为 表述),练习选择抽象函数,防止内部量泄露

P4

  • with our graph datatype in hand,we will implement GraphPoet ,a class for generating poetry using a word affinity graph. 用我们在手边的graph类型,我们来实现GraphPoet,一个类生成诗,通过词汇吸引图。
    *(awesome 像那么回事了)
  • input: 来自Tolkien的phrase短语
  • They spoke no more of the small news of the Shire far away, nor of the dark shadows and perils that encompassed them, but of the fair things they had seen in the world together
  • (他们不再提及遥远Shire的小事,不再提及黑夜的阴影和笼罩他们的危险,而是那些他们共度的golden时光)(信达雅!!!)
  • output:
  • 他们的言语/
  • 凌越那些远处的细碎世事/
  • 不见黑夜的影子和周遭暗流/
  • 而又光热/
  • 三千世界未睹/
  • 的绵绵光热/
  • (长短句 结合 一代文豪!!!!)

Problem 1:Test graph

  • Devise,document,and implement tests for Graph

  • For now,我们只test有String label的Graph,一会我们扩label

  • 为了运行我们的test关于mutiple的Graph interface,here is the setup 这就是设置(mmp !too much!fuc…k shi…t)

  • static Graph.empty() 的测试策略和测试在 Grapf…里头有。。。。。。。。。。。。。

  • 2022/5/10 先开始做吧

  • 具体的要求什么的边看编写 参考ppt的写法吧。

Problem 1 Test的设置

  • 以P1/test添加进buildpath
  • 再把junit4库添加进buildpath
  • 然后就可以执行测试了
  • 可以顺便看看java网课一些其他的内容
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值