Back to project page interdroid-swan.
The source code is released under:
Copyright (c) 2008-2011 Vrije Universiteit, The Netherlands All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the follo...
If you think the Android project interdroid-swan listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package interdroid.swan.swansong; /* w w w . ja v a2 s . c o m*/ import android.os.Bundle; public class SensorValueExpression implements ValueExpression { private String mLocation; private String mEntity; private String mValuePath; private Bundle mConfig; private HistoryReductionMode mMode; private long mHistoryLength; public SensorValueExpression(String location, String entity, String valuePath, Bundle config, HistoryReductionMode mode, long historyLength) { mLocation = location; mEntity = entity; mValuePath = valuePath; mConfig = config; if (mConfig == null) { mConfig = new Bundle(); } mMode = mode; mHistoryLength = historyLength; } @Override public HistoryReductionMode getHistoryReductionMode() { return mMode; } public long getHistoryLength() { return mHistoryLength; } @Override public String toParseString() { String result = mLocation + "@" + mEntity + ":" + mValuePath; if (mConfig != null && mConfig.size() > 0) { boolean first = true; for (String key : mConfig.keySet()) { String value = "" + mConfig.get(key); if (mConfig.get(key) instanceof String) { value = "'" + value + "'"; } result += (first ? "?" : "&") + key + "=" + value; first = false; } } result += "{" + mMode.toParseString() + "," + mHistoryLength + "}"; return result; } public String getEntity() { return mEntity; } @Override public void setInferredLocation(String location) { throw new RuntimeException( "Please don't use this method. For internal use only."); } public String getValuePath() { return mValuePath; } public String getLocation() { return mLocation; } public Bundle getConfiguration() { return mConfig; } }