Skip to content

Commit

Permalink
Add Eclipse formatter settings. These are the Eclipse built in settin…
Browse files Browse the repository at this point in the history
…gs with

the line length changed to 160 characters.
The main source files have also been formatted.
  • Loading branch information
sdedwards committed May 23, 2015
1 parent 7b64e02 commit cdbb8ef
Show file tree
Hide file tree
Showing 80 changed files with 4,424 additions and 4,888 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
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.problem.forbiddenReference=warning
Expand Down
204 changes: 97 additions & 107 deletions com.github.sdedwards.m2e-nar/src/com/github/maven_nar/AOL.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,111 +23,101 @@
* @author Mark Donszelmann
* @version $Id$
*/
public class AOL
{

private String architecture;

private String os;

private String linkerName;

private String suffix;

// FIXME, need more complicated parsing for numbers as part of os.
public AOL( String aolWithSuffix )
{
final int suffixIndex = 3;
final int linkerIndex = 2;
final int osIndex = 1;
final int architectureIndex = 0;

String[] aolString = aolWithSuffix.split( "-", suffixIndex+1 );
switch ( aolString.length )
{
case suffixIndex+1:
suffix = aolString[suffixIndex];
case linkerIndex+1:
linkerName = aolString[linkerIndex];
case osIndex+1:
os = aolString[osIndex];
case architectureIndex+1:
architecture = aolString[architectureIndex];
break;

default:
throw new IllegalArgumentException( "AOL '" + aolWithSuffix + "' cannot be parsed." );
}
}

public AOL( String aol, String aolSuffix )
{
this(aol);
suffix = aolSuffix;
}

public AOL( String architecture, String os, String linkerName, String suffix )
{
this.architecture = architecture;
this.os = os;
this.linkerName = linkerName;
this.suffix = suffix;
}

/**
* Returns an AOL string (arch-os-linker) to use as directory or file.
* @return dash separated AOL
*/
public final String toString()
{
String tempLinkerName = null;
if ( linkerName == null ) {
tempLinkerName = "";
} else if ( linkerName.equals("g++") ) {
tempLinkerName = "-gpp";
} else {
if ( linkerName.equals("g++") ) {
tempLinkerName = "-gpp";
} else {
tempLinkerName = "-" + linkerName;
}
if ( suffix != null ) {
tempLinkerName += "-" + suffix;
}
}

return architecture
+ ((os == null) ? "" : "-" + os
+ tempLinkerName);
}

// FIXME, maybe change to something like isCompatible (AOL).
public final boolean hasLinker( String linker )
{
return linkerName.equals(linker);
}

/**
* Returns an AOL key (arch.os.linker) to search in the properties files.
* @return dot separated AOL
*/
public final String getKey()
{
String tempLinkerName = null;
if ( linkerName == null ) {
tempLinkerName = "";
} else if ( linkerName.equals("g++") ) {
tempLinkerName = ".gpp";
} else {
tempLinkerName = "." + linkerName;
}

return architecture
+ ((os == null) ? "" : "." + os
+ tempLinkerName);
}

final String getOS() {
return os;
}
public class AOL {

private String architecture;

private String os;

private String linkerName;

private String suffix;

// FIXME, need more complicated parsing for numbers as part of os.
public AOL(String aolWithSuffix) {
final int suffixIndex = 3;
final int linkerIndex = 2;
final int osIndex = 1;
final int architectureIndex = 0;

String[] aolString = aolWithSuffix.split("-", suffixIndex + 1);
switch (aolString.length) {
case suffixIndex + 1:
suffix = aolString[suffixIndex];
case linkerIndex + 1:
linkerName = aolString[linkerIndex];
case osIndex + 1:
os = aolString[osIndex];
case architectureIndex + 1:
architecture = aolString[architectureIndex];
break;

default:
throw new IllegalArgumentException("AOL '" + aolWithSuffix + "' cannot be parsed.");
}
}

public AOL(String aol, String aolSuffix) {
this(aol);
suffix = aolSuffix;
}

public AOL(String architecture, String os, String linkerName, String suffix) {
this.architecture = architecture;
this.os = os;
this.linkerName = linkerName;
this.suffix = suffix;
}

/**
* Returns an AOL string (arch-os-linker) to use as directory or file.
*
* @return dash separated AOL
*/
public final String toString() {
String tempLinkerName = null;
if (linkerName == null) {
tempLinkerName = "";
} else if (linkerName.equals("g++")) {
tempLinkerName = "-gpp";
} else {
if (linkerName.equals("g++")) {
tempLinkerName = "-gpp";
} else {
tempLinkerName = "-" + linkerName;
}
if (suffix != null) {
tempLinkerName += "-" + suffix;
}
}

return architecture + ((os == null) ? "" : "-" + os + tempLinkerName);
}

// FIXME, maybe change to something like isCompatible (AOL).
public final boolean hasLinker(String linker) {
return linkerName.equals(linker);
}

/**
* Returns an AOL key (arch.os.linker) to search in the properties files.
*
* @return dot separated AOL
*/
public final String getKey() {
String tempLinkerName = null;
if (linkerName == null) {
tempLinkerName = "";
} else if (linkerName.equals("g++")) {
tempLinkerName = ".gpp";
} else {
tempLinkerName = "." + linkerName;
}

return architecture + ((os == null) ? "" : "." + os + tempLinkerName);
}

final String getOS() {
return os;
}
}
Loading

0 comments on commit cdbb8ef

Please sign in to comment.