/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/**
* A stack based Symble Table.
*<br>For speed reasons all the symbols are introduced in the same map,
* and at the same time in a list so it can be removed when the frame is pop back.
* @author Raul Benito
**/
public class NameSpaceSymbTable {
/**The map betwen prefix-> entry table. */
/**The level of nameSpaces (for Inclusive visibility).*/
/**The stacks for removing the definitions when doing pop.*/
boolean cloned=true;
static {
}
/**
* Default constractor
**/
public NameSpaceSymbTable() {
//Insert the default binding for xmlns.
}
/**
* Get all the unrendered nodes in the name space.
* For Inclusive rendering
* @param result the list where to fill the unrendered xmlns definitions.
**/
//List result=new ArrayList();
//put them rendered?
n=(NameSpaceSymbEntry) n.clone();
needsClone();
n.lastrendered=n.uri;
n.rendered=true;
}
}
}
/**
* Push a frame for visible namespace.
* For Inclusive rendering.
**/
public void outputNodePush() {
nameSpaces++;
push();
}
/**
* Pop a frame for visible namespace.
**/
public void outputNodePop() {
nameSpaces--;
pop();
}
/**
* Push a frame for a node.
* Inclusive or Exclusive.
**/
public void push() {
//Put the number of namespace definitions in the stack.
cloned=false;
}
/**
* Pop a frame.
* Inclusive or Exclusive.
**/
public void pop() {
if (size==0) {
cloned=false;
} else
} else {
cloned=false;
}
}
final void needsClone() {
if (!cloned) {
cloned=true;
}
}
/**
* Gets the attribute node that defines the binding for the prefix.
* @param prefix the prefix to obtain the attribute.
* @return null if there is no need to render the prefix. Otherwise the node of
* definition.
**/
//There is no definition for the prefix(a bug?).
return null;
}
//No need to render an entry already rendered.
return null;
}
// Mark this entry as render.
needsClone();
// Return the node for outputing.
return entry.n;
}
/**
* Gets a definition without mark it as render.
* For render in exclusive c14n the namespaces in the include prefixes.
* @param prefix The prefix whose definition is neaded.
* @return the attr to render, null if there is no need to render
**/
return null;
}
return null;
}
return entry.n;
}
/**
* Adds the mapping for a prefix.
* @param prefix the prefix of definition
* @param uri the Uri of the definition
* @param n the attribute that have the definition
* @return true if there is already defined.
**/
//If we have it previously defined. Don't keep working.
return false;
}
//Creates and entry in the table for this new definition.
needsClone();
//We have a previous definition store it for the pop.
//Check if a previous definition(not the inmidiatly one) has been rendered.
//Yes it is. Mark as rendered.
}
}
return true;
}
/**
* Adds a definition and mark it as render.
* For inclusive c14n.
* @param prefix the prefix of definition
* @param uri the Uri of the definition
* @param n the attribute that have the definition
* @return the attr to render, null if there is no need to render
**/
needsClone();
return ob.n;
}
return null;
}
needsClone();
return null;
}
}
return ne.n;
}
public int getLevel() {
// TODO Auto-generated method stub
}
needsClone();
}
}
needsClone();
}
}
needsClone();
}
return false;
}
}
/**
* The internal structure of NameSpaceSymbTable.
**/
this.n=n;
}
/** @inheritDoc */
try {
return super.clone();
} catch (CloneNotSupportedException e) {
return null;
}
}
/** The level where the definition was rendered(Only for inclusive) */
/**The URI that the prefix defines */
/**The last output in the URI for this prefix (This for speed reason).*/
/**This prefix-URI has been already render or not.*/
boolean rendered=false;
/**The attribute to include.*/
Attr n;
};
SymbMap() {
}
if (--free == 0) {
}
}
}
}
}
return a;
}
//abs of index
return index;
}
do {
return index;
}
/**
* rehashes the map to the new capacity.
*
* @param newCapacity an <code>int</code> value
*/
for (int i = oldCapacity; i-- > 0;) {
}
}
}
}
try {
return copy;
} catch (CloneNotSupportedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}