-
大小: 3.85MB文件类型: .rar金币: 1下载: 0 次发布日期: 2023-10-01
- 语言: Java
- 标签: ntroduction to Java Programming
资源简介
Introduction to Java Programming第八版的原码+习题代码,作者Y.daniel Liang
代码片段和文件信息
import java.util.*;
public abstract class AbstractGraph implements Graph {
protected List vertices; // Store vertices
protected List> neighbors; // Adjacency lists
/** Construct a graph from edges and vertices stored in arrays */
protected AbstractGraph(int[][] edges V[] vertices) {
this.vertices = new ArrayList();
for (int i = 0; i < vertices.length; i++)
this.vertices.add(vertices[i]);
createAdjacencyLists(edges vertices.length);
}
/** Construct a graph from edges and vertices stored in List */
protected AbstractGraph(List edges List vertices) {
this.vertices = vertices;
createAdjacencyLists(edges vertices.size());
}
/** Construct a graph for integer vertices 0 1 2 and edge list */
protected AbstractGraph(List edges int numberOfVertices) {
vertices = new ArrayList(); // Create vertices
for (int i = 0; i < numberOfVertices; i++) {
vertices.add((V)(new Integer(i))); // vertices is {0 1 ...}
}
createAdjacencyLists(edges numberOfVertices);
}
/** Construct a graph from integer vertices 0 1 and edge array */
protected AbstractGraph(int[][] edges int numberOfVertices) {
vertices = new ArrayList(); // Create vertices
for (int i = 0; i < numberOfVertices; i++) {
vertices.add((V)(new Integer(i))); // vertices is {0 1 ...}
}
createAdjacencyLists(edges numberOfVertices);
}
/** Create adjacency lists for each vertex */
private void createAdjacencyLists(
int[][] edges int numberOfVertices) {
// Create a linked list
neighbors = new ArrayList>();
for (int i = 0; i < numberOfVertices; i++) {
neighbors.add(new ArrayList());
}
for (int i = 0; i < edges.length; i++) {
int u = edges[i][0];
int v = edges[i][1];
neighbors.get(u).add(v);
}
}
/** Create adjacency lists for each vertex */
private void createAdjacencyLists(
List edges int numberOfVertices) {
// Create a linked list
neighbors = new ArrayList>();
for (int i = 0; i < numberOfVertices; i++) {
neighbors.add(new ArrayList());
}
for (Edge edge: edges) {
neighbors.get(edge.u).add(edge.v);
}
}
/** Return the number of vertices in the graph */
public int getSize() {
return vertices.size();
}
/** Return the vertices in the graph */
public List getVertices() {
return vertices;
}
/** Return the object for the specified vertex */
public V getVertex(int index) {
return vertices.get(index);
}
/** Return the index for the specified vertex object */
public int getIndex(V v) {
return vertices.indexOf(v);
}
/** Return the neighbors of vertex with the specified index */
public List getNeighbors(int index) {
return neighbors.get(index);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 631 2009-10-15 14:06 Introduction to Java Programming\book\A.class
文件 429 2009-10-15 14:06 Introduction to Java Programming\book\AbstractGraph$Edge.class
文件 2849 2009-10-15 14:06 Introduction to Java Programming\book\AbstractGraph$Tree.class
文件 8825 2009-10-15 14:06 Introduction to Java Programming\book\AbstractGraph.class
文件 12435 2009-04-18 10:32 Introduction to Java Programming\book\AbstractGraph.java
文件 944 2009-10-15 14:06 Introduction to Java Programming\book\AbstractTree.class
文件 558 2007-05-13 20:44 Introduction to Java Programming\book\AbstractTree.java
文件 869 2009-10-15 14:06 Introduction to Java Programming\book\AccountWithoutSync$Account.class
文件 705 2009-10-15 14:06 Introduction to Java Programming\book\AccountWithoutSync$AddAPennyTask.class
文件 1636 2009-10-15 14:06 Introduction to Java Programming\book\AccountWithoutSync.class
文件 1239 2007-05-14 06:32 Introduction to Java Programming\book\AccountWithoutSync.java
文件 1142 2009-10-15 14:06 Introduction to Java Programming\book\AccountWithSyncUsingLock$Account.class
文件 645 2009-10-15 14:06 Introduction to Java Programming\book\AccountWithSyncUsingLock$AddAPennyTask.class
文件 1593 2009-10-15 14:06 Introduction to Java Programming\book\AccountWithSyncUsingLock.class
文件 1472 2007-05-14 06:32 Introduction to Java Programming\book\AccountWithSyncUsingLock.java
文件 1770 2009-10-15 14:06 Introduction to Java Programming\book\ActionInterfaceDemo$MyAction.class
文件 4144 2009-10-15 14:06 Introduction to Java Programming\book\ActionInterfaceDemo.class
文件 3821 2007-05-14 13:32 Introduction to Java Programming\book\ActionInterfaceDemo.java
文件 744 2009-10-15 14:06 Introduction to Java Programming\book\AdapterDemo$1.class
文件 839 2009-10-15 14:06 Introduction to Java Programming\book\AdapterDemo.class
文件 609 2007-05-13 09:22 Introduction to Java Programming\book\AdapterDemo.java
文件 1413 2009-10-15 14:06 Introduction to Java Programming\book\AdditionQuiz.class
文件 548 2007-10-05 22:09 Introduction to Java Programming\book\AdditionQuiz.java
文件 1252 2009-10-15 14:06 Introduction to Java Programming\book\Address.class
文件 0 2006-12-29 19:09 Introduction to Java Programming\book\address.dat
文件 823 2007-05-13 08:13 Introduction to Java Programming\book\Address.java
文件 636 2009-10-15 14:06 Introduction to Java Programming\book\AddressBook$1.class
文件 924 2009-10-15 14:06 Introduction to Java Programming\book\AddressBook$2.class
文件 1049 2009-10-15 14:06 Introduction to Java Programming\book\AddressBook$3.class
文件 1063 2009-10-15 14:06 Introduction to Java Programming\book\AddressBook$4.class
............此处省略1392个文件信息
相关资源
- LeetCode 参考 Java版本
- 植物大战僵尸java源码
- Java Design Patterns 高清原版pdf
- Mastering concurrency programming with java 8 高
- 牛客网Java专项50题详解
- ATM(自动取款机)-java编写-提供新手
- smali2java120745
- [SM2_SM3_SM4]国密加解密算法java实现源码
- java mail 可以指定附件和要上传的文件
- jsp音乐网站源代码
- Compiler_mean3tmp.rar
- Javaweb购物车系统源码
- org.jdesktop.swingx.util.OSswingx-1.6.1.jar
- 离散数学计算器
- java实现的考试系统
- 毕业论文基于java的实验室设备登记管
- 酒店管理系统JAVA+sqlserver
- 大华视频监控Javaweb 的demo html
- jsp+servlet+javabean客房管理系统
- swingx-1.6.1.jar
- java进行Vmware ESXI开发所需的基础jar包
- MySQL官方提供的驱动包 mysql-connector-
- JAVA在线支付源码
- Javaweb购物车119915
- javaWeb物流管理系统含数据库文件
- java点餐系统 java swing版本 mysql数据库
- java的小型超市管理系统,包含mysql数
- java爬取网页表格的(运行环境myecli
- javaWeb源码学生公寓管理系统struts2
- 学生学籍管理系统-jsp
评论
共有 条评论