class VirtualListViewRequestControl extends AbstractControl implements RequestControl {

  @Override
  public byte[] encode()
  {
    final List<DEREncoder> l = new ArrayList<>();
    if (getAssertionValue() != null) {
      l.add(new IntegerType(getBeforeCount()));
      l.add(new IntegerType(getAfterCount()));
      l.add(new OctetStringType(new ContextDERTag(1, false), getAssertionValue()));
      if (getContextID() != null) {
        l.add(new OctetStringType(getContextID()));
      }
    } else {
      l.add(new IntegerType(getBeforeCount()));
      l.add(new IntegerType(getAfterCount()));
      l.add(
        new ConstructedDEREncoder(
          new ContextDERTag(0, true),
          new IntegerType(getTargetOffset()),
          new IntegerType(getContentCount())));
      if (getContextID() != null) {
        l.add(new OctetStringType(getContextID()));
      }
    }

    final ConstructedDEREncoder se = new ConstructedDEREncoder(
      UniversalDERTag.SEQ,
      l.toArray(new DEREncoder[0]));
    return se.encode();
  }

  public  VirtualListViewRequestControl();
  public  VirtualListViewRequestControl(final int offset, final int before, final int after);
  public  VirtualListViewRequestControl(final int offset, final int before, final int after, final boolean critical);
  public  VirtualListViewRequestControl(
    final int offset,
    final int before,
    final int after,
    final int count,
    final byte[] context);
  public  VirtualListViewRequestControl(
    final int offset,
    final int before,
    final int after,
    final int count,
    final byte[] context,
    final boolean critical);
  public  VirtualListViewRequestControl(final String assertion, final int before, final int after);
  public  VirtualListViewRequestControl(
    final String assertion,
    final int before,
    final int after,
    final boolean critical);
  public  VirtualListViewRequestControl(final String assertion, final int before, final int after, final byte[] context);
  public  VirtualListViewRequestControl(
    final String assertion,
    final int before,
    final int after,
    final byte[] context,
    final boolean critical);

}