APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.x509

public Class GeneralSubtrees

extends Object
implements Cloneable, DerEncoder
Class Inheritance
All Implemented Interfaces
sun.security.util.DerEncoder, java.lang.Cloneable
Imports
java.io.*, java.util.*, sun.security.util.*

Represent the GeneralSubtrees ASN.1 object.

The ASN.1 for this is

GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree
Authors
Amit Kapoor, Hemma Prafullchandra, Andreas Sterbenz

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final int
private static final int
private static final int
private final List<GeneralSubtree>

Constructor Summary

AccessConstructor and Description
public
GeneralSubtrees()

The default constructor for the class.

private
public
GeneralSubtrees(DerValue
the DER encoded form of the same.
val
)

Create the object from the passed DER encoded form.

Method Summary

Modifier and TypeMethod and Description
public void
public Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.

public boolean
private GeneralSubtree

Returns:

GeneralSubtree containing widest name of that type
createWidestSubtree
(GeneralNameInterface
GeneralNameInterface name
name
)

create a subtree containing an instance of the input name type that widens all other names of that type.

public void
encode(DerOutputStream
the DerOutputStream to encode this object to.
out
)

Implements sun.security.util.DerEncoder.encode.

Encode the GeneralSubtrees.

public boolean

Returns:

true if match
equals
(Object
GeneralSubtrees to compare to this
obj
)

Overrides java.lang.Object.equals.

Compare two general subtrees by comparing the subtrees of each.

public GeneralSubtree
get(int index)

private GeneralNameInterface
getGeneralNameInterface(int
index of the GeneralSubtree from which to obtain the name
ndx
)

Return the GeneralNameInterface form of the GeneralName in one of the GeneralSubtrees.

private static GeneralNameInterface
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public GeneralSubtrees

Returns:

GeneralSubtrees to be merged with excluded; these are empty-valued name types corresponding to entries that were of the same type but did not share the same subtree between this and other. Returns null if no such.
intersect
(GeneralSubtrees
GeneralSubtrees to be intersected with this
other
)

intersect this GeneralSubtrees with other.

public Iterator<GeneralSubtree>
private void
minimize()

minimize this GeneralSubtrees by removing all redundant entries.

public void
reduce(GeneralSubtrees
GeneralSubtrees
excluded
)

reduce this GeneralSubtrees by contents of another.

public void
remove(int index)

public int
size()

public String
toString()

Overrides java.lang.Object.toString.

Return a printable string of the GeneralSubtree.

public List<GeneralSubtree>
public void
union(GeneralSubtrees
GeneralSubtrees to be united with this
other
)

construct union of this GeneralSubtrees with other.

Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

NAME_DIFF_TYPEback to summary
private static final int NAME_DIFF_TYPE
NAME_MATCHback to summary
private static final int NAME_MATCH
NAME_NARROWSback to summary
private static final int NAME_NARROWS
NAME_SAME_TYPEback to summary
private static final int NAME_SAME_TYPE
NAME_WIDENSback to summary
private static final int NAME_WIDENS
treesback to summary
private final List<GeneralSubtree> trees

Constructor Detail

GeneralSubtreesback to summary
public GeneralSubtrees()

The default constructor for the class.

GeneralSubtreesback to summary
private GeneralSubtrees(GeneralSubtrees source)
GeneralSubtreesback to summary
public GeneralSubtrees(DerValue val) throws IOException

Create the object from the passed DER encoded form.

Parameters
val:DerValue

the DER encoded form of the same.

Annotations
@SuppressWarnings:this-escape

Method Detail

addback to summary
public void add(GeneralSubtree tree)
cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

containsback to summary
public boolean contains(GeneralSubtree tree)
createWidestSubtreeback to summary
private GeneralSubtree createWidestSubtree(GeneralNameInterface name)

create a subtree containing an instance of the input name type that widens all other names of that type.

Parameters
name:GeneralNameInterface

GeneralNameInterface name

Returns:GeneralSubtree

GeneralSubtree containing widest name of that type

Exceptions
RuntimeException:
on error (should not occur)
encodeback to summary
public void encode(DerOutputStream out)

Implements sun.security.util.DerEncoder.encode.

Encode the GeneralSubtrees.

Parameters
out:DerOutputStream

the DerOutputStream to encode this object to.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Compare two general subtrees by comparing the subtrees of each.

Parameters
obj:Object

GeneralSubtrees to compare to this

Returns:boolean

true if match

getback to summary
public GeneralSubtree get(int index)
getGeneralNameInterfaceback to summary
private GeneralNameInterface getGeneralNameInterface(int ndx)

Return the GeneralNameInterface form of the GeneralName in one of the GeneralSubtrees.

Parameters
ndx:int

index of the GeneralSubtree from which to obtain the name

getGeneralNameInterfaceback to summary
private static GeneralNameInterface getGeneralNameInterface(GeneralSubtree gs)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
intersectback to summary
public GeneralSubtrees intersect(GeneralSubtrees other)

intersect this GeneralSubtrees with other. This function is used in merging permitted NameConstraints. The operation is performed as follows:

  • If a name in other narrows all names of the same type in this, the result will contain the narrower name and none of the names it narrows.
  • If a name in other widens all names of the same type in this, the result will not contain the wider name.
  • If a name in other does not share the same subtree with any name of the same type in this, then the name is added to the list of GeneralSubtrees returned. These names should be added to the list of names that are specifically excluded. The reason is that, if the intersection is empty, then no names of that type are permitted, and the only way to express this in NameConstraints is to include the name in excludedNames.
  • If a name in this has no name of the same type in other, then the result contains the name in this. No name of a given type means the name type is completely permitted.
  • If a name in other has no name of the same type in this, then the result contains the name in other. This means that the name is now constrained in some way, whereas before it was completely permitted.
Parameters
other:GeneralSubtrees

GeneralSubtrees to be intersected with this

Returns:GeneralSubtrees

GeneralSubtrees to be merged with excluded; these are empty-valued name types corresponding to entries that were of the same type but did not share the same subtree between this and other. Returns null if no such.

iteratorback to summary
public Iterator<GeneralSubtree> iterator()
minimizeback to summary
private void minimize()

minimize this GeneralSubtrees by removing all redundant entries. Internal method used by intersect and reduce.

reduceback to summary
public void reduce(GeneralSubtrees excluded)

reduce this GeneralSubtrees by contents of another. This function is used in merging excluded NameConstraints with permitted NameConstraints to obtain a minimal form of permitted NameConstraints. It is an optimization, and does not affect correctness of the results.

Parameters
excluded:GeneralSubtrees

GeneralSubtrees

removeback to summary
public void remove(int index)
sizeback to summary
public int size()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Return a printable string of the GeneralSubtree.

treesback to summary
public List<GeneralSubtree> trees()
unionback to summary
public void union(GeneralSubtrees other)

construct union of this GeneralSubtrees with other.

Parameters
other:GeneralSubtrees

GeneralSubtrees to be united with this