nus-yam/ex-repair huggingface dataset:
Program: 92255
Project: 92255
Buggy source:
/** 
 * Moves to the given position in the stream, relative to the stream position at construction time. If the given position is greater than the stream length, then the values of bytes between the previous stream length and the given position are unspecified. The limit is unchanged.
 * @param position The position where to move.
 * @throws IOException If the stream can not be moved to the given position.
 */
@Override public final void seek(final long position) throws IOException {
  long p=position - bufferOffset;
  if (p >= 0 && p <= buffer.capacity()) {
    if (p > buffer.limit()) {
      buffer.position(buffer.limit()).limit((int)p);
      clear();
    }
    buffer.position((int)p);
    clearBitOffset();
  }
 else   if (channel instanceof SeekableByteChannel) {
    flush();
    ((SeekableByteChannel)channel).position(channelOffset + position);
    bufferOffset=position;
  }
 else   if (p >= 0) {
    p-=buffer.limit();
    flush();
    if (p <= buffer.capacity()) {
      buffer.limit((int)p);
      clear();
      buffer.position((int)p);
    }
 else {
      buffer.clear();
      clear();
      do {
        if (channel.write(buffer) == 0) {
          onEmptyTransfer();
        }
        bufferOffset+=buffer.position();
        p-=buffer.position();
        buffer.rewind();
      }
 while (p > buffer.capacity());
      buffer.limit((int)p).position((int)p);
    }
  }
 else {
    throw new IOException(Errors.format(Errors.Keys.StreamIsForwardOnly_1,filename));
  }
}

Fixed version (ground truth):
/** 
 * Moves to the given position in the stream, relative to the stream position at construction time. If the given position is greater than the stream length, then the values of bytes between the previous stream length and the given position are unspecified. The limit is unchanged.
 * @param position The position where to move.
 * @throws IOException If the stream can not be moved to the given position.
 */
@Override public final void seek(final long position) throws IOException {
  long p=position - bufferOffset;
  if (p >= 0 && p <= buffer.limit()) {
    buffer.position((int)p);
    clearBitOffset();
  }
 else   if (channel instanceof SeekableByteChannel) {
    flush();
    ((SeekableByteChannel)channel).position(channelOffset + position);
    bufferOffset=position;
  }
 else   if (p >= 0) {
    p-=buffer.limit();
    flush();
    if (p <= buffer.capacity()) {
      buffer.limit((int)p);
      clear();
      buffer.position((int)p);
    }
 else {
      buffer.clear();
      clear();
      do {
        if (channel.write(buffer) == 0) {
          onEmptyTransfer();
        }
        bufferOffset+=buffer.position();
        p-=buffer.position();
        buffer.rewind();
      }
 while (p > buffer.capacity());
      buffer.limit((int)p).position((int)p);
    }
  }
 else {
    throw new IOException(Errors.format(Errors.Keys.StreamIsForwardOnly_1,filename));
  }
}
Program: 92256
Project: 92256
Buggy source:
/** 
 * Converts a date read from a XML stream to the object which will contains the value. JAXB calls automatically this method at unmarshalling time.
 * @param value The XML date, or {@code null}.
 * @return The {@code java.util} date, or {@code null.}
 */
@Override public Date unmarshal(final XMLGregorianCalendar value){
  return (value != null) ? XmlUtilities.toDate(Context.current(),value) : null;
}

Fixed version (ground truth):
/** 
 * Converts a date read from a XML stream to the object which will contains the value. JAXB calls automatically this method at unmarshalling time.
 * @param value The XML date, or {@code null}.
 * @return The {@code java.util} date, or {@code null}.
 */
@Override public Date unmarshal(final XMLGregorianCalendar value){
  return (value != null) ? XmlUtilities.toDate(Context.current(),value) : null;
}
Program: 92257
Project: 92257
Buggy source:
/** 
 * Converts the date to the object to be marshalled in a XML file or stream. JAXB calls automatically this method at marshalling time.
 * @param value The {@code java.util} date value, or {@code null.}
 * @return The XML date, or {@code null.}
 */
@Override public XMLGregorianCalendar marshal(final Date value){
  if (value != null) {
    final Context context=Context.current();
    try {
      final XMLGregorianCalendar gc=XmlUtilities.toXML(context,value);
      XmlUtilities.trimTime(gc,true);
      return gc;
    }
 catch (    DatatypeConfigurationException e) {
      Context.warningOccured(context,XmlAdapter.class,"String_Node_Str",e,true);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Converts the date to the object to be marshalled in a XML file or stream. JAXB calls automatically this method at marshalling time.
 * @param value The {@code java.util} date value, or {@code null}.
 * @return The XML date, or {@code null}.
 */
@Override public XMLGregorianCalendar marshal(final Date value){
  if (value != null) {
    final Context context=Context.current();
    try {
      final XMLGregorianCalendar gc=XmlUtilities.toXML(context,value);
      XmlUtilities.trimTime(gc,true);
      return gc;
    }
 catch (    DatatypeConfigurationException e) {
      Context.warningOccured(context,XmlAdapter.class,"String_Node_Str",e,true);
    }
  }
  return null;
}
Program: 92258
Project: 92258
Buggy source:
/** 
 * Converts a date read from a XML stream to the object which will contains the value. JAXB calls automatically this method at unmarshalling time.
 * @param value The XML date, or {@code null}.
 * @return The {@code java.util} date, or {@code null.}
 */
@Override public Date unmarshal(final XMLGregorianCalendar value){
  return (value != null) ? XmlUtilities.toDate(Context.current(),value) : null;
}

Fixed version (ground truth):
/** 
 * Converts a date read from a XML stream to the object which will contains the value. JAXB calls automatically this method at unmarshalling time.
 * @param value The XML date, or {@code null}.
 * @return The {@code java.util} date, or {@code null}.
 */
@Override public Date unmarshal(final XMLGregorianCalendar value){
  return (value != null) ? XmlUtilities.toDate(Context.current(),value) : null;
}
Program: 92259
Project: 92259
Buggy source:
/** 
 * Converts the date to the object to be marshalled in a XML file or stream. JAXB calls automatically this method at marshalling time.
 * @param value The {@code java.util} date value, or {@code null.}
 * @return The XML date, or {@code null.}
 */
@Override public XMLGregorianCalendar marshal(final Date value){
  if (value != null) {
    final GregorianCalendar calendar=new GregorianCalendar(UTC,Locale.ROOT);
    calendar.setTime(value);
    try {
      final XMLGregorianCalendar gc=getDatatypeFactory().newXMLGregorianCalendar(calendar);
      if (gc.getMillisecond() == 0) {
        gc.setMillisecond(DatatypeConstants.FIELD_UNDEFINED);
      }
      return gc;
    }
 catch (    DatatypeConfigurationException e) {
      Context.warningOccured(Context.current(),XmlAdapter.class,"String_Node_Str",e,true);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Converts the date to the object to be marshalled in a XML file or stream. JAXB calls automatically this method at marshalling time.
 * @param value The {@code java.util} date value, or {@code null}.
 * @return The XML date, or {@code null}.
 */
@Override public XMLGregorianCalendar marshal(final Date value){
  if (value != null) {
    final GregorianCalendar calendar=new GregorianCalendar(UTC,Locale.ROOT);
    calendar.setTime(value);
    try {
      final XMLGregorianCalendar gc=getDatatypeFactory().newXMLGregorianCalendar(calendar);
      if (gc.getMillisecond() == 0) {
        gc.setMillisecond(DatatypeConstants.FIELD_UNDEFINED);
      }
      return gc;
    }
 catch (    DatatypeConfigurationException e) {
      Context.warningOccured(Context.current(),XmlAdapter.class,"String_Node_Str",e,true);
    }
  }
  return null;
}
Program: 92261
Project: 92261
Buggy source:
/** 
 * Creates a descriptor for an array of   {@code double[] values.}
 * @param name         The parameter name.
 * @param minimumValue The minimum parameter value, or {@link Double#NEGATIVE_INFINITY} if none.
 * @param maximumValue The maximum parameter value, or {@link Double#POSITIVE_INFINITY} if none.
 * @param unit         The unit for minimum and maximum values.
 * @return The parameter descriptor for the given range of values.
 */
static DefaultParameterDescriptor<double[]> createForArray(final String name,final double minimumValue,final double maximumValue,final Unit<?> unit){
  final MeasurementRange<Double> valueDomain=MeasurementRange.create(minimumValue,true,maximumValue,true,unit);
  return new DefaultParameterDescriptor<>(properties(name),double[].class,valueDomain,null,null,true);
}

Fixed version (ground truth):
/** 
 * Creates a descriptor for an array of   {@code double[]} values.
 * @param name         The parameter name.
 * @param minimumValue The minimum parameter value, or {@link Double#NEGATIVE_INFINITY} if none.
 * @param maximumValue The maximum parameter value, or {@link Double#POSITIVE_INFINITY} if none.
 * @param unit         The unit for minimum and maximum values.
 * @return The parameter descriptor for the given range of values.
 */
static DefaultParameterDescriptor<double[]> createForArray(final String name,final double minimumValue,final double maximumValue,final Unit<?> unit){
  final MeasurementRange<Double> valueDomain=MeasurementRange.create(minimumValue,true,maximumValue,true,unit);
  return new DefaultParameterDescriptor<>(properties(name),double[].class,valueDomain,null,null,true);
}
Program: 92262
Project: 92262
Buggy source:
/** 
 * Creates a new daemon thread. This constructor sets the daemon flag to   {@code true}. <p>We need to maintain a list of daemon threads created by each SIS module in order to kill them at shutdown time (not strictly necessary for pure JSEE applications, but required in OSGi environment). Each module using   {@code DaemonThread} shall maintainits <strong>own</strong> list (don't use the list of another module), like below:</p> {@preformat java}class MyInternalClass  static DaemonThread lastCreatedDaemon; } class AnOtherClass { private static final MyDaemonThread; static { synchronized (MyInternalClass.class) { MyInternalClass.lastCreatedDaemon = myDaemonThread = new MyDaemonThread( "MyThread", MyInternalClass.lastCreatedDaemon); } } } See   {@link ReferenceQueueConsumer} for a real example.
 * @param name The thread name.
 * @param lastCreatedDaemon The previous element in a chain of {@code DaemonThread}s, or   {@code null}. Each SIS module shall maintain its own chain, if any.
 */
protected DaemonThread(final String name,final DaemonThread lastCreatedDaemon){
  super(Threads.DAEMONS,name);
  previous=lastCreatedDaemon;
  setDaemon(true);
}

Fixed version (ground truth):
/** 
 * Creates a new daemon thread. This constructor sets the daemon flag to   {@code true}. <p>We need to maintain a list of daemon threads created by each SIS module in order to kill them at shutdown time (not strictly necessary for pure JSEE applications, but required in OSGi environment). Each module using   {@code DaemonThread} shall maintainits <strong>own</strong> list (don't use the list of another module), like below:</p> {@preformat java}class MyInternalClass  static DaemonThread lastCreatedDaemon; } class AnOtherClass { private static final MyDaemonThread; static { synchronized (MyInternalClass.class) { MyInternalClass.lastCreatedDaemon = myDaemonThread = new MyDaemonThread( "MyThread", MyInternalClass.lastCreatedDaemon); } } } } See   {@link ReferenceQueueConsumer} for a real example.
 * @param name The thread name.
 * @param lastCreatedDaemon The previous element in a chain of {@code DaemonThread}s, or   {@code null}. Each SIS module shall maintain its own chain, if any.
 */
protected DaemonThread(final String name,final DaemonThread lastCreatedDaemon){
  super(Threads.DAEMONS,name);
  previous=lastCreatedDaemon;
  setDaemon(true);
}
Program: 92263
Project: 92263
Buggy source:
/** 
 * Sets this   {@code DoubleDouble} to the sum of the given numbers.<p>Source: [Hida & al.] page 4 algorithm 4, itself reproduced from [Shewchuk] page 314.</p>
 * @param a The first number to add.
 * @param b The second number to add.
 */
public void setToSum(final double a,final double b){
  value=a + b;
  final double v=value - a;
  error=(a - (value - v)) + (b - v);
  if (DISABLED)   error=0;
}

Fixed version (ground truth):
/** 
 * Sets this   {@code DoubleDouble} to the sum of the given numbers.<p>Source: [Hida &amp; al.] page 4 algorithm 4, itself reproduced from [Shewchuk] page 314.</p>
 * @param a The first number to add.
 * @param b The second number to add.
 */
public void setToSum(final double a,final double b){
  value=a + b;
  final double v=value - a;
  error=(a - (value - v)) + (b - v);
  if (DISABLED)   error=0;
}
Program: 92264
Project: 92264
Buggy source:
/** 
 * Sets this   {@code DoubleDouble} to the sum of the given numbers,to be used only when  {@code abs(a) >= abs(b)}. <p>Source: [Hida & al.] page 4 algorithm 3, itself reproduced from [Shewchuk] page 312.</p>
 * @param a The first number to add.
 * @param b The second number to add, which must be smaller than {@code a}.
 */
public void setToQuickSum(final double a,final double b){
  value=a + b;
  error=b - (value - a);
  if (DISABLED)   error=0;
}

Fixed version (ground truth):
/** 
 * Sets this   {@code DoubleDouble} to the sum of the given numbers,to be used only when  {@code abs(a) >= abs(b)}. <p>Source: [Hida &amp; al.] page 4 algorithm 3, itself reproduced from [Shewchuk] page 312.</p>
 * @param a The first number to add.
 * @param b The second number to add, which must be smaller than {@code a}.
 */
public void setToQuickSum(final double a,final double b){
  value=a + b;
  error=b - (value - a);
  if (DISABLED)   error=0;
}
Program: 92265
Project: 92265
Buggy source:
/** 
 * Sets this   {@code DoubleDouble} to the product of the given numbers.The given numbers shall not be greater than  {@value #MAX_VALUE} in magnitude.<p>Source: [Hida & al.] page 4 algorithm 6, itself reproduced from [Shewchuk] page 326.</p>
 * @param a The first number to multiply.
 * @param b The second number to multiply.
 */
public void setToProduct(final double a,final double b){
  value=a * b;
  double t=SPLIT * a;
  final double ahi=t - (t - a);
  final double alo=a - ahi;
  t=SPLIT * b;
  final double bhi=t - (t - b);
  final double blo=b - bhi;
  error=((ahi * bhi - value) + ahi * blo + alo * bhi) + alo * blo;
  if (DISABLED)   error=0;
}

Fixed version (ground truth):
/** 
 * Sets this   {@code DoubleDouble} to the product of the given numbers.The given numbers shall not be greater than  {@value #MAX_VALUE} in magnitude.<p>Source: [Hida &amp; al.] page 4 algorithm 6, itself reproduced from [Shewchuk] page 326.</p>
 * @param a The first number to multiply.
 * @param b The second number to multiply.
 */
public void setToProduct(final double a,final double b){
  value=a * b;
  double t=SPLIT * a;
  final double ahi=t - (t - a);
  final double alo=a - ahi;
  t=SPLIT * b;
  final double bhi=t - (t - b);
  final double blo=b - bhi;
  error=((ahi * bhi - value) + ahi * blo + alo * bhi) + alo * blo;
  if (DISABLED)   error=0;
}
Program: 92266
Project: 92266
Buggy source:
/** 
 * Finds the line separator used in the given character sequence portion, or returns  {@code null} if unknown. This method is designed for invocation at the beginningof  {@code append(CharSequence, ...), before the characters are effectively read.}
 */
final String lineSeparator(final CharSequence sequence,int start,final int end){
  if (isHighSurrogate()) {
    start++;
  }
  while (start < end) {
    final int c=Character.codePointAt(sequence,start);
    final int b=start;
    start+=Character.charCount(c);
    if (isLineOrParagraphSeparator(c)) {
      if (c == '\r' && (start < end) && sequence.charAt(start) == '\n') {
        start++;
      }
      return sequence.subSequence(b,start).toString();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Finds the line separator used in the given character sequence portion, or returns  {@code null} if unknown. This method is designed for invocation at the beginningof  {@code append(CharSequence, ...)}, before the characters are effectively read.
 */
final String lineSeparator(final CharSequence sequence,int start,final int end){
  if (isHighSurrogate()) {
    start++;
  }
  while (start < end) {
    final int c=Character.codePointAt(sequence,start);
    final int b=start;
    start+=Character.charCount(c);
    if (isLineOrParagraphSeparator(c)) {
      if (c == '\r' && (start < end) && sequence.charAt(start) == '\n') {
        start++;
      }
      return sequence.subSequence(b,start).toString();
    }
  }
  return null;
}
Program: 92268
Project: 92268
Buggy source:
/** 
 * Must be invoked by subclasses before a   {@code try} block performing a (un)marshallingoperation. Must be followed by a call to  {@code finish()} in a {@code finally} block.{@preformat javaContext context = begin();}try  ... } finally { context.finish(); } }
 * @see Context#finish();
 */
final Context begin(){
  return new Context(bitMasks,locale,timezone,schemas,gmlVersion,resolver,converter,warningListener);
}

Fixed version (ground truth):
/** 
 * Must be invoked by subclasses before a   {@code try} block performing a (un)marshallingoperation. Must be followed by a call to  {@code finish()} in a {@code finally} block.{@preformat javaContext context = begin();}try  ... } finally { context.finish(); } }
 * @see Context#finish()
 */
final Context begin(){
  return new Context(bitMasks,locale,timezone,schemas,gmlVersion,resolver,converter,warningListener);
}
Program: 92272
Project: 92272
Buggy source:
/** 
 * Tests   {@link RangeSet#add(Range)} using string values.
 */
@Test public void testRangeOfStrings(){
  final RangeSet<String> ranges=RangeSet.create(String.class,true,false);
  assertTrue(ranges.isEmpty());
  assertTrue(ranges.add("String_Node_Str","String_Node_Str"));
  assertEquals(1,ranges.size());
  checkContains(ranges,new Range<>(String.class,"String_Node_Str",true,"String_Node_Str",false),true,true);
  assertTrue(ranges.add("String_Node_Str","String_Node_Str"));
  assertEquals(1,ranges.size());
  checkContains(ranges,new Range<>(String.class,"String_Node_Str",true,"String_Node_Str",false),true,true);
  assertTrue(ranges.add("String_Node_Str","String_Node_Str"));
  assertEquals(2,ranges.size());
  final Iterator<Range<String>> it=ranges.iterator();
  assertEqual(new Range<>(String.class,"String_Node_Str",true,"String_Node_Str",false),it.next(),ranges.first());
  assertEqual(new Range<>(String.class,"String_Node_Str",true,"String_Node_Str",false),it.next(),ranges.last());
  assertFalse(it.hasNext());
}

Fixed version (ground truth):
/** 
 * Tests   {@link RangeSet#add(Range)} using string values.
 */
@Test public void testRangeOfStrings(){
  final RangeSet<String> ranges=RangeSet.create(String.class,true,false);
  assertTrue(ranges.isEmpty());
  assertTrue(ranges.add("String_Node_Str","String_Node_Str"));
  assertEquals(1,ranges.size());
  checkContains(ranges,new Range<>(String.class,"String_Node_Str",true,"String_Node_Str",false),true,true);
  assertTrue(ranges.add("String_Node_Str","String_Node_Str"));
  assertEquals(1,ranges.size());
  checkContains(ranges,new Range<>(String.class,"String_Node_Str",true,"String_Node_Str",false),true,true);
  assertTrue(ranges.add("String_Node_Str","String_Node_Str"));
  assertEquals(2,ranges.size());
  final Iterator<Range<String>> it=ranges.iterator();
  assertEqual(new Range<String>(String.class,"String_Node_Str",true,"String_Node_Str",false),it.next(),ranges.first());
  assertEqual(new Range<String>(String.class,"String_Node_Str",true,"String_Node_Str",false),it.next(),ranges.last());
  assertFalse(it.hasNext());
}
Program: 92273
Project: 92273
Buggy source:
/** 
 * Tests   {@link RangeSet#add(Range)} using date values.
 */
@Test public void testRangeOfDates(){
  final RangeSet<Date> ranges=RangeSet.create(Date.class,true,false);
  assertTrue(ranges.isEmpty());
  final long day=24 * 60 * 60* 1000L;
  final Date now=new Date();
  final Date yesterday=new Date(now.getTime() - day);
  assertTrue(ranges.add(yesterday,now));
  assertEquals(1,ranges.size());
  checkContains(ranges,new Range<>(Date.class,yesterday,true,now,false),true,true);
  final Date lastWeek=new Date(now.getTime() - 7 * day);
  final Date other=new Date(lastWeek.getTime() + 2 * day);
  assertTrue(ranges.add(new Range<>(Date.class,lastWeek,true,other,false)));
  assertEquals(2,ranges.size());
  final Iterator<Range<Date>> it=ranges.iterator();
  assertEqual(new Range<>(Date.class,lastWeek,true,other,false),it.next(),ranges.first());
  assertEqual(new Range<>(Date.class,yesterday,true,now,false),it.next(),ranges.last());
  assertFalse(it.hasNext());
}

Fixed version (ground truth):
/** 
 * Tests   {@link RangeSet#add(Range)} using date values.
 */
@Test public void testRangeOfDates(){
  final RangeSet<Date> ranges=RangeSet.create(Date.class,true,false);
  assertTrue(ranges.isEmpty());
  final long day=24 * 60 * 60* 1000L;
  final Date now=new Date();
  final Date yesterday=new Date(now.getTime() - day);
  assertTrue(ranges.add(yesterday,now));
  assertEquals(1,ranges.size());
  checkContains(ranges,new Range<>(Date.class,yesterday,true,now,false),true,true);
  final Date lastWeek=new Date(now.getTime() - 7 * day);
  final Date other=new Date(lastWeek.getTime() + 2 * day);
  assertTrue(ranges.add(new Range<>(Date.class,lastWeek,true,other,false)));
  assertEquals(2,ranges.size());
  final Iterator<Range<Date>> it=ranges.iterator();
  assertEqual(new Range<Date>(Date.class,lastWeek,true,other,false),it.next(),ranges.first());
  assertEqual(new Range<Date>(Date.class,yesterday,true,now,false),it.next(),ranges.last());
  assertFalse(it.hasNext());
}
Program: 92275
Project: 92275
Buggy source:
/** 
 * Creates the   {@code "metadata"} sub-command.
 */
MetadataSC(final int commandIndex,final String... args) throws InvalidOptionException {
  super(commandIndex,args,EnumSet.of(Option.FORMAT,Option.LOCALE,Option.TIMEZONE,Option.ENCODING,Option.HELP));
}

Fixed version (ground truth):
/** 
 * Creates the   {@code "metadata"} or {@code "crs"} sub-command.
 * @param isCRS {@code true} for the {@code "crs"} sub-command,or  {@code false} for the {@code "metadata"} sub-command.
 */
MetadataSC(final boolean isCRS,final int commandIndex,final String... args) throws InvalidOptionException {
  super(commandIndex,args,EnumSet.of(Option.FORMAT,Option.LOCALE,Option.TIMEZONE,Option.ENCODING,Option.COLORS,Option.HELP));
  this.isCRS=isCRS;
}
Program: 92277
Project: 92277
Buggy source:
/** 
 * Returns the domain of values with their unit of measurement (if any), or   {@code null} if none.The  {@code Range} object combines the {@linkplain #getValueClass() value class},  {@linkplain #getMinimumValue() minimum value} and {@link #getMaximumValue() maximum value}and whether these values are inclusive or inclusive. If the range is an instance of  {@link MeasurementRange}, then it contains also the   {@linkplain #getUnit() unit of measurement}. <div class="note"><b>API note:</b> If this method returns a non-null value, then its type is exactly  {@code Range<T>}. The   {@code <? extends T>} in this method signature is because range types need toextend  {@link Comparable}, while   {@code ParameterDescriptor<T>} does not have this requirement.</div>
 * @return The domain of values, or {@code null}.
 * @see Parameters#getValueDomain(ParameterDescriptor)
 */
public Range<? extends T> getValueDomain(){
  return valueDomain;
}

Fixed version (ground truth):
/** 
 * Returns the domain of values with their unit of measurement (if any), or   {@code null} if none.The  {@code Range} object combines the {@linkplain #getValueClass() value class},  {@linkplain #getMinimumValue() minimum value},   {@linkplain #getMaximumValue() maximum value}and whether these values are inclusive or inclusive. If the range is an instance of  {@link MeasurementRange}, then it contains also the   {@linkplain #getUnit() unit of measurement}. <div class="note"><b>API note:</b> If this method returns a non-null value, then its type is either exactly  {@code Range<T>}, or   {@code Range<E>} where {@code <E>} is the {@linkplain Class#getComponentType() componenttype} of {@code <T>} (using wrapper classes for primitive types).</div>
 * @return The domain of values, or {@code null}.
 * @see Parameters#getValueDomain(ParameterDescriptor)
 */
public final Range<?> getValueDomain(){
  return valueDomain;
}
Program: 92278
Project: 92278
Buggy source:
/** 
 * Returns the maximum parameter value. If there is no maximum value, or if maximum value is inappropriate for the   {@linkplain #getValueClass() value type}, then this method returns   {@code null}. <p>This is a convenience method for <code>  {@linkplain #getValueDomain()}.  {@linkplain Range#getMaxValue() getMaxValue()}</code>. Note that this method said nothing about whether the value is   {@linkplain Range#isMaxIncluded() inclusive}.</p>
 * @return The minimum parameter value (often an instance of {@link Double}), or   {@code null} if unbounded.
 */
@Override @SuppressWarnings("String_Node_Str") public Comparable<T> getMaximumValue(){
  return (valueDomain != null) ? (Comparable<T>)valueDomain.getMaxValue() : null;
}

Fixed version (ground truth):
/** 
 * Returns the maximum parameter value. If there is no maximum value, or if maximum value is inappropriate for the   {@linkplain #getValueClass() value type}, then this method returns   {@code null}. <p>This is a convenience method for <code>  {@linkplain #getValueDomain()}.  {@linkplain Range#getMaxValue() getMaxValue()}</code>. Note that this method said nothing about whether the value is   {@linkplain Range#isMaxIncluded() inclusive}.</p>
 * @return The minimum parameter value (often an instance of {@link Double}), or   {@code null} if unbounded.
 */
@Override @SuppressWarnings("String_Node_Str") public Comparable<T> getMaximumValue(){
  return (valueDomain != null && valueDomain.getElementType() == valueClass) ? (Comparable<T>)valueDomain.getMaxValue() : null;
}
Program: 92279
Project: 92279
Buggy source:
/** 
 * Returns the minimum parameter value. If there is no minimum value, or if minimum value is inappropriate for the   {@linkplain #getValueClass() value class}, then this method returns   {@code null}. <p>This is a convenience method for <code>  {@linkplain #getValueDomain()}.  {@linkplain Range#getMinValue() getMinValue()}</code>. Note that this method said nothing about whether the value is   {@linkplain Range#isMinIncluded() inclusive}.</p>
 * @return The minimum parameter value (often an instance of {@link Double}), or   {@code null} if unbounded.
 */
@Override @SuppressWarnings("String_Node_Str") public Comparable<T> getMinimumValue(){
  return (valueDomain != null) ? (Comparable<T>)valueDomain.getMinValue() : null;
}

Fixed version (ground truth):
/** 
 * Returns the minimum parameter value. If there is no minimum value, or if minimum value is inappropriate for the   {@linkplain #getValueClass() value class}, then this method returns   {@code null}. <p>This is a convenience method for <code>  {@linkplain #getValueDomain()}.  {@linkplain Range#getMinValue() getMinValue()}</code>. Note that this method said nothing about whether the value is   {@linkplain Range#isMinIncluded() inclusive}.</p>
 * @return The minimum parameter value (often an instance of {@link Double}), or   {@code null} if unbounded.
 */
@Override @SuppressWarnings("String_Node_Str") public Comparable<T> getMinimumValue(){
  return (valueDomain != null && valueDomain.getElementType() == valueClass) ? (Comparable<T>)valueDomain.getMinValue() : null;
}
Program: 92280
Project: 92280
Buggy source:
/** 
 * Sets the parameter value and its associated unit. If the given value is   {@code null}, then this parameter is set to the  {@linkplain DefaultParameterDescriptor#getDefaultValue() default value}. <p>Current implementation does not clone the given value. In particular, references to  {@code int[]} and {@code double[]} arrays are stored <cite>as-is</cite>.</p>{@section Implementation note for subclasses}This method is invoked by all setter methods in this class, thus providing a single point that subclasses can override if they want to perform more processing on the value before its storage, or to be notified about value changes.
 * @param value The parameter value, or {@code null} to restore the default.
 * @param unit  The unit associated to the new parameter value, or {@code null}.
 * @throws InvalidParameterValueException if the type of {@code value} is inappropriate for this parameter,or if the value is illegal for some other reason (for example the value is numeric and out of range).
 */
protected void setValue(final Object value,final Unit<?> unit) throws InvalidParameterValueException {
  this.value=Verifier.ensureValidValue(descriptor,value,unit);
  this.unit=unit;
}

Fixed version (ground truth):
/** 
 * Sets the parameter value and its associated unit. If the given value is   {@code null}, then this parameter is set to the  {@linkplain DefaultParameterDescriptor#getDefaultValue() default value}. <p>Current implementation does not clone the given value. In particular, references to  {@code int[]} and {@code double[]} arrays are stored <cite>as-is</cite>.</p>{@section Implementation note for subclasses}This method is invoked by all setter methods in this class, thus providing a single point that subclasses can override if they want to perform more processing on the value before its storage, or to be notified about value changes.
 * @param value The parameter value, or {@code null} to restore the default.
 * @param unit  The unit associated to the new parameter value, or {@code null}.
 * @throws InvalidParameterValueException if the type of {@code value} is inappropriate for this parameter,or if the value is illegal for some other reason (for example the value is numeric and out of range).
 */
@SuppressWarnings("String_Node_Str") protected void setValue(final Object value,final Unit<?> unit) throws InvalidParameterValueException {
  final T convertedValue=Verifier.ensureValidValue(descriptor,value,unit);
  if (value != null) {
    validate(convertedValue);
    this.value=(T)value;
  }
 else {
    this.value=descriptor.getDefaultValue();
  }
  this.unit=unit;
}
Program: 92281
Project: 92281
Buggy source:
/** 
 * Constructs an international string.
 */
public AbstractInternationalString(){
}

Fixed version (ground truth):
/** 
 * Constructs an international string.
 */
protected AbstractInternationalString(){
}
Program: 92283
Project: 92283
Buggy source:
/** 
 * Appends the name of the given object to the formatter.
 * @param object    The object from which to get the name.
 * @param formatter The formatter where to append the name.
 * @param type      The key of colors to apply if syntax colors are enabled.
 */
public static void appendName(final IdentifiedObject object,final Formatter formatter,final ElementKind type){
  String name=IdentifiedObjects.getName(object,formatter.getNameAuthority());
  if (name == null) {
    name=IdentifiedObjects.getName(object,null);
    if (name == null) {
      name=Vocabulary.getResources(formatter.getLocale()).getString(Vocabulary.Keys.Unnamed);
    }
  }
  formatter.append(name,type);
}

Fixed version (ground truth):
/** 
 * Appends the name of the given object to the formatter.
 * @param object    The object from which to get the name.
 * @param formatter The formatter where to append the name.
 * @param type      The key of colors to apply if syntax colors are enabled.
 */
public static void appendName(final IdentifiedObject object,final Formatter formatter,final ElementKind type){
  String name=IdentifiedObjects.getName(object,formatter.getNameAuthority());
  if (name == null) {
    name=IdentifiedObjects.getName(object,null);
    if (name == null) {
      name=Vocabulary.getResources(formatter.getLocale()).getString(Vocabulary.Keys.Unnamed);
    }
  }
  formatter.append(name,(type != null) ? type : ElementKind.NAME);
}
Program: 92284
Project: 92284
Buggy source:
/** 
 * A method which is common to both   {@code Marshaller} and {@code Unmarshaller}.
 */
public final Object getProperty(final String name) throws PropertyException {
switch (name) {
case XML.LOCALE:
    return locale;
case XML.TIMEZONE:
  return timezone;
case XML.SCHEMAS:
return schemas;
case XML.GML_VERSION:
return gmlVersion;
case XML.RESOLVER:
return resolver;
case XML.CONVERTER:
return converter;
case XML.WARNING_LISTENER:
return warningListener;
case XML.STRING_SUBSTITUTES:
{
int n=0;
final String[] substitutes=new String[4];
if ((bitMasks & Context.SUBSTITUTE_LANGUAGE) != 0) substitutes[n++]="String_Node_Str";
if ((bitMasks & Context.SUBSTITUTE_COUNTRY) != 0) substitutes[n++]="String_Node_Str";
if ((bitMasks & Context.SUBSTITUTE_FILENAME) != 0) substitutes[n++]="String_Node_Str";
if ((bitMasks & Context.SUBSTITUTE_MIMETYPE) != 0) substitutes[n++]="String_Node_Str";
return (n != 0) ? ArraysExt.resize(substitutes,n) : null;
}
case LegacyNamespaces.APPLY_NAMESPACE_REPLACEMENTS:
{
switch (applyNamespaceReplacements) {
case 1:
return Boolean.TRUE;
case 2:
return Boolean.FALSE;
default :
return null;
}
}
default :
{
return getStandardProperty(convertPropertyKey(name));
}
}
}

Fixed version (ground truth):
/** 
 * A method which is common to both   {@code Marshaller} and {@code Unmarshaller}.
 */
public final Object getProperty(final String name) throws PropertyException {
switch (name) {
case XML.LOCALE:
    return locale;
case XML.TIMEZONE:
  return timezone;
case XML.SCHEMAS:
return schemas;
case XML.GML_VERSION:
return gmlVersion;
case XML.RESOLVER:
return resolver;
case XML.CONVERTER:
return converter;
case XML.WARNING_LISTENER:
return warningListener;
case XML.STRING_SUBSTITUTES:
{
int n=0;
final String[] substitutes=new String[4];
if ((bitMasks & Context.SUBSTITUTE_LANGUAGE) != 0) substitutes[n++]="String_Node_Str";
if ((bitMasks & Context.SUBSTITUTE_COUNTRY) != 0) substitutes[n++]="String_Node_Str";
if ((bitMasks & Context.SUBSTITUTE_FILENAME) != 0) substitutes[n++]="String_Node_Str";
if ((bitMasks & Context.SUBSTITUTE_MIMETYPE) != 0) substitutes[n++]="String_Node_Str";
return (n != 0) ? ArraysExt.resize(substitutes,n) : null;
}
case LegacyNamespaces.APPLY_NAMESPACE_REPLACEMENTS:
{
switch (xmlnsReplaceCode) {
case 1:
return Boolean.TRUE;
case 2:
return Boolean.FALSE;
default :
return null;
}
}
default :
{
return getStandardProperty(convertPropertyKey(name));
}
}
}
Program: 92285
Project: 92285
Buggy source:
/** 
 * Returns the   {@code FilterVersion} enumeration value to use for the current GML version, or{@code null} if the SIS native version is suitable. If this method returns a non-null value,then the output generated by JAXB will need to go through a  {@link FilteredStreamWriter}in order to replace the namespace of the GML version implemented by SIS by the namespace of the GML version asked by the user.
 * @see FilteredNamespaces
 */
final FilterVersion getFilterVersion(){
switch (applyNamespaceReplacements) {
case 0:
{
      if (gmlVersion != null) {
        if (gmlVersion.compareTo(LegacyNamespaces.VERSION_3_2,2) < 0) {
          return FilterVersion.GML31;
        }
      }
      break;
    }
case 1:
{
    if ((bitMasks & Context.MARSHALLING) == 0) {
      return FilterVersion.ALL;
    }
    break;
  }
}
return null;
}

Fixed version (ground truth):
/** 
 * Returns the   {@code FilterVersion} enumeration value to use for the current GML version, or{@code null} if the SIS native version is suitable. If this method returns a non-null value,then the output generated by JAXB will need to go through a  {@link FilteredStreamWriter}in order to replace the namespace of the GML version implemented by SIS by the namespace of the GML version asked by the user.
 * @see FilteredNamespaces
 */
final FilterVersion getFilterVersion(){
switch (xmlnsReplaceCode) {
case 0:
{
      if (gmlVersion != null) {
        if (gmlVersion.compareTo(LegacyNamespaces.VERSION_3_2,2) < 0) {
          return FilterVersion.GML31;
        }
      }
      break;
    }
case 1:
{
    if ((bitMasks & Context.MARSHALLING) == 0) {
      return FilterVersion.ALL;
    }
    break;
  }
}
return null;
}
Program: 92287
Project: 92287
Buggy source:
/** 
 * Tests unmarshalling of Paris prime meridian.
 * @throws JAXBException If an error occurred during unmarshalling.
 */
@Test @DependsOnMethod({"String_Node_Str","String_Node_Str"}) public void testParisMeridian() throws JAXBException {
  final DefaultPrimeMeridian pm=unmarshall(DefaultPrimeMeridian.class,"String_Node_Str");
  assertIsParisMeridian(pm);
  assertEquals("String_Node_Str",2.33722917,pm.getGreenwichLongitude(NonSI.DEGREE_ANGLE),1E-12);
  assertEquals("String_Node_Str",pm.getRemarks().toString());
  assertNull("String_Node_Str",pm.getName().getCodeSpace());
  assertWktEquals(pm,"String_Node_Str");
  assertXmlEquals("String_Node_Str" + Namespaces.GML + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",marshal(pm),"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Tests unmarshalling of Paris prime meridian.
 * @throws JAXBException If an error occurred during unmarshalling.
 */
@Test @DependsOnMethod({"String_Node_Str","String_Node_Str"}) public void testParisMeridian() throws JAXBException {
  final DefaultPrimeMeridian pm=unmarshall(DefaultPrimeMeridian.class,"String_Node_Str");
  assertIsParisMeridian(pm);
  assertEquals("String_Node_Str",2.33722917,pm.getGreenwichLongitude(NonSI.DEGREE_ANGLE),1E-12);
  assertEquals("String_Node_Str",pm.getRemarks().toString());
  assertNull("String_Node_Str",pm.getName().getCodeSpace());
  assertWktEquals(pm,"String_Node_Str");
  assertXmlEquals("String_Node_Str" + Namespaces.GML + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",marshal(pm),"String_Node_Str");
}
Program: 92288
Project: 92288
Buggy source:
/** 
 * Tests marshalling in the default namespace.
 * @throws JAXBException If an error occurred during marshalling.
 */
@Test public void testMarshall() throws JAXBException {
  final DefaultPrimeMeridian pm=new DefaultPrimeMeridian(GREENWICH);
  assertXmlEquals(getGreenwichXml(Namespaces.GML),marshal(pm),"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Tests marshalling in the default namespace.
 * @throws JAXBException If an error occurred during marshalling.
 */
@Test public void testMarshall() throws JAXBException {
  final DefaultPrimeMeridian pm=new DefaultPrimeMeridian(GREENWICH);
  assertXmlEquals(getGreenwichXml(Namespaces.GML),marshal(pm),"String_Node_Str");
}
Program: 92289
Project: 92289
Buggy source:
/** 
 * Invoked by   {@link TestRunner} in order to flush the {@link #out} stream.The stream content will be flushed to the  {@linkplain System#console() console}if available, or to the   {@linkplain System#out standard output stream} otherwise.This method clears the stream buffer.
 * @param success {@code true} if this method is invoked on build success,
 */
static void flushOutput(){
  randomSeed=0;
  System.out.flush();
  System.err.flush();
synchronized (buffer) {
    out.flush();
    String content=buffer.toString();
    int length=content.length();
    do     if (length == 0)     return;
 while (Character.isWhitespace(content.charAt(--length)));
    content=content.substring(0,++length);
    PrintWriter writer=null;
    final String encoding=System.getProperty(OUTPUT_ENCODING_KEY);
    if (encoding == null) {
      final Console console=System.console();
      if (console != null) {
        writer=console.writer();
      }
    }
    if (writer == null) {
      if (encoding != null)       try {
        writer=new PrintWriter(new OutputStreamWriter(System.out,encoding));
      }
 catch (      UnsupportedEncodingException e) {
      }
      if (writer == null) {
        writer=new PrintWriter(System.out);
      }
    }
    writer.println(content);
    writer.flush();
    buffer.getBuffer().setLength(0);
  }
}

Fixed version (ground truth):
/** 
 * Invoked by   {@link TestRunner} in order to flush the {@link #out} stream.The stream content will be flushed to the  {@linkplain System#console() console}if available, or to the   {@linkplain System#out standard output stream} otherwise.This method clears the stream buffer.
 * @param success {@code true} if this method is invoked on build success,
 */
static void flushOutput(){
  System.out.flush();
  System.err.flush();
synchronized (buffer) {
    out.flush();
    String content=buffer.toString();
    int length=content.length();
    do     if (length == 0)     return;
 while (Character.isWhitespace(content.charAt(--length)));
    content=content.substring(0,++length);
    PrintWriter writer=null;
    final String encoding=System.getProperty(OUTPUT_ENCODING_KEY);
    if (encoding == null) {
      final Console console=System.console();
      if (console != null) {
        writer=console.writer();
      }
    }
    if (writer == null) {
      if (encoding != null)       try {
        writer=new PrintWriter(new OutputStreamWriter(System.out,encoding));
      }
 catch (      UnsupportedEncodingException e) {
      }
      if (writer == null) {
        writer=new PrintWriter(System.out);
      }
    }
    writer.println(content);
    writer.flush();
    buffer.getBuffer().setLength(0);
  }
}
Program: 92290
Project: 92290
Buggy source:
/** 
 * Prints output only in verbose mode. Otherwise silently discard the output.
 */
@Override public void testFinished(final Description description){
  if (TestCase.verbose) {
    TestCase.flushOutput();
  }
}

Fixed version (ground truth):
/** 
 * Prints output only in verbose mode. Otherwise silently discard the output. This method is invoked on failure as well as on success. In case of test failure, this method is invoked after   {@link #testFailure(Failure)}.
 */
@Override public void testFinished(final Description description){
  if (TestCase.verbose) {
    TestCase.flushOutput();
  }
  TestCase.randomSeed=0;
}
Program: 92291
Project: 92291
Buggy source:
/** 
 * Remember that a test failed, and prints output if it was not already done
 */
@Override public void testFailure(final Failure failure){
  final String methodName=failure.getDescription().getMethodName();
  addDependencyFailure(methodName);
  final long seed=TestCase.randomSeed;
  if (seed != 0) {
    final PrintWriter out=TestCase.out;
    out.print("String_Node_Str");
    out.print(methodName);
    out.print("String_Node_Str");
    out.print(seed);
    out.println('.');
  }
  if (!TestCase.verbose) {
    TestCase.flushOutput();
  }
}

Fixed version (ground truth):
/** 
 * Remember that a test failed, and prints output if it was not already done
 */
@Override public void testFailure(final Failure failure){
  final Description description=failure.getDescription();
  final String methodName=description.getMethodName();
  addDependencyFailure(methodName);
  final long seed=TestCase.randomSeed;
  if (seed != 0) {
    final String className=description.getClassName();
    final PrintWriter out=TestCase.out;
    out.print("String_Node_Str");
    out.print(className.substring(className.lastIndexOf('.') + 1));
    out.print('.');
    out.print(methodName);
    out.print("String_Node_Str");
    out.print(seed);
    out.println('.');
  }
  if (!TestCase.verbose) {
    TestCase.flushOutput();
  }
}
Program: 92292
Project: 92292
Buggy source:
/** 
 * Tests with a seconds fields.
 */
@Test @DependsOnMethod("String_Node_Str") public void testDegreeMinutesSeconds(){
  final AngleFormat f=new AngleFormat("String_Node_Str",Locale.CANADA);
  assertEquals(3,f.getMinimumFractionDigits());
  assertEquals(3,f.getMaximumFractionDigits());
  assertEquals("String_Node_Str",f.toPattern());
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(12.515625)));
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(-12.515625)));
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(-0.01)));
}

Fixed version (ground truth):
/** 
 * Tests with a seconds fields.
 */
@Test @DependsOnMethod("String_Node_Str") public void testDegreeMinutesSeconds(){
  final AngleFormat f=new AngleFormat("String_Node_Str",Locale.CANADA);
  assertEquals(3,f.getMinimumFractionDigits());
  assertEquals(3,f.getMaximumFractionDigits());
  assertEquals("String_Node_Str",f.toPattern());
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(12.515625)));
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(-12.515625)));
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(-0.01)));
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(89.01666666666667)));
}
Program: 92293
Project: 92293
Buggy source:
/** 
 * Tests with a minute fields.
 */
@Test @DependsOnMethod("String_Node_Str") public void testDegreeMinutes(){
  final AngleFormat f=new AngleFormat("String_Node_Str",Locale.CANADA);
  assertEquals(1,f.getMinimumFractionDigits());
  assertEquals(1,f.getMaximumFractionDigits());
  assertEquals("String_Node_Str",f.toPattern());
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(12.50)));
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(-10.25)));
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(-0.01)));
}

Fixed version (ground truth):
/** 
 * Tests with a minute fields.
 */
@Test @DependsOnMethod("String_Node_Str") public void testDegreeMinutes(){
  final AngleFormat f=new AngleFormat("String_Node_Str",Locale.CANADA);
  assertEquals(1,f.getMinimumFractionDigits());
  assertEquals(1,f.getMaximumFractionDigits());
  assertEquals("String_Node_Str",f.toPattern());
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(12.50)));
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(-10.25)));
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(-0.01)));
  assertEquals("String_Node_Str",formatAndParse(f,new Angle(89.01666666666667)));
}
Program: 92294
Project: 92294
Buggy source:
/** 
 * Tests the   {@link Angle#toString()} method.
 */
@Test public void testToString(){
  assertEquals("String_Node_Str",new Angle(45).toString());
  assertEquals("String_Node_Str",new Angle(45.5).toString());
  assertEquals("String_Node_Str",new Latitude(45.5).toString());
  assertEquals("String_Node_Str",new Longitude(45.5).toString());
  assertEquals("String_Node_Str",new Longitude(45.515625).toString());
  assertEquals("String_Node_Str",new Longitude(720).toString());
  assertEquals("String_Node_Str",new Latitude(-99).toString());
  assertEquals("String_Node_Str",new Angle(-361).toString());
  assertEquals("String_Node_Str",new Angle(1E-10).toString());
  assertEquals("String_Node_Str",new Latitude(1E-10).toString());
  assertEquals("String_Node_Str",new Longitude(-1E-10).toString());
}

Fixed version (ground truth):
/** 
 * Tests the   {@link Angle#toString()} method.
 */
@Test public void testToString(){
  assertEquals("String_Node_Str",new Angle(45).toString());
  assertEquals("String_Node_Str",new Angle(45.5).toString());
  assertEquals("String_Node_Str",new Latitude(45.5).toString());
  assertEquals("String_Node_Str",new Longitude(45.5).toString());
  assertEquals("String_Node_Str",new Longitude(45.515625).toString());
  assertEquals("String_Node_Str",new Latitude(89.01666666666667).toString());
  assertEquals("String_Node_Str",new Longitude(720).toString());
  assertEquals("String_Node_Str",new Latitude(-99).toString());
  assertEquals("String_Node_Str",new Angle(-361).toString());
  assertEquals("String_Node_Str",new Angle(1E-10).toString());
  assertEquals("String_Node_Str",new Latitude(1E-10).toString());
  assertEquals("String_Node_Str",new Longitude(-1E-10).toString());
}
Program: 92295
Project: 92295
Buggy source:
/** 
 * Sets the value of this matrix to its transpose.
 */
@Override public void transpose(){
  final short numRow=this.numRow;
  final short numCol=this.numCol;
  final double[] copy=elements.clone();
  int k=0;
  for (int j=0; j < numRow; j++) {
    for (int i=0; i < numCol; i++) {
      elements[i * numCol + j]=copy[k++];
    }
  }
  this.numRow=numCol;
  this.numCol=numRow;
}

Fixed version (ground truth):
/** 
 * Sets the value of this matrix to its transpose.
 */
@Override public void transpose(){
  final short numRow=this.numRow;
  final short numCol=this.numCol;
  final double[] copy=elements.clone();
  int k=0;
  for (int j=0; j < numRow; j++) {
    for (int i=0; i < numCol; i++) {
      elements[i * numRow + j]=copy[k++];
    }
  }
  this.numRow=numCol;
  this.numCol=numRow;
}