id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
79508f6f-a2ba-4d86-9998-cac03dfe5aaf | public void testStartTime() throws URISyntaxException {
File record = getWFDBFile("/chf03.dat");
RdsampOptions options = new RdsampOptions(record);
options.setStartTime(new LocalTime(1, 2, 3));
List<String> cmd = options.getCommand();
assertTrue(cmd.contains("-f"));
assertTrue(cmd.indexOf("-f")... |
283f35ab-8108-4d3a-ab3c-8cb87f96babc | public static void main(String[] args) throws FileNotFoundException {
FileReader fin = new FileReader( "/Users/ananth89/Desktop/text1.txt");
FileReader fin1 = new FileReader( "/Users/ananth89/Desktop/text2.txt");
Scanner s1 = new Scanner( fin );
Scanner s2 = new Scanner( fin1 );
int count1 = 0;
in... |
d4f2db37-188c-4dd1-aa22-65780b146b61 | public static void main(String[] args) throws java.io.IOException
{
String match = null;
//read contents from pattern.txt -- written by Vijay
ArrayList<String>pattern = new ArrayList<String>();
FileReader f1 = new FileReader( "/Users/ananth89/Desktop/text2.txt"); //pattern.txt goes here
Scanner sc = new Scann... |
1faa91d4-51de-416c-bbe9-6e98376cbd21 | public static void main(String[] args) throws IOException {
KnuthMorrisPratt k = new KnuthMorrisPratt();
String text = readFile("/Users/ananth89/Desktop/text1.txt", Charset.defaultCharset());
String pattern = readFile("/Users/ananth89/Desktop/text2.txt", Charset.defaultCharset());
int first_occur_position ... |
9c9ff02e-9aef-48a6-88bc-4a5341bfa4e0 | static String readFile(String path, Charset encoding)
throws IOException
{
byte[] encoded = Files.readAllBytes(Paths.get(path));
return new String(encoded, encoding);
} |
1e0453a3-759f-483b-9d04-1f39397b5dcb | public int[] prekmp(String pattern) {
int[] next = new int[pattern.length()];
int i=0, j=-1;
next[0]=-1;
while (i<pattern.length()-1) {
while (j>=0 && pattern.charAt(i)!=pattern.charAt(j))
j = next[j];
i++;
j++;
next[i] = j;
}
return next;
} |
01f0ff3e-4915-4e61-9a68-948a9d715f98 | public int kmp(String text, String pattern) {
int[] next = prekmp(pattern);
int i=0, j=0;
while (i<text.length()) {
while (j>=0 && text.charAt(i)!=pattern.charAt(j))
j = next[j];
i++; j++;
if (j==pattern.length()) return i-pattern.length();
}
return -1;
} |
7c9a0e8d-e8d9-48e7-92aa-43c2a56019cd | public static void main(String[] args) throws InterruptedException {
// String[] commandf = {
// "/bin/sh -c",
// " cd /Users/ananth89/Desktop; grep -f text1.txt text2.txt"
// };
try {
// Execute the command and wait for it to complete
Process child = Runtime.getRuntime().exec("cd /Users/anant... |
b69ec779-bd0b-43b7-aed1-8198ba2b0d73 | public static void main(String[] args) throws IOException
{
String text = readFile("/Users/ananth89/Desktop/text1.txt", Charset.defaultCharset());
String text1 = readFile("/Users/ananth89/Desktop/text1.txt", Charset.defaultCharset());} |
0a8749eb-7b6b-4de7-b95a-03e9c018db42 | static boolean testStrings(String a, String b) {
if (isValid(a) && isValid(b)) {
for (int i = 0; i < 4; i++) {
a = a.replaceFirst(String.valueOf(b.charAt(i)), "");
}
return a.length() <= (4 - 3);
}else
return false;
} |
5ab4210d-3b50-4258-9591-94bbbf1fb8eb | static boolean isValid(String s) {
return s.matches("");
} |
11d4fb73-6734-447e-8146-a4ba5f0be1ff | static String readFile(String path, Charset encoding)
throws IOException
{
byte[] encoded = Files.readAllBytes(Paths.get(path));
return new String(encoded, encoding);
}} |
263a9146-010d-481e-bfbe-82c73c5906b1 | public DH(Logging passedLog) {
mylog = passedLog;
GeneratePrime(1024);
GenerateBase(128);
// System.out.println("1024 bit Prime (Hex): " + GetPrime(16));
// System.out.println("128 bit Base (Hex): " + GetBase(16));
} |
d08fd826-602d-494a-9747-d71ef38fe882 | public DH(Logging passedLog, String passedPrime, int radixPrime, String passedBase, int radixBase) {
mylog = passedLog;
prime = new BigInteger(passedPrime, radixPrime);
base = new BigInteger(passedBase, radixBase);
} |
b2f73261-8647-4f07-bdb1-49916458bee5 | public void GeneratePrime(int bitLength) {
prime = new BigInteger(bitLength, 0, new SecureRandom());
} |
6cb1e852-29f6-4bb3-9161-2fa08c892989 | public void SetPrime(String passedPrime, int radix) {
prime = new BigInteger(passedPrime, radix);
} |
c586e099-93d1-43b7-879b-310a0d7ac989 | public String GetPrime(int radix) {
return prime.toString(radix);
} |
6a6260fd-f0a2-4eb9-8166-3c3c25098389 | public void GenerateBase(int bitLength) {
base = new BigInteger(bitLength, new SecureRandom());
} |
36f40d5d-b616-4a03-ac97-e4eb959f7138 | public void SetBase(String passedPrime, int radix) {
base = new BigInteger(passedPrime, radix);
} |
99383c25-1cd9-4e5c-9899-b84892b14d13 | public String GetBase(int radix) {
return base.toString(radix);
} |
c85972de-448b-45b7-9ffa-a9462e11810f | public String GetSharedSecret(int radix) {
return sharedSecret.toString(radix);
} |
7ef2e738-e641-4474-ad5d-55713f4ff78c | public PublicKey GetPublicKey() {
PublicKey pubKey = keyPair.getPublic();
return pubKey;
} |
a1f16c8c-f374-4cc4-93d0-57c0af3338b7 | public byte[] GetPublicKeyBF() {
PublicKey pubKey = keyPair.getPublic();
byte[] byteForm = pubKey.getEncoded();
// String format = pubKey.getFormat();
// System.out.println("Public Key in [" + format + "] : " + byteForm);
return byteForm;
} |
c14291d1-d99f-4484-8215-eed9fbc8c8b0 | public PublicKey CraftPublicKey(byte[] source) {
PublicKey pubKey = null;
try {
pubKey = KeyFactory.getInstance("DH").generatePublic(new X509EncodedKeySpec(source));
} catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
mylog.out("ERROR", "Failed to build a public key from the received byte array... |
5156871e-1dc9-40dc-9717-5a8b7e2cd1f8 | public void DHPhase1() {
// Prep DH
dhParameters = new DHParameterSpec(prime, base);
// Setup key generator
keyGen = null;
try {
keyGen = KeyPairGenerator.getInstance("DH");
} catch (NoSuchAlgorithmException e) {
mylog.out("ERROR", "There is no DH algorithm available.");
}
try {
keyGen.initial... |
ba572ddb-9e0f-4c61-a1f8-49287783a95c | public void DHPhase2(PublicKey partnersKey, String ReKeyedWith) {
try {
keyAgree.doPhase(partnersKey, true);
} catch (InvalidKeyException | IllegalStateException e) {
mylog.out("ERROR", "Unable to complete keying agreement with " + ReKeyedWith);
}
// Generate shared Secret
byte[] secretBYTE = keyAgree.... |
718c67df-017f-4d7b-8034-7235d7f58a1e | public Networking(Logging passedLog) {
mylog = passedLog;
IdleLimit = 14400000; // 4 hours
} |
3be1a038-9306-4794-bebf-e8a1de606a75 | public Networking(Logging passedLog, int port) {
mylog = passedLog;
BindServer(port);
IdleLimit = 86400000; // 1 day
} |
6d211e0b-4a21-4655-a19d-84e554baa9a3 | public Networking(Logging passedLog, int passedPort, String target) {
int port = 40000;
if ((passedPort > 1024) && (passedPort <= 65535)) {
port = passedPort;
}
mylog = passedLog;
try {
ClientSocket = new Socket(target, port);
} catch (UnknownHostException e) {
mylog.out("FATAL", "Unknown host [" +... |
f38939d6-4697-4797-9a6f-c107ab945043 | public Socket PassBackClient() {
return ClientSocket;
} |
7445003f-7860-4046-9eec-fbd52a5f6162 | private void BindServer(int passedSocket) {
int socket = 8080;
if ((passedSocket > 1024) && (passedSocket <= 65535)) {
socket = passedSocket;
} else {
mylog.out("WARN", "Passed port number is out of bounds or in privledged space, defaulting to 8080.");
}
try {
serverSocket = new ServerSocket(socket);... |
1265d659-62aa-40fe-a0dc-a17fc0f4ad0c | public Socket ListenForNewConnection() {
Socket newClient = null;
try {
newClient = serverSocket.accept();
} catch (IOException e) {
mylog.out("ERROR", "Error: Failed to establish connection with the new client.");
}
// Logging
SocketAddress theirAddress = newClient.getRemoteSocketAddress();
Socket... |
18cd26b2-a50f-4dec-bb1a-ac596b709630 | public void BringUp(Socket passedSocket) {
// Bind input/output to the socket
try {
receive = new DataInputStream(passedSocket.getInputStream());
} catch (NullPointerException e1) {
mylog.out("ERROR", "Failed to setup RECEIVE input stream");
} catch (IOException e2) {
mylog.out("ERROR", "Failed to setu... |
5a5e74ed-cf75-477f-8670-ba6e0a46aa30 | public void BringDown() {
// Close opened IO interfaces
try {
receive.close();
} catch (IOException e) {
mylog.out("ERROR", "Failed to close RECIEVE");
}
try {
send.close();
} catch (IOException e) {
mylog.out("ERROR", "Failed to close SEND");
}
} |
e578f1ec-30b2-443d-9a45-ad140952c451 | public void Send(String data) {
try {
send.writeUTF(data);
} catch (IOException e1) {
mylog.out("ERROR", "Failed to SEND data STRING");
}
try {
send.flush();
} catch (IOException e) {
mylog.out("ERROR", "Failed to flush SEND buffer");
}
} |
bb9df8a6-49bd-4fbe-bf85-6df69f4b7ed4 | public void Send(byte[] data) {
try {
send.write(data);
if (VERBOSE) {
mylog.out("INFO", "Wrote [" + data.length + "] bytes.");
}
} catch (IOException e1) {
mylog.out("ERROR", "Failed to SEND data byte[]");
}
try {
send.flush();
} catch (IOException e) {
mylog.out("ERROR", "Failed to flu... |
a3b4c405-6a9f-4faa-88a7-42b10dfaf98f | public String Receive() {
String fetched = null;
try {
fetched = receive.readUTF();
} catch (IOException e1) {
mylog.out("ERROR", "Failed to RECEIVE data STRING");
fetched = null;
}
return fetched;
} |
3cdcea30-f470-4949-ae88-46d65d76abf5 | public byte[] ReceiveByte() {
// Prep
int read = 0;
byte[] fetched = null;
int sleepFOR = 25; // a very small fraction of a second
int sleeptFOR = 0; // sleep counter
// Wait (block) for data
try {
while (receive.available() == 0) {
try {
Thread.sleep(sleepFOR);
} catch (InterruptedExcept... |
0e67628c-fcee-43a4-9778-977656ba6fbd | public byte[] ReceiveByteACK() {
// Prep
int read = 0;
byte[] fetched = null;
// Wait (block) for data
try {
while (receive.available() == 0) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
mylog.out("ERROR", "Failed to sleep while waiting for data over the network.");
}
... |
1676154d-2720-4b2a-984f-746bf6e5ea9b | public Client(Logging passedLog, Auth passedSubject, Session passedSession, boolean ClientMode) {
mylog = passedLog;
subject = passedSubject;
clientSession = passedSession;
ClientUI = ClientMode;
} |
c5493841-c417-468b-941e-787382982a8a | private void DisplayMenu() {
System.out.println("======================================================================");
System.out.println("Commands are:");
System.out.println("QUIT - Closes connection with the server and quits");
System.out.println("REKEY - Rekeys encryption between the client and the serv... |
6baeb318-6e76-434e-b178-48501a53dd02 | public void StartClient(int SERVERpassedPort, String SERVERpassedTarget, int DROPOFFpassedPort,
String DROPOFFpassedTarget) {
// Connect to the server
// Start up client networking
ServerNetwork = new Networking(mylog, SERVERpassedPort, SERVERpassedTarget);
// Bring the created socket into this scope
Socke... |
3c9ada86-be43-4e21-8efb-5c5fee3cb26d | private String readUI() {
System.out.flush();
System.out.print("> ");
System.out.flush();
String data = null;
BufferedReader inputHandle = new BufferedReader(new InputStreamReader(System.in));
boolean wait = true;
while (wait) {
try {
if (inputHandle.ready()) {
wait = false;
} else {
... |
5216ac9c-b863-4c81-83e6-03b3aed30a91 | private void DHrekey(Networking network, Crypto crypt, String ReKeyedWith) {
// Prep
byte[] fetched = null;
String ServerResponse = null;
// Create a DH instance and generate a PRIME and BASE
DH myDH = new DH(mylog);
// Share data with the server
network.Send(crypt.encrypt("<REKEY>"));
RecieveACK(netw... |
dcbd8e5f-9165-455c-876e-646f0e082bb0 | private void SendACK(Networking network, Crypto crypt) {
network.Send(crypt.encrypt("<ACK>"));
if (crypt.decrypt(network.ReceiveByteACK()).compareToIgnoreCase("<ACK>") != 0) {
mylog.out("ERROR", "Partner failed to ACK");
}
} |
4c60bc39-ef3d-435c-9a2f-17897ea7a5ff | private void RecieveACK(Networking network, Crypto crypt) {
if (crypt.decrypt(network.ReceiveByteACK()).compareToIgnoreCase("<ACK>") != 0) {
mylog.out("ERROR", "Partner failed to ACK");
}
network.Send(crypt.encrypt("<ACK>"));
} |
4e9fea5b-e683-4718-a775-efb602a44ed2 | StreamGobbler(InputStream is, String type) {
this.is = is;
this.type = type;
Collect = new ArrayList<String>();
} |
8159c125-bd5f-469e-aa58-ff83b0fda3ab | public void run() {
try {
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
Collect.add(line);
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
} |
2ccde1ba-93d4-4f59-b8ed-8d8336b7f47e | public int GetSize() {
return Collect.size();
} |
b23a6eb6-04b6-45d8-a2fe-190ad38cb426 | public ArrayList<String> ReturnData() {
return Collect;
} |
d1749bf9-b398-4c69-9570-117fdff10b62 | public Logging(String loglevel) {
// Setup logger via slf4j
Log = LoggerFactory.getLogger("TRUSS");
// Send passed value to upper case
String compare = "FATAL";
if (!loglevel.isEmpty()) {
compare = loglevel.toUpperCase();
}
// Set log level to passed paramaters (if it can be mapped)
if (compare.sta... |
004cfe0d-e440-4199-8b1a-7d756f047589 | public void out(String level, String msg) {
// The messages level
int severity = 0;
// Send passed value to upper case
String compare = level.toUpperCase();
// Set log level to passed parameters (if it can be mapped)
if (compare.startsWith("INFO")) {
// All messages
severity = 4;
} else if (compare... |
179d7ed8-e02d-49af-acfc-c6eb840e8f12 | public Server(Logging passedLog, Auth passedSubject, int PortNumber, Session session) {
mylog = passedLog;
PortUsed = PortNumber;
network = new Networking(mylog, PortNumber);
subject = passedSubject;
ServerSession = session;
// Setup master thread communication
JobLock = new Object();
MasterJobQueue = n... |
4121c719-6551-4686-b060-67f605972cb2 | private void DisplayMenu(String Mode) {
if (Mode.compareToIgnoreCase("Server") == 0) {
System.out.println("======================================================================");
System.out.println("Welcome. This server is accepting connections on port [" + PortUsed + "]");
System.out.println("Commands are... |
0148e323-51f0-4671-a75b-579359cf9a9e | public void LaunchServer() {
// Prepare
String UserInput = null;
// Display the UI boilerplate
DisplayMenu("Server");
// Enter the UI loop
UserInput = readUI();
while ((UserInput != null) && (UserInput.compareToIgnoreCase("quit") != 0)) {
if (UserInput.compareToIgnoreCase("sw") == 0) {
// Load a ... |
23bd43f2-8b8f-4c42-a095-a21aa586dede | public void LaunchDropOff() {
// Prepare
String UserInput = null;
// Display the UI boilerplate
DisplayMenu("DropOff");
// Enter the UI loop
UserInput = readUI();
while ((UserInput != null) && (UserInput.compareToIgnoreCase("quit") != 0)) {
if (UserInput.compareToIgnoreCase("sw") == 0) {
// Load ... |
3a6c6265-82e9-4369-9e6b-f163c2322b7c | public void run() {
// Seed client numeric labeling
int UIDcounter = 0;
// Determine mode to use (Server or Drop Off)
String purpose = (String) ServerSession.getAttribute("USE");
boolean ServerMode = true;
if (purpose == "dropoff") {
ServerMode = false;
}
// Listen for new connections indefinitely
... |
b520bec6-a1e6-499f-813c-582ae916e78d | private String readUI() {
System.out.flush();
System.out.print("> ");
System.out.flush();
String data = null;
BufferedReader inputHandle = new BufferedReader(new InputStreamReader(System.in));
boolean wait = true;
while (wait) {
try {
if (inputHandle.ready()) {
wait = false;
} else {
... |
f16febb2-defe-4323-90af-b4eb1043b039 | public static void main(String[] args) {
// Collect any passed arguments
String Ploglevel = System.getProperty("loglevel");
if (Ploglevel == null) {
// Default to FATAL log level
Ploglevel = "FATAL";
}
String Pusername = System.getProperty("user");
if (Pusername == null) {
// Default to empty strin... |
40f29beb-a5fd-4818-af1f-4bbe653da537 | public Jobs() {
work = "";
issuedTo = "";
timeIssued = 0;
SecurityLevel = 0;
OSspecific = "any";
ReturnedErrors = new ArrayList<String>();
ReturnedOutput = new ArrayList<String>();
JobID = 0;
} |
2cba17ea-627a-4583-bd4e-18a76c6a0bae | public Jobs(String PassedWork) {
work = PassedWork;
issuedTo = "";
timeIssued = 0;
SecurityLevel = 0;
OSspecific = "any";
ReturnedErrors = new ArrayList<String>();
ReturnedOutput = new ArrayList<String>();
JobID = 0;
} |
e991d7d1-ec60-4cad-9ce8-e63ea7d33570 | public Jobs(String PassedWork, String PassedOSspecific) {
work = PassedWork;
issuedTo = "";
timeIssued = 0;
SecurityLevel = 0;
OSspecific = PassedOSspecific;
ReturnedErrors = new ArrayList<String>();
ReturnedOutput = new ArrayList<String>();
JobID = 0;
} |
606c759a-a124-477b-9df9-46fd9781db42 | public Jobs(String PassedWork, String PassedOSspecific, int PassedSecurityLevel) {
work = PassedWork;
issuedTo = "";
timeIssued = 0;
SecurityLevel = PassedSecurityLevel;
OSspecific = PassedOSspecific;
ReturnedErrors = new ArrayList<String>();
ReturnedOutput = new ArrayList<String>();
JobID = 0;
} |
1a861565-86eb-40bb-b6f3-f54bf159ba2c | public int GetJobID() {
return JobID;
} |
c8a59e81-0dc9-456e-83a8-ea1089e5849f | public void SetJobID(int DesiredJobID) {
JobID = DesiredJobID;
} |
0d4ee6c5-b296-4797-9a8a-ef1a58377ed4 | public int GetOutputListSize() {
return ReturnedOutput.size();
} |
06368f53-dafb-40c7-a6cc-dd9eb58ee185 | public ArrayList<String> GetOutputList() {
return ReturnedOutput;
} |
0f489a66-9b5a-4562-89f0-7260c8fd1bcd | public void AddToOutputList(String OutputString) {
ReturnedOutput.add(OutputString);
} |
4235e7be-dd79-43e2-ba2c-1ff94174db92 | public int GetErrorListSize() {
return ReturnedErrors.size();
} |
54bc959f-b93d-4ac5-b540-d5cca195e9d5 | public ArrayList<String> GetErrorList() {
return ReturnedErrors;
} |
9a9c91fa-7002-4e03-81fa-4f0940c46cf8 | public void AddToErrorList(String ErrorString) {
ReturnedErrors.add(ErrorString);
} |
a0f48aaf-2af6-433b-8ba8-df663a22b6c7 | public int GetSecurityLevel() {
return SecurityLevel;
} |
f172d734-3ed8-4e53-9039-823c2a53891e | public void SetSecurityLevel(int PassedSecurityLevel) {
SecurityLevel = PassedSecurityLevel;
} |
db0a855c-585c-46b3-98a7-cea70e0a885d | public String GetOSspecific() {
return OSspecific;
} |
bd9cbae2-e856-4af2-a4ad-a493279187f6 | public void SetOSspecific(String PassedOSspecific) {
OSspecific = PassedOSspecific;
} |
377be4ab-47c4-4fa9-aa30-63ad9a09e8c3 | public String GetWork() {
return work;
} |
fd2dcc79-3ef2-4a5b-80d7-4f1402db94cf | public void SetWork(String PassedWork) {
work = PassedWork;
} |
64a251aa-be1a-4e71-8bf2-2529d4875ae1 | public String GetIussed() {
return issuedTo;
} |
acf17651-b699-4e3d-a949-42fdb9d13c70 | public void SetIssued(String PassedIssuedTo) {
issuedTo = PassedIssuedTo;
} |
b16c3800-9aa7-4d4b-8d0c-326cb509a70c | public long GetTimeIssued() {
return timeIssued;
} |
fc97ab44-01e9-4763-bef5-2dceb053d67c | public void SetTimeIssued() {
timeIssued = System.nanoTime();
} |
d642bba7-7178-41f0-b39f-848b0e24ef2d | public long GetElpased() {
long currentTime = System.nanoTime();
long elpasedTime = currentTime - timeIssued;
if (elpasedTime < 0) {
elpasedTime = 0;
}
return elpasedTime;
} |
2c715f6d-9b25-4a7d-86a8-8262ad840b9e | public JobManagement() {
jobqueue = new ArrayList<Jobs>();
jobsent = new ArrayList<Jobs>();
jobcomplete = new ArrayList<Jobs>();
IDcounter = 1;
} |
94b1f04d-ccd7-4b72-b51d-a1e15646b0af | public void DetailedList(String mode) {
// Cast generic target type, then specify it
ArrayList<Jobs> TargetList;
String TargetName = "";
if (mode.equalsIgnoreCase("unassigned")) {
TargetList = jobqueue;
TargetName = "Unassigned List";
} else if (mode.equalsIgnoreCase("assigned")) {
TargetList = jobse... |
cff4d072-25b7-424e-bfbd-359c9e214d5a | public int UnassignedCount() {
return jobqueue.size();
} |
60d9f3b5-2447-47e7-a740-1281bd8a3697 | public int AssignedCount() {
return jobsent.size();
} |
c6270ea1-818e-4b42-ae61-7acbc4678ad0 | public int CompletedCount() {
return jobcomplete.size();
} |
8a98de46-af87-4a94-97c2-a7fea68cdca6 | public int Load(String filepath) throws IOException {
// Setup
int AddedCounter = 0;
boolean LoadJob = true;
// Open the file and parse it
Path path = Paths.get(filepath);
try (Scanner scanner = new Scanner(path, ENCODING.name())) {
System.out.printf("%8s|%6s|%-50s%n", "OS", "SecLev", "Job");
while (... |
bc778a55-f5f4-4c43-9566-17cf87226dd4 | public int Save(String filepath) throws IOException {
// Setup
int size = jobcomplete.size();
int SavePointer = 0;
// If there is nothing to save, do not create an empty file
if (size == 0) {
return 0;
}
// Open the file
PrintWriter writer = new PrintWriter(filepath, "UTF-8");
// Save each c... |
7a881988-aa59-4b3f-afc0-8987d117e40d | public int SetupResultStorage(String JobComplete) {
Jobs jobUnit = new Jobs(JobComplete);
jobcomplete.add(jobUnit);
jobUnit.SetJobID(IDcounter);
int toReturn = IDcounter;
IDcounter++;
return toReturn;
} |
6dd64da5-9374-4dc1-bca6-9a7279ad4a41 | public void StoreResutls(int JobID, String ToStore, String Type) {
// Look for, and load, the job that has that JobID
int fetch = JobSearch(JobID, jobcomplete);
Jobs jobUnit = jobcomplete.get(fetch);
// If we can find that job...
if (fetch >= 0) {
if (Type.equalsIgnoreCase("ERROR")) {
jobUnit.AddToErr... |
d0af3c55-4681-4d94-86fa-a7c626a63cdc | public void SampleWindows() {
for (int loop = 0; loop < 10; loop++) {
Jobs jobUnit = new Jobs("time /T", "Windows");
jobqueue.add(jobUnit);
}
} |
d9c99e36-efa5-46a2-80f7-e43670b66493 | public void SampleLinux() {
for (int loop = 0; loop < 10; loop++) {
Jobs jobUnit = new Jobs("date", "Linux");
jobqueue.add(jobUnit);
}
} |
0684a1f2-4e45-4a7c-a213-4d7c9d0ad219 | public void Sample() {
for (int loop = 0; loop < 10; loop++) {
Jobs jobUnit = new Jobs("java -version");
jobqueue.add(jobUnit);
}
} |
2e3eca23-3401-4fc0-8d55-07e32c69c21a | public String Signoff(String clientsName) {
int size = jobsent.size();
int fetch = 0;
if (size > 0) {
fetch = JobSearch(clientsName, jobsent);
// If fetch is 0 or -1 than no jobs have been assigned to that
// client
if (fetch < 0) {
return "Failed";
} else {
jobsent.remove(fetch); // Remov... |
26d46f8f-e2c9-45c8-a774-1f2e1288982f | public String Assign(String clientsName, String OS, int SecLev) {
int size = jobqueue.size();
if (size > 0) {
int fetch = 0;
if ((OS.toLowerCase().contains("windows")) || (OS.toLowerCase().contains("linux"))
|| (OS.toLowerCase().contains("mac"))) {
fetch = JobSearch(OS, SecLev, jobqueue);
// If ... |
65c9a3bc-763a-4de2-9914-a27f64f5fdbf | private int JobSearch(String OS, int SecLev, ArrayList<Jobs> SearchThrough) {
int size = SearchThrough.size();
int scan = 0;
// Simplify searches (remove anything extra that was passed
if (OS.toLowerCase().contains("windows")) {
OS = "windows";
} else if (OS.toLowerCase().contains("linux")) {
OS = "lin... |
0e08684a-657b-44b1-9115-9e46246e80dc | private int JobSearch(String ClientID, ArrayList<Jobs> SearchThrough) {
int size = SearchThrough.size();
int scan = 0;
while (scan < size) {
Jobs looking = SearchThrough.get(scan);
// See if the client name matches the search parameter
if (looking.GetIussed() == ClientID) {
return scan;
}
scan... |
39650573-08af-468b-8b50-640251137b93 | private int JobSearch(int JobID, ArrayList<Jobs> SearchThrough) {
int size = SearchThrough.size();
int scan = 0;
if (JobID < 0) {
return -1;
}
while (scan < size) {
Jobs looking = SearchThrough.get(scan);
// See if the job id matches the search parameter
if (looking.GetJobID() == JobID) {
re... |
09cdd20f-346d-4cc1-8a19-ace26f1275ae | public void ClearUnsentQueue() {
jobqueue.clear();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.