Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012 Martin Skurla
   *
   * Licensed 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.crazyjavahacking.astvisualizer.impl.javac.model;
 
 
 import java.util.List;
 
 
 import lombok.Getter;


Edge data factory.

Author(s):
Martin
 
 public final class EdgeDataFactory {
 
     //-----------------------------------------------------------------------------------------------------------------
     // Constructors.
     //-----------------------------------------------------------------------------------------------------------------
     private EdgeDataFactory() {}
 
 
     //-----------------------------------------------------------------------------------------------------------------
     // Public Methods.
     //-----------------------------------------------------------------------------------------------------------------
     
Creates IEdgeData from given transition name.

Parameters:
transitionName transition name
Returns:
IEdgeData
 
     public static IEdgeData fromTree(String transitionName) {
         return new TreeEdgeData(transitionName);
     }

    
Creates List of IEdgeData objects from given transition name and number of times.

Parameters:
transitionName transition name
times times
Returns:
list of IEdgeData objects
 
     public static List<IEdgeDatafromTreeMultipleTimes(String transitionNameint times) {
         return Collections.nCopies(times, EdgeDataFactory.fromTree(transitionName));
     }

    
Creates IEdgeData from given transition name and javax.lang.model.element.Name.

Parameters:
transitionName transition name
name name
Returns:
IEdgeData
 
     public static IEdgeData fromName(String transitionNameName name) {
         return new NameEdgeData(transitionName,
                                 name);
     }

    
Creates IEdgeData from given transition name and javax.lang.model.element.Modifier.

Parameters:
transitionName transition name
modifier modifier
Returns:
IEdgeData
 
     public static IEdgeData fromModifier(String transitionNameModifier modifier) {
         return new ModifierEdgeData(transitionName,
                                     modifier);
     }

    
Creates IEdgeData from given stansition name and javax.lang.model.type.TypeKind.

Parameters:
transitionName transition name
typeKind type kind
Returns:
IEdgeData
    public static IEdgeData fromTypeKind(String transitionNameTypeKind typeKind) {
        return new TypeKindEdgeData(transitionName,
                                    typeKind);
    }
    //-----------------------------------------------------------------------------------------------------------------
    // Inner classes.
    //-----------------------------------------------------------------------------------------------------------------
    @Getter
    private static final class TreeEdgeData extends EdgeDataParentWithTostring
                                                                            implements IComSunSourceTreeTreeEdgeData {
        private final String transitionName;
    }
    @Getter
    private static final class NameEdgeData extends EdgeDataParentWithTostring
                                                                        implements IJavaxLangModelElementNameEdgeData {
        private final String transitionName;
        private final Name name;
    }
    @Getter
    private static final class ModifierEdgeData extends EdgeDataParentWithTostring
                                                                    implements IJavaxLangModelElementModifierEdgeData {
        private final String transitionName;
        private final Modifier modifier;
    }
    @Getter
    private static final class TypeKindEdgeData extends EdgeDataParentWithTostring
                                                                        implements IJavaxLangModelTypeTypeKindEdgeData {
        private final String transitionName;
        private final TypeKind typeKind;
    }
    private static abstract class EdgeDataParentWithTostring implements IEdgeData {
        @Override
        public String toString() {
            return getTransitionName();
        }
    }
New to GrepCode? Check out our FAQ X