|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.rmi.constraint.ConstraintAlternatives
Combines constraint alternatives of uniform type into a single overall constraint. The semantics of this aggregate constraint is that at least one of the individual constraints must be satisfied. All of the individual constraints must be instances of the same concrete class, and there must be at least two constraints.
Note that this class implements
RelativeTimeConstraint
even though the
constraint elements might not implement
RelativeTimeConstraint
.
Constructor Summary | |
ConstraintAlternatives(java.util.Collection c)
Creates an instance containing the specified alternative constraints, with unnecessary constraints removed. |
|
ConstraintAlternatives(SecurityConstraint[] constraints)
Creates an instance containing the specified alternative constraints, with unnecessary constraints removed. |
Method Summary | |
static SecurityConstraint |
create(java.util.Collection c)
Returns a constraint representing the specified alternative constraints, with unnecessary constraints removed. |
static SecurityConstraint |
create(SecurityConstraint[] constraints)
Returns a constraint representing the specified alternative constraints, with unnecessary constraints removed. |
java.util.Set |
elements()
Returns an immutable set of all the constraints. |
boolean |
equals(java.lang.Object obj)
Two instances of this class are equal if they have the same constraints (ignoring order). |
java.lang.Class |
getElementType()
Returns the concrete class of the constraint elements. |
int |
hashCode()
Returns a hash code value for this object. |
SecurityConstraint |
makeAbsolute(long baseTime)
Returns the original ConstraintAlternatives instance if
the constraint elements are not instances of
RelativeTimeConstraint , otherwise converts each constraint
element using its makeAbsolute method and returns the
result of invoking the create method of this class with
the converted constraints. |
SecurityConstraint |
reduceBy(SecurityConstraint c)
Returns the smallest representable subset of this constraint that contains the intersection of this constraint with the specified constraint, or null if there is no intersection. |
java.lang.String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ConstraintAlternatives(SecurityConstraint[] constraints)
c1
, if there exists another remaining
constraint c2
such that c2.reduceBy(c1)
equals c1
, then c1
is removed. The parameter
passed to this constructor is neither modified nor retained; subsequent
changes to that parameter have no effect on the instance created.constraints
- the alternative constraintsNullPointerException
- if the parameter is null
or
any element is null
java.lang.IllegalArgumentException
- if any of the elements are instances
of ConstraintAlternatives
, or if the elements are not all
instances of the same concrete class, or if the elements are not all
instances of trusted constraint classes, or if fewer than two elements
remain after unnecessary constraints are removedpublic ConstraintAlternatives(java.util.Collection c)
c1
, if there exists another remaining
constraint c2
such that c2.reduceBy(c1)
equals c1
, then c1
is removed. The parameter
passed to this constructor is neither modified nor retained; subsequent
changes to that parameter have no effect on the instance created.constraints
- the alternative constraintsNullPointerException
- if the parameter is null
or
any element is null
java.lang.IllegalArgumentException
- if any of the elements are instances
of ConstraintAlternatives
, or if the elements are not all
instances of the same concrete class, or if the elements are not all
instances of trusted constraint classes, or if fewer than two elements
remain after unnecessary constraints are removedMethod Detail |
public static SecurityConstraint create(SecurityConstraint[] constraints)
c1
, if there exists another remaining
constraint c2
such that c2.reduceBy(c1)
equals c1
, then c1
is removed. If a single
constraint remains, then that constraint is returned, otherwise an
instance of ConstraintAlternatives
containing the
remaining constraints is returned. The parameter passed to this method
is neither modified nor retained; subsequent changes to that parameter
have no effect on the instance created.constraints
- the alternative constraintsNullPointerException
- if the parameter is null
or
any element is null
java.lang.IllegalArgumentException
- if the parameter is empty, or if any
of the elements are instances of ConstraintAlternatives
,
or if the elements are not all instances of the same concrete class,
or if the elements are not all instances of trusted constraint classes.public static SecurityConstraint create(java.util.Collection c)
c1
, if there exists another remaining
constraint c2
such that c2.reduceBy(c1)
equals c1
, then c1
is removed. If a single
constraint remains, then that constraint is returned, otherwise an
instance of ConstraintAlternatives
containing the
remaining constraints is returned. The parameter passed to this method
is neither modified nor retained; subsequent changes to that parameter
have no effect on the instance created.constraints
- the alternative constraintsNullPointerException
- if the parameter is null
or
any element is null
java.lang.IllegalArgumentException
- if the parameter is empty, or if any
of the elements are instances of ConstraintAlternatives
,
or if the elements are not all instances of the same concrete class,
or if the elements are not all instances of trusted constraint classespublic java.util.Set elements()
UnsupportedOperationException
being
thrown.public SecurityConstraint reduceBy(SecurityConstraint c)
null
if there is no intersection.
For any instance c1
of this class and any constraint
instance c2
, the result of c1.reduceBy(c2)
is
obtained as follows. If for any element e1
of
c1
, the result of e1.reduceBy(c2)
equals
c2
, then the result of c1.reduceBy(c2)
is
c2
. If c2
is itself an instance of this class
and for each element e2
of c2
there exists an
element e1
of c1
such that
e1.reduceBy(e2)
equals e2
, then the result of
c1.reduceBy(c2)
is c2
. If for each element
e1
of c1
, the result of
e1.reduceBy(c2)
is null
, then the result of
c1.reduceBy(c2)
is null
. Otherwise, a
collection is formed from the non-null
values returned by
e1.reduceBy(c2)
for each element e1
of
c1
. Each constraint in the collection that is an instance
of ConstraintAlternatives
is then replaced by all of the
elements of that constraint. The result of c1.reduceBy(c2)
is then the result of calling the create
method of this
class with the final collection.
reduceBy
in interface SecurityConstraint
java.rmi.constraint.SecurityConstraint
c
- a constraintnull
if
there is no intersectionpublic SecurityConstraint makeAbsolute(long baseTime)
ConstraintAlternatives
instance if
the constraint elements are not instances of
RelativeTimeConstraint
, otherwise converts each constraint
element using its makeAbsolute
method and returns the
result of invoking the create
method of this class with
the converted constraints.makeAbsolute
in interface RelativeTimeConstraint
java.rmi.constraint.RelativeTimeConstraint
baseTime
- an absolute time, specified in milliseconds from
midnight, January 1, 1970 UTCpublic java.lang.Class getElementType()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |