<commit_before>package com.opera.core.systems;

import java.awt.Dimension;
import java.awt.Point;

import com.opera.core.systems.scope.protos.DesktopWmProtos.QuickWidgetInfo;
import com.opera.core.systems.scope.protos.DesktopWmProtos.DesktopWindowRect;

public class QuickWidget {
		private final QuickWidgetInfo info; // or just int objectId
		//private final OperaDriver parent;
		//private final IOperaExec execService;
		
		public QuickWidget(QuickWidgetInfo info) {
	        //this.parent = parent;
	        this.info = info;
	        //execService = parent.getExecService();
	    }
		
		public String getName() {
			return info.getName();
		}

		public String getText() {
			return info.getText();
		}
		
		/* (non-Javadoc)
		 * @see com.opera.core.systems.IOperaWidget#isEnabled()
		 */
		public boolean isDefault() {
			return info.getDefaultLook();
		}
		
		public boolean hasFocusedLook() {
			return info.getFocusedLook();
		}

		public boolean isEnabled() {
			return info.getEnabled();
		}
		
		/* (non-Javadoc)
		 * @see com.opera.core.systems.IOperaWidget#isSelected()
		 */
		public boolean isSelected() {
			return info.getState() == 1;
		}
		
		/* (non-Javadoc)
		 * @see com.opera.core.systems.IOperaWidget#isVisible()
		 * TODO, FIXME: This needs to handle also if the dialog is not expanded, is off_screen etc.
		 */
		public boolean isVisible(){
			return info.getVisible() != 0 ? true : false; 
		}
		
		public boolean isDefault() {
			return info.getDefaultLook() &&  info.getFocusedLook();
		}
		
		
		/* (non-Javadoc)
		 * @see com.opera.core.systems.IOperaWidget#toggle()
		 */
		public boolean toggle() {
			// TODO FIXME
			return false; 
		}
		
		private DesktopWindowRect getRect() {
			return info.getRect();
		}
		
		
		public Point getLocation() {
			DesktopWindowRect rect = getRect();
			return new Point(rect.getX(), rect.getY());
		}

		/* (non-Javadoc)
		 * @see com.opera.core.systems.IOperaWidget#getSize()
		 */
		public Dimension getSize() {
			DesktopWindowRect rect = getRect();
			return new Dimension(rect.getWidth(), rect.getHeight());
		}

		@Override
		public boolean equals(Object obj) {
			if(obj instanceof QuickWidget) {
				QuickWidget ref = (QuickWidget) obj;
				return (ref.getName().equals(this.getName()));
			}
			return false;
		}
		
		@Override
		public int hashCode() {
			int result = 42;
			result = 31 * result + getName().hashCode();
			return result;
		}
		
		@Override
		public String toString() {
			return "quickwidget" + hashCode();
		}
}


<commit_msg>Human-readable toString<commit_after>package com.opera.core.systems;

import java.awt.Dimension;
import java.awt.Point;

import com.opera.core.systems.scope.protos.DesktopWmProtos.QuickWidgetInfo;
import com.opera.core.systems.scope.protos.DesktopWmProtos.DesktopWindowRect;

public class QuickWidget {
		private final QuickWidgetInfo info; // or just int objectId
		//private final OperaDriver parent;
		//private final IOperaExec execService;
		
		public QuickWidget(QuickWidgetInfo info) {
	        //this.parent = parent;
	        this.info = info;
	        //execService = parent.getExecService();
	    }
		
		public String getName() {
			return info.getName();
		}

		public String getText() {
			return info.getText();
		}
		
		/* (non-Javadoc)
		 * @see com.opera.core.systems.IOperaWidget#isEnabled()
		 */
		public boolean isDefault() {
			return info.getDefaultLook();
		}
		
		// TODO: FIXME . isFocused()
		public boolean hasFocusedLook() {
			return info.getFocusedLook();
		}

		public boolean isEnabled() {
			return info.getEnabled();
		}
		
		/* (non-Javadoc)
		 * @see com.opera.core.systems.IOperaWidget#isSelected()
		 */
		public boolean isSelected() {
			return info.getValue() == 1;
		}
		
		/* (non-Javadoc)
		 * @see com.opera.core.systems.IOperaWidget#isVisible()
		 * TODO, FIXME: This needs to handle also if the dialog is not expanded, is off_screen etc.
		 */
		public boolean isVisible(){
			return info.getVisible() != 0 ? true : false; 
		}
		
		
		/* (non-Javadoc)
		 * @see com.opera.core.systems.IOperaWidget#toggle()
		 */
		public boolean toggle() {
			// TODO FIXME
			return false; 
		}
		
		private DesktopWindowRect getRect() {
			return info.getRect();
		}
		
		
		public Point getLocation() {
			DesktopWindowRect rect = getRect();
			return new Point(rect.getX(), rect.getY());
		}

		/* (non-Javadoc)
		 * @see com.opera.core.systems.IOperaWidget#getSize()
		 */
		public Dimension getSize() {
			DesktopWindowRect rect = getRect();
			return new Dimension(rect.getWidth(), rect.getHeight());
		}

		@Override
		public boolean equals(Object obj) {
			if(obj instanceof QuickWidget) {
				QuickWidget ref = (QuickWidget) obj;
				return (ref.getName().equals(this.getName()));
			}
			return false;
		}
		
		@Override
		public int hashCode() {
			int result = 42;
			result = 31 * result + getName().hashCode();
			return result;
		}
		
		@Override
		public String toString() {
			return "QuickWidget " + getName();
		}
		
		public String toFullString() {
			return "QuickWidget\n" +  
			  "       Widget name: " + info.getName() + "\n"
			+ "       type: " + info.getType()  + "\n"
			+ "    visible: " + info.getVisible() + "\n"
			+ "       text: " + info.getText() + "\n"
			+ "      state: " + info.getValue() + "\n"
			+ "    enabled: " + info.getEnabled() + "\n"
			+ "    default: " + info.getDefaultLook() + "\n"
			+ "    focused: " + info.getFocusedLook() + "\n"
			+ "          x: " + info.getRect().getX() + "\n"
			+ "          y: " + info.getRect().getY() + "\n"
			+ "      width: " + info.getRect().getWidth() + "\n"
			+ "     height: " + info.getRect().getHeight() + " \n";
		}
}



{'fraction_non_alphanumeric': 0.14205146281283046, 'fraction_numerical': 0.0021149101163200562, 'mean_word_length': 2.847457627118644, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '517554', 'n_tokens_mistral': 2215, 'n_tokens_neox': 1820, 'n_words': 404}