X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTKeypress.java;h=34b286fec1e35b39ecb25acbc6de7a79187e218c;hb=6ba187ac15f387dd7758c10ed1bd90f34bd32892;hp=5d1eabc9889adc057fdbda821e91de5b52c09d5e;hpb=e16dda65585466c8987bd1efd718431450a96605;p=fanfix.git diff --git a/src/jexer/TKeypress.java b/src/jexer/TKeypress.java index 5d1eabc..34b286f 100644 --- a/src/jexer/TKeypress.java +++ b/src/jexer/TKeypress.java @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2016 Kevin Lamonte + * Copyright (C) 2017 Kevin Lamonte * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -296,6 +296,23 @@ public final class TKeypress { && (shift == that.shift)); } + /** + * Comparison check, omitting the ctrl/alt/shift flags. + * + * @param rhs another TKeypress instance + * @return true if all fields (except for ctrl/alt/shift) are equal + */ + public boolean equalsWithoutModifiers(final Object rhs) { + if (!(rhs instanceof TKeypress)) { + return false; + } + + TKeypress that = (TKeypress) rhs; + return ((isFunctionKey == that.isFunctionKey) + && (keyCode == that.keyCode) + && (ch == that.ch)); + } + /** * Hashcode uses all fields in equals(). *