You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/04/25 08:18:23 UTC
[24/46] FlexPMD Donation from Adobe Systems Inc
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IClass.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IClass.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IClass.java
new file mode 100644
index 0000000..01235b2
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IClass.java
@@ -0,0 +1,81 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * Node representing a class. It contains different lists (constants, variables,
+ * functions, implementations, ...), but also a reference to its constructor (if
+ * any), the extension name (if any), and its name.
+ *
+ * @author xagnetti
+ */
+public interface IClass extends IVisible, IMetaDataListHolder, INamableNode, IAsDocHolder, ICommentHolder
+{
+ /**
+ * @return
+ */
+ List< IAttribute > getAttributes();
+
+ /**
+ * @return
+ */
+ double getAverageCyclomaticComplexity();
+
+ /**
+ * @return
+ */
+ IParserNode getBlock();
+
+ /**
+ * @return
+ */
+ List< IConstant > getConstants();
+
+ /**
+ * @return
+ */
+ IFunction getConstructor();
+
+ /**
+ * @return
+ */
+ String getExtensionName();
+
+ /**
+ * @return
+ */
+ List< IFunction > getFunctions();
+
+ /**
+ * @return
+ */
+ List< IParserNode > getImplementations();
+
+ /**
+ * @return
+ */
+ boolean isBindable();
+
+ /**
+ * @return
+ */
+ boolean isFinal();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/ICommentHolder.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/ICommentHolder.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/ICommentHolder.java
new file mode 100644
index 0000000..5094f90
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/ICommentHolder.java
@@ -0,0 +1,32 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * @author xagnetti
+ */
+public interface ICommentHolder
+{
+ /**
+ * @return
+ */
+ List< IParserNode > getMultiLinesComment();
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IConstant.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IConstant.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IConstant.java
new file mode 100644
index 0000000..d5b8f39
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IConstant.java
@@ -0,0 +1,24 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IConstant extends IField
+{
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IField.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IField.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IField.java
new file mode 100644
index 0000000..81a2979
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IField.java
@@ -0,0 +1,28 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IField extends IVariable, IVisible, IAsDocHolder
+{
+ /**
+ * @return
+ */
+ boolean isStatic();
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFieldInitialization.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFieldInitialization.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFieldInitialization.java
new file mode 100644
index 0000000..87d6980
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFieldInitialization.java
@@ -0,0 +1,24 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IFieldInitialization extends INode
+{
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFunction.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFunction.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFunction.java
new file mode 100644
index 0000000..e2124f1
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IFunction.java
@@ -0,0 +1,100 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+import java.util.List;
+import java.util.Map;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * Node representing a Function It contains the function name, its parameters,
+ * its return type, its modifiers, its metadata
+ *
+ * @author xagnetti
+ */
+public interface IFunction extends IVisible, IMetaDataListHolder, INamableNode, IAsDocHolder, ICommentHolder
+{
+ /**
+ * Finds recursively a statement in the function body from a list of names
+ *
+ * @param primaryNames statement name
+ * @return corresponding node
+ */
+ List< IParserNode > findPrimaryStatementInBody( final String[] primaryNames );
+
+ /**
+ * Finds recursively a statement in the function body from its name
+ *
+ * @param primaryName statement name
+ * @return corresponding node
+ */
+ List< IParserNode > findPrimaryStatementsInBody( final String primaryName );
+
+ /**
+ * @return
+ */
+ IParserNode getBody();
+
+ /**
+ * @return
+ */
+ int getCyclomaticComplexity();
+
+ /**
+ * @return
+ */
+ Map< String, IParserNode > getLocalVariables();
+
+ /**
+ * @return
+ */
+ List< IParameter > getParameters();
+
+ /**
+ * @return
+ */
+ IIdentifierNode getReturnType();
+
+ /**
+ * @return
+ */
+ int getStatementNbInBody();
+
+ /**
+ * @return Extracts the super call node (if any) from the function content
+ * block
+ */
+ IParserNode getSuperCall();
+
+ boolean isEventHandler();
+
+ /**
+ * @return
+ */
+ boolean isGetter();
+
+ /**
+ * @return
+ */
+ boolean isOverriden();
+
+ /**
+ * @return
+ */
+ boolean isSetter();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IIdentifierNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IIdentifierNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IIdentifierNode.java
new file mode 100644
index 0000000..28b5d11
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IIdentifierNode.java
@@ -0,0 +1,25 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IIdentifierNode extends INode
+{
+
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaData.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaData.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaData.java
new file mode 100644
index 0000000..ac6fd0b
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaData.java
@@ -0,0 +1,47 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+import java.util.List;
+
+/**
+ * @author xagnetti
+ */
+public interface IMetaData extends INamable, INode
+{
+ /**
+ * @return
+ */
+ List< String > getAttributeNames();
+
+ /**
+ * @return
+ */
+ String getDefaultValue();
+
+ /**
+ * @param property
+ * @return
+ */
+ String[] getProperty( final String property );
+
+ /**
+ * @param property
+ * @return
+ */
+ List< String > getPropertyAsList( final String property );
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaDataListHolder.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaDataListHolder.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaDataListHolder.java
new file mode 100644
index 0000000..2622556
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IMetaDataListHolder.java
@@ -0,0 +1,46 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+import java.util.List;
+
+/**
+ * @author xagnetti
+ */
+public interface IMetaDataListHolder
+{
+ /**
+ * @param metaData
+ */
+ void add( IMetaData metaData );
+
+ /**
+ * @return
+ */
+ List< IMetaData > getAllMetaData();
+
+ /**
+ * @param metaDataName
+ * @return
+ */
+ List< IMetaData > getMetaData( MetaData metaDataName );
+
+ /**
+ * @return
+ */
+ int getMetaDataCount();
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IModifiersHolder.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IModifiersHolder.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IModifiersHolder.java
new file mode 100644
index 0000000..8ed7eb5
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IModifiersHolder.java
@@ -0,0 +1,34 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IModifiersHolder
+{
+ /**
+ * @param modifier
+ */
+ void add( Modifier modifier );
+
+ /**
+ * @param modifier
+ * @return
+ */
+ boolean is( Modifier modifier ); // NOPMD
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamable.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamable.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamable.java
new file mode 100644
index 0000000..2ebad51
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamable.java
@@ -0,0 +1,28 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface INamable
+{
+ /**
+ * @return
+ */
+ String getName();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamableNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamableNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamableNode.java
new file mode 100644
index 0000000..24ea835
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INamableNode.java
@@ -0,0 +1,25 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface INamableNode extends INode, INamable
+{
+
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INode.java
new file mode 100644
index 0000000..04f4c9e
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/INode.java
@@ -0,0 +1,32 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * FlexPmdNode which wraps the parser node into a concrete type
+ *
+ * @author xagnetti
+ */
+public interface INode
+{
+ /**
+ * @return
+ */
+ IParserNode getInternalNode();
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IPackage.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IPackage.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IPackage.java
new file mode 100644
index 0000000..5fd2069
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IPackage.java
@@ -0,0 +1,50 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+import java.util.List;
+
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * Node representing a package. It contains the nested class node, the list of
+ * imports, and the package name.
+ *
+ * @author xagnetti
+ */
+public interface IPackage extends INamable, INode
+{
+ /**
+ * @return
+ */
+ IClass getClassNode();
+
+ /**
+ * @return
+ */
+ String getFullyQualifiedClassName();
+
+ /**
+ * @return
+ */
+ List< IFunction > getFunctions();
+
+ /**
+ * @return
+ */
+ List< IParserNode > getImports();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IParameter.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IParameter.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IParameter.java
new file mode 100644
index 0000000..9a2057b
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IParameter.java
@@ -0,0 +1,24 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IParameter extends IVariable
+{
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IVariable.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IVariable.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IVariable.java
new file mode 100644
index 0000000..e8902b6
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IVariable.java
@@ -0,0 +1,33 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IVariable extends IMetaDataListHolder, INamableNode
+{
+ /**
+ * @return
+ */
+ IFieldInitialization getInitializationExpression();
+
+ /**
+ * @return
+ */
+ IIdentifierNode getType();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IVisible.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IVisible.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IVisible.java
new file mode 100644
index 0000000..7afd485
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/IVisible.java
@@ -0,0 +1,28 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+/**
+ * @author xagnetti
+ */
+public interface IVisible extends IModifiersHolder
+{
+ /**
+ * @return
+ */
+ boolean isPublic();
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/MetaData.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/MetaData.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/MetaData.java
new file mode 100644
index 0000000..48e30bf
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/MetaData.java
@@ -0,0 +1,85 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+/**
+ * @author xagnetti
+ */
+public enum MetaData
+{
+ ARRAY_ELEMENT_TYPE("ArrayElementType"),
+ BEFORE("Before"),
+ BINDABLE("Bindable"),
+ DEFAULT_PROPERTY("DefaultProperty"),
+ DEPRECATED("Deprecated"),
+ EFFECT("Effect"),
+ EMBED("Embed"),
+ EVENT("Event"),
+ EXCLUDE("Exclude"),
+ EXCLUDE_CLASS("Exclude"),
+ ICON_FILE("IconFile"),
+ INSPECTABLE("Inspectable"),
+ INSTANCE_TYPE("InstanceType"),
+ NON_COMITTING_CHANGE_EVENT("NonCommittingChangeEvent"),
+ OTHER("Other"),
+ REMOTE_CLASS("RemoteClass"),
+ STYLE("Style"),
+ TEST("Test"),
+ TRANSIENT("Transient");
+
+ /**
+ * @param metaDataName
+ * @return
+ */
+ public static MetaData create( final String metaDataName )
+ {
+ MetaData metaData = null;
+
+ for ( final MetaData currentMetadata : values() )
+ {
+ if ( currentMetadata.toString().compareTo( metaDataName ) == 0 )
+ {
+ metaData = currentMetadata;
+ break;
+ }
+ }
+ if ( metaData == null )
+ {
+ metaData = MetaData.OTHER;
+ metaData.name = metaDataName;
+ }
+
+ return metaData;
+ }
+
+ private String name;
+
+ private MetaData( final String nameToBeSet )
+ {
+ name = nameToBeSet;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Enum#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/Modifier.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/Modifier.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/Modifier.java
new file mode 100644
index 0000000..bd93b42
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/Modifier.java
@@ -0,0 +1,78 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes;
+
+import com.adobe.ac.pmd.parser.KeyWords;
+
+/**
+ * @author xagnetti
+ */
+public enum Modifier
+{
+ DYNAMIC, FINAL, INTERNAL, OVERRIDE, PRIVATE, PROTECTED, PUBLIC, STATIC, INTRINSIC;
+
+ /**
+ * @param name
+ * @return
+ */
+ public static Modifier create( final String name )
+ {
+ Modifier modifier = null;
+ if ( KeyWords.PUBLIC.toString().equals( name ) )
+ {
+ modifier = Modifier.PUBLIC;
+ }
+ else if ( KeyWords.PRIVATE.toString().equals( name ) )
+ {
+ modifier = Modifier.PRIVATE;
+ }
+ else if ( KeyWords.PROTECTED.toString().equals( name ) )
+ {
+ modifier = Modifier.PROTECTED;
+ }
+ else if ( KeyWords.INTERNAL.toString().equals( name ) )
+ {
+ modifier = Modifier.INTERNAL;
+ }
+ else if ( KeyWords.DYNAMIC.toString().equals( name ) )
+ {
+ modifier = Modifier.DYNAMIC;
+ }
+ else if ( KeyWords.OVERRIDE.toString().equals( name ) )
+ {
+ modifier = Modifier.OVERRIDE;
+ }
+ else if ( KeyWords.STATIC.toString().equals( name ) )
+ {
+ modifier = Modifier.STATIC;
+ }
+ else if ( KeyWords.FINAL.toString().equals( name ) )
+ {
+ modifier = Modifier.FINAL;
+ }
+ // class modifier AS2
+ else if ( KeyWords.INTRINSIC.toString().equals( name ) )
+ {
+ modifier = Modifier.INTRINSIC;
+ }
+ return modifier;
+ }
+
+ private Modifier()
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/AsDocNodeBase.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/AsDocNodeBase.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/AsDocNodeBase.java
new file mode 100644
index 0000000..9cdb774
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/AsDocNodeBase.java
@@ -0,0 +1,42 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.asdoc.impl;
+
+/**
+ * @author xagnetti
+ */
+public class AsDocNodeBase
+{
+ private final String description;
+
+ /**
+ * @param descriptionToBeSet
+ */
+ public AsDocNodeBase( final String descriptionToBeSet )
+ {
+ super();
+ description = descriptionToBeSet;
+ }
+
+ /**
+ * @return
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/ClassAsDocNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/ClassAsDocNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/ClassAsDocNode.java
new file mode 100644
index 0000000..f165771
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/ClassAsDocNode.java
@@ -0,0 +1,31 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.asdoc.impl;
+
+/**
+ * @author xagnetti
+ */
+public class ClassAsDocNode extends AsDocNodeBase
+{
+ /**
+ * @param descriptionToBeSet
+ */
+ public ClassAsDocNode( final String descriptionToBeSet )
+ {
+ super( descriptionToBeSet );
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/FunctionAsDocNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/FunctionAsDocNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/FunctionAsDocNode.java
new file mode 100644
index 0000000..c8edf41
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/FunctionAsDocNode.java
@@ -0,0 +1,54 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.asdoc.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author xagnetti
+ */
+public class FunctionAsDocNode extends AsDocNodeBase
+{
+ private final List< ParameterAsDocNode > parameters;
+
+ /**
+ * @param descriptionToBeSet
+ */
+ public FunctionAsDocNode( final String descriptionToBeSet )
+ {
+ super( descriptionToBeSet );
+ parameters = new ArrayList< ParameterAsDocNode >();
+ }
+
+ /**
+ * @param param
+ */
+ public void addParameter( final ParameterAsDocNode param )
+ {
+ parameters.add( param );
+ }
+
+ /**
+ * @param index
+ * @return
+ */
+ public ParameterAsDocNode getParameter( final int index )
+ {
+ return parameters.get( index );
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/ParameterAsDocNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/ParameterAsDocNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/ParameterAsDocNode.java
new file mode 100644
index 0000000..a41286a
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/asdoc/impl/ParameterAsDocNode.java
@@ -0,0 +1,55 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.asdoc.impl;
+
+/**
+ * @author xagnetti
+ */
+public class ParameterAsDocNode
+{
+ private final String description;
+ private final String name;
+
+ /**
+ * @param nameToBeSet
+ * @param descriptionToBeSet
+ */
+ public ParameterAsDocNode( final String nameToBeSet,
+ final String descriptionToBeSet )
+ {
+ super();
+
+ name = nameToBeSet;
+ description = descriptionToBeSet;
+ }
+
+ /**
+ * @return
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * @return
+ */
+ public String getName()
+ {
+ return name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/AbstractNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/AbstractNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/AbstractNode.java
new file mode 100644
index 0000000..41c0183
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/AbstractNode.java
@@ -0,0 +1,90 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.impl;
+
+import java.util.logging.Logger;
+
+import com.adobe.ac.pmd.nodes.IMetaDataListHolder;
+import com.adobe.ac.pmd.nodes.IModifiersHolder;
+import com.adobe.ac.pmd.nodes.INode;
+import com.adobe.ac.pmd.nodes.Modifier;
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * @author xagnetti
+ */
+abstract class AbstractNode implements INode
+{
+ protected static final Logger LOGGER = Logger.getLogger( "Node" );
+
+ /**
+ * @param metaDataHolder
+ * @param child
+ */
+ protected static void computeMetaDataList( final IMetaDataListHolder metaDataHolder,
+ final IParserNode child )
+ {
+ if ( child.numChildren() != 0 )
+ {
+ for ( final IParserNode metadataNode : child.getChildren() )
+ {
+ metaDataHolder.add( NodeFactory.createMetaData( metadataNode ) );
+ }
+ }
+ }
+
+ /**
+ * @param modifiable
+ * @param child
+ */
+ protected static final void computeModifierList( final IModifiersHolder modifiable,
+ final IParserNode child )
+ {
+ if ( child.numChildren() != 0 )
+ {
+ for ( final IParserNode modifierNode : child.getChildren() )
+ {
+ final Modifier modifier = Modifier.create( modifierNode.getStringValue() );
+
+ modifiable.add( modifier );
+ }
+ }
+ }
+ private final IParserNode internalNode;
+
+ /**
+ * @param node
+ */
+ protected AbstractNode( final IParserNode node )
+ {
+ internalNode = node;
+ }
+
+ /**
+ * @return
+ */
+ public abstract AbstractNode compute();
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.INode#getInternalNode()
+ */
+ public IParserNode getInternalNode()
+ {
+ return internalNode;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/AttributeNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/AttributeNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/AttributeNode.java
new file mode 100644
index 0000000..accdb1d
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/AttributeNode.java
@@ -0,0 +1,44 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.impl;
+
+import com.adobe.ac.pmd.nodes.IAttribute;
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * @author xagnetti
+ */
+class AttributeNode extends FieldNode implements IAttribute
+{
+ /**
+ * @param rootNode
+ */
+ protected AttributeNode( final IParserNode rootNode )
+ {
+ super( rootNode );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.impl.FieldNode#compute()
+ */
+ @Override
+ public AttributeNode compute()
+ {
+ return ( AttributeNode ) super.compute();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/ClassNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/ClassNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/ClassNode.java
new file mode 100644
index 0000000..8f39c78
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/ClassNode.java
@@ -0,0 +1,411 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.impl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import com.adobe.ac.pmd.nodes.IAttribute;
+import com.adobe.ac.pmd.nodes.IClass;
+import com.adobe.ac.pmd.nodes.IConstant;
+import com.adobe.ac.pmd.nodes.IFunction;
+import com.adobe.ac.pmd.nodes.IMetaData;
+import com.adobe.ac.pmd.nodes.MetaData;
+import com.adobe.ac.pmd.nodes.Modifier;
+import com.adobe.ac.pmd.parser.IParserNode;
+import com.adobe.ac.pmd.parser.NodeKind;
+
+/**
+ * @author xagnetti
+ */
+class ClassNode extends AbstractNode implements IClass
+{
+ private IParserNode asDoc;
+ private final List< IAttribute > attributes;
+ private IParserNode block;
+ private final List< IConstant > constants;
+ private IFunction constructor;
+ private String extensionName;
+ private final List< IFunction > functions;
+ private List< IParserNode > implementations;
+ private final Map< MetaData, List< IMetaData > > metaDataList;
+ private final Set< Modifier > modifiers;
+ private final List< IParserNode > multiLinesComments;
+ private IdentifierNode name;
+
+ /**
+ * @param node
+ */
+ protected ClassNode( final IParserNode node )
+ {
+ super( node );
+
+ modifiers = new HashSet< Modifier >();
+ metaDataList = new LinkedHashMap< MetaData, List< IMetaData > >();
+ implementations = new ArrayList< IParserNode >();
+ constants = new ArrayList< IConstant >();
+ attributes = new ArrayList< IAttribute >();
+ functions = new ArrayList< IFunction >();
+ multiLinesComments = new ArrayList< IParserNode >();
+ name = null;
+ asDoc = null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.nodes.IMetaDataListHolder#add(com.adobe.ac.pmd.nodes.
+ * IMetaData)
+ */
+ public void add( final IMetaData metaData )
+ {
+ final MetaData metaDataImpl = MetaData.create( metaData.getName() );
+
+ if ( !metaDataList.containsKey( metaDataImpl ) )
+ {
+ metaDataList.put( metaDataImpl,
+ new ArrayList< IMetaData >() );
+ }
+ metaDataList.get( metaDataImpl ).add( metaData );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.nodes.IModifiersHolder#add(com.adobe.ac.pmd.nodes.Modifier
+ * )
+ */
+ public void add( final Modifier modifier )
+ {
+ modifiers.add( modifier );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.impl.AbstractNode#compute()
+ */
+ @Override
+ public ClassNode compute()
+ {
+ if ( getInternalNode().numChildren() != 0 )
+ {
+ for ( final IParserNode node : getInternalNode().getChildren() )
+ {
+ if ( node.is( NodeKind.CONTENT ) )
+ {
+ computeClassContent( node );
+ }
+ else if ( node.is( NodeKind.MOD_LIST ) )
+ {
+ computeModifierList( this,
+ node );
+ }
+ else if ( node.is( NodeKind.NAME ) )
+ {
+ name = IdentifierNode.create( node );
+ }
+ else if ( node.is( NodeKind.META_LIST ) )
+ {
+ computeMetaDataList( this,
+ node );
+ }
+ else if ( node.is( NodeKind.AS_DOC ) )
+ {
+ asDoc = node;
+ }
+ else if ( node.is( NodeKind.MULTI_LINE_COMMENT ) )
+ {
+ multiLinesComments.add( node );
+ }
+ detectImplementations( node );
+ detectExtensions( node );
+ }
+ for ( final IFunction function : functions )
+ {
+ if ( name.toString().equals( function.getName() ) )
+ {
+ constructor = function;
+ }
+ }
+ }
+ return this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IMetaDataListHolder#getAllMetaData()
+ */
+ public List< IMetaData > getAllMetaData()
+ {
+ final List< IMetaData > list = new ArrayList< IMetaData >();
+
+ for ( final Entry< MetaData, List< IMetaData > > entry : metaDataList.entrySet() )
+ {
+ list.addAll( entry.getValue() );
+ }
+
+ return list;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IAsDocHolder#getAsDoc()
+ */
+ public IParserNode getAsDoc()
+ {
+ return asDoc;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IClass#getAttributes()
+ */
+ public List< IAttribute > getAttributes()
+ {
+ return attributes;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IClass#getAverageCyclomaticComplexity()
+ */
+ public double getAverageCyclomaticComplexity()
+ {
+ if ( functions.isEmpty() )
+ {
+ return 0;
+ }
+ int totalCcn = 0;
+
+ for ( final IFunction function : functions )
+ {
+ totalCcn += function.getCyclomaticComplexity();
+ }
+
+ return totalCcn
+ / functions.size();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IClass#getBlock()
+ */
+ public final IParserNode getBlock()
+ {
+ return block;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IClass#getConstants()
+ */
+ public List< IConstant > getConstants()
+ {
+ return constants;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IClass#getConstructor()
+ */
+ public IFunction getConstructor()
+ {
+ return constructor;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IClass#getExtensionName()
+ */
+ public String getExtensionName()
+ {
+ return extensionName;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IClass#getFunctions()
+ */
+ public List< IFunction > getFunctions()
+ {
+ return functions;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IClass#getImplementations()
+ */
+ public List< IParserNode > getImplementations()
+ {
+ return implementations;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.nodes.IMetaDataListHolder#getMetaData(com.adobe.ac.pmd
+ * .nodes.MetaData)
+ */
+ public List< IMetaData > getMetaData( final MetaData metaDataName )
+ {
+ if ( metaDataList.containsKey( metaDataName ) )
+ {
+ return metaDataList.get( metaDataName );
+ }
+ else
+ {
+ return new ArrayList< IMetaData >();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IMetaDataListHolder#getMetaDataCount()
+ */
+ public int getMetaDataCount()
+ {
+ return metaDataList.size();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.ICommentHolder#getMultiLinesComment()
+ */
+ public List< IParserNode > getMultiLinesComment()
+ {
+ return multiLinesComments;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.INamable#getName()
+ */
+ public String getName()
+ {
+ return name.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.nodes.IModifiersHolder#is(com.adobe.ac.pmd.nodes.Modifier
+ * )
+ */
+ public boolean is( final Modifier modifier ) // NOPMD
+ {
+ return modifiers.contains( modifier );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IClass#isBindable()
+ */
+ public boolean isBindable()
+ {
+ return metaDataList.get( MetaData.BINDABLE ) != null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IClass#isFinal()
+ */
+ public boolean isFinal()
+ {
+ return is( Modifier.FINAL );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IVisible#isPublic()
+ */
+ public boolean isPublic()
+ {
+ return is( Modifier.PUBLIC );
+ }
+
+ private void computeClassContent( final IParserNode classContentNode )
+ {
+ if ( classContentNode.numChildren() != 0 )
+ {
+ for ( final IParserNode node : classContentNode.getChildren() )
+ {
+ detectBlock( node );
+ detectFunction( node );
+ detectAttribute( node );
+ detectConstant( node );
+ if ( node.is( NodeKind.MULTI_LINE_COMMENT ) )
+ {
+ multiLinesComments.add( node );
+ }
+ }
+ }
+ }
+
+ private void detectAttribute( final IParserNode node )
+ {
+ if ( node.is( NodeKind.VAR_LIST ) )
+ {
+ attributes.add( new AttributeNode( node ).compute() );
+ }
+ }
+
+ private void detectBlock( final IParserNode node )
+ {
+ if ( node.is( NodeKind.BLOCK ) )
+ {
+ block = node;
+ }
+ }
+
+ private void detectConstant( final IParserNode node )
+ {
+ if ( node.is( NodeKind.CONST_LIST ) )
+ {
+ constants.add( new ConstantNode( node ).compute() );
+ }
+ }
+
+ private void detectExtensions( final IParserNode node )
+ {
+ if ( node.is( NodeKind.EXTENDS ) )
+ {
+ extensionName = node.getStringValue();
+ }
+ }
+
+ private void detectFunction( final IParserNode node )
+ {
+ if ( node.is( NodeKind.FUNCTION )
+ || node.is( NodeKind.GET ) || node.is( NodeKind.SET ) )
+ {
+ functions.add( new FunctionNode( node ).compute() );
+ }
+ }
+
+ private void detectImplementations( final IParserNode node )
+ {
+ if ( node.is( NodeKind.IMPLEMENTS_LIST ) )
+ {
+ implementations = node.getChildren();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/ConstantNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/ConstantNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/ConstantNode.java
new file mode 100644
index 0000000..dd809c5
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/ConstantNode.java
@@ -0,0 +1,44 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.impl;
+
+import com.adobe.ac.pmd.nodes.IConstant;
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * @author xagnetti
+ */
+class ConstantNode extends FieldNode implements IConstant
+{
+ /**
+ * @param rootNode
+ */
+ protected ConstantNode( final IParserNode rootNode )
+ {
+ super( rootNode );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.impl.FieldNode#compute()
+ */
+ @Override
+ public ConstantNode compute()
+ {
+ return ( ConstantNode ) super.compute();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FieldInitializationNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FieldInitializationNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FieldInitializationNode.java
new file mode 100644
index 0000000..bde2b5a
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FieldInitializationNode.java
@@ -0,0 +1,53 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.impl;
+
+import com.adobe.ac.pmd.nodes.IFieldInitialization;
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * @author xagnetti
+ */
+class FieldInitializationNode extends AbstractNode implements IFieldInitialization
+{
+ /**
+ * @param node
+ * @return
+ */
+ static FieldInitializationNode create( final IParserNode node )
+ {
+ return new FieldInitializationNode( node );
+ }
+
+ /**
+ * @param node
+ */
+ protected FieldInitializationNode( final IParserNode node )
+ {
+ super( node );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.impl.AbstractNode#compute()
+ */
+ @Override
+ public FieldInitializationNode compute()
+ {
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FieldNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FieldNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FieldNode.java
new file mode 100644
index 0000000..a9db9d9
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FieldNode.java
@@ -0,0 +1,94 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.impl;
+
+import com.adobe.ac.pmd.nodes.IField;
+import com.adobe.ac.pmd.nodes.Modifier;
+import com.adobe.ac.pmd.parser.IParserNode;
+import com.adobe.ac.pmd.parser.NodeKind;
+
+/**
+ * Base class for AttributeNode and for ConstantNode
+ *
+ * @author xagnetti
+ */
+class FieldNode extends VariableNode implements IField
+{
+ private IParserNode asDocs;
+
+ /**
+ * @param rootNode
+ */
+ protected FieldNode( final IParserNode rootNode )
+ {
+ super( rootNode );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.impl.VariableNode#compute()
+ */
+ @Override
+ public FieldNode compute()
+ {
+ super.compute();
+
+ if ( getInternalNode().numChildren() != 0 )
+ {
+ for ( final IParserNode child : getInternalNode().getChildren() )
+ {
+ if ( child.is( NodeKind.MOD_LIST ) )
+ {
+ computeModifierList( this,
+ child );
+ }
+ else if ( child.is( NodeKind.AS_DOC ) )
+ {
+ asDocs = child;
+ }
+ }
+ }
+ return this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IAsDocHolder#getAsDoc()
+ */
+ public IParserNode getAsDoc()
+ {
+ return asDocs;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IVisible#isPublic()
+ */
+ public boolean isPublic()
+ {
+ return is( Modifier.PUBLIC );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IField#isStatic()
+ */
+ public boolean isStatic()
+ {
+ return is( Modifier.STATIC );
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FormalNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FormalNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FormalNode.java
new file mode 100644
index 0000000..8aaacdb
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FormalNode.java
@@ -0,0 +1,53 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.impl;
+
+import com.adobe.ac.pmd.nodes.IParameter;
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * @author xagnetti
+ */
+final class FormalNode extends VariableNode implements IParameter
+{
+ /**
+ * @param node
+ * @return
+ */
+ static FormalNode create( final IParserNode node )
+ {
+ return new FormalNode( node ).compute();
+ }
+
+ /**
+ * @param node
+ */
+ private FormalNode( final IParserNode node )
+ {
+ super( node );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.impl.VariableNode#compute()
+ */
+ @Override
+ public FormalNode compute()
+ {
+ return ( FormalNode ) super.compute();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FunctionNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FunctionNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FunctionNode.java
new file mode 100644
index 0000000..6d61a9e
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/FunctionNode.java
@@ -0,0 +1,444 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.impl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import com.adobe.ac.pmd.nodes.IFunction;
+import com.adobe.ac.pmd.nodes.IIdentifierNode;
+import com.adobe.ac.pmd.nodes.IMetaData;
+import com.adobe.ac.pmd.nodes.IParameter;
+import com.adobe.ac.pmd.nodes.MetaData;
+import com.adobe.ac.pmd.nodes.Modifier;
+import com.adobe.ac.pmd.parser.IParserNode;
+import com.adobe.ac.pmd.parser.KeyWords;
+import com.adobe.ac.pmd.parser.NodeKind;
+
+/**
+ * @author xagnetti
+ */
+class FunctionNode extends AbstractNode implements IFunction
+{
+ private IParserNode asDoc;
+ private IParserNode body;
+ private int cyclomaticComplexity;
+ private final Map< String, IParserNode > localVariables;
+ private final Map< MetaData, List< IMetaData > > metaDataList;
+ private final Set< Modifier > modifiers;
+ private final List< IParserNode > multiLinesComments;
+ private IdentifierNode name;
+ private final List< IParameter > parameters;
+ private IIdentifierNode returnType;
+
+ /**
+ * @param node
+ */
+ protected FunctionNode( final IParserNode node )
+ {
+ super( node );
+
+ modifiers = new HashSet< Modifier >();
+ metaDataList = new LinkedHashMap< MetaData, List< IMetaData > >();
+ localVariables = new LinkedHashMap< String, IParserNode >();
+ parameters = new ArrayList< IParameter >();
+ name = null;
+ multiLinesComments = new ArrayList< IParserNode >();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.nodes.IMetaDataListHolder#add(com.adobe.ac.pmd.nodes.
+ * IMetaData)
+ */
+ public void add( final IMetaData metaData )
+ {
+ final MetaData metaDataImpl = MetaData.create( metaData.getName() );
+
+ if ( !metaDataList.containsKey( metaDataImpl ) )
+ {
+ metaDataList.put( metaDataImpl,
+ new ArrayList< IMetaData >() );
+ }
+ metaDataList.get( metaDataImpl ).add( metaData );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.nodes.IModifiersHolder#add(com.adobe.ac.pmd.nodes.Modifier
+ * )
+ */
+ public void add( final Modifier modifier )
+ {
+ modifiers.add( modifier );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.impl.AbstractNode#compute()
+ */
+ @Override
+ public FunctionNode compute()
+ {
+ if ( getInternalNode().numChildren() != 0 )
+ {
+ for ( final IParserNode node : getInternalNode().getChildren() )
+ {
+ if ( node.is( NodeKind.BLOCK ) )
+ {
+ computeFunctionContent( node );
+ }
+ else if ( node.is( NodeKind.NAME ) )
+ {
+ name = IdentifierNode.create( node );
+ }
+ else if ( node.is( NodeKind.MOD_LIST ) )
+ {
+ computeModifierList( this,
+ node );
+ }
+ else if ( node.is( NodeKind.PARAMETER_LIST ) )
+ {
+ computeParameterList( node );
+ }
+ else if ( node.is( NodeKind.TYPE ) )
+ {
+ returnType = IdentifierNode.create( node );
+ }
+ else if ( node.is( NodeKind.META_LIST ) )
+ {
+ computeMetaDataList( this,
+ node );
+ }
+ else if ( node.is( NodeKind.AS_DOC ) )
+ {
+ asDoc = node;
+ }
+ }
+ }
+ return this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.nodes.IFunction#findPrimaryStatementInBody(java.lang.
+ * String[])
+ */
+ public List< IParserNode > findPrimaryStatementInBody( final String[] primaryNames )
+ {
+ return body == null ? null
+ : body.findPrimaryStatementsFromNameInChildren( primaryNames );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.nodes.IFunction#findPrimaryStatementsInBody(java.lang
+ * .String)
+ */
+ public List< IParserNode > findPrimaryStatementsInBody( final String primaryName )
+ {
+ return body == null ? new ArrayList< IParserNode >()
+ : body.findPrimaryStatementsFromNameInChildren( new String[]
+ { primaryName } );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IMetaDataListHolder#getAllMetaData()
+ */
+ public List< IMetaData > getAllMetaData()
+ {
+ final List< IMetaData > list = new ArrayList< IMetaData >();
+
+ for ( final Entry< MetaData, List< IMetaData > > entry : metaDataList.entrySet() )
+ {
+ list.addAll( entry.getValue() );
+ }
+
+ return list;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IAsDocHolder#getAsDoc()
+ */
+ public IParserNode getAsDoc()
+ {
+ return asDoc;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IFunction#getBody()
+ */
+ public IParserNode getBody()
+ {
+ return body;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IFunction#getCyclomaticComplexity()
+ */
+ public int getCyclomaticComplexity()
+ {
+ return cyclomaticComplexity;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IFunction#getLocalVariables()
+ */
+ public Map< String, IParserNode > getLocalVariables()
+ {
+ return localVariables;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.nodes.IMetaDataListHolder#getMetaData(com.adobe.ac.pmd
+ * .nodes.MetaData)
+ */
+ public List< IMetaData > getMetaData( final MetaData metaDataName )
+ {
+ if ( metaDataList.containsKey( metaDataName ) )
+ {
+ return metaDataList.get( metaDataName );
+ }
+ else
+ {
+ return new ArrayList< IMetaData >();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IMetaDataListHolder#getMetaDataCount()
+ */
+ public int getMetaDataCount()
+ {
+ return metaDataList.size();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.ICommentHolder#getMultiLinesComment()
+ */
+ public List< IParserNode > getMultiLinesComment()
+ {
+ return multiLinesComments;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.INamable#getName()
+ */
+ public String getName()
+ {
+ return name.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IFunction#getParameters()
+ */
+ public List< IParameter > getParameters()
+ {
+ return parameters;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IFunction#getReturnType()
+ */
+ public IIdentifierNode getReturnType()
+ {
+ return returnType;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IFunction#getStatementNbInBody()
+ */
+ public int getStatementNbInBody()
+ {
+ return 1 + getStatementInNode( body );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IFunction#getSuperCall()
+ */
+ public IParserNode getSuperCall()
+ {
+ if ( body != null
+ && body.numChildren() != 0 )
+ {
+ for ( final IParserNode childContent : body.getChildren() )
+ {
+ if ( NodeKind.CALL.equals( childContent.getId() )
+ || NodeKind.DOT.equals( childContent.getId() ) )
+ {
+ for ( final IParserNode childCall : childContent.getChildren() )
+ {
+ if ( KeyWords.SUPER.toString().equals( childCall.getStringValue() ) )
+ {
+ return childContent;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * com.adobe.ac.pmd.nodes.IModifiersHolder#is(com.adobe.ac.pmd.nodes.Modifier
+ * )
+ */
+ public boolean is( final Modifier modifier ) // NOPMD
+ {
+ return modifiers.contains( modifier );
+ }
+
+ //@Override
+ public boolean isEventHandler()
+ {
+ return getParameters().size() == 1
+ && getParameters().get( 0 ).getType().toString().contains( "Event" );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IFunction#isGetter()
+ */
+ public boolean isGetter()
+ {
+ return getInternalNode().is( NodeKind.GET );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IFunction#isOverriden()
+ */
+ public boolean isOverriden()
+ {
+ return is( Modifier.OVERRIDE );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IVisible#isPublic()
+ */
+ public boolean isPublic()
+ {
+ return is( Modifier.PUBLIC );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.IFunction#isSetter()
+ */
+ public boolean isSetter()
+ {
+ return getInternalNode().is( NodeKind.SET );
+ }
+
+ private void computeCyclomaticComplexity()
+ {
+ cyclomaticComplexity = 1 + body.computeCyclomaticComplexity();
+ }
+
+ private void computeFunctionContent( final IParserNode functionBodyNode )
+ {
+ body = functionBodyNode;
+
+ computeCyclomaticComplexity();
+ if ( body.numChildren() > 0 )
+ {
+ for ( final IParserNode node : body.getChildren() )
+ {
+ if ( node.is( NodeKind.MULTI_LINE_COMMENT ) )
+ {
+ multiLinesComments.add( node );
+ }
+ }
+ }
+ computeVariableList( body );
+ }
+
+ private void computeParameterList( final IParserNode node )
+ {
+ if ( node.numChildren() != 0 )
+ {
+ for ( final IParserNode parameterNode : node.getChildren() )
+ {
+ parameters.add( FormalNode.create( parameterNode ) );
+ }
+ }
+ }
+
+ private void computeVariableList( final IParserNode node )
+ {
+ if ( node.is( NodeKind.VAR_LIST ) )
+ {
+ localVariables.put( node.getChild( 0 ).getChild( 0 ).getStringValue(),
+ node );
+ }
+ else if ( node.numChildren() > 0 )
+ {
+ for ( final IParserNode child : node.getChildren() )
+ {
+ computeVariableList( child );
+ }
+ }
+ }
+
+ private int getStatementInNode( final IParserNode node )
+ {
+ int statementNb = 0;
+
+ if ( node != null
+ && node.numChildren() != 0 )
+ {
+ int lastLine = node.getChild( 0 ).getLine();
+ for ( final IParserNode childContent : node.getChildren() )
+ {
+ if ( childContent.getLine() != lastLine )
+ {
+ lastLine = childContent.getLine();
+ statementNb++;
+ }
+ statementNb += getStatementInNode( childContent );
+ }
+ }
+
+ return statementNb;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/IdentifierNode.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/IdentifierNode.java b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/IdentifierNode.java
new file mode 100644
index 0000000..2b7ff10
--- /dev/null
+++ b/FlexPMD/flex-pmd-ruleset-api/src/main/java/com/adobe/ac/pmd/nodes/impl/IdentifierNode.java
@@ -0,0 +1,63 @@
+/*
+ * 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 com.adobe.ac.pmd.nodes.impl;
+
+import com.adobe.ac.pmd.nodes.IIdentifierNode;
+import com.adobe.ac.pmd.parser.IParserNode;
+
+/**
+ * @author xagnetti
+ */
+class IdentifierNode extends AbstractNode implements IIdentifierNode
+{
+ /**
+ * @param node
+ * @return
+ */
+ static IdentifierNode create( final IParserNode node )
+ {
+ return new IdentifierNode( node ).compute();
+ }
+
+ /**
+ * @param node
+ */
+ protected IdentifierNode( final IParserNode node )
+ {
+ super( node );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.adobe.ac.pmd.nodes.impl.AbstractNode#compute()
+ */
+ @Override
+ public IdentifierNode compute()
+ {
+ return this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return getInternalNode().getStringValue();
+ }
+}