001 /*
002 * Copyright (C) 2011 eXo Platform SAS.
003 *
004 * This is free software; you can redistribute it and/or modify it
005 * under the terms of the GNU Lesser General Public License as
006 *
007 * published by the Free Software Foundation; either version 2.1 of
008 * the License, or (at your option) any later version.
009 *
010 * This software is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013 * Lesser General Public License for more details.
014 *
015 * You should have received a copy of the GNU Lesser General Public
016 * License along with this software; if not, write to the Free
017 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
018 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
019 */
020
021 package org.crsh.term.processor;
022
023 /**
024 * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
025 */
026 final class Status {
027
028 /** . */
029 private final State state;
030
031 /** . */
032 private final boolean available;
033
034 Status(State state, boolean available) {
035 this.state = state;
036 this.available = available;
037 }
038
039 public State getState() {
040 return state;
041 }
042
043 public boolean isAvailable() {
044 return available;
045 }
046
047 public boolean isBusy() {
048 return !available;
049 }
050
051 @Override
052 public boolean equals(Object o) {
053 if (o == this) {
054 return true;
055 } else if (o instanceof Status) {
056 Status that = (Status)o;
057 return state == that.state && available == that.available;
058 } else {
059 return false;
060 }
061 }
062 }