首页 > 文档 > FloatDict浮点型字典类
2017
07-17

FloatDict浮点型字典类

Name FloatDict浮点型字典类
Examples FloatDict inventory;

void setup() {

size(200, 200);

inventory = new FloatDict();

inventory.set(“coffee”,108.6);

inventory.set(“flour”,5.8);

inventory.set(“tea”,8.2);

println(inventory);

noLoop();

fill(0);

textAlign(CENTER);

}

void draw() {

float weight = inventory.get(“coffee”);

text(weight, width/2, height/2);

}


Description

描述

A simple class to use a String as a lookup for an float value. String “keys” are associated with floating-point values.

使用字符串作为浮点值查找的简单类。字符串 floating-point 值关联。

Methods
size() Returns the number of key/value pairs
返回键/值对的个数
clear() Remove all entries删除所有条目
keyArray() Return a copy of the internal keys array返回内部键数组的副本
values() Return the internal array being used to store the values返回用于存储值的内部数组
valueArray() Create a new array and copy each of the values into it创建一个新数组并将每个值复制到其中
get() Return a value for the specified key返回指定键的值
set() Create a new key/value pair or change the value of one创建新的键/值对或更改一个值
hasKey() Check if a key is a part of the data structure检查键是否为数据结构的一部分
add() Add to a value添加到值
sub() Subtract from a value从值中减去
mult() Multiply a value将值相乘
div() Divide a value划分值
remove() Remove a key/value pair删除键/值对
sortKeys() Sort the keys alphabetically按字母顺序对键排序
sortKeysReverse() Sort the keys alphabetically in reverse按字母顺序对键进行反向排序
sortValues() Sort by values in ascending order按值按升序排列
sortValuesReverse() Sort by values in descending order按值降序排列
Constructor

语法

FloatDict()

FloatDict(pairs)

Related

相关

IntDict
StringDict

Updated on April 30, 2017 02:33:19pm EDT

Processing is an open proje



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。