English 中文(简体)
如何记录Java/Coffee文本结构
原标题:How to document JavaScript/CoffeeScript data structures

我正在寻求一种描述性的方法,把旧的数据结构记录在我的 Java本应用中。 我认为,由于 Java本的活力,很难做到这一点。

例如,可以说明的是,使用过的变量distance是一个双维阵,其长度为一、一、四和四倍,在<>-1>和之间。 我可以这样想:

distance[i][j] = -1 <= n <= MAX_INT

某些数据类型用作的地图/字典的标的是什么,一个阵列的第一个元件界定了其他数据等的两维阵列的是什么。

当然,我刚才认为,总是有可能在案文中记载这些问题,因为也许有很了解的、用半正规的方式这样做。

最佳回答
问题回答

What I tend to do in my JavaScript when I am replicating a lot of data models is to write out what their class definition would be in comments. I am not sure if this is what you meant with your question.

// JavaScript Class jsHomeLocation
// jsHomeLocation{
// string name
// string address
// }

var jsHomeLocation = {};
jsHomeLocation.name = "Travis";
jsHomeLocation.address = "California";

You could also use javascript objects to track the information of the example, a two-dimensional array

var distanceData = {};
distanceData.type = "two-dimensional array";
distanceData.length = i * j;
distanceData.min = -1;
distanceData.max = MAX_INT;




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.