O'Reilly logo

Joy of Patterns: Using Patterns for Enterprise Development, The by Brandon Goldfedder

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ResourceList.java

 package ProductConfig; import java.util.*; import java.io.PrintStream; public class ResourceList { public ResourceList() { m_resList = new Hashtable(); } public void addResource(String name, int count) { Integer resourceCount = (Integer)m_resList.get(name); if (resourceCount != null) { m_resList.remove(name); m_resList.put(name, new Integer (resourceCount.intValue() + count) ); } else { m_resList.put(name,new Integer(count)); } } public void removeResource(String name, int count) { addResource(name, - count); } // Check if the resource configuration is valid public boolean isValid() { boolean flag = true; for (Enumeration e = m_resList.elements() ; flag && e.hasMoreElements() ; ) { Integer resourceCount = (Integer)e.nextElement(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required