Merge branch 'racecommittee_integrated' of

ssh://armin@sapsailing.com/home/trac/git into racecommittee_integrated

Conflicts:
	java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/AbstractSimpleLeaderboardImpl.java
This commit is contained in:
Armin Zamani committed 2013-04-11 00:28:12 +02:00
commit b501d1ca6f
2382 files changed
+1283491 -1283408

No files matched your search

+22 -22
View File
@@ -1,22 +1,22 @@
/target
build.log
.metadata
*.class
*.swp
*~
manifest.txt
java/com.sap.sailing.gwt.ui/gwt-unitCache/*
java/com.sap.sailing.gwt.ui/war/WEB-INF/deploy/*
sailing_debug0*
/java/.settings/org.eclipse.jdt.core.prefs
/mobile/com.sap.sailing.racecommittee.app/.settings/org.eclipse.jdt.core.prefs
/mobile/com.sap.sailing.racecommittee.app/bin/*
/mobile/com.sap.sailing.racecommittee.app/gen/*
/mobile/com.sap.sailing.racecommittee.glue/.settings/org.eclipse.jdt.core.prefs
/mobile/com.sap.sailing.racecommittee.glue/bin/*
/mobile/com.sap.sailing.racecommittee.glue/gen/*
/mobile/com.sap.sailing.racecommittee.glue/bin
/mobile/com.sap.sailing.racecommittee.glue/gen
/mobile/com.sap.sailing.racecommittee.glue/bin/com.sap.sailing.racecommittee.glue.jar
/mobile/com.sap.sailing.racecommittee.glue/bin/jarlist.cache
/java/com.sap.sailing.server.gateway.serialization.test/.settings/*.prefs
/target
build.log
.metadata
*.class
*.swp
*~
manifest.txt
java/com.sap.sailing.gwt.ui/gwt-unitCache/*
java/com.sap.sailing.gwt.ui/war/WEB-INF/deploy/*
sailing_debug0*
/java/.settings/org.eclipse.jdt.core.prefs
/mobile/com.sap.sailing.racecommittee.app/.settings/org.eclipse.jdt.core.prefs
/mobile/com.sap.sailing.racecommittee.app/bin/*
/mobile/com.sap.sailing.racecommittee.app/gen/*
/mobile/com.sap.sailing.racecommittee.glue/.settings/org.eclipse.jdt.core.prefs
/mobile/com.sap.sailing.racecommittee.glue/bin/*
/mobile/com.sap.sailing.racecommittee.glue/gen/*
/mobile/com.sap.sailing.racecommittee.glue/bin
/mobile/com.sap.sailing.racecommittee.glue/gen
/mobile/com.sap.sailing.racecommittee.glue/bin/com.sap.sailing.racecommittee.glue.jar
/mobile/com.sap.sailing.racecommittee.glue/bin/jarlist.cache
/java/com.sap.sailing.server.gateway.serialization.test/.settings/*.prefs
+11 -11
View File
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>sailing</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>sailing</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
+42 -42
View File
@@ -1,42 +1,42 @@
Installing GWT and related stuff:
---------------------------------
Add http://dl.google.com/eclipse/plugin/3.7 as update site to your Eclipse Indigo.
Ensure that you have your proxy settings activated when installing from within the
SAP network and if necessary "Reload" the default Indigo and GWT update sites to
ensure all necessary features are found.
Create a sample project using "File - New - Project" and choose Google / Web Application.
The resulting project can be "Run As"ed using "Web Application" as launcher. This
pops up your default browser (e.g., Firefox), perhaps asking the user to install a
missing GWT plugin.
I wrapped the GWT JARs in a separate com.google.gwt.osgi bundle, exporting all but
the javax.servlet packages, as described in http://wiki.eclipse.org/Google_Web_Toolkit_and_Equinox.
I had to explicitly add the javax.servlet dependency to the new com.google.gwt.osgi bundle.
Otherwise, the cast of the GreetingsServletImpl to an HttpServlet would have been
unsuccessful.
Adjust the servlet URL alias in plugin.xml such that it corresponds to
/<application-name>/<service-name>. The <service-name> is usually specified
using a @RemoteServiceRelativePath annotation, such as
@RemoteServiceRelativePath("greet")
No GWT path library in the Eclipse project settings seems to be required to make
the project GWT-compilable and executable within an OSGi container with Jetty
support.
Next, create a new "Web Application" launch configuration, specifying in the "Server"
tab to not "Run built-in server." Instead, the running OSGi container's Jetty with the
registered servlet will be used. In the "GWT" tab I chose "Automatically select an unused
port" instead of providing a fixed Code Server Port.
With this, when I launch the new Web Application configuration, my Firefox opens,
e.g., with the URL http://127.0.0.1:8888/Com_sap_sailing_gwt_ui.html?gwt.codesvr=127.0.0.1:56824
and displays the web app. I can set breakpoints in the client part as well as in the servlet.
When you want to compile mulitple GWT modules in one project in one go, the GWT library
has to be on the project's build path and has to be the first in the Order and Exports tab.
See also http://arrogantprogrammer.blogspot.com/2010/04/projects-using-gwt-15-or-lower-may-only.html.
Installing GWT and related stuff:
---------------------------------
Add http://dl.google.com/eclipse/plugin/3.7 as update site to your Eclipse Indigo.
Ensure that you have your proxy settings activated when installing from within the
SAP network and if necessary "Reload" the default Indigo and GWT update sites to
ensure all necessary features are found.
Create a sample project using "File - New - Project" and choose Google / Web Application.
The resulting project can be "Run As"ed using "Web Application" as launcher. This
pops up your default browser (e.g., Firefox), perhaps asking the user to install a
missing GWT plugin.
I wrapped the GWT JARs in a separate com.google.gwt.osgi bundle, exporting all but
the javax.servlet packages, as described in http://wiki.eclipse.org/Google_Web_Toolkit_and_Equinox.
I had to explicitly add the javax.servlet dependency to the new com.google.gwt.osgi bundle.
Otherwise, the cast of the GreetingsServletImpl to an HttpServlet would have been
unsuccessful.
Adjust the servlet URL alias in plugin.xml such that it corresponds to
/<application-name>/<service-name>. The <service-name> is usually specified
using a @RemoteServiceRelativePath annotation, such as
@RemoteServiceRelativePath("greet")
No GWT path library in the Eclipse project settings seems to be required to make
the project GWT-compilable and executable within an OSGi container with Jetty
support.
Next, create a new "Web Application" launch configuration, specifying in the "Server"
tab to not "Run built-in server." Instead, the running OSGi container's Jetty with the
registered servlet will be used. In the "GWT" tab I chose "Automatically select an unused
port" instead of providing a fixed Code Server Port.
With this, when I launch the new Web Application configuration, my Firefox opens,
e.g., with the URL http://127.0.0.1:8888/Com_sap_sailing_gwt_ui.html?gwt.codesvr=127.0.0.1:56824
and displays the web app. I can set breakpoints in the client part as well as in the servlet.
When you want to compile mulitple GWT modules in one project in one go, the GWT library
has to be on the project's build path and has to be the first in the Order and Exports tab.
See also http://arrogantprogrammer.blogspot.com/2010/04/projects-using-gwt-15-or-lower-may-only.html.
+307 -307
View File
@@ -1,307 +1,307 @@
#!/bin/bash
set -o functrace
find_project_home ()
{
if [[ $1 == '/' ]] || [[ $1 == "" ]]; then
echo ""
return 0
fi
if [ ! -d "$1/.git" ]; then
PARENT_DIR=`cd $1/..;pwd`
echo $(find_project_home $PARENT_DIR)
return 0
fi
echo $1 | sed -e 's/\/cygdrive\/\([a-zA-Z]\)/\1:/'
}
# this holds for default installation
USER_HOME=~
START_DIR=`pwd`
if [ "$PROJECT_HOME" = "" ]; then
PROJECT_HOME=$(find_project_home $START_DIR)
fi
# if project_home is still empty we could not determine any suitable directory
if [[ $PROJECT_HOME == "" ]]; then
echo "Could neither determine nor get PROJECT_HOME. Please provide it by setting an environment variable with this name."
exit
fi
if [ "$SERVERS_HOME" = "" ]; then
SERVERS_HOME=`echo "$USER_HOME/servers" | sed -e 's/\/cygdrive\/\([a-zA-Z]\)/\1:/'`
fi
# x86 or x86_64 should work for most cases
ARCH=x86_64
START_DIR=`pwd`
# needed for maven on sapsailing.com to work correctly
if [ -f $USER_HOME/.bash_profile ]; then
source $USER_HOME/.bash_profile
fi
cd $PROJECT_HOME
active_branch=$(git symbolic-ref -q HEAD)
active_branch=`basename $active_branch`
ACDIR=$SERVERS_HOME/$active_branch
MAVEN_SETTINGS=$PROJECT_HOME/configuration/maven-settings.xml
MAVEN_SETTINGS_PROXY=$PROJECT_HOME/configuration/maven-settings-proxy.xml
p2PluginRepository=$PROJECT_HOME/java/com.sap.sailing.feature.p2build/bin/products/raceanalysis.product.id/linux/gtk/$ARCH
gwtcompile=1
testing=1
clean="clean"
offline=0
proxy=0
extra=''
if [ $# -eq 0 ]; then
echo "buildAndUpdateProduct [-g -t -o -c -m <config> -n <package> -l <port>] [build|install|all|hot-deploy]"
echo ""
echo "-g Disable GWT compile, no gwt files will be generated, old ones will be preserved."
echo "-t Disable tests"
echo "-o Enable offline mode (does not work for tycho surefire plugin)"
echo "-c Disable cleaning (use only if you are sure that no java file has changed)"
echo "-p Enable proxy mode (overwrites file specified by -m)"
echo "-m <path to file> Specify alternate maven configuration (possibly has side effect on proxy setting)"
echo "-n <package name> Name of the bundle you want to hot deploy. Needs fully qualified name like"
echo " com.sap.sailing.monitoring. Only works if there is a fully built server available."
echo "-l <telnet port> Telnet port the OSGi server is running. Optional but enables fully automatic hot-deploy."
echo ""
echo "build: builds the server code using Maven to $PROJECT_HOME (log to $START_DIR/build.log)"
echo "install: installs product and configuration to $SERVERS_HOME/$active_branch. Overwrites any configuration by using config from branch."
echo "all: calls build and then install"
echo "hot-deploy: performs hot deployment of named bundle into OSGi server"
echo ""
echo "Active branch is $active_branch"
echo "Project home is $PROJECT_HOME"
echo "Server home is $SERVERS_HOME"
echo "P2 home is $p2PluginRepository"
exit 2
fi
echo PROJECT_HOME is $PROJECT_HOME
echo SERVERS_HOME is $SERVERS_HOME
options=':gtocpm:n:l:'
while getopts $options option
do
case $option in
g) gwtcompile=0;;
t) testing=0;;
o) offline=1;;
c) clean="";;
p) proxy=1;;
m) MAVEN_SETTINGS=$OPTARG;;
n) OSGI_BUNDLE_NAME=$OPTARG;;
l) OSGI_TELNET_PORT=$OPTARG;;
\?) echo "Invalid option"
exit 2;;
esac
done
shift $((OPTIND-1))
if [[ $@ == "" ]]; then
echo "You need to specify an action [build|install|all|hot-deploy]"
exit 2
fi
if [[ "$@" == "hot-deploy" ]]; then
# check parameters
if [[ $OSGI_BUNDLE_NAME == "" ]]; then
echo "You need to provide -n parameter with bundle name."
exit 1
fi
# locate old bundle
BUNDLE_COUNT=`find $SERVERS_HOME/$active_branch/plugins -maxdepth 1 -name "${OSGI_BUNDLE_NAME}_*.jar" | wc -l`
OLD_BUNDLE=`find $SERVERS_HOME/$active_branch/plugins -maxdepth 1 -name "${OSGI_BUNDLE_NAME}_*.jar"`
if [[ $OLD_BUNDLE == "" ]] || [[ $BUNDLE_COUNT -ne 1 ]]; then
echo "ERROR: Could not find any bundle named $OSGI_BUNDLE_NAME ($BUNDLE_COUNT). Perhaps your name is misspelled or you have no build?"
exit
fi
OLD_BUNDLE_BASENAME=`basename $OLD_BUNDLE .jar`
OLD_BUNDLE_VERSION=${OLD_BUNDLE_BASENAME#*_}
echo "OLD bundle is $OSGI_BUNDLE_NAME with version $OLD_BUNDLE_VERSION"
# locate new bundle
NEW_BUNDLE=`find $p2PluginRepository/plugins -maxdepth 1 -name "${OSGI_BUNDLE_NAME}_*.jar"`
NEW_BUNDLE_BASENAME=`basename $NEW_BUNDLE .jar`
NEW_BUNDLE_VERSION=${NEW_BUNDLE_BASENAME#*_}
echo "NEW bundle is $OSGI_BUNDLE_NAME with version $NEW_BUNDLE_VERSION"
if [[ $NEW_BUNDLE_VERSION == $OLD_BUNDLE_VERSION ]]; then
echo ""
echo "WARNING: Bundle versions do not differ. Update not needed."
fi
read -s -n1 -p "Do you really want to hot-deploy bundle $OSGI_BUNDLE_NAME to $PROJECT_HOME/$active_branch? (y/N): " answer
case $answer in
"Y" | "y") echo "Continuing";;
*) echo "Aborting..."
exit;;
esac
# deploy new bundle physically
mkdir -p $SERVERS_HOME/$active_branch/plugins/deploy
cp $NEW_BUNDLE $SERVERS_HOME/$active_branch/plugins/deploy
echo "Copied ${NEW_BUNDLE_BASENAME}.jar to $SERVERS_HOME/$active_branch/plugins/deploy"
# check telnet port connection
TELNET_ACTIVE=`netstat -tlnp 2>/dev/null | grep ":$OSGI_TELNET_PORT"`
if [[ $OSGI_TELNET_PORT == "" ]] || [[ $TELNET_ACTIVE == "" ]]; then
echo ""
echo "ERROR: Could not find any process running on port $OSGI_TELNET_PORT. Make sure your server has been started with -console $OSGI_TELNET_PORT"
echo "I've already deployed bundle to $SERVERS_HOME/$active_branch/plugins/deploy/${NEW_BUNDLE_BASENAME}.jar"
echo "You can now install it yourself by issuing the following commands:"
echo ""
echo "osgi> ss $OSGI_BUNDLE_NAME"
echo "21 ACTIVE $OLD_BUNDLE_BASENAME"
echo "osgi> stop 21"
echo "osgi> uninstall 21"
echo "osgi> install file://$SERVERS_HOME/$active_branch/plugins/deploy/${NEW_BUNDLE_BASENAME}.jar"
echo "osgi> ss $OSGI_BUNDLE_NAME"
echo "71 INSTALLED $NEW_BUNDLE_BASENAME"
echo "osgi> start 71"
exit
fi
# first get bundle ID
NC_CMD="nc -t 127.0.0.1 $OSGI_TELNET_PORT"
OLD_BUNDLE_INFORMATION=`echo -n ss | $NC_CMD | grep $OSGI_BUNDLE_NAME`
BUNDLE_ID=`echo $OLD_BUNDLE_INFORMATION | cut -d " " -f 1`
OLD_ACTIVATED_NAME=`echo $OLD_BUNDLE_INFORMATION | cut -d " " -f 3`
echo "Could identify bundle-id $BUNDLE_ID for $OLD_ACTIVATED_NAME"
# stop and uninstall
echo -n stop $BUNDLE_ID | $NC_CMD > /dev/null
echo -n uninstall $BUNDLE_ID | $NC_CMD > /dev/null
# make sure bundle is removed
UNINSTALL_INFORMATION=`echo -n ss | $NC_CMD | grep $OSGI_BUNDLE_NAME`
if [[ $UNINSTALL_INFORMATION == "" ]]; then
echo "Uninstall procedure sucessful!"
else
echo "Something went wrong during uninstall. Please check error logs."
exit
fi
# now reinstall bundle
NEW_BUNDLE_ID=`echo -n install file://$SERVERS_HOME/$active_branch/plugins/deploy/${NEW_BUNDLE_BASENAME}.jar | $NC_CMD`
NEW_BUNDLE_INFORMATION=`echo -n ss | $NC_CMD | grep $OSGI_BUNDLE_NAME`
NEW_BUNDLE_ID=`echo $NEW_BUNDLE_INFORMATION | cut -d " " -f 1`
echo "Installed new bundle file://$SERVERS_HOME/$active_branch/plugins/deploy/${NEW_BUNDLE_BASENAME}.jar with id $NEW_BUNDLE_ID"
# and start
echo -n start $NEW_BUNDLE_ID | $NC_CMD > /dev/null && sleep 1
NEW_BUNDLE_STATUS=`echo -n ss | $NC_CMD | grep $OSGI_BUNDLE_NAME | grep ACTIVE`
if [[ $NEW_BUNDLE_STATUS == "" ]]; then
echo "ERROR: Something went wrong with start of bundle. Please check if everything went ok."
exit
fi
echo "Everything seems to be ok. Bundle hot-deployed to server with new id $NEW_BUNDLE_ID"
exit
fi
echo "Starting $@ of server (maven configuration set to $MAVEN_SETTINGS)..."
if [[ "$@" == "build" ]] || [[ "$@" == "all" ]]; then
# yield build so that we get updated product
cd $PROJECT_HOME/java
if [ $gwtcompile -eq 1 ]; then
echo "INFO: Compiling GWT (rm -rf com.sap.sailing.gwt.ui/com.sap.sailing.*)"
rm -rf com.sap.sailing.gwt.ui/com.sap.sailing.*
else
echo "INFO: GWT Compilation disabled"
extra="-Pdebug.no-gwt-compile"
fi
if [ $testing -eq 0 ]; then
echo "INFO: Skipping tests"
extra="$extra -Dmaven.test.skip=true"
fi
if [ $offline -eq 1 ]; then
echo "INFO: Activating offline mode"
extra="$extra -o"
fi
if [ $proxy -eq 1 ]; then
echo "INFO: Activating proxy profile"
extra="$extra -P no-debug.with-proxy"
MAVEN_SETTINGS=$MAVEN_SETTINGS_PROXY
else
extra="$extra -P no-debug.without-proxy"
fi
echo "Using following command: mvn $extra -fae -s $MAVEN_SETTINGS $clean install"
mvn $extra -fae -s $MAVEN_SETTINGS $clean install 2>&1 | tee $START_DIR/build.log
echo "Build complete. Do not forget to install product..."
fi
if [[ "$@" == "install" ]] || [[ "$@" == "all" ]]; then
read -s -n1 -p "Currently branch $active_branch is active and I will deploy to $ACDIR. Do you want to proceed with $@ (y/N): " answer
case $answer in
"Y" | "y") echo "Continuing";;
*) echo "Aborting..."
exit;;
esac
if [ ! -d $ACDIR ]; then
echo "Could not find directory $ACDIR - perhaps you are on a wrong branch?"
exit
fi
if [ ! -d "$ACDIR/plugins" ]; then
mkdir $ACDIR/plugins
fi
if [ ! -d "$ACDIR/configuration" ]; then
mkdir $ACDIR/configuration
fi
# seems that initial scripts not there
if [ ! -f "$ACDIR/start" ]; then
cp -v $PROJECT_HOME/java/target/start $ACDIR
cp -v $PROJECT_HOME/java/target/http2udpmirror $ACDIR
cp -v $PROJECT_HOME/java/target/configuration/logging.properties $ACDIR/configuration
fi
cd $ACDIR
rm -rf $ACDIR/plugins/*.*
rm -rf $ACDIR/org.eclipse.*
rm -rf $ACDIR/configuration/org.eclipse.*
cp -v $p2PluginRepository/configuration/config.ini configuration/
cp -r -v $p2PluginRepository/configuration/org.eclipse.equinox.simpleconfigurator configuration/
cp -v $p2PluginRepository/plugins/*.jar plugins/
mkdir -p configuration/jetty/etc
cp -v $PROJECT_HOME/java/target/configuration/jetty/etc/jetty.xml configuration/jetty/etc
cp -v $PROJECT_HOME/java/target/configuration/jetty/etc/realm.properties configuration/jetty/etc
cp -v $PROJECT_HOME/java/target/configuration/monitoring.properties configuration/
# Make sure mongodb configuration is active
cp -v $PROJECT_HOME/configuration/mongodb.cfg $ACDIR/
cp -rv $PROJECT_HOME/configuration/native-libraries $ACDIR/
# Make sure this script is up2date at least for the next run
cp -v $PROJECT_HOME/configuration/buildAndUpdateProduct.sh $ACDIR/
echo "Installation complete. You may now start the server using ./start"
fi
#!/bin/bash
set -o functrace
find_project_home ()
{
if [[ $1 == '/' ]] || [[ $1 == "" ]]; then
echo ""
return 0
fi
if [ ! -d "$1/.git" ]; then
PARENT_DIR=`cd $1/..;pwd`
echo $(find_project_home $PARENT_DIR)
return 0
fi
echo $1 | sed -e 's/\/cygdrive\/\([a-zA-Z]\)/\1:/'
}
# this holds for default installation
USER_HOME=~
START_DIR=`pwd`
if [ "$PROJECT_HOME" = "" ]; then
PROJECT_HOME=$(find_project_home $START_DIR)
fi
# if project_home is still empty we could not determine any suitable directory
if [[ $PROJECT_HOME == "" ]]; then
echo "Could neither determine nor get PROJECT_HOME. Please provide it by setting an environment variable with this name."
exit
fi
if [ "$SERVERS_HOME" = "" ]; then
SERVERS_HOME=`echo "$USER_HOME/servers" | sed -e 's/\/cygdrive\/\([a-zA-Z]\)/\1:/'`
fi
# x86 or x86_64 should work for most cases
ARCH=x86_64
START_DIR=`pwd`
# needed for maven on sapsailing.com to work correctly
if [ -f $USER_HOME/.bash_profile ]; then
source $USER_HOME/.bash_profile
fi
cd $PROJECT_HOME
active_branch=$(git symbolic-ref -q HEAD)
active_branch=`basename $active_branch`
ACDIR=$SERVERS_HOME/$active_branch
MAVEN_SETTINGS=$PROJECT_HOME/configuration/maven-settings.xml
MAVEN_SETTINGS_PROXY=$PROJECT_HOME/configuration/maven-settings-proxy.xml
p2PluginRepository=$PROJECT_HOME/java/com.sap.sailing.feature.p2build/bin/products/raceanalysis.product.id/linux/gtk/$ARCH
gwtcompile=1
testing=1
clean="clean"
offline=0
proxy=0
extra=''
if [ $# -eq 0 ]; then
echo "buildAndUpdateProduct [-g -t -o -c -m <config> -n <package> -l <port>] [build|install|all|hot-deploy]"
echo ""
echo "-g Disable GWT compile, no gwt files will be generated, old ones will be preserved."
echo "-t Disable tests"
echo "-o Enable offline mode (does not work for tycho surefire plugin)"
echo "-c Disable cleaning (use only if you are sure that no java file has changed)"
echo "-p Enable proxy mode (overwrites file specified by -m)"
echo "-m <path to file> Specify alternate maven configuration (possibly has side effect on proxy setting)"
echo "-n <package name> Name of the bundle you want to hot deploy. Needs fully qualified name like"
echo " com.sap.sailing.monitoring. Only works if there is a fully built server available."
echo "-l <telnet port> Telnet port the OSGi server is running. Optional but enables fully automatic hot-deploy."
echo ""
echo "build: builds the server code using Maven to $PROJECT_HOME (log to $START_DIR/build.log)"
echo "install: installs product and configuration to $SERVERS_HOME/$active_branch. Overwrites any configuration by using config from branch."
echo "all: calls build and then install"
echo "hot-deploy: performs hot deployment of named bundle into OSGi server"
echo ""
echo "Active branch is $active_branch"
echo "Project home is $PROJECT_HOME"
echo "Server home is $SERVERS_HOME"
echo "P2 home is $p2PluginRepository"
exit 2
fi
echo PROJECT_HOME is $PROJECT_HOME
echo SERVERS_HOME is $SERVERS_HOME
options=':gtocpm:n:l:'
while getopts $options option
do
case $option in
g) gwtcompile=0;;
t) testing=0;;
o) offline=1;;
c) clean="";;
p) proxy=1;;
m) MAVEN_SETTINGS=$OPTARG;;
n) OSGI_BUNDLE_NAME=$OPTARG;;
l) OSGI_TELNET_PORT=$OPTARG;;
\?) echo "Invalid option"
exit 2;;
esac
done
shift $((OPTIND-1))
if [[ $@ == "" ]]; then
echo "You need to specify an action [build|install|all|hot-deploy]"
exit 2
fi
if [[ "$@" == "hot-deploy" ]]; then
# check parameters
if [[ $OSGI_BUNDLE_NAME == "" ]]; then
echo "You need to provide -n parameter with bundle name."
exit 1
fi
# locate old bundle
BUNDLE_COUNT=`find $SERVERS_HOME/$active_branch/plugins -maxdepth 1 -name "${OSGI_BUNDLE_NAME}_*.jar" | wc -l`
OLD_BUNDLE=`find $SERVERS_HOME/$active_branch/plugins -maxdepth 1 -name "${OSGI_BUNDLE_NAME}_*.jar"`
if [[ $OLD_BUNDLE == "" ]] || [[ $BUNDLE_COUNT -ne 1 ]]; then
echo "ERROR: Could not find any bundle named $OSGI_BUNDLE_NAME ($BUNDLE_COUNT). Perhaps your name is misspelled or you have no build?"
exit
fi
OLD_BUNDLE_BASENAME=`basename $OLD_BUNDLE .jar`
OLD_BUNDLE_VERSION=${OLD_BUNDLE_BASENAME#*_}
echo "OLD bundle is $OSGI_BUNDLE_NAME with version $OLD_BUNDLE_VERSION"
# locate new bundle
NEW_BUNDLE=`find $p2PluginRepository/plugins -maxdepth 1 -name "${OSGI_BUNDLE_NAME}_*.jar"`
NEW_BUNDLE_BASENAME=`basename $NEW_BUNDLE .jar`
NEW_BUNDLE_VERSION=${NEW_BUNDLE_BASENAME#*_}
echo "NEW bundle is $OSGI_BUNDLE_NAME with version $NEW_BUNDLE_VERSION"
if [[ $NEW_BUNDLE_VERSION == $OLD_BUNDLE_VERSION ]]; then
echo ""
echo "WARNING: Bundle versions do not differ. Update not needed."
fi
read -s -n1 -p "Do you really want to hot-deploy bundle $OSGI_BUNDLE_NAME to $PROJECT_HOME/$active_branch? (y/N): " answer
case $answer in
"Y" | "y") echo "Continuing";;
*) echo "Aborting..."
exit;;
esac
# deploy new bundle physically
mkdir -p $SERVERS_HOME/$active_branch/plugins/deploy
cp $NEW_BUNDLE $SERVERS_HOME/$active_branch/plugins/deploy
echo "Copied ${NEW_BUNDLE_BASENAME}.jar to $SERVERS_HOME/$active_branch/plugins/deploy"
# check telnet port connection
TELNET_ACTIVE=`netstat -tlnp 2>/dev/null | grep ":$OSGI_TELNET_PORT"`
if [[ $OSGI_TELNET_PORT == "" ]] || [[ $TELNET_ACTIVE == "" ]]; then
echo ""
echo "ERROR: Could not find any process running on port $OSGI_TELNET_PORT. Make sure your server has been started with -console $OSGI_TELNET_PORT"
echo "I've already deployed bundle to $SERVERS_HOME/$active_branch/plugins/deploy/${NEW_BUNDLE_BASENAME}.jar"
echo "You can now install it yourself by issuing the following commands:"
echo ""
echo "osgi> ss $OSGI_BUNDLE_NAME"
echo "21 ACTIVE $OLD_BUNDLE_BASENAME"
echo "osgi> stop 21"
echo "osgi> uninstall 21"
echo "osgi> install file://$SERVERS_HOME/$active_branch/plugins/deploy/${NEW_BUNDLE_BASENAME}.jar"
echo "osgi> ss $OSGI_BUNDLE_NAME"
echo "71 INSTALLED $NEW_BUNDLE_BASENAME"
echo "osgi> start 71"
exit
fi
# first get bundle ID
NC_CMD="nc -t 127.0.0.1 $OSGI_TELNET_PORT"
OLD_BUNDLE_INFORMATION=`echo -n ss | $NC_CMD | grep $OSGI_BUNDLE_NAME`
BUNDLE_ID=`echo $OLD_BUNDLE_INFORMATION | cut -d " " -f 1`
OLD_ACTIVATED_NAME=`echo $OLD_BUNDLE_INFORMATION | cut -d " " -f 3`
echo "Could identify bundle-id $BUNDLE_ID for $OLD_ACTIVATED_NAME"
# stop and uninstall
echo -n stop $BUNDLE_ID | $NC_CMD > /dev/null
echo -n uninstall $BUNDLE_ID | $NC_CMD > /dev/null
# make sure bundle is removed
UNINSTALL_INFORMATION=`echo -n ss | $NC_CMD | grep $OSGI_BUNDLE_NAME`
if [[ $UNINSTALL_INFORMATION == "" ]]; then
echo "Uninstall procedure sucessful!"
else
echo "Something went wrong during uninstall. Please check error logs."
exit
fi
# now reinstall bundle
NEW_BUNDLE_ID=`echo -n install file://$SERVERS_HOME/$active_branch/plugins/deploy/${NEW_BUNDLE_BASENAME}.jar | $NC_CMD`
NEW_BUNDLE_INFORMATION=`echo -n ss | $NC_CMD | grep $OSGI_BUNDLE_NAME`
NEW_BUNDLE_ID=`echo $NEW_BUNDLE_INFORMATION | cut -d " " -f 1`
echo "Installed new bundle file://$SERVERS_HOME/$active_branch/plugins/deploy/${NEW_BUNDLE_BASENAME}.jar with id $NEW_BUNDLE_ID"
# and start
echo -n start $NEW_BUNDLE_ID | $NC_CMD > /dev/null && sleep 1
NEW_BUNDLE_STATUS=`echo -n ss | $NC_CMD | grep $OSGI_BUNDLE_NAME | grep ACTIVE`
if [[ $NEW_BUNDLE_STATUS == "" ]]; then
echo "ERROR: Something went wrong with start of bundle. Please check if everything went ok."
exit
fi
echo "Everything seems to be ok. Bundle hot-deployed to server with new id $NEW_BUNDLE_ID"
exit
fi
echo "Starting $@ of server (maven configuration set to $MAVEN_SETTINGS)..."
if [[ "$@" == "build" ]] || [[ "$@" == "all" ]]; then
# yield build so that we get updated product
cd $PROJECT_HOME/java
if [ $gwtcompile -eq 1 ]; then
echo "INFO: Compiling GWT (rm -rf com.sap.sailing.gwt.ui/com.sap.sailing.*)"
rm -rf com.sap.sailing.gwt.ui/com.sap.sailing.*
else
echo "INFO: GWT Compilation disabled"
extra="-Pdebug.no-gwt-compile"
fi
if [ $testing -eq 0 ]; then
echo "INFO: Skipping tests"
extra="$extra -Dmaven.test.skip=true"
fi
if [ $offline -eq 1 ]; then
echo "INFO: Activating offline mode"
extra="$extra -o"
fi
if [ $proxy -eq 1 ]; then
echo "INFO: Activating proxy profile"
extra="$extra -P no-debug.with-proxy"
MAVEN_SETTINGS=$MAVEN_SETTINGS_PROXY
else
extra="$extra -P no-debug.without-proxy"
fi
echo "Using following command: mvn $extra -fae -s $MAVEN_SETTINGS $clean install"
mvn $extra -fae -s $MAVEN_SETTINGS $clean install 2>&1 | tee $START_DIR/build.log
echo "Build complete. Do not forget to install product..."
fi
if [[ "$@" == "install" ]] || [[ "$@" == "all" ]]; then
read -s -n1 -p "Currently branch $active_branch is active and I will deploy to $ACDIR. Do you want to proceed with $@ (y/N): " answer
case $answer in
"Y" | "y") echo "Continuing";;
*) echo "Aborting..."
exit;;
esac
if [ ! -d $ACDIR ]; then
echo "Could not find directory $ACDIR - perhaps you are on a wrong branch?"
exit
fi
if [ ! -d "$ACDIR/plugins" ]; then
mkdir $ACDIR/plugins
fi
if [ ! -d "$ACDIR/configuration" ]; then
mkdir $ACDIR/configuration
fi
# seems that initial scripts not there
if [ ! -f "$ACDIR/start" ]; then
cp -v $PROJECT_HOME/java/target/start $ACDIR
cp -v $PROJECT_HOME/java/target/http2udpmirror $ACDIR
cp -v $PROJECT_HOME/java/target/configuration/logging.properties $ACDIR/configuration
fi
cd $ACDIR
rm -rf $ACDIR/plugins/*.*
rm -rf $ACDIR/org.eclipse.*
rm -rf $ACDIR/configuration/org.eclipse.*
cp -v $p2PluginRepository/configuration/config.ini configuration/
cp -r -v $p2PluginRepository/configuration/org.eclipse.equinox.simpleconfigurator configuration/
cp -v $p2PluginRepository/plugins/*.jar plugins/
mkdir -p configuration/jetty/etc
cp -v $PROJECT_HOME/java/target/configuration/jetty/etc/jetty.xml configuration/jetty/etc
cp -v $PROJECT_HOME/java/target/configuration/jetty/etc/realm.properties configuration/jetty/etc
cp -v $PROJECT_HOME/java/target/configuration/monitoring.properties configuration/
# Make sure mongodb configuration is active
cp -v $PROJECT_HOME/configuration/mongodb.cfg $ACDIR/
cp -rv $PROJECT_HOME/configuration/native-libraries $ACDIR/
# Make sure this script is up2date at least for the next run
cp -v $PROJECT_HOME/configuration/buildAndUpdateProduct.sh $ACDIR/
echo "Installation complete. You may now start the server using ./start"
fi
+39 -39
View File
@@ -1,39 +1,39 @@
<settings>
<servers>
<server>
<id>ssh-repository</id>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
</server>
</servers>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.wdf.sap.corp</host>
<port>8080</port>
<nonProxyHosts>localhost|*.sap.corp</nonProxyHosts>
</proxy>
</proxies>
<profiles>
<profile>
<id>sailing.analytics</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- Leave empty, if no proxy is needed in your environment! -->
<parameters.proxy>
</parameters.proxy>
<!-- Change the configuration file to the one you like to use for the tests. -->
<parameters.integration-tests>
-Dselenium.test.environment.configuration=ci-test-environment.xml
</parameters.integration-tests>
</properties>
</profile>
</profiles>
</settings>
<settings>
<servers>
<server>
<id>ssh-repository</id>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
</server>
</servers>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.wdf.sap.corp</host>
<port>8080</port>
<nonProxyHosts>localhost|*.sap.corp</nonProxyHosts>
</proxy>
</proxies>
<profiles>
<profile>
<id>sailing.analytics</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- Leave empty, if no proxy is needed in your environment! -->
<parameters.proxy>
</parameters.proxy>
<!-- Change the configuration file to the one you like to use for the tests. -->
<parameters.integration-tests>
-Dselenium.test.environment.configuration=ci-test-environment.xml
</parameters.integration-tests>
</properties>
</profile>
</profiles>
</settings>
+39 -39
View File
@@ -1,39 +1,39 @@
<settings>
<servers>
<server>
<id>ssh-repository</id>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
</server>
</servers>
<proxies>
<proxy>
<active>false</active>
<protocol>http</protocol>
<host>proxy.wdf.sap.corp</host>
<port>8080</port>
<nonProxyHosts>localhost|*.sap.corp</nonProxyHosts>
</proxy>
</proxies>
<profiles>
<profile>
<id>sailing.analytics</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- Leave empty, if no proxy is needed in your environment! -->
<parameters.proxy>
</parameters.proxy>
<!-- Change the configuration file to the one you like to use for the tests. -->
<parameters.integration-tests>
-Dselenium.test.environment.configuration=ci-test-environment.xml
</parameters.integration-tests>
</properties>
</profile>
</profiles>
</settings>
<settings>
<servers>
<server>
<id>ssh-repository</id>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
</server>
</servers>
<proxies>
<proxy>
<active>false</active>
<protocol>http</protocol>
<host>proxy.wdf.sap.corp</host>
<port>8080</port>
<nonProxyHosts>localhost|*.sap.corp</nonProxyHosts>
</proxy>
</proxies>
<profiles>
<profile>
<id>sailing.analytics</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- Leave empty, if no proxy is needed in your environment! -->
<parameters.proxy>
</parameters.proxy>
<!-- Change the configuration file to the one you like to use for the tests. -->
<parameters.integration-tests>
-Dselenium.test.environment.configuration=ci-test-environment.xml
</parameters.integration-tests>
</properties>
</profile>
</profiles>
</settings>
+7 -7
View File
@@ -1,7 +1,7 @@
port = 27017
master = true
dbpath = /opt/mongodb/data/mongodb-data
logappend = true
directoryperdb = true
rest = true
syncdelay = 5
port = 27017
master = true
dbpath = /opt/mongodb/data/mongodb-data
logappend = true
directoryperdb = true
rest = true
syncdelay = 5
+44 -44
View File
@@ -1,44 +1,44 @@
#!/bin/bash
command -v tmux >/dev/null 2>&1 || { echo "I require tmux but it's not installed. Aborting." >&2; exit 1; }
sn=sailing
SERVERS_DIR=/home/trac/servers
TMUX_ACTIVE=`tmux has-session -t $sn 2>/dev/null`
if [ $? -eq 0 ]; then
echo "Session exists...not configuring a new one"
else
echo "Session does not exist...creating a new one with name $sn"
cd /home/trac/git
tmux new-session -s "$sn" -n "BUILD" -d
counter=1
for dir in dev test prod1 prod2; do
cd $SERVERS_DIR/$dir
tmux new-window -t "$sn:$counter" -n `basename $dir` "bash -c './start'; bash"
counter=$[counter + 1]
done
cd /home/trac/servers/prod1
tmux new-window -t "$sn:$counter" -n "UDP" "bash -c './udpmirror -v 2012 localhost 2010 localhost 2011 localhost 2013 localhost 2014'; bash"
cd /opt/mongodb/bin
tmux new-window -t "$sn:$[counter+1]" -n "GOAccess" "bash -c 'goaccess -f /var/log/httpd/access_log'; bash"
cd /opt/
tmux new-window -t "$sn:$[counter+2]" -n "ATop" "bash -c 'apachetop -f /var/log/httpd/access_log'; bash"
cd /home/trac/servers
tmux new-window -t "$sn:$[counter+3]" -n "Logs" "bash -c 'ls -lah'; bash"
cd /home/trac/servers/prod1
tmux new-window -t "$sn:$[counter+4]" -n "STListener" "bash -c './swisstiminglistener 3500 3501'; bash"
tmux select-window -t "$sn:0"
fi
if [[ "$1" != "unattended" ]]; then
tmux -2 attach-session -t "$sn"
fi
#!/bin/bash
command -v tmux >/dev/null 2>&1 || { echo "I require tmux but it's not installed. Aborting." >&2; exit 1; }
sn=sailing
SERVERS_DIR=/home/trac/servers
TMUX_ACTIVE=`tmux has-session -t $sn 2>/dev/null`
if [ $? -eq 0 ]; then
echo "Session exists...not configuring a new one"
else
echo "Session does not exist...creating a new one with name $sn"
cd /home/trac/git
tmux new-session -s "$sn" -n "BUILD" -d
counter=1
for dir in dev test prod1 prod2; do
cd $SERVERS_DIR/$dir
tmux new-window -t "$sn:$counter" -n `basename $dir` "bash -c './start'; bash"
counter=$[counter + 1]
done
cd /home/trac/servers/prod1
tmux new-window -t "$sn:$counter" -n "UDP" "bash -c './udpmirror -v 2012 localhost 2010 localhost 2011 localhost 2013 localhost 2014'; bash"
cd /opt/mongodb/bin
tmux new-window -t "$sn:$[counter+1]" -n "GOAccess" "bash -c 'goaccess -f /var/log/httpd/access_log'; bash"
cd /opt/
tmux new-window -t "$sn:$[counter+2]" -n "ATop" "bash -c 'apachetop -f /var/log/httpd/access_log'; bash"
cd /home/trac/servers
tmux new-window -t "$sn:$[counter+3]" -n "Logs" "bash -c 'ls -lah'; bash"
cd /home/trac/servers/prod1
tmux new-window -t "$sn:$[counter+4]" -n "STListener" "bash -c './swisstiminglistener 3500 3501'; bash"
tmux select-window -t "$sn:0"
fi
if [[ "$1" != "unattended" ]]; then
tmux -2 attach-session -t "$sn"
fi
+13 -13
View File
@@ -1,13 +1,13 @@
#!/bin/sh
export JAVA_HOME=/home/trac/jdk1.7.0_02
jar=`find plugins -name 'com.sap.sailing.expeditionconnector_*.jar' | sort | tail -1`
echo Using JAR file $jar
if [ $# -eq 0 ]; then
ARGS="-v 2012 localhost 2010 localhost 2011 localhost 2013 localhost 2014"
else
ARGS=$*
fi
echo "Using $ARGS"
java -cp "$jar" -Djava.util.logging.config.file=udpmirrorLog.properties com.sap.sailing.expeditionconnector.UDPMirror $ARGS
#!/bin/sh
export JAVA_HOME=/home/trac/jdk1.7.0_02
jar=`find plugins -name 'com.sap.sailing.expeditionconnector_*.jar' | sort | tail -1`
echo Using JAR file $jar
if [ $# -eq 0 ]; then
ARGS="-v 2012 localhost 2010 localhost 2011 localhost 2013 localhost 2014"
else
ARGS=$*
fi
echo "Using $ARGS"
java -cp "$jar" -Djava.util.logging.config.file=udpmirrorLog.properties com.sap.sailing.expeditionconnector.UDPMirror $ARGS
+219 -219
View File
@@ -1,219 +1,219 @@
This file explains the typical administrative tasks to be performed on
the SAP Sailing server. For an explanation of what this server does,
please refer to the README file stored next to this ADMIN file.
Emergency Startup After Reboot
------------------------------
When for some reason the server re-booted, a number of manual steps
need to be performed to get back up and running. Proceed as follows:
- "ssh -A trac@sapsailing.com"
- "screen"
Open 10 screen sessions, using the "Ctrl-a c" keyboard shortcut in the screen session.
Name them, using "Ctrl-a A", according to the following scheme:
0$ dev 1$ test 2$ prod1 3$ prod2 4$ wind 5$ mongo 6$ ssh tunnel 7-$ build 8$ logs 9*$ storeandforward
Additional sessions may be used for the race committee app server.
The first four sessions are used to run the four server instances. Session 4
is used to run the udpmirror script that receives wind data through UDP and
forwards to the four server instances. Session 5 hosts a test MongoDB instance.
Session 6 hosts an ssh tunnel making sure port 12347 forwards to local port 22 to
create homogeneous SSH access to the machine for build and deploy scripts.
Session 7 is used for build processes. Session 8 can be used to monitor logs
and server load. Session 9 is used to record and forward inbound SwissTiming data.
In each screen session it is necessary to run the /home/trac/.bash_profile script by
entering
". .bash_profile"
This, in particular, adjusts the JAVA_HOME variable as needed.
Perform the steps "Launch MongoDB" and "Launch Python Server"
described below. Launch the four server instances by cd'ing to
/home/trac/servers/<instance> and invoke "./start" there. If you
additionally want to upgrade from a fresh build, call "./install"
before calling "./start".
Follow the step "Launch UDP Mirror" described below. Follow the step
"Launch SwissTiming forwarder" described below.
Launching Readily-built Java Server Instances
---------------------------------------------
We usually launch, manage and observe the Java server instances using
a screen session. See below for how to update and
restart an already running instance.
- ssh -A trac@sapsailing.com
- screen -rd
- Connect to the screen session for your server, e.g., session 0 for dev:
Ctrl-a 0
- "cd servers/<instance>" where <instance> is one of
dev/test/prod1/prod2
Then launch the server:
- ./start
This should start an OSGi console with the latest version of the
bundles deployed to ~trac/servers/<instance>/plugins.
Launch MongoDB
--------------
The MongoDB is used to store wind information and general
leaderboard-related information required by the Python web
application.
- log in as user "root"
- "cd /opt/mongodb/bin"
- "./supervisord"
This will launch the MongoDB servers. If not, check for old mongod.lock
files in the server directories and remove them, then try again.
Launch UDP Mirror
-----------------
The two production instances shall share the same wind
information. Therefore, it is necessary to launch a "UDP mirror" that
distributes UDP packets received on the single inbound UDP port for
the production instances to the two Java server instances.
In screen session 4 (Ctrl-a 4), do the following:
- "cd ~/servers/prod1"
- "./udpmirror -v 2012 localhost 2013 localhost 2014 localhost 2010 localhost 2011"
The "-v" argument ensures that UDP packets received will be dumped to
the console. The process will listen for inbound UDP packets on port
2012 and forward anything received on that port to localhost:2013 as
well as localhost:2014. See also the list of ports as documented in
the README file.
Launch SwissTiming forwarder
----------------------------
Go to screen session 9 (Ctrl-a 9), then do the following:
- "cd ~/servers/prod1"
- "./swisstiminglistener 3500 3501"
Apache HTTP Server configuration
--------------------------------
To define the different URL's to access the java servers you need to configure
the corresponding virtual hosts of the Apache Http server. The configuration file
can be found at /etc/httpd/conf.d/kiel.conf
Re-Building the Java Server
---------------------------
If, e.g., after a bug fix, it is necessary to re-build and re-deploy
the Java server, you should consider doing this first on the "dev"
branch of the git versioning system. The master branch contains the
sources for the "dev" server instance. The git branch to server
instance mappings are as follows:
git branch server instance
---------- ---------------
master <none> (internal development inside SAP network)
dev dev
test test
prod1 prod1
prod2 prod2
First, check out the branch you want to re-build:
- log in as user "trac"
- ensure that your SSH key is loaded / unlocked, either by logging in
using SSH with the -A argument, or by invoking the alias "sa" and
entering the password for the trac user's SSH key
- "cd git/java"
- "git checkout -f <branchname>" where <branchname> is either one of
dev, test, prod1 or prod2
- ensure the "ulimit -n" output is at least 4096 to enable the GWT compiler to assemble
the resource sets which consist of many files that all need to be opened concurrently.
Currently, the maximum value for "ulimit -n" is configured in /etc/security/limits.conf
and is set to 16384. This specified the maximum amount to which a user's shell can set
this value. The ~trac/.bash_profile contains a "ulimit -n 4096" command, but when
running "screen" the shells usually are no login shells. You need to make sure you
run ~trac/.bash_profile in the build shell to set the limit of open files to at least
4096.
- rm -rf com.sap.sailing.gwt.ui/com.sap.sailing.gwt.ui.*; mvn -fae -s /home/trac/git/settings.xml -P debug.without-proxy clean install 2>&1 | tee log
This will compile the sources, bundle them up in to OSGi bundle JAR
files, run all tests which required online access to the TracTrac
servers, and, if successful, creates an eclipse product in the directory
/home/trac/git/java/com.sap.sailing.feature.p2build/bin/products/raceanalysis.product.id/linux/gtk/x86_64
which contains all files required to install and run the build result.
Note that the running server(s) are not updated automatically. See next topic.
OSGi Server Instances
---------------------
We usually have four OSGi consoles running with a terminal window
each, visible at the VNC server running on por 5902. The title bar
shows the current working directory which should be something like
"~/servers/<instancename>" where <instancename> is one of dev, test,
prod1 and prod2.
At the "osgi>" prompt of the OSGi console you can type
- "exit"
to terminate the particular Java server instance.
You can either install a complete new server instance or just update an existing one.
Install a new OSGi Server Instance
----------------------------------
To install a complete new server instance you can issue
- "./install"
This command will delete the old installation and copy all required files
from the build result to the right directories of the server instance.
To start the server instance again, type
- "./start"
and the server should welcome you again with the "osgi>" prompt after
a successful start.
Update an existing OSGi Server Instance
-----------------------------------------
To update the server you can issue
- "./update"
This command will NOT delete the old installation but copy the updated plugins
from the build result to the right directories of the server instance.
To start the server instance again, type
- "./start"
and the server should welcome you again with the "osgi>" prompt after
a successful start.
This file explains the typical administrative tasks to be performed on
the SAP Sailing server. For an explanation of what this server does,
please refer to the README file stored next to this ADMIN file.
Emergency Startup After Reboot
------------------------------
When for some reason the server re-booted, a number of manual steps
need to be performed to get back up and running. Proceed as follows:
- "ssh -A trac@sapsailing.com"
- "screen"
Open 10 screen sessions, using the "Ctrl-a c" keyboard shortcut in the screen session.
Name them, using "Ctrl-a A", according to the following scheme:
0$ dev 1$ test 2$ prod1 3$ prod2 4$ wind 5$ mongo 6$ ssh tunnel 7-$ build 8$ logs 9*$ storeandforward
Additional sessions may be used for the race committee app server.
The first four sessions are used to run the four server instances. Session 4
is used to run the udpmirror script that receives wind data through UDP and
forwards to the four server instances. Session 5 hosts a test MongoDB instance.
Session 6 hosts an ssh tunnel making sure port 12347 forwards to local port 22 to
create homogeneous SSH access to the machine for build and deploy scripts.
Session 7 is used for build processes. Session 8 can be used to monitor logs
and server load. Session 9 is used to record and forward inbound SwissTiming data.
In each screen session it is necessary to run the /home/trac/.bash_profile script by
entering
". .bash_profile"
This, in particular, adjusts the JAVA_HOME variable as needed.
Perform the steps "Launch MongoDB" and "Launch Python Server"
described below. Launch the four server instances by cd'ing to
/home/trac/servers/<instance> and invoke "./start" there. If you
additionally want to upgrade from a fresh build, call "./install"
before calling "./start".
Follow the step "Launch UDP Mirror" described below. Follow the step
"Launch SwissTiming forwarder" described below.
Launching Readily-built Java Server Instances
---------------------------------------------
We usually launch, manage and observe the Java server instances using
a screen session. See below for how to update and
restart an already running instance.
- ssh -A trac@sapsailing.com
- screen -rd
- Connect to the screen session for your server, e.g., session 0 for dev:
Ctrl-a 0
- "cd servers/<instance>" where <instance> is one of
dev/test/prod1/prod2
Then launch the server:
- ./start
This should start an OSGi console with the latest version of the
bundles deployed to ~trac/servers/<instance>/plugins.
Launch MongoDB
--------------
The MongoDB is used to store wind information and general
leaderboard-related information required by the Python web
application.
- log in as user "root"
- "cd /opt/mongodb/bin"
- "./supervisord"
This will launch the MongoDB servers. If not, check for old mongod.lock
files in the server directories and remove them, then try again.
Launch UDP Mirror
-----------------
The two production instances shall share the same wind
information. Therefore, it is necessary to launch a "UDP mirror" that
distributes UDP packets received on the single inbound UDP port for
the production instances to the two Java server instances.
In screen session 4 (Ctrl-a 4), do the following:
- "cd ~/servers/prod1"
- "./udpmirror -v 2012 localhost 2013 localhost 2014 localhost 2010 localhost 2011"
The "-v" argument ensures that UDP packets received will be dumped to
the console. The process will listen for inbound UDP packets on port
2012 and forward anything received on that port to localhost:2013 as
well as localhost:2014. See also the list of ports as documented in
the README file.
Launch SwissTiming forwarder
----------------------------
Go to screen session 9 (Ctrl-a 9), then do the following:
- "cd ~/servers/prod1"
- "./swisstiminglistener 3500 3501"
Apache HTTP Server configuration
--------------------------------
To define the different URL's to access the java servers you need to configure
the corresponding virtual hosts of the Apache Http server. The configuration file
can be found at /etc/httpd/conf.d/kiel.conf
Re-Building the Java Server
---------------------------
If, e.g., after a bug fix, it is necessary to re-build and re-deploy
the Java server, you should consider doing this first on the "dev"
branch of the git versioning system. The master branch contains the
sources for the "dev" server instance. The git branch to server
instance mappings are as follows:
git branch server instance
---------- ---------------
master <none> (internal development inside SAP network)
dev dev
test test
prod1 prod1
prod2 prod2
First, check out the branch you want to re-build:
- log in as user "trac"
- ensure that your SSH key is loaded / unlocked, either by logging in
using SSH with the -A argument, or by invoking the alias "sa" and
entering the password for the trac user's SSH key
- "cd git/java"
- "git checkout -f <branchname>" where <branchname> is either one of
dev, test, prod1 or prod2
- ensure the "ulimit -n" output is at least 4096 to enable the GWT compiler to assemble
the resource sets which consist of many files that all need to be opened concurrently.
Currently, the maximum value for "ulimit -n" is configured in /etc/security/limits.conf
and is set to 16384. This specified the maximum amount to which a user's shell can set
this value. The ~trac/.bash_profile contains a "ulimit -n 4096" command, but when
running "screen" the shells usually are no login shells. You need to make sure you
run ~trac/.bash_profile in the build shell to set the limit of open files to at least
4096.
- rm -rf com.sap.sailing.gwt.ui/com.sap.sailing.gwt.ui.*; mvn -fae -s /home/trac/git/settings.xml -P debug.without-proxy clean install 2>&1 | tee log
This will compile the sources, bundle them up in to OSGi bundle JAR
files, run all tests which required online access to the TracTrac
servers, and, if successful, creates an eclipse product in the directory
/home/trac/git/java/com.sap.sailing.feature.p2build/bin/products/raceanalysis.product.id/linux/gtk/x86_64
which contains all files required to install and run the build result.
Note that the running server(s) are not updated automatically. See next topic.
OSGi Server Instances
---------------------
We usually have four OSGi consoles running with a terminal window
each, visible at the VNC server running on por 5902. The title bar
shows the current working directory which should be something like
"~/servers/<instancename>" where <instancename> is one of dev, test,
prod1 and prod2.
At the "osgi>" prompt of the OSGi console you can type
- "exit"
to terminate the particular Java server instance.
You can either install a complete new server instance or just update an existing one.
Install a new OSGi Server Instance
----------------------------------
To install a complete new server instance you can issue
- "./install"
This command will delete the old installation and copy all required files
from the build result to the right directories of the server instance.
To start the server instance again, type
- "./start"
and the server should welcome you again with the "osgi>" prompt after
a successful start.
Update an existing OSGi Server Instance
-----------------------------------------
To update the server you can issue
- "./update"
This command will NOT delete the old installation but copy the updated plugins
from the build result to the right directories of the server instance.
To start the server instance again, type
- "./start"
and the server should welcome you again with the "osgi>" prompt after
a successful start.
+204 -204
View File
@@ -1,204 +1,204 @@
This file explains the development environment and some typical
usecases you will need to work with race analysis project.
IDE
---
We use Eclipse as development environment - version 3.7.x (www.eclipse.org)
Additional mandatory installations:
- Git (file versioning system)
- Maven 3.x (build system)
TODO: Explain at least "on-boarding" use case (what to install, where
to get it, prerequisites, Bugzilla, git, git account and SSH keys, SAP
internal vs. external, file share, Wiki, project import into Eclipse,
JDK setup 1.6/1.7, Eclipse JRE config, ...). Distinguish setup
variants: a) SAP-internal; b) extenral; c) offline
Configure the IDE
-----------------
1. Target Platform
After the import of all required projects from the local git
repository into your eclipse workspace you need to setup the target
platform. A target platform is an Eclipse concept to define the set
of java classes (from a set of jars/libs) your compiler can use to
build the sources. We have defined some target-platforms for the
project which can be found inside the project
"com.sap.sailing.targetplatform" in the folder 'definitions'. There
you will find 3 definitions: race-analysis-p2-ide-local,
race-analysis-p2-maven-local and race-analysis-p2-maven-central. The
definition 'race-analysis-p2-ide-local' is intended to be used for the
IDE whereas the other definitions are used for the local and central
maven builds. The target definition contains a list of URLs to
different p2 repositories containing the actual bundles. The URLs can
be either URLs to local or remote repositories depending on your
access to those repositories. Normally you should bind your target
platform to central (remote) repositories in order to keep the content
up-to-date. In case you don't have access to specific remote
repositories you can create a local copy of a p2 repository and change
the URL to this local copy.
!!!ATTENTION!!!
It's important that we can NOT use any other options
(like directories or update site) than p2 repositories for the target
platform definition. The reason is that Tycho (the tool we use for the
maven/osgi build integration) does only support p2 repositories (in
version 0.14.0). Therefore we must convert any jars/libs/etc. into a
p2 repository if we want to use them in our target definition. Eclipse
equinox provides an application supporting the creation of p2
repositories from a directory with of jar files and a feature.xml
(org.eclipse.equinox.p2.publisher.UpdateSitePublisher). You can use
the the script createLocalBaseP2repository.sh (in project
com.sap.sailing.targetplatform/scripts) as a template.
The currently used target platform types:
a) Remote p2 repositories (like http://download.eclipse.org/releases/indigo)
b) SAP Nexus repositories (like http://nexus:8081/nexus/content/...)
c) Our own p2 repository served by our central server via Apache WebServer (http://sapcoe-app01.pironet-ndh.com/p2/...)
Local maven build
-----------------
TODO: how to run a maven build; which current working directory to
use? For example, when to delete
git/java/com.sap.sailing.gwt.ui/com.sap.sailing.*?
If you run a local build with maven the used target platform defintion
is 'race-analysis-p2-maven-local'. The reference to this definition is
defined in the pom.xml of the /git/java folder.
The "SAP Race Analysis" Product
-------------------------------
The project com.sap.sailing.feature.p2build contains an eclipse
product definition with the name "SAP Race Analysis". This product
contains a list of features defining the product. These features are:
- com.sap.sailing.feature (contains all development bundles and it's dependencies)
- com.sap.sailing.feature.runtime (contains additional libraries only needed at runtime)
The maven/tycho build creates an deployable eclipse product containing
all required runtime artifacts based on this product defintion. This
is also the basis for the server installation. The resulting files can
be found in /bin/products/raceanalysis.product.id/<os>/<ws>/<arch>/...
Target-Platform related projects
--------------------------------
com.sap.sailing.targetplatform.base -> contains all files required to
build a p2 repository for all library files defining the base target
platform for the sailing project
com.sap.sailing.targetplatform -> contains the p2 repository
generation scripts and the target platform definitions (.target files)
com.sap.sailing.feature -> contains the feature.xml for the race
analysis project itself (required for the product build)
com.sap.sailing.feature.runtime -> contains the feature.xml for
additional runtime libraries which are not required for the source
build (e.g. jetty.osgi bundle)
com.sap.sailing.feature.p2build -> contains the product defintion
(.product file) for the race analysis project (required for the
product build)
Typical development usecases affecting the target platform and the maven build
------------------------------------------------------------------------------
1. Adding an external open source library
To add a new library which can not be found in any SAP repository you
need to follow some steps.
a) Check if the library is already OSGi-enabled (normally this means
there is a manifest.mf in the META-INF folder of the jar file
containing valid OSGi metadata.
b) In case the library is not OSGi-enabled someone has to create such
a OSGI-enabled version (ask the technical lead of the project)
c) Add the library to an appropriate target folder in the project
com.sap.sailing.targetplatform.base (e.g. target-base)
d) Add a corresponding entry to the corresponding feature.xml in the
project com.sap.sailing.targetplatform.base
e) Rebuild the base target platform by running the script
createLocalBaseP2repository.sh
(com.sap.sailing.targetplatform/scripts)
f) Test the new overall target platform by settings the race-analysis-p2-ide-p2admin.target as target platform
in the IDE
g) The admin of the central p2 repository must now replace the content of the central server
/home/trac/p2-repositories/sailing with the content of the new local base p2 repository
(com.sap.sailing.targetplatform/base/gen/p2)
g) Reload the target platform in the IDE
2. Adding a library from an internal SAP repository (e.g. Nexus)
not used yet.
3. Adding an existing remote p2 repository as new source of libraries
a) Add the URL of the remote p2 repository to all target definition
files in com.sap.sailing.targetplatform/defintions
b) Select the features of the p2 repository you want to use in the project
c) Reload the target platform
4. Adding a GWT library to the com.sap.sailing.gwt.ui project
a) Copy the library (the jar file) to the folder /WEB-INF/lib
b) Add the library to the bundle classpath (in the META-INF/manifest.mf file)
c) Add a build dependency for the GWT compiler to the pom.xml
d) Add the library to the central maven repository /home/trac/maven-repositories
by using the mvn install:install -file command
5. Adding an GWT extension library (with source code)
TODO (see Highcharts example)
6. Adding a self created p2 repository from a maven based external
project as new source of libraries
Example: Integration of 'Atmosphere' framework (Server push technology)
TODO
Typical usecases changing the features and product definition
-------------------------------------------------------------
1. Adding a new bundle project
a) add a new bundle project in the IDE
b) add the project to the product definition by adding it to the
feature.xml in the project com.sap.sailing.feature
c) add the project to the launch configurations in com.sap.sailing.server
d) add the project to the main pom.xml (/java dir in the git repository)
TODO: launch OSGi runtime (debug vs. run), compile / launch GWT application
in hosted / non-hosted mode, maven-compile GWT app and launch non-hosted, ...
TODO: How does our git branch structure work? (master -> dev -> test
-> prod1 -> prod2) When to merge from where to where?
TODO: Server Deployment: how to use the screen sessions on sapsailing.com?
How to deploy changes from master branch to dev server, etc.?
TODO: keep this documentation in WikiMarkup format and explain how the
process of updating this documentation and synchronizing with the Wiki
shall work. Consider using a Wiki branch in git that represents the
last deployment.
TODO: runtime installation, e.g., as done for Hawaii on separate laptops
This file explains the development environment and some typical
usecases you will need to work with race analysis project.
IDE
---
We use Eclipse as development environment - version 3.7.x (www.eclipse.org)
Additional mandatory installations:
- Git (file versioning system)
- Maven 3.x (build system)
TODO: Explain at least "on-boarding" use case (what to install, where
to get it, prerequisites, Bugzilla, git, git account and SSH keys, SAP
internal vs. external, file share, Wiki, project import into Eclipse,
JDK setup 1.6/1.7, Eclipse JRE config, ...). Distinguish setup
variants: a) SAP-internal; b) extenral; c) offline
Configure the IDE
-----------------
1. Target Platform
After the import of all required projects from the local git
repository into your eclipse workspace you need to setup the target
platform. A target platform is an Eclipse concept to define the set
of java classes (from a set of jars/libs) your compiler can use to
build the sources. We have defined some target-platforms for the
project which can be found inside the project
"com.sap.sailing.targetplatform" in the folder 'definitions'. There
you will find 3 definitions: race-analysis-p2-ide-local,
race-analysis-p2-maven-local and race-analysis-p2-maven-central. The
definition 'race-analysis-p2-ide-local' is intended to be used for the
IDE whereas the other definitions are used for the local and central
maven builds. The target definition contains a list of URLs to
different p2 repositories containing the actual bundles. The URLs can
be either URLs to local or remote repositories depending on your
access to those repositories. Normally you should bind your target
platform to central (remote) repositories in order to keep the content
up-to-date. In case you don't have access to specific remote
repositories you can create a local copy of a p2 repository and change
the URL to this local copy.
!!!ATTENTION!!!
It's important that we can NOT use any other options
(like directories or update site) than p2 repositories for the target
platform definition. The reason is that Tycho (the tool we use for the
maven/osgi build integration) does only support p2 repositories (in
version 0.14.0). Therefore we must convert any jars/libs/etc. into a
p2 repository if we want to use them in our target definition. Eclipse
equinox provides an application supporting the creation of p2
repositories from a directory with of jar files and a feature.xml
(org.eclipse.equinox.p2.publisher.UpdateSitePublisher). You can use
the the script createLocalBaseP2repository.sh (in project
com.sap.sailing.targetplatform/scripts) as a template.
The currently used target platform types:
a) Remote p2 repositories (like http://download.eclipse.org/releases/indigo)
b) SAP Nexus repositories (like http://nexus:8081/nexus/content/...)
c) Our own p2 repository served by our central server via Apache WebServer (http://sapcoe-app01.pironet-ndh.com/p2/...)
Local maven build
-----------------
TODO: how to run a maven build; which current working directory to
use? For example, when to delete
git/java/com.sap.sailing.gwt.ui/com.sap.sailing.*?
If you run a local build with maven the used target platform defintion
is 'race-analysis-p2-maven-local'. The reference to this definition is
defined in the pom.xml of the /git/java folder.
The "SAP Race Analysis" Product
-------------------------------
The project com.sap.sailing.feature.p2build contains an eclipse
product definition with the name "SAP Race Analysis". This product
contains a list of features defining the product. These features are:
- com.sap.sailing.feature (contains all development bundles and it's dependencies)
- com.sap.sailing.feature.runtime (contains additional libraries only needed at runtime)
The maven/tycho build creates an deployable eclipse product containing
all required runtime artifacts based on this product defintion. This
is also the basis for the server installation. The resulting files can
be found in /bin/products/raceanalysis.product.id/<os>/<ws>/<arch>/...
Target-Platform related projects
--------------------------------
com.sap.sailing.targetplatform.base -> contains all files required to
build a p2 repository for all library files defining the base target
platform for the sailing project
com.sap.sailing.targetplatform -> contains the p2 repository
generation scripts and the target platform definitions (.target files)
com.sap.sailing.feature -> contains the feature.xml for the race
analysis project itself (required for the product build)
com.sap.sailing.feature.runtime -> contains the feature.xml for
additional runtime libraries which are not required for the source
build (e.g. jetty.osgi bundle)
com.sap.sailing.feature.p2build -> contains the product defintion
(.product file) for the race analysis project (required for the
product build)
Typical development usecases affecting the target platform and the maven build
------------------------------------------------------------------------------
1. Adding an external open source library
To add a new library which can not be found in any SAP repository you
need to follow some steps.
a) Check if the library is already OSGi-enabled (normally this means
there is a manifest.mf in the META-INF folder of the jar file
containing valid OSGi metadata.
b) In case the library is not OSGi-enabled someone has to create such
a OSGI-enabled version (ask the technical lead of the project)
c) Add the library to an appropriate target folder in the project
com.sap.sailing.targetplatform.base (e.g. target-base)
d) Add a corresponding entry to the corresponding feature.xml in the
project com.sap.sailing.targetplatform.base
e) Rebuild the base target platform by running the script
createLocalBaseP2repository.sh
(com.sap.sailing.targetplatform/scripts)
f) Test the new overall target platform by settings the race-analysis-p2-ide-p2admin.target as target platform
in the IDE
g) The admin of the central p2 repository must now replace the content of the central server
/home/trac/p2-repositories/sailing with the content of the new local base p2 repository
(com.sap.sailing.targetplatform/base/gen/p2)
g) Reload the target platform in the IDE
2. Adding a library from an internal SAP repository (e.g. Nexus)
not used yet.
3. Adding an existing remote p2 repository as new source of libraries
a) Add the URL of the remote p2 repository to all target definition
files in com.sap.sailing.targetplatform/defintions
b) Select the features of the p2 repository you want to use in the project
c) Reload the target platform
4. Adding a GWT library to the com.sap.sailing.gwt.ui project
a) Copy the library (the jar file) to the folder /WEB-INF/lib
b) Add the library to the bundle classpath (in the META-INF/manifest.mf file)
c) Add a build dependency for the GWT compiler to the pom.xml
d) Add the library to the central maven repository /home/trac/maven-repositories
by using the mvn install:install -file command
5. Adding an GWT extension library (with source code)
TODO (see Highcharts example)
6. Adding a self created p2 repository from a maven based external
project as new source of libraries
Example: Integration of 'Atmosphere' framework (Server push technology)
TODO
Typical usecases changing the features and product definition
-------------------------------------------------------------
1. Adding a new bundle project
a) add a new bundle project in the IDE
b) add the project to the product definition by adding it to the
feature.xml in the project com.sap.sailing.feature
c) add the project to the launch configurations in com.sap.sailing.server
d) add the project to the main pom.xml (/java dir in the git repository)
TODO: launch OSGi runtime (debug vs. run), compile / launch GWT application
in hosted / non-hosted mode, maven-compile GWT app and launch non-hosted, ...
TODO: How does our git branch structure work? (master -> dev -> test
-> prod1 -> prod2) When to merge from where to where?
TODO: Server Deployment: how to use the screen sessions on sapsailing.com?
How to deploy changes from master branch to dev server, etc.?
TODO: keep this documentation in WikiMarkup format and explain how the
process of updating this documentation and synchronizing with the Wiki
shall work. Consider using a Wiki branch in git that represents the
last deployment.
TODO: runtime installation, e.g., as done for Hawaii on separate laptops
+35 -35
View File
@@ -1,35 +1,35 @@
Cloning wind data from one MongoDB instance to another
------------------------------------------------------
10200: MongoDB "dev" instance
10201: MongoDB "test" instance
10202: MontoDB "prod" instance
connect to the mongo shell:
e.g. /opt/mongodb/bin/mongo --port 10202
typical commands:
show dbs displays all the databases on the server you are connected to
use db_name switches to db_name on the same server
show collections displays a list of all the collections in the current database
First, export the WIND_TRACKS collection from one database. For example...
/opt/mongodb/bin/mongoexport --port 10202 -d winddb -c WIND_TRACKS > /tmp/wind-tracks-dev.json
or with an additional query parameter if only want to export the wind of a specific race
/opt/mongodb/bin/mongoexport --port 10202 -d winddb -c WIND_TRACKS -q "{ 'EVENT_NAME': /Arenal Training Camps Regatta 2012/, 'RACE_NAME': /Laser/}" > /tmp/wind-tracks-dev.json
To import the resulting JSON file into the DB instance call:
/opt/mongodb/bin/mongoimport --port 10201 -d winddb -c WIND_TRACKS /tmp/wind-tracks-dev.json
Name change of the TracTrac Account
-----------------------------------
Update the wind track data
mongo update command:
db.WIND_TRACKS.update({EVENT_NAME: "Sailing Team Germany"}, { $set: {EVENT_NAME: "Academy Tracking 2011"}}, true, true)
Cloning wind data from one MongoDB instance to another
------------------------------------------------------
10200: MongoDB "dev" instance
10201: MongoDB "test" instance
10202: MontoDB "prod" instance
connect to the mongo shell:
e.g. /opt/mongodb/bin/mongo --port 10202
typical commands:
show dbs displays all the databases on the server you are connected to
use db_name switches to db_name on the same server
show collections displays a list of all the collections in the current database
First, export the WIND_TRACKS collection from one database. For example...
/opt/mongodb/bin/mongoexport --port 10202 -d winddb -c WIND_TRACKS > /tmp/wind-tracks-dev.json
or with an additional query parameter if only want to export the wind of a specific race
/opt/mongodb/bin/mongoexport --port 10202 -d winddb -c WIND_TRACKS -q "{ 'EVENT_NAME': /Arenal Training Camps Regatta 2012/, 'RACE_NAME': /Laser/}" > /tmp/wind-tracks-dev.json
To import the resulting JSON file into the DB instance call:
/opt/mongodb/bin/mongoimport --port 10201 -d winddb -c WIND_TRACKS /tmp/wind-tracks-dev.json
Name change of the TracTrac Account
-----------------------------------
Update the wind track data
mongo update command:
db.WIND_TRACKS.update({EVENT_NAME: "Sailing Team Germany"}, { $set: {EVENT_NAME: "Academy Tracking 2011"}}, true, true)
@@ -1,7 +1,7 @@
Extreme Sailing Series 2012 - Cardiff
Move wind data from test
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Extreme Sailing Series (Extreme40)'}" > /tmp/windtracks-ess40_cardiff.json
to prod
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-ess40_cardiff.json
Extreme Sailing Series 2012 - Cardiff
Move wind data from test
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Extreme Sailing Series (Extreme40)'}" > /tmp/windtracks-ess40_cardiff.json
to prod
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-ess40_cardiff.json
+29 -29
View File
@@ -1,29 +1,29 @@
Kieler Woche 2012
Move wind data from test to prod
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (LASER)'}" > /tmp/windtracks-laser.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (470M)'}" > /tmp/windtracks-470m.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (470W)'}" > /tmp/windtracks-470w.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (49er)'}" > /tmp/windtracks-49er.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (SWAN)'}" > /tmp/windtracks-swan.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (RAD W)'}" > /tmp/windtracks-laserradial.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (Kite)'}" > /tmp/windtracks-kite.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (Finn)'}" > /tmp/windtracks-finn.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (29er)'}" > /tmp/windtracks-29er.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche IC 2012 (STAR)'}" > /tmp/windtracks-star.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche IC 2012 (5o5)'}" > /tmp/windtracks-5o5.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-laser.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-470m.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-470w.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-49er.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-swan.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-laserradial.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-kite.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-finn.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-29er.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-star.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-5o5.json
Kieler Woche 2012
Move wind data from test to prod
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (LASER)'}" > /tmp/windtracks-laser.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (470M)'}" > /tmp/windtracks-470m.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (470W)'}" > /tmp/windtracks-470w.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (49er)'}" > /tmp/windtracks-49er.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (SWAN)'}" > /tmp/windtracks-swan.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (RAD W)'}" > /tmp/windtracks-laserradial.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (Kite)'}" > /tmp/windtracks-kite.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (Finn)'}" > /tmp/windtracks-finn.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche 2012 (29er)'}" > /tmp/windtracks-29er.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche IC 2012 (STAR)'}" > /tmp/windtracks-star.json
/opt/mongodb/bin/mongoexport --port 10201 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'Kieler Woche IC 2012 (5o5)'}" > /tmp/windtracks-5o5.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-laser.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-470m.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-470w.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-49er.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-swan.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-laserradial.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-kite.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-finn.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-29er.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-star.json
/opt/mongodb/bin/mongoimport --port 10202 -d winddb -c WIND_TRACKS /tmp/windtracks-5o5.json
+10 -10
View File
@@ -1,10 +1,10 @@
505 WM La Rochelle
Move wind data from prod to test/dev
/opt/mongodb/bin/mongoexport --port 10202 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'SAP 505 World Championship 2012 (505)'}" > /tmp/windtracks-505.json
to test
/opt/mongodb/bin/mongoimport --port 10201 -d winddb -c WIND_TRACKS /tmp/windtracks-505.json
to dev
/opt/mongodb/bin/mongoimport --port 10200 -d winddb -c WIND_TRACKS /tmp/windtracks-505.json
505 WM La Rochelle
Move wind data from prod to test/dev
/opt/mongodb/bin/mongoexport --port 10202 -d winddb -c WIND_TRACKS -q "{ REGATTA_NAME: 'SAP 505 World Championship 2012 (505)'}" > /tmp/windtracks-505.json
to test
/opt/mongodb/bin/mongoimport --port 10201 -d winddb -c WIND_TRACKS /tmp/windtracks-505.json
to dev
/opt/mongodb/bin/mongoimport --port 10200 -d winddb -c WIND_TRACKS /tmp/windtracks-505.json
+624 -624
View File
File diff suppressed because it is too large. Load diff
+137 -137
View File
@@ -1,137 +1,137 @@
See http://www.rabbitmq.com/download.html
On Windows, setting up RabbitMQ requires downloading Erlang and and RabbitMQ installer.
Although on 64bit, the 64bit Erlang wouldn't work for me, and I installed the 32bit Erlang
and RabbitMQ versions. Those worked ok.
I had to set the following global environment variables:
ERLANG_HOME=c:/Program Files/erl5.9.1/erts-5.9.1/
RABBITMQ_NODENAME=rabbit@localhost
The RABBITMQ_NODENAME setting avoids a strange issue that otherwise happened in my case
when Erlang is trying to lookup my hostname and can't resolve it although it's resolvable
using, e.g., ping.
Starting the RabbitMQ server as a service didn't work. a "rabbitmqctl status" couldn't connect.
Instead, launching the server from the command line did the job:
d043530@WDFN00263037A /cygdrive/c/Program Files (x86)/RabbitMQ Server/rabbitmq_server-2.8.4/sbin
$ ./rabbitmq-server.bat
Activating RabbitMQ plugins ...
0 plugins activated:
+---+ +---+
| | | |
| | | |
| | | |
| +---+ +-------+
| |
| RabbitMQ +---+ |
| | | |
| v2.8.4 +---+ |
| |
+-------------------+
AMQP 0-9-1 / 0-9 / 0-8
Copyright (C) 2007-2012 VMware, Inc.
Licensed under the MPL. See http://www.rabbitmq.com/
node : rabbit@localhost
app descriptor : c:/Program Files (x86)/RabbitMQ Server/rabbitmq_server-2.8.4/sbin/../ebin/rabbit.app
home dir : C:\Users\d043530
config file(s) : (none)
cookie hash : g87gcNH9xrRolSDAnRxCPg==
log : C:/Users/d043530/AppData/Roaming/RabbitMQ/log/rabbit@localhost.log
sasl log : C:/Users/d043530/AppData/Roaming/RabbitMQ/log/rabbit@localhost-sasl.log
database dir : c:/Users/d043530/AppData/Roaming/RabbitMQ/db/rabbit@localhost-mnesia
erlang version : 5.9.1
-- rabbit boot start
starting file handle cache server ...done
starting worker pool ...done
starting database ...done
starting database sync ...done
starting codec correctness check ...done
-- external infrastructure ready
starting plugin registry ...done
starting auth mechanism cr-demo ...done
starting auth mechanism amqplain ...done
starting auth mechanism plain ...done
starting statistics event manager ...done
starting logging server ...done
starting exchange type direct ...done
starting exchange type fanout ...done
starting exchange type headers ...done
starting exchange type topic ...done
-- kernel ready
starting alarm handler ...done
starting node monitor ...done
starting cluster delegate ...done
starting guid generator ...done
starting memory monitor ...done
-- core initialized
starting empty DB check ...done
starting exchange, queue and binding recovery ...done
starting mirror queue slave sup ...done
starting adding mirrors to queues ...done
-- message delivery logic ready
starting error log relay ...done
starting networking ...done
starting direct client ...done
starting notify cluster nodes ...done
broker running
To get a list of the current exchanges declared, try this:
d043530@WDFN00263037A /cygdrive/c/Program Files (x86)/RabbitMQ Server/rabbitmq_server-2.8.4/sbin
$ ./rabbitmqctl.bat list_exchanges
Listing exchanges ...
amq.direct direct
amq.topic topic
updates fanout
amq.rabbitmq.trace topic
amq.rabbitmq.log topic
amq.fanout fanout
amq.headers headers
direct
amq.match headers
...done.
Querying the server state should work with something like this:
d043530@WDFN00263037A /cygdrive/c/Program Files (x86)/RabbitMQ Server/rabbitmq_server-2.8.4/sbin
$ ./rabbitmqctl.bat status
Status of node rabbit@localhost ...
[{pid,7600},
{running_applications,[{rabbit,"RabbitMQ","2.8.4"},
{mnesia,"MNESIA CXC 138 12","4.7"},
{os_mon,"CPO CXC 138 46","2.2.9"},
{sasl,"SASL CXC 138 11","2.2.1"},
{stdlib,"ERTS CXC 138 10","1.18.1"},
{kernel,"ERTS CXC 138 10","2.15.1"}]},
{os,{win32,nt}},
{erlang_version,"Erlang R15B01 (erts-5.9.1) [smp:4:4] [async-threads:30]\n"},
{memory,[{total,14832576},
{processes,5354833},
{processes_used,5354818},
{system,9477743},
{atom,383301},
{atom_used,352292},
{binary,233728},
{code,6334821},
{ets,442068}]},
{vm_memory_high_watermark,0.10174284453305112},
{vm_memory_limit,858993459},
{disk_free_limit,1000000000},
{disk_free,38736687104},
{file_descriptors,[{total_limit,924},
{total_used,4},
{sockets_limit,829},
{sockets_used,2}]},
{processes,[{limit,1048576},{used,126}]},
{run_queue,0},
{uptime,4479}]
...done.
See http://www.rabbitmq.com/download.html
On Windows, setting up RabbitMQ requires downloading Erlang and and RabbitMQ installer.
Although on 64bit, the 64bit Erlang wouldn't work for me, and I installed the 32bit Erlang
and RabbitMQ versions. Those worked ok.
I had to set the following global environment variables:
ERLANG_HOME=c:/Program Files/erl5.9.1/erts-5.9.1/
RABBITMQ_NODENAME=rabbit@localhost
The RABBITMQ_NODENAME setting avoids a strange issue that otherwise happened in my case
when Erlang is trying to lookup my hostname and can't resolve it although it's resolvable
using, e.g., ping.
Starting the RabbitMQ server as a service didn't work. a "rabbitmqctl status" couldn't connect.
Instead, launching the server from the command line did the job:
d043530@WDFN00263037A /cygdrive/c/Program Files (x86)/RabbitMQ Server/rabbitmq_server-2.8.4/sbin
$ ./rabbitmq-server.bat
Activating RabbitMQ plugins ...
0 plugins activated:
+---+ +---+
| | | |
| | | |
| | | |
| +---+ +-------+
| |
| RabbitMQ +---+ |
| | | |
| v2.8.4 +---+ |
| |
+-------------------+
AMQP 0-9-1 / 0-9 / 0-8
Copyright (C) 2007-2012 VMware, Inc.
Licensed under the MPL. See http://www.rabbitmq.com/
node : rabbit@localhost
app descriptor : c:/Program Files (x86)/RabbitMQ Server/rabbitmq_server-2.8.4/sbin/../ebin/rabbit.app
home dir : C:\Users\d043530
config file(s) : (none)
cookie hash : g87gcNH9xrRolSDAnRxCPg==
log : C:/Users/d043530/AppData/Roaming/RabbitMQ/log/rabbit@localhost.log
sasl log : C:/Users/d043530/AppData/Roaming/RabbitMQ/log/rabbit@localhost-sasl.log
database dir : c:/Users/d043530/AppData/Roaming/RabbitMQ/db/rabbit@localhost-mnesia
erlang version : 5.9.1
-- rabbit boot start
starting file handle cache server ...done
starting worker pool ...done
starting database ...done
starting database sync ...done
starting codec correctness check ...done
-- external infrastructure ready
starting plugin registry ...done
starting auth mechanism cr-demo ...done
starting auth mechanism amqplain ...done
starting auth mechanism plain ...done
starting statistics event manager ...done
starting logging server ...done
starting exchange type direct ...done
starting exchange type fanout ...done
starting exchange type headers ...done
starting exchange type topic ...done
-- kernel ready
starting alarm handler ...done
starting node monitor ...done
starting cluster delegate ...done
starting guid generator ...done
starting memory monitor ...done
-- core initialized
starting empty DB check ...done
starting exchange, queue and binding recovery ...done
starting mirror queue slave sup ...done
starting adding mirrors to queues ...done
-- message delivery logic ready
starting error log relay ...done
starting networking ...done
starting direct client ...done
starting notify cluster nodes ...done
broker running
To get a list of the current exchanges declared, try this:
d043530@WDFN00263037A /cygdrive/c/Program Files (x86)/RabbitMQ Server/rabbitmq_server-2.8.4/sbin
$ ./rabbitmqctl.bat list_exchanges
Listing exchanges ...
amq.direct direct
amq.topic topic
updates fanout
amq.rabbitmq.trace topic
amq.rabbitmq.log topic
amq.fanout fanout
amq.headers headers
direct
amq.match headers
...done.
Querying the server state should work with something like this:
d043530@WDFN00263037A /cygdrive/c/Program Files (x86)/RabbitMQ Server/rabbitmq_server-2.8.4/sbin
$ ./rabbitmqctl.bat status
Status of node rabbit@localhost ...
[{pid,7600},
{running_applications,[{rabbit,"RabbitMQ","2.8.4"},
{mnesia,"MNESIA CXC 138 12","4.7"},
{os_mon,"CPO CXC 138 46","2.2.9"},
{sasl,"SASL CXC 138 11","2.2.1"},
{stdlib,"ERTS CXC 138 10","1.18.1"},
{kernel,"ERTS CXC 138 10","2.15.1"}]},
{os,{win32,nt}},
{erlang_version,"Erlang R15B01 (erts-5.9.1) [smp:4:4] [async-threads:30]\n"},
{memory,[{total,14832576},
{processes,5354833},
{processes_used,5354818},
{system,9477743},
{atom,383301},
{atom_used,352292},
{binary,233728},
{code,6334821},
{ets,442068}]},
{vm_memory_high_watermark,0.10174284453305112},
{vm_memory_limit,858993459},
{disk_free_limit,1000000000},
{disk_free,38736687104},
{file_descriptors,[{total_limit,924},
{total_used,4},
{sockets_limit,829},
{sockets_used,2}]},
{processes,[{limit,1048576},{used,126}]},
{run_queue,0},
{uptime,4479}]
...done.
+11 -11
View File
@@ -1,11 +1,11 @@
Exporting swisstiming 'Store and forward' messages
------------------------------------------------------
27012: local MongoDB "winddb" instance
/opt/mongodb/bin/mongoexport --port 27017 -d winddb -c SWISSTIMING_CONFIGURATIONS > /tmp/swisstiming_configurations.json
/opt/mongodb/bin/mongoexport --port 27017 -d winddb -c LAST_MESSAGE_COUNT > /tmp/swisstiming_last_message_count.json
/opt/mongodb/bin/mongoexport --port 27017 -d winddb -c RACES_MASTERDATA > /tmp/swisstiming_races_masterdata.json
/opt/mongodb/bin/mongoexport --port 27017 -d winddb -c RACES_MESSAGES > /tmp/swisstiming_races_massages.json
/opt/mongodb/bin/mongoexport --port 27017 -d winddb -c COMMAND_MESSAGES > /tmp/swisstiming_command_messages.json
Exporting swisstiming 'Store and forward' messages
------------------------------------------------------
27012: local MongoDB "winddb" instance
/opt/mongodb/bin/mongoexport --port 27017 -d winddb -c SWISSTIMING_CONFIGURATIONS > /tmp/swisstiming_configurations.json
/opt/mongodb/bin/mongoexport --port 27017 -d winddb -c LAST_MESSAGE_COUNT > /tmp/swisstiming_last_message_count.json
/opt/mongodb/bin/mongoexport --port 27017 -d winddb -c RACES_MASTERDATA > /tmp/swisstiming_races_masterdata.json
/opt/mongodb/bin/mongoexport --port 27017 -d winddb -c RACES_MESSAGES > /tmp/swisstiming_races_massages.json
/opt/mongodb/bin/mongoexport --port 27017 -d winddb -c COMMAND_MESSAGES > /tmp/swisstiming_command_messages.json
+136 -136
View File
@@ -1,136 +1,136 @@
Logging in:
http://tracms.germanmaster.traclive.dk
Username: baur@sailing-team-germany.de
Password: MarcusBaur
Tracking devices have some kind of an "expiry date" when attached to a
mark. As a clean-up measure, Jakob had to reset some of these expiry
dates.
One database for one "event." Start/end is the start/end date of the
whole regatta. Tracking data received is keyed by time and tracker
association. Only if it's inside the event window the tracker data is
accepted. If a tracker is associated with an event, it's data is
recorded, even if not yet associated with an object. Later, the
tracker may be associated with an object, associating its track with
that object. This way it's possible to recover from various types of
"situations."
Edit an event. As a club event it has a long duration.
Courses - Marks/waypoints:
Show advanced: Tracking device session. Shows tracking device
association to the mark for a time frame. A tracking device cannot be
used for other marks if it is still associated for the time frame
under consideration with another object. Before re-using a tracking
device for a time frame, it must be disassociated with all other
objects for that time frame.
Create a new mark:
Mark's short name must not be longer than two characters. It's
currently not possible to associate trackers to marks if the trackers
are associated to *any* other object with *any* time frame. We
currently have to re-use existing mark definitions because of this
problem.
A mark can also be created without tracking devices associated. Then
show the advanced page for the tracking device. There we can set the
start/end time, and all trackers not associated during this period
should become available for selection / association.
Create a course:
New course, give it a name. Choose "Mark/Waypoint" as Course Type. Add
marks (control points) as waypoint. Can be updated while the race is
on, but marks have to be in the course before the first boat passes
this mark.
Inserting a mark first always appends it to the end. Then, drag&drop
is possible to move it to the desired position in the waypoint
list. Afterwards, "Update" needs to be pressed.
When waypoint data is changed too late, tracking data needs to be
re-run through the system to update the mark passings. This can only
be done by TracTrac administrators.
A course needs to be associated to a race. You cannot have the same
course associated with many races. But a new course's waypoints can be
copied from any other existing course.
Race:
New race; give it a name. Enter start of tracking, end of tracking,
start of race. Times are all UTC. Start of race needs to be between
start and end of tracking. Choose the (default) course. Start of race
can only be entered later, when known. Don't try to change the
course-race association. Edit the course instead. It's a 1:1
association between race and course anyhow since courses cannot
directly be re-used (only copied) in a different race.
Checkbox "Populate start and endtime to entries" means that race
timing is applied to the tracking device sessions associated with the
race.
Editing entries (competitors) information:
It's possible to import from "another race" which typically happens
for fleet races. Competitor information can also be imported from CSV
files. Field names: Short name, Last name, Nationality, Class, Team,
External ID, Tracking device, Picture. Don't use special characters in
the boat class name.
Boat classes and pictures can be maintained under the "Details" menu.
A tracker can be substituted in the Entries page, clicking the
"Replace" button next to the tracking device number, entering a UTC
time for when the replacement shall become effective. If mark passings
have happened in between, mark passings either need to be entered
manually or TracTrac administrators can re-run the data by the mark
passing algorithm.
Manually enter a mark passing:
Go to the races page. Press the SailMarks button (red container). In
the popup dialog the mark passing times can be manually
entered. Automatically-detected mark passings will automatically
update if the algorithm detects a better candidate for the mark
passing. Manually entered mark passings may be overwritten by the
algorithm, also during a re-run.
Replacing a tracker on a mark: click the replace button next to a mark
in the marks list.
Monitoring page:
When the battery indicator shows a dying battery, we can schedule a
planned replacement.
Send interval configuration: Clicking the checkbox next to the device
in the monitoring page enables sending an SMS to the device. For this,
we need to inform TracTrac about which SIM card with which phone
number went into which tracker. This can be provided in a CSV file
that has the format "tracker-ID;phone-number" where the phone number
starts with the country prefix, e.g. "1".
Green button will reboot the devices with checkmarks on. The device
rebooted will send all buffered information once back up.
A Teltonika command can be sent to all devices wich checkmark
set. "CF1;" "CF2;" and "CF3;" are the commands to send the device into
the respective mode. CF1 is most aggressive (quickest possible
sampling, sending out directly); CF2 sends every 15 seconds; CF3 sends
every 120 seconds.
Recharging a depleted battery takes about 3h. Batteries can be
replaced. It's a standard Nokia battery: BL-5C
- registering boat and mark trackers
- setting up the fleet
- defining the course with the marks
- setting and updating the start time
- fixing erroneous mark passing events
- updating a course before and during a race
Logging in:
http://tracms.germanmaster.traclive.dk
Username: baur@sailing-team-germany.de
Password: MarcusBaur
Tracking devices have some kind of an "expiry date" when attached to a
mark. As a clean-up measure, Jakob had to reset some of these expiry
dates.
One database for one "event." Start/end is the start/end date of the
whole regatta. Tracking data received is keyed by time and tracker
association. Only if it's inside the event window the tracker data is
accepted. If a tracker is associated with an event, it's data is
recorded, even if not yet associated with an object. Later, the
tracker may be associated with an object, associating its track with
that object. This way it's possible to recover from various types of
"situations."
Edit an event. As a club event it has a long duration.
Courses - Marks/waypoints:
Show advanced: Tracking device session. Shows tracking device
association to the mark for a time frame. A tracking device cannot be
used for other marks if it is still associated for the time frame
under consideration with another object. Before re-using a tracking
device for a time frame, it must be disassociated with all other
objects for that time frame.
Create a new mark:
Mark's short name must not be longer than two characters. It's
currently not possible to associate trackers to marks if the trackers
are associated to *any* other object with *any* time frame. We
currently have to re-use existing mark definitions because of this
problem.
A mark can also be created without tracking devices associated. Then
show the advanced page for the tracking device. There we can set the
start/end time, and all trackers not associated during this period
should become available for selection / association.
Create a course:
New course, give it a name. Choose "Mark/Waypoint" as Course Type. Add
marks (control points) as waypoint. Can be updated while the race is
on, but marks have to be in the course before the first boat passes
this mark.
Inserting a mark first always appends it to the end. Then, drag&drop
is possible to move it to the desired position in the waypoint
list. Afterwards, "Update" needs to be pressed.
When waypoint data is changed too late, tracking data needs to be
re-run through the system to update the mark passings. This can only
be done by TracTrac administrators.
A course needs to be associated to a race. You cannot have the same
course associated with many races. But a new course's waypoints can be
copied from any other existing course.
Race:
New race; give it a name. Enter start of tracking, end of tracking,
start of race. Times are all UTC. Start of race needs to be between
start and end of tracking. Choose the (default) course. Start of race
can only be entered later, when known. Don't try to change the
course-race association. Edit the course instead. It's a 1:1
association between race and course anyhow since courses cannot
directly be re-used (only copied) in a different race.
Checkbox "Populate start and endtime to entries" means that race
timing is applied to the tracking device sessions associated with the
race.
Editing entries (competitors) information:
It's possible to import from "another race" which typically happens
for fleet races. Competitor information can also be imported from CSV
files. Field names: Short name, Last name, Nationality, Class, Team,
External ID, Tracking device, Picture. Don't use special characters in
the boat class name.
Boat classes and pictures can be maintained under the "Details" menu.
A tracker can be substituted in the Entries page, clicking the
"Replace" button next to the tracking device number, entering a UTC
time for when the replacement shall become effective. If mark passings
have happened in between, mark passings either need to be entered
manually or TracTrac administrators can re-run the data by the mark
passing algorithm.
Manually enter a mark passing:
Go to the races page. Press the SailMarks button (red container). In
the popup dialog the mark passing times can be manually
entered. Automatically-detected mark passings will automatically
update if the algorithm detects a better candidate for the mark
passing. Manually entered mark passings may be overwritten by the
algorithm, also during a re-run.
Replacing a tracker on a mark: click the replace button next to a mark
in the marks list.
Monitoring page:
When the battery indicator shows a dying battery, we can schedule a
planned replacement.
Send interval configuration: Clicking the checkbox next to the device
in the monitoring page enables sending an SMS to the device. For this,
we need to inform TracTrac about which SIM card with which phone
number went into which tracker. This can be provided in a CSV file
that has the format "tracker-ID;phone-number" where the phone number
starts with the country prefix, e.g. "1".
Green button will reboot the devices with checkmarks on. The device
rebooted will send all buffered information once back up.
A Teltonika command can be sent to all devices wich checkmark
set. "CF1;" "CF2;" and "CF3;" are the commands to send the device into
the respective mode. CF1 is most aggressive (quickest possible
sampling, sending out directly); CF2 sends every 15 seconds; CF3 sends
every 120 seconds.
Recharging a depleted battery takes about 3h. Batteries can be
replaced. It's a standard Nokia battery: BL-5C
- registering boat and mark trackers
- setting up the fleet
- defining the course with the marks
- setting and updating the start time
- fixing erroneous mark passing events
- updating a course before and during a race
+72 -72
View File
@@ -1,72 +1,72 @@
Trac Trac accounts and their access parameters
Internationale Deutsche Meisterschaften
http://germanmaster.traclive.dk/events/event_20110929_Internatio/jsonservice.php
Sailing Team Germany
http://germanmaster.traclive.dk/events/event_20110505_SailingTea/jsonservice.php
Kieler Woche
http://germanmaster.traclive.dk/events/event_20110609_KielerWoch/jsonservice.php
Live-URI: tcp://germanmaster.traclive.dk:1520
Stored-URI: tcp://germanmaster.traclive.dk:1521
Arenal Training Camps Regatta 2012
http://germanmaster.traclive.dk/events/event_20120314_ArenalTrai/jsonservice.php
Live-URI: tcp://germanmaster.traclive.dk:1520
Stored-URI: tcp://germanmaster.traclive.dk:1521
SAP 2011 505 World Championship
http://germanmaster.traclive.dk/events/event_20110308_SAPWorldCh/jsonservice.php
Live-URI: tcp://germanmaster.traclive.dk:1520
Stored-URI: tcp://germanmaster.traclive.dk:1521
505 Worlds 2010
http://germanmaster.traclive.dk/events/event_20100725_OWorlds/jsonservice.php
Live-URI: tcp://germanmaster.traclive.dk:1520
Stored-URI: tcp://germanmaster.traclive.dk:1521
505 World Championship 2012:
http://germanmaster.traclive.dk/events/event_20120714_SAPWorldCh/jsonservice.php
Kieler Woche 2012:
http://germanmaster.traclive.dk/events/event_20120615_KielerWoch/jsonservice.php
http://germanmaster.traclive.dk/events/event_20120621_KielerWoch/jsonservice.php
http://germanmaster.traclive.dk/events/event_20120615_KielerWoch1/jsonservice.php
Extreme Sailing Series 2012:
http://germanmaster.traclive.dk/events/event_20120101_ExtremeSai/jsonservice.php
OBMR 2012:
http://germanmaster.traclive.dk/events/event_20121031_OBMR/jsonservice.php
Academy Tracking 2011:
http://germanmaster.traclive.dk/events/event_20110505_SailingTea/jsonservice.php
Academy Tracking 2012:
http://germanmaster.traclive.dk/events/event_20120501_SailingTea/jsonservice.php
BMW Cup:
http://kml.skitrac.traclive.dk/events/event_20120803_BMWCup/jsonservice.php
YES 2012:
http://germanmaster.traclive.dk/events/event_20120525_YES/jsonservice.php
IDM Drachen 2012:
http://kml.skitrac.traclive.dk/events/event_20120730_IDMDrachen/jsonservice.php
49er European Championship:
http://traclive.dk/events/event_20120905_erEuropean/jsonservice.php
RC44 Sweden Cup:
http://germanmaster.traclive.dk/events/event_20110815_RCSwedenCu/jsonservice.php
Extreme Sailing Series 2013:
Traclive
http://traclive.dk/events/event_20130302_ESSMuscat/jsonservice.php
Live: tcp://traclive.dk:44005
Stored: tcp://traclive.dk:44015
LocalServer
http://192.168.1.46/events/event_20130302_ESSMuscat/jsonservice.php
Live: tcp://192.168.1.46:4400
Stored: tcp://192.168.1.46:4401
Trac Trac accounts and their access parameters
Internationale Deutsche Meisterschaften
http://germanmaster.traclive.dk/events/event_20110929_Internatio/jsonservice.php
Sailing Team Germany
http://germanmaster.traclive.dk/events/event_20110505_SailingTea/jsonservice.php
Kieler Woche
http://germanmaster.traclive.dk/events/event_20110609_KielerWoch/jsonservice.php
Live-URI: tcp://germanmaster.traclive.dk:1520
Stored-URI: tcp://germanmaster.traclive.dk:1521
Arenal Training Camps Regatta 2012
http://germanmaster.traclive.dk/events/event_20120314_ArenalTrai/jsonservice.php
Live-URI: tcp://germanmaster.traclive.dk:1520
Stored-URI: tcp://germanmaster.traclive.dk:1521
SAP 2011 505 World Championship
http://germanmaster.traclive.dk/events/event_20110308_SAPWorldCh/jsonservice.php
Live-URI: tcp://germanmaster.traclive.dk:1520
Stored-URI: tcp://germanmaster.traclive.dk:1521
505 Worlds 2010
http://germanmaster.traclive.dk/events/event_20100725_OWorlds/jsonservice.php
Live-URI: tcp://germanmaster.traclive.dk:1520
Stored-URI: tcp://germanmaster.traclive.dk:1521
505 World Championship 2012:
http://germanmaster.traclive.dk/events/event_20120714_SAPWorldCh/jsonservice.php
Kieler Woche 2012:
http://germanmaster.traclive.dk/events/event_20120615_KielerWoch/jsonservice.php
http://germanmaster.traclive.dk/events/event_20120621_KielerWoch/jsonservice.php
http://germanmaster.traclive.dk/events/event_20120615_KielerWoch1/jsonservice.php
Extreme Sailing Series 2012:
http://germanmaster.traclive.dk/events/event_20120101_ExtremeSai/jsonservice.php
OBMR 2012:
http://germanmaster.traclive.dk/events/event_20121031_OBMR/jsonservice.php
Academy Tracking 2011:
http://germanmaster.traclive.dk/events/event_20110505_SailingTea/jsonservice.php
Academy Tracking 2012:
http://germanmaster.traclive.dk/events/event_20120501_SailingTea/jsonservice.php
BMW Cup:
http://kml.skitrac.traclive.dk/events/event_20120803_BMWCup/jsonservice.php
YES 2012:
http://germanmaster.traclive.dk/events/event_20120525_YES/jsonservice.php
IDM Drachen 2012:
http://kml.skitrac.traclive.dk/events/event_20120730_IDMDrachen/jsonservice.php
49er European Championship:
http://traclive.dk/events/event_20120905_erEuropean/jsonservice.php
RC44 Sweden Cup:
http://germanmaster.traclive.dk/events/event_20110815_RCSwedenCu/jsonservice.php
Extreme Sailing Series 2013:
Traclive
http://traclive.dk/events/event_20130302_ESSMuscat/jsonservice.php
Live: tcp://traclive.dk:44005
Stored: tcp://traclive.dk:44015
LocalServer
http://192.168.1.46/events/event_20130302_ESSMuscat/jsonservice.php
Live: tcp://192.168.1.46:4400
Stored: tcp://192.168.1.46:4401
+874580 -874580
View File
File diff suppressed because it is too large. Load diff
+30 -30
View File
@@ -1,31 +1,31 @@
# Welcome to the SAP Sailing Wiki
This is the <img src="http://analysis.sapsailing.com/themes/logo.png" height="58" width="200" /> Wiki where useful information regarding this project can be found.
### The Pitch
Like businesses, sailors need the latest information to make strategic decisions - but they need it even faster. One wrong tack, a false estimation of the current, or the slightest wind shift can cost the skipper the entire race. As premium sponsor of the Kieler Woche 2011, and co-sponsor of Sailing Team Germany (STG), SAP is showing how innovative IT solutions providing real time data analysis can give teams the competitive edge.
### Table of Contents
* [[Information about this Wiki and HowTo|wiki/howto]]
* [[General Project Information|wiki/general-information]]
* [[OnBoarding Information|wiki/onboarding]]
* [[Architecture and Infrastructure|wiki/architecture-and-infrastructure]]
* [[Production Environment|wiki/production-environment]]
* [[Development Environment|wiki/development-environment]]
* [[Server Replication|wiki/server-replication]]
* [[Configure Races on Server|wiki/configure-races-on-server]]
* [[Cook Book|wiki/cook-book]]
* [[Planning|wiki/planning]]
* Event Specifica
* [[General Planning|wiki/general-event-planning]]
* [[Extreme Sailing Series|wiki/extreme-sailing-series]]
### Internal services (not related to wiki but useful)
* [Bugzilla Issue Tracking System](http://bugzilla.sapsailing.com/bugzilla/)
* [GIT Repository (SAP)](ssh://git.wdf.sap.corp:29418/SAPSail/sapsailingcapture.git)
* [Maven Repository Browser](http://maven.sapsailing.com/maven/)
* [Main Sailing Website](http://www.sapsailing.com)
# Welcome to the SAP Sailing Wiki
This is the <img src="http://analysis.sapsailing.com/themes/logo.png" height="58" width="200" /> Wiki where useful information regarding this project can be found.
### The Pitch
Like businesses, sailors need the latest information to make strategic decisions - but they need it even faster. One wrong tack, a false estimation of the current, or the slightest wind shift can cost the skipper the entire race. As premium sponsor of the Kieler Woche 2011, and co-sponsor of Sailing Team Germany (STG), SAP is showing how innovative IT solutions providing real time data analysis can give teams the competitive edge.
### Table of Contents
* [[Information about this Wiki and HowTo|wiki/howto]]
* [[General Project Information|wiki/general-information]]
* [[OnBoarding Information|wiki/onboarding]]
* [[Architecture and Infrastructure|wiki/architecture-and-infrastructure]]
* [[Production Environment|wiki/production-environment]]
* [[Development Environment|wiki/development-environment]]
* [[Server Replication|wiki/server-replication]]
* [[Configure Races on Server|wiki/configure-races-on-server]]
* [[Cook Book|wiki/cook-book]]
* [[Planning|wiki/planning]]
* Event Specifica
* [[General Planning|wiki/general-event-planning]]
* [[Extreme Sailing Series|wiki/extreme-sailing-series]]
### Internal services (not related to wiki but useful)
* [Bugzilla Issue Tracking System](http://bugzilla.sapsailing.com/bugzilla/)
* [GIT Repository (SAP)](ssh://git.wdf.sap.corp:29418/SAPSail/sapsailingcapture.git)
* [Maven Repository Browser](http://maven.sapsailing.com/maven/)
* [Main Sailing Website](http://www.sapsailing.com)
* [Visitor Statistics](http://analysis.sapsailing.com/)
+4 -4
View File
@@ -1,4 +1,4 @@
build.log
gwt-unitCache
bin/
log
build.log
gwt-unitCache
bin/
log
+5 -5
View File
@@ -1,5 +1,5 @@
#Fri Jul 29 09:33:48 CEST 2011
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
#Fri Jul 29 09:33:48 CEST 2011
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
+291 -291
View File
@@ -1,291 +1,291 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="Spaces" version="12">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<setting id="org.eclipse.jdt.core.compiler.source" value="1.7"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="8"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.7"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.7"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
</profile>
</profiles>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="Spaces" version="12">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<setting id="org.eclipse.jdt.core.compiler.source" value="1.7"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="8"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.7"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.7"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
</profile>
</profiles>
+10 -10
View File
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/gwt-dev.jar"/>
<classpathentry exported="true" kind="lib" path="lib/gwt-user.jar"/>
<classpathentry exported="true" kind="lib" path="lib/validation-api-1.0.0.GA-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/validation-api-1.0.0.GA.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/gwt-dev.jar"/>
<classpathentry exported="true" kind="lib" path="lib/gwt-user.jar"/>
<classpathentry exported="true" kind="lib" path="lib/validation-api-1.0.0.GA-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/validation-api-1.0.0.GA.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
+1 -1
View File
@@ -1 +1 @@
bin
bin
+28 -28
View File
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.google.gwt.osgi</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.google.gwt.osgi</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -1,8 +1,8 @@
#Thu Jan 19 09:46:08 CET 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
#Thu Jan 19 09:46:08 CET 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
@@ -1,4 +1,4 @@
#Mon Jul 04 13:02:58 CEST 2011
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false
#Mon Jul 04 13:02:58 CEST 2011
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false
File diff suppressed because it is too large. Load diff
+6 -6
View File
@@ -1,6 +1,6 @@
bin.includes = META-INF/,\
.,\
lib/gwt-dev.jar,\
lib/gwt-user.jar,\
lib/validation-api-1.0.0.GA-sources.jar,\
lib/validation-api-1.0.0.GA.jar
bin.includes = META-INF/,\
.,\
lib/gwt-dev.jar,\
lib/gwt-user.jar,\
lib/validation-api-1.0.0.GA-sources.jar,\
lib/validation-api-1.0.0.GA.jar
+13 -13
View File
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>root</artifactId>
<groupId>com.sap.sailing</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.google.gwt.osgi</artifactId>
<version>2.5.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>root</artifactId>
<groupId>com.sap.sailing</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.google.gwt.osgi</artifactId>
<version>2.5.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="test" sourcepath="test"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="test" sourcepath="test"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -1 +1 @@
bin/
bin/
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.googlecode.java-diff-utils.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.googlecode.java-diff-utils.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -1,8 +1,8 @@
#Thu Jan 19 09:47:34 CET 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
#Thu Jan 19 09:47:34 CET 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
@@ -1,5 +1,5 @@
#Fri Jul 29 09:33:56 CEST 2011
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
#Fri Jul 29 09:33:56 CEST 2011
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
@@ -1,4 +1,4 @@
#Fri Jun 10 10:54:00 CEST 2011
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false
#Fri Jun 10 10:54:00 CEST 2011
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false
@@ -1,11 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Test
Bundle-SymbolicName: com.googlecode.java-diff-utils.test
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: GOOGLECODE
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Fragment-Host: com.googlecode.java-diff-utils
Bundle-ClassPath: test/,
.
Import-Package: junit.framework;version="4.8.1"
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Test
Bundle-SymbolicName: com.googlecode.java-diff-utils.test
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: GOOGLECODE
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Fragment-Host: com.googlecode.java-diff-utils
Bundle-ClassPath: test/,
.
Import-Package: junit.framework;version="4.8.1"
@@ -1,6 +1,6 @@
source.. = src/
output.. = bin/,\
test
bin.includes = META-INF/,\
.,\
test/
source.. = src/
output.. = bin/,\
test
bin.includes = META-INF/,\
.,\
test/
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>root</artifactId>
<groupId>com.sap.sailing</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.googlecode.java-diff-utils.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>root</artifactId>
<groupId>com.sap.sailing</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.googlecode.java-diff-utils.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
</project>
@@ -1,27 +1,27 @@
package diffutils;
import java.io.File;
import java.util.List;
import difflib.DiffUtils;
import difflib.Patch;
import difflib.PatchFailedException;
public class ApplyPatch extends Example {
static final String FS = File.separator;
static final String ORIGINAL = "test" + FS + "mocks" + FS + "issue10_base.txt";
static final String PATCH = "test" + FS + "mocks" + FS + "issue10_patch.txt";
public static void main(String[] args) throws PatchFailedException {
List<String> original = fileToLines(ORIGINAL);
List<String> patched = fileToLines(PATCH);
// At first, parse the unified diff file and get the patch
Patch<String> patch = DiffUtils.parseUnifiedDiff(patched);
// Then apply the computed patch to the given text
List<String> result = DiffUtils.patch(original, patch);
System.out.println(result);
/// Or we can call patch.applyTo(original). There is no difference.
}
}
package diffutils;
import java.io.File;
import java.util.List;
import difflib.DiffUtils;
import difflib.Patch;
import difflib.PatchFailedException;
public class ApplyPatch extends Example {
static final String FS = File.separator;
static final String ORIGINAL = "test" + FS + "mocks" + FS + "issue10_base.txt";
static final String PATCH = "test" + FS + "mocks" + FS + "issue10_patch.txt";
public static void main(String[] args) throws PatchFailedException {
List<String> original = fileToLines(ORIGINAL);
List<String> patched = fileToLines(PATCH);
// At first, parse the unified diff file and get the patch
Patch<String> patch = DiffUtils.parseUnifiedDiff(patched);
// Then apply the computed patch to the given text
List<String> result = DiffUtils.patch(original, patch);
System.out.println(result);
/// Or we can call patch.applyTo(original). There is no difference.
}
}
@@ -1,26 +1,26 @@
package diffutils;
import java.io.File;
import java.util.List;
import difflib.Delta;
import difflib.DiffUtils;
import difflib.Patch;
public class ComputeDifference extends Example {
static final String FS = File.separator;
static final String ORIGINAL = "test" + FS + "mocks" + FS + "original.txt";
static final String REVISED = "test" + FS + "mocks" + FS + "revised.txt";
public static void main(String[] args) {
List<String> original = fileToLines(ORIGINAL);
List<String> revised = fileToLines(REVISED);
// Compute diff. Get the Patch object. Patch is the container for computed deltas.
Patch<String> patch = DiffUtils.diff(original, revised);
for (Delta<String> delta: patch.getDeltas()) {
System.out.println(delta);
}
}
}
package diffutils;
import java.io.File;
import java.util.List;
import difflib.Delta;
import difflib.DiffUtils;
import difflib.Patch;
public class ComputeDifference extends Example {
static final String FS = File.separator;
static final String ORIGINAL = "test" + FS + "mocks" + FS + "original.txt";
static final String REVISED = "test" + FS + "mocks" + FS + "revised.txt";
public static void main(String[] args) {
List<String> original = fileToLines(ORIGINAL);
List<String> revised = fileToLines(REVISED);
// Compute diff. Get the Patch object. Patch is the container for computed deltas.
Patch<String> patch = DiffUtils.diff(original, revised);
for (Delta<String> delta: patch.getDeltas()) {
System.out.println(delta);
}
}
}
@@ -1,61 +1,61 @@
package diffutils;
import difflib.*;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class DiffTest extends TestCase {
public void testDiff_Insert() {
final Patch<String> patch = DiffUtils.diff(Arrays.asList("hhh"), Arrays.asList("hhh", "jjj", "kkk"));
assertNotNull(patch);
assertEquals(1, patch.getDeltas().size());
final Delta<String> delta = patch.getDeltas().get(0);
assertEquals(InsertDelta.class, delta.getClass());
List<String> emptyList = Collections.emptyList();
assertEquals(new Chunk<String>(1, emptyList), delta.getOriginal());
assertEquals(new Chunk<String>(1, Arrays.asList("jjj", "kkk")), delta.getRevised());
}
public void testDiff_Delete() {
final Patch<String> patch = DiffUtils.diff(Arrays.asList("ddd", "fff", "ggg"), Arrays.asList("ggg"));
assertNotNull(patch);
assertEquals(1, patch.getDeltas().size());
final Delta<String> delta = patch.getDeltas().get(0);
assertEquals(DeleteDelta.class, delta.getClass());
assertEquals(new Chunk<String>(0, Arrays.asList("ddd", "fff")), delta.getOriginal());
List<String> emptyList = Collections.emptyList();
assertEquals(new Chunk<String>(0, emptyList), delta.getRevised());
}
public void testDiff_Change() {
final List<String> changeTest_from = Arrays.asList("aaa", "bbb", "ccc");
final List<String> changeTest_to = Arrays.asList("aaa", "zzz", "ccc");
final Patch<String> patch = DiffUtils.diff(changeTest_from, changeTest_to);
assertNotNull(patch);
assertEquals(1, patch.getDeltas().size());
final Delta<String> delta = patch.getDeltas().get(0);
assertEquals(ChangeDelta.class, delta.getClass());
assertEquals(new Chunk<String>(1, Arrays.asList("bbb")), delta.getOriginal());
assertEquals(new Chunk<String>(1, Arrays.asList("zzz")), delta.getRevised());
}
public void testDiff_EmptyList() {
final Patch<String> patch = DiffUtils.diff(new ArrayList<String>(), new ArrayList<String>());
assertNotNull(patch);
assertEquals(0, patch.getDeltas().size());
}
public void testDiff_EmptyListWithNonEmpty() {
final Patch<String> patch = DiffUtils.diff(new ArrayList<String>(), Arrays.asList("aaa"));
assertNotNull(patch);
assertEquals(1, patch.getDeltas().size());
final Delta<String> delta = patch.getDeltas().get(0);
assertEquals(InsertDelta.class, delta.getClass());
}
}
package diffutils;
import difflib.*;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class DiffTest extends TestCase {
public void testDiff_Insert() {
final Patch<String> patch = DiffUtils.diff(Arrays.asList("hhh"), Arrays.asList("hhh", "jjj", "kkk"));
assertNotNull(patch);
assertEquals(1, patch.getDeltas().size());
final Delta<String> delta = patch.getDeltas().get(0);
assertEquals(InsertDelta.class, delta.getClass());
List<String> emptyList = Collections.emptyList();
assertEquals(new Chunk<String>(1, emptyList), delta.getOriginal());
assertEquals(new Chunk<String>(1, Arrays.asList("jjj", "kkk")), delta.getRevised());
}
public void testDiff_Delete() {
final Patch<String> patch = DiffUtils.diff(Arrays.asList("ddd", "fff", "ggg"), Arrays.asList("ggg"));
assertNotNull(patch);
assertEquals(1, patch.getDeltas().size());
final Delta<String> delta = patch.getDeltas().get(0);
assertEquals(DeleteDelta.class, delta.getClass());
assertEquals(new Chunk<String>(0, Arrays.asList("ddd", "fff")), delta.getOriginal());
List<String> emptyList = Collections.emptyList();
assertEquals(new Chunk<String>(0, emptyList), delta.getRevised());
}
public void testDiff_Change() {
final List<String> changeTest_from = Arrays.asList("aaa", "bbb", "ccc");
final List<String> changeTest_to = Arrays.asList("aaa", "zzz", "ccc");
final Patch<String> patch = DiffUtils.diff(changeTest_from, changeTest_to);
assertNotNull(patch);
assertEquals(1, patch.getDeltas().size());
final Delta<String> delta = patch.getDeltas().get(0);
assertEquals(ChangeDelta.class, delta.getClass());
assertEquals(new Chunk<String>(1, Arrays.asList("bbb")), delta.getOriginal());
assertEquals(new Chunk<String>(1, Arrays.asList("zzz")), delta.getRevised());
}
public void testDiff_EmptyList() {
final Patch<String> patch = DiffUtils.diff(new ArrayList<String>(), new ArrayList<String>());
assertNotNull(patch);
assertEquals(0, patch.getDeltas().size());
}
public void testDiff_EmptyListWithNonEmpty() {
final Patch<String> patch = DiffUtils.diff(new ArrayList<String>(), Arrays.asList("aaa"));
assertNotNull(patch);
assertEquals(1, patch.getDeltas().size());
final Delta<String> delta = patch.getDeltas().get(0);
assertEquals(InsertDelta.class, delta.getClass());
}
}
@@ -1,24 +1,24 @@
package diffutils;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
public class Example {
public static List<String> fileToLines(String filename) {
List<String> lines = new LinkedList<String>();
String line = "";
try {
BufferedReader in = new BufferedReader(new FileReader(filename));
while ((line = in.readLine()) != null) {
lines.add(line);
}
in.close();
} catch (IOException e) {
e.printStackTrace();
}
return lines;
}
}
package diffutils;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
public class Example {
public static List<String> fileToLines(String filename) {
List<String> lines = new LinkedList<String>();
String line = "";
try {
BufferedReader in = new BufferedReader(new FileReader(filename));
while ((line = in.readLine()) != null) {
lines.add(line);
}
in.close();
} catch (IOException e) {
e.printStackTrace();
}
return lines;
}
}
@@ -1,129 +1,129 @@
package diffutils;
import difflib.DiffUtils;
import difflib.Patch;
import difflib.PatchFailedException;
import junit.framework.TestCase;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class GenerateUnifiedDiffTest extends TestCase {
private static final String FS = File.separator;
private static final String MOCK_FOLDER = "test" + FS + "mocks" + FS;
public List<String> fileToLines(String filename) {
List<String> lines = new LinkedList<String>();
String line = "";
try {
BufferedReader in = new BufferedReader(new FileReader(filename));
while ((line = in.readLine()) != null) {
lines.add(line);
}
in.close();
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
}
return lines;
}
public void testGenerateUnified() {
List<String> origLines = fileToLines(MOCK_FOLDER + "original.txt");
List<String> revLines = fileToLines(MOCK_FOLDER + "revised.txt");
verify(origLines, revLines, "original.txt", "revised.txt");
}
public void testGenerateUnifiedWithOneDelta() {
List<String> origLines = fileToLines(MOCK_FOLDER + "one_delta_test_original.txt");
List<String> revLines = fileToLines(MOCK_FOLDER + "one_delta_test_revised.txt");
verify(origLines, revLines, "one_delta_test_original.txt", "one_delta_test_revised.txt");
}
public void testGenerateUnifiedDiffWithoutAnyDeltas() {
List<String> test = Arrays.asList("abc");
Patch<String> patch = DiffUtils.diff(test, test);
DiffUtils.generateUnifiedDiff("abc", "abc", test, patch, 0);
}
public void testDiff_Issue10() {
final List<String> baseLines = fileToLines(MOCK_FOLDER + "issue10_base.txt");
final List<String> patchLines = fileToLines(MOCK_FOLDER + "issue10_patch.txt");
final Patch<String> p = DiffUtils.parseUnifiedDiff(patchLines);
try {
DiffUtils.patch(baseLines, p);
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
/**
* Issue 12
*/
public void testPatchWithNoDeltas() {
final List<String> lines1 = fileToLines(MOCK_FOLDER + "issue11_1.txt");
final List<String> lines2 = fileToLines(MOCK_FOLDER + "issue11_2.txt");
verify(lines1, lines2, "issue11_1.txt", "issue11_2.txt");
}
public void testDiff5() {
final List<String> lines1 = fileToLines(MOCK_FOLDER + "5A.txt");
final List<String> lines2 = fileToLines(MOCK_FOLDER + "5B.txt");
verify(lines1, lines2, "5A.txt", "5B.txt");
}
/**
* Issue 19
*/
public void testDiffWithHeaderLineInText() {
List<String> original = new ArrayList<String>();
List<String> revised = new ArrayList<String>();
original.add("test line1");
original.add("test line2");
original.add("test line 4");
original.add("test line 5");
revised.add("test line1");
revised.add("test line2");
revised.add("@@ -2,6 +2,7 @@");
revised.add("test line 4");
revised.add("test line 5");
Patch<String> patch = DiffUtils.diff(original, revised);
List<String> udiff = DiffUtils.generateUnifiedDiff("original", "revised",
original, patch, 10);
DiffUtils.parseUnifiedDiff(udiff);
}
private void verify(List<String> origLines, List<String> revLines,
String originalFile, String revisedFile) {
Patch<String> patch = DiffUtils.diff(origLines, revLines);
List<String> unifiedDiff = DiffUtils.generateUnifiedDiff(originalFile, revisedFile,
origLines, patch, 10);
Patch<String> fromUnifiedPatch = DiffUtils.parseUnifiedDiff(unifiedDiff);
List<String> patchedLines;
try {
patchedLines = (List<String>) fromUnifiedPatch.applyTo(origLines);
assertTrue(revLines.size() == patchedLines.size());
for (int i = 0; i < revLines.size(); i++) {
String l1 = revLines.get(i);
String l2 = patchedLines.get(i);
if (!l1.equals(l2)) {
fail("Line " + (i + 1) + " of the patched file did not match the revised original");
}
}
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
}
package diffutils;
import difflib.DiffUtils;
import difflib.Patch;
import difflib.PatchFailedException;
import junit.framework.TestCase;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class GenerateUnifiedDiffTest extends TestCase {
private static final String FS = File.separator;
private static final String MOCK_FOLDER = "test" + FS + "mocks" + FS;
public List<String> fileToLines(String filename) {
List<String> lines = new LinkedList<String>();
String line = "";
try {
BufferedReader in = new BufferedReader(new FileReader(filename));
while ((line = in.readLine()) != null) {
lines.add(line);
}
in.close();
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
}
return lines;
}
public void testGenerateUnified() {
List<String> origLines = fileToLines(MOCK_FOLDER + "original.txt");
List<String> revLines = fileToLines(MOCK_FOLDER + "revised.txt");
verify(origLines, revLines, "original.txt", "revised.txt");
}
public void testGenerateUnifiedWithOneDelta() {
List<String> origLines = fileToLines(MOCK_FOLDER + "one_delta_test_original.txt");
List<String> revLines = fileToLines(MOCK_FOLDER + "one_delta_test_revised.txt");
verify(origLines, revLines, "one_delta_test_original.txt", "one_delta_test_revised.txt");
}
public void testGenerateUnifiedDiffWithoutAnyDeltas() {
List<String> test = Arrays.asList("abc");
Patch<String> patch = DiffUtils.diff(test, test);
DiffUtils.generateUnifiedDiff("abc", "abc", test, patch, 0);
}
public void testDiff_Issue10() {
final List<String> baseLines = fileToLines(MOCK_FOLDER + "issue10_base.txt");
final List<String> patchLines = fileToLines(MOCK_FOLDER + "issue10_patch.txt");
final Patch<String> p = DiffUtils.parseUnifiedDiff(patchLines);
try {
DiffUtils.patch(baseLines, p);
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
/**
* Issue 12
*/
public void testPatchWithNoDeltas() {
final List<String> lines1 = fileToLines(MOCK_FOLDER + "issue11_1.txt");
final List<String> lines2 = fileToLines(MOCK_FOLDER + "issue11_2.txt");
verify(lines1, lines2, "issue11_1.txt", "issue11_2.txt");
}
public void testDiff5() {
final List<String> lines1 = fileToLines(MOCK_FOLDER + "5A.txt");
final List<String> lines2 = fileToLines(MOCK_FOLDER + "5B.txt");
verify(lines1, lines2, "5A.txt", "5B.txt");
}
/**
* Issue 19
*/
public void testDiffWithHeaderLineInText() {
List<String> original = new ArrayList<String>();
List<String> revised = new ArrayList<String>();
original.add("test line1");
original.add("test line2");
original.add("test line 4");
original.add("test line 5");
revised.add("test line1");
revised.add("test line2");
revised.add("@@ -2,6 +2,7 @@");
revised.add("test line 4");
revised.add("test line 5");
Patch<String> patch = DiffUtils.diff(original, revised);
List<String> udiff = DiffUtils.generateUnifiedDiff("original", "revised",
original, patch, 10);
DiffUtils.parseUnifiedDiff(udiff);
}
private void verify(List<String> origLines, List<String> revLines,
String originalFile, String revisedFile) {
Patch<String> patch = DiffUtils.diff(origLines, revLines);
List<String> unifiedDiff = DiffUtils.generateUnifiedDiff(originalFile, revisedFile,
origLines, patch, 10);
Patch<String> fromUnifiedPatch = DiffUtils.parseUnifiedDiff(unifiedDiff);
List<String> patchedLines;
try {
patchedLines = (List<String>) fromUnifiedPatch.applyTo(origLines);
assertTrue(revLines.size() == patchedLines.size());
for (int i = 0; i < revLines.size(); i++) {
String l1 = revLines.get(i);
String l2 = patchedLines.get(i);
if (!l1.equals(l2)) {
fail("Line " + (i + 1) + " of the patched file did not match the revised original");
}
}
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
}
@@ -1,64 +1,64 @@
package diffutils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import junit.framework.TestCase;
import difflib.DiffUtils;
import difflib.Patch;
import difflib.PatchFailedException;
public class PatchTest extends TestCase {
public void testPatch_Insert() {
final List<String> insertTest_from = Arrays.asList("hhh");
final List<String> insertTest_to = Arrays.asList("hhh", "jjj", "kkk", "lll");
final Patch<String> patch = DiffUtils.diff(insertTest_from, insertTest_to);
try {
assertEquals(insertTest_to, DiffUtils.patch(insertTest_from, patch));
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
public void testPatch_Delete() {
final List<String> deleteTest_from = Arrays.asList("ddd", "fff", "ggg", "hhh");
final List<String> deleteTest_to = Arrays.asList("ggg");
final Patch<String> patch = DiffUtils.diff(deleteTest_from, deleteTest_to);
try {
assertEquals(deleteTest_to, DiffUtils.patch(deleteTest_from, patch));
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
public void testPatch_Change() {
final List<String> changeTest_from = Arrays.asList("aaa", "bbb", "ccc", "ddd");
final List<String> changeTest_to = Arrays.asList("aaa", "bxb", "cxc", "ddd");
final Patch<String> patch = DiffUtils.diff(changeTest_from, changeTest_to);
try {
assertEquals(changeTest_to, DiffUtils.patch(changeTest_from, patch));
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
public void testPatch_EntirelyDifferent() {
final List<String> changeTest_from = new ArrayList<String>();
changeTest_from.add("aaa");
changeTest_from.add("bbb");
final List<String> changeTest_to = Arrays.asList("ccc", "ddd");
final Patch<String> patch = DiffUtils.diff(changeTest_from, changeTest_to);
try {
patch.applyToInPlace(changeTest_from);
assertEquals(changeTest_to, changeTest_from);
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
}
package diffutils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import junit.framework.TestCase;
import difflib.DiffUtils;
import difflib.Patch;
import difflib.PatchFailedException;
public class PatchTest extends TestCase {
public void testPatch_Insert() {
final List<String> insertTest_from = Arrays.asList("hhh");
final List<String> insertTest_to = Arrays.asList("hhh", "jjj", "kkk", "lll");
final Patch<String> patch = DiffUtils.diff(insertTest_from, insertTest_to);
try {
assertEquals(insertTest_to, DiffUtils.patch(insertTest_from, patch));
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
public void testPatch_Delete() {
final List<String> deleteTest_from = Arrays.asList("ddd", "fff", "ggg", "hhh");
final List<String> deleteTest_to = Arrays.asList("ggg");
final Patch<String> patch = DiffUtils.diff(deleteTest_from, deleteTest_to);
try {
assertEquals(deleteTest_to, DiffUtils.patch(deleteTest_from, patch));
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
public void testPatch_Change() {
final List<String> changeTest_from = Arrays.asList("aaa", "bbb", "ccc", "ddd");
final List<String> changeTest_to = Arrays.asList("aaa", "bxb", "cxc", "ddd");
final Patch<String> patch = DiffUtils.diff(changeTest_from, changeTest_to);
try {
assertEquals(changeTest_to, DiffUtils.patch(changeTest_from, patch));
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
public void testPatch_EntirelyDifferent() {
final List<String> changeTest_from = new ArrayList<String>();
changeTest_from.add("aaa");
changeTest_from.add("bbb");
final List<String> changeTest_to = Arrays.asList("ccc", "ddd");
final Patch<String> patch = DiffUtils.diff(changeTest_from, changeTest_to);
try {
patch.applyToInPlace(changeTest_from);
assertEquals(changeTest_to, changeTest_from);
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
}
@@ -1,372 +1,372 @@
#!/bin/sh
#
# Copyright (c) 2006 Johannes E. Schindelin
#
test_description='Test special whitespace in diff engine.
'
. ./test-lib.sh
. ../diff-lib.sh
# Ray Lehtiniemi's example
cat << EOF > x
do {
nothing;
} while (0);
EOF
git update-index --add x
cat << EOF > x
do
{
nothing;
}
while (0);
EOF
cat << EOF > expect
diff --git a/x b/x
index adf3937..6edc172 100644
--- a/x
+++ b/x
@@ -1,3 +1,5 @@
-do {
+do
+{
nothing;
-} while (0);
+}
+while (0);
EOF
git diff > out
test_expect_success "Ray's example without options" 'test_cmp expect out'
git diff -w > out
test_expect_success "Ray's example with -w" 'test_cmp expect out'
git diff -b > out
test_expect_success "Ray's example with -b" 'test_cmp expect out'
tr 'Q' '\015' << EOF > x
whitespace at beginning
whitespace change
whitespace in the middle
whitespace at end
unchanged line
CR at endQ
EOF
git update-index x
tr '_' ' ' << EOF > x
whitespace at beginning
whitespace change
white space in the middle
whitespace at end__
unchanged line
CR at end
EOF
tr 'Q_' '\015 ' << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
--- a/x
+++ b/x
@@ -1,6 +1,6 @@
-whitespace at beginning
-whitespace change
-whitespace in the middle
-whitespace at end
+ whitespace at beginning
+whitespace change
+white space in the middle
+whitespace at end__
unchanged line
-CR at endQ
+CR at end
EOF
git diff > out
test_expect_success 'another test, without options' 'test_cmp expect out'
cat << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
EOF
git diff -w > out
test_expect_success 'another test, with -w' 'test_cmp expect out'
tr 'Q' '\015' << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
--- a/x
+++ b/x
@@ -1,6 +1,6 @@
-whitespace at beginning
+ whitespace at beginning
whitespace change
-whitespace in the middle
+white space in the middle
whitespace at end
unchanged line
CR at endQ
EOF
git diff -b > out
test_expect_success 'another test, with -b' 'test_cmp expect out'
test_expect_success 'check mixed spaces and tabs in indent' '
# This is indented with SP HT SP.
echo " foo();" > x &&
git diff --check | grep "space before tab in indent"
'
test_expect_success 'check mixed tabs and spaces in indent' '
# This is indented with HT SP HT.
echo " foo();" > x &&
git diff --check | grep "space before tab in indent"
'
test_expect_success 'check with no whitespace errors' '
git commit -m "snapshot" &&
echo "foo();" > x &&
git diff --check
'
test_expect_success 'check with trailing whitespace' '
echo "foo(); " > x &&
test_must_fail git diff --check
'
test_expect_success 'check with space before tab in indent' '
# indent has space followed by hard tab
echo " foo();" > x &&
test_must_fail git diff --check
'
test_expect_success '--check and --exit-code are not exclusive' '
git checkout x &&
git diff --check --exit-code
'
test_expect_success '--check and --quiet are not exclusive' '
git diff --check --quiet
'
test_expect_success 'check staged with no whitespace errors' '
echo "foo();" > x &&
git add x &&
git diff --cached --check
'
test_expect_success 'check staged with trailing whitespace' '
echo "foo(); " > x &&
git add x &&
test_must_fail git diff --cached --check
'
test_expect_success 'check staged with space before tab in indent' '
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
test_must_fail git diff --cached --check
'
test_expect_success 'check with no whitespace errors (diff-index)' '
echo "foo();" > x &&
git add x &&
git diff-index --check HEAD
'
test_expect_success 'check with trailing whitespace (diff-index)' '
echo "foo(); " > x &&
git add x &&
test_must_fail git diff-index --check HEAD
'
test_expect_success 'check with space before tab in indent (diff-index)' '
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
test_must_fail git diff-index --check HEAD
'
test_expect_success 'check staged with no whitespace errors (diff-index)' '
echo "foo();" > x &&
git add x &&
git diff-index --cached --check HEAD
'
test_expect_success 'check staged with trailing whitespace (diff-index)' '
echo "foo(); " > x &&
git add x &&
test_must_fail git diff-index --cached --check HEAD
'
test_expect_success 'check staged with space before tab in indent (diff-index)' '
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
test_must_fail git diff-index --cached --check HEAD
'
test_expect_success 'check with no whitespace errors (diff-tree)' '
echo "foo();" > x &&
git commit -m "new commit" x &&
git diff-tree --check HEAD^ HEAD
'
test_expect_success 'check with trailing whitespace (diff-tree)' '
echo "foo(); " > x &&
git commit -m "another commit" x &&
test_must_fail git diff-tree --check HEAD^ HEAD
'
test_expect_success 'check with space before tab in indent (diff-tree)' '
# indent has space followed by hard tab
echo " foo();" > x &&
git commit -m "yet another" x &&
test_must_fail git diff-tree --check HEAD^ HEAD
'
test_expect_success 'check trailing whitespace (trailing-space: off)' '
git config core.whitespace "-trailing-space" &&
echo "foo (); " > x &&
git diff --check
'
test_expect_success 'check trailing whitespace (trailing-space: on)' '
git config core.whitespace "trailing-space" &&
echo "foo (); " > x &&
test_must_fail git diff --check
'
test_expect_success 'check space before tab in indent (space-before-tab: off)' '
# indent contains space followed by HT
git config core.whitespace "-space-before-tab" &&
echo " foo ();" > x &&
git diff --check
'
test_expect_success 'check space before tab in indent (space-before-tab: on)' '
# indent contains space followed by HT
git config core.whitespace "space-before-tab" &&
echo " foo (); " > x &&
test_must_fail git diff --check
'
test_expect_success 'check spaces as indentation (indent-with-non-tab: off)' '
git config core.whitespace "-indent-with-non-tab"
echo " foo ();" > x &&
git diff --check
'
test_expect_success 'check spaces as indentation (indent-with-non-tab: on)' '
git config core.whitespace "indent-with-non-tab" &&
echo " foo ();" > x &&
test_must_fail git diff --check
'
test_expect_success 'check tabs and spaces as indentation (indent-with-non-tab: on)' '
git config core.whitespace "indent-with-non-tab" &&
echo " foo ();" > x &&
test_must_fail git diff --check
'
test_expect_success 'line numbers in --check output are correct' '
echo "" > x &&
echo "foo(); " >> x &&
git diff --check | grep "x:2:"
'
test_expect_success 'checkdiff detects trailing blank lines' '
echo "foo();" >x &&
echo "" >>x &&
git diff --check | grep "ends with blank"
'
test_expect_success 'checkdiff allows new blank lines' '
git checkout x &&
mv x y &&
(
echo "/* This is new */" &&
echo "" &&
cat y
) >x &&
git diff --check
'
test_expect_success 'combined diff with autocrlf conversion' '
git reset --hard &&
echo >x hello &&
git commit -m "one side" x &&
git checkout HEAD^ &&
echo >x goodbye &&
git commit -m "the other side" x &&
git config core.autocrlf true &&
test_must_fail git merge master &&
git diff | sed -e "1,/^@@@/d" >actual &&
! grep "^-" actual
'
test_done
#!/bin/sh
#
# Copyright (c) 2006 Johannes E. Schindelin
#
test_description='Test special whitespace in diff engine.
'
. ./test-lib.sh
. ../diff-lib.sh
# Ray Lehtiniemi's example
cat << EOF > x
do {
nothing;
} while (0);
EOF
git update-index --add x
cat << EOF > x
do
{
nothing;
}
while (0);
EOF
cat << EOF > expect
diff --git a/x b/x
index adf3937..6edc172 100644
--- a/x
+++ b/x
@@ -1,3 +1,5 @@
-do {
+do
+{
nothing;
-} while (0);
+}
+while (0);
EOF
git diff > out
test_expect_success "Ray's example without options" 'test_cmp expect out'
git diff -w > out
test_expect_success "Ray's example with -w" 'test_cmp expect out'
git diff -b > out
test_expect_success "Ray's example with -b" 'test_cmp expect out'
tr 'Q' '\015' << EOF > x
whitespace at beginning
whitespace change
whitespace in the middle
whitespace at end
unchanged line
CR at endQ
EOF
git update-index x
tr '_' ' ' << EOF > x
whitespace at beginning
whitespace change
white space in the middle
whitespace at end__
unchanged line
CR at end
EOF
tr 'Q_' '\015 ' << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
--- a/x
+++ b/x
@@ -1,6 +1,6 @@
-whitespace at beginning
-whitespace change
-whitespace in the middle
-whitespace at end
+ whitespace at beginning
+whitespace change
+white space in the middle
+whitespace at end__
unchanged line
-CR at endQ
+CR at end
EOF
git diff > out
test_expect_success 'another test, without options' 'test_cmp expect out'
cat << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
EOF
git diff -w > out
test_expect_success 'another test, with -w' 'test_cmp expect out'
tr 'Q' '\015' << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
--- a/x
+++ b/x
@@ -1,6 +1,6 @@
-whitespace at beginning
+ whitespace at beginning
whitespace change
-whitespace in the middle
+white space in the middle
whitespace at end
unchanged line
CR at endQ
EOF
git diff -b > out
test_expect_success 'another test, with -b' 'test_cmp expect out'
test_expect_success 'check mixed spaces and tabs in indent' '
# This is indented with SP HT SP.
echo " foo();" > x &&
git diff --check | grep "space before tab in indent"
'
test_expect_success 'check mixed tabs and spaces in indent' '
# This is indented with HT SP HT.
echo " foo();" > x &&
git diff --check | grep "space before tab in indent"
'
test_expect_success 'check with no whitespace errors' '
git commit -m "snapshot" &&
echo "foo();" > x &&
git diff --check
'
test_expect_success 'check with trailing whitespace' '
echo "foo(); " > x &&
test_must_fail git diff --check
'
test_expect_success 'check with space before tab in indent' '
# indent has space followed by hard tab
echo " foo();" > x &&
test_must_fail git diff --check
'
test_expect_success '--check and --exit-code are not exclusive' '
git checkout x &&
git diff --check --exit-code
'
test_expect_success '--check and --quiet are not exclusive' '
git diff --check --quiet
'
test_expect_success 'check staged with no whitespace errors' '
echo "foo();" > x &&
git add x &&
git diff --cached --check
'
test_expect_success 'check staged with trailing whitespace' '
echo "foo(); " > x &&
git add x &&
test_must_fail git diff --cached --check
'
test_expect_success 'check staged with space before tab in indent' '
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
test_must_fail git diff --cached --check
'
test_expect_success 'check with no whitespace errors (diff-index)' '
echo "foo();" > x &&
git add x &&
git diff-index --check HEAD
'
test_expect_success 'check with trailing whitespace (diff-index)' '
echo "foo(); " > x &&
git add x &&
test_must_fail git diff-index --check HEAD
'
test_expect_success 'check with space before tab in indent (diff-index)' '
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
test_must_fail git diff-index --check HEAD
'
test_expect_success 'check staged with no whitespace errors (diff-index)' '
echo "foo();" > x &&
git add x &&
git diff-index --cached --check HEAD
'
test_expect_success 'check staged with trailing whitespace (diff-index)' '
echo "foo(); " > x &&
git add x &&
test_must_fail git diff-index --cached --check HEAD
'
test_expect_success 'check staged with space before tab in indent (diff-index)' '
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
test_must_fail git diff-index --cached --check HEAD
'
test_expect_success 'check with no whitespace errors (diff-tree)' '
echo "foo();" > x &&
git commit -m "new commit" x &&
git diff-tree --check HEAD^ HEAD
'
test_expect_success 'check with trailing whitespace (diff-tree)' '
echo "foo(); " > x &&
git commit -m "another commit" x &&
test_must_fail git diff-tree --check HEAD^ HEAD
'
test_expect_success 'check with space before tab in indent (diff-tree)' '
# indent has space followed by hard tab
echo " foo();" > x &&
git commit -m "yet another" x &&
test_must_fail git diff-tree --check HEAD^ HEAD
'
test_expect_success 'check trailing whitespace (trailing-space: off)' '
git config core.whitespace "-trailing-space" &&
echo "foo (); " > x &&
git diff --check
'
test_expect_success 'check trailing whitespace (trailing-space: on)' '
git config core.whitespace "trailing-space" &&
echo "foo (); " > x &&
test_must_fail git diff --check
'
test_expect_success 'check space before tab in indent (space-before-tab: off)' '
# indent contains space followed by HT
git config core.whitespace "-space-before-tab" &&
echo " foo ();" > x &&
git diff --check
'
test_expect_success 'check space before tab in indent (space-before-tab: on)' '
# indent contains space followed by HT
git config core.whitespace "space-before-tab" &&
echo " foo (); " > x &&
test_must_fail git diff --check
'
test_expect_success 'check spaces as indentation (indent-with-non-tab: off)' '
git config core.whitespace "-indent-with-non-tab"
echo " foo ();" > x &&
git diff --check
'
test_expect_success 'check spaces as indentation (indent-with-non-tab: on)' '
git config core.whitespace "indent-with-non-tab" &&
echo " foo ();" > x &&
test_must_fail git diff --check
'
test_expect_success 'check tabs and spaces as indentation (indent-with-non-tab: on)' '
git config core.whitespace "indent-with-non-tab" &&
echo " foo ();" > x &&
test_must_fail git diff --check
'
test_expect_success 'line numbers in --check output are correct' '
echo "" > x &&
echo "foo(); " >> x &&
git diff --check | grep "x:2:"
'
test_expect_success 'checkdiff detects trailing blank lines' '
echo "foo();" >x &&
echo "" >>x &&
git diff --check | grep "ends with blank"
'
test_expect_success 'checkdiff allows new blank lines' '
git checkout x &&
mv x y &&
(
echo "/* This is new */" &&
echo "" &&
cat y
) >x &&
git diff --check
'
test_expect_success 'combined diff with autocrlf conversion' '
git reset --hard &&
echo >x hello &&
git commit -m "one side" x &&
git checkout HEAD^ &&
echo >x goodbye &&
git commit -m "the other side" x &&
git config core.autocrlf true &&
test_must_fail git merge master &&
git diff | sed -e "1,/^@@@/d" >actual &&
! grep "^-" actual
'
test_done
@@ -1,381 +1,381 @@
#!/bin/sh
#
# Copyright (c) 2006 Johannes E. Schindelin
#
test_description='Test special whitespace in diff engine.
'
. ./test-lib.sh
. ../diff-lib.sh
# Ray Lehtiniemi's example
cat << EOF > x
do {
nothing;
} while (0);
EOF
git update-index --add x
cat << EOF > x
do
{
nothing;
}
while (0);
EOF
cat << EOF > expect
diff --git a/x b/x
index adf3937..6edc172 100644
--- a/x
+++ b/x
@@ -1,3 +1,5 @@
-do {
+do
+{
nothing;
-} while (0);
+}
+while (0);
EOF
git diff > out
test_expect_success "Ray's example without options" 'test_cmp expect out'
git diff -w > out
test_expect_success "Ray's example with -w" 'test_cmp expect out'
git diff -b > out
test_expect_success "Ray's example with -b" 'test_cmp expect out'
tr 'Q' '\015' << EOF > x
whitespace at beginning
whitespace change
whitespace in the middle
whitespace at end
unchanged line
CR at endQ
EOF
git update-index x
tr '_' ' ' << EOF > x
whitespace at beginning
whitespace change
white space in the middle
whitespace at end__
unchanged line
CR at end
EOF
tr 'Q_' '\015 ' << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
--- a/x
+++ b/x
@@ -1,6 +1,6 @@
-whitespace at beginning
-whitespace change
-whitespace in the middle
-whitespace at end
+ whitespace at beginning
+whitespace change
+white space in the middle
+whitespace at end__
unchanged line
-CR at endQ
+CR at end
EOF
git diff > out
test_expect_success 'another test, without options' 'test_cmp expect out'
cat << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
EOF
git diff -w > out
test_expect_success 'another test, with -w' 'test_cmp expect out'
tr 'Q' '\015' << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
--- a/x
+++ b/x
@@ -1,6 +1,6 @@
-whitespace at beginning
+ whitespace at beginning
whitespace change
-whitespace in the middle
+white space in the middle
whitespace at end
unchanged line
CR at endQ
git diff -b --ignore-space-at-eol > out
test_expect_failure 'another test, with -b --ignore-space-at-eol' 'test_cmp expect out'
tr 'Q' '\015' << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
--- a/x
+++ b/x
EOF
git diff -b > out
test_expect_success 'another test, with -b' 'test_cmp expect out'
test_expect_success 'check mixed spaces and tabs in indent' '
# This is indented with SP HT SP.
echo " foo();" > x &&
git diff --check | grep "space before tab in indent"
'
test_expect_success 'check mixed tabs and spaces in indent' '
# This is indented with HT SP HT.
echo " foo();" > x &&
git diff --check | grep "space before tab in indent"
'
test_expect_success 'check with no whitespace errors' '
git commit -m "snapshot" &&
echo "foo();" > x &&
git diff --check
'
test_expect_success 'check with trailing whitespace' '
echo "foo(); " > x &&
test_must_fail git diff --check
'
test_expect_success 'check with space before tab in indent' '
# indent has space followed by hard tab
echo " foo();" > x &&
test_must_fail git diff --check
'
test_expect_success '--check and --exit-code are not exclusive' '
git checkout x &&
git diff --check --exit-code
'
test_expect_success '--check and --quiet are not exclusive' '
git diff --check --quiet
'
test_expect_success 'check staged with no whitespace errors' '
echo "foo();" > x &&
git add x &&
git diff --cached --check
'
test_expect_success 'check staged with trailing whitespace' '
echo "foo(); " > x &&
git add x &&
test_must_fail git diff --cached --check
'
test_expect_success 'check staged with space before tab in indent' '
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
test_must_fail git diff --cached --check
'
test_expect_success 'check with no whitespace errors (diff-index)' '
echo "foo();" > x &&
git add x &&
git diff-index --check HEAD
'
test_expect_success 'check with trailing whitespace (diff-index)' '
echo "foo(); " > x &&
git add x &&
test_must_fail git diff-index --check HEAD
'
test_expect_success 'check with space before tab in indent (diff-index)' '
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
test_must_fail git diff-index --check HEAD
'
test_expect_success 'check staged with no whitespace errors (diff-index)' '
echo "foo();" > x &&
git add x &&
git diff-index --cached --check HEAD
'
test_expect_success 'check staged with trailing whitespace (diff-index)' '
echo "foo(); " > x &&
git add x &&
test_must_fail git diff-index --cached --check HEAD
'
test_expect_success 'check staged with space before tab in indent (diff-index)' '
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
test_must_fail git diff-index --cached --check HEAD
'
test_expect_success 'check with no whitespace errors (diff-tree)' '
echo "foo();" > x &&
git commit -m "new commit" x &&
git diff-tree --check HEAD^ HEAD
'
test_expect_success 'check with trailing whitespace (diff-tree)' '
echo "foo(); " > x &&
git commit -m "another commit" x &&
test_must_fail git diff-tree --check HEAD^ HEAD
'
test_expect_success 'check with space before tab in indent (diff-tree)' '
# indent has space followed by hard tab
echo " foo();" > x &&
git commit -m "yet another" x &&
test_must_fail git diff-tree --check HEAD^ HEAD
'
test_expect_success 'check trailing whitespace (trailing-space: off)' '
git config core.whitespace "-trailing-space" &&
echo "foo (); " > x &&
git diff --check
'
test_expect_success 'check trailing whitespace (trailing-space: on)' '
git config core.whitespace "trailing-space" &&
echo "foo (); " > x &&
test_must_fail git diff --check
'
test_expect_success 'check space before tab in indent (space-before-tab: off)' '
# indent contains space followed by HT
git config core.whitespace "-space-before-tab" &&
echo " foo ();" > x &&
git diff --check
'
test_expect_success 'check space before tab in indent (space-before-tab: on)' '
# indent contains space followed by HT
git config core.whitespace "space-before-tab" &&
echo " foo (); " > x &&
test_must_fail git diff --check
'
test_expect_success 'check spaces as indentation (indent-with-non-tab: off)' '
git config core.whitespace "-indent-with-non-tab"
echo " foo ();" > x &&
git diff --check
'
test_expect_success 'check spaces as indentation (indent-with-non-tab: on)' '
git config core.whitespace "indent-with-non-tab" &&
echo " foo ();" > x &&
test_must_fail git diff --check
'
test_expect_success 'check tabs and spaces as indentation (indent-with-non-tab: on)' '
git config core.whitespace "indent-with-non-tab" &&
echo " foo ();" > x &&
test_must_fail git diff --check
'
test_expect_success 'line numbers in --check output are correct' '
echo "" > x &&
echo "foo(); " >> x &&
git diff --check | grep "x:2:"
'
test_expect_success 'checkdiff detects trailing blank lines' '
echo "foo();" >x &&
echo "" >>x &&
git diff --check | grep "ends with blank"
'
test_expect_success 'checkdiff allows new blank lines' '
git checkout x &&
mv x y &&
(
echo "/* This is new */" &&
echo "" &&
cat y
) >x &&
git diff --check
'
test_expect_success 'combined diff with autocrlf conversion' '
git reset --hard &&
echo >x hello &&
git commit -m "one side" x &&
git checkout HEAD^ &&
echo >x goodbye &&
git commit -m "the other side" x &&
git config core.autocrlf true &&
test_must_fail git merge master &&
git diff | sed -e "1,/^@@@/d" >actual &&
! grep "^-" actual
'
test_done
#!/bin/sh
#
# Copyright (c) 2006 Johannes E. Schindelin
#
test_description='Test special whitespace in diff engine.
'
. ./test-lib.sh
. ../diff-lib.sh
# Ray Lehtiniemi's example
cat << EOF > x
do {
nothing;
} while (0);
EOF
git update-index --add x
cat << EOF > x
do
{
nothing;
}
while (0);
EOF
cat << EOF > expect
diff --git a/x b/x
index adf3937..6edc172 100644
--- a/x
+++ b/x
@@ -1,3 +1,5 @@
-do {
+do
+{
nothing;
-} while (0);
+}
+while (0);
EOF
git diff > out
test_expect_success "Ray's example without options" 'test_cmp expect out'
git diff -w > out
test_expect_success "Ray's example with -w" 'test_cmp expect out'
git diff -b > out
test_expect_success "Ray's example with -b" 'test_cmp expect out'
tr 'Q' '\015' << EOF > x
whitespace at beginning
whitespace change
whitespace in the middle
whitespace at end
unchanged line
CR at endQ
EOF
git update-index x
tr '_' ' ' << EOF > x
whitespace at beginning
whitespace change
white space in the middle
whitespace at end__
unchanged line
CR at end
EOF
tr 'Q_' '\015 ' << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
--- a/x
+++ b/x
@@ -1,6 +1,6 @@
-whitespace at beginning
-whitespace change
-whitespace in the middle
-whitespace at end
+ whitespace at beginning
+whitespace change
+white space in the middle
+whitespace at end__
unchanged line
-CR at endQ
+CR at end
EOF
git diff > out
test_expect_success 'another test, without options' 'test_cmp expect out'
cat << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
EOF
git diff -w > out
test_expect_success 'another test, with -w' 'test_cmp expect out'
tr 'Q' '\015' << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
--- a/x
+++ b/x
@@ -1,6 +1,6 @@
-whitespace at beginning
+ whitespace at beginning
whitespace change
-whitespace in the middle
+white space in the middle
whitespace at end
unchanged line
CR at endQ
git diff -b --ignore-space-at-eol > out
test_expect_failure 'another test, with -b --ignore-space-at-eol' 'test_cmp expect out'
tr 'Q' '\015' << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
--- a/x
+++ b/x
EOF
git diff -b > out
test_expect_success 'another test, with -b' 'test_cmp expect out'
test_expect_success 'check mixed spaces and tabs in indent' '
# This is indented with SP HT SP.
echo " foo();" > x &&
git diff --check | grep "space before tab in indent"
'
test_expect_success 'check mixed tabs and spaces in indent' '
# This is indented with HT SP HT.
echo " foo();" > x &&
git diff --check | grep "space before tab in indent"
'
test_expect_success 'check with no whitespace errors' '
git commit -m "snapshot" &&
echo "foo();" > x &&
git diff --check
'
test_expect_success 'check with trailing whitespace' '
echo "foo(); " > x &&
test_must_fail git diff --check
'
test_expect_success 'check with space before tab in indent' '
# indent has space followed by hard tab
echo " foo();" > x &&
test_must_fail git diff --check
'
test_expect_success '--check and --exit-code are not exclusive' '
git checkout x &&
git diff --check --exit-code
'
test_expect_success '--check and --quiet are not exclusive' '
git diff --check --quiet
'
test_expect_success 'check staged with no whitespace errors' '
echo "foo();" > x &&
git add x &&
git diff --cached --check
'
test_expect_success 'check staged with trailing whitespace' '
echo "foo(); " > x &&
git add x &&
test_must_fail git diff --cached --check
'
test_expect_success 'check staged with space before tab in indent' '
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
test_must_fail git diff --cached --check
'
test_expect_success 'check with no whitespace errors (diff-index)' '
echo "foo();" > x &&
git add x &&
git diff-index --check HEAD
'
test_expect_success 'check with trailing whitespace (diff-index)' '
echo "foo(); " > x &&
git add x &&
test_must_fail git diff-index --check HEAD
'
test_expect_success 'check with space before tab in indent (diff-index)' '
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
test_must_fail git diff-index --check HEAD
'
test_expect_success 'check staged with no whitespace errors (diff-index)' '
echo "foo();" > x &&
git add x &&
git diff-index --cached --check HEAD
'
test_expect_success 'check staged with trailing whitespace (diff-index)' '
echo "foo(); " > x &&
git add x &&
test_must_fail git diff-index --cached --check HEAD
'
test_expect_success 'check staged with space before tab in indent (diff-index)' '
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
test_must_fail git diff-index --cached --check HEAD
'
test_expect_success 'check with no whitespace errors (diff-tree)' '
echo "foo();" > x &&
git commit -m "new commit" x &&
git diff-tree --check HEAD^ HEAD
'
test_expect_success 'check with trailing whitespace (diff-tree)' '
echo "foo(); " > x &&
git commit -m "another commit" x &&
test_must_fail git diff-tree --check HEAD^ HEAD
'
test_expect_success 'check with space before tab in indent (diff-tree)' '
# indent has space followed by hard tab
echo " foo();" > x &&
git commit -m "yet another" x &&
test_must_fail git diff-tree --check HEAD^ HEAD
'
test_expect_success 'check trailing whitespace (trailing-space: off)' '
git config core.whitespace "-trailing-space" &&
echo "foo (); " > x &&
git diff --check
'
test_expect_success 'check trailing whitespace (trailing-space: on)' '
git config core.whitespace "trailing-space" &&
echo "foo (); " > x &&
test_must_fail git diff --check
'
test_expect_success 'check space before tab in indent (space-before-tab: off)' '
# indent contains space followed by HT
git config core.whitespace "-space-before-tab" &&
echo " foo ();" > x &&
git diff --check
'
test_expect_success 'check space before tab in indent (space-before-tab: on)' '
# indent contains space followed by HT
git config core.whitespace "space-before-tab" &&
echo " foo (); " > x &&
test_must_fail git diff --check
'
test_expect_success 'check spaces as indentation (indent-with-non-tab: off)' '
git config core.whitespace "-indent-with-non-tab"
echo " foo ();" > x &&
git diff --check
'
test_expect_success 'check spaces as indentation (indent-with-non-tab: on)' '
git config core.whitespace "indent-with-non-tab" &&
echo " foo ();" > x &&
test_must_fail git diff --check
'
test_expect_success 'check tabs and spaces as indentation (indent-with-non-tab: on)' '
git config core.whitespace "indent-with-non-tab" &&
echo " foo ();" > x &&
test_must_fail git diff --check
'
test_expect_success 'line numbers in --check output are correct' '
echo "" > x &&
echo "foo(); " >> x &&
git diff --check | grep "x:2:"
'
test_expect_success 'checkdiff detects trailing blank lines' '
echo "foo();" >x &&
echo "" >>x &&
git diff --check | grep "ends with blank"
'
test_expect_success 'checkdiff allows new blank lines' '
git checkout x &&
mv x y &&
(
echo "/* This is new */" &&
echo "" &&
cat y
) >x &&
git diff --check
'
test_expect_success 'combined diff with autocrlf conversion' '
git reset --hard &&
echo >x hello &&
git commit -m "one side" x &&
git checkout HEAD^ &&
echo >x goodbye &&
git commit -m "the other side" x &&
git config core.autocrlf true &&
test_must_fail git merge master &&
git diff | sed -e "1,/^@@@/d" >actual &&
! grep "^-" actual
'
test_done
@@ -1,46 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Python" name="Python">
<configuration sdkName="Python 2.7 (C:/Python27/python.exe)" />
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Python 2.7 (C:/Python27/python.exe) interpreter library" level="application" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-io-1.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/java-diff-utils-1.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jython.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Python" name="Python">
<configuration sdkName="Python 2.7 (C:/Python27/python.exe)" />
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Python 2.7 (C:/Python27/python.exe) interpreter library" level="application" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-io-1.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/java-diff-utils-1.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jython.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
@@ -1,10 +1,10 @@
--- /bonobo/bonobo.iml
+++ /bonobo/bonobo.iml
@@ -41,6 +40,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="library" name="Python 2.6.6 (/usr/bin/python2.6) interpreter library" level="application" />
</component>
</module>
--- /bonobo/bonobo.iml
+++ /bonobo/bonobo.iml
@@ -41,6 +40,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="library" name="Python 2.6.6 (/usr/bin/python2.6) interpreter library" level="application" />
</component>
</module>
@@ -1 +1 @@
svn: '77954' path not found
svn: '77954' path not found
@@ -1 +1 @@
svn: '77954' path not found
svn: '77954' path not found
@@ -1,54 +1,54 @@
<p>Esta &eacute; uma obra Online.</p>
<p>&nbsp;</p>
<p><strong>Este texto &eacute; negrito</strong></p>
<p><em>Este texto &eacute; it&aacute;lico</em></p>
<p><span style="text-decoration:underline;">Este texto est&aacute; sublinhado</span></p>
<p><span style="text-decoration: line-through;">Este texto est&aacute; riscado</span></p>
<p style="text-align: center;">Este texto est&aacute; centralizado</p>
<p style="text-align: right;">Este texto est&aacute; alinhado a direita</p>
<ol>
<li>Este texto est&aacute; em uma lista num&eacute;rica<ol>
<li>Este texto est&aacute; identado</li>
</ol></li>
</ol>
<p><a title="uol" href="http://www.uol.com.br" target="_blank">Este
aqui &eacute; um link</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>,
<p>&nbsp;</p>
<p>P&aacute;gina 1</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>P&aacute;gina 2</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>P&aacute;gina 3</p>
<p>Esta &eacute; uma obra Online.</p>
<p>&nbsp;</p>
<p><strong>Este texto &eacute; negrito</strong></p>
<p><em>Este texto &eacute; it&aacute;lico</em></p>
<p><span style="text-decoration:underline;">Este texto est&aacute; sublinhado</span></p>
<p><span style="text-decoration: line-through;">Este texto est&aacute; riscado</span></p>
<p style="text-align: center;">Este texto est&aacute; centralizado</p>
<p style="text-align: right;">Este texto est&aacute; alinhado a direita</p>
<ol>
<li>Este texto est&aacute; em uma lista num&eacute;rica<ol>
<li>Este texto est&aacute; identado</li>
</ol></li>
</ol>
<p><a title="uol" href="http://www.uol.com.br" target="_blank">Este
aqui &eacute; um link</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>,
<p>&nbsp;</p>
<p>P&aacute;gina 1</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>P&aacute;gina 2</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>P&aacute;gina 3</p>
<p>&nbsp;</p>
@@ -1,11 +1,11 @@
<p>Revis&atilde;o 3</p><p>&nbsp;</p><p>Esta &eacute; uma obra
Online.</p><p>&nbsp;</p><p><strong>Este texto &eacute;
negrit</strong></p><p>Este texto &eacute; it&aacute;lico/p><p><span
style="text-decoration: undeline;">Este texto est&aacute;
sublinhado</span></p><p>Este texto est&aacute; riscado agora n&atilde;o
est&aacute; mais</p>p style="text-align: left;">Este texto est&aacute;
centralizado nem este</p><p style="text-align: right;">Este texto
est&aacute; alinhado a direita</p><ol><li>Este texto est&aacute; em uma
lista num&eacute;rica</li></ol><p><a title="uol"
href="http://www.uol.com.br" target="_blank">Este aqui &eacute; um
<p>Revis&atilde;o 3</p><p>&nbsp;</p><p>Esta &eacute; uma obra
Online.</p><p>&nbsp;</p><p><strong>Este texto &eacute;
negrit</strong></p><p>Este texto &eacute; it&aacute;lico/p><p><span
style="text-decoration: undeline;">Este texto est&aacute;
sublinhado</span></p><p>Este texto est&aacute; riscado agora n&atilde;o
est&aacute; mais</p>p style="text-align: left;">Este texto est&aacute;
centralizado nem este</p><p style="text-align: right;">Este texto
est&aacute; alinhado a direita</p><ol><li>Este texto est&aacute; em uma
lista num&eacute;rica</li></ol><p><a title="uol"
href="http://www.uol.com.br" target="_blank">Este aqui &eacute; um
link</a></p>
@@ -1,174 +1,174 @@
/*
Copyright 2009 Dmitry Naumenko (dm.naumenko@gmail.com)
This file is part of Java Diff Utills Library.
Java Diff Utills Library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Java Diff Utills Library 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Java Diff Utills Library. If not, see <http://www.gnu.org/licenses/>.
*/
package difflib;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import difflib.myers.*;
/**
* Implements the difference and patching engine
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
* @version 0.4.1
*/
public class DiffUtils {
private static DiffAlgorithm defaultDiffAlgorithm = new MyersDiff();
private static Pattern unifiedDiffChunkRe =
Pattern.compile("@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\d+))?)\\s+@@");
/**
* Compute the difference between the original and revised texts with default diff algorithm
*
* @param original the original text
* @param revised the revised text
* @return the patch describing the difference between the original and revised texts
*/
public static Patch diff(List<?> original, List<?> revised) {
return DiffUtils.diff(original, revised, defaultDiffAlgorithm);
}
/**
* Compute the difference between the original and revised texts with given diff algorithm
*
* @param original the original text
* @param revised the revised text
* @param algorithm the given algorithm
* @return the patch describing the difference between the original and revised texts
*/
public static Patch diff(List<?> original, List<?> revised, DiffAlgorithm algorithm) {
return algorithm.diff(original, revised);
}
/**
* Patch the original text with given patch
*
* @param original the original text
* @param patch the given patch
* @return the revised text
* @throws PatchFailedException if can't apply patch
*/
public static List<?> patch(List<?> original, Patch patch) throws PatchFailedException {
return patch.applyTo(original);
}
/**
* Unpatch the revised text for a given patch
*
* @param revised the revised text
* @param patch the given patch
* @return the original text
*/
public static List<?> unpatch(List<?> revised, Patch patch) {
return patch.restore(revised);
}
/**
* Parse the given text in unified format and creates the list of deltas for it.
*
* @param diff the text in unified format
* @return the patch with deltas.
*/
public static Patch parseUnifiedDiff(List<String> diff) {
boolean inPrelude = true;
List<Object[]> rawChunk = new ArrayList<Object[]>();
Patch patch = new Patch();
int old_ln = 0, old_n = 0, new_ln = 0, new_n = 0;
String tag = "", rest = "";
for (String line: diff) {
// Skip leading lines until after we've seen one starting with '+++'
if (inPrelude) {
if (line.startsWith("+++")) {
inPrelude = false;
}
continue;
}
Matcher m = unifiedDiffChunkRe.matcher(line);
if (m.find()) {
// Process the lines in the previous chunk
if (rawChunk.size() != 0) {
List<String> oldChunkLines = new ArrayList<String>();
List<String> newChunkLines = new ArrayList<String>();
for (Object[] raw_line: rawChunk) {
tag = (String)raw_line[0];
rest = (String)raw_line[1];
if (tag.equals(" ") || tag.equals("-")) {
oldChunkLines.add(rest);
}
if (tag.equals(" ") || tag.equals("+")) {
newChunkLines.add(rest);
}
}
patch.addDelta(new ChangeDelta(new Chunk(old_ln - 1, old_n, oldChunkLines),
new Chunk(new_ln - 1, new_n, newChunkLines)));
rawChunk.clear();
}
// Parse the @@ header
old_ln = m.group(1) == null ? 1 : Integer.parseInt(m.group(1));
old_n = m.group(2) == null ? 1 : Integer.parseInt(m.group(2));
new_ln = m.group(3) == null ? 1 : Integer.parseInt(m.group(3));
new_n = m.group(4) == null ? 1 : Integer.parseInt(m.group(4));
old_ln = Integer.parseInt(m.group(1));
if (old_ln == 0) {
old_ln += 1;
}
if (new_ln == 0) {
new_ln += 1;
}
} else {
if (line.length() > 0) {
tag = line.substring(0, 1);
rest = line.substring(1);
if (tag.equals(" ") || tag.equals("+") || tag.equals("-")) {
rawChunk.add(new Object[] {tag, rest});
}
}
}
}
// Process the lines in the last chunk
if (rawChunk.size() != 0) {
List<String> oldChunkLines = new ArrayList<String>();
List<String> newChunkLines = new ArrayList<String>();
for (Object[] raw_line: rawChunk) {
tag = (String)raw_line[0];
rest = (String)raw_line[1];
if (tag.equals(" ") || tag.equals("-")) {
oldChunkLines.add(rest);
}
if (tag.equals(" ") || tag.equals("+")) {
newChunkLines.add(rest);
}
}
patch.addDelta(new ChangeDelta(new Chunk(old_ln - 1, old_n, oldChunkLines),
new Chunk(new_ln - 1, new_n, newChunkLines)));
rawChunk.clear();
}
return patch;
}
}
/*
Copyright 2009 Dmitry Naumenko (dm.naumenko@gmail.com)
This file is part of Java Diff Utills Library.
Java Diff Utills Library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Java Diff Utills Library 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Java Diff Utills Library. If not, see <http://www.gnu.org/licenses/>.
*/
package difflib;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import difflib.myers.*;
/**
* Implements the difference and patching engine
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
* @version 0.4.1
*/
public class DiffUtils {
private static DiffAlgorithm defaultDiffAlgorithm = new MyersDiff();
private static Pattern unifiedDiffChunkRe =
Pattern.compile("@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\d+))?)\\s+@@");
/**
* Compute the difference between the original and revised texts with default diff algorithm
*
* @param original the original text
* @param revised the revised text
* @return the patch describing the difference between the original and revised texts
*/
public static Patch diff(List<?> original, List<?> revised) {
return DiffUtils.diff(original, revised, defaultDiffAlgorithm);
}
/**
* Compute the difference between the original and revised texts with given diff algorithm
*
* @param original the original text
* @param revised the revised text
* @param algorithm the given algorithm
* @return the patch describing the difference between the original and revised texts
*/
public static Patch diff(List<?> original, List<?> revised, DiffAlgorithm algorithm) {
return algorithm.diff(original, revised);
}
/**
* Patch the original text with given patch
*
* @param original the original text
* @param patch the given patch
* @return the revised text
* @throws PatchFailedException if can't apply patch
*/
public static List<?> patch(List<?> original, Patch patch) throws PatchFailedException {
return patch.applyTo(original);
}
/**
* Unpatch the revised text for a given patch
*
* @param revised the revised text
* @param patch the given patch
* @return the original text
*/
public static List<?> unpatch(List<?> revised, Patch patch) {
return patch.restore(revised);
}
/**
* Parse the given text in unified format and creates the list of deltas for it.
*
* @param diff the text in unified format
* @return the patch with deltas.
*/
public static Patch parseUnifiedDiff(List<String> diff) {
boolean inPrelude = true;
List<Object[]> rawChunk = new ArrayList<Object[]>();
Patch patch = new Patch();
int old_ln = 0, old_n = 0, new_ln = 0, new_n = 0;
String tag = "", rest = "";
for (String line: diff) {
// Skip leading lines until after we've seen one starting with '+++'
if (inPrelude) {
if (line.startsWith("+++")) {
inPrelude = false;
}
continue;
}
Matcher m = unifiedDiffChunkRe.matcher(line);
if (m.find()) {
// Process the lines in the previous chunk
if (rawChunk.size() != 0) {
List<String> oldChunkLines = new ArrayList<String>();
List<String> newChunkLines = new ArrayList<String>();
for (Object[] raw_line: rawChunk) {
tag = (String)raw_line[0];
rest = (String)raw_line[1];
if (tag.equals(" ") || tag.equals("-")) {
oldChunkLines.add(rest);
}
if (tag.equals(" ") || tag.equals("+")) {
newChunkLines.add(rest);
}
}
patch.addDelta(new ChangeDelta(new Chunk(old_ln - 1, old_n, oldChunkLines),
new Chunk(new_ln - 1, new_n, newChunkLines)));
rawChunk.clear();
}
// Parse the @@ header
old_ln = m.group(1) == null ? 1 : Integer.parseInt(m.group(1));
old_n = m.group(2) == null ? 1 : Integer.parseInt(m.group(2));
new_ln = m.group(3) == null ? 1 : Integer.parseInt(m.group(3));
new_n = m.group(4) == null ? 1 : Integer.parseInt(m.group(4));
old_ln = Integer.parseInt(m.group(1));
if (old_ln == 0) {
old_ln += 1;
}
if (new_ln == 0) {
new_ln += 1;
}
} else {
if (line.length() > 0) {
tag = line.substring(0, 1);
rest = line.substring(1);
if (tag.equals(" ") || tag.equals("+") || tag.equals("-")) {
rawChunk.add(new Object[] {tag, rest});
}
}
}
}
// Process the lines in the last chunk
if (rawChunk.size() != 0) {
List<String> oldChunkLines = new ArrayList<String>();
List<String> newChunkLines = new ArrayList<String>();
for (Object[] raw_line: rawChunk) {
tag = (String)raw_line[0];
rest = (String)raw_line[1];
if (tag.equals(" ") || tag.equals("-")) {
oldChunkLines.add(rest);
}
if (tag.equals(" ") || tag.equals("+")) {
newChunkLines.add(rest);
}
}
patch.addDelta(new ChangeDelta(new Chunk(old_ln - 1, old_n, oldChunkLines),
new Chunk(new_ln - 1, new_n, newChunkLines)));
rawChunk.clear();
}
return patch;
}
}
@@ -1,308 +1,308 @@
/*
Copyright 2009 Dmitry Naumenko (dm.naumenko@gmail.com)
This file is part of Java Diff Utils Library.
Java Diff Utils Library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Java Diff Utils Library 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Java Diff Utils Library. If not, see <http://www.gnu.org/licenses/>.
*/
package difflib;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import difflib.myers.*;
/**
* Implements the difference and patching engine
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
* @version 0.4.1
*/
public class DiffUtils {
private static DiffAlgorithm defaultDiffAlgorithm = new MyersDiff();
private static Pattern unifiedDiffChunkRe =
Pattern.compile("@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\d+))?)\\s+@@");
/**
* Compute the difference between the original and revised texts with default diff algorithm
*
* @param original the original text
* @param revised the revised text
* @return the patch describing the difference between the original and revised texts
*/
public static Patch diff(List<?> original, List<?> revised) {
return DiffUtils.diff(original, revised, defaultDiffAlgorithm);
}
/**
* Compute the difference between the original and revised texts with given diff algorithm
*
* @param original the original text
* @param revised the revised text
* @param algorithm the given algorithm
* @return the patch describing the difference between the original and revised texts
*/
public static Patch diff(List<?> original, List<?> revised, DiffAlgorithm algorithm) {
return algorithm.diff(original, revised);
}
/**
* Patch the original text with given patch
*
* @param original the original text
* @param patch the given patch
* @return the revised text
* @throws PatchFailedException if can't apply patch
*/
public static List<?> patch(List<?> original, Patch patch) throws PatchFailedException {
return patch.applyTo(original);
}
/**
* Unpatch the revised text for a given patch
*
* @param revised the revised text
* @param patch the given patch
* @return the original text
*/
public static List<?> unpatch(List<?> revised, Patch patch) {
return patch.restore(revised); // bla-bla-bla
}
/**
* Parse the given text in unified format and creates the list of deltas for it.
*
* @param diff the text in unified format
* @return the patch with deltas.
*/
public static Patch parseUnifiedDiff(List<String> diff) {
boolean inPrelude = true;
List<Object[]> rawChunk = new ArrayList<Object[]>();
Patch patch = new Patch();
int old_ln = 0, old_n = 0, new_ln = 0, new_n = 0;
String tag = "", rest = "";
for (String line: diff) {
// Skip leading lines until after we've seen one starting with '+++'
if (inPrelude) {
if (line.startsWith("+++")) {
inPrelude = false;
}
continue;
}
Matcher m = unifiedDiffChunkRe.matcher(line);
if (m.find()) {
// Process the lines in the previous chunk
if (rawChunk.size() != 0) {
List<String> oldChunkLines = new ArrayList<String>();
List<String> newChunkLines = new ArrayList<String>();
for (Object[] raw_line: rawChunk) {
tag = (String)raw_line[0];
rest = (String)raw_line[1];
if (tag.equals(" ") || tag.equals("-")) {
oldChunkLines.add(rest);
}
if (tag.equals(" ") || tag.equals("+")) {
newChunkLines.add(rest);
}
}
patch.addDelta(new ChangeDelta(new Chunk(old_ln - 1, old_n, oldChunkLines),
new Chunk(new_ln - 1, new_n, newChunkLines)));
rawChunk.clear();
}
// Parse the @@ header
old_ln = m.group(1) == null ? 1 : Integer.parseInt(m.group(1));
old_n = m.group(2) == null ? 1 : Integer.parseInt(m.group(2));
new_ln = m.group(3) == null ? 1 : Integer.parseInt(m.group(3));
new_n = m.group(4) == null ? 1 : Integer.parseInt(m.group(4));
old_ln = Integer.parseInt(m.group(1));
if (old_ln == 0) {
old_ln += 1;
}
if (new_ln == 0) {
new_ln += 1;
}
} else {
if (line.length() > 0) {
tag = line.substring(0, 1);
rest = line.substring(1);
if (tag.equals(" ") || tag.equals("+") || tag.equals("-")) {
rawChunk.add(new Object[] {tag, rest});
}
}
}
}
// Process the lines in the last chunk
if (rawChunk.size() != 0) {
List<String> oldChunkLines = new ArrayList<String>();
List<String> newChunkLines = new ArrayList<String>();
for (Object[] raw_line: rawChunk)
{
tag = (String)raw_line[0];
rest = (String)raw_line[1];
if (tag.equals(" ") || tag.equals("-"))
{
oldChunkLines.add(rest);
}
if (tag.equals(" ") || tag.equals("+"))
{
newChunkLines.add(rest);
}
}
patch.addDelta(new ChangeDelta(new Chunk(old_ln - 1, old_n, oldChunkLines),
new Chunk(new_ln - 1, new_n, newChunkLines)));
rawChunk.clear();
}
return patch;
}
/**
* generateUnifiedDiff takes a Patch and some other arguments, returning the Unified Diff format text representing the Patch.
* @author Bill James (tankerbay@gmail.com)
*
* @param fname1 - Filename of the original (unrevised file)
* @param fname2 - Filename of the revised file
* @param originalLines - Lines of the original file
* @param patch - Patch created by the diff() function
* @param contextSize - number of lines of context output around each difference in the file.
* @return List of strings representing the Unified Diff representation of the Patch argument.
*/
public static List<String> generateUnifiedDiff(String fname1, String fname2, List<String> originalLines, Patch patch, int contextSize ) {
List<String> ret = new ArrayList<String>();
ret.add( "--- " + fname1 );
ret.add( "+++ " + fname2 );
List<Delta> cur = new ArrayList<Delta>(); // current list of Delta's to process
int deltact = patch.getDeltas().size();
// if there's more than 1 Delta, we may need to output them together
if ( deltact > 1 ) {
Delta curDelta = patch.getDelta(0);
cur.add( curDelta ); // add the first Delta to the current set
for ( int i = 1; i < deltact; i++ ) {
int curpos = curDelta.getOriginal().getPosition(); // store the current position of the first Delta
Delta nextDelta = patch.getDelta(i); // Check if the next Delta is too close to the current position
if ( (curpos + curDelta.getOriginal().getSize() + contextSize) >= ( nextDelta.getOriginal().getPosition()-contextSize ) ) {
cur.add( nextDelta ); // if it is, add it to the current set
} else {
List<String> curBlock = processDeltas( originalLines, cur, contextSize );
ret.addAll( curBlock ); // if it isn't, output the current set, then create a new
cur.clear(); // set and add the current Delta to it.
cur.add( nextDelta );
}
curDelta = nextDelta;
}
List<String> curBlock = processDeltas( originalLines, cur, contextSize ); // don't forget to process the last set of Deltas
ret.addAll( curBlock );
}
return ret;
}
/**
* processDeltas takes a list of Deltas and outputs them together in a single block of Unified-Diff-format text.
* @author Bill James (tankerbay@gmail.com)
*
* @param origLines - the lines of the original file
* @param deltas - the Deltas to be output as a single block
* @param contextSize - the number of lines of context to place around block
* @return
*/
private static List<String> processDeltas( List<String> origLines, List<Delta> deltas, int contextSize ) {
List<String> buffer = new ArrayList<String>();
int origTotal = 0; // counter for total lines output from Original
int revTotal = 0; // counter for total lines output from Original
int line;
Delta curDelta = deltas.get(0); // start with the first Delta
int origStart = curDelta.getOriginal().getPosition()+1 - contextSize; // note the +1 to overcome the 0-offset Position
if ( origStart < 1 ) origStart = 1; // clamp to the start of the file
int revStart = curDelta.getRevised().getPosition()+1 - contextSize; // note the +1 to overcome the 0-offset Position
if ( revStart < 1 ) revStart = 1; // clamp to the start of the file
int contextStart = curDelta.getOriginal().getPosition() - contextSize; // find the start of the wrapper context code
if ( contextStart < 0 ) contextStart = 0; // clamp to the start of the file
for ( line = contextStart; line < curDelta.getOriginal().getPosition(); line++ ) { // output the context before the first Delta
buffer.add( " " + origLines.get( line ) );
origTotal++;
revTotal++;
}
buffer.addAll( getDeltaText( curDelta ) ); // output the first Delta
origTotal += curDelta.getOriginal().getLines().size();
revTotal += curDelta.getRevised().getLines().size();
int deltaIndex = 1;
while ( deltaIndex < deltas.size() ) { // for each of the other Deltas
Delta nextDelta = deltas.get( deltaIndex );
int intermediateStart = curDelta.getOriginal().getPosition() + curDelta.getOriginal().getLines().size();
for ( line = intermediateStart; line < nextDelta.getOriginal().getPosition(); line++ ) {
buffer.add( " " + origLines.get( line ) ); // output the code between the last Delta and this one
origTotal++;
revTotal++;
}
buffer.addAll( getDeltaText( nextDelta ) ); // output the Delta
origTotal += nextDelta.getOriginal().getLines().size();
revTotal += nextDelta.getRevised().getLines().size();
curDelta = nextDelta;
deltaIndex++; // increment the iterator
}
// Now output the post-Delta context code, clamping the end of the file
contextStart = curDelta.getOriginal().getPosition() + curDelta.getOriginal().getLines().size();
for ( line = contextStart; ( line < (contextStart + contextSize )) && ( line < origLines.size() ); line++ ) {
buffer.add( " " + origLines.get( line ) );
origTotal++;
revTotal++;
}
// Create and insert the block header, conforming to the Unified Diff standard
StringBuffer header = new StringBuffer();
header.append( "@@ -" );
header.append( origStart );
header.append( "," );
header.append( origTotal );
header.append( " +" );
header.append( revStart );
header.append( "," );
header.append( revTotal );
header.append( " @@" );
buffer.add( 0, header.toString() );
return buffer;
}
/**
* getDeltaText returns the lines to be added to the Unified Diff text from the Delta parameter
* @author Bill James (tankerbay@gmail.com)
*
* @param delta - the Delta to output
* @return list of String lines of code.
*/
private static List<String> getDeltaText( Delta delta ) {
List<String> buffer = new ArrayList<String>();
for ( Object line: delta.getOriginal().getLines() ) {
buffer.add( "-" + line );
}
for ( Object line: delta.getRevised().getLines() ) {
buffer.add( "+" + line );
}
return buffer;
}
}
/*
Copyright 2009 Dmitry Naumenko (dm.naumenko@gmail.com)
This file is part of Java Diff Utils Library.
Java Diff Utils Library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Java Diff Utils Library 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Java Diff Utils Library. If not, see <http://www.gnu.org/licenses/>.
*/
package difflib;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import difflib.myers.*;
/**
* Implements the difference and patching engine
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
* @version 0.4.1
*/
public class DiffUtils {
private static DiffAlgorithm defaultDiffAlgorithm = new MyersDiff();
private static Pattern unifiedDiffChunkRe =
Pattern.compile("@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\d+))?)\\s+@@");
/**
* Compute the difference between the original and revised texts with default diff algorithm
*
* @param original the original text
* @param revised the revised text
* @return the patch describing the difference between the original and revised texts
*/
public static Patch diff(List<?> original, List<?> revised) {
return DiffUtils.diff(original, revised, defaultDiffAlgorithm);
}
/**
* Compute the difference between the original and revised texts with given diff algorithm
*
* @param original the original text
* @param revised the revised text
* @param algorithm the given algorithm
* @return the patch describing the difference between the original and revised texts
*/
public static Patch diff(List<?> original, List<?> revised, DiffAlgorithm algorithm) {
return algorithm.diff(original, revised);
}
/**
* Patch the original text with given patch
*
* @param original the original text
* @param patch the given patch
* @return the revised text
* @throws PatchFailedException if can't apply patch
*/
public static List<?> patch(List<?> original, Patch patch) throws PatchFailedException {
return patch.applyTo(original);
}
/**
* Unpatch the revised text for a given patch
*
* @param revised the revised text
* @param patch the given patch
* @return the original text
*/
public static List<?> unpatch(List<?> revised, Patch patch) {
return patch.restore(revised); // bla-bla-bla
}
/**
* Parse the given text in unified format and creates the list of deltas for it.
*
* @param diff the text in unified format
* @return the patch with deltas.
*/
public static Patch parseUnifiedDiff(List<String> diff) {
boolean inPrelude = true;
List<Object[]> rawChunk = new ArrayList<Object[]>();
Patch patch = new Patch();
int old_ln = 0, old_n = 0, new_ln = 0, new_n = 0;
String tag = "", rest = "";
for (String line: diff) {
// Skip leading lines until after we've seen one starting with '+++'
if (inPrelude) {
if (line.startsWith("+++")) {
inPrelude = false;
}
continue;
}
Matcher m = unifiedDiffChunkRe.matcher(line);
if (m.find()) {
// Process the lines in the previous chunk
if (rawChunk.size() != 0) {
List<String> oldChunkLines = new ArrayList<String>();
List<String> newChunkLines = new ArrayList<String>();
for (Object[] raw_line: rawChunk) {
tag = (String)raw_line[0];
rest = (String)raw_line[1];
if (tag.equals(" ") || tag.equals("-")) {
oldChunkLines.add(rest);
}
if (tag.equals(" ") || tag.equals("+")) {
newChunkLines.add(rest);
}
}
patch.addDelta(new ChangeDelta(new Chunk(old_ln - 1, old_n, oldChunkLines),
new Chunk(new_ln - 1, new_n, newChunkLines)));
rawChunk.clear();
}
// Parse the @@ header
old_ln = m.group(1) == null ? 1 : Integer.parseInt(m.group(1));
old_n = m.group(2) == null ? 1 : Integer.parseInt(m.group(2));
new_ln = m.group(3) == null ? 1 : Integer.parseInt(m.group(3));
new_n = m.group(4) == null ? 1 : Integer.parseInt(m.group(4));
old_ln = Integer.parseInt(m.group(1));
if (old_ln == 0) {
old_ln += 1;
}
if (new_ln == 0) {
new_ln += 1;
}
} else {
if (line.length() > 0) {
tag = line.substring(0, 1);
rest = line.substring(1);
if (tag.equals(" ") || tag.equals("+") || tag.equals("-")) {
rawChunk.add(new Object[] {tag, rest});
}
}
}
}
// Process the lines in the last chunk
if (rawChunk.size() != 0) {
List<String> oldChunkLines = new ArrayList<String>();
List<String> newChunkLines = new ArrayList<String>();
for (Object[] raw_line: rawChunk)
{
tag = (String)raw_line[0];
rest = (String)raw_line[1];
if (tag.equals(" ") || tag.equals("-"))
{
oldChunkLines.add(rest);
}
if (tag.equals(" ") || tag.equals("+"))
{
newChunkLines.add(rest);
}
}
patch.addDelta(new ChangeDelta(new Chunk(old_ln - 1, old_n, oldChunkLines),
new Chunk(new_ln - 1, new_n, newChunkLines)));
rawChunk.clear();
}
return patch;
}
/**
* generateUnifiedDiff takes a Patch and some other arguments, returning the Unified Diff format text representing the Patch.
* @author Bill James (tankerbay@gmail.com)
*
* @param fname1 - Filename of the original (unrevised file)
* @param fname2 - Filename of the revised file
* @param originalLines - Lines of the original file
* @param patch - Patch created by the diff() function
* @param contextSize - number of lines of context output around each difference in the file.
* @return List of strings representing the Unified Diff representation of the Patch argument.
*/
public static List<String> generateUnifiedDiff(String fname1, String fname2, List<String> originalLines, Patch patch, int contextSize ) {
List<String> ret = new ArrayList<String>();
ret.add( "--- " + fname1 );
ret.add( "+++ " + fname2 );
List<Delta> cur = new ArrayList<Delta>(); // current list of Delta's to process
int deltact = patch.getDeltas().size();
// if there's more than 1 Delta, we may need to output them together
if ( deltact > 1 ) {
Delta curDelta = patch.getDelta(0);
cur.add( curDelta ); // add the first Delta to the current set
for ( int i = 1; i < deltact; i++ ) {
int curpos = curDelta.getOriginal().getPosition(); // store the current position of the first Delta
Delta nextDelta = patch.getDelta(i); // Check if the next Delta is too close to the current position
if ( (curpos + curDelta.getOriginal().getSize() + contextSize) >= ( nextDelta.getOriginal().getPosition()-contextSize ) ) {
cur.add( nextDelta ); // if it is, add it to the current set
} else {
List<String> curBlock = processDeltas( originalLines, cur, contextSize );
ret.addAll( curBlock ); // if it isn't, output the current set, then create a new
cur.clear(); // set and add the current Delta to it.
cur.add( nextDelta );
}
curDelta = nextDelta;
}
List<String> curBlock = processDeltas( originalLines, cur, contextSize ); // don't forget to process the last set of Deltas
ret.addAll( curBlock );
}
return ret;
}
/**
* processDeltas takes a list of Deltas and outputs them together in a single block of Unified-Diff-format text.
* @author Bill James (tankerbay@gmail.com)
*
* @param origLines - the lines of the original file
* @param deltas - the Deltas to be output as a single block
* @param contextSize - the number of lines of context to place around block
* @return
*/
private static List<String> processDeltas( List<String> origLines, List<Delta> deltas, int contextSize ) {
List<String> buffer = new ArrayList<String>();
int origTotal = 0; // counter for total lines output from Original
int revTotal = 0; // counter for total lines output from Original
int line;
Delta curDelta = deltas.get(0); // start with the first Delta
int origStart = curDelta.getOriginal().getPosition()+1 - contextSize; // note the +1 to overcome the 0-offset Position
if ( origStart < 1 ) origStart = 1; // clamp to the start of the file
int revStart = curDelta.getRevised().getPosition()+1 - contextSize; // note the +1 to overcome the 0-offset Position
if ( revStart < 1 ) revStart = 1; // clamp to the start of the file
int contextStart = curDelta.getOriginal().getPosition() - contextSize; // find the start of the wrapper context code
if ( contextStart < 0 ) contextStart = 0; // clamp to the start of the file
for ( line = contextStart; line < curDelta.getOriginal().getPosition(); line++ ) { // output the context before the first Delta
buffer.add( " " + origLines.get( line ) );
origTotal++;
revTotal++;
}
buffer.addAll( getDeltaText( curDelta ) ); // output the first Delta
origTotal += curDelta.getOriginal().getLines().size();
revTotal += curDelta.getRevised().getLines().size();
int deltaIndex = 1;
while ( deltaIndex < deltas.size() ) { // for each of the other Deltas
Delta nextDelta = deltas.get( deltaIndex );
int intermediateStart = curDelta.getOriginal().getPosition() + curDelta.getOriginal().getLines().size();
for ( line = intermediateStart; line < nextDelta.getOriginal().getPosition(); line++ ) {
buffer.add( " " + origLines.get( line ) ); // output the code between the last Delta and this one
origTotal++;
revTotal++;
}
buffer.addAll( getDeltaText( nextDelta ) ); // output the Delta
origTotal += nextDelta.getOriginal().getLines().size();
revTotal += nextDelta.getRevised().getLines().size();
curDelta = nextDelta;
deltaIndex++; // increment the iterator
}
// Now output the post-Delta context code, clamping the end of the file
contextStart = curDelta.getOriginal().getPosition() + curDelta.getOriginal().getLines().size();
for ( line = contextStart; ( line < (contextStart + contextSize )) && ( line < origLines.size() ); line++ ) {
buffer.add( " " + origLines.get( line ) );
origTotal++;
revTotal++;
}
// Create and insert the block header, conforming to the Unified Diff standard
StringBuffer header = new StringBuffer();
header.append( "@@ -" );
header.append( origStart );
header.append( "," );
header.append( origTotal );
header.append( " +" );
header.append( revStart );
header.append( "," );
header.append( revTotal );
header.append( " @@" );
buffer.add( 0, header.toString() );
return buffer;
}
/**
* getDeltaText returns the lines to be added to the Unified Diff text from the Delta parameter
* @author Bill James (tankerbay@gmail.com)
*
* @param delta - the Delta to output
* @return list of String lines of code.
*/
private static List<String> getDeltaText( Delta delta ) {
List<String> buffer = new ArrayList<String>();
for ( Object line: delta.getOriginal().getLines() ) {
buffer.add( "-" + line );
}
for ( Object line: delta.getRevised().getLines() ) {
buffer.add( "+" + line );
}
return buffer;
}
}
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -1 +1 @@
bin/
bin/
+28 -28
View File
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.googlecode.java-diff-utils</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.googlecode.java-diff-utils</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -1,12 +1,12 @@
#Thu Jan 19 09:47:14 CET 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
#Thu Jan 19 09:47:14 CET 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
@@ -1,5 +1,5 @@
#Fri Jul 29 09:33:56 CEST 2011
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
#Fri Jul 29 09:33:56 CEST 2011
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
@@ -1,10 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Java Diff Utils
Bundle-SymbolicName: com.googlecode.java-diff-utils
Bundle-Version: 1.3.0.qualifier
Bundle-Vendor: SAP AG
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: difflib,
difflib.myers
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Java Diff Utils
Bundle-SymbolicName: com.googlecode.java-diff-utils
Bundle-Version: 1.3.0.qualifier
Bundle-Vendor: SAP AG
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: difflib,
difflib.myers
@@ -1,4 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
+13 -13
View File
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>root</artifactId>
<groupId>com.sap.sailing</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.googlecode.java-diff-utils</artifactId>
<version>1.3.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>root</artifactId>
<groupId>com.sap.sailing</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.googlecode.java-diff-utils</artifactId>
<version>1.3.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
@@ -1,92 +1,92 @@
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.List;
/**
* Describes the change-delta between original and revised texts.
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public class ChangeDelta<T> extends Delta<T> {
/**
* {@inheritDoc}
*/
public ChangeDelta(Chunk<T> original, Chunk<T> revised) {
super(original, revised);
}
/**
* {@inheritDoc}
*
* @throws PatchFailedException
*/
@Override
public void applyTo(List<T> target) throws PatchFailedException {
verify(target);
int position = getOriginal().getPosition();
int size = getOriginal().size();
for (int i = 0; i < size; i++) {
target.remove(position);
}
int i = 0;
for (T line : getRevised().getLines()) {
target.add(position + i, line);
i++;
}
}
/**
* {@inheritDoc}
*/
@Override
public void restore(List<T> target) {
int position = getRevised().getPosition();
int size = getRevised().size();
for (int i = 0; i < size; i++) {
target.remove(position);
}
int i = 0;
for (T line : getOriginal().getLines()) {
target.add(position + i, line);
i++;
}
}
/**
* {@inheritDoc}
*/
public void verify(List<T> target) throws PatchFailedException {
getOriginal().verify(target);
if (getOriginal().getPosition() > target.size()) {
throw new PatchFailedException("Incorrect patch for delta: "
+ "delta original position > target size");
}
}
@Override
public String toString() {
return "[ChangeDelta, position: " + getOriginal().getPosition() + ", lines: "
+ getOriginal().getLines() + " to " + getRevised().getLines() + "]";
}
@Override
public TYPE getType() {
return Delta.TYPE.CHANGE;
}
}
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.List;
/**
* Describes the change-delta between original and revised texts.
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public class ChangeDelta<T> extends Delta<T> {
/**
* {@inheritDoc}
*/
public ChangeDelta(Chunk<T> original, Chunk<T> revised) {
super(original, revised);
}
/**
* {@inheritDoc}
*
* @throws PatchFailedException
*/
@Override
public void applyTo(List<T> target) throws PatchFailedException {
verify(target);
int position = getOriginal().getPosition();
int size = getOriginal().size();
for (int i = 0; i < size; i++) {
target.remove(position);
}
int i = 0;
for (T line : getRevised().getLines()) {
target.add(position + i, line);
i++;
}
}
/**
* {@inheritDoc}
*/
@Override
public void restore(List<T> target) {
int position = getRevised().getPosition();
int size = getRevised().size();
for (int i = 0; i < size; i++) {
target.remove(position);
}
int i = 0;
for (T line : getOriginal().getLines()) {
target.add(position + i, line);
i++;
}
}
/**
* {@inheritDoc}
*/
public void verify(List<T> target) throws PatchFailedException {
getOriginal().verify(target);
if (getOriginal().getPosition() > target.size()) {
throw new PatchFailedException("Incorrect patch for delta: "
+ "delta original position > target size");
}
}
@Override
public String toString() {
return "[ChangeDelta, position: " + getOriginal().getPosition() + ", lines: "
+ getOriginal().getLines() + " to " + getRevised().getLines() + "]";
}
@Override
public TYPE getType() {
return Delta.TYPE.CHANGE;
}
}
@@ -1,154 +1,154 @@
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.Arrays;
import java.util.List;
/**
* Holds the information about the part of text involved in the diff process
*
* <p>
* Text is represented as <code>Object[]</code> because the diff engine is
* capable of handling more than plain ascci. In fact, arrays or lists of any
* type that implements {@link java.lang.Object#hashCode hashCode()} and
* {@link java.lang.Object#equals equals()} correctly can be subject to
* differencing using this library.
* </p>
*
* @author <a href="dm.naumenko@gmail.com>Dmitry Naumenko</a>
*/
public class Chunk<T> {
private final int position;
private final List<T> lines;
/**
* Creates a chunk and saves a copy of affected lines
*
* @param position
* the start position
* @param lines
* the affected lines
*/
public Chunk(int position, List<T> lines) {
this.position = position;
this.lines = lines;
}
/**
* Creates a chunk and saves a copy of affected lines
*
* @param position
* the start position
* @param lines
* the affected lines
*/
public Chunk(int position, T[] lines) {
this.position = position;
this.lines = Arrays.asList(lines);
}
/**
* Verifies that this chunk's saved text matches the corresponding text in
* the given sequence.
*
* @param target
* the sequence to verify against.
*/
public void verify(List<T> target) throws PatchFailedException {
if (last() > target.size()) {
throw new PatchFailedException("Incorrect Chunk: the position of chunk > target size");
}
for (int i = 0; i < size(); i++) {
if (!target.get(position + i).equals(lines.get(i))) {
throw new PatchFailedException(
"Incorrect Chunk: the chunk content doesn't match the target");
}
}
}
/**
* @return the start position of chunk in the text
*/
public int getPosition() {
return position;
}
/**
* @return the affected lines
*/
public List<T> getLines() {
return lines;
}
public int size() {
return lines.size();
}
/**
* Returns the index of the last line of the chunk.
*/
public int last() {
return getPosition() + size() - 1;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((lines == null) ? 0 : lines.hashCode());
result = prime * result + position;
result = prime * result + size();
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@SuppressWarnings("unchecked")
Chunk<T> other = (Chunk<T>) obj;
if (lines == null) {
if (other.lines != null)
return false;
} else if (!lines.equals(other.lines))
return false;
if (position != other.position)
return false;
return true;
}
@Override
public String toString() {
return "[position: " + position + ", size: " + size() + ", lines: " + lines + "]";
}
}
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.Arrays;
import java.util.List;
/**
* Holds the information about the part of text involved in the diff process
*
* <p>
* Text is represented as <code>Object[]</code> because the diff engine is
* capable of handling more than plain ascci. In fact, arrays or lists of any
* type that implements {@link java.lang.Object#hashCode hashCode()} and
* {@link java.lang.Object#equals equals()} correctly can be subject to
* differencing using this library.
* </p>
*
* @author <a href="dm.naumenko@gmail.com>Dmitry Naumenko</a>
*/
public class Chunk<T> {
private final int position;
private final List<T> lines;
/**
* Creates a chunk and saves a copy of affected lines
*
* @param position
* the start position
* @param lines
* the affected lines
*/
public Chunk(int position, List<T> lines) {
this.position = position;
this.lines = lines;
}
/**
* Creates a chunk and saves a copy of affected lines
*
* @param position
* the start position
* @param lines
* the affected lines
*/
public Chunk(int position, T[] lines) {
this.position = position;
this.lines = Arrays.asList(lines);
}
/**
* Verifies that this chunk's saved text matches the corresponding text in
* the given sequence.
*
* @param target
* the sequence to verify against.
*/
public void verify(List<T> target) throws PatchFailedException {
if (last() > target.size()) {
throw new PatchFailedException("Incorrect Chunk: the position of chunk > target size");
}
for (int i = 0; i < size(); i++) {
if (!target.get(position + i).equals(lines.get(i))) {
throw new PatchFailedException(
"Incorrect Chunk: the chunk content doesn't match the target");
}
}
}
/**
* @return the start position of chunk in the text
*/
public int getPosition() {
return position;
}
/**
* @return the affected lines
*/
public List<T> getLines() {
return lines;
}
public int size() {
return lines.size();
}
/**
* Returns the index of the last line of the chunk.
*/
public int last() {
return getPosition() + size() - 1;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((lines == null) ? 0 : lines.hashCode());
result = prime * result + position;
result = prime * result + size();
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@SuppressWarnings("unchecked")
Chunk<T> other = (Chunk<T>) obj;
if (lines == null) {
if (other.lines != null)
return false;
} else if (!lines.equals(other.lines))
return false;
if (position != other.position)
return false;
return true;
}
@Override
public String toString() {
return "[position: " + position + ", size: " + size() + ", lines: " + lines + "]";
}
}
@@ -1,76 +1,76 @@
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.List;
/**
* Describes the delete-delta between original and revised texts.
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public class DeleteDelta<T> extends Delta<T> {
/**
* {@inheritDoc}
*/
public DeleteDelta(Chunk<T> original, Chunk<T> revised) {
super(original, revised);
}
/**
* {@inheritDoc}
*
* @throws PatchFailedException
*/
@Override
public void applyTo(List<T> target) throws PatchFailedException {
verify(target);
int position = getOriginal().getPosition();
int size = getOriginal().size();
for (int i = 0; i < size; i++) {
target.remove(position);
}
}
/**
* {@inheritDoc}
*/
@Override
public void restore(List<T> target) {
int position = this.getRevised().getPosition();
List<T> lines = this.getOriginal().getLines();
for (int i = 0; i < lines.size(); i++) {
target.add(position + i, lines.get(i));
}
}
@Override
public TYPE getType() {
return Delta.TYPE.DELETE;
}
@Override
public void verify(List<T> target) throws PatchFailedException {
getOriginal().verify(target);
}
@Override
public String toString() {
return "[DeleteDelta, position: " + getOriginal().getPosition() + ", lines: "
+ getOriginal().getLines() + "]";
}
}
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.List;
/**
* Describes the delete-delta between original and revised texts.
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public class DeleteDelta<T> extends Delta<T> {
/**
* {@inheritDoc}
*/
public DeleteDelta(Chunk<T> original, Chunk<T> revised) {
super(original, revised);
}
/**
* {@inheritDoc}
*
* @throws PatchFailedException
*/
@Override
public void applyTo(List<T> target) throws PatchFailedException {
verify(target);
int position = getOriginal().getPosition();
int size = getOriginal().size();
for (int i = 0; i < size; i++) {
target.remove(position);
}
}
/**
* {@inheritDoc}
*/
@Override
public void restore(List<T> target) {
int position = this.getRevised().getPosition();
List<T> lines = this.getOriginal().getLines();
for (int i = 0; i < lines.size(); i++) {
target.add(position + i, lines.get(i));
}
}
@Override
public TYPE getType() {
return Delta.TYPE.DELETE;
}
@Override
public void verify(List<T> target) throws PatchFailedException {
getOriginal().verify(target);
}
@Override
public String toString() {
return "[DeleteDelta, position: " + getOriginal().getPosition() + ", lines: "
+ getOriginal().getLines() + "]";
}
}
@@ -1,144 +1,144 @@
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.*;
/**
* Describes the delta between original and revised texts.
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public abstract class Delta<T> {
private Chunk<T> original;
private Chunk<T> revised;
public enum TYPE {
CHANGE, DELETE, INSERT
}
/**
* Construct the delta for original and revised chunks
*
* @param original chunk describes the original text
* @param revised chunk describes the revised text
*/
public Delta(Chunk<T> original, Chunk<T> revised) {
this.original = original;
this.revised = revised;
}
/**
* Verifies that this delta can be used to patch the given text.
*
* @param target the text to patch.
* @throws PatchFailedException if the patch cannot be applied.
*/
public abstract void verify(List<T> target) throws PatchFailedException;
/**
* Applies this delta as the patch for a given target
*
* @param target the given target
* @throws PatchFailedException
*/
public abstract void applyTo(List<T> target) throws PatchFailedException;
/**
* Cancel this delta for a given revised text. The action is opposite to
* patch.
*
* @param target the given revised text
*/
public abstract void restore(List<T> target);
/**
* Returns the type of delta
* @return the type enum
*/
public abstract TYPE getType();
/**
* @return the Chunk describing the original text
*/
public Chunk<T> getOriginal() {
return original;
}
/**
* @param original the Chunk describing the original text to set
*/
public void setOriginal(Chunk<T> original) {
this.original = original;
}
/**
* @return the Chunk describing the revised text
*/
public Chunk<T> getRevised() {
return revised;
}
/**
* @param revised the Chunk describing the revised text to set
*/
public void setRevised(Chunk<T> revised) {
this.revised = revised;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((original == null) ? 0 : original.hashCode());
result = prime * result + ((revised == null) ? 0 : revised.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@SuppressWarnings("unchecked")
Delta<T> other = (Delta<T>) obj;
if (original == null) {
if (other.original != null)
return false;
} else if (!original.equals(other.original))
return false;
if (revised == null) {
if (other.revised != null)
return false;
} else if (!revised.equals(other.revised))
return false;
return true;
}
}
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.*;
/**
* Describes the delta between original and revised texts.
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public abstract class Delta<T> {
private Chunk<T> original;
private Chunk<T> revised;
public enum TYPE {
CHANGE, DELETE, INSERT
}
/**
* Construct the delta for original and revised chunks
*
* @param original chunk describes the original text
* @param revised chunk describes the revised text
*/
public Delta(Chunk<T> original, Chunk<T> revised) {
this.original = original;
this.revised = revised;
}
/**
* Verifies that this delta can be used to patch the given text.
*
* @param target the text to patch.
* @throws PatchFailedException if the patch cannot be applied.
*/
public abstract void verify(List<T> target) throws PatchFailedException;
/**
* Applies this delta as the patch for a given target
*
* @param target the given target
* @throws PatchFailedException
*/
public abstract void applyTo(List<T> target) throws PatchFailedException;
/**
* Cancel this delta for a given revised text. The action is opposite to
* patch.
*
* @param target the given revised text
*/
public abstract void restore(List<T> target);
/**
* Returns the type of delta
* @return the type enum
*/
public abstract TYPE getType();
/**
* @return the Chunk describing the original text
*/
public Chunk<T> getOriginal() {
return original;
}
/**
* @param original the Chunk describing the original text to set
*/
public void setOriginal(Chunk<T> original) {
this.original = original;
}
/**
* @return the Chunk describing the revised text
*/
public Chunk<T> getRevised() {
return revised;
}
/**
* @param revised the Chunk describing the revised text to set
*/
public void setRevised(Chunk<T> revised) {
this.revised = revised;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((original == null) ? 0 : original.hashCode());
result = prime * result + ((revised == null) ? 0 : revised.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@SuppressWarnings("unchecked")
Delta<T> other = (Delta<T>) obj;
if (original == null) {
if (other.original != null)
return false;
} else if (!original.equals(other.original))
return false;
if (revised == null) {
if (other.revised != null)
return false;
} else if (!revised.equals(other.revised))
return false;
return true;
}
}
@@ -1,25 +1,25 @@
package difflib;
import java.io.Serializable;
import java.util.Comparator;
/**
* @author mksenzov
*/
public class DeltaComparator<T> implements Comparator<Delta<T>>, Serializable {
private static final long serialVersionUID = 1L;
public DeltaComparator() {
}
public int compare(final Delta<T> a, final Delta<T> b) {
final int posA = a.getOriginal().getPosition();
final int posB = b.getOriginal().getPosition();
if (posA > posB) {
return 1;
} else if (posA < posB) {
return -1;
}
return 0;
}
package difflib;
import java.io.Serializable;
import java.util.Comparator;
/**
* @author mksenzov
*/
public class DeltaComparator<T> implements Comparator<Delta<T>>, Serializable {
private static final long serialVersionUID = 1L;
public DeltaComparator() {
}
public int compare(final Delta<T> a, final Delta<T> b) {
final int posA = a.getOriginal().getPosition();
final int posB = b.getOriginal().getPosition();
if (posA > posB) {
return 1;
} else if (posA < posB) {
return -1;
}
return 0;
}
}
@@ -1,44 +1,44 @@
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
/**
* The general interface for computing diffs between two texts
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public interface DiffAlgorithm<T> {
/**
* Computes the difference between the original sequence and the revised
* sequence and returns it as a {@link difflib.Patch Patch} object.
*
* @param original the original text
* @param revised the revised text
* @return the patch
*/
public Patch<T> diff(T[] original, T[] revised);
/**
* Computes the difference between the original sequence and the revised
* sequence and returns it as a {@link difflib.Patch Patch} object.
*
* @param original the original text
* @param revised the revised text
* @return the patch
*/
public Patch<T> diff(Iterable<T> original, Iterable<T> revised);
}
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
/**
* The general interface for computing diffs between two texts
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public interface DiffAlgorithm<T> {
/**
* Computes the difference between the original sequence and the revised
* sequence and returns it as a {@link difflib.Patch Patch} object.
*
* @param original the original text
* @param revised the revised text
* @return the patch
*/
public Patch<T> diff(T[] original, T[] revised);
/**
* Computes the difference between the original sequence and the revised
* sequence and returns it as a {@link difflib.Patch Patch} object.
*
* @param original the original text
* @param revised the revised text
* @return the patch
*/
public Patch<T> diff(Iterable<T> original, Iterable<T> revised);
}
@@ -1,33 +1,33 @@
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
/**
* Base class for all exceptions emanating from this package.
*
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*/
public class DiffException extends Exception {
private static final long serialVersionUID = 1L;
public DiffException() {
}
public DiffException(String msg) {
super(msg);
}
}
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
/**
* Base class for all exceptions emanating from this package.
*
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*/
public class DiffException extends Exception {
private static final long serialVersionUID = 1L;
public DiffException() {
}
public DiffException(String msg) {
super(msg);
}
}
@@ -1,131 +1,131 @@
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
/**
* Describes the diff row in form [tag, oldLine, newLine) for showing the
* difference between two texts
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public class DiffRow {
private Tag tag;
private String oldLine;
private String newLine;
public DiffRow(Tag tag, String oldLine, String newLine) {
this.tag = tag;
this.oldLine = oldLine;
this.newLine = newLine;
}
public enum Tag {
INSERT, DELETE, CHANGE, EQUAL
}
/**
* @return the tag
*/
public Tag getTag() {
return tag;
}
/**
* @param tag the tag to set
*/
public void setTag(Tag tag) {
this.tag = tag;
}
/**
* @return the oldLine
*/
public String getOldLine() {
return oldLine;
}
/**
* @param oldLine the oldLine to set
*/
public void setOldLine(String oldLine) {
this.oldLine = oldLine;
}
/**
* @return the newLine
*/
public String getNewLine() {
return newLine;
}
/**
* @param newLine the newLine to set
*/
public void setNewLine(String newLine) {
this.newLine = newLine;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((newLine == null) ? 0 : newLine.hashCode());
result = prime * result + ((oldLine == null) ? 0 : oldLine.hashCode());
result = prime * result + ((tag == null) ? 0 : tag.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DiffRow other = (DiffRow) obj;
if (newLine == null) {
if (other.newLine != null)
return false;
} else if (!newLine.equals(other.newLine))
return false;
if (oldLine == null) {
if (other.oldLine != null)
return false;
} else if (!oldLine.equals(other.oldLine))
return false;
if (tag == null) {
if (other.tag != null)
return false;
} else if (!tag.equals(other.tag))
return false;
return true;
}
public String toString() {
return "[" + this.tag + "," + this.oldLine + "," + this.newLine + "]";
}
}
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
/**
* Describes the diff row in form [tag, oldLine, newLine) for showing the
* difference between two texts
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public class DiffRow {
private Tag tag;
private String oldLine;
private String newLine;
public DiffRow(Tag tag, String oldLine, String newLine) {
this.tag = tag;
this.oldLine = oldLine;
this.newLine = newLine;
}
public enum Tag {
INSERT, DELETE, CHANGE, EQUAL
}
/**
* @return the tag
*/
public Tag getTag() {
return tag;
}
/**
* @param tag the tag to set
*/
public void setTag(Tag tag) {
this.tag = tag;
}
/**
* @return the oldLine
*/
public String getOldLine() {
return oldLine;
}
/**
* @param oldLine the oldLine to set
*/
public void setOldLine(String oldLine) {
this.oldLine = oldLine;
}
/**
* @return the newLine
*/
public String getNewLine() {
return newLine;
}
/**
* @param newLine the newLine to set
*/
public void setNewLine(String newLine) {
this.newLine = newLine;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((newLine == null) ? 0 : newLine.hashCode());
result = prime * result + ((oldLine == null) ? 0 : oldLine.hashCode());
result = prime * result + ((tag == null) ? 0 : tag.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DiffRow other = (DiffRow) obj;
if (newLine == null) {
if (other.newLine != null)
return false;
} else if (!newLine.equals(other.newLine))
return false;
if (oldLine == null) {
if (other.oldLine != null)
return false;
} else if (!oldLine.equals(other.oldLine))
return false;
if (tag == null) {
if (other.tag != null)
return false;
} else if (!tag.equals(other.tag))
return false;
return true;
}
public String toString() {
return "[" + this.tag + "," + this.oldLine + "," + this.newLine + "]";
}
}
@@ -1,336 +1,336 @@
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import difflib.myers.MyersDiff;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Implements the difference and patching engine
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
* @version 0.4.1
*/
public class DiffUtils {
private static Pattern unifiedDiffChunkRe =
Pattern.compile("^@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\d+))?)\\s+@@$");
/**
* Compute the difference between the original and revised texts with default diff algorithm
*
* @param original the original text
* @param revised the revised text
* @return the patch describing the difference between the original and revised texts
*/
public static <T> Patch<T> diff(Iterable<T> original, Iterable<T> revised) {
return DiffUtils.diff(original, revised, new MyersDiff<T>());
}
/**
* Compute the difference between the original and revised texts with given diff algorithm
*
* @param original the original text
* @param revised the revised text
* @param algorithm the given algorithm
* @return the patch describing the difference between the original and revised texts
*/
public static <T> Patch<T> diff(Iterable<T> original, Iterable<T> revised, DiffAlgorithm<T> algorithm) {
return algorithm.diff(original, revised);
}
/**
* Patch the original text with given patch
*
* @param original the original text
* @param patch the given patch
* @return the revised text
* @throws PatchFailedException if can't apply patch
*/
public static <T> List<T> patch(List<T> original, Patch<T> patch) throws PatchFailedException {
return patch.applyTo(original);
}
/**
* Unpatch the revised text for a given patch
*
* @param revised the revised text
* @param patch the given patch
* @return the original text
*/
public static <T> List<T> unpatch(List<T> revised, Patch<T> patch) {
return patch.restore(revised);
}
/**
* Parse the given text in unified format and creates the list of deltas for it.
*
* @param diff the text in unified format
* @return the patch with deltas.
*/
public static Patch<String> parseUnifiedDiff(List<String> diff) {
boolean inPrelude = true;
List<Object[]> rawChunk = new ArrayList<Object[]>();
Patch<String> patch = new Patch<String>();
int old_ln = 0, new_ln = 0;
String tag;
String rest;
for (String line : diff) {
// Skip leading lines until after we've seen one starting with '+++'
if (inPrelude) {
if (line.startsWith("+++")) {
inPrelude = false;
}
continue;
}
Matcher m = unifiedDiffChunkRe.matcher(line);
if (m.find()) {
// Process the lines in the previous chunk
if (rawChunk.size() != 0) {
List<String> oldChunkLines = new ArrayList<String>();
List<String> newChunkLines = new ArrayList<String>();
for (Object[] raw_line : rawChunk) {
tag = (String) raw_line[0];
rest = (String) raw_line[1];
if (tag.equals(" ") || tag.equals("-")) {
oldChunkLines.add(rest);
}
if (tag.equals(" ") || tag.equals("+")) {
newChunkLines.add(rest);
}
}
patch.addDelta(new ChangeDelta<String>(new Chunk<String>(old_ln - 1, oldChunkLines),
new Chunk<String>(new_ln - 1, newChunkLines)));
rawChunk.clear();
}
// Parse the @@ header
old_ln = m.group(1) == null ? 1 : Integer.parseInt(m.group(1));
new_ln = m.group(3) == null ? 1 : Integer.parseInt(m.group(3));
if (old_ln == 0) {
old_ln += 1;
}
if (new_ln == 0) {
new_ln += 1;
}
} else {
if (line.length() > 0) {
tag = line.substring(0, 1);
rest = line.substring(1);
if (tag.equals(" ") || tag.equals("+") || tag.equals("-")) {
rawChunk.add(new Object[]{tag, rest});
}
} else {
rawChunk.add(new Object[]{" ", ""});
}
}
}
// Process the lines in the last chunk
if (rawChunk.size() != 0) {
List<String> oldChunkLines = new ArrayList<String>();
List<String> newChunkLines = new ArrayList<String>();
for (Object[] raw_line : rawChunk) {
tag = (String) raw_line[0];
rest = (String) raw_line[1];
if (tag.equals(" ") || tag.equals("-")) {
oldChunkLines.add(rest);
}
if (tag.equals(" ") || tag.equals("+")) {
newChunkLines.add(rest);
}
}
patch.addDelta(new ChangeDelta<String>(new Chunk<String>(old_ln - 1, oldChunkLines), new Chunk<String>(
new_ln - 1, newChunkLines)));
rawChunk.clear();
}
return patch;
}
/**
* generateUnifiedDiff takes a Patch and some other arguments, returning the Unified Diff format text representing the Patch.
*
* @param original - Filename of the original (unrevised file)
* @param revised - Filename of the revised file
* @param originalLines - Lines of the original file
* @param patch - Patch created by the diff() function
* @param contextSize - number of lines of context output around each difference in the file.
* @return List of strings representing the Unified Diff representation of the Patch argument.
* @author Bill James (tankerbay@gmail.com)
*/
public static List<String> generateUnifiedDiff(String original, String revised,
List<String> originalLines, Patch<String> patch, int contextSize) {
if (!patch.getDeltas().isEmpty()) {
List<String> ret = new ArrayList<String>();
ret.add("--- " + original);
ret.add("+++ " + revised);
List<Delta<String>> patchDeltas = new ArrayList<Delta<String>>(patch.getDeltas());
// code outside the if block also works for single-delta issues.
List<Delta<String>> deltas = new ArrayList<Delta<String>>(); // current list of Delta's to process
Delta<String> delta = patchDeltas.get(0);
deltas.add(delta); // add the first Delta to the current set
// if there's more than 1 Delta, we may need to output them together
if (patchDeltas.size() > 1) {
for (int i = 1; i < patchDeltas.size(); i++) {
int position = delta.getOriginal().getPosition(); // store the current position of
// the first Delta
// Check if the next Delta is too close to the current position.
// And if it is, add it to the current set
Delta<String> nextDelta = patchDeltas.get(i);
if ((position + delta.getOriginal().size() + contextSize) >=
(nextDelta.getOriginal().getPosition() - contextSize)) {
deltas.add(nextDelta);
} else {
// if it isn't, output the current set,
// then create a new set and add the current Delta to it.
List<String> curBlock = processDeltas(originalLines, deltas, contextSize);
ret.addAll(curBlock);
deltas.clear();
deltas.add(nextDelta);
}
delta = nextDelta;
}
}
// don't forget to process the last set of Deltas
List<String> curBlock = processDeltas(originalLines, deltas, contextSize);
ret.addAll(curBlock);
return ret;
}
return new ArrayList<String>();
}
/**
* processDeltas takes a list of Deltas and outputs them together in a single block of Unified-Diff-format text.
*
* @param origLines - the lines of the original file
* @param deltas - the Deltas to be output as a single block
* @param contextSize - the number of lines of context to place around block
* @return
* @author Bill James (tankerbay@gmail.com)
*/
private static List<String> processDeltas(List<String> origLines, List<Delta<String>> deltas,
int contextSize) {
List<String> buffer = new ArrayList<String>();
int origTotal = 0; // counter for total lines output from Original
int revTotal = 0; // counter for total lines output from Original
int line;
Delta<String> curDelta = deltas.get(0);
// NOTE: +1 to overcome the 0-offset Position
int origStart = curDelta.getOriginal().getPosition() + 1 - contextSize;
if (origStart < 1) {
origStart = 1;
}
int revStart = curDelta.getRevised().getPosition() + 1 - contextSize;
if (revStart < 1) {
revStart = 1;
}
// find the start of the wrapper context code
int contextStart = curDelta.getOriginal().getPosition() - contextSize;
if (contextStart < 0) {
contextStart = 0; // clamp to the start of the file
}
// output the context before the first Delta
for (line = contextStart; line < curDelta.getOriginal().getPosition(); line++) { //
buffer.add(" " + origLines.get(line));
origTotal++;
revTotal++;
}
// output the first Delta
buffer.addAll(getDeltaText(curDelta));
origTotal += curDelta.getOriginal().getLines().size();
revTotal += curDelta.getRevised().getLines().size();
int deltaIndex = 1;
while (deltaIndex < deltas.size()) { // for each of the other Deltas
Delta<String> nextDelta = deltas.get(deltaIndex);
int intermediateStart = curDelta.getOriginal().getPosition()
+ curDelta.getOriginal().getLines().size();
for (line = intermediateStart; line < nextDelta.getOriginal().getPosition(); line++) {
// output the code between the last Delta and this one
buffer.add(" " + origLines.get(line));
origTotal++;
revTotal++;
}
buffer.addAll(getDeltaText(nextDelta)); // output the Delta
origTotal += nextDelta.getOriginal().getLines().size();
revTotal += nextDelta.getRevised().getLines().size();
curDelta = nextDelta;
deltaIndex++;
}
// Now output the post-Delta context code, clamping the end of the file
contextStart = curDelta.getOriginal().getPosition()
+ curDelta.getOriginal().getLines().size();
for (line = contextStart; (line < (contextStart + contextSize))
&& (line < origLines.size()); line++) {
buffer.add(" " + origLines.get(line));
origTotal++;
revTotal++;
}
// Create and insert the block header, conforming to the Unified Diff standard
StringBuffer header = new StringBuffer();
header.append("@@ -");
header.append(origStart);
header.append(",");
header.append(origTotal);
header.append(" +");
header.append(revStart);
header.append(",");
header.append(revTotal);
header.append(" @@");
buffer.add(0, header.toString());
return buffer;
}
/**
* getDeltaText returns the lines to be added to the Unified Diff text from the Delta parameter
*
* @param delta - the Delta to output
* @return list of String lines of code.
* @author Bill James (tankerbay@gmail.com)
*/
private static List<String> getDeltaText(Delta<String> delta) {
List<String> buffer = new ArrayList<String>();
for (Object line : delta.getOriginal().getLines()) {
buffer.add("-" + line);
}
for (Object line : delta.getRevised().getLines()) {
buffer.add("+" + line);
}
return buffer;
}
}
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import difflib.myers.MyersDiff;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Implements the difference and patching engine
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
* @version 0.4.1
*/
public class DiffUtils {
private static Pattern unifiedDiffChunkRe =
Pattern.compile("^@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\d+))?)\\s+@@$");
/**
* Compute the difference between the original and revised texts with default diff algorithm
*
* @param original the original text
* @param revised the revised text
* @return the patch describing the difference between the original and revised texts
*/
public static <T> Patch<T> diff(Iterable<T> original, Iterable<T> revised) {
return DiffUtils.diff(original, revised, new MyersDiff<T>());
}
/**
* Compute the difference between the original and revised texts with given diff algorithm
*
* @param original the original text
* @param revised the revised text
* @param algorithm the given algorithm
* @return the patch describing the difference between the original and revised texts
*/
public static <T> Patch<T> diff(Iterable<T> original, Iterable<T> revised, DiffAlgorithm<T> algorithm) {
return algorithm.diff(original, revised);
}
/**
* Patch the original text with given patch
*
* @param original the original text
* @param patch the given patch
* @return the revised text
* @throws PatchFailedException if can't apply patch
*/
public static <T> List<T> patch(List<T> original, Patch<T> patch) throws PatchFailedException {
return patch.applyTo(original);
}
/**
* Unpatch the revised text for a given patch
*
* @param revised the revised text
* @param patch the given patch
* @return the original text
*/
public static <T> List<T> unpatch(List<T> revised, Patch<T> patch) {
return patch.restore(revised);
}
/**
* Parse the given text in unified format and creates the list of deltas for it.
*
* @param diff the text in unified format
* @return the patch with deltas.
*/
public static Patch<String> parseUnifiedDiff(List<String> diff) {
boolean inPrelude = true;
List<Object[]> rawChunk = new ArrayList<Object[]>();
Patch<String> patch = new Patch<String>();
int old_ln = 0, new_ln = 0;
String tag;
String rest;
for (String line : diff) {
// Skip leading lines until after we've seen one starting with '+++'
if (inPrelude) {
if (line.startsWith("+++")) {
inPrelude = false;
}
continue;
}
Matcher m = unifiedDiffChunkRe.matcher(line);
if (m.find()) {
// Process the lines in the previous chunk
if (rawChunk.size() != 0) {
List<String> oldChunkLines = new ArrayList<String>();
List<String> newChunkLines = new ArrayList<String>();
for (Object[] raw_line : rawChunk) {
tag = (String) raw_line[0];
rest = (String) raw_line[1];
if (tag.equals(" ") || tag.equals("-")) {
oldChunkLines.add(rest);
}
if (tag.equals(" ") || tag.equals("+")) {
newChunkLines.add(rest);
}
}
patch.addDelta(new ChangeDelta<String>(new Chunk<String>(old_ln - 1, oldChunkLines),
new Chunk<String>(new_ln - 1, newChunkLines)));
rawChunk.clear();
}
// Parse the @@ header
old_ln = m.group(1) == null ? 1 : Integer.parseInt(m.group(1));
new_ln = m.group(3) == null ? 1 : Integer.parseInt(m.group(3));
if (old_ln == 0) {
old_ln += 1;
}
if (new_ln == 0) {
new_ln += 1;
}
} else {
if (line.length() > 0) {
tag = line.substring(0, 1);
rest = line.substring(1);
if (tag.equals(" ") || tag.equals("+") || tag.equals("-")) {
rawChunk.add(new Object[]{tag, rest});
}
} else {
rawChunk.add(new Object[]{" ", ""});
}
}
}
// Process the lines in the last chunk
if (rawChunk.size() != 0) {
List<String> oldChunkLines = new ArrayList<String>();
List<String> newChunkLines = new ArrayList<String>();
for (Object[] raw_line : rawChunk) {
tag = (String) raw_line[0];
rest = (String) raw_line[1];
if (tag.equals(" ") || tag.equals("-")) {
oldChunkLines.add(rest);
}
if (tag.equals(" ") || tag.equals("+")) {
newChunkLines.add(rest);
}
}
patch.addDelta(new ChangeDelta<String>(new Chunk<String>(old_ln - 1, oldChunkLines), new Chunk<String>(
new_ln - 1, newChunkLines)));
rawChunk.clear();
}
return patch;
}
/**
* generateUnifiedDiff takes a Patch and some other arguments, returning the Unified Diff format text representing the Patch.
*
* @param original - Filename of the original (unrevised file)
* @param revised - Filename of the revised file
* @param originalLines - Lines of the original file
* @param patch - Patch created by the diff() function
* @param contextSize - number of lines of context output around each difference in the file.
* @return List of strings representing the Unified Diff representation of the Patch argument.
* @author Bill James (tankerbay@gmail.com)
*/
public static List<String> generateUnifiedDiff(String original, String revised,
List<String> originalLines, Patch<String> patch, int contextSize) {
if (!patch.getDeltas().isEmpty()) {
List<String> ret = new ArrayList<String>();
ret.add("--- " + original);
ret.add("+++ " + revised);
List<Delta<String>> patchDeltas = new ArrayList<Delta<String>>(patch.getDeltas());
// code outside the if block also works for single-delta issues.
List<Delta<String>> deltas = new ArrayList<Delta<String>>(); // current list of Delta's to process
Delta<String> delta = patchDeltas.get(0);
deltas.add(delta); // add the first Delta to the current set
// if there's more than 1 Delta, we may need to output them together
if (patchDeltas.size() > 1) {
for (int i = 1; i < patchDeltas.size(); i++) {
int position = delta.getOriginal().getPosition(); // store the current position of
// the first Delta
// Check if the next Delta is too close to the current position.
// And if it is, add it to the current set
Delta<String> nextDelta = patchDeltas.get(i);
if ((position + delta.getOriginal().size() + contextSize) >=
(nextDelta.getOriginal().getPosition() - contextSize)) {
deltas.add(nextDelta);
} else {
// if it isn't, output the current set,
// then create a new set and add the current Delta to it.
List<String> curBlock = processDeltas(originalLines, deltas, contextSize);
ret.addAll(curBlock);
deltas.clear();
deltas.add(nextDelta);
}
delta = nextDelta;
}
}
// don't forget to process the last set of Deltas
List<String> curBlock = processDeltas(originalLines, deltas, contextSize);
ret.addAll(curBlock);
return ret;
}
return new ArrayList<String>();
}
/**
* processDeltas takes a list of Deltas and outputs them together in a single block of Unified-Diff-format text.
*
* @param origLines - the lines of the original file
* @param deltas - the Deltas to be output as a single block
* @param contextSize - the number of lines of context to place around block
* @return
* @author Bill James (tankerbay@gmail.com)
*/
private static List<String> processDeltas(List<String> origLines, List<Delta<String>> deltas,
int contextSize) {
List<String> buffer = new ArrayList<String>();
int origTotal = 0; // counter for total lines output from Original
int revTotal = 0; // counter for total lines output from Original
int line;
Delta<String> curDelta = deltas.get(0);
// NOTE: +1 to overcome the 0-offset Position
int origStart = curDelta.getOriginal().getPosition() + 1 - contextSize;
if (origStart < 1) {
origStart = 1;
}
int revStart = curDelta.getRevised().getPosition() + 1 - contextSize;
if (revStart < 1) {
revStart = 1;
}
// find the start of the wrapper context code
int contextStart = curDelta.getOriginal().getPosition() - contextSize;
if (contextStart < 0) {
contextStart = 0; // clamp to the start of the file
}
// output the context before the first Delta
for (line = contextStart; line < curDelta.getOriginal().getPosition(); line++) { //
buffer.add(" " + origLines.get(line));
origTotal++;
revTotal++;
}
// output the first Delta
buffer.addAll(getDeltaText(curDelta));
origTotal += curDelta.getOriginal().getLines().size();
revTotal += curDelta.getRevised().getLines().size();
int deltaIndex = 1;
while (deltaIndex < deltas.size()) { // for each of the other Deltas
Delta<String> nextDelta = deltas.get(deltaIndex);
int intermediateStart = curDelta.getOriginal().getPosition()
+ curDelta.getOriginal().getLines().size();
for (line = intermediateStart; line < nextDelta.getOriginal().getPosition(); line++) {
// output the code between the last Delta and this one
buffer.add(" " + origLines.get(line));
origTotal++;
revTotal++;
}
buffer.addAll(getDeltaText(nextDelta)); // output the Delta
origTotal += nextDelta.getOriginal().getLines().size();
revTotal += nextDelta.getRevised().getLines().size();
curDelta = nextDelta;
deltaIndex++;
}
// Now output the post-Delta context code, clamping the end of the file
contextStart = curDelta.getOriginal().getPosition()
+ curDelta.getOriginal().getLines().size();
for (line = contextStart; (line < (contextStart + contextSize))
&& (line < origLines.size()); line++) {
buffer.add(" " + origLines.get(line));
origTotal++;
revTotal++;
}
// Create and insert the block header, conforming to the Unified Diff standard
StringBuffer header = new StringBuffer();
header.append("@@ -");
header.append(origStart);
header.append(",");
header.append(origTotal);
header.append(" +");
header.append(revStart);
header.append(",");
header.append(revTotal);
header.append(" @@");
buffer.add(0, header.toString());
return buffer;
}
/**
* getDeltaText returns the lines to be added to the Unified Diff text from the Delta parameter
*
* @param delta - the Delta to output
* @return list of String lines of code.
* @author Bill James (tankerbay@gmail.com)
*/
private static List<String> getDeltaText(Delta<String> delta) {
List<String> buffer = new ArrayList<String>();
for (Object line : delta.getOriginal().getLines()) {
buffer.add("-" + line);
}
for (Object line : delta.getRevised().getLines()) {
buffer.add("+" + line);
}
return buffer;
}
}
@@ -1,78 +1,78 @@
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.List;
/**
* Describes the add-delta between original and revised texts.
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public class InsertDelta<T> extends Delta<T> {
/**
* {@inheritDoc}
*/
public InsertDelta(Chunk<T> original, Chunk<T> revised) {
super(original, revised);
}
/**
* {@inheritDoc}
* @throws PatchFailedException
*/
@Override
public void applyTo(List<T> target) throws PatchFailedException {
verify(target);
int position = this.getOriginal().getPosition();
List<T> lines = this.getRevised().getLines();
for (int i = 0; i < lines.size(); i++) {
target.add(position + i, lines.get(i));
}
}
/**
* {@inheritDoc}
*/
@Override
public void restore(List<T> target) {
int position = getRevised().getPosition();
int size = getRevised().size();
for (int i = 0; i < size; i++) {
target.remove(position);
}
}
@Override
public void verify(List<T> target) throws PatchFailedException {
if (getOriginal().getPosition() > target.size()) {
throw new PatchFailedException("Incorrect patch for delta: "
+ "delta original position > target size");
}
}
public TYPE getType() {
return Delta.TYPE.INSERT;
}
@Override
public String toString() {
return "[InsertDelta, position: " + getOriginal().getPosition() + ", lines: "
+ getRevised().getLines() + "]";
}
}
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.List;
/**
* Describes the add-delta between original and revised texts.
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public class InsertDelta<T> extends Delta<T> {
/**
* {@inheritDoc}
*/
public InsertDelta(Chunk<T> original, Chunk<T> revised) {
super(original, revised);
}
/**
* {@inheritDoc}
* @throws PatchFailedException
*/
@Override
public void applyTo(List<T> target) throws PatchFailedException {
verify(target);
int position = this.getOriginal().getPosition();
List<T> lines = this.getRevised().getLines();
for (int i = 0; i < lines.size(); i++) {
target.add(position + i, lines.get(i));
}
}
/**
* {@inheritDoc}
*/
@Override
public void restore(List<T> target) {
int position = getRevised().getPosition();
int size = getRevised().size();
for (int i = 0; i < size; i++) {
target.remove(position);
}
}
@Override
public void verify(List<T> target) throws PatchFailedException {
if (getOriginal().getPosition() > target.size()) {
throw new PatchFailedException("Incorrect patch for delta: "
+ "delta original position > target size");
}
}
public TYPE getType() {
return Delta.TYPE.INSERT;
}
@Override
public String toString() {
return "[InsertDelta, position: " + getOriginal().getPosition() + ", lines: "
+ getRevised().getLines() + "]";
}
}
@@ -1,113 +1,113 @@
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
/**
* Describes the patch holding all deltas between the original and revised texts.
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public class Patch<T> {
private List<Delta<T>> deltas = new LinkedList<Delta<T>>();
/**
* Apply this patch to the given target, producing a new list as result
* @return the patched text
* @throws PatchFailedException if can't apply patch
*/
public List<T> applyTo(List<T> target) throws PatchFailedException {
List<T> result = new LinkedList<T>(target);
ListIterator<Delta<T>> it = getDeltas().listIterator(deltas.size());
while (it.hasPrevious()) {
Delta<T> delta = it.previous();
delta.applyTo(result);
}
return result;
}
public boolean isEmpty() {
return deltas.isEmpty();
}
/**
* Apply this patch to the given target in-place, updating the <code>target</code> list
* @return the patched text
* @throws PatchFailedException if can't apply patch
*/
public List<T> applyToInPlace(List<T> target) throws PatchFailedException {
List<T> result = target;
ListIterator<Delta<T>> it = getDeltas().listIterator(deltas.size());
while (it.hasPrevious()) {
Delta<T> delta = it.previous();
delta.applyTo(result);
}
return result;
}
/**
* Restore the text to original. Opposite to applyTo() method.
* @param target the given target
* @return the restored text
*/
public List<T> restore(List<T> target) {
List<T> result = new LinkedList<T>(target);
ListIterator<Delta<T>> it = getDeltas().listIterator(deltas.size());
while (it.hasPrevious()) {
Delta<T> delta = it.previous();
delta.restore(result);
}
return result;
}
/**
* Add the given delta to this patch
* @param delta the given delta
*/
public void addDelta(Delta<T> delta) {
deltas.add(delta);
}
/**
* Get the list of computed deltas
* @return the deltas
*/
public List<Delta<T>> getDeltas() {
Collections.sort(deltas, new DeltaComparator<T>());
return deltas;
}
@Override
public String toString() {
StringBuilder result = new StringBuilder();
result.append('[');
boolean first = true;
for (Delta<T> delta : getDeltas()) {
if (first) {
first = false;
} else {
result.append(", ");
}
result.append(delta);
}
result.append(']');
return result.toString();
}
}
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
/**
* Describes the patch holding all deltas between the original and revised texts.
*
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
*/
public class Patch<T> {
private List<Delta<T>> deltas = new LinkedList<Delta<T>>();
/**
* Apply this patch to the given target, producing a new list as result
* @return the patched text
* @throws PatchFailedException if can't apply patch
*/
public List<T> applyTo(List<T> target) throws PatchFailedException {
List<T> result = new LinkedList<T>(target);
ListIterator<Delta<T>> it = getDeltas().listIterator(deltas.size());
while (it.hasPrevious()) {
Delta<T> delta = it.previous();
delta.applyTo(result);
}
return result;
}
public boolean isEmpty() {
return deltas.isEmpty();
}
/**
* Apply this patch to the given target in-place, updating the <code>target</code> list
* @return the patched text
* @throws PatchFailedException if can't apply patch
*/
public List<T> applyToInPlace(List<T> target) throws PatchFailedException {
List<T> result = target;
ListIterator<Delta<T>> it = getDeltas().listIterator(deltas.size());
while (it.hasPrevious()) {
Delta<T> delta = it.previous();
delta.applyTo(result);
}
return result;
}
/**
* Restore the text to original. Opposite to applyTo() method.
* @param target the given target
* @return the restored text
*/
public List<T> restore(List<T> target) {
List<T> result = new LinkedList<T>(target);
ListIterator<Delta<T>> it = getDeltas().listIterator(deltas.size());
while (it.hasPrevious()) {
Delta<T> delta = it.previous();
delta.restore(result);
}
return result;
}
/**
* Add the given delta to this patch
* @param delta the given delta
*/
public void addDelta(Delta<T> delta) {
deltas.add(delta);
}
/**
* Get the list of computed deltas
* @return the deltas
*/
public List<Delta<T>> getDeltas() {
Collections.sort(deltas, new DeltaComparator<T>());
return deltas;
}
@Override
public String toString() {
StringBuilder result = new StringBuilder();
result.append('[');
boolean first = true;
for (Delta<T> delta : getDeltas()) {
if (first) {
first = false;
} else {
result.append(", ");
}
result.append(delta);
}
result.append(']');
return result.toString();
}
}
@@ -1,33 +1,33 @@
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
/**
* Thrown whenever a delta cannot be applied as a patch to a given text.
*
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*/
public class PatchFailedException extends DiffException {
private static final long serialVersionUID = 1L;
public PatchFailedException() {
}
public PatchFailedException(String msg) {
super(msg);
}
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
/**
* Thrown whenever a delta cannot be applied as a patch to a given text.
*
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*/
public class PatchFailedException extends DiffException {
private static final long serialVersionUID = 1L;
public PatchFailedException() {
}
public PatchFailedException(String msg) {
super(msg);
}
}
@@ -1,83 +1,83 @@
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public class StringUtills {
public static <T> String join(final Iterable<T> objs, final String delimiter) {
Iterator<T> iter = objs.iterator();
if (!iter.hasNext()) {
return "";
}
StringBuffer buffer = new StringBuffer(String.valueOf(iter.next()));
while (iter.hasNext()) {
buffer.append(delimiter).append(String.valueOf(iter.next()));
}
return buffer.toString();
}
public static String expandTabs(String str) {
return str.replace("\t", " ");
}
public static String htmlEntites(String str) {
return str.replace("<", "&lt;").replace(">", "&gt;");
}
public static String normalize(String str) {
return expandTabs(htmlEntites(str));
}
public static List<String> normalize(List<String> list) {
List<String> result = new LinkedList<String>();
for (String line : list) {
result.add(normalize(line));
}
return result;
}
public static List<String> wrapText(List<String> list, int columnWidth) {
List<String> result = new LinkedList<String>();
for (String line : list) {
result.add(wrapText(line, columnWidth));
}
return result;
}
/**
* Wrap the text with the given column width
* @param line the text
* @param columnWidth the given column
* @return the wrapped text
*/
public static String wrapText(String line, int columnWidth) {
int lenght = line.length();
int delimiter = "<br>".length();
int widthIndex = columnWidth;
for (int count = 0; lenght > widthIndex; count++) {
line = line.subSequence(0, widthIndex + delimiter * count) + "<br>"
+ line.substring(widthIndex + delimiter * count);
widthIndex += columnWidth;
}
return line;
}
}
/*
Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
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 difflib;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public class StringUtills {
public static <T> String join(final Iterable<T> objs, final String delimiter) {
Iterator<T> iter = objs.iterator();
if (!iter.hasNext()) {
return "";
}
StringBuffer buffer = new StringBuffer(String.valueOf(iter.next()));
while (iter.hasNext()) {
buffer.append(delimiter).append(String.valueOf(iter.next()));
}
return buffer.toString();
}
public static String expandTabs(String str) {
return str.replace("\t", " ");
}
public static String htmlEntites(String str) {
return str.replace("<", "&lt;").replace(">", "&gt;");
}
public static String normalize(String str) {
return expandTabs(htmlEntites(str));
}
public static List<String> normalize(List<String> list) {
List<String> result = new LinkedList<String>();
for (String line : list) {
result.add(normalize(line));
}
return result;
}
public static List<String> wrapText(List<String> list, int columnWidth) {
List<String> result = new LinkedList<String>();
for (String line : list) {
result.add(wrapText(line, columnWidth));
}
return result;
}
/**
* Wrap the text with the given column width
* @param line the text
* @param columnWidth the given column
* @return the wrapped text
*/
public static String wrapText(String line, int columnWidth) {
int lenght = line.length();
int delimiter = "<br>".length();
int widthIndex = columnWidth;
for (int count = 0; lenght > widthIndex; count++) {
line = line.subSequence(0, widthIndex + delimiter * count) + "<br>"
+ line.substring(widthIndex + delimiter * count);
widthIndex += columnWidth;
}
return line;
}
}
@@ -1,77 +1,77 @@
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package difflib.myers;
/**
* Base class for all exceptions emanating from this package.
*
* @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
*
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*/
public class DiffException extends Exception {
private static final long serialVersionUID = 1L;
public DiffException() {
}
public DiffException(String msg) {
super(msg);
}
}
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package difflib.myers;
/**
* Base class for all exceptions emanating from this package.
*
* @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
*
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*/
public class DiffException extends Exception {
private static final long serialVersionUID = 1L;
public DiffException() {
}
public DiffException(String msg) {
super(msg);
}
}
@@ -1,53 +1,53 @@
package difflib.myers;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
/**
* A diffnode in a diffpath.
* <p>
* A DiffNode and its previous node mark a delta between
* two input sequences, that is, two differing subsequences
* between (possibly zero length) matching sequences.
*
* {@link DiffNode DiffNodes} and {@link Snake Snakes} allow for compression
* of diffpaths, as each snake is represented by a single {@link Snake Snake}
* node and each contiguous series of insertions and deletions is represented
* by a single {@link DiffNode DiffNodes}.
*
* @version $Revision: 60 $ $Date: 2003-05-10 21:56:10 +0300 (Суб, 10 Май 2003) $
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*
*/
public final class DiffNode extends PathNode {
/**
* Constructs a DiffNode.
* <p>
* DiffNodes are compressed. That means that
* the path pointed to by the <code>prev</code> parameter
* will be followed using {@link PathNode#previousSnake}
* until a non-diff node is found.
*
* @param the position in the original sequence
* @param the position in the revised sequence
* @param prev the previous node in the path.
*/
public DiffNode(int i, int j, PathNode prev) {
super(i, j, (prev == null ? null : prev.previousSnake()));
}
/**
* {@inheritDoc}
* @return false, always
*/
public boolean isSnake() {
return false;
}
package difflib.myers;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
/**
* A diffnode in a diffpath.
* <p>
* A DiffNode and its previous node mark a delta between
* two input sequences, that is, two differing subsequences
* between (possibly zero length) matching sequences.
*
* {@link DiffNode DiffNodes} and {@link Snake Snakes} allow for compression
* of diffpaths, as each snake is represented by a single {@link Snake Snake}
* node and each contiguous series of insertions and deletions is represented
* by a single {@link DiffNode DiffNodes}.
*
* @version $Revision: 60 $ $Date: 2003-05-10 21:56:10 +0300 (Суб, 10 Май 2003) $
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*
*/
public final class DiffNode extends PathNode {
/**
* Constructs a DiffNode.
* <p>
* DiffNodes are compressed. That means that
* the path pointed to by the <code>prev</code> parameter
* will be followed using {@link PathNode#previousSnake}
* until a non-diff node is found.
*
* @param the position in the original sequence
* @param the position in the revised sequence
* @param prev the previous node in the path.
*/
public DiffNode(int i, int j, PathNode prev) {
super(i, j, (prev == null ? null : prev.previousSnake()));
}
/**
* {@inheritDoc}
* @return false, always
*/
public boolean isSnake() {
return false;
}
}
@@ -1,79 +1,79 @@
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package difflib.myers;
/**
* Thrown whenever the differencing engine cannot produce the differences
* between two revisions of ta text.
*
* @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
*
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
* @see MyersDiff
* @see difflib.DiffAlgorithm
*/
public class DifferentiationFailedException extends DiffException {
private static final long serialVersionUID = 1L;
public DifferentiationFailedException() {
}
public DifferentiationFailedException(String msg) {
super(msg);
}
}
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package difflib.myers;
/**
* Thrown whenever the differencing engine cannot produce the differences
* between two revisions of ta text.
*
* @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
*
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
* @see MyersDiff
* @see difflib.DiffAlgorithm
*/
public class DifferentiationFailedException extends DiffException {
private static final long serialVersionUID = 1L;
public DifferentiationFailedException() {
}
public DifferentiationFailedException(String msg) {
super(msg);
}
}
@@ -1,263 +1,263 @@
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package difflib.myers;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
import difflib.ChangeDelta;
import difflib.Chunk;
import difflib.DeleteDelta;
import difflib.Delta;
import difflib.DiffAlgorithm;
import difflib.InsertDelta;
import difflib.Patch;
/**
* A clean-room implementation of <a href="http://www.cs.arizona.edu/people/gene/">
* Eugene Myers</a> differencing algorithm.
*
* <p> See the paper at <a href="http://www.cs.arizona.edu/people/gene/PAPERS/diff.ps">
* http://www.cs.arizona.edu/people/gene/PAPERS/diff.ps</a></p>
*
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*/
public class MyersDiff<T> implements DiffAlgorithm<T> {
/**
* Constructs an instance of the Myers differencing algorithm.
*/
public MyersDiff() {
}
/**
* {@inheritDoc}
*
* Return empty diff if get the error while procession the difference.
*/
public Patch<T> diff(Iterable<T> original, Iterable<T> revised) {
List<T> originalList = new ArrayList<T>();
for (T o : original) {
originalList.add(o);
}
@SuppressWarnings("unchecked")
T[] originalArray = (T[]) originalList.toArray();
List<T> revisedList = new ArrayList<T>();
for (T o : revised) {
revisedList.add(o);
}
@SuppressWarnings("unchecked")
T[] revisedArray = (T[]) revisedList.toArray();
return diff(originalArray, revisedArray);
}
/**
* {@inheritDoc}
*
* Return empty diff if get the error while procession the difference.
*/
public Patch<T> diff(T[] orig, T[] rev) {
PathNode path;
try {
path = buildPath(orig, rev);
return buildRevision(path, orig, rev);
} catch (DifferentiationFailedException e) {
e.printStackTrace();
}
return new Patch<T>();
}
/**
* Computes the minimum diffpath that expresses the differences
* between the original and revised sequences, according
* to Gene Myers differencing algorithm.
*
* @param orig The original sequence.
* @param rev The revised sequence.
* @return A minimum {@link PathNode Path} accross the differences graph.
* @throws DifferentiationFailedException if a diff path could not be found.
*/
public static PathNode buildPath(Object[] orig, Object[] rev)
throws DifferentiationFailedException {
if (orig == null)
throw new IllegalArgumentException("original sequence is null");
if (rev == null)
throw new IllegalArgumentException("revised sequence is null");
// these are local constants
final int N = orig.length;
final int M = rev.length;
final int MAX = N + M + 1;
final int size = 1 + 2 * MAX;
final int middle = size / 2;
final PathNode diagonal[] = new PathNode[size];
diagonal[middle + 1] = new Snake(0, -1, null);
for (int d = 0; d < MAX; d++) {
for (int k = -d; k <= d; k += 2) {
final int kmiddle = middle + k;
final int kplus = kmiddle + 1;
final int kminus = kmiddle - 1;
PathNode prev = null;
int i;
if ((k == -d) || (k != d && diagonal[kminus].i < diagonal[kplus].i)) {
i = diagonal[kplus].i;
prev = diagonal[kplus];
} else {
i = diagonal[kminus].i + 1;
prev = diagonal[kminus];
}
diagonal[kminus] = null; // no longer used
int j = i - k;
PathNode node = new DiffNode(i, j, prev);
// orig and rev are zero-based
// but the algorithm is one-based
// that's why there's no +1 when indexing the sequences
while (i < N && j < M && orig[i].equals(rev[j])) {
i++;
j++;
}
if (i > node.i) {
node = new Snake(i, j, node);
}
diagonal[kmiddle] = node;
if (i >= N && j >= M) {
return diagonal[kmiddle];
}
}
diagonal[middle + d - 1] = null;
}
// According to Myers, this cannot happen
throw new DifferentiationFailedException("could not find a diff path");
}
/**
* Constructs a {@link Patch} from a difference path.
*
* @param path The path.
* @param orig The original sequence.
* @param rev The revised sequence.
* @return A {@link Patch} script corresponding to the path.
* @throws DifferentiationFailedException if a {@link Patch} could
* not be built from the given path.
*/
public static <T> Patch<T> buildRevision(PathNode path, T[] orig, T[] rev) {
if (path == null)
throw new IllegalArgumentException("path is null");
if (orig == null)
throw new IllegalArgumentException("original sequence is null");
if (rev == null)
throw new IllegalArgumentException("revised sequence is null");
Patch<T> patch = new Patch<T>();
if (path.isSnake())
path = path.prev;
while (path != null && path.prev != null && path.prev.j >= 0) {
if (path.isSnake())
throw new IllegalStateException("bad diffpath: found snake when looking for diff");
int i = path.i;
int j = path.j;
path = path.prev;
int ianchor = path.i;
int janchor = path.j;
Chunk<T> original = new Chunk<T>(ianchor, copyOfRange(orig, ianchor, i));
Chunk<T> revised = new Chunk<T>(janchor, copyOfRange(rev, janchor, j));
Delta<T> delta = null;
if (original.size() == 0 && revised.size() != 0) {
delta = new InsertDelta<T>(original, revised);
} else if (original.size() > 0 && revised.size() == 0) {
delta = new DeleteDelta<T>(original, revised);
} else {
delta = new ChangeDelta<T>(original, revised);
}
patch.addDelta(delta);
if (path.isSnake())
path = path.prev;
}
return patch;
}
/**
* Copied here from JDK 1.6
*/
@SuppressWarnings("unchecked")
public static <T> T[] copyOfRange(T[] original, int from, int to) {
return copyOfRange(original, from, to, (Class<T[]>) original.getClass());
}
/**
* Copied here from JDK 1.6
*/
@SuppressWarnings("unchecked")
public static <T, U> T[] copyOfRange(U[] original, int from, int to,
Class<? extends T[]> newType) {
int newLength = to - from;
if (newLength < 0)
throw new IllegalArgumentException(from + " > " + to);
T[] copy = ((Object) newType == (Object) Object[].class) ? (T[]) new Object[newLength]
: (T[]) Array.newInstance(newType.getComponentType(), newLength);
System.arraycopy(original, from, copy, 0, Math.min(original.length - from, newLength));
return copy;
}
}
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package difflib.myers;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
import difflib.ChangeDelta;
import difflib.Chunk;
import difflib.DeleteDelta;
import difflib.Delta;
import difflib.DiffAlgorithm;
import difflib.InsertDelta;
import difflib.Patch;
/**
* A clean-room implementation of <a href="http://www.cs.arizona.edu/people/gene/">
* Eugene Myers</a> differencing algorithm.
*
* <p> See the paper at <a href="http://www.cs.arizona.edu/people/gene/PAPERS/diff.ps">
* http://www.cs.arizona.edu/people/gene/PAPERS/diff.ps</a></p>
*
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*/
public class MyersDiff<T> implements DiffAlgorithm<T> {
/**
* Constructs an instance of the Myers differencing algorithm.
*/
public MyersDiff() {
}
/**
* {@inheritDoc}
*
* Return empty diff if get the error while procession the difference.
*/
public Patch<T> diff(Iterable<T> original, Iterable<T> revised) {
List<T> originalList = new ArrayList<T>();
for (T o : original) {
originalList.add(o);
}
@SuppressWarnings("unchecked")
T[] originalArray = (T[]) originalList.toArray();
List<T> revisedList = new ArrayList<T>();
for (T o : revised) {
revisedList.add(o);
}
@SuppressWarnings("unchecked")
T[] revisedArray = (T[]) revisedList.toArray();
return diff(originalArray, revisedArray);
}
/**
* {@inheritDoc}
*
* Return empty diff if get the error while procession the difference.
*/
public Patch<T> diff(T[] orig, T[] rev) {
PathNode path;
try {
path = buildPath(orig, rev);
return buildRevision(path, orig, rev);
} catch (DifferentiationFailedException e) {
e.printStackTrace();
}
return new Patch<T>();
}
/**
* Computes the minimum diffpath that expresses the differences
* between the original and revised sequences, according
* to Gene Myers differencing algorithm.
*
* @param orig The original sequence.
* @param rev The revised sequence.
* @return A minimum {@link PathNode Path} accross the differences graph.
* @throws DifferentiationFailedException if a diff path could not be found.
*/
public static PathNode buildPath(Object[] orig, Object[] rev)
throws DifferentiationFailedException {
if (orig == null)
throw new IllegalArgumentException("original sequence is null");
if (rev == null)
throw new IllegalArgumentException("revised sequence is null");
// these are local constants
final int N = orig.length;
final int M = rev.length;
final int MAX = N + M + 1;
final int size = 1 + 2 * MAX;
final int middle = size / 2;
final PathNode diagonal[] = new PathNode[size];
diagonal[middle + 1] = new Snake(0, -1, null);
for (int d = 0; d < MAX; d++) {
for (int k = -d; k <= d; k += 2) {
final int kmiddle = middle + k;
final int kplus = kmiddle + 1;
final int kminus = kmiddle - 1;
PathNode prev = null;
int i;
if ((k == -d) || (k != d && diagonal[kminus].i < diagonal[kplus].i)) {
i = diagonal[kplus].i;
prev = diagonal[kplus];
} else {
i = diagonal[kminus].i + 1;
prev = diagonal[kminus];
}
diagonal[kminus] = null; // no longer used
int j = i - k;
PathNode node = new DiffNode(i, j, prev);
// orig and rev are zero-based
// but the algorithm is one-based
// that's why there's no +1 when indexing the sequences
while (i < N && j < M && orig[i].equals(rev[j])) {
i++;
j++;
}
if (i > node.i) {
node = new Snake(i, j, node);
}
diagonal[kmiddle] = node;
if (i >= N && j >= M) {
return diagonal[kmiddle];
}
}
diagonal[middle + d - 1] = null;
}
// According to Myers, this cannot happen
throw new DifferentiationFailedException("could not find a diff path");
}
/**
* Constructs a {@link Patch} from a difference path.
*
* @param path The path.
* @param orig The original sequence.
* @param rev The revised sequence.
* @return A {@link Patch} script corresponding to the path.
* @throws DifferentiationFailedException if a {@link Patch} could
* not be built from the given path.
*/
public static <T> Patch<T> buildRevision(PathNode path, T[] orig, T[] rev) {
if (path == null)
throw new IllegalArgumentException("path is null");
if (orig == null)
throw new IllegalArgumentException("original sequence is null");
if (rev == null)
throw new IllegalArgumentException("revised sequence is null");
Patch<T> patch = new Patch<T>();
if (path.isSnake())
path = path.prev;
while (path != null && path.prev != null && path.prev.j >= 0) {
if (path.isSnake())
throw new IllegalStateException("bad diffpath: found snake when looking for diff");
int i = path.i;
int j = path.j;
path = path.prev;
int ianchor = path.i;
int janchor = path.j;
Chunk<T> original = new Chunk<T>(ianchor, copyOfRange(orig, ianchor, i));
Chunk<T> revised = new Chunk<T>(janchor, copyOfRange(rev, janchor, j));
Delta<T> delta = null;
if (original.size() == 0 && revised.size() != 0) {
delta = new InsertDelta<T>(original, revised);
} else if (original.size() > 0 && revised.size() == 0) {
delta = new DeleteDelta<T>(original, revised);
} else {
delta = new ChangeDelta<T>(original, revised);
}
patch.addDelta(delta);
if (path.isSnake())
path = path.prev;
}
return patch;
}
/**
* Copied here from JDK 1.6
*/
@SuppressWarnings("unchecked")
public static <T> T[] copyOfRange(T[] original, int from, int to) {
return copyOfRange(original, from, to, (Class<T[]>) original.getClass());
}
/**
* Copied here from JDK 1.6
*/
@SuppressWarnings("unchecked")
public static <T, U> T[] copyOfRange(U[] original, int from, int to,
Class<? extends T[]> newType) {
int newLength = to - from;
if (newLength < 0)
throw new IllegalArgumentException(from + " > " + to);
T[] copy = ((Object) newType == (Object) Object[].class) ? (T[]) new Object[newLength]
: (T[]) Array.newInstance(newType.getComponentType(), newLength);
System.arraycopy(original, from, copy, 0, Math.min(original.length - from, newLength));
return copy;
}
}
@@ -1,140 +1,140 @@
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package difflib.myers;
/**
* A node in a diffpath.
*
* @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*
* @see DiffNode
* @see Snake
*
*/
public abstract class PathNode {
/** Position in the original sequence. */
public final int i;
/** Position in the revised sequence. */
public final int j;
/** The previous node in the path. */
public final PathNode prev;
/**
* Concatenates a new path node with an existing diffpath.
* @param i The position in the original sequence for the new node.
* @param j The position in the revised sequence for the new node.
* @param prev The previous node in the path.
*/
public PathNode(int i, int j, PathNode prev) {
this.i = i;
this.j = j;
this.prev = prev;
}
/**
* Is this node a {@link Snake Snake node}?
* @return true if this is a {@link Snake Snake node}
*/
public abstract boolean isSnake();
/**
* Is this a bootstrap node?
* <p>
* In bottstrap nodes one of the two corrdinates is
* less than zero.
* @return tru if this is a bootstrap node.
*/
public boolean isBootstrap() {
return i < 0 || j < 0;
}
/**
* Skips sequences of {@link DiffNode DiffNodes} until a
* {@link Snake} or bootstrap node is found, or the end
* of the path is reached.
* @return The next first {@link Snake} or bootstrap node in the path, or
* <code>null</code>
* if none found.
*/
public final PathNode previousSnake() {
if (isBootstrap())
return null;
if (!isSnake() && prev != null)
return prev.previousSnake();
return this;
}
/**
* {@inheritDoc}
*/
public String toString() {
StringBuffer buf = new StringBuffer("[");
PathNode node = this;
while (node != null) {
buf.append("(");
buf.append(Integer.toString(node.i));
buf.append(",");
buf.append(Integer.toString(node.j));
buf.append(")");
node = node.prev;
}
buf.append("]");
return buf.toString();
}
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package difflib.myers;
/**
* A node in a diffpath.
*
* @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*
* @see DiffNode
* @see Snake
*
*/
public abstract class PathNode {
/** Position in the original sequence. */
public final int i;
/** Position in the revised sequence. */
public final int j;
/** The previous node in the path. */
public final PathNode prev;
/**
* Concatenates a new path node with an existing diffpath.
* @param i The position in the original sequence for the new node.
* @param j The position in the revised sequence for the new node.
* @param prev The previous node in the path.
*/
public PathNode(int i, int j, PathNode prev) {
this.i = i;
this.j = j;
this.prev = prev;
}
/**
* Is this node a {@link Snake Snake node}?
* @return true if this is a {@link Snake Snake node}
*/
public abstract boolean isSnake();
/**
* Is this a bootstrap node?
* <p>
* In bottstrap nodes one of the two corrdinates is
* less than zero.
* @return tru if this is a bootstrap node.
*/
public boolean isBootstrap() {
return i < 0 || j < 0;
}
/**
* Skips sequences of {@link DiffNode DiffNodes} until a
* {@link Snake} or bootstrap node is found, or the end
* of the path is reached.
* @return The next first {@link Snake} or bootstrap node in the path, or
* <code>null</code>
* if none found.
*/
public final PathNode previousSnake() {
if (isBootstrap())
return null;
if (!isSnake() && prev != null)
return prev.previousSnake();
return this;
}
/**
* {@inheritDoc}
*/
public String toString() {
StringBuffer buf = new StringBuffer("[");
PathNode node = this;
while (node != null) {
buf.append("(");
buf.append(Integer.toString(node.i));
buf.append(",");
buf.append(Integer.toString(node.j));
buf.append(")");
node = node.prev;
}
buf.append("]");
return buf.toString();
}
}
@@ -1,93 +1,93 @@
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package difflib.myers;
/**
* Represents a snake in a diffpath.
* <p>
*
* {@link DiffNode DiffNodes} and {@link Snake Snakes} allow for compression
* of diffpaths, as each snake is represented by a single {@link Snake Snake}
* node and each contiguous series of insertions and deletions is represented
* by a single {@link DiffNode DiffNodes}.
*
* @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*
*/
public final class Snake extends PathNode {
/**
* Constructs a snake node.
*
* @param the position in the original sequence
* @param the position in the revised sequence
* @param prev the previous node in the path.
*/
public Snake(int i, int j, PathNode prev) {
super(i, j, prev);
}
/**
* {@inheritDoc}
* @return true always
*/
public boolean isSnake() {
return true;
}
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package difflib.myers;
/**
* Represents a snake in a diffpath.
* <p>
*
* {@link DiffNode DiffNodes} and {@link Snake Snakes} allow for compression
* of diffpaths, as each snake is represented by a single {@link Snake Snake}
* node and each contiguous series of insertions and deletions is represented
* by a single {@link DiffNode DiffNodes}.
*
* @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
* @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
*
*/
public final class Snake extends PathNode {
/**
* Constructs a snake node.
*
* @param the position in the original sequence
* @param the position in the revised sequence
* @param prev the previous node in the path.
*/
public Snake(int i, int j, PathNode prev) {
super(i, j, prev);
}
/**
* {@inheritDoc}
* @return true always
*/
public boolean isSnake() {
return true;
}
}
@@ -1,42 +1,42 @@
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--
/*
Copyright 2009 Dmitry Naumenko (dm.naumenko@gmail.com)
This file is part of Java Diff Utills Library.
Java Diff Utills Library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Java Diff Utills Library 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Java Diff Utills Library. If not, see <http://www.gnu.org/licenses/>.
*/
-->
<html>
<head>
<meta name="generator" content=
"HTML Tidy for Cygwin (vers 1st February 2003), see www.w3.org">
<title></title>
</head>
<body>
<p>
The {@link difflib.myers diff.myers} package
implements <a href=
"http://www.cs.arizona.edu/people/gene/">Gene Myers</a>'
differencing algorithm.
</p>
<p>
Myer's algorithm produces optimum results (minimum diffs), but
consumes considerably more memory than SimpleDiff, so its not
suitable for very large files.
</p>
@author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
</body>
</html>
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--
/*
Copyright 2009 Dmitry Naumenko (dm.naumenko@gmail.com)
This file is part of Java Diff Utills Library.
Java Diff Utills Library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Java Diff Utills Library 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Java Diff Utills Library. If not, see <http://www.gnu.org/licenses/>.
*/
-->
<html>
<head>
<meta name="generator" content=
"HTML Tidy for Cygwin (vers 1st February 2003), see www.w3.org">
<title></title>
</head>
<body>
<p>
The {@link difflib.myers diff.myers} package
implements <a href=
"http://www.cs.arizona.edu/people/gene/">Gene Myers</a>'
differencing algorithm.
</p>
<p>
Myer's algorithm produces optimum results (minimum diffs), but
consumes considerably more memory than SimpleDiff, so its not
suitable for very large files.
</p>
@author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
</body>
</html>
@@ -1,70 +1,70 @@
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-->
<html>
<head>
<meta name="generator" content=
"HTML Tidy for Cygwin (vers 1st February 2003), see www.w3.org">
<title></title>
</head>
<body>
<p>
The {@link difflib difflib} package
implements general operation with diff files.
</p>
@author <a href="mailto:dm.naumenko@gmail.com">Dmitry Naumenko</a>
</body>
</html>
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-->
<html>
<head>
<meta name="generator" content=
"HTML Tidy for Cygwin (vers 1st February 2003), see www.w3.org">
<title></title>
</head>
<body>
<p>
The {@link difflib difflib} package
implements general operation with diff files.
</p>
@author <a href="mailto:dm.naumenko@gmail.com">Dmitry Naumenko</a>
</body>
</html>
+11 -11
View File
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="lib/mongo-2.6.2.jar">
<attributes>
<attribute name="javadoc_location" value="http://api.mongodb.org/java/2.6.2/"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="lib/mongo-2.6.2.jar">
<attributes>
<attribute name="javadoc_location" value="http://api.mongodb.org/java/2.6.2/"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
+1 -1
View File
@@ -1 +1 @@
bin/
bin/
+28 -28
View File
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.mongodb.driver</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.mongodb.driver</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -1,8 +1,8 @@
#Thu Jan 19 09:47:57 CET 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
#Thu Jan 19 09:47:57 CET 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
@@ -1,5 +1,5 @@
#Fri Jul 29 09:33:56 CEST 2011
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
#Fri Jul 29 09:33:56 CEST 2011
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
@@ -1,4 +1,4 @@
#Wed Jun 08 13:41:06 CEST 2011
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false
#Wed Jun 08 13:41:06 CEST 2011
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false
+18 -18
View File
@@ -1,18 +1,18 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Driver
Bundle-SymbolicName: com.mongodb.driver
Bundle-Version: 2.6.2
Bundle-Vendor: MONGODB
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: lib/mongo-2.6.2.jar,
.
Export-Package: com.mongodb,
com.mongodb.gridfs,
com.mongodb.io,
com.mongodb.util,
org.bson,
org.bson.io,
org.bson.types,
org.bson.util
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Driver
Bundle-SymbolicName: com.mongodb.driver
Bundle-Version: 2.6.2
Bundle-Vendor: MONGODB
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: lib/mongo-2.6.2.jar,
.
Export-Package: com.mongodb,
com.mongodb.gridfs,
com.mongodb.io,
com.mongodb.util,
org.bson,
org.bson.io,
org.bson.types,
org.bson.util
+3 -3
View File
@@ -1,3 +1,3 @@
bin.includes = META-INF/,\
.,\
lib/mongo-2.6.2.jar
bin.includes = META-INF/,\
.,\
lib/mongo-2.6.2.jar
+13 -13
View File
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>root</artifactId>
<groupId>com.sap.sailing</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.mongodb.driver</artifactId>
<version>2.6.2</version>
<packaging>eclipse-plugin</packaging>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>root</artifactId>
<groupId>com.sap.sailing</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.mongodb.driver</artifactId>
<version>2.6.2</version>
<packaging>eclipse-plugin</packaging>
</project>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -1 +1 @@
/bin
/bin
+28 -28
View File
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.sap.sailing.declination.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.sap.sailing.declination.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -1,8 +1,8 @@
#Thu Jan 19 09:48:53 CET 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
#Thu Jan 19 09:48:53 CET 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
Loaded 100 of 2382 files, more files were not shown because too many files have changed in this diff. Show more