org.bouncycastle.oer.its.PolygonalRegion 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 java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
/**
*
* SEQUENCE SIZE(3..MAX) OF TwoDLocation
*
*/
public class PolygonalRegion
extends ASN1Object
implements RegionInterface
{
private final List points;
public PolygonalRegion(List locations)
{
points = Collections.unmodifiableList(locations);
}
public static PolygonalRegion getInstance(Object o)
{
if (o instanceof PolygonalRegion)
{
return (PolygonalRegion)o;
}
else if (o != null)
{
return new PolygonalRegion(Utils.fillList(TwoDLocation.class, ASN1Sequence.getInstance(o)));
}
return null;
}
public List getPoints()
{
return points;
}
public ASN1Primitive toASN1Primitive()
{
return Utils.toSequence(points);
}
public static class Builder
{
private List locations = new ArrayList();
public Builder setLocations(List locations)
{
this.locations = locations;
return this;
}
public Builder setLocations(TwoDLocation... locations)
{
this.locations.addAll(Arrays.asList(locations));
return this;
}
public PolygonalRegion createPolygonalRegion()
{
return new PolygonalRegion(locations);
}
}
}