summaryrefslogtreecommitdiffstats
path: root/tags/java-M1-20060518/java/spec/sdo/src/main/java/commonj/sdo/Sequence.java
blob: b46a5be7e0dc54d3e4d4f14268419db28276a27f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
 * <copyright>
 *
 * Service Data Objects
 * Version 2.0
 * Licensed Materials - Property of BEA and IBM
 *
 * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005.  All rights reserved.
 *
 * </copyright>
 * 
 */

package commonj.sdo;

/**
 * A sequence is a heterogeneous list of {@link Property properties} and corresponding values.
 * It represents an ordered arbitrary mixture of data values from more than one property of a {@link DataObject data object}.
 */
public interface Sequence
{
  /**
   * Returns the number of entries in the sequence.
   * @return the number of entries.
   */
  int size();

  /**
   * Returns the property for the given entry index.
   * Returns <code>null</code> for mixed text entries.
   * @param index the index of the entry.
   * @return the property or <code>null</code> for the given entry index.
   */
  Property getProperty(int index);
  
  /**
   * Returns the property value for the given entry index.
   * @param index the index of the entry.
   * @return the value for the given entry index.
   */
  Object getValue(int index);
  
  /**
   * Sets the entry at a specified index to the new value.
   * @param index the index of the entry.
   * @param value the new value for the entry.
   */
  Object setValue(int index, Object value);

  /**
   * Adds a new entry with the specified property name and value
   * to the end of the entries.
   * @param propertyName the name of the entry's property.
   * @param value the value for the entry.
   */
  boolean add(String propertyName, Object value);

  /**
   * Adds a new entry with the specified property index and value
   * to the end of the entries.
   * @param propertyIndex the index of the entry's property.
   * @param value the value for the entry.
   */
  boolean add(int propertyIndex, Object value);

  /**
   * Adds a new entry with the specified property and value
   * to the end of the entries.
   * @param property the property of the entry.
   * @param value the value for the entry.
   */
  boolean add(Property property, Object value);

  /**
   * Adds a new entry with the specified property name and value
   * at the specified entry index.
   * @param index the index at which to add the entry.
   * @param propertyName the name of the entry's property.
   * @param value the value for the entry.
   */
  void add(int index, String propertyName, Object value);

  /**
   * Adds a new entry with the specified property index and value
   * at the specified entry index.
   * @param index the index at which to add the entry.
   * @param propertyIndex the index of the entry's property.
   * @param value the value for the entry.
   */
  void add(int index, int propertyIndex, Object value);

  /**
   * Adds a new entry with the specified property and value
   * at the specified entry index.
   * @param index the index at which to add the entry.
   * @param property the property of the entry.
   * @param value the value for the entry.
   */
  void add(int index, Property property, Object value);
 
  /**
   * Removes the entry at the given entry index.
   * @param index the index of the entry.
   */
  void remove(int index);

  /**
   * Moves the entry at <code>fromIndex</code> to <code>toIndex</code>.
   * @param toIndex the index of the entry destination.
   * @param fromIndex the index of the entry to move.
   */
  void move(int toIndex, int fromIndex);
  
  /**
   * Adds a new entry with the SDO text Property
   * to the end of the Sequence.
   * Same as add(property, text) where property is the SDO text Property.
   * @param text value of the entry.
   */
  void add(String text);

  /**
   * Adds a new entry with the SDO text Property
   * at the given index.
   * Same as add(index, property, text) where property is the SDO text Property.
   * @param index the index at which to add the entry.
   * @param text value of the entry.
   */
  void add(int index, String text);
  
}