/** Constructs a new any with a given type and value @param type the UNO type of the any. @param object the value of the any. */ public Any(Type type, Object object) { if (type.equals(Type.ANY)) { throw new IllegalArgumentException("Any cannot contain Any"); } _type = type; _object = object; }
public boolean equals(Object obj) { return obj instanceof Any && _type.equals(((Any) obj)._type) && (_object == null ? ((Any) obj)._object == null : _object.equals(((Any) obj)._object)); }
/** * Constructs a new any with a given type and value * * @param type the UNO type of the any. * @param object the value of the any. */ public Any(Type type, Object object) { if (type.equals(Type.ANY)) { throw new IllegalArgumentException("Any cannot contain Any"); } _type = type; _object = object; }
/** * Indicates whether some other object is equal to this one. * * @param obj the reference object with which to compare. * @return <code>true</code> if this object is the same as the obj argument; * <code>false</code> otherwise. * @see java.lang.Object#equals */ @Override public boolean equals(Object obj) { return obj instanceof Any && _type.equals(((Any) obj)._type) && (_object == null ? ((Any) obj)._object == null : _object.equals(((Any) obj)._object)); }
final void remRefHolder(Type type, String oid) { synchronized (refHolders) { LinkedList l = (LinkedList) refHolders.get(oid); if (l != null) { for (Iterator i = l.iterator(); i.hasNext();) { RefHolder rh = (RefHolder) i.next(); if (rh.getType().equals(type)) { try { if (rh.release()) { l.remove(rh); if (l.isEmpty()) { refHolders.remove(oid); } } } finally { release(); } break; } } } } }
final void addRefHolder(Object obj, Type type, String oid) { synchronized (refHolders) { LinkedList l = (LinkedList) refHolders.get(oid); if (l == null) { l = new LinkedList(); refHolders.put(oid, l); } boolean found = false; for (Iterator i = l.iterator(); !found && i.hasNext();) { RefHolder rh = (RefHolder) i.next(); if (rh.getType().equals(type)) { found = true; rh.acquire(); } } if (!found) { l.add(new RefHolder(type, obj)); } } acquire(); }
final void addRefHolder(Object obj, Type type, String oid) { synchronized (refHolders) { LinkedList<RefHolder> l = refHolders.get(oid); if (l == null) { l = new LinkedList<RefHolder>(); refHolders.put(oid, l); } boolean found = false; for (Iterator<RefHolder> i = l.iterator(); !found && i.hasNext();) { RefHolder rh = i.next(); if (rh.getType().equals(type)) { found = true; rh.acquire(); } } if (!found) { l.add(new RefHolder(type, obj)); } } acquire(); }
final void remRefHolder(Type type, String oid) { synchronized (refHolders) { LinkedList<RefHolder> l = refHolders.get(oid); if (l == null) { return; } for (RefHolder rh : l) { if (rh.getType().equals(type)) { try { if (rh.release()) { l.remove(rh); if (l.isEmpty()) { refHolders.remove(oid); } } } finally { release(); } break; } } } }
Any a2 = Any.complete(any2); Type t = a1.getType(); if (!a2.getType().equals(t)) { return false;
Any a2 = Any.complete(any2); Type t = a1.getType(); if (!a2.getType().equals(t)) { return false;