Skip to content

Commit

Permalink
Merge pull request #979 from johnbrvc/i232_submit_judges_solutions_wi…
Browse files Browse the repository at this point in the history
…th_tracking

I232 submit judges' solutions with tracking
  • Loading branch information
johnbrvc authored Jul 5, 2024
2 parents b88e08a + 0dc9ee6 commit b44fa59
Show file tree
Hide file tree
Showing 37 changed files with 5,668 additions and 1,013 deletions.
263 changes: 156 additions & 107 deletions src/edu/csus/ecs/pc2/core/IInternalController.java

Large diffs are not rendered by default.

771 changes: 467 additions & 304 deletions src/edu/csus/ecs/pc2/core/InternalController.java

Large diffs are not rendered by default.

35 changes: 23 additions & 12 deletions src/edu/csus/ecs/pc2/core/LanguageUtilities.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
// Copyright (C) 1989-2023 PC2 Development Team: John Clevenger, Douglas Lane, Samir Ashoo, and Troy Boudreau.
// Copyright (C) 1989-2024 PC2 Development Team: John Clevenger, Douglas Lane, Samir Ashoo, and Troy Boudreau.
package edu.csus.ecs.pc2.core;

import edu.csus.ecs.pc2.core.model.IInternalContest;
import edu.csus.ecs.pc2.core.model.Language;

/**
* Utility methods for languages
*
*
* @author Douglas A. Lane <[email protected]>
*/
public class LanguageUtilities {

/**
* List of language extensions and their full or partial language display name
* Legacy list of language extensions and their full or partial language display name
* This should be deprecated and languages defined in system.pc2.yaml should be required to
* include the CLICS ID (as shown above) and optionally a list of extensions supported by the
* language. The list below is inadequate and out of date. For the moment, it is included for
* backward compatibility. JB
*/
public static final String[][] LANGUAGE_LIST = { //
{ "java", "Java" }, //
Expand All @@ -28,10 +32,9 @@ public class LanguageUtilities {
{ "c", "C" }, //
};


/**
/**
* get file extension.
*
*
* @param filename
* @return file extension if no period found returns null
*/
Expand All @@ -45,7 +48,7 @@ public static String getExtension(String filename) {

/**
* Match a contest Language for the input extension.
*
*
* @param myContest contest model
* @param filename base name file or full path name.
* @return
Expand All @@ -57,14 +60,22 @@ public static Language guessLanguage(IInternalContest myContest, String filename

/**
* Match a contest Language for the input extension.
*
*
* @param inContest contest model
* @param extension the extension without period, ex cpp
* @return null if does not match any language title
*/
public static Language matchFirstLanguage(IInternalContest inContest, String extension) {
Language[] lang = inContest.getLanguages();
Language[] allLangs = inContest.getLanguages();

// first try the new way
for(Language lang : allLangs) {
if(lang.getExtensions().contains(extension)) {
return(lang);
}
}

// if all else fails, try the old way. This should be deprecated. JB
/**
* Partial or complete display name
*/
Expand All @@ -73,7 +84,7 @@ public static Language matchFirstLanguage(IInternalContest inContest, String ext
for (String[] row : LANGUAGE_LIST) {
String fileExtension = row[0];
String dispName = row[1];

if (fileExtension.equals(extension)) {
displayName = dispName;
break;
Expand All @@ -82,7 +93,7 @@ public static Language matchFirstLanguage(IInternalContest inContest, String ext

displayName = displayName.toLowerCase();

for (Language language : lang) {
for (Language language : allLangs) {
if (language.getDisplayName().toLowerCase().indexOf(displayName) != -1) {
return language;
}
Expand Down
Loading

0 comments on commit b44fa59

Please sign in to comment.