text stringlengths 3 1.18M |
|---|
package Principal;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Principal;
import java.io.File;
import javax.swing.filechooser.FileFilter;
/**
*
* @author Administrador
*/
public class XMLFileFilter extends FileFilter {
private String filtrar = ".xml";
@Overri... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Excepciones;
import DTD.LectorDTD;
/**
*
* @author Administrador
*/
public class InvalidReadException extends Exception {
LectorDTD otroR;
public InvalidReadException(String mensaje, LectorDTD otro... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Excepciones;
/**
*
* @author Administrador
*/
public class DTDException extends Exception {
public DTDException() {
}
public DTDException(String msg) {
super("DTD Exception: " + msg);
... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Excepciones;
/**
*
* @author Administrador
*/
public interface IManejadorError {
public void errorFatal(ParserException ex) throws ParserException;
public void error(ParserException ex) throws Pars... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Excepciones;
/**
*
* @author Administrador
*/
public class ParserException extends Exception {
public static int WARNING = 0;
public static int ERROR = 1;
public static int ERROR_FATAL = 2;
p... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Excepciones;
/**
*
* @author Administrador
*/
public class ManejadorError implements IManejadorError {
public void errorFatal(ParserException ex) throws ParserException {
String titulo = "ERROR ... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser.Manejador;
import Excepciones.ParserException;
import Utilidades.AtributoEtiqueta;
/**
*
* @author Administrador
*/
public interface IManejadorContenido {
/**
* Metodo plantilla al abrir un... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser.Manejador;
import DOM.Estructura.Atributo;
import DOM.Estructura.Elemento;
import DOM.*;
import Excepciones.ParserException;
import Utilidades.AtributoEtiqueta;
/**
* Manejador DOM se encarga de crear ... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser;
import DOM.Estructura.Atributo;
import DTD.DTDValidador;
import DTD.ParserDTD;
import Excepciones.*;
import Parser.Manejador.*;
import Parser.Validador.*;
import Principal.Principal;
import Utilidades.A... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser;
import Parser.Validador.*;
/**
* Valida el tipo de etiqueta XML leida
* @author Administrador
*/
public class ClasificadorEtiqueta {
//Constantes que corresponden a cada una de las partes que n... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser;
import java.util.Stack;
/**
* Esta clase encapsula la pila para asegurar que se cumpla con la estructura jerarquica del XML y que
* cada etiqueta se cierre como corresponde.
* @author Administrador
... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser.Validador;
/**
* Interface que define el metodo plantilla de los diferentes validadores que pueden existir
* @author Administrador
*/
public interface IValidador {
/**
* Metodo plantilla que... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser.Validador;
import Utilidades.Balance;
import Utilidades.VerificadorStrings;
/**
*
* @author Administrador
*/
public class ValidadorTagInicio implements IValidador {
private ValidadorVariables vVa... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser.Validador;
import Utilidades.VerificadorStrings;
import Utilidades.StrOp;
/**
*
* @author Administrador
*/
public class ValidadorTagFinal implements IValidador {
String str;
public boolean v... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser.Validador;
import Utilidades.VerificadorStrings;
import Utilidades.StrOp;
/**
* Verifica si el tag XML leido corresponde a un comentario
* @author Administrador
*/
public class ValidadorComentario im... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser.Validador;
import Utilidades.VerificadorStrings;
/**
*
* @author Administrador
*/
public class ValidadorContenido implements IValidador{
public boolean validar(String str) {
boolean resu... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser.Validador;
import Utilidades.*;
/**
*
* @author Administrador
*/
public class ValidadorTagAutoContenido implements IValidador {
private String str;
private ValidadorVariables vVariables;
... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser.Validador;
import Utilidades.*;
import javax.swing.JOptionPane;
/**
*
* @author Administrador
*/
public class ValidadorPrologo implements IValidador {
private static String nombres[]={"version"... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser.Validador;
import Utilidades.VerificadorStrings;
/**
*
* @author Administrador
*/
public class ValidadorContenidoCDATA implements IValidador{
public boolean validar(String str) {
boolean... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser.Validador;
import Utilidades.VerificadorStrings;
import java.util.Vector;
/**
*
* @author Administrador
*/
public class ValidadorVariables implements IValidador {
private String str;
private ... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Parser.Validador;
/**
*
* @author Administrador
*/
public class ValidadorDTD implements IValidador {
public boolean validar(String str) {
boolean resultado = true;
try {
res... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
public class Constants {
static public final boolean LOGV = true;
}
|
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
public class Constants {
static public final boolean LOGV = false;
}
|
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package compatible.shareactionprovider;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/... |
package compatible.shareactionprovider;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses... |
package compatible.shareactionprovider;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
public class Constants {
static public final boolean LOGV = true;
}
|
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package compatible.shareactionprovider;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/... |
package compatible.shareactionprovider;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses... |
package compatible.shareactionprovider;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package compatible.actionbar;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
public class Constants {
static public final boolean LOGV = true;
}
|
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package sample.multithreading;
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
package parte3;
import parte1.*;
public class MonitorSinInanicionCat implements MonitorArbitraje {
private int numLectores = 0;
private boolean escritor = false;
private long startTime;
private int escritoresEnEspera = 0;
private boolean turnoLectores = true;
MonitorSinInanicionCat() {
star... |
package parte3;
import parte1.*;
public class LectoresEscritores {
static int numLectores = 4;
static int numEscritores = 2;
public static void main(String[] argv) {
BaseDatos BD = new BaseDatos();
MonitorSinInanicionCat monitor = new MonitorSinInanicionCat();
try {
for (int i = 1; i... |
package parte1;
public class BaseDatos {
private String contenido = "estado inicial";
public void escribir() {
contenido = Thread.currentThread().getName() + " ha estado aqui";
}
public String leer() { return contenido; }
}
|
package parte1;
public class MonitorBasico implements MonitorArbitraje {
private int numLectores = 0;
private boolean escritor = false;
private long startTime;
MonitorBasico() {
startTime = System.currentTimeMillis();
}
public synchronized void entrarLeer() throws InterruptedException {
whi... |
package parte1;
public interface MonitorArbitraje {
public void entrarLeer() throws InterruptedException;
public void salirLeer();
public void entrarEscribir() throws InterruptedException;
public void salirEscribir();
}
|
package parte1;
import java.util.concurrent.ThreadLocalRandom;
public class Escritor extends Thread {
private MonitorArbitraje monitorArb;
private BaseDatos baseDatos;
public Escritor(MonitorArbitraje monitor, BaseDatos BD, String nombre) {
super(nombre);
monitorArb = monitor;
baseDatos = BD;
}... |
package parte1;
public class LectoresEscritores {
static int numLectores = 4;
static int numEscritores = 2;
public static void main(String[] argv) {
BaseDatos BD = new BaseDatos();
MonitorBasico monitor = new MonitorBasico();
try {
for (int i = 1; i <= numLectores; ++i)
new Lector(m... |
package parte1;
import java.util.concurrent.ThreadLocalRandom;
public class Lector extends Thread {
private MonitorArbitraje monitorArb;
private BaseDatos baseDatos;
public Lector(MonitorArbitraje monitor, BaseDatos BD, String nombre) {
super(nombre);
monitorArb = monitor;
baseDatos = BD;
}
... |
package parte4;
import parte1.*;
public class LectoresEscritores {
static int numLectores = 4;
static int numEscritores = 2;
public static void main(String[] argv) {
BaseDatos BD = new BaseDatos();
MonitorFIFO monitor = new MonitorFIFO();
try {
for (int i = 1; i <= numLectores; ++i... |
package parte4;
import parte1.*;
public class MonitorFIFO implements MonitorArbitraje {
private boolean hayEscritor = false;
private boolean habilitadoTicket = true;
private boolean lectoresSeguidos = true;
private int numLectores = 0;
private long startTime;
private int turnoActual = 0;
private S... |
package parte2;
import parte1.*;
public class LectoresEscritores {
static int numLectores = 4;
static int numEscritores = 2;
public static void main(String[] argv) {
BaseDatos BD = new BaseDatos();
MonitorPrioridadEscritores monitor = new MonitorPrioridadEscritores();
try {
for (int ... |
package parte2;
import parte1.*;
public class MonitorPrioridadEscritores implements MonitorArbitraje {
private int numLectores = 0;
private boolean escritor = false;
private long startTime;
private int escritoresEnEspera = 0;
MonitorPrioridadEscritores() {
startTime = System.currentTimeMillis... |
package parte3;
import java.util.concurrent.ThreadLocalRandom;
import parte1.BaseDatos;
import parte1.MonitorArbitraje;
public class LectorEscritor extends Thread {
private MonitorArbitraje monitorArb;
private BaseDatos baseDatos;
public LectorEscritor(ReentranteLecturaAEscritura monitor, BaseDatos BD, String n... |
package parte3;
import java.util.HashMap;
import java.util.Map.Entry;
import parte1.MonitorArbitraje;
public class ReentranteLecturaAEscritura implements MonitorArbitraje {
private int numLectores = 0;
private long startTime;
private int escritoresEnEspera = 0;
private HashMap<Thread, Integer> threadMapLectura;... |
package parte3;
import parte1.BaseDatos;
public class LectoresEscritoresReentrantes {
static int numLectoresEscritores = 4;
public static void main(String[] argv) {
BaseDatos BD = new BaseDatos();
ReentranteLecturaAEscritura monitor = new ReentranteLecturaAEscritura();
try {
for (int i = 1; i <= numL... |
package parte1;
public class BaseDatos {
private String contenido = "estado inicial";
public void escribir() {
contenido = Thread.currentThread().getName() + " ha estado aqui";
}
public String leer() { return contenido; }
}
|
package parte1;
import java.util.HashMap;
public class ReentranteLectura implements MonitorArbitraje {
private int numLectores = 0;
private boolean hayEscritor = false;
private long startTime;
private int escritoresEnEspera = 0;
private HashMap<Thread, Integer> threadMapLectura;
ReentranteLectura... |
package parte1;
public interface MonitorArbitraje {
public void entrarLeer() throws InterruptedException;
public void salirLeer();
public void entrarEscribir() throws InterruptedException;
public void salirEscribir();
}
|
package parte1;
import java.util.concurrent.ThreadLocalRandom;
public class Escritor extends Thread {
private MonitorArbitraje monitorArb;
private BaseDatos baseDatos;
public Escritor(MonitorArbitraje monitor, BaseDatos BD, String nombre) {
super(nombre);
monitorArb = monitor;
baseDatos = BD;
}... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.