/*
Converts the features in the given feature set. Adds a "!" in front of NOT features.

@param features feature set
@param normalFeature specifies the type of features -- normal feature = true,
NOT feature = false
@param list state variables
439241
private void extractFeatures(Set<EntityFeature> features, boolean normalFeature,
		List<Glyph> list)
	{
		for (EntityFeature feature : features) {
			if (feature instanceof ModificationFeature || feature instanceof FragmentFeature) {
				Glyph stvar = factory.createGlyph();
				stvar.setClazz(GlyphClazz.STATE_VARIABLE.getClazz());
				Glyph.State state = featStrGen.createStateVar(feature, factory);
				if (state != null) {
					// Add a "!" in front of NOT features
					if (!normalFeature) {
						state.setValue("!" + state.getValue());
					}
					stvar.setState(state);
					list.add(stvar);
				}
			}
		}
	}
365056
@Override
    public void setFeature(String featureId, boolean value)
            throws SAXNotRecognizedException, SAXNotSupportedException {
        boolean state;

        // Features with a defined value, we just change it if we can.
        state = getFeature(featureId);

        if (state == value) {
            return;
        }
        if (parser != null) {
            throw new SAXNotSupportedException("not while parsing");
        }

        if ((FEATURE + "namespace-prefixes").equals(featureId)) {
            // in this implementation, this only affects xmlns reporting
            xmlNames = value;
            // forcibly prevent illegal parser state
            if (!xmlNames) {
                namespaces = true;
            }
            return;
        }

        if ((FEATURE + "namespaces").equals(featureId)) {
            namespaces = value;
            // forcibly prevent illegal parser state
            if (!namespaces) {
                xmlNames = true;
            }
            return;
        }

        if ((FEATURE + "external-general-entities").equals(featureId)) {
            extGE = value;
            return;
        }
        if ((FEATURE + "external-parameter-entities").equals(featureId)) {
            extPE = value;
            return;
        }
        if ((FEATURE + "resolve-dtd-uris").equals(featureId)) {
            resolveAll = value;
            return;
        }

        if ((FEATURE + "use-entity-resolver2").equals(featureId)) {
            useResolver2 = value;
            return;
        }

        if ("http://xml.org/sax/features/unicode-normalization-checking".equals(featureId)) {
            checkNormalization = value;
            return;
        }

        throw new SAXNotRecognizedException(featureId);
    }
488787
public boolean setFeatureStyle(PolylineOptions polylineOptions, FeatureRow featureRow) {
        return StyleUtils.setFeatureStyle(polylineOptions, featureStyleExtension, featureRow, density);
    }
490129
public List<StringDoublePair> classifyValuedInstanceDistribution(List<StringDoublePair> features) {
    List<scala.Tuple2<String,Double>> nfs = new ArrayList<scala.Tuple2<String,Double>>();
    for (StringDoublePair el : features) {
      nfs.add(new scala.Tuple2<String,Double>(el.getString(), el.getDouble()));
    }
    List<scala.Tuple2<String,Double>> r = maxEnt.decodeValuedInstanceAsDistribution(nfs);
    List<StringDoublePair> res = new ArrayList<StringDoublePair>();
    for (scala.Tuple2<String,Double> el : r) {
      res.add(new StringDoublePair(el._1, el._2));
    }
    return res;
  }
74
public SyntacticCategory assignAllFeatures(String value) {
    Set<Integer> featureVars = Sets.newHashSet();
    getAllFeatureVariables(featureVars);

    Map<Integer, String> valueMap = Maps.newHashMap();
    for (Integer var : featureVars) {
      valueMap.put(var, value);
    }
    return assignFeatures(valueMap, Collections.<Integer, Integer>emptyMap());
  }
761221
public void addFeature(String feature) {
        if (feature == null) {
            throw new IllegalArgumentException("Invalid null argument passed for addFeature");
        }
        feature = feature.trim();
        if (!feature.isEmpty()) { 
            Feature newFeature = new Feature();
            newFeature.addText(feature);
            featureList.add(newFeature);
        }
    }
789782
@SuppressWarnings("static-method")
	public void getImportedFeatures(List<Class<?>> features) {
		features.add(AtomicLongCastExtensions.class);
		features.add(AtomicIntegerCastExtensions.class);
		features.add(AtomicDoubleCastExtensions.class);
		features.add(BigIntegerCastExtensions.class);
		features.add(BigDecimalCastExtensions.class);
		features.add(NumberCastExtensions.class);
		features.add(PrimitiveByteCastExtensions.class);
		features.add(PrimitiveDoubleCastExtensions.class);
		features.add(PrimitiveFloatCastExtensions.class);
		features.add(PrimitiveIntCastExtensions.class);
		features.add(PrimitiveLongCastExtensions.class);
		features.add(PrimitiveShortCastExtensions.class);
	}
1092279
public void updateFeatures() {
	for (int i = 0; i < feaGen.features.size(); i++) {
	    Feature f = (Feature)feaGen.features.get(i);
	    f.wgt = lambda[f.idx];    
	}
    }
1317319
public static FeatureCollection fromFeature(@NonNull Feature feature) {
    List<Feature> featureList = Arrays.asList(feature);
    return new FeatureCollection(TYPE, null, featureList);
  }
142300
public JSONReader withFeatures(int features)
    {
        if (_features == features) {
            return this;
        }
        return _with(features, _readerLocator, _treeCodec, _collectionBuilder, _mapBuilder);
    }
380681
public void addFeatures(Map<VectorLayer, List<Feature>> featureMap, Criterion criterion) {
		if (showDetailsOnSingleResult && featureMap.size() == 1) {
			// sorting is never needed if only 1 entry
			List<Feature> features = featureMap.values().iterator().next();
			if (features.size() == 1) {
				showFeatureDetailWindow(map, features.get(0));
			}
		}

		//Add feature tabs in map order
		for (VectorLayer layer : map.getMapModel().getVectorLayers()) {
			if (featureMap.containsKey(layer)) {
				addFeatures(layer, featureMap.get(layer), criterion);
			}
		}
		tabset.selectTab(0);
	}
875090
private static void genericizeftStyles( List<FeatureTypeStyle> ftStyles ) {
        for( FeatureTypeStyle featureTypeStyle : ftStyles ) {
            featureTypeStyle.featureTypeNames().clear();
            featureTypeStyle.featureTypeNames().add(new NameImpl(GENERIC_FEATURE_TYPENAME));
        }
    }
602111
@Api
	public void zoomToFeatures(List<Feature> features) {
		// calculate the point scale as the minimum point scale for all layers (only relevant for zooming to multiple
		// points at the exact same location)
		double zoomToPointScale = getMapInfo().getScaleConfiguration().getMaximumScale().getPixelPerUnit();
		for (Feature feature : features) {
			double scale = feature.getLayer().getLayerInfo().getZoomToPointScale().getPixelPerUnit();
			zoomToPointScale = Math.min(zoomToPointScale,  scale);
		}
		ZoomToFeaturesLazyLoadCallback callback = new ZoomToFeaturesLazyLoadCallback(features.size(), 
				zoomToPointScale);
		for (Feature feature : features) {
			// no need to fetch if we already have the geometry !
			if (feature.isGeometryLoaded()) {
				callback.execute(Arrays.asList(feature));
			} else {
				feature.getLayer().getFeatureStore()
						.getFeature(feature.getId(), GeomajasConstant.FEATURE_INCLUDE_GEOMETRY, callback);			
			}
		}
	}
1255040
public FeatureSet with(Feature feature) {
    if (features.contains(feature)) {
      return this;
    }
    return new FeatureSet(add(features, feature));
  }
851697
function(feature) {
        var style = this.defaultsPerSymbolizer ? {} : this.createLiterals(
            OpenLayers.Util.extend({}, this.defaultStyle), feature);
        
        var rules = this.rules;

        var rule, context;
        var elseRules = [];
        var appliedRules = false;
        for(var i=0, len=rules.length; i<len; i++) {
            rule = rules[i];
            // does the rule apply?
            var applies = rule.evaluate(feature);
            
            if(applies) {
                if(rule instanceof OpenLayers.Rule && rule.elseFilter) {
                    elseRules.push(rule);
                } else {
                    appliedRules = true;
                    this.applySymbolizer(rule, style, feature);
                }
            }
        }
        
        // if no other rules apply, apply the rules with else filters
        if(appliedRules == false && elseRules.length > 0) {
            appliedRules = true;
            for(var i=0, len=elseRules.length; i<len; i++) {
                this.applySymbolizer(elseRules[i], style, feature);
            }
        }

        // don't display if there were rules but none applied
        if(rules.length > 0 && appliedRules == false) {
            style.display = "none";
        }
        
        if (style.label != null && typeof style.label !== "string") {
            style.label = String(style.label);
        }
        
        return style;
    }
1236479
@Override
    protected EnumSet<C.Feature> initFeatures() {
        EnumSet<C.Feature> fs = (data instanceof C.List) ?
                ((C.List<T>)data).features()
                : EnumSet.of(C.Feature.LIMITED, C.Feature.ORDERED);
        if (data instanceof RandomAccess) {
            fs.add(C.Feature.RANDOM_ACCESS);
        }
        return fs;
    }
491841
public boolean setFeatureStyle(PolylineOptions polylineOptions, FeatureStyle featureStyle) {
        return StyleUtils.setFeatureStyle(polylineOptions, featureStyle, density);
    }