/** * @param padding end offset that will be set after drawing current text fragment * @param align alignment of the current text fragment, if it is SwingConstants.RIGHT * or SwingConstants.TRAILING then the text fragment will be aligned to the right at * the padding, otherwise it will be aligned to the left */ public synchronized void appendTextPadding(int padding, @JdkConstants.HorizontalAlignment int align) { final int alignIndex = myFragments.size() - 1; myFragmentPadding.put(alignIndex, padding); myFragmentAlignment.put(alignIndex, align); }
public int put (int featureIndex, int value) { if (featureIndex < 0 || featureIndex > alphabet.size()) throw new IllegalArgumentException ("featureIndex "+featureIndex+" out of range"); return featureCounts.put (featureIndex, value); }
@Override public void addConstraint(int fi, double[][] target, double weight) { constraintsList.add(new TwoLabelKLGEConstraint(target,weight)); constraintsMap.put(fi, constraintsList.size()-1); }
@Override public void addConstraint(int fi, double[][] target, double weight) { constraintsList.add(new TwoLabelL2GEConstraint(target,weight)); constraintsMap.put(fi, constraintsList.size()-1); }
public int put (int featureIndex, int value) { if (featureIndex < 0 || featureIndex > alphabet.size()) throw new IllegalArgumentException ("featureIndex "+featureIndex+" out of range"); return featureCounts.put (featureIndex, value); }
@Override public void addConstraint(int fi, double[][] target, double weight) { constraintsList.add(new TwoLabelKLGEConstraint(target,weight)); constraintsMap.put(fi, constraintsList.size()-1); }
public void ours() { TIntIntHashMap ours = new TIntIntHashMap(SET_SIZE); for (int i = dataset.size(); i-- > 0;) { ours.put(i,i); } }
@Override public void addConstraint(int fi, double[][] target, double weight) { constraintsList.add(new TwoLabelL2GEConstraint(target,weight)); constraintsMap.put(fi, constraintsList.size()-1); }
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); int size = stream.readInt(); setUp(size); while (size-- > 0) { int key = stream.readInt(); int val = stream.readInt(); put(key, val); } }
@Override public void addConstraint(int fi, double[][] target, double weight) { constraintsList.add(new TwoLabelL2GEConstraint(target,weight)); constraintsMap.put(fi, constraintsList.size()-1); }
private void setIndex2Location () { //System.out.println ("HashedSparseVector setIndex2Location indices.length="+indices.length+" maxindex="+indices[indices.length-1]); assert (index2location == null); assert (indices.length > 0); this.maxIndex = indices[indices.length - 1]; this.index2location = new TIntIntHashMap (numLocations ()); //index2location.setDefaultValue (-1); for (int i = 0; i < indices.length; i++) index2location.put (indices[i], i); }
private void cacheVariable (Variable var) { numNodes++; updateFactorCaches (); int gvi = var.getIndex (); int myvi = numNodes - 1; projectionMap.put (gvi, myvi); my2global[myvi] = gvi; }
private void setIndex2Location () { //System.out.println ("HashedSparseVector setIndex2Location indices.length="+indices.length+" maxindex="+indices[indices.length-1]); assert (index2location == null); assert (indices.length > 0); this.maxIndex = indices[indices.length - 1]; this.index2location = new TIntIntHashMap (numLocations ()); //index2location.setDefaultValue (-1); for (int i = 0; i < indices.length; i++) index2location.put (indices[i], i); }
private void cacheVariable (Variable var) { numNodes++; updateFactorCaches (); int gvi = var.getIndex (); int myvi = numNodes - 1; projectionMap.put (gvi, myvi); my2global[myvi] = gvi; }
@Override public void addConstraint(int fi, double[] ex, double weight) { constraints.put(fi,new MaxEntL2FLPRConstraint(ex,weight)); constraintIndices.put(fi, constraintIndices.size()); }
@Override public void addConstraint(int fi, double[] ex, double weight) { constraints.put(fi,new MaxEntL2FLPRConstraint(ex,weight)); constraintIndices.put(fi, constraintIndices.size()); }
private void setIndex2Location () { //System.out.println ("HashedSparseVector setIndex2Location indices.length="+indices.length+" maxindex="+indices[indices.length-1]); assert (index2location == null); assert (indices.length > 0); this.maxIndex = indices[indices.length - 1]; this.index2location = new TIntIntHashMap (numLocations ()); index2location.setDefaultValue (-1); for (int i = 0; i < indices.length; i++) index2location.put (indices[i], i); }
/** * Inserts a key/value pair into the map. * * @param key an <code>Object</code> value * @param value an <code>Object</code> value * @return the previous value associated with <tt>key</tt>, * or Integer(0) if none was found. */ public Object put(Object key, Object value) { return wrapValue(_map.put(unwrapKey(key), unwrapValue(value))); }
@Override public void addConstraint(int fi, double[] ex, double weight) { constraints.put(fi,new MaxEntL2FLPRConstraint(ex,weight)); constraintIndices.put(fi, constraintIndices.size()); }
public void addConstraint(int fi, double[] target, double weight) { constraints.put(fi,new OneLabelPRConstraint(target,weight)); constraintIndices.put(fi, constraintIndices.size()); }