/*
 * 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 com.facebook.presto.memory;

import com.facebook.presto.execution.QueryId;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableMap;

import java.util.Map;

public final class MemoryPoolInfo
{
    private final long maxBytes;
    private final long freeBytes;
    private final Map<QueryId, Long> queryMemoryReservations;

    @JsonCreator
    public MemoryPoolInfo(@JsonProperty("maxBytes") long maxBytes, @JsonProperty("freeBytes") long freeBytes, @JsonProperty("queryMemoryReservations") Map<QueryId, Long> queryMemoryReservations)
    {
        this.maxBytes = maxBytes;
        this.freeBytes = freeBytes;
        this.queryMemoryReservations = ImmutableMap.copyOf(queryMemoryReservations);
    }

    @JsonProperty
    public long getMaxBytes()
    {
        return maxBytes;
    }

    @JsonProperty
    public long getFreeBytes()
    {
        return freeBytes;
    }

    @JsonProperty
    public Map<QueryId, Long> getQueryMemoryReservations()
    {
        return queryMemoryReservations;
    }

    @Override
    public String toString()
    {
        return MoreObjects.toStringHelper(this)
                .add("maxBytes", maxBytes)
                .add("freeBytes", freeBytes)
                .toString();
    }
}

@@ -749,106 +749,104 @@
 ty;%0A
+%0A
 import 
-com.google.common.base.MoreObjects;%0Aimport com.google.common.collect.ImmutableMap;%0A
+java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport static java.lang.String.format;
 %0Aimport 
 java
@@ -833,32 +833,39 @@
 .format;%0Aimport 
+static 
 java.util.Map;%0A%0A
@@ -854,24 +854,48 @@
 c java.util.
+Collections.unmodifiable
 Map;%0A%0Apublic
@@ -1385,27 +1385,37 @@
 s = 
-ImmutableMap.copyOf
+unmodifiableMap(new HashMap%3C%3E
 (que
@@ -1435,16 +1435,17 @@
 vations)
+)
 ;%0A    %7D%0A
@@ -1817,116 +1817,51 @@
 urn 
-MoreObjects.toStringHelper(this)%0A                .add(%22maxBytes%22, maxBytes)%0A                .add(%22free
+format(%22maxBytes=%25s,freeBytes=%25s%22, max
 Bytes
-%22
 , fr
@@ -1872,36 +1872,8 @@
 tes)
-%0A                .toString()
 ;%0A  

Refactor MemoryPoolInfo to remove Guava dependency