cascading.tuple.Tuple.isUnmodifiable()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中cascading.tuple.Tuple.isUnmodifiable()方法的一些代码示例,展示了Tuple.isUnmodifiable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tuple.isUnmodifiable()方法的具体详情如下:
包路径:cascading.tuple.Tuple
类名称:Tuple
方法名:isUnmodifiable

Tuple.isUnmodifiable介绍

[英]Field isUnmodifiable
[中]字段是不可修改的

代码示例

代码示例来源:origin: dataArtisans/cascading-flink

private Tuple getReuseOrNew(Tuple reuse) {
  if(reuse.isUnmodifiable()) {
    return Tuple.size(this.length);
  }
  else {
    return reuse;
  }
}

代码示例来源:origin: dataArtisans/cascading-flink

private Tuple getReuseOrNew(Tuple reuse, int arity) {

    if(reuse.isUnmodifiable() || reuse.size() != arity) {
      return Tuple.size(arity);
    }
    else {
      return reuse;
    }
  }
}

代码示例来源:origin: cwensel/cascading

/**
 * Method setTuple sets the tuple of this TupleEntry object, no copy will be performed.
 * <p>
 * If the given tuple is "unmodifiable" ({@code Tuple.isUnmodifiable() == true}) and this TupleEntry is
 * not "unmodifiable", an exception will be thrown.
 * <p>
 * Unmodifiable tuples are generally owned by the system and cannot be be changed and must not be cached.
 *
 * @param tuple the tuple of this TupleEntry object.
 */
public void setTuple( Tuple tuple )
 {
 if( !isUnmodifiable && tuple != null && tuple.isUnmodifiable() )
  throw new IllegalArgumentException( "current entry is modifiable but given tuple is not modifiable, make copy of given Tuple first" );
 if( tuple != null && isUnmodifiable )
  this.tuple = Tuples.asUnmodifiable( tuple );
 else
  this.tuple = tuple;
 setCoercions();
 }

代码示例来源:origin: cascading/cascading-platform

public void complete( FlowProcess flowProcess, AggregatorCall aggregatorCall )
 {
 if( !aggregatorCall.getGroup().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !aggregatorCall.getGroup().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 Tuple result = new Tuple( "some value" );
 aggregatorCall.getOutputCollector().add( result );
 if( result.isUnmodifiable() )
  throw new IllegalStateException( "is unmodifiable" );
 }
}

代码示例来源:origin: cwensel/cascading

public void complete( FlowProcess flowProcess, AggregatorCall aggregatorCall )
 {
 if( !aggregatorCall.getGroup().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !aggregatorCall.getGroup().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 Tuple result = new Tuple( "some value" );
 aggregatorCall.getOutputCollector().add( result );
 if( result.isUnmodifiable() )
  throw new IllegalStateException( "is unmodifiable" );
 }
}

代码示例来源:origin: cwensel/cascading

public void aggregate( FlowProcess flowProcess, AggregatorCall aggregatorCall )
 {
 if( !aggregatorCall.getGroup().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !aggregatorCall.getGroup().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !aggregatorCall.getArguments().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !aggregatorCall.getArguments().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 }

代码示例来源:origin: cwensel/cascading

public void start( FlowProcess flowProcess, AggregatorCall aggregatorCall )
 {
 if( !aggregatorCall.getGroup().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !aggregatorCall.getGroup().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 }

代码示例来源:origin: cwensel/cascading

public boolean isRemove( FlowProcess flowProcess, FilterCall filterCall )
 {
 if( !filterCall.getArguments().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !filterCall.getArguments().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 return false;
 }
}

代码示例来源:origin: cascading/cascading-platform

public boolean isRemove( FlowProcess flowProcess, FilterCall filterCall )
 {
 if( !filterCall.getArguments().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !filterCall.getArguments().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 return false;
 }
}

代码示例来源:origin: cascading/cascading-platform

public void start( FlowProcess flowProcess, AggregatorCall aggregatorCall )
 {
 if( !aggregatorCall.getGroup().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !aggregatorCall.getGroup().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 }

代码示例来源:origin: cascading/cascading-platform

public void aggregate( FlowProcess flowProcess, AggregatorCall aggregatorCall )
 {
 if( !aggregatorCall.getGroup().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !aggregatorCall.getGroup().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !aggregatorCall.getArguments().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !aggregatorCall.getArguments().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 }

代码示例来源:origin: cwensel/cascading

public void operate( FlowProcess flowProcess, FunctionCall functionCall )
 {
 if( !functionCall.getArguments().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !functionCall.getArguments().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 Tuple result = new Tuple( functionCall.getArguments().getTuple() );
 functionCall.getOutputCollector().add( result );
 if( result.isUnmodifiable() )
  throw new IllegalStateException( "is unmodifiable" );
 }
}

代码示例来源:origin: cwensel/cascading

public void operate( FlowProcess flowProcess, BufferCall bufferCall )
 {
 if( !bufferCall.getGroup().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !bufferCall.getGroup().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( bufferCall.getJoinerClosure() != null )
  throw new IllegalStateException( "joiner closure should be null" );
 Iterator<TupleEntry> iterator = bufferCall.getArgumentsIterator();
 while( iterator.hasNext() )
  {
  TupleEntry tupleEntry = iterator.next();
  if( !tupleEntry.isUnmodifiable() )
   throw new IllegalStateException( "is modifiable" );
  if( !tupleEntry.getTuple().isUnmodifiable() )
   throw new IllegalStateException( "is modifiable" );
  Tuple result = new Tuple( tupleEntry.getTuple() );
  bufferCall.getOutputCollector().add( result );
  if( result.isUnmodifiable() )
   throw new IllegalStateException( "is unmodifiable" );
  }
 }
}

代码示例来源:origin: cascading/cascading-platform

public void operate( FlowProcess flowProcess, FunctionCall functionCall )
 {
 if( !functionCall.getArguments().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !functionCall.getArguments().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 Tuple result = new Tuple( functionCall.getArguments().getTuple() );
 functionCall.getOutputCollector().add( result );
 if( result.isUnmodifiable() )
  throw new IllegalStateException( "is unmodifiable" );
 }
}

代码示例来源:origin: cascading/cascading-platform

public void operate( FlowProcess flowProcess, BufferCall bufferCall )
 {
 if( !bufferCall.getGroup().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( !bufferCall.getGroup().getTuple().isUnmodifiable() )
  throw new IllegalStateException( "is modifiable" );
 if( bufferCall.getJoinerClosure() != null )
  throw new IllegalStateException( "joiner closure should be null" );
 Iterator<TupleEntry> iterator = bufferCall.getArgumentsIterator();
 while( iterator.hasNext() )
  {
  TupleEntry tupleEntry = iterator.next();
  if( !tupleEntry.isUnmodifiable() )
   throw new IllegalStateException( "is modifiable" );
  if( !tupleEntry.getTuple().isUnmodifiable() )
   throw new IllegalStateException( "is modifiable" );
  Tuple result = new Tuple( tupleEntry.getTuple() );
  bufferCall.getOutputCollector().add( result );
  if( result.isUnmodifiable() )
   throw new IllegalStateException( "is unmodifiable" );
  }
 }
}

代码示例来源:origin: cwensel/cascading

/**
 * Method add inserts the given {@link Tuple} into the outgoing stream.
 * <p>
 * See {@link cascading.tuple.TupleEntryCollector} on when and how to re-use a Tuple instance.
 *
 * @param tuple of type Tuple
 */
public void add( Tuple tuple )
 {
 if( !tupleEntry.getFields().isUnknown() && tupleEntry.getFields().size() != tuple.size() )
  throw new TupleException( "operation added the wrong number of fields, expected: " + tupleEntry.getFields().print() + ", got result size: " + tuple.size() );
 boolean isUnmodifiable = tuple.isUnmodifiable();
 tupleEntry.setTuple( tuple );
 try
  {
  safeCollect( tupleEntry );
  }
 finally
  {
  Tuples.setUnmodifiable( tuple, isUnmodifiable );
  }
 }

相关文章