@Override public int hashCode() { int hash = type.name().hashCode(); if (ofType != null) { hash += ofType.name().hashCode(); } if (name != null) { hash += name.hashCode(); } return hash; }
private int getIndexOfType(String msg, Type t) { if (msg == null) { return 0; } String typeString = "%" + t.name().toLowerCase(); return StringUtils.indexOf(msg, typeString); }
@Override public Uri generateJsonUri() { Uri.Builder builder = new Uri.Builder(); builder.scheme(Constants.Reddit.getScheme()).authority(Constants.Reddit.getDomain()); builder.appendEncodedPath("user"); builder.appendPath(user); builder.appendEncodedPath(type.name().toLowerCase()); if (before != null) { builder.appendQueryParameter("before", before); } if (after != null) { builder.appendQueryParameter("after", after); } if (limit != null) { builder.appendQueryParameter("limit", String.valueOf(limit)); } builder.appendEncodedPath(".json"); return builder.build(); }
public JSONObject toJSON() throws JSONException { final JSONObject root = new JSONObject(); root.put("type", type.name()); root.put("name", LengthUtils.safeString(name, "auto")); root.put("timestamp", SDF.format(timestamp)); return root; }
// @see org.jgroups.protocols.Executing#sendToCoordinator(org.jgroups.protocols.Executing.Type, // long, org.jgroups.Address) @Override protected void sendToCoordinator(Type type, final long requestId, final Address value) { if (is_coord) { if (log.isTraceEnabled()) log.trace( "[redirect] <--> [" + local_addr + "] " + type.name() + " [" + value + (requestId != -1 ? " request id: " + requestId : "") + "]"); switch (type) { case RUN_REQUEST: handleTaskRequest(requestId, value); break; case CONSUMER_READY: handleConsumerReadyRequest(requestId, value); break; case CONSUMER_UNREADY: handleConsumerUnreadyRequest(requestId, value); break; } ; } else sendRequest(coord, type, requestId, value); }
private void throwIfSwipeToDeleteEnabled() { if (!swipeToDelete) { return; } throw new IllegalStateException( "SwipeToDelete not supported with this layout type: " + type.name()); }
protected static String calcLabel(ValueDescriptor descriptor) { final ValueDescriptorImpl valueDescriptor = (ValueDescriptorImpl) descriptor; final Value value = valueDescriptor.getValue(); if (value instanceof ObjectReference) { if (value instanceof StringReference) { return ((StringReference) value).value(); } else if (value instanceof ClassObjectReference) { ReferenceType type = ((ClassObjectReference) value).reflectedType(); return (type != null) ? type.name() : "{...}"; } else { final ObjectReference objRef = (ObjectReference) value; final Type type = objRef.type(); if (type instanceof ClassType && ((ClassType) type).isEnum()) { final String name = getEnumConstantName(objRef, (ClassType) type); if (name != null) { return name; } else { return type.name(); } } else { return ""; } } } else if (value == null) { //noinspection HardCodedStringLiteral return "null"; } else { return DebuggerBundle.message("label.undefined"); } }
public String evaluate(Program pgm, Variables vars, Instruction inst) throws Exception { Object[] objs = Bit.getObjects(pgm, vars, inst, 1); String type = objs[0].toString(); String msg = ""; for (int i = 1; i < objs.length; i++) { msg += objs[i].toString(); } Type t = null; try { t = Type.valueOf(type); } catch (Exception e) { Bit.error(inst, "Invalid type, first parameter must be the type"); } if (t == null) Bit.error(inst, "First parameter must be the type"); String i; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print(msg); i = br.readLine(); while (!t.isValidValue(i)) { System.out.println("The value must be a valid " + t.name()); System.out.print(msg); i = br.readLine(); } Reference ref = new Reference(); ref.type = t; ref.value = t.getObject(i, null); return pgm.getReferences().newReference(ref); }
/** * Creates a new Event. * * @param entityKey key of the entity bound to the event * @param type type of the event * @param comment comment */ public Event(final Key entityKey, final Type type, final String comment) { this.entityKey = entityKey; this.type = type.ordinal(); this.name = type.name(); this.comment = comment; setV(1); }
private Combo createTypeCombo() { final Combo c = new Combo(this, SWT.NONE); for (final Type type : Type.values()) { c.add(type.name()); } c.select(0); return c; }
/** @return - human readable representation of the address */ @Override public String toString() { try { return toSatoshiStyle(this); } catch (ValidationException e) { return network.name() + ":" + type.name() + ":" + ByteUtils.toHex(bytes); } }
public static Type fromString(final String value) { Type result = null; for (Type type : values()) { if (value.equals(type.name())) { result = type; } } return result; }
public String toString() { return type.name() + " [" + lock_name + ", owner=" + owner + (is_trylock ? ", trylock " : " ") + (timeout > 0 ? "(timeout=" + timeout + ")" : "" + "]"); }
public Text(String id, String name, Type type, Date date, String notes, String language) { this.id = id; this.name = name; this.state = State.Created.name(); this.type = type == null ? null : type.name(); this.date = date; this.notes = notes; this.language = language; }
private static Type _getType(String name) { name = StringUtil.toUpperCase(name); for (Type type : values()) { if (name.equals(type.name())) { return type; } } return Type.STRING; }
/** Given a Fantom type, get its stack type: 'A', 'I', 'J', etc */ public static int toJavaStackType(Type t) { if (!t.isNullable()) { if (t == Sys.VoidType) return 'V'; if (t == Sys.BoolType) return 'I'; if (t == Sys.IntType) return 'J'; if (t == Sys.FloatType) return 'D'; if (t.isJava() && t.podName().equals("[java]")) { // FFI primitives if (t.name().equals("byte")) return 'I'; if (t.name().equals("char")) return 'I'; if (t.name().equals("short")) return 'I'; if (t.name().equals("int")) return 'I'; if (t.name().equals("float")) return 'F'; // fail-safe if (t.name().equals("long")) return 'L'; if (t.name().equals("boolean")) return 'F'; if (t.name().equals("double")) return 'D'; } } return 'A'; }
private void buildTables(Index index) { pool = new StrongInternPool<String>(); classTable = new TreeMap<DotName, Integer>(); // Build the pool for all strings for (ClassInfo clazz : index.getKnownClasses()) { addClassName(clazz.name()); if (clazz.superName() != null) addClassName(clazz.superName()); for (DotName intf : clazz.interfaces()) addClassName(intf); for (Entry<DotName, List<AnnotationTarget>> entry : clazz.annotations().entrySet()) { addClassName(entry.getKey()); for (AnnotationTarget target : entry.getValue()) { if (target instanceof FieldInfo) { FieldInfo field = (FieldInfo) target; intern(field.name()); addClassName(field.type().name()); } else if (target instanceof MethodInfo) { MethodInfo method = (MethodInfo) target; intern(method.name()); for (Type type : method.args()) addClassName(type.name()); addClassName(method.returnType().name()); } else if (target instanceof MethodParameterInfo) { MethodParameterInfo param = (MethodParameterInfo) target; intern(param.method().name()); for (Type type : param.method().args()) addClassName(type.name()); addClassName(param.method().returnType().name()); } } } } poolIndex = pool.index(); }
private Object read( DataInput objBuffer, Type propertyType, boolean array, UnrealPackageReadOnly.ExportEntry arrayInner, String structName, UnrealPackageReadOnly up, String objClass, String pname) throws IOException { System.out.println("\t" + objClass + "->" + pname + " [" + propertyType.name() + "]"); return read(objBuffer, propertyType, array, arrayInner, structName, up); }
@Override public String toString() { return type.name() + "[" + start + "," + end + "] " + value() .replaceAll("\r", "\\\\r") .replaceAll("\n", "\\\\n") .replaceAll(" ", "\\\\s") .replaceAll("\t", "\\\\t"); }
@Override public String toString() { if (type == Type.HARDWARE_INTERRUPT) { return "HW interrupt " + TxInterruptController.hardwareInterruptDescription[interruptNumber].symbolicName + " (#" + interruptNumber + "d = 0x" + Format.asHex(interruptNumber, 2) + ")"; } else { return type.name(); } }
@Override public String toString() { StringBuilder builder = new StringBuilder(); for (Type type : Type.values()) { if (scores[type.ordinal()] > 0) { if (builder.length() > 0) { builder.append(", "); } builder.append(String.format("%s: %f", type.name(), scores[type.ordinal()])); } } return builder.toString(); }
@JsIgnore public Property( Type type, Object value, boolean reflectToAttribute, boolean readOnly, boolean notify, String computed, String observer) { setType(getGlobalObject(type.name())); setValue(value); setReflectToAttribute(reflectToAttribute); setReadOnly(readOnly); setNotify(notify); setComputed(computed); setObserver(observer); }
protected GridFSInputFile create(Type type, boolean createEmptyFile) { Assert.notNull(type, "Type must not be null"); GridFSInputFile file = this.fs.createFile(getFilename(getPath())); JailedResourcePath parent = this.path.getParent(); if (parent != null) { file.put(PARENT, parent.getUnjailedPath().toString()); } file.put(RESOURCE_TYPE, type.name()); if (createEmptyFile) { try { file.getOutputStream().close(); } catch (IOException e) { throw new ResourceException(e); } } return file; }
private static Map<String, Type> parseTestXmlWithMap(final String xPathExpr, final String xml) throws ParserConfigurationException, XPathExpressionException, IOException, SAXException { final Document document = DocumentBuilderFactory.newInstance() .newDocumentBuilder() .parse(new ByteArrayInputStream(xml.getBytes())); final XPath xPath = XPathFactory.newInstance().newXPath(); final NodeList list = (NodeList) xPath.compile(xPathExpr).evaluate(document, XPathConstants.NODESET); final Map<String, Type> map = new HashMap<>(); final ParserOptions options = ParserOptions.builder().stopOnError(true).suppressOutput(true).warningsFatal(true).build(); document.setUserData(XmlSchemaParser.ERROR_HANDLER_KEY, new ErrorHandler(options), null); for (int i = 0, size = list.getLength(); i < size; i++) { final Type t = new SetType(list.item(i)); map.put(t.name(), t); } return map; }
public QProfileChangeDto toDto() { QProfileChangeDto dto = new QProfileChangeDto(); dto.setChangeType(type.name()); dto.setProfileKey(getKey().qProfile()); Map<String, String> data = new HashMap<>(); data.put("key", getKey().toString()); data.put("ruleKey", getKey().ruleKey().toString()); parameters .entrySet() .stream() .filter(param -> !param.getKey().isEmpty()) .forEach(param -> data.put("param_" + param.getKey(), param.getValue())); if (StringUtils.isNotEmpty(severity)) { data.put("severity", severity); } if (inheritance != null) { data.put("inheritance", inheritance.name()); } dto.setData(data); return dto; }
public static String getFileName(final Type type, final Date timestamp) { return type.name() + "." + SDF.format(timestamp) + ".jso"; }
private Label createFieldTypeLabel(final Type type) { final Label l = new Label(this, SWT.NONE); l.setText(type.name()); return l; }
public String name() { return type.name(); }
@Override public String toString() { // Simple button - no items if (items.isEmpty()) { StringBuilder sb = new StringBuilder(renderComment()).append("<button type=\""); sb.append(type.name().toLowerCase()); sb.append("\" class=\"btn"); buttonClasses(sb); String classMerge = merge("class"); if (classMerge.length() > 0) { sb.append(" "); sb.append(classMerge); } sb.append("\""); if (disabled) { sb.append(" disabled=\"disabled\""); } sb.append(attributes("class", "type", "disabled")); sb.append(">"); for (Object c : content) { sb.append(c); } sb.append("</button>"); if (isInputGroupButton) { return "<span class=\"input-group-btn\">" + sb + "</span>"; } return sb.append(genLoadRemoteContentScript()).toString(); } // Dropdown button StringBuilder sb = new StringBuilder("<div class=\""); if (isInputGroupButton) { sb.append("input-group-btn"); } else { sb.append("btn-group"); } if (dropup) { sb.append(" dropup"); } sb.append("\">"); sb.append("<button type=\""); sb.append(type.name().toLowerCase()); sb.append("\" class=\"btn"); buttonClasses(sb); if (!split) { sb.append(" dropdown-toggle"); } String classMerge = merge("class"); if (classMerge.length() > 0) { sb.append(" "); sb.append(classMerge); } sb.append("\""); if (disabled) { sb.append(" disabled=\"disabled\""); } if (!split) { sb.append("data-toggle=\"dropdown\""); } sb.append(attributes("class", "type", "disabled", "data-toggle")); sb.append(">"); for (Object c : content) { sb.append(c); } if (!split) { sb.append(" <span class=\"caret\"></span>"); } sb.append("</button>"); if (split) { sb.append("<button type=\"button\" class=\"btn"); buttonClasses(sb); sb.append(" dropdown-toggle\" data-toggle=\"dropdown\">"); sb.append("<span class=\"caret\"></span>"); sb.append("<span class=\"sr-only\">Toggle Dropdown</span>"); sb.append("</button>"); } sb.append("<ul class=\"dropdown-menu\" role=\"menu\""); if (forEachExpresion != null && forEachExpresion.toString().trim().length() > 0) { sb.append(" data-bind=\"foreach: " + forEachExpresion + "\""); } sb.append(">"); for (DropdownItem item : items) { if (item instanceof Item) { sb.append("<li>"); sb.append(((Item) item).content); sb.append("</li>"); } else if (item instanceof Divider) { sb.append("<li class=\"divider\"></li>"); } else { sb.append("<li class=\"dropdown-header\">"); sb.append(((Header) item).content); sb.append("</li>"); } } sb.append("</ul>"); sb.append("</div>"); return sb.toString(); }
/** Given a Fantom type, get the Java type signature: fan/sys/Duration */ public static String toJavaTypeSig(Type t) { return toJavaTypeSig(t.podName(), t.name(), t.isNullable()); }