Jesse Wilson | 0ad6047 | 2009-09-14 11:23:39 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | import java.util.LinkedHashSet; |
| 18 | import java.util.Set; |
| 19 | |
| 20 | /** |
| 21 | * A logical unit of code shared between Apache Harmony and Dalvik. |
| 22 | */ |
| 23 | class Module { |
| 24 | |
| 25 | private final String svnBaseUrl; |
| 26 | private final String path; |
| 27 | private final Set<MappedDirectory> mappedDirectories; |
| 28 | |
| 29 | public String getSvnBaseUrl() { |
| 30 | return svnBaseUrl; |
| 31 | } |
| 32 | |
| 33 | public String path() { |
| 34 | return path; |
| 35 | } |
| 36 | |
| 37 | public Set<MappedDirectory> getMappedDirectories() { |
| 38 | return mappedDirectories; |
| 39 | } |
| 40 | |
| 41 | private Module(Builder builder) { |
| 42 | this.svnBaseUrl = builder.svnBaseUrl; |
| 43 | this.path = builder.path; |
| 44 | this.mappedDirectories = new LinkedHashSet<MappedDirectory>(builder.mappedDirectories); |
| 45 | } |
| 46 | |
| 47 | public static class Builder { |
| 48 | private final String svnBaseUrl; |
| 49 | private final String path; |
| 50 | private final Set<MappedDirectory> mappedDirectories |
| 51 | = new LinkedHashSet<MappedDirectory>(); |
| 52 | |
| 53 | public Builder(String svnBaseUrl, String path) { |
| 54 | this.svnBaseUrl = svnBaseUrl; |
| 55 | this.path = path; |
| 56 | } |
| 57 | |
| 58 | public Builder mapDirectory(String svnPath, String gitPath) { |
| 59 | mappedDirectories.add(new MappedDirectory(svnPath, gitPath)); |
| 60 | return this; |
| 61 | } |
| 62 | |
| 63 | public Module build() { |
| 64 | return new Module(this); |
| 65 | } |
| 66 | } |
| 67 | } |