- 浏览: 304661 次
- 性别:
- 来自: 江阴
文章分类
最新评论
原来每次运行ant,最后一行都会提示Total Time:
所以觉得好奇,看看他是怎么计算的,其实跟我们平时计算的没有什么差别,
只是他用到了一些显示的处理,以下来源 ant 的源代码:
\main\org\apache\tools\ant\DefaultLogger.java
另外一个工具类的文件如下:
\main\org\apache\tools\ant\util\DateUtils.java
我根据这两个类,修改为我自己的程序执行时间显示为:
所以觉得好奇,看看他是怎么计算的,其实跟我们平时计算的没有什么差别,
只是他用到了一些显示的处理,以下来源 ant 的源代码:
\main\org\apache\tools\ant\DefaultLogger.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.apache.tools.ant; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintStream; import java.io.StringReader; import java.util.Date; import java.text.DateFormat; import org.apache.tools.ant.util.DateUtils; import org.apache.tools.ant.util.StringUtils; import org.apache.tools.ant.util.FileUtils; /** * Writes build events to a PrintStream. Currently, it * only writes which targets are being executed, and * any messages that get logged. * */ public class DefaultLogger implements BuildLogger { /** * Size of left-hand column for right-justified task name. * @see #messageLogged(BuildEvent) */ public static final int LEFT_COLUMN_SIZE = 12; // CheckStyle:VisibilityModifier OFF - bc /** PrintStream to write non-error messages to */ protected PrintStream out; /** PrintStream to write error messages to */ protected PrintStream err; /** Lowest level of message to write out */ protected int msgOutputLevel = Project.MSG_ERR; /** Time of the start of the build */ private long startTime = System.currentTimeMillis(); // CheckStyle:ConstantNameCheck OFF - bc /** Line separator */ protected static final String lSep = StringUtils.LINE_SEP; // CheckStyle:ConstantNameCheck ON /** Whether or not to use emacs-style output */ protected boolean emacsMode = false; // CheckStyle:VisibilityModifier ON /** * Sole constructor. */ public DefaultLogger() { } /** * Sets the highest level of message this logger should respond to. * * Only messages with a message level lower than or equal to the * given level should be written to the log. * <p> * Constants for the message levels are in the * {@link Project Project} class. The order of the levels, from least * to most verbose, is <code>MSG_ERR</code>, <code>MSG_WARN</code>, * <code>MSG_INFO</code>, <code>MSG_VERBOSE</code>, * <code>MSG_DEBUG</code>. * <p> * The default message level for DefaultLogger is Project.MSG_ERR. * * @param level the logging level for the logger. */ public void setMessageOutputLevel(int level) { this.msgOutputLevel = level; } /** * Sets the output stream to which this logger is to send its output. * * @param output The output stream for the logger. * Must not be <code>null</code>. */ public void setOutputPrintStream(PrintStream output) { this.out = new PrintStream(output, true); } /** * Sets the output stream to which this logger is to send error messages. * * @param err The error stream for the logger. * Must not be <code>null</code>. */ public void setErrorPrintStream(PrintStream err) { this.err = new PrintStream(err, true); } /** * Sets this logger to produce emacs (and other editor) friendly output. * * @param emacsMode <code>true</code> if output is to be unadorned so that * emacs and other editors can parse files names, etc. */ public void setEmacsMode(boolean emacsMode) { this.emacsMode = emacsMode; } /** * Responds to a build being started by just remembering the current time. * * @param event Ignored. */ public void buildStarted(BuildEvent event) { startTime = System.currentTimeMillis(); } static void throwableMessage(StringBuffer m, Throwable error, boolean verbose) { while (error instanceof BuildException) { // #43398 Throwable cause = error.getCause(); if (cause == null) { break; } String msg1 = error.toString(); String msg2 = cause.toString(); if (msg1.endsWith(msg2)) { m.append(msg1.substring(0, msg1.length() - msg2.length())); error = cause; } else { break; } } if (verbose || !(error instanceof BuildException)) { m.append(StringUtils.getStackTrace(error)); } else { m.append(error).append(lSep); } } /** * Prints whether the build succeeded or failed, * any errors the occurred during the build, and * how long the build took. * * @param event An event with any relevant extra information. * Must not be <code>null</code>. */ public void buildFinished(BuildEvent event) { Throwable error = event.getException(); StringBuffer message = new StringBuffer(); if (error == null) { message.append(StringUtils.LINE_SEP); message.append(getBuildSuccessfulMessage()); } else { message.append(StringUtils.LINE_SEP); message.append(getBuildFailedMessage()); message.append(StringUtils.LINE_SEP); throwableMessage(message, error, Project.MSG_VERBOSE <= msgOutputLevel); } message.append(StringUtils.LINE_SEP); message.append("Total time: "); message.append(formatTime(System.currentTimeMillis() - startTime)); String msg = message.toString(); if (error == null) { printMessage(msg, out, Project.MSG_VERBOSE); } else { printMessage(msg, err, Project.MSG_ERR); } log(msg); } /** * This is an override point: the message that indicates whether a build failed. * Subclasses can change/enhance the message. * @return The classic "BUILD FAILED" */ protected String getBuildFailedMessage() { return "BUILD FAILED"; } /** * This is an override point: the message that indicates that a build succeeded. * Subclasses can change/enhance the message. * @return The classic "BUILD SUCCESSFUL" */ protected String getBuildSuccessfulMessage() { return "BUILD SUCCESSFUL"; } /** * Logs a message to say that the target has started if this * logger allows information-level messages. * * @param event An event with any relevant extra information. * Must not be <code>null</code>. */ public void targetStarted(BuildEvent event) { if (Project.MSG_INFO <= msgOutputLevel && !event.getTarget().getName().equals("")) { String msg = StringUtils.LINE_SEP + event.getTarget().getName() + ":"; printMessage(msg, out, event.getPriority()); log(msg); } } /** * No-op implementation. * * @param event Ignored. */ public void targetFinished(BuildEvent event) { } /** * No-op implementation. * * @param event Ignored. */ public void taskStarted(BuildEvent event) { } /** * No-op implementation. * * @param event Ignored. */ public void taskFinished(BuildEvent event) { } /** * Logs a message, if the priority is suitable. * In non-emacs mode, task level messages are prefixed by the * task name which is right-justified. * * @param event A BuildEvent containing message information. * Must not be <code>null</code>. */ public void messageLogged(BuildEvent event) { int priority = event.getPriority(); // Filter out messages based on priority if (priority <= msgOutputLevel) { StringBuffer message = new StringBuffer(); if (event.getTask() != null && !emacsMode) { // Print out the name of the task if we're in one String name = event.getTask().getTaskName(); String label = "[" + name + "] "; int size = LEFT_COLUMN_SIZE - label.length(); StringBuffer tmp = new StringBuffer(); for (int i = 0; i < size; i++) { tmp.append(" "); } tmp.append(label); label = tmp.toString(); BufferedReader r = null; try { r = new BufferedReader( new StringReader(event.getMessage())); String line = r.readLine(); boolean first = true; do { if (first) { if (line == null) { message.append(label); break; } } else { message.append(StringUtils.LINE_SEP); } first = false; message.append(label).append(line); line = r.readLine(); } while (line != null); } catch (IOException e) { // shouldn't be possible message.append(label).append(event.getMessage()); } finally { if (r != null) { FileUtils.close(r); } } } else { //emacs mode or there is no task message.append(event.getMessage()); } Throwable ex = event.getException(); if (Project.MSG_DEBUG <= msgOutputLevel && ex != null) { message.append(StringUtils.getStackTrace(ex)); } String msg = message.toString(); if (priority != Project.MSG_ERR) { printMessage(msg, out, priority); } else { printMessage(msg, err, priority); } log(msg); } } /** * Convenience method to format a specified length of time. * * @param millis Length of time to format, in milliseconds. * * @return the time as a formatted string. * * @see DateUtils#formatElapsedTime(long) */ protected static String formatTime(final long millis) { return DateUtils.formatElapsedTime(millis); } /** * Prints a message to a PrintStream. * * @param message The message to print. * Should not be <code>null</code>. * @param stream A PrintStream to print the message to. * Must not be <code>null</code>. * @param priority The priority of the message. * (Ignored in this implementation.) */ protected void printMessage(final String message, final PrintStream stream, final int priority) { stream.println(message); } /** * Empty implementation which allows subclasses to receive the * same output that is generated here. * * @param message Message being logged. Should not be <code>null</code>. */ protected void log(String message) { } /** * Get the current time. * @return the current time as a formatted string. * @since Ant1.7.1 */ protected String getTimestamp() { Date date = new Date(System.currentTimeMillis()); DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); String finishTime = formatter.format(date); return finishTime; } /** * Get the project name or null * @param event the event * @return the project that raised this event * @since Ant1.7.1 */ protected String extractProjectName(BuildEvent event) { Project project = event.getProject(); return (project != null) ? project.getName() : null; } }
另外一个工具类的文件如下:
\main\org\apache\tools\ant\util\DateUtils.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.apache.tools.ant.util; import java.text.ChoiceFormat; import java.text.DateFormat; import java.text.MessageFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.TimeZone; /** * Helper methods to deal with date/time formatting with a specific * defined format (<a href="http://www.w3.org/TR/NOTE-datetime">ISO8601</a>) * or a plurialization correct elapsed time in minutes and seconds. * * @since Ant 1.5 * */ public final class DateUtils { private static final int ONE_SECOND = 1000; private static final int ONE_MINUTE = 60; private static final int ONE_HOUR = 60; private static final int TEN = 10; /** * ISO8601-like pattern for date-time. It does not support timezone. * <tt>yyyy-MM-ddTHH:mm:ss</tt> */ public static final String ISO8601_DATETIME_PATTERN = "yyyy-MM-dd'T'HH:mm:ss"; /** * ISO8601-like pattern for date. <tt>yyyy-MM-dd</tt> */ public static final String ISO8601_DATE_PATTERN = "yyyy-MM-dd"; /** * ISO8601-like pattern for time. <tt>HH:mm:ss</tt> */ public static final String ISO8601_TIME_PATTERN = "HH:mm:ss"; /** * Format used for SMTP (and probably other) Date headers. * @deprecated DateFormat is not thread safe, and we cannot guarantee that * some other code is using the format in parallel. * Deprecated since ant 1.8 */ public static final DateFormat DATE_HEADER_FORMAT = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss ", Locale.US); private static final DateFormat DATE_HEADER_FORMAT_INT = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss ", Locale.US); // code from Magesh moved from DefaultLogger and slightly modified private static final MessageFormat MINUTE_SECONDS = new MessageFormat("{0}{1}"); private static final double[] LIMITS = {0, 1, 2}; private static final String[] MINUTES_PART = {"", "1 minute ", "{0,number,###############} minutes "}; private static final String[] SECONDS_PART = {"0 seconds", "1 second", "{1,number} seconds"}; private static final ChoiceFormat MINUTES_FORMAT = new ChoiceFormat(LIMITS, MINUTES_PART); private static final ChoiceFormat SECONDS_FORMAT = new ChoiceFormat(LIMITS, SECONDS_PART); static { MINUTE_SECONDS.setFormat(0, MINUTES_FORMAT); MINUTE_SECONDS.setFormat(1, SECONDS_FORMAT); } /** private constructor */ private DateUtils() { } /** * Format a date/time into a specific pattern. * @param date the date to format expressed in milliseconds. * @param pattern the pattern to use to format the date. * @return the formatted date. */ public static String format(long date, String pattern) { return format(new Date(date), pattern); } /** * Format a date/time into a specific pattern. * @param date the date to format expressed in milliseconds. * @param pattern the pattern to use to format the date. * @return the formatted date. */ public static String format(Date date, String pattern) { DateFormat df = createDateFormat(pattern); return df.format(date); } /** * Format an elapsed time into a plurialization correct string. * It is limited only to report elapsed time in minutes and * seconds and has the following behavior. * <ul> * <li>minutes are not displayed when 0. (ie: "45 seconds")</li> * <li>seconds are always displayed in plural form (ie "0 seconds" or * "10 seconds") except for 1 (ie "1 second")</li> * </ul> * @param millis the elapsed time to report in milliseconds. * @return the formatted text in minutes/seconds. */ public static String formatElapsedTime(long millis) { long seconds = millis / ONE_SECOND; long minutes = seconds / ONE_MINUTE; Object[] args = {new Long(minutes), new Long(seconds % ONE_MINUTE)}; return MINUTE_SECONDS.format(args); } /** * return a lenient date format set to GMT time zone. * @param pattern the pattern used for date/time formatting. * @return the configured format for this pattern. */ private static DateFormat createDateFormat(String pattern) { SimpleDateFormat sdf = new SimpleDateFormat(pattern); TimeZone gmt = TimeZone.getTimeZone("GMT"); sdf.setTimeZone(gmt); sdf.setLenient(true); return sdf; } /** * Calculate the phase of the moon for a given date. * * <p>Code heavily influenced by hacklib.c in <a * href="http://www.nethack.org/">Nethack</a></p> * * <p>The Algorithm: * * <pre> * moon period = 29.53058 days ~= 30, year = 365.2422 days * * days moon phase advances on first day of year compared to preceding year * = 365.2422 - 12*29.53058 ~= 11 * * years in Metonic cycle (time until same phases fall on the same days of * the month) = 18.6 ~= 19 * * moon phase on first day of year (epact) ~= (11*(year%19) + 18) % 30 * (18 as initial condition for 1900) * * current phase in days = first day phase + days elapsed in year * * 6 moons ~= 177 days * 177 ~= 8 reported phases * 22 * + 11/22 for rounding * </pre> * * @param cal the calander. * * @return The phase of the moon as a number between 0 and 7 with * 0 meaning new moon and 4 meaning full moon. * * @since 1.2, Ant 1.5 */ public static int getPhaseOfMoon(Calendar cal) { // CheckStyle:MagicNumber OFF int dayOfTheYear = cal.get(Calendar.DAY_OF_YEAR); int yearInMetonicCycle = ((cal.get(Calendar.YEAR) - 1900) % 19) + 1; int epact = (11 * yearInMetonicCycle + 18) % 30; if ((epact == 25 && yearInMetonicCycle > 11) || epact == 24) { epact++; } return (((((dayOfTheYear + epact) * 6) + 11) % 177) / 22) & 7; // CheckStyle:MagicNumber ON } /** * Returns the current Date in a format suitable for a SMTP date * header. * @return the current date. * @since Ant 1.5.2 */ public static String getDateForHeader() { Calendar cal = Calendar.getInstance(); TimeZone tz = cal.getTimeZone(); int offset = tz.getOffset(cal.get(Calendar.ERA), cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.DAY_OF_WEEK), cal.get(Calendar.MILLISECOND)); StringBuffer tzMarker = new StringBuffer(offset < 0 ? "-" : "+"); offset = Math.abs(offset); int hours = offset / (ONE_HOUR * ONE_MINUTE * ONE_SECOND); int minutes = offset / (ONE_MINUTE * ONE_SECOND) - ONE_HOUR * hours; if (hours < TEN) { tzMarker.append("0"); } tzMarker.append(hours); if (minutes < TEN) { tzMarker.append("0"); } tzMarker.append(minutes); synchronized (DATE_HEADER_FORMAT_INT) { return DATE_HEADER_FORMAT_INT.format(cal.getTime()) + tzMarker.toString(); } } /** * Parses the string in a format suitable for a SMTP date header. * * @param datestr string to be parsed * * @return a java.util.Date object as parsed by the format. * @exception ParseException if the supplied string cannot be parsed by * this pattern. * @since Ant 1.8.0 */ public static Date parseDateFromHeader(String datestr) throws ParseException { synchronized (DATE_HEADER_FORMAT_INT) { return DATE_HEADER_FORMAT_INT.parse(datestr); } } /** * Parse a string as a datetime using the ISO8601_DATETIME format which is * <code>yyyy-MM-dd'T'HH:mm:ss</code> * * @param datestr string to be parsed * * @return a java.util.Date object as parsed by the format. * @exception ParseException if the supplied string cannot be parsed by * this pattern. * @since Ant 1.6 */ public static Date parseIso8601DateTime(String datestr) throws ParseException { return new SimpleDateFormat(ISO8601_DATETIME_PATTERN).parse(datestr); } /** * Parse a string as a date using the ISO8601_DATE format which is * <code>yyyy-MM-dd</code> * * @param datestr string to be parsed * * @return a java.util.Date object as parsed by the format. * @exception ParseException if the supplied string cannot be parsed by * this pattern. * @since Ant 1.6 */ public static Date parseIso8601Date(String datestr) throws ParseException { return new SimpleDateFormat(ISO8601_DATE_PATTERN).parse(datestr); } /** * Parse a string as a date using the either the ISO8601_DATETIME * or ISO8601_DATE formats. * * @param datestr string to be parsed * * @return a java.util.Date object as parsed by the formats. * @exception ParseException if the supplied string cannot be parsed by * either of these patterns. * @since Ant 1.6 */ public static Date parseIso8601DateTimeOrDate(String datestr) throws ParseException { try { return parseIso8601DateTime(datestr); } catch (ParseException px) { return parseIso8601Date(datestr); } } }
我根据这两个类,修改为我自己的程序执行时间显示为:
package com.xjh.util; import java.text.ChoiceFormat; import java.text.MessageFormat; public class TotalTime { private static final int ONE_SECOND = 1000; private static final int ONE_MINUTE = 60; private static final double[] LIMITS = {0, 1, 2}; private static final String[] MINUTES_PART = {"", "1 minute", "{0,number,###############} minutes"}; private static final String[] SECONDS_PART = {"0 seconds", "1 second", "{1,number} seconds"}; private static final ChoiceFormat MINUTES_FORMAT = new ChoiceFormat(LIMITS, MINUTES_PART); private static final ChoiceFormat SECONDS_FORMAT = new ChoiceFormat(LIMITS, SECONDS_PART); private static final MessageFormat MINUTE_SECONDS = new MessageFormat("{0} {1}"); static { MINUTE_SECONDS.setFormat(0, MINUTES_FORMAT); MINUTE_SECONDS.setFormat(1, SECONDS_FORMAT); } public static void main(String[] args) { long startTime = System.currentTimeMillis(); long sum = 0; for (int i = 1; i < Integer.MAX_VALUE; i++) { sum = sum + i; } System.out.println("sum is " + sum); System.out.println("Total time: " + formatTime(System.currentTimeMillis() - startTime)); // System.out.println(TotalTime.formatTime(59000)); } public static String formatTime(final long millis) { // long seconds = 0; // long minutes = 0; long seconds = millis / ONE_SECOND; // 得到秒 long minutes = seconds / ONE_MINUTE; // 得到分钟 Object[] args = {new Long(minutes), new Long(seconds % ONE_MINUTE)}; return MINUTE_SECONDS.format(args); } }
相关推荐
1. **安装**:解压Ant 1.9.5压缩包到指定目录,将`bin`目录添加到系统PATH环境变量,以便在命令行中直接运行`ant`命令。 2. **构建文件**:Ant的配置文件通常为`build.xml`,其中定义了构建任务和依赖关系。例如,...
"apache-ant-1.7.0.jar"是Ant的一个版本库,其中包含了Ant运行所需的类和资源,使得开发者能够自动化构建、编译、测试和部署Java项目。 在Android开发中,由于ZIP格式的文件在处理中文字符时可能存在编码问题,导致...
标题中的“一个使用ant及junit进行单元测试的简单例子”揭示了本主题将围绕两个核心工具——Apache Ant和JUnit,讲解如何在Java项目中进行单元测试。Apache Ant是一个广泛使用的构建工具,它允许开发者通过XML配置...
在提供的压缩包文件中,"ANT Setup.exe"很可能是ANT工具的安装程序,用户可以通过运行它来安装和使用这些工具。"ANT Homepage.url"、"Register ANT.url"和"ANT Help.url"可能是ANT官方网站、注册页面和帮助文档的...
4. 执行构建:在命令行中导航到`build.xml`所在的目录,运行`ant generate-hbm`命令。这将根据你的数据库模式生成Hbm文件和Java类。 通过这个配置手顺,你可以有效地结合`Ant 1.7.0`和`Middlegen 2.1`,自动化地...
在接口测试中,JMeter可以用来发送请求到服务器,并记录响应时间和其他相关性能指标。通过JMeter可以设计复杂的测试场景,生成负载,验证接口的性能是否满足需求。 ant是Apache软件基金会的一个Java库,用于自动化...
在前端开发领域,Ant Design(简称antd)是一个广泛使用的React组件库,它为开发者提供了丰富的UI设计模式和...在实际开发中,还需要结合Babel进行代码转换,以便在不同浏览器中运行React和antd的现代JavaScript语法。
在前后端分离的架构中,JWT通常用于生成和验证用户令牌,使得用户在登录后可以在一定时间内无须再次认证即可访问受保护的API资源。 4. **Vue**:Vue.js是一个前端JavaScript框架,以其易学易用、高性能和灵活性著称...
找到Web项目中的.mymetadata文件,看看里面的内容,就知道怎么回事了。 4. 求改项目编译结果的存放地址,找到"部分,修改path的值为WebRoot/WEB-INF/classes,这样就可以跑自己的代码了。 5. 配置Solr运行环境 1....
找到Web项目中的.mymetadata文件,看看里面的内容,就知道怎么回事了。 4. 求改项目编译结果的存放地址,找到"部分,修改path的值为WebRoot/WEB-INF/classes,这样就可以跑自己的代码了。 5. 配置Solr运行环境 1....
找到Web项目中的.mymetadata文件,看看里面的内容,就知道怎么回事了。 4. 求改项目编译结果的存放地址,找到"部分,修改path的值为WebRoot/WEB-INF/classes,这样就可以跑自己的代码了。 5. 配置Solr运行环境 1....
找到Web项目中的.mymetadata文件,看看里面的内容,就知道怎么回事了。 4. 求改项目编译结果的存放地址,找到"部分,修改path的值为WebRoot/WEB-INF/classes,这样就可以跑自己的代码了。 5. 配置Solr运行环境 1....
首先,我们来看看Java在系统中的角色。Java是一种广泛应用的后端编程语言,以其“一次编写,到处运行”的特性而闻名。在这个系统中,Java主要用于服务器端的数据处理、业务逻辑实现以及与数据库的交互。开发者可能...
首先,我们来看标题“ant_colony_simulation:蚁群模拟”。这个标题明确指出了我们要讨论的主题,即使用计算机程序来模拟蚂蚁寻找食物的行为。在这种模拟中,程序会根据蚂蚁的行为规则,如信息素的扩散和蒸发,以及...
【标题】"matlab.zip_蚁群 重构_蚁群算法 潮流_蚁群算法重构_重构 蚁群"所涉及的核心知识点主要围绕蚁群算法(Ant Colony Optimization, ACO)及其在潮流计算(Power Flow Calculation)中的应用进行深入探讨。...
通过配置文件设置数据库连接参数,运行Ant脚本,即可自动生成与数据库表结构对应的Java实体类,方便进行数据访问和操作。对于Java开发者而言,这样的工具能有效提升开发效率,特别是在处理大量数据库表时。
3. **antpower.m**:这可能涉及到天线功率计算,比如卫星通信中天线增益的计算,可能与无线传播、信号强度预测等相关。 4. **look_angle.m**:看(Look)角度通常在卫星通信中用来描述地面站接收卫星信号时的方向角...
5. **计算复杂性(Computational Complexity)**: 计算资源消耗,包括时间复杂性和空间复杂性。 **应用领域** 蚁群算法已被广泛应用于各种优化问题,如旅行商问题、网络路由、物流配送、作业调度、图像分割等领域...