Yurttas/PL/OOL/CS/F/02/05/02/04/A.java

From ZCubes Wiki
Revision as of 08:24, 7 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="java" line start="1" enclose="div">/** * Copyright(C) 1998 * All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc.. * * P...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
 1/**
 2 *  Copyright(C) 1998
 3 *  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4 *
 5 *  Permission to use, copy, modify, and distribute this
 6 *  software and its documentation for EDUCATIONAL purposes
 7 *  and without fee is hereby granted provided that this
 8 *  copyright notice appears in all copies.
 9 *
10 *  @date   : January 1, 1998.
11 *  @author : Salih Yurttas.
12 */
13
14
15import java.util.*;
16
17public class A {
18
19  private Vector a;
20
21  public A() {
22    a = new Vector();
23
24    a.addElement(new Integer(0));
25    a.addElement(new Integer(2));
26  }
27
28  public int getFirst() {
29    return ((Integer)a.firstElement()).intValue();
30  }
31
32  public int getLast() {
33    return ((Integer)a.lastElement()).intValue();
34  }
35
36  public Vector getA() {
37    return a;
38  }
39
40  public void setFirst(final int a) {
41    this.a.setElementAt(new Integer(a), 0);
42  }
43
44  public void setLast(final int a) {
45    this.a.setElementAt(new Integer(a), 1);
46  }
47
48  public void setA(final int a) {
49    this.a.setElementAt(new Integer(a), 0);
50    this.a.setElementAt(new Integer(a), 1);
51  }
52
53  public void setA(final int a,
54                   final int b) {
55    this.a.setElementAt(new Integer(a), 0);
56    this.a.setElementAt(new Integer(b), 1);
57  }
58
59  public void setA(final Vector a) {
60    this.a.setElementAt(a.elementAt(0), 0);
61    this.a.setElementAt(a.elementAt(1), 1);
62  }
63
64  public void printA() {
65    System.out.println("a /");
66
67    System.out.println("i0 = " + a.elementAt(0));
68    System.out.println("i1 = " + a.elementAt(1));
69
70    System.out.println();
71  }
72
73}