This project has retired. For details please refer to its Attic page.
Source code
001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.reef.io.network.group.impl.config;
020
021import org.apache.reef.io.network.group.api.config.OperatorSpec;
022import org.apache.reef.io.network.group.impl.utils.Utils;
023import org.apache.reef.io.serialization.Codec;
024
025/**
026 * The specification for the Gather operator.
027 */
028public class GatherOperatorSpec implements OperatorSpec {
029
030  private final String receiverId;
031  private final Class<? extends Codec> dataCodecClass;
032
033  public GatherOperatorSpec(final String receiverId,
034                            final Class<? extends Codec> dataCodecClass) {
035    this.receiverId = receiverId;
036    this.dataCodecClass = dataCodecClass;
037  }
038
039  public String getReceiverId() {
040    return receiverId;
041  }
042
043  @Override
044  public Class<? extends Codec> getDataCodecClass() {
045    return dataCodecClass;
046  }
047
048  @Override
049  public String toString() {
050    final StringBuilder sb = new StringBuilder("Gather Operator Spec: [receiver=")
051        .append(receiverId)
052        .append("] [dataCodecClass=")
053        .append(Utils.simpleName(dataCodecClass))
054        .append("]");
055    return sb.toString();
056  }
057
058  public static Builder newBuilder() {
059    return new GatherOperatorSpec.Builder();
060  }
061
062  public static class Builder implements org.apache.reef.util.Builder<GatherOperatorSpec> {
063
064    private String receiverId;
065    private Class<? extends Codec> dataCodecClass;
066
067    public Builder setReceiverId(final String receiverId) {
068      this.receiverId = receiverId;
069      return this;
070    }
071
072    public Builder setDataCodecClass(final Class<? extends Codec> dataCodecClass) {
073      this.dataCodecClass = dataCodecClass;
074      return this;
075    }
076
077    @Override
078    public GatherOperatorSpec build() {
079      return new GatherOperatorSpec(receiverId, dataCodecClass);
080    }
081  }
082}