weijin il y a 5 ans
commit
fa46d0abf6
46 fichiers modifiés avec 2704 ajouts et 0 suppressions
  1. BIN
      .DS_Store
  2. 33 0
      .gitignore
  3. 118 0
      .mvn/wrapper/MavenWrapperDownloader.java
  4. BIN
      .mvn/wrapper/maven-wrapper.jar
  5. 2 0
      .mvn/wrapper/maven-wrapper.properties
  6. 2 0
      config/application.yml
  7. 310 0
      mvnw
  8. 182 0
      mvnw.cmd
  9. 70 0
      pom.xml
  10. BIN
      src/.DS_Store
  11. 22 0
      src/main/java/com/example/osservice/Controller/DeadlockController.java
  12. 37 0
      src/main/java/com/example/osservice/Controller/LevelController.java
  13. 28 0
      src/main/java/com/example/osservice/Controller/PageController.java
  14. 41 0
      src/main/java/com/example/osservice/Controller/ProcessController.java
  15. 48 0
      src/main/java/com/example/osservice/Controller/SubjectController.java
  16. 33 0
      src/main/java/com/example/osservice/DTO/CodeParam.java
  17. 43 0
      src/main/java/com/example/osservice/DTO/PatternParam.java
  18. 43 0
      src/main/java/com/example/osservice/DTO/RenderParam.java
  19. 14 0
      src/main/java/com/example/osservice/OsserviceApplication.java
  20. 79 0
      src/main/java/com/example/osservice/PO/OSProcess.java
  21. 44 0
      src/main/java/com/example/osservice/PO/OSProcessRunning.java
  22. 64 0
      src/main/java/com/example/osservice/PO/PageProcess.java
  23. 69 0
      src/main/java/com/example/osservice/PO/PageState.java
  24. 76 0
      src/main/java/com/example/osservice/PO/ProcessState.java
  25. 14 0
      src/main/java/com/example/osservice/Service/Deadlock/DeadlockService.java
  26. 29 0
      src/main/java/com/example/osservice/Service/Deadlock/DeadlockServiceImp.java
  27. 24 0
      src/main/java/com/example/osservice/Service/LevelService.java
  28. 14 0
      src/main/java/com/example/osservice/Service/Page/PageService.java
  29. 315 0
      src/main/java/com/example/osservice/Service/Page/PageServiceImp.java
  30. 20 0
      src/main/java/com/example/osservice/Service/Process/ProcessService.java
  31. 456 0
      src/main/java/com/example/osservice/Service/Process/ProcessServiceImp.java
  32. 34 0
      src/main/java/com/example/osservice/Service/SubjectService.java
  33. 27 0
      src/main/java/com/example/osservice/Util/IRType.java
  34. 33 0
      src/main/java/com/example/osservice/Util/SourceType.java
  35. 27 0
      src/main/java/com/example/osservice/Util/TargetType.java
  36. 10 0
      src/main/java/com/example/osservice/Util/Type.java
  37. 28 0
      src/main/java/com/example/osservice/Util/TypeMap.java
  38. 53 0
      src/main/java/com/example/osservice/VO/Level.java
  39. 4 0
      src/main/java/com/example/osservice/VO/Question.java
  40. 40 0
      src/main/java/com/example/osservice/VO/Response.java
  41. 66 0
      src/main/java/com/example/osservice/VO/ServiceInfo.java
  42. 59 0
      src/main/java/com/example/osservice/VO/Subject.java
  43. 40 0
      src/main/java/com/example/osservice/VO/TypeInfo.java
  44. 1 0
      src/main/resources/application.properties
  45. 39 0
      src/test/java/com/example/osservice/OSService/FCFSTests.java
  46. 13 0
      src/test/java/com/example/osservice/OsserviceApplicationTests.java

BIN
.DS_Store


+ 33 - 0
.gitignore

@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/

+ 118 - 0
.mvn/wrapper/MavenWrapperDownloader.java

@@ -0,0 +1,118 @@
+/*
+ * Copyright 2007-present the original author or authors.
+ *
+ * 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
+ *
+ *      https://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.
+ */
+
+import java.net.*;
+import java.io.*;
+import java.nio.channels.*;
+import java.util.Properties;
+
+public class MavenWrapperDownloader {
+
+    private static final String WRAPPER_VERSION = "0.5.6";
+    /**
+     * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
+     */
+    private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+            + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
+
+    /**
+     * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
+     * use instead of the default one.
+     */
+    private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
+            ".mvn/wrapper/maven-wrapper.properties";
+
+    /**
+     * Path where the maven-wrapper.jar will be saved to.
+     */
+    private static final String MAVEN_WRAPPER_JAR_PATH =
+            ".mvn/wrapper/maven-wrapper.jar";
+
+    /**
+     * Name of the property which should be used to override the default download url for the wrapper.
+     */
+    private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
+
+    public static void main(String args[]) {
+        System.out.println("- Downloader started");
+        File baseDirectory = new File(args[0]);
+        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
+
+        // If the maven-wrapper.properties exists, read it and check if it contains a custom
+        // wrapperUrl parameter.
+        File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
+        String url = DEFAULT_DOWNLOAD_URL;
+        if (mavenWrapperPropertyFile.exists()) {
+            FileInputStream mavenWrapperPropertyFileInputStream = null;
+            try {
+                mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
+                Properties mavenWrapperProperties = new Properties();
+                mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
+                url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
+            } catch (IOException e) {
+                System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
+            } finally {
+                try {
+                    if (mavenWrapperPropertyFileInputStream != null) {
+                        mavenWrapperPropertyFileInputStream.close();
+                    }
+                } catch (IOException e) {
+                    // Ignore ...
+                }
+            }
+        }
+        System.out.println("- Downloading from: " + url);
+
+        File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
+        if (!outputFile.getParentFile().exists()) {
+            if (!outputFile.getParentFile().mkdirs()) {
+                System.out.println(
+                        "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
+            }
+        }
+        System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
+        try {
+            downloadFileFromURL(url, outputFile);
+            System.out.println("Done");
+            System.exit(0);
+        } catch (Throwable e) {
+            System.out.println("- Error downloading");
+            e.printStackTrace();
+            System.exit(1);
+        }
+    }
+
+    private static void downloadFileFromURL(String urlString, File destination) throws Exception {
+        if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
+            String username = System.getenv("MVNW_USERNAME");
+            char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
+            Authenticator.setDefault(new Authenticator() {
+                @Override
+                protected PasswordAuthentication getPasswordAuthentication() {
+                    return new PasswordAuthentication(username, password);
+                }
+            });
+        }
+        URL website = new URL(urlString);
+        ReadableByteChannel rbc;
+        rbc = Channels.newChannel(website.openStream());
+        FileOutputStream fos = new FileOutputStream(destination);
+        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+        fos.close();
+        rbc.close();
+    }
+
+}

BIN
.mvn/wrapper/maven-wrapper.jar


+ 2 - 0
.mvn/wrapper/maven-wrapper.properties

@@ -0,0 +1,2 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

+ 2 - 0
config/application.yml

@@ -0,0 +1,2 @@
+server:
+  port: 8081

+ 310 - 0
mvnw

@@ -0,0 +1,310 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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
+#
+#    https://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.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+#   JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+#   M2_HOME - location of maven2's installed home dir
+#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
+#     e.g. to debug Maven itself, use
+#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+  if [ -f /etc/mavenrc ] ; then
+    . /etc/mavenrc
+  fi
+
+  if [ -f "$HOME/.mavenrc" ] ; then
+    . "$HOME/.mavenrc"
+  fi
+
+fi
+
+# OS specific support.  $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+  CYGWIN*) cygwin=true ;;
+  MINGW*) mingw=true;;
+  Darwin*) darwin=true
+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+    if [ -z "$JAVA_HOME" ]; then
+      if [ -x "/usr/libexec/java_home" ]; then
+        export JAVA_HOME="`/usr/libexec/java_home`"
+      else
+        export JAVA_HOME="/Library/Java/Home"
+      fi
+    fi
+    ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+  if [ -r /etc/gentoo-release ] ; then
+    JAVA_HOME=`java-config --jre-home`
+  fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+  ## resolve links - $0 may be a link to maven's home
+  PRG="$0"
+
+  # need this for relative symlinks
+  while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+      PRG="$link"
+    else
+      PRG="`dirname "$PRG"`/$link"
+    fi
+  done
+
+  saveddir=`pwd`
+
+  M2_HOME=`dirname "$PRG"`/..
+
+  # make it fully qualified
+  M2_HOME=`cd "$M2_HOME" && pwd`
+
+  cd "$saveddir"
+  # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME=`cygpath --unix "$M2_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME="`(cd "$M2_HOME"; pwd)`"
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+  javaExecutable="`which javac`"
+  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+    # readlink(1) is not available as standard on Solaris 10.
+    readLink=`which readlink`
+    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+      if $darwin ; then
+        javaHome="`dirname \"$javaExecutable\"`"
+        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+      else
+        javaExecutable="`readlink -f \"$javaExecutable\"`"
+      fi
+      javaHome="`dirname \"$javaExecutable\"`"
+      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+      JAVA_HOME="$javaHome"
+      export JAVA_HOME
+    fi
+  fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+  if [ -n "$JAVA_HOME"  ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+      # IBM's JDK on AIX uses strange locations for the executables
+      JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+      JAVACMD="$JAVA_HOME/bin/java"
+    fi
+  else
+    JAVACMD="`which java`"
+  fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+  echo "Error: JAVA_HOME is not defined correctly." >&2
+  echo "  We cannot execute $JAVACMD" >&2
+  exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+  echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+  if [ -z "$1" ]
+  then
+    echo "Path not specified to find_maven_basedir"
+    return 1
+  fi
+
+  basedir="$1"
+  wdir="$1"
+  while [ "$wdir" != '/' ] ; do
+    if [ -d "$wdir"/.mvn ] ; then
+      basedir=$wdir
+      break
+    fi
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+    if [ -d "${wdir}" ]; then
+      wdir=`cd "$wdir/.."; pwd`
+    fi
+    # end of workaround
+  done
+  echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+  if [ -f "$1" ]; then
+    echo "$(tr -s '\n' ' ' < "$1")"
+  fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+  exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Found .mvn/wrapper/maven-wrapper.jar"
+    fi
+else
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+    fi
+    if [ -n "$MVNW_REPOURL" ]; then
+      jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    else
+      jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    fi
+    while IFS="=" read key value; do
+      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+      esac
+    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Downloading from: $jarUrl"
+    fi
+    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+    if $cygwin; then
+      wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+    fi
+
+    if command -v wget > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found wget ... using wget"
+        fi
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            wget "$jarUrl" -O "$wrapperJarPath"
+        else
+            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
+        fi
+    elif command -v curl > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found curl ... using curl"
+        fi
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            curl -o "$wrapperJarPath" "$jarUrl" -f
+        else
+            curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+        fi
+
+    else
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Falling back to using Java to download"
+        fi
+        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+        # For Cygwin, switch paths to Windows format before running javac
+        if $cygwin; then
+          javaClass=`cygpath --path --windows "$javaClass"`
+        fi
+        if [ -e "$javaClass" ]; then
+            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+                if [ "$MVNW_VERBOSE" = true ]; then
+                  echo " - Compiling MavenWrapperDownloader.java ..."
+                fi
+                # Compiling the Java class
+                ("$JAVA_HOME/bin/javac" "$javaClass")
+            fi
+            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+                # Running the downloader
+                if [ "$MVNW_VERBOSE" = true ]; then
+                  echo " - Running MavenWrapperDownloader.java ..."
+                fi
+                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+            fi
+        fi
+    fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+  echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME=`cygpath --path --windows "$M2_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+  $MAVEN_OPTS \
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 182 - 0
mvnw.cmd

@@ -0,0 +1,182 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM    https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM     e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+
+FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+    IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Found %WRAPPER_JAR%
+    )
+) else (
+    if not "%MVNW_REPOURL%" == "" (
+        SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    )
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Couldn't find %WRAPPER_JAR%, downloading it ...
+        echo Downloading from: %DOWNLOAD_URL%
+    )
+
+    powershell -Command "&{"^
+		"$webclient = new-object System.Net.WebClient;"^
+		"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+		"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+		"}"^
+		"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+		"}"
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Finished downloading %WRAPPER_JAR%
+    )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%

+ 70 - 0
pom.xml

@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.4.3</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.example</groupId>
+    <artifactId>osservice</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>osservice</name>
+    <description>OS Playground</description>
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>net.sf.json-lib</groupId>
+            <artifactId>json-lib</artifactId>
+            <version>2.4</version>
+            <classifier>jdk15</classifier>
+        </dependency>
+        <dependency>
+            <groupId>com.vaadin.external.google</groupId>
+            <artifactId>android-json</artifactId>
+            <version>0.0.20131108.vaadin1</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

BIN
src/.DS_Store


+ 22 - 0
src/main/java/com/example/osservice/Controller/DeadlockController.java

@@ -0,0 +1,22 @@
+package com.example.osservice.Controller;
+
+import com.example.osservice.Service.Deadlock.DeadlockService;
+import com.example.osservice.VO.Response;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@CrossOrigin(origins = "*", maxAge = 3600)
+@RestController
+@RequestMapping("/deadlock")
+public class DeadlockController {
+    @Autowired
+    private DeadlockService deadlockService;
+
+    @GetMapping("/info")
+    public Response<String> info(){
+        return deadlockService.info();
+    }
+}

+ 37 - 0
src/main/java/com/example/osservice/Controller/LevelController.java

@@ -0,0 +1,37 @@
+package com.example.osservice.Controller;
+
+import com.example.osservice.Service.LevelService;
+import com.example.osservice.VO.Level;
+import com.example.osservice.VO.Response;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/api/level")
+public class LevelController {
+
+    @Autowired
+    private LevelService levelService;
+
+    @PostMapping("/")
+    public Response<Level> createLevel(@RequestBody long userId, @RequestBody long subjectId, @RequestBody String name, @RequestBody String description, @RequestBody List<String> questions){
+        return levelService.createLevel();
+    }
+
+    @PutMapping("/{levelId}")
+    public Response<Boolean> updateLevel(@PathVariable long levelId, @RequestBody long userId, @RequestBody long subjectId, @RequestBody String name, @RequestBody String description, @RequestBody List<String> questions){
+        return levelService.updateLevel();
+    }
+
+    @DeleteMapping("/{levelId}")
+    public Response<Boolean> deleteLevel(@PathVariable long levelId){
+        return levelService.deleteLevel();
+    }
+
+    @GetMapping("/{levelId}")
+    public Response<Boolean> getLevel(@PathVariable long levelId){
+        return levelService.getLevel();
+    }
+}

+ 28 - 0
src/main/java/com/example/osservice/Controller/PageController.java

@@ -0,0 +1,28 @@
+package com.example.osservice.Controller;
+
+import com.example.osservice.DTO.CodeParam;
+import com.example.osservice.PO.PageState;
+import com.example.osservice.Service.Page.PageService;
+import com.example.osservice.VO.Response;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@CrossOrigin(origins = "*", maxAge = 3600)
+@RestController
+@RequestMapping("/page")
+public class PageController {
+    @Autowired
+    private PageService pageService;
+
+    @GetMapping("/info")
+    public Response<String> info(){
+        return pageService.info();
+    }
+
+    @PostMapping("/pattern/code")
+    public Response<List<PageState>> patternCode(@RequestBody CodeParam codeParam){
+        return pageService.patternCode(codeParam);
+    }
+}

+ 41 - 0
src/main/java/com/example/osservice/Controller/ProcessController.java

@@ -0,0 +1,41 @@
+package com.example.osservice.Controller;
+
+import com.example.osservice.DTO.CodeParam;
+import com.example.osservice.DTO.PatternParam;
+import com.example.osservice.DTO.RenderParam;
+import com.example.osservice.PO.ProcessState;
+import com.example.osservice.Service.Process.ProcessService;
+import com.example.osservice.VO.Response;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@CrossOrigin(origins = "*", maxAge = 3600)
+@RestController
+@RequestMapping("/process")
+public class ProcessController {
+
+    @Autowired
+    private ProcessService processService;
+
+    @GetMapping("/info")
+    public Response<String> info(){
+        return processService.info();
+    }
+
+    @PostMapping("/pattern/table")
+    public Response<List<ProcessState>> patternTable(@RequestBody PatternParam patternParam){
+        return processService.patternTable(patternParam);
+    }
+
+    @PostMapping("/pattern/code")
+    public Response<List<ProcessState>> patternCode(@RequestBody CodeParam codeParam){
+        return processService.patternCode(codeParam);
+    }
+
+    @PostMapping("/render")
+    public Response<String> render(@RequestBody RenderParam renderParam){
+        return processService.render(renderParam);
+    }
+}

+ 48 - 0
src/main/java/com/example/osservice/Controller/SubjectController.java

@@ -0,0 +1,48 @@
+package com.example.osservice.Controller;
+
+import com.example.osservice.Service.SubjectService;
+import com.example.osservice.VO.Response;
+import com.example.osservice.VO.Subject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/api/subject")
+public class SubjectController {
+
+    @Autowired
+    private SubjectService subjectService;
+
+    @PostMapping("/")
+    public Response<Subject> createSubject(@RequestBody long userId, @RequestBody String name, @RequestBody String description){
+        return subjectService.createSubject();
+    }
+
+    @PutMapping("/{subjectId}")
+    public Response<Boolean> updateSubject(@PathVariable long subjectId,@RequestBody long userId, @RequestBody String name, @RequestBody String description){
+        return subjectService.updateSubject();
+    }
+
+    @DeleteMapping("/{subjectId}")
+    public Response<Boolean> deleteSubject(@PathVariable long subjectId){
+        return subjectService.deleteSubject();
+    }
+
+    @GetMapping("/{subjectId}")
+    public Response<Subject> getSubject(@PathVariable long subjectId){
+        return subjectService.getSubject();
+    }
+
+    @GetMapping("/list/{userId}")
+    public Response<List<Subject>> getSubjectsByUserId(@PathVariable long userId){
+        return subjectService.getSubjectsByUserId();
+    }
+
+    @GetMapping("/list")
+    public Response<List<Subject>> getAllSubjects(){
+        return subjectService.getAllSubjects();
+    }
+
+}

+ 33 - 0
src/main/java/com/example/osservice/DTO/CodeParam.java

@@ -0,0 +1,33 @@
+package com.example.osservice.DTO;
+
+import com.example.osservice.Util.SourceType;
+
+import java.util.List;
+
+public class CodeParam {
+
+    private SourceType type;
+
+    private List<String> data;
+
+    public CodeParam(SourceType type, List<String> data) {
+        this.type = type;
+        this.data = data;
+    }
+
+    public SourceType getType() {
+        return type;
+    }
+
+    public void setType(SourceType type) {
+        this.type = type;
+    }
+
+    public List<String> getData() {
+        return data;
+    }
+
+    public void setData(List<String> data) {
+        this.data = data;
+    }
+}

+ 43 - 0
src/main/java/com/example/osservice/DTO/PatternParam.java

@@ -0,0 +1,43 @@
+package com.example.osservice.DTO;
+
+import com.example.osservice.Util.SourceType;
+import com.example.osservice.Util.IRType;
+
+public class PatternParam {
+
+    private SourceType type;
+
+    private String data;
+
+    private IRType target;
+
+    public PatternParam(SourceType type, String data, IRType target) {
+        this.type = type;
+        this.data = data;
+        this.target = target;
+    }
+
+    public SourceType getType() {
+        return type;
+    }
+
+    public void setType(SourceType type) {
+        this.type = type;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    public IRType getTarget() {
+        return target;
+    }
+
+    public void setTarget(IRType target) {
+        this.target = target;
+    }
+}

+ 43 - 0
src/main/java/com/example/osservice/DTO/RenderParam.java

@@ -0,0 +1,43 @@
+package com.example.osservice.DTO;
+
+import com.example.osservice.Util.TargetType;
+import com.example.osservice.Util.IRType;
+
+public class RenderParam {
+
+    private IRType type;
+
+    private String data;
+
+    private TargetType target;
+
+    public RenderParam(IRType type, String data, TargetType target) {
+        this.type = type;
+        this.data = data;
+        this.target = target;
+    }
+
+    public IRType getType() {
+        return type;
+    }
+
+    public void setType(IRType type) {
+        this.type = type;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    public TargetType getTarget() {
+        return target;
+    }
+
+    public void setTarget(TargetType target) {
+        this.target = target;
+    }
+}

+ 14 - 0
src/main/java/com/example/osservice/OsserviceApplication.java

@@ -0,0 +1,14 @@
+package com.example.osservice;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+
+@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
+public class OsserviceApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(OsserviceApplication.class, args);
+    }
+
+}

+ 79 - 0
src/main/java/com/example/osservice/PO/OSProcess.java

@@ -0,0 +1,79 @@
+package com.example.osservice.PO;
+
+public class OSProcess implements Cloneable{
+    private int id;
+
+    private String name;
+
+    private int arrive;
+
+    private int total;
+
+    private int remain;
+
+    public OSProcess() {
+    }
+
+    public OSProcess(int id, String name, int arrive, int total, int remain) {
+        this.id = id;
+        this.name = name;
+        this.arrive = arrive;
+        this.total = total;
+        this.remain = remain;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getArrive() {
+        return arrive;
+    }
+
+    public void setArrive(int arrive) {
+        this.arrive = arrive;
+    }
+
+    public int getTotal() {
+        return total;
+    }
+
+    public void setTotal(int total) {
+        this.total = total;
+    }
+
+    public int getRemain() {
+        return remain;
+    }
+
+    public void setRemain(int remain) {
+        this.remain = remain;
+    }
+
+    @Override
+    public Object clone() {
+        OSProcess o = null;
+        try {
+            o = (OSProcess) super.clone();
+        } catch (CloneNotSupportedException e) {
+            e.printStackTrace();
+        }
+        return o;
+    }
+
+    public void show(){
+        System.out.println("{name: " + name + ", arrive: " + arrive + ", total: " + total + ", remain: " + remain + "}");
+    }
+}

+ 44 - 0
src/main/java/com/example/osservice/PO/OSProcessRunning.java

@@ -0,0 +1,44 @@
+package com.example.osservice.PO;
+
+public class OSProcessRunning extends OSProcess implements Cloneable{
+    private int length;
+
+    private int current;
+
+    public OSProcessRunning(OSProcess osProcess, int length, int current) {
+        super(osProcess.getId(), osProcess.getName(), osProcess.getArrive(), osProcess.getTotal(), osProcess.getRemain());
+        this.length = length;
+        this.current = current;
+    }
+
+    public int getLength() {
+        return length;
+    }
+
+    public void setLength(int length) {
+        this.length = length;
+    }
+
+    public int getCurrent() {
+        return current;
+    }
+
+    public void setCurrent(int current) {
+        this.current = current;
+    }
+
+    public OSProcess deteriorate(){
+        return new OSProcess(super.getId(), super.getName(), super.getArrive(), super.getTotal(), super.getRemain()-this.current);
+    }
+
+    public void show(){
+        System.out.println("{name: " + super.getName()
+                + ", arrive: " + super.getArrive()
+                + ", total: " + super.getTotal()
+                + ", remain: " + super.getRemain()
+                + ", length: " + length
+                + ", current: " + current
+                + "}");
+
+    }
+}

+ 64 - 0
src/main/java/com/example/osservice/PO/PageProcess.java

@@ -0,0 +1,64 @@
+package com.example.osservice.PO;
+
+public class PageProcess implements Cloneable {
+    private int id;
+
+    private String name;
+
+    private String tag1;
+
+    private String tag2;
+
+    public PageProcess() {
+    }
+
+    public PageProcess(int id, String name, String tag1, String tag2) {
+        this.id = id;
+        this.name = name;
+        this.tag1 = tag1;
+        this.tag2 = tag2;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getTag1() {
+        return tag1;
+    }
+
+    public void setTag1(String tag1) {
+        this.tag1 = tag1;
+    }
+
+    public String getTag2() {
+        return tag2;
+    }
+
+    public void setTag2(String tag2) {
+        this.tag2 = tag2;
+    }
+
+    @Override
+    public Object clone() {
+        PageProcess o = null;
+        try {
+            o = (PageProcess) super.clone();
+        } catch (CloneNotSupportedException e) {
+            e.printStackTrace();
+        }
+        return o;
+    }
+}

+ 69 - 0
src/main/java/com/example/osservice/PO/PageState.java

@@ -0,0 +1,69 @@
+package com.example.osservice.PO;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PageState {
+    private int time;
+
+    private PageProcess in;
+
+    private PageProcess out;
+
+    private List<PageProcess> stack = new ArrayList<>();
+
+    private boolean miss;
+
+    public PageState() {
+    }
+
+    public PageState(int time, PageProcess in, PageProcess out, List<PageProcess> stack, boolean miss) {
+        this.time = time;
+        this.in = in;
+        this.out = out;
+        for(PageProcess pageProcess: stack){
+            this.stack.add((PageProcess) pageProcess.clone());
+        }
+        this.miss = miss;
+    }
+
+    public int getTime() {
+        return time;
+    }
+
+    public void setTime(int time) {
+        this.time = time;
+    }
+
+    public PageProcess getIn() {
+        return in;
+    }
+
+    public void setIn(PageProcess in) {
+        this.in = in;
+    }
+
+    public PageProcess getOut() {
+        return out;
+    }
+
+    public void setOut(PageProcess out) {
+        this.out = out;
+    }
+
+    public List<PageProcess> getStack() {
+        return stack;
+    }
+
+    public void setStack(List<PageProcess> stack) {
+        this.stack = stack;
+    }
+
+    public boolean isMiss() {
+        return miss;
+    }
+
+    public void setMiss(boolean miss) {
+        this.miss = miss;
+    }
+}

+ 76 - 0
src/main/java/com/example/osservice/PO/ProcessState.java

@@ -0,0 +1,76 @@
+package com.example.osservice.PO;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ProcessState {
+    private int time;
+
+    private OSProcessRunning running;
+
+    private List<OSProcess> waiting = new ArrayList<>();
+
+    private List<OSProcess> done = new ArrayList<>();
+
+    public ProcessState() {
+    }
+
+    public ProcessState(int time, OSProcessRunning running, List<OSProcess> waiting, List<OSProcess> done) {
+        this.time = time;
+        this.running = running==null?null:(OSProcessRunning) running.clone();
+        for(OSProcess osProcess : waiting){
+            this.waiting.add((OSProcess) osProcess.clone());
+        }
+        for(OSProcess osProcess : done){
+            this.done.add((OSProcess) osProcess.clone());
+        }
+    }
+
+    public int getTime() {
+        return time;
+    }
+
+    public void setTime(int time) {
+        this.time = time;
+    }
+
+    public OSProcessRunning getRunning() {
+        return running;
+    }
+
+    public void setRunning(OSProcessRunning running) {
+        this.running = running;
+    }
+
+    public List<OSProcess> getWaiting() {
+        return waiting;
+    }
+
+    public void setWaiting(List<OSProcess> waiting) {
+        this.waiting = waiting;
+    }
+
+    public List<OSProcess> getDone() {
+        return done;
+    }
+
+    public void setDone(List<OSProcess> done) {
+        this.done = done;
+    }
+
+    public void show(){
+        System.out.println("time: " + time);
+        System.out.println("running: ");
+        if (running != null) {
+            running.show();
+        }
+        System.out.println("waiting: ");
+        for(OSProcess osProcess : waiting){
+            osProcess.show();
+        }
+        System.out.println("done: ");
+        for(OSProcess osProcess : done){
+            osProcess.show();
+        }
+    }
+}

+ 14 - 0
src/main/java/com/example/osservice/Service/Deadlock/DeadlockService.java

@@ -0,0 +1,14 @@
+package com.example.osservice.Service.Deadlock;
+
+import com.example.osservice.DTO.CodeParam;
+import com.example.osservice.PO.ProcessState;
+import com.example.osservice.VO.Response;
+
+import java.util.List;
+
+public interface DeadlockService {
+
+    Response<String> info();
+
+    Response<List<ProcessState>> patternCode(CodeParam codeParam);
+}

+ 29 - 0
src/main/java/com/example/osservice/Service/Deadlock/DeadlockServiceImp.java

@@ -0,0 +1,29 @@
+package com.example.osservice.Service.Deadlock;
+
+import com.example.osservice.DTO.CodeParam;
+import com.example.osservice.PO.ProcessState;
+import com.example.osservice.VO.Response;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class DeadlockServiceImp implements DeadlockService {
+
+    public Response<String> info(){
+        String info = "<strong style=\"font-size: 16px\">死锁</strong><br/>\n" +
+                "&#12288;&#12288;一组进程处于死锁状态指的是该组进程中的每一个进程都在等待被另一个进程所占有的、不能抢占的资源。其产生的原因不仅与系统拥有的资源数量有关,而且与资源分配策略,进程对资源的使用要求以及并发进程的推进顺序有关。<br/>\n" +
+                "<br/>\n" +
+                "<strong style=\"font-size: 16px\">死锁产生的四个必要条件</strong><br/>\n" +
+                "&#12288;&#12288;<strong>1. 互斥条件:</strong>系统中存在临界资源,进程应互斥地使用这些资源。<br/>\n" +
+                "&#12288;&#12288;<strong>2. 不剥夺条件:</strong>已被占用的资源只能由属主释放,不允许被其他进程剥夺。<br/>\n" +
+                "&#12288;&#12288;<strong>3. 占有和等待条件:</strong>在进程请求资源得不到满足而进入等待时,不会释放已经占有的资源。<br/>\n" +
+                "&#12288;&#12288;<strong>4. 循环等待条件:</strong>存在循环等待链,其中的每个进程都在链中等待下一个进程所持有的资源,造成这组进程永远等待。<br/>\n" +
+                "&#12288;&#12288;只要破坏上述四个条件中的任意一个就能防止死锁的发生。";
+        return new Response<>(200, "", info);
+    }
+
+    public Response<List<ProcessState>> patternCode(CodeParam codeParam){
+        return null;
+    }
+}

+ 24 - 0
src/main/java/com/example/osservice/Service/LevelService.java

@@ -0,0 +1,24 @@
+package com.example.osservice.Service;
+
+import com.example.osservice.VO.Level;
+import com.example.osservice.VO.Response;
+import org.springframework.stereotype.Service;
+
+@Service
+public class LevelService {
+    public Response<Level> createLevel(){
+        return null;
+    }
+
+    public Response<Boolean> updateLevel(){
+        return null;
+    }
+
+    public Response<Boolean> deleteLevel(){
+        return null;
+    }
+
+    public Response<Boolean> getLevel(){
+        return null;
+    }
+}

+ 14 - 0
src/main/java/com/example/osservice/Service/Page/PageService.java

@@ -0,0 +1,14 @@
+package com.example.osservice.Service.Page;
+
+import com.example.osservice.DTO.CodeParam;
+import com.example.osservice.PO.PageState;
+import com.example.osservice.VO.Response;
+
+import java.util.List;
+
+public interface PageService {
+
+    Response<String> info();
+
+    Response<List<PageState>> patternCode(CodeParam codeParam);
+}

+ 315 - 0
src/main/java/com/example/osservice/Service/Page/PageServiceImp.java

@@ -0,0 +1,315 @@
+package com.example.osservice.Service.Page;
+
+import com.example.osservice.DTO.CodeParam;
+import com.example.osservice.PO.PageProcess;
+import com.example.osservice.PO.PageState;
+import com.example.osservice.Util.SourceType;
+import com.example.osservice.VO.Response;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class PageServiceImp implements PageService {
+
+    public Response<String> info(){
+        String info = "<strong style=\"font-size: 16px\">页缺失</strong><br/>\n" +
+                "&#12288;&#12288;页缺失指的是当软件试图访问已映射在虚拟地址空间中、但目前并未被加载在物理内存中的一个分页时,由中央处理器的内存管理单元所发出的中断。 通常情况下,用于处理此中断的程序是操作系统的一部分。如果操作系统判断此次访问是有效的,那么操作系统会尝试将相关的分页从硬盘上的虚拟内存文件中调入内存。而如果访问是不被允许的,那么操作系统通常会结束相关的进程。<br/>\n" +
+                "<br/>\n" +
+                "<strong style=\"font-size: 16px\">页面调度算法</strong><br/>\n" +
+                "&#12288;&#12288;<strong>1. 最佳⻚⾯替换算法(OPT):</strong>当要调⼊新⻚⾯时,⾸先淘汰以后不再访问的⻚,然后选择淘汰距现在最⻓时间后再访问的⻚。但在实际情况下由于后续进程序列不可确定,该算法只可模拟,不可实现。<br/>\n" +
+                "&#12288;&#12288;<strong>2. 先进先出⻚⾯替换算法(FIFO):</strong>总是淘汰最先调⼊主存的那⼀⻚,或者说主存驻留时间最⻓的那⼀⻚,括号内表示停留时间。<br/>\n" +
+                "&#12288;&#12288;<strong>3. 最近最少使⽤⻚⾯调度算法(LRU):</strong>FIFO的改进版本,可以理解为⼀种栈的形式。每当有⼀个新⻚⾯,若⻚框够⼤,就继续压栈;若在栈中,则将其移动到栈顶;否则将新⻚⾯加⼊到栈顶,栈底元素被移除。<br/>\n" +
+                "&#12288;&#12288;<strong>4. 最不常⽤⻚⾯调度算法(LFU):</strong>淘汰最近⼀段时间内访问次数最少的页⾯,同时也使⽤了栈的思想,括号内表示近期使⽤次数。<br/>\n" +
+                "&#12288;&#12288;<strong>5. 第二次机会页面替换算法(SCR):</strong>FIFO的改进版本,目的是避免FIFO算法将重要的页换出。算法的思想是先检查FIFO页面队列中的队首,如果其\"引用位\"为0,把该页面淘汰;如果其\"引用位\"为1,将其\"引用位\"清0,并把这个页面移至队尾。如果所有的页面\"引用位\"均为1,则先把所有页面的\"引用位\"清0,再找出队首,将其淘汰。括号内表示\"引用位\",*表示队首。<br/>\n";
+        return new Response<>(200, "", info);
+    }
+
+    public Response<List<PageState>> patternCode(CodeParam codeParam){
+        List<String> data = codeParam.getData(); // 0为引用串,1为页框大小长度,2之后为填空
+
+        String blank = data.get(2).replace(" ", "");
+        if(codeParam.getType() == SourceType.LRU){
+            if(!blank.equals("stack.add(0,in);")){
+                return new Response<>(500, "请参考list添加元素至第一位的方法", null);
+            }
+        }else if(codeParam.getType() == SourceType.LFU) {
+            if(!blank.equals("stacks.get(0).add(in);")){
+                return new Response<>(500, "请参考list添加元素的方法", null);
+            }
+        }else {
+            if(!blank.equals("stack.add(in);") && !blank.equals("stack.add(stack.size(),in);")){
+                return new Response<>(500, "请参考list添加元素的方法", null);
+            }
+        }
+
+        List<PageProcess> list = new ArrayList<>();
+        String processStr = data.get(0);
+        String[] processes = processStr.split(",");
+        for(String name: processes){
+            list.add(new PageProcess(Integer.parseInt(name.replace("P", "")), name, "", ""));
+        }
+        int size = Integer.parseInt(data.get(1));
+
+        List<PageState> result;
+        if(codeParam.getType() == SourceType.OPT){
+            result = OPTFunc(list, size);
+        }else if(codeParam.getType() == SourceType.FIFO){
+            result = FIFOFunc(list, size);
+        }else if(codeParam.getType() == SourceType.LRU){
+            result = LRUFunc(list, size);
+        }else if(codeParam.getType() == SourceType.LFU){
+            result = LFUFunc(list, size);
+        }else if(codeParam.getType() == SourceType.SCR){
+            result = SCRFunc(list, size);
+        }else {
+            result = null;
+        }
+        return new Response<>(200, "", result);
+    }
+
+    public List<PageState> OPTFunc (List<PageProcess> processes, int size){
+        List<PageState> states = new ArrayList<>();
+        states.add(new PageState(0, null, null, new ArrayList<>(), true));
+        List<PageProcess> stack = new ArrayList<>();
+        int time = 1;
+
+        while (processes.size() != 0) {
+            PageProcess in = (PageProcess) processes.get(0).clone();
+            processes.remove(0);
+            int index = find(stack, in);
+            if (index != -1) {
+                states.add(new PageState(time, in, null, stack, false));
+            } else if (stack.size() < size) {
+                stack.add(in);
+                states.add(new PageState(time, in, null, stack, true));
+            } else {
+                int[] opt = {100, 100, 100, 100, 100};
+                for (int i = processes.size(); i > 0; i--) {
+                    opt[processes.get(i - 1).getId() - 1] = i - 1;
+                }
+                int max = 0;// 最长时间访问页
+                int maxIndex = 0;
+                for (int i = 0; i < stack.size(); i++) {
+                    if (opt[stack.get(i).getId() - 1] > max) {
+                        max = opt[stack.get(i).getId() - 1];
+                        maxIndex = i;
+                    }
+                }
+                PageProcess out = (PageProcess) stack.get(maxIndex).clone();
+                stack.set(maxIndex, in);
+                states.add(new PageState(time, in, out, stack, true));
+            }
+            time += 1;
+        }
+        return states;
+    }
+
+    public List<PageState> FIFOFunc (List<PageProcess> processes, int size){
+        List<PageState> states = new ArrayList<>();
+        states.add(new PageState(0, null, null, new ArrayList<>(), true));
+        List<PageProcess> stack = new ArrayList<>();
+        int time = 1;
+
+        while (processes.size() != 0) {
+            PageProcess in = (PageProcess) processes.get(0).clone();
+            processes.remove(0);
+            int index = find(stack, in);
+            for(PageProcess pageProcess: stack){
+                pageProcess.setTag1("" + (Integer.parseInt(pageProcess.getTag1())+1));
+            }
+            if (index != -1) {
+                states.add(new PageState(time, in, null, stack, false));
+            } else if (stack.size() < size) {
+                in.setTag1("0");
+                stack.add(in);
+                states.add(new PageState(time, in, null, stack, true));
+            } else {
+                String max = "0";// 最长时间访问页
+                int maxIndex = 0;
+                for (int i = 0; i < stack.size(); i++) {
+                    if (stack.get(i).getTag1().compareTo(max) > 0) {
+                        max = stack.get(i).getTag1();
+                        maxIndex = i;
+                    }
+                }
+                PageProcess out = (PageProcess) stack.get(maxIndex).clone();
+                in.setTag1("0");
+                stack.set(maxIndex, in);
+                states.add(new PageState(time, in, out, stack, true));
+            }
+            time += 1;
+        }
+        return states;
+    }
+
+    public List<PageState> LRUFunc (List<PageProcess> processes, int size){
+        List<PageState> states = new ArrayList<>();
+        states.add(new PageState(0, null, null, new ArrayList<>(), true));
+        List<PageProcess> stack = new ArrayList<>();
+        int time = 1;
+
+        while (processes.size() != 0) {
+            PageProcess in = (PageProcess) processes.get(0).clone();
+            processes.remove(0);
+            int index = find(stack, in);
+            if (index != -1) {
+                PageProcess process = (PageProcess)stack.get(index).clone();
+                stack.remove(index);
+                stack.add(0, process);
+                states.add(new PageState(time, in, null, stack, false));
+            } else if (stack.size() < size) {
+                stack.add(0, in);
+                states.add(new PageState(time, in, null, stack, true));
+            } else {
+                PageProcess out = (PageProcess) stack.get(stack.size() - 1).clone();
+                stack.remove(stack.size() - 1);
+                stack.add(0, in);
+                states.add(new PageState(time, in, out, stack, true));
+            }
+            time += 1;
+        }
+        return states;
+    }
+
+    public List<PageState> LFUFunc (List<PageProcess> processes, int size){
+        List<PageState> states = new ArrayList<>();
+        states.add(new PageState(0, null, null, new ArrayList<>(), true));
+        List<List<PageProcess>> stacks = new ArrayList<>();
+        int time = 1;
+        int count = 0;
+
+        while (processes.size() != 0) {
+            PageProcess in = (PageProcess) processes.get(0).clone();
+            processes.remove(0);
+            int index = -1;
+            int appear = 0;
+            for(int i = 0; i < stacks.size(); i++){
+                int j = find(stacks.get(i), in);
+                if(j != -1){
+                    index = j;
+                    appear = i;
+                    break;
+                }
+            }
+            if (index != -1) {
+                PageProcess process = (PageProcess)stacks.get(appear).get(index).clone();
+                stacks.get(appear).remove(index);
+                if(appear + 1 == stacks.size()){
+                    stacks.add(new ArrayList<>());
+                }
+                process.setTag1("" + (appear + 2));
+                stacks.get(appear+1).add(process);
+                states.add(new PageState(time, in, null, toStack(stacks), false));
+            } else if (count < size) {
+                if(count == 0){
+                    stacks.add(new ArrayList<>());
+                }
+                in.setTag1("1");
+                stacks.get(0).add(in);
+                count += 1;
+                states.add(new PageState(time, in, null, toStack(stacks), true));
+            } else {
+                PageProcess out = null;
+                for(int i = 0; i < stacks.size(); i++){
+                    if(stacks.get(i).size() != 0){
+                        out = (PageProcess) stacks.get(i).get(0).clone();
+                        stacks.get(i).remove(0);
+                        break;
+                    }
+                }
+                in.setTag1("1");
+                stacks.get(0).add(in);
+                states.add(new PageState(time, in, out, toStack(stacks), true));
+            }
+            time += 1;
+        }
+        return states;
+    }
+
+    public List<PageState> SCRFunc (List<PageProcess> processes, int size){
+        List<PageState> states = new ArrayList<>();
+        states.add(new PageState(0, null, null, new ArrayList<>(), true));
+        List<PageProcess> stack = new ArrayList<>();
+        int time = 1;
+        int head = 0;
+
+        while (processes.size() != 0) {
+            PageProcess in = (PageProcess) processes.get(0).clone();
+            processes.remove(0);
+            int index = find(stack, in);
+            if (index != -1) {
+                stack.get(index).setTag1("1");
+                states.add(new PageState(time, in, null, stack, false));
+            } else if (stack.size() < size) {
+                if(stack.size() == 0){
+                    in.setTag2("*");
+                }
+                in.setTag1("1");
+                stack.add(in);
+                states.add(new PageState(time, in, null, stack, true));
+            } else {
+                boolean isAll1 = true;
+                for(PageProcess pageProcess: stack){
+                    if(!pageProcess.getTag1().equals("1")){
+                        isAll1 = false;
+                        break;
+                    }
+                }
+                int outIndex = -1;
+                if(isAll1){
+                    for(PageProcess pageProcess: stack){
+                        pageProcess.setTag1("0");
+                    }
+                    outIndex = head;
+                }else{
+                    for(int i = head; i < stack.size(); i++){
+                        if(stack.get(i).getTag1().equals("1")){
+                            stack.get(i).setTag1("0");
+                        }else{
+                            outIndex = i;
+                            break;
+                        }
+                    }
+                    if(outIndex == -1){
+                        for(int i = 0; i < head; i++){
+                            if(stack.get(i).getTag1().equals("1")){
+                                stack.get(i).setTag1("0");
+                            }else{
+                                outIndex = i;
+                                break;
+                            }
+                        }
+                    }
+                }
+                PageProcess out = (PageProcess) stack.get(outIndex).clone();
+                in.setTag1("1");
+                stack.set(outIndex, in);
+                stack.get(head).setTag2("");
+                head = outIndex == stack.size() - 1 ? 0 : outIndex + 1;
+                stack.get(head).setTag2("*");
+                states.add(new PageState(time, in, out, stack, true));
+            }
+            time += 1;
+        }
+        return states;
+    }
+
+    private int find(List<PageProcess> processes, PageProcess process){
+        for(int i = 0; i < processes.size(); i++){
+            if(processes.get(i).getId() == process.getId() && processes.get(i).getName().equals(process.getName())){
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    private List<PageProcess> toStack(List<List<PageProcess>> stacks){
+        List<PageProcess> res = new ArrayList<>();
+        for(int i = stacks.size() - 1;i >= 0; i--){
+            res.addAll(stacks.get(i));
+        }
+        return res;
+    }
+}

+ 20 - 0
src/main/java/com/example/osservice/Service/Process/ProcessService.java

@@ -0,0 +1,20 @@
+package com.example.osservice.Service.Process;
+
+import com.example.osservice.DTO.CodeParam;
+import com.example.osservice.DTO.PatternParam;
+import com.example.osservice.DTO.RenderParam;
+import com.example.osservice.PO.ProcessState;
+import com.example.osservice.VO.Response;
+
+import java.util.List;
+
+public interface ProcessService {
+
+    Response<String> info();
+
+    Response<List<ProcessState>> patternTable(PatternParam patternParam);
+
+    Response<List<ProcessState>> patternCode(CodeParam codeParam);
+
+    Response<String> render(RenderParam renderParam);
+}

+ 456 - 0
src/main/java/com/example/osservice/Service/Process/ProcessServiceImp.java

@@ -0,0 +1,456 @@
+package com.example.osservice.Service.Process;
+
+import com.example.osservice.DTO.CodeParam;
+import com.example.osservice.DTO.PatternParam;
+import com.example.osservice.DTO.RenderParam;
+import com.example.osservice.PO.*;
+import com.example.osservice.Util.SourceType;
+import com.example.osservice.VO.Response;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.springframework.stereotype.Service;
+
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+@Service
+public class ProcessServiceImp implements ProcessService {
+
+    public Response<String> info(){
+        String info = "<strong style=\"font-size: 16px\">处理机调度</strong><br/>\n" +
+                "&#12288;&#12288;在多道程序设计系统中,内存中有多道程序运行,他们相互争夺处理机这一重要的资源。处理机调度就是从就绪队列中,按照一定的算法选择一个进程并将处理机分配给它运行,以实现进程并发地执行。<br/>\n" +
+                "<br/>\n" +
+                "<strong style=\"font-size: 16px\">选择处理机调度算法的原则</strong><br/>\n" +
+                "&#12288;&#12288;<strong>1. 资源利用率:</strong>使得CPU或其他资源的使用率尽可能高且能够并行工作。<br/>\n" +
+                "&#12288;&#12288;<strong>2. 响应时间:</strong>使交互式用户的响应时间尽可能小,或尽快处理实时任务。<br/>\n" +
+                "&#12288;&#12288;<strong>3. 周转时间:</strong>提交给系统开始到执行完成获得结果为止的这段时间间隔称周转时间,应该使周转时间或平均周转时间尽可能短。<br/>\n" +
+                "&#12288;&#12288;<strong>4. 吞吐量:</strong>单位时间处理的进程数尽可能多。<br/>\n" +
+                "&#12288;&#12288;<strong>5. 公平性:</strong>确保每个用户每个进程获得合理的CPU份额或其他资源份额。<br/>\n" +
+                "<br/>\n" +
+                "<strong style=\"font-size: 16px\">处理机调度算法</strong><br/>\n" +
+                "&#12288;&#12288;<strong>1. 先来先服务(FCFS):</strong>是一种非抢占式的调度算法,每当有进程就绪时,都加入就绪队列,当前正在运行的进程结束执行时,选择在就绪队列中存在时间最长的进程运行。<br/>\n" +
+                "&#12288;&#12288;<strong>2. 时间片轮转(RR):</strong>基于时钟的抢占式调度算法,以一个周期性间隔产生时钟中断,当中断发生时,当前正在运行的进程被置于就绪队列中,然后基于FCFS算法选择下一个就绪进程进行。<br/>\n" +
+                "&#12288;&#12288;<strong>3. 最短进程优先(SPN): </strong>是一种非抢占式调度算法,选择所需处理时间最短的进程,短进程将会越过长进程,优先获得调度。<br/>\n" +
+                "&#12288;&#12288;<strong>4. 最短剩余时间优先(SRT):</strong>是一种抢占式调度算法,调度器总是选择预期剩余时间更短的进程,当一个新进程加入就绪队列,可能比当前运行的进程具有更短的剩余时间,调度器就可能抢占当前正在运行的进程。<br/>\n" +
+                "&#12288;&#12288;<strong>5. 最高响应比优先(HRRN):</strong>是一种非抢占式的调度算法,按照如下公式选择响应比最高的进程。<br/>\n" +
+                "&#12288;&#12288;&#12288;响应比 = (等待时间 + 期待服务时间) / 期待服务时间";
+        return new Response<>(200, "", info);
+    }
+
+    public Response<List<ProcessState>> patternTable(PatternParam patternParam){
+        List<OSProcess> list = new ArrayList<>();
+        try{
+            JSONArray jsonArray = new JSONArray(patternParam.getData());
+            for(int i = 0; i < jsonArray.length();i++){
+                JSONObject jsonObject2 = jsonArray.getJSONObject(i);
+                OSProcess osProcess = new OSProcess(i+1, jsonObject2.getString("name"), jsonObject2.getInt("arrive"), jsonObject2.getInt("total"), jsonObject2.getInt("total"));
+                list.add(osProcess);
+            }
+        } catch (Exception e){
+            System.out.println(e);
+            return new Response<>(500, "进程解析失败", null);
+        }
+        list.sort(Comparator.comparingInt(OSProcess::getArrive));
+
+        List<ProcessState> result;
+        if(patternParam.getType() == SourceType.FCFS){
+            result = FCFSFunc(list);
+        }else if(patternParam.getType() == SourceType.RR){
+            result = RRFunc(list);
+        }else if(patternParam.getType() == SourceType.SPN){
+            result = SPNFunc(list);
+        }else if(patternParam.getType() == SourceType.SRT){
+            result = SRTFunc(list);
+        }else if(patternParam.getType() == SourceType.HRRN){
+            result = HRRNFunc(list);
+        }else if(patternParam.getType() == SourceType.Feedback){
+            result = FeedbackFunc(list);
+        }else {
+            result = null;
+        }
+        return new Response<>(200, "成功", result);
+    }
+
+    public Response<String> render(RenderParam renderParam){
+        return null;
+    }
+
+    public List<ProcessState> FCFSFunc(List<OSProcess> processes){
+        List<OSProcess> wait = new ArrayList<>();
+        List<OSProcess> done = new ArrayList<>();
+        OSProcessRunning running = null;
+
+        int time = 0;
+        List<ProcessState> states = new ArrayList<>();
+        while (true){
+            //准备阶段
+            if(processes.size() == 0){
+                states.add(new ProcessState(time, running, wait, done));
+                break;
+            }else{
+                for(OSProcess osProcess : processes){
+                    if(osProcess.getArrive() == time){
+                        wait.add((OSProcess) osProcess.clone());
+                    }
+                }
+                states.add(new ProcessState(time, running, wait, done));
+            }
+
+            //运行阶段
+            if(running==null){
+                if(wait.size()>0){
+                    OSProcess next = wait.get(0);
+                    running = new OSProcessRunning(next, next.getTotal(), 1);
+                    wait.remove(0);
+                }
+            }
+            else if(running.getCurrent()!=running.getLength()){
+                running.setCurrent(running.getCurrent()+1);
+            }
+            else if(running.getCurrent()==running.getLength()){
+                OSProcess now = running.deteriorate();
+                done.add(now);
+                for(int i = processes.size()-1; i >= 0 ; i--){
+                    if(processes.get(i).getName().equals(now.getName())){
+                        processes.remove(i);
+                    }
+                }
+                if(wait.size()>0){
+                    OSProcess next = wait.get(0);
+                    running = new OSProcessRunning(next, next.getTotal(), 1);
+                    wait.remove(0);
+                }else{
+                    running = null;
+                }
+            }
+            time += 1;
+        }
+        return states;
+    }
+
+    public List<ProcessState> RRFunc(List<OSProcess> processes){
+        List<OSProcess> wait = new ArrayList<>();
+        List<OSProcess> done = new ArrayList<>();
+        OSProcessRunning running = null;
+        int RRLength = 4;
+
+        int time = 0;
+        List<ProcessState> states = new ArrayList<>();
+        while (true){
+            //准备阶段
+            if(processes.size() == 0){
+                states.add(new ProcessState(time, running, wait, done));
+                break;
+            }else{
+                for(OSProcess osProcess : processes){
+                    if(osProcess.getArrive() == time){
+                        wait.add((OSProcess) osProcess.clone());
+                    }
+                }
+                states.add(new ProcessState(time, running, wait, done));
+            }
+
+            //运行阶段
+            if(running == null){
+                if(wait.size()>0){
+                    OSProcess next = wait.get(0);
+                    running = new OSProcessRunning(next, Math.min(next.getRemain(), RRLength), 1);
+                    wait.remove(0);
+                }
+            }
+            else if(running.getCurrent() != running.getLength()){
+                running.setCurrent(running.getCurrent()+1);
+            }else if(running.getCurrent() == running.getLength()){
+                OSProcess now = running.deteriorate();
+                if(now.getRemain() == 0){
+                    done.add(now);
+                    for(int i = processes.size()-1; i >= 0 ; i--){
+                        if(processes.get(i).getName().equals(now.getName())){
+                            processes.remove(i);
+                        }
+                    }
+                }else {
+                    wait.add(now);
+                }
+                if(wait.size()>0){
+                    OSProcess next = wait.get(0);
+                    running = new OSProcessRunning(next, Math.min(next.getRemain(), RRLength), 1);
+                    wait.remove(0);
+                }else{
+                    running = null;
+                }
+            }
+            time += 1;
+        }
+        return states;
+    }
+
+    public List<ProcessState> SPNFunc(List<OSProcess> processes){
+        List<OSProcess> wait = new ArrayList<>();
+        List<OSProcess> done = new ArrayList<>();
+        OSProcessRunning running = null;
+
+        int time = 0;
+        List<ProcessState> states = new ArrayList<>();
+        while (true){
+            //准备阶段
+            if(processes.size() == 0){
+                states.add(new ProcessState(time, running, wait, done));
+                break;
+            }else{
+                for(OSProcess osProcess : processes){
+                    if(osProcess.getArrive() == time){
+                        wait.add((OSProcess) osProcess.clone());
+                    }
+                }
+                states.add(new ProcessState(time, running, wait, done));
+            }
+
+            //运行阶段
+            if(running==null){
+                if(wait.size()>0){
+                    int index = getShortestProcess(wait);
+                    running = new OSProcessRunning(wait.get(index), wait.get(index).getTotal(), 1);
+                    wait.remove(index);
+                }
+            }
+            else if(running.getCurrent()!=running.getLength()){
+                running.setCurrent(running.getCurrent()+1);
+            }else if(running.getCurrent()==running.getLength()){
+                OSProcess now = running.deteriorate();
+                done.add(now);
+                for(int i = processes.size()-1; i >= 0 ; i--){
+                    if(processes.get(i).getName().equals(now.getName())){
+                        processes.remove(i);
+                    }
+                }
+                if(wait.size()>0){
+                    int index = getShortestProcess(wait);
+                    running = new OSProcessRunning(wait.get(index), wait.get(index).getTotal(), 1);
+                    wait.remove(index);
+                }else{
+                    running = null;
+                }
+            }
+            time += 1;
+        }
+        return states;
+    }
+
+    private int getShortestProcess(List<OSProcess> processes){
+        int minIndex = 0;
+        int minRemain = processes.get(0).getRemain();
+        for(int i = 1;i < processes.size();i++){
+            int currentRemain = processes.get(i).getRemain();
+            if(currentRemain < minRemain){
+                minIndex = i;
+                minRemain = currentRemain;
+            }
+        }
+        return minIndex;
+    }
+
+    public List<ProcessState> SRTFunc(List<OSProcess> processes){
+        List<OSProcess> wait = new ArrayList<>();
+        List<OSProcess> done = new ArrayList<>();
+        OSProcessRunning running = null;
+
+        int time = 0;
+        List<ProcessState> states = new ArrayList<>();
+        while (true){
+            //准备阶段
+            boolean hasNew = false;
+            if(processes.size() == 0){
+                states.add(new ProcessState(time, running, wait, done));
+                break;
+            }else{
+                for(OSProcess osProcess : processes){
+                    if(osProcess.getArrive() == time){
+                        wait.add((OSProcess) osProcess.clone());
+                        hasNew = true;
+                    }
+                }
+                states.add(new ProcessState(time, running, wait, done));
+            }
+
+            //运行阶段
+            if(running==null){
+                if(wait.size()>0){
+                    int index = getShortestRemainProcess(wait, null);
+                    running = new OSProcessRunning(wait.get(index), wait.get(index).getRemain(), 1);
+                    wait.remove(index);
+                }
+            }
+            else if(hasNew&&running.getCurrent()!=running.getLength()){
+                int index = getShortestRemainProcess(wait, running);
+                if(index == -1){
+                    running.setCurrent(running.getCurrent()+1);
+                }else {
+                    OSProcess now = running.deteriorate();
+                    running = new OSProcessRunning(wait.get(index), wait.get(index).getRemain(), 1);
+                    wait.remove(index);
+                    wait.add(now);
+                }
+            } else if(running.getCurrent()!=running.getLength()){
+                running.setCurrent(running.getCurrent()+1);
+            }else if(running.getCurrent()==running.getLength()){
+                OSProcess now = running.deteriorate();
+                done.add(now);
+                for(int i = processes.size()-1; i >= 0 ; i--){
+                    if(processes.get(i).getName().equals(now.getName())){
+                        processes.remove(i);
+                    }
+                }
+                if(wait.size()>0){
+                    int index = getShortestRemainProcess(wait, null);
+                    running = new OSProcessRunning(wait.get(index), wait.get(index).getRemain(), 1);
+                    wait.remove(index);
+                }else{
+                    running = null;
+                }
+            }
+            time += 1;
+        }
+        return states;
+    }
+
+    private int getShortestRemainProcess(List<OSProcess> processes, OSProcessRunning running){
+        int minIndex = 0;
+        int minRemain = processes.get(0).getRemain();
+        for(int i = 1;i < processes.size();i++){
+            if(processes.get(i).getRemain()<minRemain){
+                minIndex = i;
+                minRemain = processes.get(i).getRemain();
+            }
+        }
+        if(running==null||minRemain<running.getRemain()-running.getCurrent()){
+            return minIndex;
+        }else {
+            return -1;
+        }
+    }
+
+    public List<ProcessState> HRRNFunc(List<OSProcess> processes){
+        List<OSProcess> wait = new ArrayList<>();
+        List<OSProcess> done = new ArrayList<>();
+        OSProcessRunning running = null;
+
+        int time = 0;
+        List<ProcessState> states = new ArrayList<>();
+        while (true){
+            //准备阶段
+            if(processes.size() == 0){
+                states.add(new ProcessState(time, running, wait, done));
+                break;
+            }else{
+                for(OSProcess osProcess : processes){
+                    if(osProcess.getArrive() == time){
+                        wait.add((OSProcess) osProcess.clone());
+                    }
+                }
+                states.add(new ProcessState(time, running, wait, done));
+            }
+
+            //运行阶段
+            if(running==null){
+                if(wait.size()>0){
+                    int index = getHighestHRRNProcess(wait, time);
+                    running = new OSProcessRunning(wait.get(index), wait.get(index).getTotal(), 1);
+                    wait.remove(index);
+                }
+            }
+            else if(running.getCurrent()!=running.getLength()){
+                running.setCurrent(running.getCurrent()+1);
+            }else if(running.getCurrent()==running.getLength()){
+                OSProcess now = running.deteriorate();
+                done.add(now);
+                for(int i = processes.size()-1; i >= 0 ; i--){
+                    if(processes.get(i).getName().equals(now.getName())){
+                        processes.remove(i);
+                    }
+                }
+                if(wait.size()>0){
+                    int index = getHighestHRRNProcess(wait, time);
+                    running = new OSProcessRunning(wait.get(index), wait.get(index).getTotal(), 1);
+                    wait.remove(index);
+                }else{
+                    running = null;
+                }
+            }
+            time += 1;
+        }
+        return states;
+    }
+
+    private int getHighestHRRNProcess(List<OSProcess> processes, int time){
+        int highestIndex = 0;
+        double highestHRRN = (double) (time - processes.get(0).getArrive() + processes.get(0).getTotal())/processes.get(0).getTotal();
+        for(int i = 0;i < processes.size();i++){
+            double currentHRRN = (double) (time - processes.get(i).getArrive() + processes.get(i).getTotal())/processes.get(i).getTotal();
+            if(currentHRRN > highestHRRN){
+                highestIndex = i;
+                highestHRRN = currentHRRN;
+            }
+        }
+        return highestIndex;
+    }
+
+    public Response<List<ProcessState>> patternCode(CodeParam codeParam){
+        int grade = 0;
+        String info = "";
+        List<String> blanks = codeParam.getData();
+        String blank1 = blanks.get(0).replace(" ", "");
+        if(codeParam.getType() == SourceType.FCFS || codeParam.getType() == SourceType.RR){
+            if(!"wait.remove(0);".equals(blank1) && !"wait.pop();".equals(blank1)){
+                grade += 1;
+                info += " 1.请参考list删除元素的方法";
+            }
+        } else{
+            if(!"wait.remove(index);".equals(blank1)){
+                grade += 1;
+                info += " 1.请参考list删除元素的方法";
+            }
+        }
+        String blank2 = blanks.get(1).replace(" ", "");
+        if(!"running.setCurrent(running.getCurrent()+1);".equals(blank2)){
+            grade +=2;
+            if(blank2.contains(".current")){
+                info += info.equals("")?" ":"\n2."+"成员变量current为私有成员变量,不可直接访问";
+            }else{
+                info += info.equals("")?" ":"\n2."+"参考Process.java中对current成员变量的操作";
+            }
+        }
+
+        List<ProcessState> result;
+        if(grade > 0){
+            return new Response<>(500, "" + grade + info, null);
+        }
+
+        List<OSProcess> list = new ArrayList<>();
+        list.add(new OSProcess(1, "A", 0 ,4, 4));
+        list.add(new OSProcess(2, "B", 1 ,5, 5));
+        list.add(new OSProcess(3, "C", 1 ,2, 2));
+        if(codeParam.getType() == SourceType.FCFS){
+            result = FCFSFunc(list);
+        }else if(codeParam.getType() == SourceType.RR){
+            result = RRFunc(list);
+        }else if(codeParam.getType() == SourceType.SPN){
+            result = SPNFunc(list);
+        }else if(codeParam.getType() == SourceType.SRT){
+            result = SRTFunc(list);
+        }else if(codeParam.getType() == SourceType.HRRN){
+            result = HRRNFunc(list);
+        }else if(codeParam.getType() == SourceType.Feedback){
+            result = FeedbackFunc(list);
+        }else {
+            result = null;
+        }
+        return new Response<>(200, "成功", result);
+    }
+
+    public List<ProcessState> FeedbackFunc(List<OSProcess> processes){
+        return null;
+    }
+}

+ 34 - 0
src/main/java/com/example/osservice/Service/SubjectService.java

@@ -0,0 +1,34 @@
+package com.example.osservice.Service;
+
+import org.springframework.stereotype.Service;
+import com.example.osservice.VO.Response;
+import com.example.osservice.VO.Subject;
+
+import java.util.List;
+
+@Service
+public class SubjectService {
+    public Response<Subject> createSubject() {
+        return null;
+    }
+
+    public Response<Boolean> updateSubject(){
+        return null;
+    }
+
+    public Response<Boolean> deleteSubject(){
+        return null;
+    }
+
+    public Response<Subject> getSubject(){
+        return null;
+    }
+
+    public Response<List<Subject>> getSubjectsByUserId(){
+        return null;
+    }
+
+    public Response<List<Subject>> getAllSubjects(){
+        return null;
+    }
+}

+ 27 - 0
src/main/java/com/example/osservice/Util/IRType.java

@@ -0,0 +1,27 @@
+package com.example.osservice.Util;
+
+public enum IRType implements Type {
+
+    FCFS("处理机调度算法"),
+    RR("时间片轮转算法"),
+    SPN("最短进程优先算法"),
+    SRT("最短剩余时间优先算法"),
+    HRRN("最高响应比优先算法"),
+    Feedback("多级反馈序列算法");
+
+    private String label;
+
+    IRType(String label) {
+        this.label = label;
+    }
+
+    @Override
+    public String getLabel(){
+        return label;
+    }
+
+    @Override
+    public String getInitCode(){
+        return null;
+    }
+}

+ 33 - 0
src/main/java/com/example/osservice/Util/SourceType.java

@@ -0,0 +1,33 @@
+package com.example.osservice.Util;
+
+public enum SourceType implements Type {
+
+    FCFS ("处理机调度算法"),
+    RR ("时间片轮转算法"),
+    SPN ("最短进程优先算法"),
+    SRT ("最短剩余时间优先算法"),
+    HRRN ("最高响应比优先算法"),
+    Feedback ("多级反馈序列算法"),
+
+    OPT ("最佳⻚⾯替换算法"),
+    FIFO ("先进先出⻚⾯替换算法"),
+    LRU ("最近最少使⽤⻚⾯调度算法"),
+    LFU ("最不常⽤⻚⾯调度算法"),
+    SCR ("第二次机会页面替换算法");
+
+    private String label;
+
+    SourceType(String label) {
+        this.label = label;
+    }
+
+    @Override
+    public String getLabel(){
+        return label;
+    }
+
+    @Override
+    public String getInitCode(){
+        return null;
+    }
+}

+ 27 - 0
src/main/java/com/example/osservice/Util/TargetType.java

@@ -0,0 +1,27 @@
+package com.example.osservice.Util;
+
+public enum TargetType implements Type {
+
+    FCFS("处理机调度算法"),
+    RR("时间片轮转算法"),
+    SPN("最短进程优先算法"),
+    SRT("最短剩余时间优先算法"),
+    HRRN("最高响应比优先算法"),
+    Feedback("多级反馈序列算法");
+
+    private String label;
+
+    TargetType(String label) {
+        this.label = label;
+    }
+
+    @Override
+    public String getLabel(){
+        return label;
+    }
+
+    @Override
+    public String getInitCode(){
+        return null;
+    }
+}

+ 10 - 0
src/main/java/com/example/osservice/Util/Type.java

@@ -0,0 +1,10 @@
+package com.example.osservice.Util;
+
+public interface Type {
+
+    public String name();
+
+    public String getLabel();
+
+    public String getInitCode();
+}

+ 28 - 0
src/main/java/com/example/osservice/Util/TypeMap.java

@@ -0,0 +1,28 @@
+package com.example.osservice.Util;
+
+public class TypeMap<K extends Type, V extends Type> {
+
+    private K type;
+    private V target;
+
+    public TypeMap(K type, V target) {
+        this.type = type;
+        this.target = target;
+    }
+
+    public K getType() {
+        return type;
+    }
+
+    public void setType(K type) {
+        this.type = type;
+    }
+
+    public V getTarget() {
+        return target;
+    }
+
+    public void setTarget(V target) {
+        this.target = target;
+    }
+}

+ 53 - 0
src/main/java/com/example/osservice/VO/Level.java

@@ -0,0 +1,53 @@
+package com.example.osservice.VO;
+
+import java.util.List;
+
+public class Level {
+
+    private long id;
+
+    private String name;
+
+    private String description;
+
+    private List<Question> questions;
+
+    public Level(long id, String name, String description, List<Question> questions) {
+        this.id = id;
+        this.name = name;
+        this.description = description;
+        this.questions = questions;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public List<Question> getQuestions() {
+        return questions;
+    }
+
+    public void setQuestions(List<Question> questions) {
+        this.questions = questions;
+    }
+}

+ 4 - 0
src/main/java/com/example/osservice/VO/Question.java

@@ -0,0 +1,4 @@
+package com.example.osservice.VO;
+
+public class Question {
+}

+ 40 - 0
src/main/java/com/example/osservice/VO/Response.java

@@ -0,0 +1,40 @@
+package com.example.osservice.VO;
+
+public class Response<T> {
+
+    private long code;
+
+    private String msg;
+
+    private T data;
+
+    public Response(long code, String msg, T data) {
+        this.code = code;
+        this.msg = msg;
+        this.data = data;
+    }
+
+    public long getCode() {
+        return code;
+    }
+
+    public void setCode(long code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public T getData() {
+        return data;
+    }
+
+    public void setData(T data) {
+        this.data = data;
+    }
+}

+ 66 - 0
src/main/java/com/example/osservice/VO/ServiceInfo.java

@@ -0,0 +1,66 @@
+package com.example.osservice.VO;
+
+import com.example.osservice.Util.IRType;
+import com.example.osservice.Util.SourceType;
+import com.example.osservice.Util.TargetType;
+import com.example.osservice.Util.TypeMap;
+
+import java.util.List;
+
+public class ServiceInfo {
+
+    private String serviceName; // 服务名称
+    private List<TypeInfo> sourceTypes; // 源代码类型
+    private List<TypeInfo> irTypes; // 中间类型
+    private List<TypeInfo> targetTypes; // 渲染目标类型
+    private List<TypeMap<SourceType, IRType>> patternOptions; // 解析服务可选类型映射
+    private List<TypeMap<IRType, TargetType>> renderOptions; // 渲染服务可选类型映射
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    public List<TypeInfo> getSourceTypes() {
+        return sourceTypes;
+    }
+
+    public void setSourceTypes(List<TypeInfo> sourceTypes) {
+        this.sourceTypes = sourceTypes;
+    }
+
+    public List<TypeInfo> getIrTypes() {
+        return irTypes;
+    }
+
+    public void setIrTypes(List<TypeInfo> irTypes) {
+        this.irTypes = irTypes;
+    }
+
+    public List<TypeInfo> getTargetTypes() {
+        return targetTypes;
+    }
+
+    public void setTargetTypes(List<TypeInfo> targetTypes) {
+        this.targetTypes = targetTypes;
+    }
+
+    public List<TypeMap<SourceType, IRType>> getPatternOptions() {
+        return patternOptions;
+    }
+
+    public void setPatternOptions(List<TypeMap<SourceType, IRType>> patternOptions) {
+        this.patternOptions = patternOptions;
+    }
+
+    public List<TypeMap<IRType, TargetType>> getRenderOptions() {
+        return renderOptions;
+    }
+
+    public void setRenderOptions(List<TypeMap<IRType, TargetType>> renderOptions) {
+        this.renderOptions = renderOptions;
+    }
+}

+ 59 - 0
src/main/java/com/example/osservice/VO/Subject.java

@@ -0,0 +1,59 @@
+package com.example.osservice.VO;
+
+import java.util.List;
+
+public class Subject {
+
+    private long id;
+
+    private String name;
+
+    private String description;
+
+    private List<Level> levels;
+
+    public Subject(long id, String name, String description) {
+        this.id = id;
+        this.name = name;
+        this.description = description;
+    }
+
+    public Subject(long id, String name, String description, List<Level> levels) {
+        this.id = id;
+        this.name = name;
+        this.description = description;
+        this.levels = levels;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public List<Level> getLevels() {
+        return levels;
+    }
+
+    public void setLevels(List<Level> levels) {
+        this.levels = levels;
+    }
+}

+ 40 - 0
src/main/java/com/example/osservice/VO/TypeInfo.java

@@ -0,0 +1,40 @@
+package com.example.osservice.VO;
+
+public class TypeInfo {
+
+    private String name;
+
+    private String label;
+
+    private String initCode;
+
+    public TypeInfo(String name, String label, String initCode) {
+        this.name = name;
+        this.label = label;
+        this.initCode = initCode;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public String getInitCode() {
+        return initCode;
+    }
+
+    public void setInitCode(String initCode) {
+        this.initCode = initCode;
+    }
+}

+ 1 - 0
src/main/resources/application.properties

@@ -0,0 +1 @@
+

+ 39 - 0
src/test/java/com/example/osservice/OSService/FCFSTests.java

@@ -0,0 +1,39 @@
+package com.example.osservice.OSService;
+
+import com.example.osservice.PO.OSProcess;
+import com.example.osservice.PO.ProcessState;
+import com.example.osservice.Service.Process.ProcessServiceImp;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@SpringBootTest
+class FCFSTests {
+
+    @Test
+    void test1(){
+        List<OSProcess> data = new ArrayList<>();
+        data.add(new OSProcess(1, "A", 0, 1, 1));
+        ProcessServiceImp osServiceImp = new ProcessServiceImp();
+        List<ProcessState> result = osServiceImp.FCFSFunc(data);
+        for(ProcessState processState : result){
+            processState.show();
+        }
+    }
+
+    @Test
+    void test2(){
+        List<OSProcess> data = new ArrayList<>();
+        data.add(new OSProcess(1, "C", 1, 5, 5));
+        data.add(new OSProcess(2, "B", 1, 2, 2));
+        data.add(new OSProcess(3, "A", 0, 1, 1));
+        ProcessServiceImp osServiceImp = new ProcessServiceImp();
+        List<ProcessState> result = osServiceImp.FCFSFunc(data);
+        for(ProcessState processState : result){
+            processState.show();
+        }
+    }
+
+}

+ 13 - 0
src/test/java/com/example/osservice/OsserviceApplicationTests.java

@@ -0,0 +1,13 @@
+package com.example.osservice;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class OsserviceApplicationTests {
+
+    @Test
+    void contextLoads() {
+    }
+
+}