コード例 #1
0
ファイル: Prism.java プロジェクト: Navieclipse/KEEL
  /** Creates the total selector's set for get all the possible rules */
  private Complejo hazSelectores(Dataset train) {

    Complejo almacenSelectores;
    int nClases = train.getnclases();
    almacenSelectores =
        new Complejo(nClases); // Aqui voy a almacenar los selectores (numVariable,operador,valor)
    Attribute[] atributos = null;
    int num_atributos, type;
    Vector nominalValues;
    atributos = Attributes.getAttributes();
    num_atributos = Attributes.getNumAttributes();
    Selector s;

    for (int i = 0; i < train.getnentradas(); i++) {
      type = atributos[i].getType();
      switch (type) {
        case 0: // NOMINAL
          nominalValues = atributos[i].getNominalValuesList();
          // System.out.print("{");
          for (int j = 0; j < nominalValues.size(); j++) {
            // System.out.print ((String)nominalValues.elementAt(j)+"  ");
            s = new Selector(i, 0, (String) nominalValues.elementAt(j), true); // [atr,op,valor]
            // incluimos tb los valores en double para facilitar algunas funciones
            s.setValor((double) j);
            almacenSelectores.addSelector(s);
            // s.print();
          }
          // System.out.println("}");
          break;
      }
      // System.out.println(num_atributos);
    }
    return almacenSelectores;
  }
コード例 #2
0
ファイル: Overlord.java プロジェクト: rf/bitster
  /** Selects on sockets and informs their Communicator when there is something to do. */
  public void communicate(int timeout) {

    try {
      selector.select(timeout);
    } catch (IOException e) {
      // Not really sure why/when this happens yet
      return;
    }

    Iterator<SelectionKey> keys = selector.selectedKeys().iterator();

    while (keys.hasNext()) {
      SelectionKey key = keys.next();
      keys.remove();
      if (!key.isValid()) continue; // WHY
      Communicator communicator = (Communicator) key.attachment();

      if (key.isReadable()) communicator.onReadable();
      if (key.isWritable()) communicator.onWritable();
      if (key.isAcceptable()) communicator.onAcceptable();
    }

    // Go through the queue and handle each communicator
    while (!queue.isEmpty()) {
      Communicator c = queue.poll();
      c.onMemo();
    }
  }
コード例 #3
0
ファイル: Complex.java プロジェクト: RubelAhmed57/KEEL
 /** It prints the complex content */
 public void print() {
   for (int x = 0; x < compl.size(); x++) {
     Selector s = (Selector) compl.get(x);
     System.out.print("(" + nombreAtributos[s.getAttribute()] + " ");
     switch (s.getOperator()) {
       case 0:
         System.out.print("=");
         break;
       case 1:
         System.out.print("<>");
         break;
       case 2:
         System.out.print("<=");
         break;
       default:
         System.out.print(">");
     }
     double[] valores = s.getValues();
     if (valores.length > 1) {
       System.out.print(" " + valores[0]);
       for (int i = 1; i < valores.length - 1; i++) {
         System.out.print(" ^ " + valores[i]);
       }
       System.out.print(" ^ " + valores[valores.length - 1] + ")");
     } else {
       System.out.print(" " + valores[0] + ")");
     }
     if (x < compl.size() - 1) {
       System.out.print(" AND ");
     }
   }
 }
コード例 #4
0
ファイル: Complex.java プロジェクト: RubelAhmed57/KEEL
 /**
  * It prints on a string the content of the complex
  *
  * @return String a string with the content of the complex
  */
 public String printString() {
   String cad = "";
   for (int x = 0; x < compl.size(); x++) {
     Selector s = (Selector) compl.get(x);
     cad += nombreAtributos[s.getAttribute()] + " ";
     switch (s.getOperator()) {
       case 0:
         cad += "=";
         break;
       case 1:
         cad += "<>";
         break;
       case 2:
         cad += "<=";
         break;
       case 3:
         cad += ">";
         break;
     }
     double[] valores = s.getValues();
     if (valores.length > 1) {
       cad += " " + valores[0];
       for (int i = 1; i < valores.length - 1; i++) {
         cad += " ^ " + valores[i];
       }
       cad += " ^ " + valores[valores.length - 1] + "";
     } else {
       cad += " " + valores[0] + "";
     }
     if (x < compl.size() - 1) {
       cad += " AND ";
     }
   }
   return cad;
 }
コード例 #5
0
  /**
   * Serves the incoming connections.
   *
   * @throws IOException
   * @throws DirectoryException
   */
  private void serveIncomingConnections() throws IOException, DirectoryException {
    int selectorState = selector.select();

    // We can't rely on return value of select to determine if any keys
    // are ready.
    // see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4850373
    for (Iterator<SelectionKey> iterator = selector.selectedKeys().iterator();
        iterator.hasNext(); ) {
      SelectionKey key = iterator.next();
      iterator.remove();
      if (key.isAcceptable()) {
        // Accept the new client connection.
        ServerSocketChannel serverChannel = (ServerSocketChannel) key.channel();
        SocketChannel clientChannel = serverChannel.accept();
        if (clientChannel != null) {
          acceptConnection(clientChannel);
        }
      }

      if (selectorState == 0 && enabled && !shutdownRequested && logger.isTraceEnabled()) {
        // Selected keys was non empty but select() returned 0.
        // Log warning and hope it blocks on the next select() call.
        logger.trace(
            "Selector.select() returned 0. "
                + "Selected Keys: %d, Interest Ops: %d, Ready Ops: %d ",
            selector.selectedKeys().size(), key.interestOps(), key.readyOps());
      }
    }
  }
コード例 #6
0
ファイル: Complex.java プロジェクト: RubelAhmed57/KEEL
 /**
  * It checks if the complex covers a given example
  *
  * @param m The example
  * @return boolean True if it covers the example. False in other case
  */
 public boolean covered(Instance m) {
   boolean cubierto = true;
   double[] ejemplo = m.getMuest();
   for (int i = 0; i < this.size() && cubierto; i++) {
     Selector s = this.getSelector(i);
     switch (s.getOperator()) {
       case 0: // equal operator
         double[] valor = s.getValues();
         cubierto = false;
         for (int j = 0; (j < valor.length) && (!cubierto); j++) {
           cubierto = (ejemplo[s.getAttribute()] == valor[j]);
         }
         break;
       case 1: // distinct operator
         cubierto = ejemplo[s.getAttribute()] != s.getValue();
         break;
       case 2: // lower or equal
         cubierto = ejemplo[s.getAttribute()] <= s.getValue();
         break;
       case 3: // higher
         cubierto = ejemplo[s.getAttribute()] > s.getValue();
         break;
     }
   }
   return cubierto;
 }
コード例 #7
0
ファイル: Dispatcher1.java プロジェクト: raviAmlani/java
 private void dispatch() throws IOException {
   sel.select();
   for (Iterator i = sel.selectedKeys().iterator(); i.hasNext(); ) {
     SelectionKey sk = (SelectionKey) i.next();
     i.remove();
     Handler h = (Handler) sk.attachment();
     h.handle(sk);
   }
 }
コード例 #8
0
ファイル: Complex.java プロジェクト: RubelAhmed57/KEEL
  /**
   * It copies the complex
   *
   * @return A new cloned complex
   */
  public Complex copyRule() {
    int i;

    Complex c = new Complex(nclass);
    for (i = 0; i < compl.size(); i++) {
      Selector aux = (Selector) compl.get(i);
      Selector s = new Selector(aux.getAttribute(), aux.getOperator(), aux.getValue());
      c.addSelector(s);
    }
    c.distrib = this.getDistribution();
    c.setClass(clas);

    return c;
  }
コード例 #9
0
ファイル: OpRead.java プロジェクト: susotajuraj/jdk8u-jdk
  static void test() throws Exception {
    ServerSocketChannel ssc = null;
    SocketChannel sc = null;
    SocketChannel peer = null;
    try {
      ssc = ServerSocketChannel.open().bind(new InetSocketAddress(0));

      // loopback connection
      InetAddress lh = InetAddress.getLocalHost();
      sc = SocketChannel.open(new InetSocketAddress(lh, ssc.socket().getLocalPort()));
      peer = ssc.accept();

      // peer sends message so that "sc" will be readable
      int n = peer.write(ByteBuffer.wrap("Hello".getBytes()));
      assert n > 0;

      sc.configureBlocking(false);

      Selector selector = Selector.open();
      SelectionKey key = sc.register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE);

      boolean done = false;
      int failCount = 0;
      while (!done) {
        int nSelected = selector.select();
        if (nSelected > 0) {
          if (nSelected > 1) throw new RuntimeException("More than one channel selected");
          Set<SelectionKey> keys = selector.selectedKeys();
          Iterator<SelectionKey> iterator = keys.iterator();
          while (iterator.hasNext()) {
            key = iterator.next();
            iterator.remove();
            if (key.isWritable()) {
              failCount++;
              if (failCount > 10) throw new RuntimeException("Test failed");
              Thread.sleep(250);
            }
            if (key.isReadable()) {
              done = true;
            }
          }
        }
      }
    } finally {
      if (peer != null) peer.close();
      if (sc != null) sc.close();
      if (ssc != null) ssc.close();
    }
  }
コード例 #10
0
ファイル: ShowComp.java プロジェクト: vishalshar/NetMon
 public void run() {
   for (; ; ) {
     try {
       int n = sel.select();
       if (n > 0) processSelectedKeys();
       processPendingTargets();
       if (shutdown) {
         sel.close();
         return;
       }
     } catch (IOException x) {
       x.printStackTrace();
     }
   }
 }
コード例 #11
0
ファイル: Util.java プロジェクト: dorkbox/barchart-udt
 // When finished, invoker must ensure that selector is empty
 // by cancelling any related keys and explicitly releasing
 // the selector by invoking releaseTemporarySelector()
 static Selector getTemporarySelector(SelectableChannel sc) throws IOException {
   SoftReference ref = (SoftReference) localSelector.get();
   SelectorWrapper selWrapper = null;
   Selector sel = null;
   if (ref == null
       || ((selWrapper = (SelectorWrapper) ref.get()) == null)
       || ((sel = selWrapper.get()) == null)
       || (sel.provider() != sc.provider())) {
     sel = sc.provider().openSelector();
     localSelector.set(new SoftReference(new SelectorWrapper(sel)));
   } else {
     localSelectorWrapper.set(selWrapper);
   }
   return sel;
 }
コード例 #12
0
ファイル: Util.java プロジェクト: dorkbox/barchart-udt
 public void run() {
   try {
     sel.close();
   } catch (Throwable th) {
     throw new Error(th);
   }
 }
コード例 #13
0
ファイル: ChatUI.java プロジェクト: Trojanz/Custom-Salem
 public void cdestroy(Widget w) {
   if (w instanceof Channel) {
     Channel chan = (Channel) w;
     if (chan == sel) sel = null;
     chansel.rm(chan);
   }
 }
コード例 #14
0
ファイル: ChatUI.java プロジェクト: Trojanz/Custom-Salem
 private void expand() {
   resize(new Coord(sz.x, 100));
   setcanfocus(true);
   if (sel != null) sel.show();
   chansel.show();
   expanded = true;
 }
コード例 #15
0
ファイル: ChatUI.java プロジェクト: Trojanz/Custom-Salem
 private void contract() {
   resize(new Coord(sz.x, 50));
   setcanfocus(false);
   if (sel != null) sel.hide();
   chansel.hide();
   expanded = false;
 }
コード例 #16
0
  public void addTarget(Target target) {
    // 向targets队列中加入一个任务
    SocketChannel socketChannel = null;
    try {
      socketChannel = SocketChannel.open();
      socketChannel.configureBlocking(false);
      socketChannel.connect(target.address);

      target.channel = socketChannel;
      target.connectStart = System.currentTimeMillis();

      synchronized (targets) {
        targets.add(target);
      }
      selector.wakeup();
    } catch (Exception x) {
      if (socketChannel != null) {
        try {
          socketChannel.close();
        } catch (IOException xx) {
        }
      }
      target.failure = x;
      addFinishedTarget(target);
    }
  }
コード例 #17
0
ファイル: ShowComp.java プロジェクト: vishalshar/NetMon
    void add(Target t) {
      SocketChannel sc = null;
      try {

        sc = SocketChannel.open();
        sc.configureBlocking(false);

        boolean connected = sc.connect(t.address);

        t.channel = sc;
        t.connectStart = System.currentTimeMillis();

        if (connected) {
          t.connectFinish = t.connectStart;
          sc.close();
          printer.add(t);
        } else {
          synchronized (pending) {
            pending.add(t);
          }

          sel.wakeup();
        }
      } catch (IOException x) {
        if (sc != null) {
          try {
            sc.close();
          } catch (IOException xx) {
          }
        }
        t.failure = x;
        printer.add(t);
      }
    }
コード例 #18
0
 public PingClient() throws IOException {
   selector = Selector.open();
   Connector connector = new Connector();
   Printer printer = new Printer();
   connector.start();
   printer.start();
   receiveTarget();
 }
コード例 #19
0
ファイル: ChatUI.java プロジェクト: Trojanz/Custom-Salem
 public void newchild(Widget w) {
   if (w instanceof Channel) {
     Channel chan = (Channel) w;
     select(chan);
     chansel.add(chan);
     if (!expanded) chan.hide();
   }
 }
コード例 #20
0
ファイル: ChatUI.java プロジェクト: Trojanz/Custom-Salem
 public ChatUI(Coord c, int w, Widget parent) {
   super(c.add(0, -50), new Coord(w, 50), parent);
   chansel = new Selector(Coord.z, new Coord(selw, sz.y));
   chansel.hide();
   base = c;
   setfocusctl(true);
   setcanfocus(false);
 }
コード例 #21
0
ファイル: NSUUID.java プロジェクト: nagyistoce/robovm
/**
 * <div class="javadoc">
 *
 * @see <a
 *     href="https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/ObjC_classic/../../../../Foundation/Reference/NSUUID_Class/Reference/Reference.html">NSUUID
 *     Class Reference</a>
 * @since Available in iOS 6.0 and later. </div>
 */
/*<library>*/ @Library("Foundation") /*</library>*/
@NativeClass
public class /*<name>*/ NSUUID /*</name>*/ extends /*<extends>*/ NSObject /*</extends>*/
/*<implements>*/
/*</implements>*/ {

  static {
    ObjCRuntime.bind(/*<name>*/ NSUUID /*</name>*/.class);
  }

  private static final ObjCClass objCClass =
      ObjCClass.getByType(/*<name>*/ NSUUID /*</name>*/.class);

  /*<constructors>*/
  protected NSUUID(SkipInit skipInit) {
    super(skipInit);
  }

  public NSUUID() {}

  /*</constructors>*/
  /*<properties>*/

  /*</properties>*/
  /*<methods>*/

  private static final Selector UUIDString = Selector.register("UUIDString");

  @Bridge
  private static native String objc_asString(NSUUID __self__, Selector __cmd__);

  @Bridge
  private static native String objc_asStringSuper(ObjCSuper __super__, Selector __cmd__);
  /**
   * @see <a
   *     href="https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/ObjC_classic/../../../../Foundation/Reference/NSUUID_Class/Reference/Reference.html#//apple_ref/occ/instm/NSUUID/UUIDString">-
   *     (NSString *)UUIDString</a>
   * @since Available in iOS 6.0 and later.
   */
  public String asString() {
    if (customClass) {
      return objc_asStringSuper(getSuper(), UUIDString);
    } else {
      return objc_asString(this, UUIDString);
    }
  }
  /*</methods>*/
  /*<callbacks>*/
  static class Callbacks {
    @Callback
    @BindSelector("UUIDString")
    public static String asString(NSUUID __self__, Selector __cmd__) {
      return __self__.asString();
    }
  }
  /*</callbacks>*/

}
コード例 #22
0
    public void sendMessage(Address address, byte[] message) throws java.io.IOException {
      Socket s = null;
      SocketEntry entry = (SocketEntry) sockets.get(address);
      if (logger.isDebugEnabled()) {
        logger.debug("Looking up connection for destination '" + address + "' returned: " + entry);
        logger.debug(sockets.toString());
      }
      if (entry != null) {
        s = entry.getSocket();
      }
      if ((s == null) || (s.isClosed())) {
        if (logger.isDebugEnabled()) {
          logger.debug("Socket for address '" + address + "' is closed, opening it...");
        }
        SocketChannel sc = null;
        try {
          // Open the channel, set it to non-blocking, initiate connect
          sc = SocketChannel.open();
          sc.configureBlocking(false);
          sc.connect(
              new InetSocketAddress(
                  ((TcpAddress) address).getInetAddress(), ((TcpAddress) address).getPort()));
          s = sc.socket();
          entry = new SocketEntry((TcpAddress) address, s);
          entry.addMessage(message);
          sockets.put(address, entry);

          synchronized (pending) {
            pending.add(entry);
          }

          selector.wakeup();
          logger.debug("Trying to connect to " + address);
        } catch (IOException iox) {
          logger.error(iox);
          throw iox;
        }
      } else {
        entry.addMessage(message);
        synchronized (pending) {
          pending.add(entry);
        }
        selector.wakeup();
      }
    }
コード例 #23
0
ファイル: JavaNewIO.java プロジェクト: juniuszhou/java
  public void run() {
    try {
      SocketChannel sc = SocketChannel.open();
      InetSocketAddress sinaAddr = new InetSocketAddress("sina.com", 80);
      sc.socket().connect(sinaAddr);

      // init a selector via helper class selector provider
      Selector aSel = SelectorProvider.provider().openSelector();

      Socket soc = new Socket("host", 80);
      soc.getChannel().register(aSel, SelectionKey.OP_ACCEPT);

      // init a channel for server socket. method 1
      ServerSocketChannel ssc = ServerSocketChannel.open();
      ssc.configureBlocking(true);

      // method 2, get server socket first, then init its channel
      ServerSocket ss = new ServerSocket();
      ServerSocketChannel ssc2 = ss.getChannel();

      // set socket channel as non blocking.
      ssc.configureBlocking(false);

      InetSocketAddress isa = new InetSocketAddress("localhost", 9999);
      ssc.socket().bind(isa);

      SelectionKey acceptKey = ssc.register(aSel, SelectionKey.OP_ACCEPT);
      int keysAdded = 0;
      while ((keysAdded = aSel.select()) > 0) {
        Set readyKeys = aSel.selectedKeys();
        Iterator i = readyKeys.iterator();
        while (i.hasNext()) {
          SelectionKey sk = (SelectionKey) i.next();
          i.remove();
          ServerSocketChannel n = (ServerSocketChannel) sk.channel();
          // now we got a new socket and its channel after accept in server
          Socket s = n.accept().socket();
          SocketChannel socketChannel = s.getChannel();
          socketChannel.register(aSel, SelectionKey.OP_READ);
        }
      }
    } catch (Exception e) {

    }
  }
コード例 #24
0
ファイル: ConjReglas.java プロジェクト: Navieclipse/KEEL
 /** Remove complex with repetitive attributes */
 public void eliminaNulos() {
   boolean salir;
   for (int i = 0; i < this.size(); i++) {
     Complejo aux = this.getRegla(i);
     salir = false;
     for (int j = 0; (j < aux.size() - 1) && (!salir); j++) {
       Selector s = aux.getSelector(j);
       for (int h = j + 1; (h < aux.size()) && (!salir); h++) {
         Selector s2 = aux.getSelector(h);
         if (s.compareTo(s2) < 2) { // mismo atributo
           this.deleteRegla(i); // borrando
           salir = true;
           i--;
         }
       }
     }
   }
 }
コード例 #25
0
ファイル: ConjReglas.java プロジェクト: Navieclipse/KEEL
  /**
   * Remove repetitive complex(at1 = 0 ^ at2 = 0 -- at2 = 0 ^ at1 = 0)
   *
   * @param tam Size of the star
   */
  public void eliminaRepetidos(int tam) {
    for (int i = 0; i < this.size() - 1; i++) {
      // for (int i = 0; i < tam; i++) {
      Complejo aux = this.getRegla(i);
      boolean seguir = true;
      for (int j = i + 1; (j < this.size()) && (seguir); j++) {
        Complejo aux2 = this.getRegla(j);
        // seguir = false;
        boolean parar = false;
        for (int l = 0; (l < aux.size()) && (!parar); l++) {
          Selector s = aux.getSelector(l);
          boolean salir = false;
          for (int h = 0; (h < aux2.size()) && (!salir); h++) {
            Selector s2 = aux2.getSelector(h);
            // System.out.println("Comparando ");

            if (s.compareTo(s2) == 0) { // son iguales
              salir = true; // paso a ver el siguiente selector (si eso)
              /* System.out.println("selectores iguales");
                 System.out.println("regla "+(i+1)+" y "+(j+1));
              s.print();s2.print();*/
              if (l == aux.size() - 1) {

                /* System.out.println("\nEstos son los complejos repetidos:");
                aux.print();
                aux2.print();*/

                seguir = false;
                this.deleteRegla(i); // borro porque est�repe totalmente
                /*System.out.println("Se borra la regla "+(i+1));
                aux.print();*/
                i--;
              }
            }
          }
          parar = !salir; // si salir == true -> no paro (parar = false)
        }
      }
    }
  }
コード例 #26
0
ファイル: ChatUI.java プロジェクト: Trojanz/Custom-Salem
 public boolean keydown(KeyEvent ev) {
   boolean M = (ev.getModifiersEx() & (KeyEvent.META_DOWN_MASK | KeyEvent.ALT_DOWN_MASK)) != 0;
   if (qline != null) {
     if (M && (ev.getKeyCode() == KeyEvent.VK_UP)) {
       Channel prev = this.sel;
       while (chansel.up()) {
         if (this.sel instanceof EntryChannel) break;
       }
       if (!(this.sel instanceof EntryChannel)) {
         select(prev);
         return (true);
       }
       qline = new QuickLine((EntryChannel) sel);
       return (true);
     } else if (M && (ev.getKeyCode() == KeyEvent.VK_DOWN)) {
       Channel prev = this.sel;
       while (chansel.down()) {
         if (this.sel instanceof EntryChannel) break;
       }
       if (!(this.sel instanceof EntryChannel)) {
         select(prev);
         return (true);
       }
       qline = new QuickLine((EntryChannel) sel);
       return (true);
     }
     qline.key(ev);
     return (true);
   } else {
     if (M && (ev.getKeyCode() == KeyEvent.VK_UP)) {
       chansel.up();
       return (true);
     } else if (M && (ev.getKeyCode() == KeyEvent.VK_DOWN)) {
       chansel.down();
       return (true);
     }
     return (super.keydown(ev));
   }
 }
コード例 #27
0
ファイル: Overlord.java プロジェクト: rf/bitster
  public Overlord() {
    try {
      selector = Selector.open();
      queue = new ConcurrentLinkedQueue<Communicator>();

      // open the pipe and register it with our selector
      pipe = Pipe.open();
      pipe.sink().configureBlocking(false);
      pipe.source().configureBlocking(false);
      pipe.source().register(selector, SelectionKey.OP_READ);
    } catch (IOException e) {
      throw new RuntimeException("select() failed");
    }
  }
コード例 #28
0
  void checkIO() {
    long timeout;

    if (NewConnections.size() > 0) {
      timeout = -1;
    } else if (!Timers.isEmpty()) {
      long now = new Date().getTime();
      long k = Timers.firstKey();
      long diff = k - now;

      if (diff <= 0) timeout = -1; // don't wait, just poll once
      else timeout = diff;
    } else {
      timeout = 0; // wait indefinitely
    }

    try {
      if (timeout == -1) mySelector.selectNow();
      else mySelector.select(timeout);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
コード例 #29
0
ファイル: ConjReglas.java プロジェクト: Navieclipse/KEEL
 /**
  * Remove rules are the same ina semantic way(At = 1, At <> 0, At = [0,1])
  *
  * @param tam int Size of the star
  */
 public void eliminaSubsumidos(int tam) {
   // for (int i = 0; i < this.size() - 1; i++) {
   for (int i = 0; i < tam; i++) {
     Complejo aux = this.getRegla(i);
     boolean seguir = true;
     for (int j = i + 1; (j < this.size()) && (seguir); j++) {
       Complejo aux2 = this.getRegla(j);
       seguir = false;
       boolean parar = false;
       for (int l = 0; (l < aux.size()) && (!parar); l++) {
         Selector s = aux.getSelector(l);
         boolean salir = false;
         for (int h = 0; (h < aux2.size()) && (!salir); h++) {
           Selector s2 = aux2.getSelector(h);
           if ((s.compareTo(s2) == -3) || (s.compareTo(s2) == 0)) { // mirar compareTo en Selector
             salir = true; // paso a ver el siguiente selector (si eso)
             if ((l == aux.size() - 1)
                 && (aux.getDistribucionClase(0) == aux2.getDistribucionClase(0))) {
               // if (l == aux.size() - 1) {
               /*
               System.out.println("\nEstos son los complejos subsumidos:");
               aux.print();
               aux2.print();
               */
               seguir = false;
               this.deleteRegla(
                   i); // tienen los mismos atributos y misma distribucion (son semanticament =)
               i--;
             }
           }
         }
         parar = !salir; // si salir == true -> no paro (parar = false)
       }
     }
   }
 }
コード例 #30
0
  void processIO() {
    Iterator<SelectionKey> it = mySelector.selectedKeys().iterator();
    while (it.hasNext()) {
      SelectionKey k = it.next();
      it.remove();

      if (k.isConnectable()) isConnectable(k);
      else if (k.isAcceptable()) isAcceptable(k);
      else {
        if (k.isWritable()) isWritable(k);

        if (k.isReadable()) isReadable(k);
      }
    }
  }