All Downloads are FREE. Search and download functionalities are using the official Maven repository.

swim.system.lane.JoinMapLaneDownlink Maven / Gradle / Ivy

The newest version!
// Copyright 2015-2024 Nstream, inc.
//
// 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 swim.system.lane;

import swim.concurrent.Stage;
import swim.structure.Form;
import swim.structure.Value;
import swim.system.CellContext;
import swim.system.downlink.MapDownlinkView;
import swim.system.warp.WarpDownlinkView;
import swim.uri.Uri;

public class JoinMapLaneDownlink extends MapDownlinkView {

  protected final JoinMapLaneModel laneModel;
  protected final Value key;

  public JoinMapLaneDownlink(CellContext cellContext, Stage stage, JoinMapLaneModel laneModel,
                             Value key, Uri meshUri, Uri hostUri, Uri nodeUri, Uri laneUri,
                             float prio, float rate, Value body, int flags, Form keyForm,
                             Form valueForm, Object observers) {
    super(cellContext, stage, meshUri, hostUri, nodeUri, laneUri, prio, rate, body,
          flags, keyForm, valueForm, observers);
    this.laneModel = laneModel;
    this.key = key;
  }

  public JoinMapLaneDownlink(CellContext cellContext, Stage stage, JoinMapLaneModel laneModel,
                             Value key, Uri meshUri, Uri hostUri, Uri nodeUri, Uri laneUri,
                             float prio, float rate, Value body, Form keyForm, Form valueForm) {
    this(cellContext, stage, laneModel, key, meshUri, hostUri, nodeUri, laneUri, prio, rate, body,
         WarpDownlinkView.KEEP_LINKED | WarpDownlinkView.KEEP_SYNCED, keyForm, valueForm, null);
  }

  @Override
  public MapDownlinkView hostUri(Uri hostUri) {
    return new JoinMapLaneDownlink(this.cellContext, this.stage, this.laneModel,
                                         this.key, this.meshUri, hostUri, this.nodeUri,
                                         this.laneUri, this.prio, this.rate, this.body,
                                         this.flags, this.keyForm, this.valueForm, this.observers);
  }

  @Override
  public MapDownlinkView nodeUri(Uri nodeUri) {
    return new JoinMapLaneDownlink(this.cellContext, this.stage, this.laneModel,
                                         this.key, this.meshUri, this.hostUri, nodeUri,
                                         this.laneUri, this.prio, this.rate, this.body,
                                         this.flags, this.keyForm, this.valueForm, this.observers);
  }

  @Override
  public MapDownlinkView laneUri(Uri laneUri) {
    return new JoinMapLaneDownlink(this.cellContext, this.stage, this.laneModel,
                                         this.key, this.meshUri, this.hostUri, this.nodeUri,
                                         laneUri, this.prio, this.rate, this.body,
                                         this.flags, this.keyForm, this.valueForm, this.observers);
  }

  @Override
  public MapDownlinkView prio(float prio) {
    return new JoinMapLaneDownlink(this.cellContext, this.stage, this.laneModel,
                                         this.key, this.meshUri, this.hostUri, this.nodeUri,
                                         this.laneUri, prio, this.rate, this.body,
                                         this.flags, this.keyForm, this.valueForm, this.observers);
  }

  @Override
  public MapDownlinkView rate(float rate) {
    return new JoinMapLaneDownlink(this.cellContext, this.stage, this.laneModel,
                                         this.key, this.meshUri, this.hostUri, this.nodeUri,
                                         this.laneUri, this.prio, rate, this.body,
                                         this.flags, this.keyForm, this.valueForm, this.observers);
  }

  @Override
  public MapDownlinkView body(Value body) {
    return new JoinMapLaneDownlink(this.cellContext, this.stage, this.laneModel,
                                         this.key, this.meshUri, this.hostUri, this.nodeUri,
                                         this.laneUri, this.prio, this.rate, body,
                                         this.flags, this.keyForm, this.valueForm, this.observers);
  }

  @Override
  public  MapDownlinkView keyForm(Form keyForm) {
    return new JoinMapLaneDownlink(this.cellContext, this.stage, this.laneModel,
                                          this.key, this.meshUri, this.hostUri, this.nodeUri,
                                          this.laneUri, this.prio, this.rate, this.body,
                                          this.flags, keyForm, this.valueForm,
                                          this.typesafeObservers(this.observers));
  }

  @Override
  public  MapDownlinkView valueForm(Form valueForm) {
    return new JoinMapLaneDownlink(this.cellContext, this.stage, this.laneModel,
                                          this.key, this.meshUri, this.hostUri, this.nodeUri,
                                          this.laneUri, this.prio, this.rate, this.body,
                                          this.flags, this.keyForm, valueForm,
                                          this.typesafeObservers(this.observers));
  }

  @Override
  public Value downlinkWillUpdateValue(Value key, Value newValue) {
    return newValue;
  }

  @Override
  public void downlinkDidUpdateValue(Value key, Value newValue, Value oldValue) {
    this.laneModel.put(this, key, newValue);
  }

  @Override
  public void downlinkWillRemoveValue(Value key) {
    // hook
  }

  @Override
  public void downlinkDidRemoveValue(Value key, Value oldValue) {
    this.laneModel.remove(this, key);
  }

  @Override
  public void downlinkWillDrop(int lower) {
    // hook
  }

  @Override
  public void downlinkDidDrop(int lower) {
    // hook
  }

  @Override
  public void downlinkWillTake(int upper) {
    // hook
  }

  @Override
  public void downlinkDidTake(int upper) {
    // hook
  }

  @Override
  public void downlinkWillClear() {
    // hook
  }

  @Override
  public void downlinkDidClear() {
    //this.laneModel.clear(this);
  }

  @Override
  public MapDownlinkView open() {
    this.laneModel.downlink(this.key, this);
    return this;
  }

  protected void openDownlink() {
    super.open();
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy