Skip to content

Commit

Permalink
Update to code consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik1 committed Dec 2, 2016
1 parent ff27890 commit 9f7ddd1
Show file tree
Hide file tree
Showing 11 changed files with 2,116 additions and 2,081 deletions.
487 changes: 266 additions & 221 deletions src/main/java/org/jboss/staxmapper/FixedXMLStreamReader.java

Large diffs are not rendered by default.

1,028 changes: 500 additions & 528 deletions src/main/java/org/jboss/staxmapper/FormattingXMLStreamWriter.java

Large diffs are not rendered by default.

93 changes: 47 additions & 46 deletions src/main/java/org/jboss/staxmapper/Spliterable.java
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2010, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.staxmapper;

import java.util.Iterator;

/**
* @author <a href="mailto:[email protected]">David M. Lloyd</a>
*/
final class Spliterable implements Iterable<String> {
private final String subject;
private final char delimiter;

Spliterable(final String subject, final char delimiter) {
this.subject = subject;
this.delimiter = delimiter;
}

static Spliterable over(String subject, char delimiter) {
return new Spliterable(subject, delimiter);
}

public Iterator<String> iterator() {
return new Spliterator(subject, delimiter);
}
}
/*
* JBoss, Home of Professional Open Source.
* Copyright 2010, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.staxmapper;

import java.util.Iterator;

/**
* @author <a href="mailto:[email protected]">David M. Lloyd</a>
*/
final class Spliterable implements Iterable<String> {
private final String subject;
private final char delimiter;

Spliterable(final String subject, final char delimiter) {
this.subject = subject;
this.delimiter = delimiter;
}

static Spliterable over(String subject, char delimiter) {
return new Spliterable(subject, delimiter);
}

@Override
public Iterator<String> iterator() {
return new Spliterator(subject, delimiter);
}
}
135 changes: 69 additions & 66 deletions src/main/java/org/jboss/staxmapper/Spliterator.java
Original file line number Diff line number Diff line change
@@ -1,66 +1,69 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2010, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.staxmapper;

import java.util.Iterator;
import java.util.NoSuchElementException;

/**
* @author <a href="mailto:[email protected]">David M. Lloyd</a>
*/
final class Spliterator implements Iterator<String> {
private final String subject;
private final char delimiter;
private int i;

Spliterator(final String subject, final char delimiter) {
this.subject = subject;
this.delimiter = delimiter;
i = 0;
}

static Spliterator over(String subject, char delimiter) {
return new Spliterator(subject, delimiter);
}

public boolean hasNext() {
return i != -1;
}

public String next() {
final int i = this.i;
if (i == -1) {
throw new NoSuchElementException();
}
int n = subject.indexOf(delimiter, i);
try {
return n == -1 ? subject.substring(i) : subject.substring(i, n);
} finally {
this.i = n == -1 ? -1 : n + 1;
}
}

public void remove() {
throw new UnsupportedOperationException();
}
}
/*
* JBoss, Home of Professional Open Source.
* Copyright 2010, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.staxmapper;

import java.util.Iterator;
import java.util.NoSuchElementException;

/**
* @author <a href="mailto:[email protected]">David M. Lloyd</a>
*/
final class Spliterator implements Iterator<String> {
private final String subject;
private final char delimiter;
private int i;

Spliterator(final String subject, final char delimiter) {
this.subject = subject;
this.delimiter = delimiter;
i = 0;
}

static Spliterator over(String subject, char delimiter) {
return new Spliterator(subject, delimiter);
}

@Override
public boolean hasNext() {
return i != -1;
}

@Override
public String next() {
final int i = this.i;
if (i == -1) {
throw new NoSuchElementException();
}
int n = subject.indexOf(delimiter, i);
try {
return n == -1 ? subject.substring(i) : subject.substring(i, n);
} finally {
this.i = n == -1 ? -1 : n + 1;
}
}

@Override
public void remove() {
throw new UnsupportedOperationException();
}
}
Loading

0 comments on commit 9f7ddd1

Please sign in to comment.