rammodulecollection.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 59 行

JAVA
59
字号
/*
 * $Id: RAMModuleCollection.java,v 1.1 2003/11/25 11:42:31 epr Exp $
 */
package org.jnode.driver.ram;

/**
 * RAMModuleCollection.
 * 
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Licence: GNU LGPL</p>
 * <p> </p>
 * @author Francois-Frederic Ozog
 * @version 1.0
 */

import java.util.Vector;

public class RAMModuleCollection {

  private Vector slots=null;

  /**
   * Creates the list of slots
   * @param slots number of possible slots
   */
  public RAMModuleCollection (int slots) {
    this.slots=new Vector(slots);
  }

  /**
   * Retrieves the actual total number of slots, empty or occupied
   */
  public int capacity() {
    return slots.size();
  }

  /**
   * Retrieves the actual number of occupied slots
   * @return number of occupied slots
   */
  public int size() {
    int s=0;
    for (int i=0; i<slots.size();i++)
      s+=slots.elementAt(i)!=null ? 1 : 0;
    return s;
  }


  /**
   * get details on one slot
   * @param index slot number
   * @return RAM module information
   * @see org.jnode.driver.ram.RAMModuleInfo
   */
  public RAMModuleInfo getSlot(int index) {
    return (RAMModuleInfo)(slots.elementAt(index));
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?