var array:Array = new Array();
array.push("val 1", "val 2");
array[array.length] = "val 3";
array.unshift("z");
trace(array.shift());
trace(array.pop());
for (var i:int = 0; i < array.length; i++) {
trace(array[i]);
}
trace(ArrayUtilities.findMatchIndices(array, "val"));
array.splice(0, 2);
array.splice(1, 0, "r", "s", "t");
var list:String = "Peter Piper picked a peck of pickled peppers";
var words:Array = list.split(" ");
trace(words.join("|"));
var newWords:Array = words.concat();
var newWords2:Array = words.slice(0);
var newWords3:Array = ArrayUtilities.duplicate(words, true);
words.sort();
words.sort(Array.DESCENDING);
words.sort(Array.CASEINSENSITIVE);
var scores:Array = [10, 2, 2, 1, 1, 14, 5, 8, 20, 19, 6];
scores.sort(Array.NUMERIC);
var sortedScores:Object = scores.sort(Array.UNIQUESORT);
trace(sortedScores);
trace(scores);
var words:Array = ["tricycle", "relative", "aardvark", "jargon"];
var indices:Array = words.sort(Array.RETURNINDEXEDARRAY);
trace(words);
trace(indices);
for(var i:int = 0; i < words.length; i++) {
trace(words[indices[i]]);
}
words.sort(Array.CASEINSENSITIVE | Array.DESCENDING);
words.reverse();
var cars:Array = new Array( );
cars.push({make: "Honda", year: 1997, color: "maroon"});
cars.push({make: "Chrysler", year: 2000, color: "beige"});
cars.push({make: "Mercedes", year: 1985, color: "blue"});
cars.push({make: "Fiat", year: 1983, color: "gray"});
cars.push({make: "Honda", year: 1992, color: "silver"});
cars.push({make: "Chrysler", year: 1968, color: "gold"});
cars.push({make: "Mercedes", year: 1975, color: "green"});
cars.push({make: "Fiat", year: 1983, color: "black"});
cars.push({make: "Honda", year: 2001, color: "blue"});
cars.push({make: "Chrysler", year: 2004, color: "orange"});
cars.push({make: "Mercedes", year: 2000, color: "white"});
cars.push({make: "Fiat", year: 1975, color: "yellow"});
cars.sortOn(["year", "make"]);
cars.sortOn("year", Array.DESCENDING);
var bands:Array = ["The Clash",
"The Who",
"Led Zeppelin",
"The Beatles",
"Aerosmith",
"Cream"];
function bandNameSort(band1:String, band2:String):int
{
band1 = band1.toLowerCase();
band2 = band2.toLowerCase();
if(band1.substr(0,4) == "the ") {
band1 = band1.substr(4);
}
if(band2.substr(0,4) == "the ") {
band2 = band2.substr(4);
}
if(band1 < band2) {
return -1;
}
else {
return 1;
}
}
bands.sort(bandNameSort);
var numbers:Array = new Array();
for(var i:int=0;i<20;i++) {
numbers[i] = i;
}
function randomSort(elementA:Object, elementB:Object):Number {
return Math.random() - .5
}
numbers.sort(randomSort);
var scores:Array = [10, 4, 15, 8];
scores.sort(Array.NUMERIC);
trace("Minimum: " + scores[0]);
trace("Maximum: " + scores[scores.length - 1]);
var letters:Array = ["a", "b", "c", "d"];
var lettersPointer:Array = letters;
trace(letters == lettersPointer); // Display: true
var letters1:Array = ["a", "b", "c", "d"];
var letters2:Array = ["a", "b", "c", "d"];
trace(letters1 == letters2); // Display: false
var equivalent:Boolean = true;
for(var i:int = 0; i < letters1.length; i++) {
if(letters1[i] != letters2[i]) {
equivalent = false;
break;
}
}
trace(equivalent); // Display: true
trace(ArrayUtilities.equals(letter1, letters2)); // Display: true
var letters1:Array = ["a", "b", "c", "d"];
var letters2:Array = ["b", "a", "d", "c"];
trace(ArrayUtilities.equals(letters1, letters2));
// Displays: false
trace(ArrayUtilities.equals(letters1, letters2, true));
// Displays: true
public static function equals(arrayA:Array,
arrayB:Array,
bNotOrdered:Boolean):Boolean {
// If the two arrays don't have the same number of elements,
// they obviously are not equivalent.
if(arrayA.length != arrayB.length) {
return false;
}
// Create a copy of each so that anything done to the copies
// doesn't affect the originals.
var arrayACopy:Array = arrayA.concat( );
var arrayBCopy:Array = arrayB.concat( );
// If the order of the elements of the two arrays doesn't
// matter, sort the two copies so the order of the copies
// matches when comparing.
if(bNotOrdered) {
arrayACopy.sort( );
arrayBCopy.sort( );
}
// Loop through each element of the arrays, and compare them.
// If they don't match, delete the copies and return false.
for(var i:int = 0; i < arrayACopy.length; i++) {
if(arrayACopy[i] != arrayBCopy[i]) {
delete arrayACopy;
delete arrayBCopy;
return false;
}
}
// Otherwise the arrays are equivalent.
// So delete the copies and return true.
delete arrayACopy;
delete arrayBCopy;
return true;
}
var members:Object = {a: "A", b: "B", c: "C"};
var members:Object = {};
members.a = "A";
members.b = "B";
members.c = "C";
trace(members.a);
trace(members["a"]);
var members:Object = new Object();
members.a = "A";
members.b = "B";
members.c = "C";
for (var m:String in members) {
trace(members[m]);
}
分享到:
相关推荐
webots月球车仿真
内容概要:本文提供了关于2025年美国大学生数学建模竞赛的重要时间点安排以及竞赛的具体细节介绍。文中明确了从报名到最终结果发布的所有时间节点,详细列出了两种不同类型的竞赛题目特点,即传统的连续性和离散性问题和涉及数据科学技术的题目的特点。同时规定了参赛队伍构成形式、论文要求及评审标准,并提及了对工具使用的具体限制条件以及对于学术诚信的要求——强调独立解决问题的重要性。此外还简述了此次赛事所提供的多个层次获奖可能性的情况介绍。 适用人群:对数学应用有兴趣的大四本科生或者研究生;准备参加2025年度数学建模国际大赛的学生。 使用场景及目标:帮助想要参赛的同学提前规划自己的备考周期,在有限的时间内最大化提升自身的竞争力;确保选手了解完整的参赛规则避免不必要的失误导致成绩受损。 其他说明:该竞赛是一项非常具有挑战性的活动,它不仅考验了参赛者的专业知识水平,还需要他们展示出色的跨学科合作能力。因此参与者应该尽早开始准备,充分考虑各个方面的因素,如组建团队、收集资料和练习旧试题等。
2025年最新康复医学概论考试题库与答案.docx
Move Class.html
C标准库源码
2025检验类之临床医学检验技术(士)真题库附答案.pptx
C标准库源码
C标准库源码
Selva Assignment Class tank problem.pptx
C标准库源码
基于二维四值元胞自动机和混沌系统的图像加密算法.pdf
CST闪电间接效应研究.pdf
### 智慧人防解决方案:科技赋能,守护安全 智慧人防解决方案通过整合军队、政府和社会资源,构建了一个集预警报知、指挥控制、防护救援、综合保障于一体的智能化系统。该方案依托物联网、大数据、GIS与BIM等技术,实现了对人防工程、战备物资、设备设施的全面监控与管理。通过智能监测、可视化展示、远程维护等功能,智慧人防不仅提升了人防设施的运行效率,还确保了设备的安全性和可靠性。例如,系统能够实时监测人防工程的给排水、通风、消防等设施,精准定位异常情况,确保设备始终处于最佳状态。这种“智慧化”的管理模式,不仅提高了人防系统的应急响应能力,还为战时和日常的防护救援提供了强有力的技术支撑。 ### 人防宣传教育与应急指挥:沉浸式体验与高效调度 智慧人防解决方案在人防宣传教育方面,突破了传统的展板宣传模式,引入了VR交互、移动App、微信公众号等现代化手段,打造了沉浸式的防空防灾体验平台。通过模拟空袭疏散、核武器袭击、火灾逃生等场景,市民可以在虚拟环境中学习和掌握应急技能,提升自我保护意识。此外,智慧人防还构建了应急指挥调度系统,实现了从预防、启动、处置到分析的全流程管理。系统通过视频监控、广播系统、手持终端等设备,快速获取现场信息,实时上报并指挥调度,确保突发事件能够迅速得到有效处置。这种“一键式”警报推送和逃生指示功能,不仅提高了应急响应的效率,还增强了公众的安全感。 ### 信用体系与协同监管:构建透明、高效的人防生态 智慧人防解决方案还引入了人防行业信用体系,通过公示系统、协同监管平台等工具,实现了对企业、个人和培训机构的全方位信用管理。系统支持企业信息查询、信用修复、联合惩戒等功能,确保人防行业的透明度和规范性。例如,企业可以通过平台公示年报和即时信息,公众可以查询企业的信用记录,政府部门则可以通过协同监管平台进行实时监控和数据分析。这种信用体系的建立,不仅提升了人防行业的整体管理水平,还为社会公众提供了更加安全、可靠的服务保障。通过科技手段与信用管理的结合,智慧人防解决方案为构建高效、透明的人防生态奠定了坚实基础。
【技术分享】Python中URL处理的常见问题及解决方案,值得收藏!.docx
C标准库源码
C标准库源码
康复医学考试题及答案.docx
Python完整程序-Pandas提取指定数据并保存在原Excel工作簿中,含有完整的源码
IndoorLocation-master
基于APF的空管安全绩效评估模型.pdf