You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Answer2a.java 934B

1234567891011121314151617181920212223242526
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Common Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/cpl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. package answers;
  13. import figures.Point;
  14. import figures.FigureElement;
  15. public aspect Answer2a {
  16. before(int newValue): set(int Point.*) && args(newValue) {
  17. if (newValue < FigureElement.MIN_VALUE) {
  18. throw new IllegalArgumentException("too small");
  19. } else if (newValue > FigureElement.MAX_VALUE) {
  20. throw new IllegalArgumentException("too large");
  21. }
  22. }
  23. }