Method to get the parsed value for this phrase.

@param _instance Instance the phrase is build on
@return parsed value
@throws EFapsException on error
174388
public String getPhraseValue(final Instance _instance)
        throws EFapsException
    {
        final StringBuilder buf = new StringBuilder();
        boolean added = false;
        for (final Token token : this.valueList.getTokens()) {
            switch (token.getType()) {
                case EXPRESSION:
                    final OneSelect oneselect = this.selectStmt2OneSelect.get(token.getValue());
                    final Object value = oneselect.getObject();
                    if (oneselect.getAttribute() != null) {
                        final UIValue uiValue = UIValue.get(null, oneselect.getAttribute(), value);
                        final String val = uiValue.getUIProvider().getStringValue(uiValue);
                        if (val != null) {
                            added = true;
                            buf.append(uiValue.getUIProvider().getStringValue(uiValue));
                        }
                    } else if (value != null) {
                        added = true;
                        buf.append(value);
                    }
                    break;
                case TEXT:
                    buf.append(token.getValue());
                    break;
                default:
                    break;
            }
        }
        return added ? buf.toString() : "";
    }
1192439
private String getValue(final String _key,
                            final ConfType _type)
        throws EFapsException
    {
        final List<Value> fv = values.stream()
                        .filter(p -> p.type.equals(_type))
                        .filter(p -> p.key.equals(_key))
                        .filter(p -> priority(p) > 0)
                        .sorted((_o1,
                         _o2) -> Integer.compare(priority(_o2), priority(_o1))).collect(Collectors.toList());
        SystemConfiguration.LOG.debug("Analyzed for key {}: {}", _key, fv);
        final String ret;
        if (fv.isEmpty()) {
            ret = null;
        } else {
            ret = fv.get(0).value;
        }
        return ret;
    }
1116500
public static This getClassInstanceThis(Object instance, String className) {
        try {
            Object o = getObjectFieldValue(instance, BSHTHIS + className);
            return (This) Primitive.unwrap(o); // unwrap Primitive.Null to null
        } catch (Exception e) {
            throw new InterpreterError("Generated class: Error getting This" + e, e);
        }
    }
269659
def parse_instance_count(instance_count, speaker_total_count):
    

    # Use all the instances of a speaker unless specified
    result = copy.copy(speaker_total_count)
    for speaker_id, count in instance_count.items():
        speaker_id = str(speaker_id)
        speaker_total = speaker_total_count.get(speaker_id, 0)

        if type(count) == float and 0.0 <= count <= 1.0:
            result[speaker_id] = int(speaker_total * count)

        else:
            result[speaker_id] = int(count)

    return result
213942
public static Class<?> getInstanceClass(Object instance) {
        Class<?> clazz = instance.getClass();      
        return (instance instanceof Hooked) ? clazz.getSuperclass() : clazz;
    }
1320834
public Object getValue(Object instance) {
        try {
            return getMethod.invoke(instance);
        } catch (Exception e) {
            throw new PropertyNotFoundException(klass, getType(), fieldName);
        }

    }
457105
private void checkProgramInstance()
    {
        try {
            if (EventDefinition.LOG.isDebugEnabled()) {
                EventDefinition.LOG.debug("checking Instance: {} - {}", this.resourceName, this.methodName);
            }
            if (!EFapsClassLoader.getInstance().isOffline()) {
                final Class<?> cls = Class.forName(this.resourceName, true, EFapsClassLoader.getInstance());
                final Method method = cls.getMethod(this.methodName, new Class[] { Parameter.class });
                final Object progInstance = cls.newInstance();
                if (EventDefinition.LOG.isDebugEnabled()) {
                    EventDefinition.LOG.debug("found Class: {} and method {}", progInstance, method);
                }
            }
        } catch (final ClassNotFoundException e) {
            EventDefinition.LOG.error("could not find Class: '{}'", this.resourceName, e);
        } catch (final InstantiationException e) {
            EventDefinition.LOG.error("could not instantiat Class: '{}'", this.resourceName, e);
        } catch (final IllegalAccessException e) {
            EventDefinition.LOG.error("could not access Class: '{}'", this.resourceName, e);
        } catch (final SecurityException e) {
            EventDefinition.LOG.error("could not access Class: '{}'", this.resourceName, e);
        } catch (final NoSuchMethodException e) {
            EventDefinition.LOG.error("could not find method: '{}' in class '{}'",
                            new Object[] { this.methodName, this.resourceName, e });
        }
    }
1175641
public Resource getResource(final Instance _instance)
        throws EFapsException
    {
        Resource ret = null;
        try {
            Store.LOG.debug("Getting resource for: {} with properties: {}", this.resource, this.resourceProperties);
            ret = (Resource) Class.forName(this.resource).newInstance();
            ret.initialize(_instance, this);
        } catch (final InstantiationException e) {
            throw new EFapsException(Store.class, "getResource.InstantiationException", e, this.resource);
        } catch (final IllegalAccessException e) {
            throw new EFapsException(Store.class, "getResource.IllegalAccessException", e, this.resource);
        } catch (final ClassNotFoundException e) {
            throw new EFapsException(Store.class, "getResource.ClassNotFoundException", e, this.resource);
        }
        return ret;
    }
347067
def parse_value_namedinstance(self, tup_tree):
        

        self.check_node(tup_tree, 'VALUE.NAMEDINSTANCE')

        k = kids(tup_tree)
        if len(k) != 2:
            raise CIMXMLParseError(
                _format("Element {0!A} has invalid number of child elements "
                        "{1!A} (expecting two child elements "
                        "(INSTANCENAME, INSTANCE))",
                        name(tup_tree), k),
                conn_id=self.conn_id)

        inst_path = self.parse_instancename(k[0])
        instance = self.parse_instance(k[1])
        instance.path = inst_path

        return instance
1074243
public function getInstanceValue()
    {
        $value = $this->getValue();
        if (
            is_array($value) &&
            array_key_exists($this->instances, $this->value)
        ) {
            $value = $value[$this->instances];
        }
        return $value;
    }
350213
InstanceWrapper getInstanceForKey(final Object key) throws ContainerException {
        // common case has "no" contention
        InstanceWrapper wrapper = instances.get(key);
        if(wrapper != null)
            return wrapper;

        // otherwise we will be working to get one.
        final Boolean tmplock = Boolean.TRUE;
        Boolean lock = keysBeingWorked.putIfAbsent(key, tmplock);
        if(lock == null)
            lock = tmplock;

        // otherwise we'll do an atomic check-and-update
        synchronized(lock) {
            wrapper = instances.get(key); // double checked lock?????
            if(wrapper != null)
                return wrapper;

            Object instance = null;
            try {
                instance = prototype.newInstance();
            } catch(final DempsyException e) {
                if(e.userCaused()) {
                    LOGGER.warn("The message processor prototype " + SafeString.valueOf(prototype)
                        + " threw an exception when trying to create a new message processor for they key " + SafeString.objectDescription(key));
                    statCollector.messageFailed(true);
                    instance = null;
                } else
                    throw new ContainerException("the container for " + clusterId + " failed to create a new instance of " +
                        SafeString.valueOf(prototype) + " for the key " + SafeString.objectDescription(key) +
                        " because the clone method threw an exception.", e);
            } catch(final RuntimeException e) {
                throw new ContainerException("the container for " + clusterId + " failed to create a new instance of " +
                    SafeString.valueOf(prototype) + " for the key " + SafeString.objectDescription(key) +
                    " because the clone invocation resulted in an unknown exception.", e);
            }

            if(instance == null)
                throw new ContainerException("the container for " + clusterId + " failed to create a new instance of " +
                    SafeString.valueOf(prototype) + " for the key " + SafeString.objectDescription(key) +
                    ". The value returned from the clone call appears to be null.");

            // activate
            boolean activateSuccessful = false;
            try {
                if(instance != null) {
                    if(LOGGER.isTraceEnabled())
                        LOGGER.trace("the container for " + clusterId + " is activating instance " + String.valueOf(instance)
                            + " via " + SafeString.valueOf(prototype) + " for " + SafeString.valueOf(key));
                    prototype.activate(instance, key);
                    activateSuccessful = true;
                }
            } catch(final DempsyException e) {
                if(e.userCaused()) {
                    LOGGER.warn("The message processor " + SafeString.objectDescription(instance) + " activate call threw an exception.");
                    statCollector.messageFailed(true);
                    instance = null;
                } else
                    throw new ContainerException(
                        "the container for " + clusterId + " failed to invoke the activate method of " + SafeString.valueOf(prototype)
                            + ". Is the active method accessible - the class is public and the method is public?",
                        e);
            } catch(final RuntimeException e) {
                throw new ContainerException(
                    "the container for " + clusterId + " failed to invoke the activate method of " + SafeString.valueOf(prototype) +
                        " because of an unknown exception.",
                    e);
            }

            if(activateSuccessful) {
                // we only want to create a wrapper and place the instance into the container
                // if the instance activated correctly. If we got here then the above try block
                // must have been successful.
                wrapper = new InstanceWrapper(instance); // null check above.
                instances.putIfAbsent(key, wrapper); // once it goes into the map, we can remove it from the 'being worked' set
                keysBeingWorked.remove(key); // remove it from the keysBeingWorked since any subsequent call will get
                // the newly added one.
                statCollector.messageProcessorCreated(key);
            }
            return wrapper;
        }
    }
881643
public static final Parser<Long> instance() { // NOPMD it's thread save!
    if (LongParserWithoutSeparator.instanceParser == null) {
      synchronized (LongParserWithoutSeparator.class) {
        if (LongParserWithoutSeparator.instanceParser == null) {
          LongParserWithoutSeparator.instanceParser = new LongParserWithoutSeparator();
        }
      }
    }
    return LongParserWithoutSeparator.instanceParser;
  }
1003155
public List<Instance> getInstances4Attribute(final String _attributeName)
        throws EFapsException
    {
        final OneSelect oneselect = this.attr2OneSelect.get(_attributeName);
        return oneselect == null ? null : oneselect.getInstances();
    }
981358
public static final Parser<Boolean> instance() { // NOPMD it's thread save!
    if (BooleanParser.instanceParser == null) {
      synchronized (BooleanParser.class) {
        if (BooleanParser.instanceParser == null) {
          BooleanParser.instanceParser = new BooleanParser();
        }
      }
    }
    return BooleanParser.instanceParser;
  }
1012352
public Instance getInstance(final String my_instance_id) {
    // [START instance_admin_client_get_instance]
    final String instanceId = my_instance_id;
    Instance ins = instanceAdminClient.getInstance(instanceId);
    // [END instance_admin_client_get_instance]
    return ins;
  }
112865
private AbstractQValue getValue(final Object _value)
        throws EFapsException
    {
        AbstractQValue ret = null;
        if (_value == null) {
            ret = new QNullValue();
        } else if (_value instanceof Number) {
            ret = new QNumberValue((Number) _value);
        } else if (_value instanceof String) {
            ret = new QStringValue((String) _value);
        } else if (_value instanceof DateTime) {
            ret = new QDateTimeValue((DateTime) _value);
        } else if (_value instanceof Boolean) {
            ret = new QBooleanValue((Boolean) _value);
        } else if (_value instanceof Status) {
            ret = new QNumberValue(((Status) _value).getId());
        } else if (_value instanceof CIStatus) {
            ret = new QNumberValue(Status.find((CIStatus) _value).getId());
        } else if (_value instanceof Instance) {
            if (!((Instance) _value).isValid()) {
                QueryBuilder.LOG.error("the given Instance was not valid and cannot be used as filter criteria",
                                _value);
                throw new EFapsException(QueryBuilder.class, "invalid Instance given");
            }
            ret = new QNumberValue(((Instance) _value).getId());
        } else if (_value instanceof UoM) {
            ret = new QNumberValue(((UoM) _value).getId());
        } else if (_value instanceof IBitEnum) {
            ret = new QBitValue((IBitEnum) _value);
        } else if (_value instanceof IEnum) {
            ret = new QNumberValue(((IEnum) _value).getInt());
        } else if (_value instanceof AbstractQValue) {
            ret = (AbstractQValue) _value;
        } else {
            throw new EFapsException(QueryBuilder.class, "notsuported");
        }
        return ret;
    }
788149
private void extractInstance(ExtractionInstance instance) {
    PrototypeMemberDeclaration first = instance.declarations.get(0);
    String className = first.qualifiedClassName;
    if (pattern == Pattern.USE_GLOBAL_TEMP) {
      // Use the temp variable to hold the prototype.
      Node classNameNode = NodeUtil.newQName(compiler, className);
      classNameNode.putBooleanProp(Node.IS_CONSTANT_NAME, first.constant);
      Node stmt =
          IR.exprResult(
              IR.assign(
                  IR.name(PROTOTYPE_ALIAS),
                  IR.getprop(
                      classNameNode, IR.string("prototype"))))
          .useSourceInfoIfMissingFromForTree(first.node);

      instance.parent.addChildBefore(stmt, first.node);
      compiler.reportChangeToEnclosingScope(stmt);
    } else if (pattern == Pattern.USE_IIFE) {
      Node block = IR.block();
      Node func = IR.function(
           IR.name(""),
           IR.paramList(IR.name(PROTOTYPE_ALIAS)),
           block);

      Node call = IR.call(func,
           NodeUtil.newQName(
               compiler, className + ".prototype",
               instance.parent, className + ".prototype"));
      call.putIntProp(Node.FREE_CALL, 1);

      Node stmt = IR.exprResult(call);
      stmt.useSourceInfoIfMissingFromForTree(first.node);
      instance.parent.addChildBefore(stmt, first.node);
      compiler.reportChangeToEnclosingScope(stmt);
      for (PrototypeMemberDeclaration declar : instance.declarations) {
        compiler.reportChangeToEnclosingScope(declar.node);
        block.addChildToBack(declar.node.detach());
      }
    }
    // Go through each member declaration and replace it with an assignment
    // to the prototype variable.
    for (PrototypeMemberDeclaration declar : instance.declarations) {
      replacePrototypeMemberDeclaration(declar);
    }
  }