/*
 * Copyright 2014 protoc-jar developers
 * 
 * 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.github.os72.protocjar;

public class ProtocVersion
{
	public static final String PROTOC_VERSION = "310";
}

@@ -637,16 +637,65 @@
 ocjar;%0A%0A
+import java.util.HashMap;%0Aimport java.util.Map;%0A%0A
 public c
@@ -740,14 +740,21 @@
 nal 
-String
+ProtocVersion
  PRO
@@ -771,13 +771,984 @@
 N = 
-%22310%22;
+new ProtocVersion(null, null, %22310%22);%0A%0A%09public static ProtocVersion getVersion(String spec) %7B%0A%09%09String v = sVersionMap.get(spec.replace(%22.%22, %22%22));%0A%09%09if (v != null) return new ProtocVersion(null, null, v);%09%09%0A%09%09String%5B%5D as = spec.split(%22:%22);%0A%09%09if (as.length == 4 && as%5B0%5D.equals(%22-v%22)) return new ProtocVersion(as%5B1%5D, as%5B2%5D, as%5B3%5D);%0A%09%09return null;%0A%09%7D%0A%0A%09public ProtocVersion(String group, String artifact, String version) %7B%0A%09%09mGroup = group;%0A%09%09mArtifact = artifact;%0A%09%09mVersion = version;%0A%09%7D%0A%0A%09@Override%0A%09public String toString() %7B%0A%09%09if (mArtifact == null) return mVersion;%0A%09%09return mGroup+%22:%22+mArtifact+%22:%22+mVersion;%0A%09%7D%0A%0A%09public final String mGroup;%0A%09public final String mArtifact;%0A%09public final String mVersion;%0A%0A%09private static Map%3CString,String%3E sVersionMap = new HashMap%3CString,String%3E();%0A%09static %7B%0A%09%09sVersionMap.put(%22-v310%22, %22310%22);%0A%09%09sVersionMap.put(%22-v300%22, %22310%22);%0A%09%09sVersionMap.put(%22-v261%22, %22261%22);%0A%09%09sVersionMap.put(%22-v250%22, %22250%22);%0A%09%09sVersionMap.put(%22-v241%22, %22241%22);%0A%09%7D
 %0A%7D%0A

refactor ProtocVersion to support group, artifact, version