EMMA Coverage Report (generated Fri Sep 15 10:32:43 EDT 2006)
[all classes][org.apache.pluto.driver.core]

COVERAGE SUMMARY FOR SOURCE FILE [PortletWindowIDImpl.java]

nameclass, %method, %block, %line, %
PortletWindowIDImpl.java0%   (0/1)0%   (0/7)0%   (0/75)0%   (0/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PortletWindowIDImpl0%   (0/1)0%   (0/7)0%   (0/75)0%   (0/22)
PortletWindowIDImpl (int, String): void 0%   (0/1)0%   (0/12)0%   (0/5)
createFromString (String): PortletWindowIDImpl 0%   (0/1)0%   (0/39)0%   (0/9)
getStringId (): String 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/3)0%   (0/1)
intValue (): int 0%   (0/1)0%   (0/3)0%   (0/1)
readObject (ObjectInputStream): void 0%   (0/1)0%   (0/10)0%   (0/3)
writeObject (ObjectOutputStream): void 0%   (0/1)0%   (0/5)0%   (0/2)

1/*
2 * Copyright 2003,2004 The Apache Software Foundation.
3 * 
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * 
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 * 
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.apache.pluto.driver.core;
17 
18import java.io.IOException;
19import java.io.ObjectInputStream;
20import java.io.ObjectOutputStream;
21import java.io.Serializable;
22 
23import org.apache.pluto.PortletWindowID;
24 
25/**
26 * Wraps around the internal Object IDs. By holding both the string and the
27 * integer version of an Object ID this class helps speed up the internal
28 * processing.
29 * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
30 * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
31 */
32public class PortletWindowIDImpl implements PortletWindowID, Serializable {
33        
34        // Private Member Variables ------------------------------------------------
35        
36    private String stringId = null;
37    private int intId;
38    
39    
40    // Constructor -------------------------------------------------------------
41    
42    /**
43     * Private constructor that prevents external instantiation.
44     * @param intId  the integer ID.
45     * @param stringId  the string ID.
46     */
47    private PortletWindowIDImpl(int intId, String stringId) {
48        this.stringId = stringId;
49        this.intId = intId;
50    }   
51    
52    
53    // PortletWindowID Impl ----------------------------------------------------
54    
55    public String getStringId() {
56        return stringId;
57    }
58    
59    // Internal Methods --------------------------------------------------------
60    
61    private void readObject(ObjectInputStream stream) throws IOException {
62            intId = stream.readInt();
63        stringId = String.valueOf(intId);
64    }
65 
66    private void writeObject(ObjectOutputStream stream) throws IOException {
67        stream.write(intId);
68    }
69 
70    // Common Object Methods ---------------------------------------------------
71    
72    /**
73    public boolean equals(Object object) {
74        boolean result = false;
75        if (object instanceof PortletWindowIDImpl) {
76            result = (intId == ((PortletWindowIDImpl) object).intId);
77        } else if (object instanceof String) {
78            result = stringId.equals(object);
79        } else if (object instanceof Integer) {
80            result = (intId == ((Integer) object).intValue());
81        }
82        return (result);
83    }
84    **/
85    
86    public int hashCode() {
87        return intId;
88    }
89    
90    
91    // Additional Methods ------------------------------------------------------
92    
93    public int intValue() {
94        return intId;
95    }
96    
97    /**
98     * Creates a portlet window ID instance from a string.
99     * @param stringId  the string ID from which the instance is created.
100     * @return a portlet window ID instance created from the string ID.
101     */
102    static public PortletWindowIDImpl createFromString(String stringId) {
103        char[] id = stringId.toCharArray();
104        int _id = 1;
105        for (int i = 0; i < id.length; i++) {
106            if ((i % 2) == 0) {
107                _id *= id[i];
108            } else {
109                _id ^= id[i];
110            }
111            _id = Math.abs(_id);
112        }
113        return new PortletWindowIDImpl(_id, stringId);
114    }
115    
116}

[all classes][org.apache.pluto.driver.core]
EMMA 2.0.5312 (C) Vladimir Roubtsov