gnu.trove.strategy.HashingStrategy Java Examples
The following examples show how to use
gnu.trove.strategy.HashingStrategy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StringFeatureAlphabet.java From fnlp with GNU Lesser General Public License v3.0 | 6 votes |
public StringFeatureAlphabet() { data = new TObjectIntCustomHashMap<String>(new HashingStrategy<String>() { AbstractHashCode hash = new MurmurHash(); @Override public int computeHashCode(String object) { return hash.hashcode(object); } @Override public boolean equals(String o1, String o2) { // return (o1.charAt(0)==o2.charAt(0)); return o1.equals(o2); } }, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, noEntryValue); frozen = false; last = 0; }
Example #2
Source File: ClusterFeatureAlphabet.java From fnlp with GNU Lesser General Public License v3.0 | 6 votes |
public ClusterFeatureAlphabet() { data = new TObjectIntCustomHashMap<String>(new HashingStrategy<String>() { AbstractHashCode hash = new MurmurHash(); @Override public int computeHashCode(String object) { return hash.hashcode(object); } @Override public boolean equals(String o1, String o2) { // return (o1.charAt(0)==o2.charAt(0)); return o1.equals(o2); } }, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, noEntryValue); frozen = false; last = 0; }
Example #3
Source File: AbstractEntropyMeasure.java From codebase with GNU Lesser General Public License v3.0 | 5 votes |
/** * Compute value of this measure. * * @return Value of entropy for the given model. * @throws Exception if limitations of this measure are not satisfied by the given models. */ public double computeMeasure() throws Exception { if (limitationsHold==null) this.checkLimitations(); if (limitationsHold==null || !limitationsHold.booleanValue()) { throw new Exception(String.format("Limitation(s): %s of %s measure are not fulfilled", violetedLimitations, this.getClass().getName())); } HashingStrategy<String> strategy = new HashingStrategy<String>() { public int computeHashCode(String object) { return object.hashCode(); } public boolean equals(String o1, String o2) { return o1.equals(o2); } }; TObjectShortMap<String> activity2short = new TObjectShortCustomHashMap<String>(strategy, 10, 0.5f, (short) -1); System.out.println(String.format("Constructing automaton for retrieved model")); long start = System.currentTimeMillis(); if (model instanceof NetSystem) { model = Utils.constructAutomatonFromNetSystem((NetSystem) model, activity2short); } else if (model instanceof XLog){ model = Utils.constructAutomatonFromLog((XLog) model, activity2short); } long finish = System.currentTimeMillis(); System.out.println(String.format("The automaton for model constructed in %s ms.", (finish-start))); System.out.println(String.format("The number of states: %s", ((Automaton)model).getNumberOfStates())); System.out.println(String.format("The number of transitions: %s", Utils.numberOfTransitions((Automaton)model))); start = System.nanoTime(); this.measureValue = this.computeMeasureValue(); this.measureComputationTime = System.nanoTime()-start; return this.measureValue; }
Example #4
Source File: AbstractQualityMeasure.java From codebase with GNU Lesser General Public License v3.0 | 4 votes |
/** * Compute value of this measure. * * @return Value of this measure for the given models of relevant and retrieved traces. * @throws Exception if limitations of this measure are not satisfied by the given models. */ public Pair<Double, Double> computeMeasure() throws Exception { if (limitationsHold==null) this.checkLimitations(); if (limitationsHold==null || !limitationsHold.booleanValue()) { throw new Exception(String.format("Limitation(s): %s of %s measure are not fulfilled", violetedLimitations, this.getClass().getName())); } HashingStrategy<String> strategy = new HashingStrategy<String>() { public int computeHashCode(String object) { return object.hashCode(); } public boolean equals(String o1, String o2) { return o1.equals(o2); } }; TObjectShortMap<String> activity2short = new TObjectShortCustomHashMap<String>(strategy, 10, 0.5f, (short) -1); System.out.println(String.format("Constructing automaton RET that encodes the retrieved model.")); long start = System.currentTimeMillis(); if (retrievedTraces instanceof NetSystem) { retrievedTraces = Utils.constructAutomatonFromNetSystem((NetSystem) retrievedTraces, activity2short); } else if (retrievedTraces instanceof XLog){ retrievedTraces = Utils.constructAutomatonFromLog((XLog) retrievedTraces, activity2short); } long finish = System.currentTimeMillis(); System.out.println(String.format("Automaton RET constructed in %s ms.", (finish-start))); System.out.println(String.format("Automaton RET has %s states and %s transitions.", ((Automaton)retrievedTraces).getNumberOfStates(), Utils.numberOfTransitions((Automaton)retrievedTraces))); System.out.println(String.format("Constructing automaton REL that encodes the relevant model.")); start = System.currentTimeMillis(); if (relevantTraces instanceof NetSystem) { relevantTraces = Utils.constructAutomatonFromNetSystem((NetSystem) relevantTraces, activity2short); } else if (relevantTraces instanceof XLog){ relevantTraces = Utils.constructAutomatonFromLog((XLog) relevantTraces, activity2short); } finish = System.currentTimeMillis(); System.out.println(String.format("Automaton REL constructed in %s ms.", (finish-start))); System.out.println(String.format("Automaton REL has %s states and %s transitions.", ((Automaton)relevantTraces).getNumberOfStates(), Utils.numberOfTransitions((Automaton)relevantTraces))); start = System.nanoTime(); this.measureValue = this.computeMeasureValue(); this.measureComputationTime = System.nanoTime()-start; return this.measureValue; }