|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.upc.dama.dex.core.Objects
public class Objects
Object identifier collection.
It stores a collection of DEX object identifiers as a set of
long values where there is no duplicated values. The memory management is
done by the parent GraphPool.
This class should be used just to store large collections. Otherwise, it is strongly recommended to use common classes from the Java API.
This class is NOT thread safe.
Known problems:
Object identifiers cannot be removed from Objects while Iterators are still opened. That is, a code as follows may have unexpected and fatal results:
Objects objs = ...
Objects.Iterator it = objs.iterator();
while (it.hasNext()) {
long oid = it.next();
if (...) {
objs.remove(oid);
}
}
it.close();
objs.close();
Also, in case Objects has been obtained directly from a Graph, this
collection cannot be updated through its original Graph. That is, a code
as follows may have unexpected and fatal results:
Objects objs = graph.select(attr, Graph.OPERATION_EQ, value); // or something similar
Objects.Iterator it objs.iterator();
while (it.hasNext()) {
long oid = it.next();
if (...) {
graph.setAttribute(oid, attr, newvalue);
}
}
it.close();
objs.close();
| Nested Class Summary | |
|---|---|
static class |
Objects.Combine
Deprecated. As of release 1.2, replace by Objects.COMBINE_UNION, Objects.COMBINE_DIFFERENCE
and Objects.COMBINE_INTERSECTION. |
class |
Objects.Iterator
Iterator to traverse the object identifier in a collection. |
| Field Summary | |
|---|---|
static short |
COMBINE_DIFFERENCE
Difference combine operation. |
static short |
COMBINE_INTERSECTION
Intersection combine operation. |
static short |
COMBINE_UNION
Union combine operation. |
| Constructor Summary | |
|---|---|
Objects(Session sess)
Creates a new instance of Objects. |
|
Objects(Session sess,
Objects objs)
Creates a new instance of Objects which is a copy
of the given one. |
|
Objects(Session sess,
Objects objs1,
Objects objs2,
Objects.Combine c)
Deprecated. As of release 1.2, replace by Objects.Objects(Session,Objects,Objects,short). |
|
Objects(Session sess,
Objects objs1,
Objects objs2,
short combine)
Creates a new instance of Objects which is the
combination of the two given collections. |
|
| Method Summary | |
|---|---|
boolean |
add(long oid)
Adds an object identifier to the collection. |
boolean |
add(java.lang.Long e)
Adds the specified element to this set if it is not already present (optional operation). |
boolean |
addAll(java.util.Collection clctn)
Adds all of the elements in the specified collection to this set if they're not already present (optional operation). |
void |
clear()
Removes all the object identifiers. |
void |
close()
Closes the collection and all their non-closed iterators. |
boolean |
contains(java.lang.Object o)
Returns true if this collections contains the specified element. |
boolean |
containsAll(java.util.Collection clctn)
Returns true if this set contains all of the elements of the specified collection. |
long |
difference(Objects objs)
Performs the difference operation with the given collection. |
static Objects |
difference(Session sess,
Objects objs1,
Objects objs2)
Creates a new instance of Objects which is the
difference of the two given collections. |
boolean |
exists(long oid)
Gets whether the object identifier exists in the collection or not. |
long |
first()
Gets the first object identifier in the collection. |
Session |
getSession()
Gets the parent Session instance. |
long |
intersection(Objects objs)
Performs the intersection operation with the given collection. |
static Objects |
intersection(Session sess,
Objects objs1,
Objects objs2)
Creates a new instance of Objects which is the
intersection of the two given collections. |
boolean |
isEmpty()
Returns true if this Objects contains no elements. |
boolean |
isOpen()
Gets if the Objects instance is open. |
Objects.Iterator |
iterator()
Gets an Objects.Iterator. |
Objects.Iterator |
iterator(long startPosition)
Gets an Objects.Iterator. |
Objects.Iterator |
iteratorFromOID(long oid)
Gets an Objects.Iterator pointing tot the given object. |
long |
next(long oid,
boolean exists)
Gets the next object identifier in the collection from the given one. |
boolean |
remove(long oid)
Removes the given object identifier. |
boolean |
remove(java.lang.Object o)
Removes the specified element from this set if it is present (optional operation). |
boolean |
removeAll(java.util.Collection clctn)
Removes from this set all of its elements that are contained in the specified collection (optional operation). |
boolean |
retainAll(java.util.Collection clctn)
Retains only the elements in this set that are contained in the specified collection (optional operation). |
static Objects |
sample(Session sess,
Objects src,
Objects exclude,
long samples)
Creates a new instance of Objects which is a sample of a given
collection excluding the objects of another one. |
int |
size()
Get the number of object identifiers in this collection (its cardinality). |
long |
sizeLong()
As Objects.size() but it returns a long which can be larger than
Integer.MAX_VALUE. |
java.lang.Object[] |
toArray()
Returns an array containing all of the object identifiers in this set. |
java.lang.Object[] |
toArray(java.lang.Object[] ts)
Returns an array containing all of the object identifiers in this set; the runtime type of the returned array is that of the specified array. |
long |
union(Objects objs)
Performs the union operation with the given collection. |
static Objects |
union(Session sess,
Objects objs1,
Objects objs2)
Creates a new instance of Objects which is the
union of the two given collections. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
equals, hashCode |
| Field Detail |
|---|
public static final short COMBINE_UNION
public static final short COMBINE_INTERSECTION
public static final short COMBINE_DIFFERENCE
| Constructor Detail |
|---|
public Objects(Session sess)
Objects.
It creates a new empty collection.
sess - Parent Session.
public Objects(Session sess,
Objects objs)
Objects which is a copy
of the given one.
sess - Parent Session instance.objs - Objects instance.
public Objects(Session sess,
Objects objs1,
Objects objs2,
short combine)
Objects which is the
combination of the two given collections.
sess - Parent Session.objs1 - Objects instance.objs2 - Objects instance.combine - Combine operation. It must be
Objects.COMBINE_UNION, Objects.COMBINE_INTERSECTION,
or Objects.COMBINE_DIFFERENCE.
@Deprecated
public Objects(Session sess,
Objects objs1,
Objects objs2,
Objects.Combine c)
Objects.Objects(Session,Objects,Objects,short).
Objects which is the
combination of the two given collections.
sess - Parent Session.objs1 - Objects instance.objs2 - Objects instance.c - Combine operation.| Method Detail |
|---|
public static Objects union(Session sess,
Objects objs1,
Objects objs2)
Objects which is the
union of the two given collections.
sess - Parent Session.objs1 - Objects instance.objs2 - Objects instance.
Objects which is the union of the
two given collections.
public static Objects intersection(Session sess,
Objects objs1,
Objects objs2)
Objects which is the
intersection of the two given collections.
sess - Parent Session.objs1 - Objects instance.objs2 - Objects instance.
Objects which is the intersection of the
two given collections.
public static Objects difference(Session sess,
Objects objs1,
Objects objs2)
Objects which is the
difference of the two given collections.
sess - Parent Session.objs1 - Objects instance.objs2 - Objects instance.
Objects which is the difference of the
two given collections.public Session getSession()
Session instance.
Session instance.public boolean isOpen()
Objects instance is open.
Only opened Objects instances can execute methods, otherwise
they will fail.
true if the Objects instance is open,
false otherwise.public void close()
It is important to close Objects as soon as possible
to free its memory resources.
close in interface java.io.CloseableObjects.Iteratorpublic long sizeLong()
Objects.size() but it returns a long which can be larger than
Integer.MAX_VALUE.
public boolean add(long oid)
oid - Object identifier.
true if the object identifier is successfully
added to the collection or false if the
object identifier was alredy in the collection.public boolean exists(long oid)
oid - Object identifier.
true if the object identifier exists
in the collection or false otherwise.public long first()
The first object identifier is that with the smaller value. The collection must have at least one element.
public long next(long oid,
boolean exists)
oid - Object identifier.exists - If true, oid must exists
into the collection.
public boolean remove(long oid)
oid - Object identifier.
true if the object identifier is
successfully removed, false if the object identifier
was not in the collection.public void clear()
clear in interface java.util.Collectionclear in interface java.util.Setpublic long union(Objects objs)
All the object identifiers in the objs collection
are added to the calling instance collection.
objs - Object identifier collection.
public long intersection(Objects objs)
Only those object identifiers which are present in the objs
collection and in the calling instance collection will remain in
the calling instance collection, the others will be removed from
the calling instance collection.
objs - Object identifier collection.
public long difference(Objects objs)
All object identifiers from the calling instance collection
will remain in the calling instance collection but those which
are present in the objs collection.
objs - Object identifier collection.
public static Objects sample(Session sess,
Objects src,
Objects exclude,
long samples)
Objects which is a sample of a given
collection excluding the objects of another one.
It creates a collection.
sess - Parent Session.src - Source Objects to be sampled.exclude - Objects to be excluded.samples - The number of object samples to be taken.
Objects collection.public Objects.Iterator iterator()
Objects.Iterator.
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.SetObjects.Iterator.public Objects.Iterator iterator(long startPosition)
Objects.Iterator.
startPosition - The number of objects to skip from the beginning [0..Size).
Objects.Iterator.public Objects.Iterator iteratorFromOID(long oid)
Objects.Iterator pointing tot the given object.
oid - The identifier of the object.
Objects.Iterator.public int size()
size in interface java.util.Collectionsize in interface java.util.SetObjects.sizeLong()public boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.Setpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectioncontains in interface java.util.Seto - element whose presence in this set is to be tested.
public java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.Setpublic java.lang.Object[] toArray(java.lang.Object[] ts)
toArray in interface java.util.CollectiontoArray in interface java.util.Setts - the array into which the elements of this set are to be stored,
if it is big enough; otherwise, a new array of the same runtime type is
allocated for this purpose.
public boolean add(java.lang.Long e)
add in interface java.util.Collectionadd in interface java.util.Sete - element to be added to this set.
public boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.Seto - object to be removed from this set, if present.
public boolean containsAll(java.util.Collection clctn)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.Setclctn - collection to be checked for containment in this set.
public boolean addAll(java.util.Collection clctn)
addAll in interface java.util.CollectionaddAll in interface java.util.Setclctn - collection whose elements are to be added to this set.
public boolean retainAll(java.util.Collection clctn)
retainAll in interface java.util.CollectionretainAll in interface java.util.Setclctn - collection that defines which elements this set will retain.
public boolean removeAll(java.util.Collection clctn)
removeAll in interface java.util.CollectionremoveAll in interface java.util.Setclctn - collection that defines which elements will be removed from this set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||