Downvote an object and register the vote in DB.
@param obj the object to receive -1 votes
@param voterid the userid of the voter
@return true if vote was successful
961384
public boolean voteDown(ParaObject obj, String voterid) {
		if (obj == null || StringUtils.isBlank(voterid)) {
			return false;
		}
		return getEntity(invokePatch(obj.getType().concat("/").concat(obj.getId()),
				Entity.json(Collections.singletonMap("_votedown", voterid))), Boolean.class);
	}
322527
@Override
    public int compareTo(Object obj)
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "compareTo", obj);

        UUID other = (UUID) obj; // Allowed to throw ClassCastException

        int result = 0;

        if (equals(other))
        {
            result = 0;
        }
        else if (_unexpectedFormat)
        {
            // This UUID is in an unexpected format so we do not have
            // uuidHigh and uuidLow to compare. Instead we compare the
            // two UUID's hash codes (the sum of each byte of their
            // byte array form).
            result = Integer.valueOf(hashCode()).compareTo(Integer.valueOf(other.hashCode()));
        }
        else
        {
            result = Long.valueOf(_uuidHigh).compareTo(Long.valueOf(other._uuidHigh));

            if (result == 0)
            {
                result = Long.valueOf(_uuidLow).compareTo(Long.valueOf(other._uuidLow));
            }
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "compareTo", Integer.valueOf(result));
        return result;
    }
620079
public void add_obj_polling(final DevVarLongStringArray argin, final boolean with_db_upd)
            throws DevFailed {
        Util.out4.println("In add_obj_polling command");
        for (final String value : argin.svalue) {
            Util.out4.println("Input string = " + value);
        }
        for (final int value : argin.lvalue) {
            Util.out4.println("Input long = " + value);
        }

        // Check that parameters number is correct
        if (argin.svalue.length != 3 || argin.lvalue.length != 1) {
            Except.throw_exception("API_WrongNumberOfArgs", "Incorrect number of inout arguments",
                    "DServer.add_obj_polling");
        }

        // Find the device
        final Util tg = Util.instance();
        DeviceImpl dev = null;
        try {
            dev = tg.get_device_by_name(argin.svalue[0]);
        } catch (final DevFailed e) {
            Except.re_throw_exception(e, "API_DeviceNotFound", "Device " + argin.svalue[0]
                    + " not found", "DServer.add_obj_polling");
        }

        // Check that the command (or the attribute) exists.
        // For command, also checks that it does not need input value.
        final String obj_type = argin.svalue[1].toLowerCase();
        final String obj_name = argin.svalue[2].toLowerCase();
        int type = Tango_POLL_CMD;
        assert dev != null;
        if (obj_type.equals(Tango_PollCommand)) {
            dev.check_command_exists(obj_name);
            type = Tango_POLL_CMD;
        } else if (obj_type.equals(Tango_PollAttribute)) {
            dev.get_device_attr().get_attr_by_name(obj_name);
            type = Tango_POLL_ATTR;
        } else {
            Except.throw_exception("API_NotSupported",
                    "Object type " + obj_type + " not supported", "DServer.add_obj_polling");
        }

        // If it's for the Init command, refuse to poll it
        if (type == Tango_POLL_CMD) {
            if (obj_name.equals("Init")) {
                Except.throw_exception("API_NotSupported",
                        "It's not possible to poll the Init command!", "DServer.add_obj_polling");
            }
        }

        // Check if the object is not already polled
        final Vector poll_list = dev.get_poll_obj_list();
        for (int i = 0; i < poll_list.size(); i++) {
            final PollObj poll_obj = (PollObj) poll_list.elementAt(i);
            if (poll_obj.get_type() == type) {
                if (poll_obj.get_name().equals(obj_name)) {
                    String s;
                    if (type == Tango_POLL_CMD) {
                        s = "Command ";
                    } else {
                        s = "Attribute ";
                    }
                    Except.throw_exception("API_AlreadyPolled", s + " " + obj_name
                            + " already polled", "DServer.add_obj_polling");
                }
            }
        }
        // Check that the update period is not to small
        final int upd = argin.lvalue[0];
        if (upd < Tango_MIN_POLL_PERIOD && upd != 0) {
            Except.throw_exception("API_NotSupported", upd
                    + " is below the min authorized period (100 mS)", "DServer.add_obj_polling");
        }

        // Create a new PollObj instance for this object
        poll_list.add(new PollObj(dev, type, obj_name, upd));

        // Send command to the polling thread but wait in case of previous cmd
        // still not executed
        Util.out4.println("Sending cmd to polling thread");
        final TangoMonitor mon = tg.get_poll_monitor();
        final PollThCmd shared_cmd = tg.get_poll_shared_cmd();

        if (shared_cmd.cmd_pending == true) {
            mon.wait_it();
        }
        shared_cmd.cmd_pending = true;
        shared_cmd.cmd_code = Tango_POLL_ADD_OBJ;
        shared_cmd.dev = dev;
        shared_cmd.index = poll_list.size() - 1;
        mon.signal();
        Util.out4.println("Cmd sent to polling thread");

        // Wait for thread to execute command
        boolean interupted;
        while (shared_cmd.cmd_pending == true) {
            interupted = mon.wait_it(Tango_DEFAULT_TIMEOUT);
            if (shared_cmd.cmd_pending == true && interupted == false) {
                Util.out4.println("TIME OUT");
                poll_list.remove(poll_list.size() - 1);
                Except.throw_exception("API_CommandTimedOut", "Polling thread blocked !!!",
                        "DServer.add_obj_polling");
            }
        }
        Util.out4.println("Thread cmd normally executed");

        // Update polling parameters in database (if wanted and possible)
        // If the property is already there (it should not but...),
        // only update its polling period
        if (with_db_upd && Util._UseDb) {
            final String upd_str = "" + upd;
            boolean found = false;

            final DbDatum db_info = new DbDatum("polled_cmd");
            if (type == Tango_POLL_CMD) {
                final Vector non_auto_list = dev.get_non_auto_polled_cmd();
                for (int i = 0; i < non_auto_list.size(); i++) {
                    final String s = (String) non_auto_list.elementAt(i);
                    if (s.equals(obj_name)) {
                        non_auto_list.remove(i);
                        db_info.name = "non_auto_polled_cmd";
                        db_info.insert(stringVect2StringArray(non_auto_list));
                        found = true;
                        break;
                    }
                }
                if (found == false) {
                    final Vector cmd_list = dev.get_polled_cmd();
                    int i;
                    for (i = 0; i < cmd_list.size(); i = i + 2) {
                        final String s = (String) cmd_list.elementAt(i);
                        if (s.equals(obj_name)) {
                            cmd_list.remove(i + 1);
                            cmd_list.insertElementAt(upd_str, i + 1);
                            break;
                        }
                    }
                    if (i == cmd_list.size()) {
                        cmd_list.add(obj_name);
                        cmd_list.add(upd_str);
                    }
                    db_info.insert(stringVect2StringArray(cmd_list));
                }
            } else {
                final Vector non_auto_list = dev.get_non_auto_polled_attr();
                for (int i = 0; i < non_auto_list.size(); i++) {
                    final String s = (String) non_auto_list.elementAt(i);
                    if (s.equals(obj_name)) {
                        non_auto_list.remove(i);
                        db_info.name = "non_auto_polled_attr";
                        db_info.insert(stringVect2StringArray(non_auto_list));
                        found = true;
                        break;
                    }
                }
                if (found == false) {
                    db_info.name = "polled_attr";
                    final Vector attr_list = dev.get_polled_attr();
                    int i;
                    for (i = 0; i < attr_list.size(); i = i + 2) {
                        final String s = (String) attr_list.elementAt(i);
                        if (s.equals(obj_name)) {
                            attr_list.remove(i + 1);
                            attr_list.insertElementAt(upd_str, i + 1);
                            break;
                        }
                    }
                    if (i == attr_list.size()) {
                        attr_list.add(obj_name);
                        attr_list.add(upd_str);
                    }
                    db_info.insert(stringVect2StringArray(attr_list));
                }
            }

            final DbDatum[] send_data = new DbDatum[1];
            send_data[0] = db_info;
            dev.get_db_device().put_property(send_data);

            Util.out4.println("Polling properties updated");
        }

        // Mark the device as polled
        dev.is_polled(true);
    }
1229393
synchronized PollObj get_polled_obj_by_type_name(final int obj_type, final String obj_name)
	    throws DevFailed {
	// Get vector and search for type and name.
	final Vector po_list = get_poll_obj_list();
	for (int i = 0; i < po_list.size(); i++) {
	    final PollObj polled_obj = (PollObj) po_list.elementAt(i);
	    if (polled_obj.get_type_i() == obj_type) {
		if (polled_obj.get_name_i().equals(obj_name)) {
		    return polled_obj;
		}
	    }
	}

	// If not found throws exception
	Except.throw_exception("API_PollObjNotFound", obj_name
		+ " not found in list of polled object", "DeviceImpl.get_polled_obj_by_type_name");
	return null;
    }
1249394
public int compareTo(CmsJspNavElement obj) {

        if (obj == this) {
            return 0;
        }
        float pos = obj.getNavPosition();
        // please note: can't just subtract and cast to int here because of float precision loss
        if (m_position == pos) {
            return 0;
        }
        return (m_position < pos) ? -1 : 1;
    }
761276
public static void unregisterObject(String id, Object obj) {
    DefaultMonitorRegistry.getInstance().unregister(newObjectMonitor(id, obj));
  }
1266307
@Override
    public void visitCode(Code obj) {
        try {
            userValues = new HashMap<>();
            super.visitCode(obj);
        } finally {
            userValues = null;
        }
    }
509951
public <T extends DObject> T registerObject (T object)
    {
        if (_dobjThread != null && !isDispatchThread()) {
            log.warning("Registering DObject on non-dobject thread",
                        "class", object.getClass().getName(), new Exception());
        }

        int oid = getNextOid();

        // initialize this object
        object.setOid(oid);
        object.setManager(this);

        // set the default access controller if a controller hasn't already been specified
        if (object.getAccessController() == null) {
            object.setAccessController(_defaultController);
        }

        // insert it into the table
        _objects.put(oid, object);

//         log.info("Registered object", "obj", object);

        return object;
    }
272829
public void setResult(T obj) {
        lock.lock();
        try {
            result=obj;
            hasResult=true;
            cond.signal(true);
        }
        finally {
            lock.unlock();
        }
    }
996523
public void startPolling(final String polledObject, final int pollingPeriod) throws DevFailed {
        try {
            final AttributeImpl attr = AttributeGetterSetter.getAttribute(polledObject, device.getAttributeList());
            attr.configurePolling(pollingPeriod);
            device.startPolling(attr);
        } catch (final DevFailed e) {
            if (polledObject.equalsIgnoreCase(DeviceImpl.STATE_NAME)
                    || polledObject.equalsIgnoreCase(DeviceImpl.STATUS_NAME)) {
                final CommandImpl cmd = device.getCommand(polledObject);
                cmd.configurePolling(pollingPeriod);
                device.startPolling(cmd);
            } else {
                throw e;
            }
        }
    }
85577
public synchronized boolean checkWrite(TransactionImpl tx, Object obj)
    {
        if (log.isDebugEnabled()) log.debug("LM.checkWrite(tx-" + tx.getGUID() + ", " + new Identity(obj, tx.getBroker()).toString() + ")");
        LockStrategy lockStrategy = LockStrategyFactory.getStrategyFor(obj);
        return lockStrategy.checkWrite(tx, obj);
    }
114619
public function votedown($voter)
    {
        //first check if we have voted up if yes then just remove that
        if (
            $voteup = $this->voteups->getQuery(true)
                                    ->disableChain()
                                    ->voter($voter)
                                    ->fetch()
        ) {
            $voteup->delete();
        } else {
            //find ore create a voteup
            $votedown = $this->votedowns
                             ->findOrAddNew(array(
                               'voter' => $voter,
                               'votee' => $this, ));
        }
    }
114385
function(obj) {
      if (obj == null) return void 0;
      return this._byId[obj] ||
        this._byId[this.entityId(obj.attributes || obj)] ||
        obj.cid && this._byId[obj.cid];
    }
854987
public static <E> int compare(final Comparable<E> obj1, final E obj2) {
        if (obj1 == obj2) {
            return 0;
        }
        if (obj1 == null) {
            return -1;
        }
        if (obj2 == null) {
            return 1;
        }

        return obj1.compareTo(obj2);
    }
92549
@Override
    public void visitCode(Code obj) {
        Method m = getMethod();
        stack.resetForMethodEntry(this);
        initializedRegs.clear();
        modifyRegs.clear();
        Type[] argTypes = m.getArgumentTypes();
        int arg = m.isStatic() ? 0 : 1;
        for (Type argType : argTypes) {
            String argSig = argType.getSignature();
            initializedRegs.set(arg);
            arg += SignatureUtils.getSignatureSize(argSig);
        }
        nullStoreToLocation.clear();
        super.visitCode(obj);

        for (Integer pc : nullStoreToLocation.values()) {
            bugReporter.reportBug(new BugInstance(this, BugType.AIOB_ARRAY_STORE_TO_NULL_REFERENCE.name(), HIGH_PRIORITY).addClass(this).addMethod(this)
                    .addSourceLine(this, pc.intValue()));
        }
    }
862436
@Override
    public void visitCode(Code obj) {
        stack.resetForMethodEntry(this);
        conditionalTarget = -1;
        sawMethodWeight = 0;
        super.visitCode(obj);
    }
882687
@SuppressWarnings("unchecked")
	public E poll () {
		if (size == 0) return null;
		int s = --size;
		E result = (E)queue[0];
		E x = (E)queue[s];
		queue[s] = null;
		if (s != 0) siftDown(0, x);
		if (uniqueness) set.remove(result);
		return result;
	}