// Path: src/main/java/tr/com/serkanozal/mysafe/impl/allocpath/AllocationPath.java
// public class AllocationPath {
// 
//     private static final int MAX_ALLOCATION_PATH_DEPTH_LIMIT = 4;
//     private static final int DEFAULT_MAX_ALLOCATION_PATH_DEPTH = MAX_ALLOCATION_PATH_DEPTH_LIMIT;
//     public static final int MAX_ALLOCATION_PATH_DEPTH =
//             Math.min(MAX_ALLOCATION_PATH_DEPTH_LIMIT,
//                      Integer.getInteger("mysafe.maxAllocationPathDepth", DEFAULT_MAX_ALLOCATION_PATH_DEPTH));
// 
//     public final long key;
//     public final String[] callPoints;
// 
//     public AllocationPath(long key, String[] callPoints) {
//         this.key = key;
//         this.callPoints = callPoints;
//     }
// 
// }
// 
// Path: src/main/java/tr/com/serkanozal/mysafe/impl/allocpath/AllocationPathAllocatedMemory.java
// public class AllocationPathAllocatedMemory {
// 
//     public final AllocationPath allocationPath;
//     public final long allocatedMemory;
//     
//     public AllocationPathAllocatedMemory(AllocationPath allocationPath, long allocatedMemory) {
//         this.allocationPath = allocationPath;
//         this.allocatedMemory = allocatedMemory;
//     }
// 
// }


import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.List;
import javax.imageio.ImageIO;
import tr.com.serkanozal.mysafe.impl.allocpath.AllocationPath;
import tr.com.serkanozal.mysafe.impl.allocpath.AllocationPathAllocatedMemory;
/*
 * Copyright (c) 2017, Serkan OZAL, All Rights Reserved.
 *
 * 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 tr.com.serkanozal.mysafe.impl;




class AllocationPathDiagramGenerator {

    static final String DEFAULT_DIAGRAM_NANE = "mysafe-allocation-path.png";
    
    private static final Color ALLOCATION_PATH_FRAME_BACKGROUND_COLOR = new Color(255, 228, 200);
    private static final Color ALLOCATION_PATH_UNIT_BACKGROUND_COLOR = new Color(228, 255, 255);
    
    private static final int ALLOCATION_PATH_FONT_SIZE = 14;
    private static final int ALLOCATION_PATH_H_GAP = 8;
    private static final int ALLOCATION_PATH_V_GAP = 8;
    
    private static final int ALLOCATION_PATH_UNIT_WIDTH = 800;
    private static final int ALLOCATION_PATH_UNIT_H_GAP = 50;
    private static final int ALLOCATION_PATH_FRAME_WIDTH = ALLOCATION_PATH_UNIT_WIDTH + (2 * ALLOCATION_PATH_UNIT_H_GAP);
    
    private static final int ALLOCATION_PATH_UNIT_HEIGHT = ALLOCATION_PATH_FONT_SIZE + (2 * ALLOCATION_PATH_V_GAP);
    private static final int ALLOCATION_PATH_UNIT_V_GAP = 50;
    private static final int ALLOCATION_PATH_FRAME_HEIGTH = 
// Path: src/main/java/tr/com/serkanozal/mysafe/impl/allocpath/AllocationPath.java
// public class AllocationPath {
// 
//     private static final int MAX_ALLOCATION_PATH_DEPTH_LIMIT = 4;
//     private static final int DEFAULT_MAX_ALLOCATION_PATH_DEPTH = MAX_ALLOCATION_PATH_DEPTH_LIMIT;
//     public static final int MAX_ALLOCATION_PATH_DEPTH =
//             Math.min(MAX_ALLOCATION_PATH_DEPTH_LIMIT,
//                      Integer.getInteger("mysafe.maxAllocationPathDepth", DEFAULT_MAX_ALLOCATION_PATH_DEPTH));
// 
//     public final long key;
//     public final String[] callPoints;
// 
//     public AllocationPath(long key, String[] callPoints) {
//         this.key = key;
//         this.callPoints = callPoints;
//     }
// 
// }
// 
// Path: src/main/java/tr/com/serkanozal/mysafe/impl/allocpath/AllocationPathAllocatedMemory.java
// public class AllocationPathAllocatedMemory {
// 
//     public final AllocationPath allocationPath;
//     public final long allocatedMemory;
//     
//     public AllocationPathAllocatedMemory(AllocationPath allocationPath, long allocatedMemory) {
//         this.allocationPath = allocationPath;
//         this.allocatedMemory = allocatedMemory;
//     }
// 
// }


// Path: src/main/java/tr/com/serkanozal/mysafe/impl/AllocationPathDiagramGenerator.java
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.List;
import javax.imageio.ImageIO;
import tr.com.serkanozal.mysafe.impl.allocpath.AllocationPath;
import tr.com.serkanozal.mysafe.impl.allocpath.AllocationPathAllocatedMemory;

/*
 * Copyright (c) 2017, Serkan OZAL, All Rights Reserved.
 *
 * 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 tr.com.serkanozal.mysafe.impl;




class AllocationPathDiagramGenerator {

    static final String DEFAULT_DIAGRAM_NANE = "mysafe-allocation-path.png";
    
    private static final Color ALLOCATION_PATH_FRAME_BACKGROUND_COLOR = new Color(255, 228, 200);
    private static final Color ALLOCATION_PATH_UNIT_BACKGROUND_COLOR = new Color(228, 255, 255);
    
    private static final int ALLOCATION_PATH_FONT_SIZE = 14;
    private static final int ALLOCATION_PATH_H_GAP = 8;
    private static final int ALLOCATION_PATH_V_GAP = 8;
    
    private static final int ALLOCATION_PATH_UNIT_WIDTH = 800;
    private static final int ALLOCATION_PATH_UNIT_H_GAP = 50;
    private static final int ALLOCATION_PATH_FRAME_WIDTH = ALLOCATION_PATH_UNIT_WIDTH + (2 * ALLOCATION_PATH_UNIT_H_GAP);
    
    private static final int ALLOCATION_PATH_UNIT_HEIGHT = ALLOCATION_PATH_FONT_SIZE + (2 * ALLOCATION_PATH_V_GAP);
    private static final int ALLOCATION_PATH_UNIT_V_GAP = 50;
    private static final int ALLOCATION_PATH_FRAME_HEIGTH = 
                    ((AllocationPath.MAX_ALLOCATION_PATH_DEPTH + 1) * ALLOCATION_PATH_UNIT_HEIGHT)