@Override public NodeParameters clone() { NodeParameters duplicate = new NodeParameters(); if (keyMapping != null) { duplicate.keyMapping = new HashMap<>(this.keyMapping); } if (boolMap != null) { duplicate.boolMap = new TObjectByteHashMap<>(boolMap); } if (longMap != null) { duplicate.longMap = new TObjectLongHashMap<>(longMap); } if (doubleMap != null) { duplicate.doubleMap = new TObjectDoubleHashMap<>(doubleMap); } if (stringMap != null) { duplicate.stringMap = new HashMap<>(this.stringMap); } return duplicate; }
public static TObjectLongHashMap loadTXT2LongGZMap(String mapFile, boolean reverse) throws IOException { long time = System.currentTimeMillis(); TObjectLongHashMap idMap = new TObjectLongHashMap(); BufferedReader br = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(mapFile)))); String line; String[] parts; while ((line = br.readLine()) != null) { parts = line.split(SEP); try { if (!reverse) { idMap.put(parts[1], Long.parseLong(parts[0])); } else { idMap.put(parts[0], Long.parseLong(parts[1])); } } catch (java.lang.ArrayIndexOutOfBoundsException ex) { logger.info(line); System.exit(-1); } } logger.info(((System.currentTimeMillis() - time) / 1000d) + "s"); return idMap; }
public TObjectLongMap<Rule<T>> getUsedRules() { TObjectLongMap<Rule<T>> rules = new TObjectLongHashMap<Rule<T>>(Constants.DEFAULT_CAPACITY, Constants.DEFAULT_LOAD_FACTOR, -1); List<Rule<T>> iteratedList = new ArrayList<Rule<T>>(32); List<Rule<T>> newList = new ArrayList<Rule<T>>(32); iteratedList.add(this); do { for (Rule<T> rule : iteratedList) { for (Symbol<T> sym: rule.symbols) { if (sym instanceof NonTerminal<?>) { Rule<T> newRule = ((NonTerminal<T>)sym).getRule(); if (rules.adjustOrPutValue(newRule, 1, 1) == 1) // increase counter. new rule? newList.add(newRule); } } } List<Rule<T>> nextNewList = iteratedList; iteratedList = newList; newList = nextNewList; newList.clear(); } while (!iteratedList.isEmpty()); return rules; }
/** * {@inheritDoc} * @see com.heliosapm.shorthand.datamapper.IDataMapper#put(long, gnu.trove.map.hash.TObjectLongHashMap, long[]) */ @Override public void put(final long address, final long[] data) { HeaderOffset.Touch.set(address, 1); int enumIndex = (int)HeaderOffset.EnumIndex.get(address); int bitMask = (int)HeaderOffset.BitMask.get(address); TObjectLongHashMap<T> offsets = (TObjectLongHashMap<T>) EnumCollectors.getInstance().offsets(enumIndex, bitMask); if(offsets.isEmpty()) return; offsets.forEachEntry(new TObjectLongProcedure<ICollector<?>>() { @Override public boolean execute(ICollector<?> collector, long offset) { if(!collector.isPreApply()) { collector.apply(address+offset, data); } return true; } }); }
public PlayTimeManager() { this.totalPlaytimeMap = new TObjectLongHashMap<>(); this.sessionTimestamps = new TObjectLongHashMap<>(); this.config = new FileConfig("play-times.yml"); this.reloadPlaytimeData(); Bukkit.getPluginManager().registerEvents(this, PracticePlugin.getInstance()); }
public static void testBug3067307() { TObjectLongHashMap<String> testHash = new TObjectLongHashMap<String>(); final int c = 1000; for ( long i = 1; i < c; i++ ) { final String data = "test-" + i; testHash.put( data, i ); testHash.remove( data ); } }
public static void testBug3067307_noAutoCompact() { TObjectLongHashMap<String> testHash = new TObjectLongHashMap<String>(); testHash.setAutoCompactionFactor( 0 ); final int c = 1000; for ( long i = 1; i < c; i++ ) { final String data = "test-" + i; testHash.put( data, i ); testHash.remove( data ); } }
/** * Creates a new DeltaManager */ private DeltaManager() { final int initialDeltaCapacity = ConfigurationHelper.getIntSystemThenEnvProperty(DELTA_CAPACITY, DELTA_CAPACITY_DEFAULT); final float initialDeltaLoadFactor = ConfigurationHelper.getFloatSystemThenEnvProperty(DELTA_LOAD_FACTOR, DELTA_LOAD_FACTOR_DEFAULT); longDeltas = new TObjectLongHashMap<java.lang.String>(initialDeltaCapacity, initialDeltaLoadFactor, Long.MIN_VALUE); doubleDeltas = new TObjectDoubleHashMap<java.lang.String>(initialDeltaCapacity, initialDeltaLoadFactor, Double.MIN_NORMAL); intDeltas = new TObjectIntHashMap<java.lang.String>(initialDeltaCapacity, initialDeltaLoadFactor, Integer.MIN_VALUE); longVDeltas = new TObjectLongHashMap<java.lang.String>(initialDeltaCapacity, initialDeltaLoadFactor, Long.MIN_VALUE); doubleVDeltas = new TObjectDoubleHashMap<java.lang.String>(initialDeltaCapacity, initialDeltaLoadFactor, Double.MIN_NORMAL); intVDeltas = new TObjectIntHashMap<java.lang.String>(initialDeltaCapacity, initialDeltaLoadFactor, Integer.MIN_VALUE); JMXHelper.registerMBean(OBJECT_NAME, this); }
public NodeParameters set(String key, long value) { ensureKeyType(key, Type.LONG); if (longMap == null) { longMap = new TObjectLongHashMap<>(); } longMap.put(key, value); return this; }
@Override @SuppressWarnings("null") public @NonNull TObjectLongHashMap<Duplex> getIssues() { if (issues == null) { issues = new TObjectLongHashMap<>(); } return issues; }
public StatsWordMatch() { this.available = new HashMap<String,Pattern>(); addAvail(new EmoticonPatternProvider()); addAvail(new URLPatternProvider()); addAvail(new TimePatternProvider()); addAvail(new PunctuationPatternProvider()); TwitterStuffPatternProvider tpp = new TwitterStuffPatternProvider(); addAvail("TwitterStuff.hashtags", tpp.hashtagPatternString()); addAvail("TwitterStuff.retweets", tpp.retweetPatternString()); addAvail("TwitterStuff.username", tpp.usernamePatternString()); addAvail("EdgePunctuation",EdgePunctuationPatternProvider.edgePuncPattern()); this.counts = new TObjectLongHashMap<String>(); }
public static void convertTextGraphWithLongMapGZ(String inputGraph, String outputGraph, String mapFile) throws IOException { TObjectLongHashMap map = loadTXT2LongGZMap(mapFile, false); long time = System.currentTimeMillis(); BufferedReader br = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(inputGraph)))); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(outputGraph)))); String line, newLine; long id1, id2; String[] parts; while ((line = br.readLine()) != null) { parts = line.split(SEP); id1 = map.get(parts[0]); id2 = map.get(parts[1]); if (id1 != 0 && id2 != 0) { newLine = "" + id1 + SEP + id2 + (parts.length > 2 ? (SEP + parts[2]) : ""); bw.write(newLine); bw.newLine(); } } bw.flush(); bw.close(); br.close(); logger.info(((System.currentTimeMillis() - time) / 1000d) + "s"); }
public PerformanceMonitorImpl() { _activityStack = new Stack<Activity>(); _metricData = new LinkedList<TObjectLongMap<String>>(); _runningTotals = new TObjectLongHashMap<String>(); _timerTicksPerSecond = Sys.getTimerResolution(); _currentData = new TObjectLongHashMap<String>(); _spikeData = new TObjectDoubleHashMap<String>(); _runningThreads = TCollections.synchronizedMap(new TObjectIntHashMap<String>()); _stoppedThreads = TCollections.synchronizedMap(new TObjectIntHashMap<String>()); _lastRunningThreads = new TObjectIntHashMap<String>(); _timeFactor = 1000.0 / _timerTicksPerSecond; _mainThread = Thread.currentThread(); }
/** * {@inheritDoc} * @see com.heliosapm.shorthand.datamapper.IDataMapper#prePut(long, long[]) */ @Override public void prePut(long address, long[] data) { int enumIndex = (int)HeaderOffset.EnumIndex.get(address); int bitMask = (int)HeaderOffset.BitMask.get(address); TObjectLongHashMap<T> offsets = (TObjectLongHashMap<T>) EnumCollectors.getInstance().offsets(enumIndex, bitMask); if(offsets.isEmpty()) return; ICollector<?>[] preApplies = (ICollector<?>[]) offsets.iterator().key().getPreApplies(bitMask); if(preApplies.length==0) return; for(ICollector<?> collector: preApplies) { collector.apply(address+offsets.get(collector), data); } }
public ChronicleStore() throws IOException { file = FileUtils.createTempFile(); LOGGER.info("Using " + file.getAbsolutePath()); chronicle = new IndexedChronicle(file.getAbsolutePath()); posMap = new TObjectLongHashMap<Serializable>(Constants.DEFAULT_CAPACITY, Constants.DEFAULT_LOAD_FACTOR, NO_ENTRY); posSizeMap = new TLongIntHashMap(Constants.DEFAULT_CAPACITY, Constants.DEFAULT_LOAD_FACTOR, NO_ENTRY, NO_ENTRY); freePosSizeMap = new TIntObjectHashMap<TLongList>(Constants.DEFAULT_CAPACITY, Constants.DEFAULT_LOAD_FACTOR, NO_ENTRY); freePosMaxSize = 0; appender = chronicle.createAppender(); randomAccessor = chronicle.createExcerpt(); }
public TscStreamReductor() { this(new TLongHashSet(), new TObjectLongHashMap<>()); }
public AutoDeltaStringLongMap() { this.changes = new ArrayList<>(5); this.container = new TObjectLongHashMap<>(); this.baselineCommandCount = 0; }
public AutoDeltaObjectLongMap(Function<ByteBuffer, K> keyCreator) { this.changes = new ArrayList<>(5); this.container = new TObjectLongHashMap<>(); this.baselineCommandCount = 0; this.keyCreator = keyCreator; }
@Override protected void setup(Context context) throws IOException, InterruptedException { counter = new TObjectLongHashMap<String>(); }
@NonNull TObjectLongHashMap<Duplex> getIssues();