本文整理汇总了Java中com.google.gwt.core.client.JsArrayNumber.length方法的典型用法代码示例。如果您正苦于以下问题:Java JsArrayNumber.length方法的具体用法?Java JsArrayNumber.length怎么用?Java JsArrayNumber.length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.core.client.JsArrayNumber
的用法示例。
在下文中一共展示了JsArrayNumber.length方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setIncrementalData
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
void setIncrementalData(JsArrayNumber domain, JsArray<JsArrayNumber> rangeArray) {
int len = domain.length(); // using this length for both
double d[] = new double[len];
for(int i=0; i<d.length; i++) {
d[i] = domain.get(i);
}
int rangeArrayLength = rangeArray.length();
Array1D[] ranges = new Array1DImpl[rangeArray.length()];
for (int dimension = 0; dimension < rangeArrayLength; dimension++) {
double[] r = new double[len];
for(int j=0; j < r.length; j++) {
r[j] = rangeArray.get(dimension).get(j);
}
ranges[dimension] = new Array1DImpl(r);
}
incremental = new MipMap(new Array1DImpl(d), ranges, -1, getMipMapChain().getMipMap(0));
Interval region = new Interval(d[0], d[d.length - 1]);
incrementalInterval = region;
outgoingRequest = System.currentTimeMillis();
firing = true;
datasets.fireChanged(this, region);
firing = false;
}
示例2: compareJsArrayNumber
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
public String compareJsArrayNumber(JsArrayNumber objectA,JsArrayNumber objectB){
if(objectA==null){
if(objectB==null){
return "";//no need check
}else{
return "A is null,B's length is "+objectB.length();
}
}
if(objectB==null){
return "A is"+objectA.length()+",but B is Empty";
}
if(objectA.length()!=objectB.length()){
return "A's length"+objectA.length()+",B's length is "+objectB.length();
}
for(int i=0;i<objectA.length();i++){
if(objectA.get(i)!=objectB.get(i)){
return "difference value at:"+i;
}
}
return "";
}
示例3: flipV
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
public void flipV(JSONModelFile model){
JsArray<JsArrayNumber> uvs= model.getUvs();
if(uvs==null){
return;
}
for(int i=0;i<uvs.length();i++){
JsArrayNumber array=uvs.get(i);
for(int j=0;j<array.length();j++){
if(j%2==1){//v only
double old=array.get(j);
array.set(j, 1-old);
}
}
}
}
示例4: doDeserializeArray
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public double[] doDeserializeArray( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params ) {
JsArrayNumber jsArray = JsArrayNumber.createArray().cast();
reader.beginArray();
while ( JsonToken.END_ARRAY != reader.peek() ) {
if ( JsonToken.NULL == reader.peek() ) {
reader.skipValue();
jsArray.push( DEFAULT );
} else {
jsArray.push( reader.nextDouble() );
}
}
reader.endArray();
if ( GWT.isScript() ) {
return reinterpretCast( jsArray );
} else {
int length = jsArray.length();
double[] ret = new double[length];
for ( int i = 0; i < length; i++ ) {
ret[i] = jsArray.get( i );
}
return ret;
}
}
示例5: getNumberArrayAttribute
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
private List<Double> getNumberArrayAttribute(SliderOption option, List<Double> defaultValue) {
// Get array attribute
JsArrayNumber array = null;
if (isAttached()) {
array = getNumberArrayAttribute(getElement(), option.getName());
} else {
String value = attributeMixin.getAttribute(option.getDataAttribute());
if (value != null && !value.isEmpty()) {
array = JsonUtils.safeEval(value);
}
}
// Attribute not set
if (array == null) {
return defaultValue;
}
// Put array to list
List<Double> list = new ArrayList<Double>(array.length());
for (int i = 0; i < array.length(); i++) {
list.add(array.get(i));
}
return list;
}
示例6: toList
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
public static List<Double> toList(JsArrayNumber array) {
List<Double> list = new ArrayList<>();
if(array != null) {
for (int i = 0; i < array.length(); i++) {
list.add(array.get(i));
}
}
return list;
}
示例7: checkForDoubleAryResult
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
private static void checkForDoubleAryResult(String key, WebPlotResult wpRes,PlotResultOverlay res) {
JsArrayNumber jsAry= res.getDoubleArrayResult(key);
if (jsAry!=null) {
double ary[]= new double[jsAry.length()];
for(int i= 0; (i<ary.length); i++) ary[i]= jsAry.get(i);
wpRes.putResult(key,new DataEntry.DoubleArray(ary));
}
}
示例8: toArray
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
public static double[] toArray(JsArrayNumber values) {
if (GWT.isScript()) {
return reinterpretCast(values);
} else {
int length = values.length();
double[] ret = new double[length];
for (int i = 0, l = length; i < l; i++) {
ret[i] = values.get(i);
}
return ret;
}
}
示例9: calculateMovingAverage
import com.google.gwt.core.client.JsArrayNumber; //导入方法依赖的package包/类
/**
* Implementation of SWFUpload Speed plug-in's moving average calculation based on the
* set of data points available ported directly from the original 2.9 implementation.
*
* @param history An array of values calculated so far
* @return The moving average
*/
private static double calculateMovingAverage(JsArrayNumber history) {
double[] vals = new double[history.length()];
long size = history.length();
double sum = 0.0;
double mSum = 0.0;
long mCount = 0;
// Check for sufficient data
if (size >= 8) {
// Clone the array and Calculate sum of the values
for (int i = 0; i < size; i++) {
vals[i] = history.get(i);
sum += vals[i];
}
double mean = sum / size;
// Calculate variance for the set
double varianceTemp = 0.0;
for (int i = 0; i < size; i++) {
varianceTemp += Math.pow(vals[i] - mean, 2);
}
double variance = varianceTemp / size;
double standardDev = Math.sqrt(variance);
// Standardize the Data
for (int i = 0; i < size; i++) {
vals[i] = (vals[i] - mean) / standardDev;
}
// Calculate the average excluding outliers
double deviationRange = 2.0;
for (int i = 0; i < size; i++) {
if (vals[i] <= deviationRange && vals[i] >= -deviationRange) {
mCount++;
mSum += history.get(i);
}
}
} else {
// Calculate the average (not enough data points to remove outliers)
mCount = size;
for (int i = 0; i < size; i++) {
mSum += history.get(i);
}
}
return mSum / mCount;
}