org.bouncycastle.oer.its.RectangularRegion Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcutil-jdk15on Show documentation
Show all versions of bcutil-jdk15on Show documentation
The Bouncy Castle Java APIs for ASN.1 extension and utility APIs used to support bcpkix and bctls. This jar contains APIs for JDK 1.5 and up.
The newest version!
package org.bouncycastle.oer.its;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
/**
*
* RectangularRegion ::= SEQUENCE {
* northWest TwoDLocation,
* southEast TwoDLocation
* }
*
*/
public class RectangularRegion
extends ASN1Object
implements RegionInterface
{
private final TwoDLocation northWest;
private final TwoDLocation southEast;
public RectangularRegion(TwoDLocation northWest, TwoDLocation southEast)
{
this.northWest = northWest;
this.southEast = southEast;
}
public static RectangularRegion getInstance(Object o)
{
if (o instanceof RectangularRegion)
{
return (RectangularRegion)o;
}
else
{
ASN1Sequence seg = ASN1Sequence.getInstance(o);
return new RectangularRegion(TwoDLocation.getInstance(seg.getObjectAt(0)),
TwoDLocation.getInstance(seg.getObjectAt(1)));
}
}
public TwoDLocation getNorthWest()
{
return northWest;
}
public TwoDLocation getSouthEast()
{
return southEast;
}
public ASN1Primitive toASN1Primitive()
{
return new DERSequence(new ASN1Encodable[]{northWest, southEast});
}
}